diff --git a/apps/gpu/tests/NumericalTests/Tests/NyTest/PostProcessingStrategy/NyTestPostProcessingStrategy.cpp b/apps/gpu/tests/NumericalTests/Tests/NyTest/PostProcessingStrategy/NyTestPostProcessingStrategy.cpp index ec87f5ed96a289dc06e02e94239f936518bf18c8..4147d91533ec010f0ca0c0b8960abab420c77ad9 100644 --- a/apps/gpu/tests/NumericalTests/Tests/NyTest/PostProcessingStrategy/NyTestPostProcessingStrategy.cpp +++ b/apps/gpu/tests/NumericalTests/Tests/NyTest/PostProcessingStrategy/NyTestPostProcessingStrategy.cpp @@ -6,6 +6,7 @@ #include "Tests/NyTest/NyTestParameterStruct.h" + std::shared_ptr<NyTestPostProcessingStrategy> NyTestPostProcessingStrategy::getNewInstance(std::shared_ptr<SimulationResults> simResult, std::shared_ptr<AnalyticalResults> analyticalResult, std::shared_ptr<NyTestParameterStruct> testPara, std::vector<std::string> dataToCalcTests) { return std::shared_ptr<NyTestPostProcessingStrategy>(new NyTestPostProcessingStrategy(simResult, analyticalResult, testPara, dataToCalcTests)); diff --git a/apps/gpu/tests/NumericalTests/Utilities/Calculator/FFTCalculator/FFTCalculator.cpp b/apps/gpu/tests/NumericalTests/Utilities/Calculator/FFTCalculator/FFTCalculator.cpp index 6942099bcf441e0f06b580a15a813f6eb34f5eec..1e06c7083b579a1657a2b474b1a3576eb815bdf8 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Calculator/FFTCalculator/FFTCalculator.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/Calculator/FFTCalculator/FFTCalculator.cpp @@ -7,6 +7,8 @@ #include <stdlib.h> #include <fstream> +#include <iostream> + std::shared_ptr<FFTCalculator> FFTCalculator::getInstance() { static std::shared_ptr<FFTCalculator> uniqueInstance; @@ -75,10 +77,24 @@ void FFTCalculator::init() double FFTCalculator::calcNy() { + std::cout << "======== BEGIN SUPER IMPORTANT OUTPUT ========" << std::endl; std::vector<double> logAmplitude = calcLogAmplitudeForAllSteps(); std::vector<double> linReg = calcLinReg(logAmplitude); + + std::cout << "lz: " << lz << "\t" << "lx: " << lx << "\t" << std::endl; + std::cout << "timestepLength: " << timeStepLength << "\t" << "linReg[0]: " << linReg.at(0) << "\t" << std::endl; + + std::cout << "amplitude: " << "\t"; + for (auto ampli : logAmplitude) { + std::cout << ampli << "\t"; + } + std::cout << std::endl; + double nu = -(1.0 / (((2.0 * M_PI / lz) * (2.0 * M_PI / lz) + (2.0 * M_PI / lx)*(2.0 * M_PI / lx)) * timeStepLength)) * linReg.at(0); + std::cout << nu << std::endl; + std::cout << "======== END SUPER IMPORTANT OUTPUT ========" << std::endl; + return nu; } @@ -153,6 +169,10 @@ std::vector<double> FFTCalculator::calcAmplitudeForAllSteps() else pos = 2 + (lz - 1); + std::cout << "DataSize: " << data.size() << std::endl; + std::cout << "fftResultsRe Size: " << fftResultsRe.size() << std::endl; + std::cout << "fftResultsIm Size: " << fftResultsIm.size() << std::endl; + for (int step = 0; step < data.size(); step++) amplitude.push_back(4.0 / (lx * lz) * sqrt(fftResultsRe.at(step).at(pos) * fftResultsRe.at(step).at(pos) + fftResultsIm.at(step).at(pos) * fftResultsIm.at(step).at(pos))); diff --git a/apps/gpu/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.cpp b/apps/gpu/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.cpp index b7a562bb5782367f963c81aa7dc6d3bde3557d4b..fb98a991d58267abf5b99185e54a9efd3a17082f 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.cpp @@ -1,66 +1,89 @@ #include "Y2dSliceToResults.h" -#include "VirtualFluids_GPU/Parameter/Parameter.h" #include "Utilities/Results/SimulationResults/SimulationResults.h" +#include "VirtualFluids_GPU/Parameter/Parameter.h" +#include <cmath> +#include <sstream> -std::shared_ptr<Y2dSliceToResults> Y2dSliceToResults::getNewInstance(std::shared_ptr<VectorWriterInformationStruct> vectorWriterInfo, unsigned int timeStepLength, std::shared_ptr<SimulationResults> simResults, unsigned int ySliceForCalculation) +std::shared_ptr<Y2dSliceToResults> +Y2dSliceToResults::getNewInstance(std::shared_ptr<VectorWriterInformationStruct> vectorWriterInfo, + unsigned int timeStepLength, std::shared_ptr<SimulationResults> simResults, + unsigned int ySliceForCalculation) { - return std::shared_ptr<Y2dSliceToResults>(new Y2dSliceToResults(vectorWriterInfo, timeStepLength, simResults, ySliceForCalculation)); + return std::shared_ptr<Y2dSliceToResults>( + new Y2dSliceToResults(vectorWriterInfo, timeStepLength, simResults, ySliceForCalculation)); } Y2dSliceToResults::Y2dSliceToResults() { - } -Y2dSliceToResults::Y2dSliceToResults(std::shared_ptr<VectorWriterInformationStruct> vectorWriterInfo, unsigned int timeStepLength, std::shared_ptr<SimulationResults> simResults, unsigned int ySliceForCalculation) - : ToVectorWriter(vectorWriterInfo, timeStepLength) +Y2dSliceToResults::Y2dSliceToResults(std::shared_ptr<VectorWriterInformationStruct> vectorWriterInfo, + unsigned int timeStepLength, std::shared_ptr<SimulationResults> simResults, + unsigned int ySliceForCalculation) + : ToVectorWriter(vectorWriterInfo, timeStepLength) { - this->simResults = simResults; - this->ySliceForCalculation = ySliceForCalculation; + this->simResults = simResults; + this->ySliceForCalculation = ySliceForCalculation; } void Y2dSliceToResults::writeTimestep(std::shared_ptr<Parameter> para, unsigned int t, int level) { - int timestep = t / timeStepLength; - maxX = para->getGridX().at(level); - maxY = para->getGridY().at(level); - maxZ = para->getGridZ().at(level); + int timestep = t / timeStepLength; + maxX = para->getGridX().at(level); + maxY = para->getGridY().at(level); + maxZ = para->getGridZ().at(level); + + int numberNodes = (maxX - 1) * (maxZ - 1); + std::vector<double> x(numberNodes), y(numberNodes), z(numberNodes); + std::vector<double> vx(numberNodes), vy(numberNodes), vz(numberNodes); + std::vector<double> press(numberNodes), rho(numberNodes); + std::vector<unsigned int> levels(numberNodes); + + ySliceForCalculation = maxY / 2; + for (int posZ = 0; posZ < maxZ - 1; posZ++) { + for (int posX = 0; posX < maxX - 1; posX++) { + int posResults = CoordResults2DTo1D(posX, posZ); + int posPara = CoordPara3DTo1D(posX, ySliceForCalculation, posZ); - int numberNodes = (maxX - 1) * (maxZ - 1); - std::vector<double> x(numberNodes), y(numberNodes), z(numberNodes); - std::vector<double> vx(numberNodes), vy(numberNodes), vz(numberNodes); - std::vector<double> press(numberNodes), rho(numberNodes); - std::vector<unsigned int> levels(numberNodes); + x.at(posResults) = (double)para->getParH(level)->coordinateX[posPara] - (double)1.0; + y.at(posResults) = (double)para->getParH(level)->coordinateY[posPara] - (double)1.0; + z.at(posResults) = (double)para->getParH(level)->coordinateZ[posPara] - (double)1.0; + vx.at(posResults) = (double)para->getParH(level)->velocityX[posPara] * (double)para->getVelocityRatio(); + // if (std::isnan(para->getParH(level)->velocityX[posPara])) { + // std::ostringstream oss; + // oss << "Vx is nan. Velocity in para->getParH(" << level << ")->velocityX[" << posPara + // << "] = " << para->getParH(level)->velocityX[posPara] << std::endl + // << "posResults is " << posResults << std::endl + // << "velocityRatio: " << para->getVelocityRatio() << std::endl + // << "maxY= " << maxY << std::endl + // << "ySlice= " << ySliceForCalculation << std::endl + // << "Broken 3D Index: (" << posX << ", " << ySliceForCalculation << ", " << posZ << ")" << std::endl; - for (int posZ = 0; posZ < maxZ - 1; posZ++) - { - for (int posX = 0; posX < maxX - 1; posX++) - { - int posResults = CoordResults2DTo1D(posX, posZ); - int posPara = CoordPara3DTo1D(posX, ySliceForCalculation, posZ); + // throw std::runtime_error(oss.str()); + // } - x.at(posResults) = (double)para->getParH(level)->coordinateX[posPara] - (double)1.0; - y.at(posResults) = (double)para->getParH(level)->coordinateY[posPara] - (double)1.0; - z.at(posResults) = (double)para->getParH(level)->coordinateZ[posPara] - (double)1.0; - vx.at(posResults) = (double)para->getParH(level)->velocityX[posPara] * (double)para->getVelocityRatio(); - vy.at(posResults) = (double)para->getParH(level)->velocityY[posPara] * (double)para->getVelocityRatio(); - vz.at(posResults) = (double)para->getParH(level)->velocityZ[posPara] * (double)para->getVelocityRatio(); - press.at(posResults) = (double)para->getParH(level)->pressure[posPara] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - rho.at(posResults) = (double)para->getParH(level)->rho[posPara] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - levels.at(posResults) = level; - } - } - simResults->addTimeStep(timestep, t, levels, x, y, z, vx, vy, vz, press, rho); + vy.at(posResults) = (double)para->getParH(level)->velocityY[posPara] * (double)para->getVelocityRatio(); + vz.at(posResults) = (double)para->getParH(level)->velocityZ[posPara] * (double)para->getVelocityRatio(); + press.at(posResults) = (double)para->getParH(level)->pressure[posPara] / (double)3.0 * + (double)para->getDensityRatio() * (double)para->getVelocityRatio() * + (double)para->getVelocityRatio(); + rho.at(posResults) = (double)para->getParH(level)->rho[posPara] / (double)3.0 * + (double)para->getDensityRatio() * (double)para->getVelocityRatio() * + (double)para->getVelocityRatio(); + levels.at(posResults) = level; + } + } + simResults->addTimeStep(timestep, t, levels, x, y, z, vx, vy, vz, press, rho); } int Y2dSliceToResults::CoordPara3DTo1D(int x, int y, int z) { - return z*maxY*maxX + y*maxX + x + 1; + return z * maxY * maxX + y * maxX + x + 1; } int Y2dSliceToResults::CoordResults2DTo1D(int x, int z) { - return z * (maxX - 1) + x; + return z * (maxX - 1) + x; } diff --git a/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.cpp index b454f1db95913562963561ef60d834ec0a9c1535..ef7f37dd9b6c5bee8878d4b7c4df076a5ff6b04d 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.cpp @@ -1,140 +1,129 @@ #include "ResultsImp.h" +#include <cmath> #include <iostream> +void logInvalidSimulationData(const std::string &quantity) +{ + std::cout << "done." << std::endl; + std::cout << "Invalid quantity: " << quantity << std::endl; + std::cout << "Simulation Result Data contains failure data." << std::endl; + std::cout << "Testing not possible." << std::endl; +} + +bool isValid(const double quantity, const std::string &quantityName) +{ + if (std::isnan(quantity)) { + logInvalidSimulationData(quantityName); + return false; + } + return true; +} + int ResultsImp::getNumberOfTimeSteps() { - return numberOfTimeSteps; + return numberOfTimeSteps; } -std::vector<std::vector<double> > ResultsImp::getVx() +std::vector<std::vector<double>> ResultsImp::getVx() { - return vx; + return vx; } -std::vector<std::vector<double> > ResultsImp::getVy() +std::vector<std::vector<double>> ResultsImp::getVy() { - return vy; + return vy; } -std::vector<std::vector<double> > ResultsImp::getVz() +std::vector<std::vector<double>> ResultsImp::getVz() { - return vz; + return vz; } int ResultsImp::getNumberOfXNodes() { - return xNodes; + return xNodes; } int ResultsImp::getNumberOfYNodes() { - return yNodes; + return yNodes; } int ResultsImp::getNumberOfZNodes() { - return zNodes; + return zNodes; } -std::vector<std::vector<double> > ResultsImp::getXNodes() +std::vector<std::vector<double>> ResultsImp::getXNodes() { - return x; + return x; } -std::vector<std::vector<double> > ResultsImp::getYNodes() +std::vector<std::vector<double>> ResultsImp::getYNodes() { - return y; + return y; } -std::vector<std::vector<double> > ResultsImp::getZNodes() +std::vector<std::vector<double>> ResultsImp::getZNodes() { - return z; + return z; } int ResultsImp::getTimeStepLength() { - return timeStepLength; + return timeStepLength; } std::vector<unsigned int> ResultsImp::getTimeSteps() { - return timeStep; + return timeStep; } std::vector<int> ResultsImp::getTime() { - return time; + return time; } -std::vector<std::vector<unsigned int> > ResultsImp::getLevels() +std::vector<std::vector<unsigned int>> ResultsImp::getLevels() { - return level; + return level; } -std::vector<std::vector<double> > ResultsImp::getPress() +std::vector<std::vector<double>> ResultsImp::getPress() { - return press; + return press; } -std::vector<std::vector<double> > ResultsImp::getRho() +std::vector<std::vector<double>> ResultsImp::getRho() { - return rho; + return rho; } int ResultsImp::getL0() { - return l0; + return l0; } bool ResultsImp::checkYourData() { - std::cout << "checking Simulation Results Data..."; - for (int i = 0; i < vx.size(); i++) { - for (int j = 0; j < vx.at(i).size(); j++) { - if (vx.at(i).at(j) != vx.at(i).at(j)) { - std::cout << "done." << std::endl; - std::cout << "Simulation Result Data contains failure data." << std::endl; - std::cout << "Testing not possible." << std::endl; - return false; - } - if (vy.at(i).at(j) != vy.at(i).at(j)) { - std::cout << "done." << std::endl; - std::cout << "Simulation Result Data contains failure data." << std::endl; - std::cout << "Testing not possible." << std::endl; - return false; - } - if (vz.at(i).at(j) != vz.at(i).at(j)) { - std::cout << "done." << std::endl; - std::cout << "Simulation Result Data contains failure data." << std::endl; - std::cout << "Testing not possible." << std::endl; - return false; - } - if (rho.at(i).at(j) != rho.at(i).at(j)) { - std::cout << "done." << std::endl; - std::cout << "Simulation Result Data contains failure data." << std::endl; - std::cout << "Testing not possible." << std::endl; - return false; - } - if (press.at(i).at(j) != press.at(i).at(j)) { - std::cout << "done." << std::endl; - std::cout << "Simulation Result Data contains failure data." << std::endl; - std::cout << "Testing not possible." << std::endl; - return false; - } - } - } - std::cout << "done." << std::endl; - std::cout << "Simulation Result Data contains no failure data." << std::endl; - return true; -} + std::cout << "checking Simulation Results Data..."; + for (int i = 0; i < vx.size(); i++) { + for (int j = 0; j < vx.at(i).size(); j++) { + bool valid = isValid(vx.at(i).at(j), "Vx") && isValid(vy.at(i).at(j), "Vy") && + isValid(vz.at(i).at(j), "Vz") && isValid(rho.at(i).at(j), "Rho") && + isValid(press.at(i).at(j), "Pressure"); -ResultsImp::ResultsImp(int l0) -{ - this->l0 = l0; + if (!valid) + return false; + } + } + std::cout << "done." << std::endl; + std::cout << "Simulation Result Data contains no failure data." << std::endl; + return true; } -ResultsImp::ResultsImp() +ResultsImp::ResultsImp(int l0) { - + this->l0 = l0; } diff --git a/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.h b/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.h index a9129dc88e461c29d330cadad0f43a5017c1c110..4e4cc80c9e3fefc86b174859bdc813b6dba22c99 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.h @@ -28,7 +28,7 @@ public: protected: ResultsImp(int l0); - ResultsImp(); + ResultsImp() = default; unsigned int numberOfTimeSteps; unsigned int timeStepLength; @@ -46,6 +46,5 @@ protected: int l0; private: - }; #endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.h b/apps/gpu/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.h index 80bcadd3e2655233309a7e4001409dd9e83c60d7..86d5c89b1747639bdc983627509d456601e836f3 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.h @@ -9,11 +9,12 @@ class SimulationParameter; class SimulationResults : public ResultsImp { public: - static std::shared_ptr<SimulationResults> getNewInstance(std::shared_ptr<SimulationParameter> simPara); - void addTimeStep(unsigned int timeStep, unsigned int time, std::vector<unsigned int> level, std::vector<double> x, std::vector<double> y, std::vector<double> z, std::vector<double> vx, std::vector<double> vy, std::vector<double> vz, std::vector<double> press, std::vector<double> rho); + static std::shared_ptr<SimulationResults> getNewInstance(std::shared_ptr<SimulationParameter> simPara); + void addTimeStep(unsigned int timeStep, unsigned int time, std::vector<unsigned int> level, std::vector<double> x, + std::vector<double> y, std::vector<double> z, std::vector<double> vx, std::vector<double> vy, + std::vector<double> vz, std::vector<double> press, std::vector<double> rho); private: - SimulationResults(std::shared_ptr<SimulationParameter> simPara); - + SimulationResults(std::shared_ptr<SimulationParameter> simPara); }; #endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/config.txt b/apps/gpu/tests/NumericalTests/config.txt index 65c9ab6ac6ea70b7955c4c24384dd9e89321aee8..fb88cd424f710c92d9e9f15a9de5deb98a2d85f7 100644 --- a/apps/gpu/tests/NumericalTests/config.txt +++ b/apps/gpu/tests/NumericalTests/config.txt @@ -115,7 +115,7 @@ GridPath512="E:\temp\numericalTests\grids\gridUni512x4x768" ################################################## # File Writing Information # ################################################## -WriteVTKFiles=false +WriteVTKFiles=true PathForVTKFileWriting="E:\temp\numericalTests\Output" StartStepFileWriter=0 diff --git a/apps/gpu/tests/NumericalTests/configK15_nu10tm2.txt b/apps/gpu/tests/NumericalTests/configK15_nu10tm2.txt index 9eda9977849a94a3f524e17e3e84ee76c25db91a..096787046a8bed7c3177fe0f4d49bfc0156f4ab3 100644 --- a/apps/gpu/tests/NumericalTests/configK15_nu10tm2.txt +++ b/apps/gpu/tests/NumericalTests/configK15_nu10tm2.txt @@ -86,7 +86,7 @@ NormalizeWith=amplitude TaylorGreenVortexUx32=true TaylorGreenVortexUx64=true TaylorGreenVortexUx128=true -TaylorGreenVortexUx256=false +TaylorGreenVortexUx256=true TaylorGreenVortexUx512=false TaylorGreenVortexUz32=false @@ -119,6 +119,6 @@ WriteVTKFiles=false FolderForVTKFileWriting=Output StartStepFileWriter=0 -WriteAnalyResultsToVTK=true +WriteAnalyResultsToVTK=false FolderLogFile=logFiles \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/configK15_nu10tm3.txt b/apps/gpu/tests/NumericalTests/configK15_nu10tm3.txt index 4afa29807de36525602a1d91ec6c72151be01104..401f390ebbe3b2c7044699831bf802296123b6ca 100644 --- a/apps/gpu/tests/NumericalTests/configK15_nu10tm3.txt +++ b/apps/gpu/tests/NumericalTests/configK15_nu10tm3.txt @@ -115,7 +115,7 @@ GridPath512=grids/gridUni512x4x768 ################################################## # File Writing Information # ################################################## -WriteVTKFiles=false +WriteVTKFiles=true FolderForVTKFileWriting=Output StartStepFileWriter=0 diff --git a/apps/gpu/tests/NumericalTests/configK15_nu10tm4.txt b/apps/gpu/tests/NumericalTests/configK15_nu10tm4.txt index 4bfd503e9668df2e80c61ee188c34ec9b6ddc4df..985040a272642ca6c426cd8e6a00f91c263449e6 100644 --- a/apps/gpu/tests/NumericalTests/configK15_nu10tm4.txt +++ b/apps/gpu/tests/NumericalTests/configK15_nu10tm4.txt @@ -115,7 +115,7 @@ GridPath512=grids/gridUni512x4x768 ################################################## # File Writing Information # ################################################## -WriteVTKFiles=false +WriteVTKFiles=true FolderForVTKFileWriting=Output StartStepFileWriter=0 diff --git a/apps/gpu/tests/NumericalTests/configK15_nu10tm5.txt b/apps/gpu/tests/NumericalTests/configK15_nu10tm5.txt index 89842b309225ca06328f48c3792e796128f2d2b8..9767e00e53d22c36405bace31479349b3fff5bcc 100644 --- a/apps/gpu/tests/NumericalTests/configK15_nu10tm5.txt +++ b/apps/gpu/tests/NumericalTests/configK15_nu10tm5.txt @@ -115,7 +115,7 @@ GridPath512=grids/gridUni512x4x768 ################################################## # File Writing Information # ################################################## -WriteVTKFiles=false +WriteVTKFiles=true FolderForVTKFileWriting=Output StartStepFileWriter=0 diff --git a/apps/gpu/tests/NumericalTests/configK17chim_nu10tm3.txt b/apps/gpu/tests/NumericalTests/configK17chim_nu10tm3.txt index 3c1ca94536dd2627fb0fffed4c0d1017e75451bf..6ca01d34f0d8fb224f67cdf786160c30dd2bbd97 100644 --- a/apps/gpu/tests/NumericalTests/configK17chim_nu10tm3.txt +++ b/apps/gpu/tests/NumericalTests/configK17chim_nu10tm3.txt @@ -1,7 +1,7 @@ ################################################## # GPU Mapping # ################################################## -Devices=1 +Devices=0 ################################################## # Basic Simulation Parameter # @@ -84,8 +84,8 @@ NormalizeWith=amplitude TaylorGreenVortexUx32=true TaylorGreenVortexUx64=true TaylorGreenVortexUx128=true -TaylorGreenVortexUx256=true -TaylorGreenVortexUx512=true +TaylorGreenVortexUx256=false +TaylorGreenVortexUx512=false TaylorGreenVortexUz32=false TaylorGreenVortexUz64=false @@ -93,11 +93,11 @@ TaylorGreenVortexUz128=false TaylorGreenVortexUz256=false TaylorGreenVortexUz512=false -ShearWave32=true -ShearWave64=true -ShearWave128=true -ShearWave256=true -ShearWave512=true +ShearWave32=false +ShearWave64=false +ShearWave128=false +ShearWave256=false +ShearWave512=false ################################################## # Grid Information # @@ -113,10 +113,10 @@ GridPath512=grids/gridUni512x4x768 ################################################## # File Writing Information # ################################################## -WriteVTKFiles=false +WriteVTKFiles=true FolderForVTKFileWriting=Output StartStepFileWriter=0 -WriteAnalyResultsToVTK=true +WriteAnalyResultsToVTK=false FolderLogFile=logFiles \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp index 21047604c0f45417cf3a992794363df4a85219f2..91943a150a4bcde4e11188aeae6f0304f8c32e94 100644 --- a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp +++ b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp @@ -51,8 +51,8 @@ #include "Output/DataWriter.h" #include "Kernel/Utilities/KernelFactory/KernelFactory.h" #include "PreProcessor/PreProcessorFactory/PreProcessorFactory.h" -#include "Kernel/Utilities/KernelFactory/KernelFactoryImp.h" #include "PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h" +#include "Kernel/Utilities/KernelFactory/KernelFactoryImp.h" #include "Kernel/Kernel.h" #include <cuda/DeviceInfo.h> @@ -69,7 +69,20 @@ std::string getFileName(const std::string& fname, int step, int myID) Simulation::Simulation(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> memoryManager, vf::gpu::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory) : para(para), cudaMemoryManager(memoryManager), communicator(communicator), kernelFactory(std::make_unique<KernelFactoryImp>()), - preProcessorFactory(std::make_unique<PreProcessorFactoryImp>()), dataWriter(std::make_unique<FileWriter>()) + preProcessorFactory(std::make_shared<PreProcessorFactoryImp>()), dataWriter(std::make_unique<FileWriter>()) +{ + init(gridProvider, bcFactory); +} + +Simulation::Simulation(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> memoryManager, + vf::gpu::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, std::shared_ptr<PreProcessorFactory> preProcessorFactory) + : para(para), cudaMemoryManager(memoryManager), communicator(communicator), kernelFactory(std::make_unique<KernelFactoryImp>()), + preProcessorFactory(preProcessorFactory), dataWriter(std::make_unique<FileWriter>()) +{ + init(gridProvider, bcFactory); +} + +void Simulation::init(GridProvider &gridProvider, BoundaryConditionFactory *bcFactory) { gridProvider.initalGridInformations(); diff --git a/src/gpu/VirtualFluids_GPU/LBM/Simulation.h b/src/gpu/VirtualFluids_GPU/LBM/Simulation.h index ac91c6c33d61e9f4e7811394798eca74651c9605..8f9a0700e1aa5953b908d2212e3e5ca8905e06b0 100644 --- a/src/gpu/VirtualFluids_GPU/LBM/Simulation.h +++ b/src/gpu/VirtualFluids_GPU/LBM/Simulation.h @@ -10,6 +10,7 @@ #include "Utilities/Buffer2D.hpp" #include "LBM/LB.h" + namespace vf::gpu { class Communicator; } class CudaMemoryManager; @@ -35,6 +36,9 @@ class Simulation public: Simulation(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> memoryManager, vf::gpu::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory); + + Simulation(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> memoryManager, + vf::gpu::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, std::shared_ptr<PreProcessorFactory> preProcessorFactory); ~Simulation(); void run(); @@ -45,12 +49,13 @@ public: void addEnstrophyAnalyzer(uint tAnalyse); private: + void init(GridProvider &gridProvider, BoundaryConditionFactory *bcFactory); void allocNeighborsOffsetsScalesAndBoundaries(GridProvider& gridProvider); void porousMedia(); void definePMarea(std::shared_ptr<PorousMedia>& pm); std::unique_ptr<KernelFactory> kernelFactory; - std::unique_ptr<PreProcessorFactory> preProcessorFactory; + std::shared_ptr<PreProcessorFactory> preProcessorFactory; Buffer2D <real> sbuf_t; Buffer2D <real> rbuf_t; diff --git a/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp b/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp index 8a58da5b53406155222d6db9d39b000317ba8cd7..dc2c859f9496c2b5dd6de0988e2c1ba0ea79fd7a 100644 --- a/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp +++ b/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp @@ -6,6 +6,7 @@ // ////////////////////////////////////////////////////////////////////////// #include "FileWriter.h" +#include <logger/Logger.h> #include <stdio.h> #include <fstream> @@ -52,6 +53,8 @@ void FileWriter::writeTimestep(std::shared_ptr<Parameter> para, unsigned int tim const unsigned int numberOfParts = para->getParH(level)->numberOfNodes / para->getlimitOfNodesForVTK() + 1; std::vector<std::string> fname; std::vector<std::string> fnameMed; + + VF_LOG_INFO(para->getFName()); for (unsigned int i = 1; i <= numberOfParts; i++) { fname.push_back(para->getFName() + "_bin_lev_" + StringUtil::toString<int>(level) + "_ID_" + StringUtil::toString<int>(para->getMyID()) + "_Part_" + StringUtil::toString<int>(i) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk");