Skip to content
Snippets Groups Projects
Commit 65559bca authored by Timon Habenicht's avatar Timon Habenicht
Browse files

final Masterarbeit

parent f4ddfb7c
No related branches found
No related tags found
No related merge requests found
Showing
with 229 additions and 203 deletions
#ifndef L2_NORM_TEST_STRUCT_H
#define L2_NORM_TEST_STRUCT_H
#include <memory>
#include <vector>
class L2NormTest;
class L2NormInformation;
class L2NormPostProcessingStrategy;
struct L2NormTestStruct
{
std::shared_ptr<L2NormInformation> logFileInfo;
std::vector<std::shared_ptr<L2NormTest> > tests;
};
#endif
\ No newline at end of file
#ifndef L2_NORM_TEST_BETWEEN_KERNELS_STRUCT_H
#define L2_NORM_TEST_BETWEEN_KERNELS_STRUCT_H
#include <memory>
#include <string>
#include <vector>
class L2NormTestBetweenKernels;
class L2NormBetweenKernelPostProcessingStrategy;
class L2NormBetweenKernelsInformation;
struct L2NormTestBetweenKernelsStruct
{
std::shared_ptr<L2NormBetweenKernelsInformation> logFileInfo;
std::vector<std::shared_ptr<L2NormTestBetweenKernels> > tests;
};
#endif
\ No newline at end of file
#ifndef NY_TEST_STRUCT_H
#define NY_TEST_STRUCT_H
#include <memory>
#include <vector>
class NyTestLogFileInformation;
class NyTest;
struct NyTestStruct
{
std::shared_ptr<NyTestLogFileInformation> logFileInfo;
std::vector<std::shared_ptr<NyTest> > tests;
};
#endif
\ No newline at end of file
#ifndef PHI_TEST_STRUCT_H
#define PHI_TEST_STRUCT_H
#include <memory>
#include <vector>
class PhiTestLogFileInformation;
class PhiTest;
struct PhiTestStruct
{
std::shared_ptr<PhiTestLogFileInformation> logFileInfo;
std::vector<std::shared_ptr<PhiTest> > tests;
};
#endif
\ No newline at end of file
......@@ -47,18 +47,20 @@ void PhiTestPostProcessingStrategy::evaluate()
int zNodes = simResult->getNumberOfZNodes();
int timeStepLength = simResult->getTimeStepLength();
for (int i = 0; i < dataToCalculate.size(); i++) {
std::vector<std::vector<double>> dataForCalculation;
std::vector<std::vector<double>> basicData;
if (dataToCalculate.at(i) == "Vx")
dataForCalculation = reduceDataToTimeSteps(simResult->getVx());
basicData = simResult->getVx();
if (dataToCalculate.at(i) == "Vy")
dataForCalculation = reduceDataToTimeSteps(simResult->getVy());
basicData = simResult->getVy();
if (dataToCalculate.at(i) == "Vz")
dataForCalculation = reduceDataToTimeSteps(simResult->getVz());
basicData = simResult->getVz();
if (dataToCalculate.at(i) == "Press")
dataForCalculation = reduceDataToTimeSteps(simResult->getPress());
basicData = simResult->getPress();
if (dataToCalculate.at(i) == "Rho")
dataForCalculation = reduceDataToTimeSteps(simResult->getRho());
basicData = simResult->getRho();
std::vector<std::vector<double>> dataForCalculation;
dataForCalculation = reduceDataToTimeSteps(basicData);
phiDiff.at(i) = fftCalculator->calcPhiDiff(dataForCalculation, transpose, xNodes, zNodes, timeStepLength);
}
isEvaluated = true;
......
......@@ -4,6 +4,7 @@
#include "Utilities/Structs/LogFileParameterStruct.h"
#include "Utilities/Structs/NumericalTestStruct.h"
#include "Utilities/Structs/SimulationDataStruct.h"
#include "Utilities/Structs/TestStruct.h"
#include "Utilities/Structs/TestSimulationDataStruct.h"
#include "Simulations/TaylorGreenVortexUx/AnalyticalResults/AnalyticalResultsTaylorGreenVortexUx.h"
......@@ -27,19 +28,15 @@
#include "Tests/NyTest/NyTest.h"
#include "Tests/NyTest/LogFileInformation/NyTestLogFileInformation.h"
#include "Tests/NyTest/PostProcessingStrategy/NyTestPostProcessingStrategy.h"
#include "Tests/NyTest/NyTestStruct.h"
#include "Tests/PhiTest/PhiTest.h"
#include "Tests/PhiTest/LogFileInformation/PhiTestLogFileInformation.h"
#include "Tests/PhiTest/PostProcessingStrategy/PhiTestPostProcessingStrategy.h"
#include "Tests/PhiTest/PhiTestStruct.h"
#include "Tests/L2NormTest/L2NormTest.h"
#include "Tests/L2NormTest/LogFileInformation/L2NormLogFileInformation.h"
#include "Tests/L2NormTest/PostProcessingStrategy/PostProcessingStrategyL2NormTest.h"
#include "Tests/L2NormTest/L2NormTestStruct.h"
#include "Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernels.h"
#include "Tests/L2NormTestBetweenKernels/PostProcessingStrategy/L2NormBetweenKernelPostProcessingStrategy.h"
#include "Tests/L2NormTestBetweenKernels/LogFileInformation/L2NormLogFileInformationBetweenKernels.h"
#include "Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernelsStruct.h"
#include "Utilities/ColorConsoleOutput/ColorConsoleOutputImp.h"
#include "Utilities/Calculator/L2NormCalculator/L2NormCalculatorFactory/L2NormCalculatorFactoryImp.h"
......@@ -134,54 +131,20 @@ std::shared_ptr<NumericalTestStruct> NumericalTestFactoryImp::makeNumericalTestS
std::vector<std::shared_ptr<TestSimulationImp> > testSim = makeTestSimulations(simDataStruct->testSimData, configFileData->vectorWriterInfo, configFileData->ySliceForCalculation);
numTestStruct->testSimulations = testSim;
std::shared_ptr<BasicTestLogFileInformation> basicTestLogFileInfo = BasicTestLogFileInformation::getNewInstance();
std::vector<std::shared_ptr<TestLogFileInformation> > testLogFileInfo;
std::shared_ptr<PhiTestStruct> phiTestStruct = makePhiTestsStructs(configFileData->phiTestParameter, testSim, viscosity);
for (int i = 0; i < phiTestStruct->tests.size(); i++)
numTestStruct->tests.push_back(phiTestStruct->tests.at(i));
if (phiTestStruct->tests.size() > 0) {
testLogFileInfo.push_back(phiTestStruct->logFileInfo);
basicTestLogFileInfo->addTest("PhiTest", true);
}
else {
basicTestLogFileInfo->addTest("PhiTest", false);
}
std::shared_ptr<TestStruct> phiTestStruct = makePhiTestsStructs(configFileData->phiTestParameter, testSim, viscosity);
initTestStruct(phiTestStruct, numTestStruct, testLogFileInfo, basicTestLogFileInfo);
std::shared_ptr<NyTestStruct> nyTestStruct = makeNyTestsStructs(configFileData->nyTestParameter, testSim, viscosity);
for (int i = 0; i < nyTestStruct->tests.size(); i++)
numTestStruct->tests.push_back(nyTestStruct->tests.at(i));
if (nyTestStruct->tests.size() > 0) {
testLogFileInfo.push_back(nyTestStruct->logFileInfo);
basicTestLogFileInfo->addTest("NyTest", true);
}
else {
basicTestLogFileInfo->addTest("NyTest", false);
}
std::shared_ptr<TestStruct> nyTestStruct = makeNyTestsStructs(configFileData->nyTestParameter, testSim, viscosity);
initTestStruct(nyTestStruct, numTestStruct, testLogFileInfo, basicTestLogFileInfo);
std::shared_ptr<TestStruct> l2NormTestSruct = makeL2NormTestsStructs(configFileData->l2NormTestParameter, testSim);
initTestStruct(l2NormTestSruct, numTestStruct, testLogFileInfo, basicTestLogFileInfo);
std::shared_ptr<L2NormTestStruct> l2NormTestSruct = makeL2NormTestsStructs(configFileData->l2NormTestParameter, testSim);
for (int i = 0; i < l2NormTestSruct->tests.size(); i++)
numTestStruct->tests.push_back(l2NormTestSruct->tests.at(i));
if (l2NormTestSruct->tests.size() > 0) {
testLogFileInfo.push_back(l2NormTestSruct->logFileInfo);
basicTestLogFileInfo->addTest("L2NormTest", true);
}
else {
basicTestLogFileInfo->addTest("L2NormTest", false);
}
std::shared_ptr<L2NormTestBetweenKernelsStruct> l2NormTestBetweenKernelStruct = makeL2NormTestsBetweenKernelsStructs(configFileData->l2NormTestBetweenKernelsParameter, testSim, kernel);
for (int i = 0; i < l2NormTestBetweenKernelStruct->tests.size(); i++)
numTestStruct->tests.push_back(l2NormTestBetweenKernelStruct->tests.at(i));
if (l2NormTestBetweenKernelStruct->tests.size() > 0) {
testLogFileInfo.push_back(l2NormTestBetweenKernelStruct->logFileInfo);
basicTestLogFileInfo->addTest("L2NormTestBetweenKernel", true);
}
else {
basicTestLogFileInfo->addTest("L2NormTestBetweenKernel", false);
}
std::shared_ptr<TestStruct> l2NormTestBetweenKernelStruct = makeL2NormTestsBetweenKernelsStructs(configFileData->l2NormTestBetweenKernelsParameter, testSim, kernel);
initTestStruct(l2NormTestBetweenKernelStruct, numTestStruct, testLogFileInfo, basicTestLogFileInfo);
std::vector<std::shared_ptr<SimulationInfo> > simInfo;
for (int i = 0; i < simDataStruct->testSimData.size(); i++)
......@@ -286,36 +249,54 @@ std::vector<std::shared_ptr<TestSimulationImp> > NumericalTestFactoryImp::makeTe
return testSimumlations;
}
std::shared_ptr<PhiTestStruct> NumericalTestFactoryImp::makePhiTestsStructs(std::shared_ptr<PhiTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp>> testSimumlations, double viscosity)
std::shared_ptr<TestStruct> NumericalTestFactoryImp::makePhiTestsStructs(std::shared_ptr<PhiTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp>> testSimumlations, double viscosity)
{
std::shared_ptr<PhiTestStruct> testStruct = std::shared_ptr<PhiTestStruct>(new PhiTestStruct);
std::shared_ptr<TestStruct> testStruct = std::shared_ptr<TestStruct>(new TestStruct);
if (testParameter->basicTestParameter->runTest && testSimumlations.size() > 1) {
testStruct->logFileInfo = PhiTestLogFileInformation::getNewInstance(testParameter);
std::shared_ptr<PhiTestLogFileInformation> testLogFileInfo = PhiTestLogFileInformation::getNewInstance(testParameter);
std::vector<std::shared_ptr<PhiTestPostProcessingStrategy> > postProcessingStrategies;
for (int i = 0; i < testSimumlations.size(); i++)
postProcessingStrategies.push_back(PhiTestPostProcessingStrategy::getNewInstance(testSimumlations.at(i)->getSimulationResults(), testSimumlations.at(i)->getAnalyticalResults(), testParameter, testSimumlations.at(i)->getDataToCalcTests()));
for (int i = 0; i < testSimumlations.at(0)->getDataToCalcTests().size(); i++) {
std::vector<std::shared_ptr<PhiTest> > phiTests = makePhiTests(testParameter, testSimumlations, postProcessingStrategies, viscosity, testSimumlations.at(0)->getDataToCalcTests().at(i));
testStruct->logFileInfo->addTestGroup(phiTests);
testLogFileInfo->addTestGroup(phiTests);
for (int j = 0; j < phiTests.size(); j++)
testStruct->tests.push_back(phiTests.at(j));
}
testStruct->logFileInfo = testLogFileInfo;
testStruct->testName = "PhiTest";
}
return testStruct;
}
std::shared_ptr<NyTestStruct> NumericalTestFactoryImp::makeNyTestsStructs(std::shared_ptr<NyTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp>> testSimumlations, double viscosity)
std::vector<std::shared_ptr<PhiTest>> NumericalTestFactoryImp::makePhiTests(std::shared_ptr<PhiTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp>> testSim, std::vector<std::shared_ptr<PhiTestPostProcessingStrategy>> phiPostProStrategy, double viscosity, std::string dataToCalculate)
{
std::shared_ptr<NyTestStruct> testStruct = std::shared_ptr<NyTestStruct>(new NyTestStruct);
std::vector<std::shared_ptr<PhiTest> > phiTests;
for (int i = 1; i < testSim.size(); i++) {
for (int j = 0; j < i; j++) {
std::shared_ptr<PhiTest> test = PhiTest::getNewInstance(colorOutput, viscosity, testParameter, dataToCalculate);
test->addSimulation(testSim.at(j), testSim.at(j)->getSimulationInfo(), phiPostProStrategy.at(j));
test->addSimulation(testSim.at(i), testSim.at(i)->getSimulationInfo(), phiPostProStrategy.at(i));
if (testParameter->basicTestParameter->runTest && testSimumlations.size() > 1) {
testStruct->logFileInfo = NyTestLogFileInformation::getNewInstance(testParameter);
testSim.at(j)->registerSimulationObserver(test);
testSim.at(i)->registerSimulationObserver(test);
phiTests.push_back(test);
}
}
return phiTests;
}
std::shared_ptr<TestStruct> NumericalTestFactoryImp::makeNyTestsStructs(std::shared_ptr<NyTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp>> testSimumlations, double viscosity)
{
std::shared_ptr<TestStruct> testStruct = std::shared_ptr<TestStruct>(new TestStruct);
if (testParameter->basicTestParameter->runTest && testSimumlations.size() > 1) {
std::shared_ptr<NyTestLogFileInformation> testLogFileInfo = NyTestLogFileInformation::getNewInstance(testParameter);
std::vector<std::shared_ptr<NyTestPostProcessingStrategy> > postProcessingStrategies;
for (int i = 0; i < testSimumlations.size(); i++)
......@@ -323,26 +304,51 @@ std::shared_ptr<NyTestStruct> NumericalTestFactoryImp::makeNyTestsStructs(std::s
for (int i = 0; i < testSimumlations.at(0)->getDataToCalcTests().size(); i++) {
std::vector<std::shared_ptr<NyTest> > nyTests = makeNyTests(testParameter, testSimumlations, postProcessingStrategies, viscosity, testSimumlations.at(0)->getDataToCalcTests().at(i));
testStruct->logFileInfo->addTestGroup(nyTests);
testLogFileInfo->addTestGroup(nyTests);
for (int j = 0; j < nyTests.size(); j++)
testStruct->tests.push_back(nyTests.at(j));
}
testStruct->logFileInfo = testLogFileInfo;
testStruct->testName = "NyTest";
}
return testStruct;
}
std::shared_ptr<L2NormTestStruct> NumericalTestFactoryImp::makeL2NormTestsStructs(std::shared_ptr<L2NormTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp> > testSimumlations)
std::vector<std::shared_ptr<NyTest>> NumericalTestFactoryImp::makeNyTests(std::shared_ptr<NyTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp>> testSim, std::vector<std::shared_ptr<NyTestPostProcessingStrategy>> nuPostProStrategy, double viscosity, std::string dataToCalculate)
{
std::vector<std::shared_ptr<NyTest> > nyTests;
for (int i = 1; i < testSim.size(); i++) {
for (int j = 0; j < i; j++) {
std::shared_ptr<NyTest> test = NyTest::getNewInstance(colorOutput, viscosity, testParameter, dataToCalculate);
test->addSimulation(testSim.at(j), testSim.at(j)->getSimulationInfo(), nuPostProStrategy.at(j));
test->addSimulation(testSim.at(i), testSim.at(i)->getSimulationInfo(), nuPostProStrategy.at(i));
testSim.at(j)->registerSimulationObserver(test);
testSim.at(i)->registerSimulationObserver(test);
nyTests.push_back(test);
}
}
return nyTests;
}
std::shared_ptr<TestStruct> NumericalTestFactoryImp::makeL2NormTestsStructs(std::shared_ptr<L2NormTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp> > testSimumlations)
{
std::shared_ptr<L2NormTestStruct> testStruct = std::shared_ptr<L2NormTestStruct> (new L2NormTestStruct);
std::shared_ptr<TestStruct> testStruct = std::shared_ptr<TestStruct> (new TestStruct);
if (testParameter->basicTestParameter->runTest) {
std::vector<std::shared_ptr<L2NormPostProcessingStrategy> > postProcessingStrategies;
for (int i = 0; i < testSimumlations.size(); i++)
postProcessingStrategies.push_back(L2NormPostProcessingStrategy::getNewInstance(testSimumlations.at(i)->getSimulationResults(), testSimumlations.at(i)->getAnalyticalResults(), testParameter, l2NormCalculatorFactory, testSimumlations.at(i)->getDataToCalcTests()));
testStruct->tests = makeL2NormTests(testSimumlations, postProcessingStrategies, testParameter);
testStruct->logFileInfo = L2NormInformation::getNewInstance(testStruct->tests, testParameter, testSimumlations.at(0)->getDataToCalcTests());
std::vector<std::shared_ptr<L2NormTest> > tests = makeL2NormTests(testSimumlations, postProcessingStrategies, testParameter);
std::shared_ptr<L2NormInformation> testLogFileInfo = L2NormInformation::getNewInstance(tests, testParameter, testSimumlations.at(0)->getDataToCalcTests());
for(int i = 0; i < tests.size(); i++)
testStruct->tests.push_back(tests.at(i));
testStruct->logFileInfo = testLogFileInfo;
testStruct->testName = "L2NormTest";
}
return testStruct;
}
......@@ -363,9 +369,9 @@ std::vector<std::shared_ptr<L2NormTest> > NumericalTestFactoryImp::makeL2NormTes
return l2Tests;
}
std::shared_ptr<L2NormTestBetweenKernelsStruct> NumericalTestFactoryImp::makeL2NormTestsBetweenKernelsStructs(std::shared_ptr<L2NormTestBetweenKernelsParameterStruct> testPara, std::vector<std::shared_ptr<TestSimulationImp> > testSim, std::string kernelName)
std::shared_ptr<TestStruct> NumericalTestFactoryImp::makeL2NormTestsBetweenKernelsStructs(std::shared_ptr<L2NormTestBetweenKernelsParameterStruct> testPara, std::vector<std::shared_ptr<TestSimulationImp> > testSim, std::string kernelName)
{
std::shared_ptr<L2NormTestBetweenKernelsStruct> testStruct = std::shared_ptr<L2NormTestBetweenKernelsStruct>(new L2NormTestBetweenKernelsStruct);
std::shared_ptr<TestStruct> testStruct = std::shared_ptr<TestStruct>(new TestStruct);
if (testPara->basicTestParameter->runTest) {
......@@ -387,50 +393,15 @@ std::shared_ptr<L2NormTestBetweenKernelsStruct> NumericalTestFactoryImp::makeL2N
}else{
std::vector<std::shared_ptr<L2NormTestBetweenKernels> > tests = linkL2NormTestsBetweenKernels(testPara, testSim, postProcessingStrategies);
testStruct->tests = tests;
for (int i = 0; i < tests.size(); i++)
testStruct->tests.push_back(tests.at(i));
testStruct->logFileInfo = L2NormBetweenKernelsInformation::getNewInstance(tests, testPara, testSim.at(0)->getDataToCalcTests());
testStruct->testName = "L2NormTestBetweenKernel";
}
}
return testStruct;
}
std::vector<std::shared_ptr<PhiTest>> NumericalTestFactoryImp::makePhiTests(std::shared_ptr<PhiTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp>> testSim, std::vector<std::shared_ptr<PhiTestPostProcessingStrategy>> phiPostProStrategy, double viscosity, std::string dataToCalculate)
{
std::vector<std::shared_ptr<PhiTest> > phiTests;
for (int i = 1; i < testSim.size(); i++) {
for (int j = 0; j < i; j++) {
std::shared_ptr<PhiTest> test = PhiTest::getNewInstance(colorOutput, viscosity, testParameter, dataToCalculate);
test->addSimulation(testSim.at(j), testSim.at(j)->getSimulationInfo(), phiPostProStrategy.at(j));
test->addSimulation(testSim.at(i), testSim.at(i)->getSimulationInfo(), phiPostProStrategy.at(i));
testSim.at(j)->registerSimulationObserver(test);
testSim.at(i)->registerSimulationObserver(test);
phiTests.push_back(test);
}
}
return phiTests;
}
std::vector<std::shared_ptr<NyTest>> NumericalTestFactoryImp::makeNyTests(std::shared_ptr<NyTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp>> testSim, std::vector<std::shared_ptr<NyTestPostProcessingStrategy>> nuPostProStrategy, double viscosity, std::string dataToCalculate)
{
std::vector<std::shared_ptr<NyTest> > nyTests;
for (int i = 1; i < testSim.size(); i++) {
for (int j = 0; j < i; j++) {
std::shared_ptr<NyTest> test = NyTest::getNewInstance(colorOutput, viscosity, testParameter, dataToCalculate);
test->addSimulation(testSim.at(j), testSim.at(j)->getSimulationInfo(), nuPostProStrategy.at(j));
test->addSimulation(testSim.at(i), testSim.at(i)->getSimulationInfo(), nuPostProStrategy.at(i));
testSim.at(j)->registerSimulationObserver(test);
testSim.at(i)->registerSimulationObserver(test);
nyTests.push_back(test);
}
}
return nyTests;
}
std::vector<std::vector<std::shared_ptr<L2NormTestBetweenKernels> > > NumericalTestFactoryImp::makeL2NormTestsBetweenKernels(std::shared_ptr<L2NormTestBetweenKernelsParameterStruct> testPara, std::vector<std::shared_ptr<TestSimulationImp> > testSim, std::vector<std::shared_ptr<L2NormBetweenKernelPostProcessingStrategy> > postProcessingStrategies)
{
std::vector<std::vector<std::shared_ptr<L2NormTestBetweenKernels> > > testsForAllKernels;
......@@ -481,6 +452,19 @@ std::vector<std::shared_ptr<L2NormTestBetweenKernels> > NumericalTestFactoryImp:
return tests;
}
void NumericalTestFactoryImp::initTestStruct(std::shared_ptr<TestStruct> testStruct, std::shared_ptr<NumericalTestStruct> numericalTestStruct, std::vector<std::shared_ptr<TestLogFileInformation> > testLogFileInfo, std::shared_ptr<BasicTestLogFileInformation> basicTestLogFileInfo)
{
for (int i = 0; i < testStruct->tests.size(); i++)
numericalTestStruct->tests.push_back(testStruct->tests.at(i));
if (testStruct->tests.size() > 0) {
testLogFileInfo.push_back(testStruct->logFileInfo);
basicTestLogFileInfo->addTest(testStruct->testName, true);
}
else {
basicTestLogFileInfo->addTest(testStruct->testName, false);
}
}
std::shared_ptr<LogFileWriter> NumericalTestFactoryImp::makeLogFileWriter(std::vector<std::shared_ptr<TestLogFileInformation> > testLogFiles, std::shared_ptr<SimulationLogFileInformation> simLogInfo, std::vector<std::shared_ptr<SimulationInfo> > simInfo, std::string kernelName, double viscosity, int basicTimeStepLength, std::shared_ptr<LogFileParameterStruct> logFilePara, std::shared_ptr<BasicTestLogFileInformation> basicTestLogFileInfo)
{
std::shared_ptr<LogFileHead> logFileHead = LogFileHead::getNewInstance(logFilePara->devices);
......
......@@ -5,23 +5,21 @@
struct ConfigDataStruct;
struct GridInformationStruct;
struct L2NormTestStruct;
struct L2NormTestParameterStruct;
struct L2NormTestBetweenKernelsParameterStruct;
struct L2NormTestBetweenKernelsStruct;
struct LogFileParameterStruct;
struct NumericalTestStruct;
struct PhiTestStruct;
struct PhiTestParameterStruct;
struct NyTestStruct;
struct NyTestParameterStruct;
struct ShearWaveParameterStruct;
struct SimulationDataStruct;
struct TestStruct;
struct TaylorGreenVortexUxParameterStruct;
struct TaylorGreenVortexUzParameterStruct;
struct TestSimulationDataStruct;
struct VectorWriterInformationStruct;
class AnalyticalResults2DToVTKWriter;
class BasicTestLogFileInformation;
class ColorConsoleOutput;
......@@ -70,28 +68,25 @@ private:
std::vector<std::shared_ptr<TestSimulationImp> > makeTestSimulations(std::vector<std::shared_ptr<TestSimulationDataStruct> > testSimDataStruct, std::shared_ptr<VectorWriterInformationStruct> vectorWriterInfo, unsigned int ySliceForCalculation);
std::shared_ptr<PhiTestStruct> makePhiTestsStructs(std::shared_ptr<PhiTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp> > testSimumlations, double viscosity);
std::shared_ptr<NyTestStruct> makeNyTestsStructs(std::shared_ptr<NyTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp> > testSimumlations, double viscosity);
std::shared_ptr<L2NormTestStruct> makeL2NormTestsStructs(std::shared_ptr<L2NormTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp> > testSimumlations);
std::shared_ptr<L2NormTestBetweenKernelsStruct> makeL2NormTestsBetweenKernelsStructs(std::shared_ptr<L2NormTestBetweenKernelsParameterStruct> testPara, std::vector<std::shared_ptr<TestSimulationImp> > testSim, std::string kernelName);
std::shared_ptr<TestStruct> makePhiTestsStructs(std::shared_ptr<PhiTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp> > testSimumlations, double viscosity);
std::shared_ptr<TestStruct> makeNyTestsStructs(std::shared_ptr<NyTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp> > testSimumlations, double viscosity);
std::shared_ptr<TestStruct> makeL2NormTestsStructs(std::shared_ptr<L2NormTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp> > testSimumlations);
std::shared_ptr<TestStruct> makeL2NormTestsBetweenKernelsStructs(std::shared_ptr<L2NormTestBetweenKernelsParameterStruct> testPara, std::vector<std::shared_ptr<TestSimulationImp> > testSim, std::string kernelName);
std::vector<std::shared_ptr<PhiTest> > makePhiTests(std::shared_ptr<PhiTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp> > testSim, std::vector<std::shared_ptr<PhiTestPostProcessingStrategy> > phiAndNuPostProStrategy, double viscosity, std::string dataToCalculate);
std::vector<std::shared_ptr<NyTest> > makeNyTests(std::shared_ptr<NyTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp> > testSim, std::vector<std::shared_ptr<NyTestPostProcessingStrategy> > phiAndNuPostProStrategy, double viscosity, std::string dataToCalculate);
std::vector<std::shared_ptr<L2NormTest> > makeL2NormTests(std::vector<std::shared_ptr<TestSimulationImp> > testSim, std::vector<std::shared_ptr<L2NormPostProcessingStrategy> > postProStrategy, std::shared_ptr<L2NormTestParameterStruct> testParameter);
std::vector<std::vector<std::shared_ptr<L2NormTestBetweenKernels> > > makeL2NormTestsBetweenKernels(std::shared_ptr<L2NormTestBetweenKernelsParameterStruct> testPara, std::vector<std::shared_ptr<TestSimulationImp> > testSim, std::vector<std::shared_ptr<L2NormBetweenKernelPostProcessingStrategy> > postProcessingStrategies);
std::vector<std::shared_ptr<L2NormTestBetweenKernels> > linkL2NormTestsBetweenKernels(std::shared_ptr<L2NormTestBetweenKernelsParameterStruct> testPara, std::vector<std::shared_ptr<TestSimulationImp> > testSim, std::vector<std::shared_ptr<L2NormBetweenKernelPostProcessingStrategy> > postProcessingStrategies);
std::shared_ptr<LogFileWriter> makeLogFileWriter(std::vector<std::shared_ptr<TestLogFileInformation> > testLogFiles, std::shared_ptr<SimulationLogFileInformation> simLogInfo, std::vector<std::shared_ptr<SimulationInfo> > simInfo, std::string kernelName, double viscosity, int basicTimeStepLength, std::shared_ptr<LogFileParameterStruct> logFilePara, std::shared_ptr<BasicTestLogFileInformation> basicTestLogFileInfo);
void initTestStruct(std::shared_ptr<TestStruct> testStruct, std::shared_ptr<NumericalTestStruct> numericalTestStruct, std::vector<std::shared_ptr<TestLogFileInformation> > testLogFileInfo, std::shared_ptr<BasicTestLogFileInformation> basicTestLogFileInfo);
std::vector<std::shared_ptr<TestSimulation> > myTestSimulations;
std::shared_ptr<TestQueueImp> myTestQueue;
std::shared_ptr<LogFileQueueImp> myLogFileWriterQueue;
std::vector<std::vector<std::shared_ptr<L2NormTestBetweenKernels> > > l2NormTestsBetweenKernels;
std::shared_ptr<ColorConsoleOutput> colorOutput;
std::shared_ptr<AnalyticalResults2DToVTKWriter> anaResultWriter;
std::shared_ptr<L2NormCalculatorFactory> l2NormCalculatorFactory;
......
#ifndef TEST_STRUCT_H
#define TEST_STRUCT_H
#include <memory>
#include <string>
#include <vector>
class TestLogFileInformation;
class Test;
struct TestStruct
{
std::shared_ptr<TestLogFileInformation> logFileInfo;
std::vector<std::shared_ptr<Test> > tests;
std::string testName;
};
#endif
\ No newline at end of file
......@@ -6,8 +6,8 @@ Devices="1"
##################################################
# Basic Simulation Parameter #
##################################################
KernelsToTest="CumulantAA2016CompSP27 "
# CumulantAll4CompSP27 CumulantOneCompSP27 CumulantF32018CompSP27 CumulantF3CompSP27
KernelsToTest="CumulantF3CompSP27 BGKCompSP27 BGKPlusCompSP27"
#BGKCompSP27 BGKPlusCompSP27 CumulantAA2016CompSP27 CumulantOneCompSP27 CumulantF3CompSP27 CumulantF32018CompSP27 CumulantAll4CompSP27
NumberOfTimeSteps=20
Viscosity="0.001"
Rho0=1.0
......@@ -16,14 +16,14 @@ Rho0=1.0
# TaylorGreenVortex Parameter #
##################################################
BasisTimeStepLength_TGV_Ux="1000"
ux_TGV_Ux="0.032"
Amplitude_TGV_Ux="0.01"
ux_TGV_Ux="0.096"
Amplitude_TGV_Ux="0.001"
l0_TGV_Ux=32
DataToCalcTests_TGV_Ux="Vx Vz"
BasisTimeStepLength_TGV_Uz="1000"
uz_TGV_Uz="0.048"
Amplitude_TGV_Uz="0.01"
Amplitude_TGV_Uz="0.001"
l0_TGV_Uz=48
DataToCalcTests_TGV_Uz="Vx Vz"
......@@ -31,7 +31,7 @@ DataToCalcTests_TGV_Uz="Vx Vz"
# Shear Wave Parameter #
##################################################
BasisTimeStepLength_SW="1000"
u0_SW="0.032"
u0_SW="0.096"
v0_SW="0.1"
l0_SW=32
DataToCalcTests_SW="Vy"
......@@ -82,10 +82,10 @@ NormalizeWith=amplitude
##################################################
# Simulation To Perform #
##################################################
TaylorGreenVortexUx32=true
TaylorGreenVortexUx64=true
TaylorGreenVortexUx128=true
TaylorGreenVortexUx256=true
TaylorGreenVortexUx32=false
TaylorGreenVortexUx64=false
TaylorGreenVortexUx128=false
TaylorGreenVortexUx256=false
TaylorGreenVortexUx512=false
TaylorGreenVortexUz32=false
......@@ -94,10 +94,10 @@ TaylorGreenVortexUz128=false
TaylorGreenVortexUz256=false
TaylorGreenVortexUz512=false
ShearWave32=false
ShearWave64=false
ShearWave128=false
ShearWave256=false
ShearWave32=true
ShearWave64=true
ShearWave128=true
ShearWave256=true
ShearWave512=false
##################################################
......@@ -114,10 +114,10 @@ GridPath512="C:\Users\Timon\Documents\studienarbeitIRMB\grids\gridUni512x4x768"
##################################################
# File Writing Information #
##################################################
WriteVTKFiles=true
WriteVTKFiles=false
PathForVTKFileWriting="C:\Users\Timon\Documents\studienarbeitIRMB\Output"
StartStepFileWriter=0
WriteAnalyResultsToVTK=true
PathLogFile="C:\Users\Timon\Documents\studienarbeitIRMB\logFiles"
\ No newline at end of file
PathLogFile="C:\Users\Timon\Documents\studienarbeitIRMB\logFiles\KleinerTest"
\ No newline at end of file
......@@ -8,6 +8,99 @@
#include "Utilities/VirtualFluidSimulation/VirtualFluidSimulation.h"
#include "Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactoryImp.h"
//validation
#include <fstream>
#include <iostream>
#include "Utilities/Calculator/FFTCalculator/FFTCalculator.h"
static void validateTestSuite()
{
const int timeSteps = 10;
const int begin = 11;
const int end = 20;
const int l0 = 32;
const double viscosity = 0.001;
std::string kernelName = "TGV";
std::vector<int> xLength{32,64,128,256,512};
std::vector<int> zLength(xLength.size());
std::vector<int> timeStepLength(xLength.size());
for (int i = 0; i < xLength.size(); i++) {
zLength.at(i) = xLength.at(i) * 3 / 2;
timeStepLength.at(i) = (int)1000 * xLength.at(i)*xLength.at(i) / l0 / l0;
}
std::vector<std::vector<std::ostringstream>> filePaths;
filePaths.resize(xLength.size());
for (int j = 0; j < xLength.size(); j++) {
filePaths.at(j).resize(timeSteps);
for (int i = begin; i <= end; i++)
filePaths.at(j).at(i - begin) << "C:/Users/Timon/Desktop/Auswertung_TGV_10hm3_X_CumD3Q27F3/Auswertung_TGV_10hm3_X_CumD3Q27F3/" << kernelName << "_" << xLength.at(j) << "_3_" << zLength.at(j) << "_AD_X_" << i*timeStepLength.at(j) << ".dat";
}
std::vector<std::vector<std::vector<double>>> dataForOneSimulationGroup;
for (int j = 0; j < filePaths.size(); j++) {
std::vector<std::vector<double>> dataForOneSimulation;
dataForOneSimulation.resize(timeSteps);
for (int i = 0; i < filePaths.at(j).size(); i++) {
std::ifstream file;
file.open(filePaths.at(j).at(i).str());
if (file.is_open()) {
double data = 0.0;
while (file >> data)
dataForOneSimulation.at(i).push_back(data);
file.close();
}
else
int stop = 1;
}
dataForOneSimulationGroup.push_back(dataForOneSimulation);
}
std::shared_ptr<FFTCalculator> calulator = FFTCalculator::getInstance();
std::vector<double> phiDifForOneSimGroup;
std::vector<double> nyDifForOneSimGroup;
for (int i = 0; i < dataForOneSimulationGroup.size(); i++) {
int timeStepLength = 1000 * xLength.at(i)*xLength.at(i) / l0 / l0;
double phiDiff = calulator->calcPhiDiff(dataForOneSimulationGroup.at(i), false, xLength.at(i), zLength.at(i), timeStepLength);
double ny = calulator->calcNy(dataForOneSimulationGroup.at(i), false, xLength.at(i), zLength.at(i), timeStepLength);
double nyDiff = abs(ny - viscosity) / viscosity;
phiDifForOneSimGroup.push_back(phiDiff);
nyDifForOneSimGroup.push_back(nyDiff);
}
std::fstream dataOutPhi;
std::string dataOutFilePathPhi = "C:/Users/Timon/Desktop/Auswertung_TGV_10hm3_X_CumD3Q27F3/NumericalTestAuswertung/" + kernelName + "_PhiDiff.dat";
dataOutPhi.open(dataOutFilePathPhi, std::ios::out);
std::fstream dataOutNy;
std::string dataOutFilePathNy = "C:/Users/Timon/Desktop/Auswertung_TGV_10hm3_X_CumD3Q27F3/NumericalTestAuswertung/" + kernelName + "_NyDiff.dat";
dataOutNy.open(dataOutFilePathNy, std::ios::out);
for (int i = 0; i < phiDifForOneSimGroup.size(); i++) {
dataOutPhi << std::fixed << std::setprecision(std::numeric_limits<double>::digits10 + 1);
dataOutPhi << phiDifForOneSimGroup.at(i);
dataOutNy << std::fixed << std::setprecision(std::numeric_limits<double>::digits10 + 1);
dataOutNy << nyDifForOneSimGroup.at(i);
if (i < phiDifForOneSimGroup.size() - 1) {
dataOutPhi << std::endl;
dataOutNy << std::endl;
}
}
dataOutPhi.close();
}
static void startNumericalTests(const std::string &configFile)
{
std::shared_ptr<ConfigFileReader> configReader = ConfigFileReader::getNewInstance(configFile);
......@@ -32,6 +125,8 @@ int main(int argc, char **argv)
{
MPI_Init(&argc, &argv);
//validateTestSuite();
if (argc > 1)
startNumericalTests(argv[1]);
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment