From 5f42913c82a316c4082010113d54cdafa13a7bd7 Mon Sep 17 00:00:00 2001 From: Timon Habenicht <t.habenicht@tu-bs.de> Date: Thu, 17 May 2018 12:16:24 +0200 Subject: [PATCH] adds information to SimulationLogFiles --- .../ShearWaveLogFileInformation.cpp | 18 ++++++++++++------ .../ShearWaveLogFileInformation.h | 10 ++++++++-- .../TaylorGreenLogFileInformation.cpp | 19 +++++++++++++------ .../TaylorGreenLogFileInformation.h | 10 ++++++++-- .../ConfigFileReader/ConfigFileReader.cpp | 4 ++-- 5 files changed, 43 insertions(+), 18 deletions(-) diff --git a/targets/tests/NumericalTests/Simulations/ShearWave/LogFileInformation/ShearWaveLogFileInformation.cpp b/targets/tests/NumericalTests/Simulations/ShearWave/LogFileInformation/ShearWaveLogFileInformation.cpp index c33c5caa7..c15936673 100644 --- a/targets/tests/NumericalTests/Simulations/ShearWave/LogFileInformation/ShearWaveLogFileInformation.cpp +++ b/targets/tests/NumericalTests/Simulations/ShearWave/LogFileInformation/ShearWaveLogFileInformation.cpp @@ -1,19 +1,25 @@ #include "ShearWaveLogFileInformation.h" -std::shared_ptr<LogFileInformation> ShearWaveInformation::getNewInstance(double u0, double v0) +std::shared_ptr<LogFileInformation> ShearWaveInformation::getNewInstance(double u0, double v0, std::vector< bool> tests, std::vector< real> l) { - return std::shared_ptr<LogFileInformation>(new ShearWaveInformation(u0,v0)); + return std::shared_ptr<LogFileInformation>(new ShearWaveInformation(u0, v0, tests, l)); } std::string ShearWaveInformation::getOutput() { makeCenterHead("ShearWave Information"); - oss << "u0: " << u0 << std::endl; - oss << "v0: " << v0 << std::endl; - oss << std::endl; + for (int i = 0; i < tests.size(); i++) { + if (tests.at(i)) { + oss << "Lx:" << l.at(i) << std::endl; + oss << "u0: " << u0 / (l.at(i) / l0) << std::endl; + oss << "v0: " << v0 / (l.at(i) / l0) << std::endl; + oss << std::endl; + } + } return oss.str(); } -ShearWaveInformation::ShearWaveInformation(double u0, double v0) : u0(u0), v0(v0) +ShearWaveInformation::ShearWaveInformation(double u0, double v0, std::vector< bool> tests, std::vector< real> l) : u0(u0), v0(v0), tests(tests), l(l) { + l0 = 32; } \ No newline at end of file diff --git a/targets/tests/NumericalTests/Simulations/ShearWave/LogFileInformation/ShearWaveLogFileInformation.h b/targets/tests/NumericalTests/Simulations/ShearWave/LogFileInformation/ShearWaveLogFileInformation.h index 5e4e7e43c..bc34349d2 100644 --- a/targets/tests/NumericalTests/Simulations/ShearWave/LogFileInformation/ShearWaveLogFileInformation.h +++ b/targets/tests/NumericalTests/Simulations/ShearWave/LogFileInformation/ShearWaveLogFileInformation.h @@ -3,19 +3,25 @@ #include "Utilities/LogFileInformation/LogFileInformationImp.h" +#include "LBM\LB.h" + #include <memory> +#include <vector> class ShearWaveInformation : public LogFileInformationImp { public: - static std::shared_ptr<LogFileInformation> getNewInstance(double u0, double v0); + static std::shared_ptr<LogFileInformation> getNewInstance(double u0, double v0, std::vector< bool> tests, std::vector< real> l); std::string getOutput(); private: ShearWaveInformation() {}; - ShearWaveInformation(double u0, double v0); + ShearWaveInformation(double u0, double v0, std::vector< bool> tests, std::vector< real> l); double u0; double v0; + std::vector< bool> tests; + std::vector< real> l; + int l0; }; #endif \ No newline at end of file diff --git a/targets/tests/NumericalTests/Simulations/TaylorGreenVortex/LogFileInformation/TaylorGreenLogFileInformation.cpp b/targets/tests/NumericalTests/Simulations/TaylorGreenVortex/LogFileInformation/TaylorGreenLogFileInformation.cpp index c3c6bda88..2afc5cb73 100644 --- a/targets/tests/NumericalTests/Simulations/TaylorGreenVortex/LogFileInformation/TaylorGreenLogFileInformation.cpp +++ b/targets/tests/NumericalTests/Simulations/TaylorGreenVortex/LogFileInformation/TaylorGreenLogFileInformation.cpp @@ -1,19 +1,26 @@ #include "TaylorGreenLogFileInformation.h" -std::shared_ptr<LogFileInformation> TaylorGreenInformation::getNewInstance(double u0, double amplitude) +std::shared_ptr<LogFileInformation> TaylorGreenInformation::getNewInstance(double u0, double amplitude, std::vector< bool> tests, std::vector< real> l) { - return std::shared_ptr<LogFileInformation>(new TaylorGreenInformation(u0, amplitude)); + return std::shared_ptr<LogFileInformation>(new TaylorGreenInformation(u0, amplitude, tests, l)); } std::string TaylorGreenInformation::getOutput() { makeCenterHead("TaylorGreenVortex Information"); - oss << "u0: " << u0 << std::endl; - oss << "Amplitude: " << amplitude << std::endl; - oss << std::endl; + for (int i = 0; i < tests.size(); i++) { + if (tests.at(i)) { + oss << "Lx:" << l.at(i) << std::endl; + oss << "u0: " << u0 / (l.at(i) / l0) << std::endl; + oss << "Amplitude: " << amplitude / (l.at(i) / l0) << std::endl; + oss << std::endl; + } + } + return oss.str(); } -TaylorGreenInformation::TaylorGreenInformation(double u0, double amplitude) : u0(u0), amplitude(amplitude) +TaylorGreenInformation::TaylorGreenInformation(double u0, double amplitude, std::vector< bool> tests, std::vector< real> l) : u0(u0), amplitude(amplitude), tests(tests), l(l) { + l0 = 32; } diff --git a/targets/tests/NumericalTests/Simulations/TaylorGreenVortex/LogFileInformation/TaylorGreenLogFileInformation.h b/targets/tests/NumericalTests/Simulations/TaylorGreenVortex/LogFileInformation/TaylorGreenLogFileInformation.h index 9f9d86076..294f8caea 100644 --- a/targets/tests/NumericalTests/Simulations/TaylorGreenVortex/LogFileInformation/TaylorGreenLogFileInformation.h +++ b/targets/tests/NumericalTests/Simulations/TaylorGreenVortex/LogFileInformation/TaylorGreenLogFileInformation.h @@ -3,19 +3,25 @@ #include "Utilities/LogFileInformation/LogFileInformationImp.h" +#include "LBM\LB.h" + #include <memory> +#include <vector> class TaylorGreenInformation : public LogFileInformationImp { public: - static std::shared_ptr<LogFileInformation> getNewInstance(double u0, double amplitude); + static std::shared_ptr<LogFileInformation> getNewInstance(double u0, double amplitude, std::vector< bool> tests, std::vector< real> l); std::string getOutput(); private: TaylorGreenInformation() {}; - TaylorGreenInformation(double u0, double amplitude); + TaylorGreenInformation(double u0, double amplitude, std::vector< bool> tests, std::vector< real> l); double u0; double amplitude; + std::vector< bool> tests; + std::vector< real> l; + int l0; }; #endif \ No newline at end of file diff --git a/targets/tests/NumericalTests/Utilities/ConfigFileReader/ConfigFileReader.cpp b/targets/tests/NumericalTests/Utilities/ConfigFileReader/ConfigFileReader.cpp index 0e838586d..8c533214f 100644 --- a/targets/tests/NumericalTests/Utilities/ConfigFileReader/ConfigFileReader.cpp +++ b/targets/tests/NumericalTests/Utilities/ConfigFileReader/ConfigFileReader.cpp @@ -174,9 +174,9 @@ void ConfigFileReader::makeLogFileInformation() logInfo.push_back(BasicSimulationInfo::getNewInstance(numberOfTimeSteps, basisTimeStepLength, startStepCalculation, viscosity)); if (testShouldRun(tgv)) - logInfo.push_back(TaylorGreenInformation::getNewInstance(u0TGV, amplitudeTGV)); + logInfo.push_back(TaylorGreenInformation::getNewInstance(u0TGV, amplitudeTGV, tgv, l)); if (testShouldRun(sw)) - logInfo.push_back(ShearWaveInformation::getNewInstance(u0SW, v0SW)); + logInfo.push_back(ShearWaveInformation::getNewInstance(u0SW, v0SW, sw, l)); logInfo.push_back(SimulationTimeInformation::getNewInstance(simInfo, writeFiles)); -- GitLab