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

moves InitialConditions to TestSimulation

parent ca1ec27b
No related branches found
No related tags found
No related merge requests found
Showing
with 83 additions and 65 deletions
#include "InitialConditionShearWave.h"
#include "Simulations\ShearWave\ShearWaveParameterStruct.h"
#include "Utilities\Structs\GridInformationStruct.h"
#define _USE_MATH_DEFINES
#include <math.h>
InitialConditionShearWave::InitialConditionShearWave(real lx, real lz, real l0, real u0, real v0, real rho0)
InitialConditionShearWave::InitialConditionShearWave(std::shared_ptr<ShearWaveParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct)
{
this->l0 = l0;
this->l0 = simParaStruct->l0;
this->lx = lx;
this->lz = lz;
this->rho = rho0;
this->u0 = u0;
this->v0 = v0;
this->rho = simParaStruct->rho0;
this->u0 = simParaStruct->ux;
this->v0 = simParaStruct->uz;
}
std::shared_ptr<InitialConditionShearWave> InitialConditionShearWave::getNewInstance(real lx, real lz, real l0, real u0, real v0, real rho0)
std::shared_ptr<InitialConditionShearWave> InitialConditionShearWave::getNewInstance(std::shared_ptr<ShearWaveParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct)
{
return std::shared_ptr<InitialConditionShearWave>(new InitialConditionShearWave(lx, lz, l0, u0, v0, rho0));
return std::shared_ptr<InitialConditionShearWave>(new InitialConditionShearWave(simParaStruct, gridInfoStruct));
}
real InitialConditionShearWave::getInitVX(int i, int level)
......
......@@ -5,10 +5,13 @@
#include <memory>
struct ShearWaveParameterStruct;
struct GridInformationStruct;
class InitialConditionShearWave :public InitialConditionImp
{
public:
static std::shared_ptr< InitialConditionShearWave> getNewInstance(real lx, real lz, real l0, real u0, real v0, real rho0);
static std::shared_ptr< InitialConditionShearWave> getNewInstance(std::shared_ptr<ShearWaveParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct);
real getInitVX(int i, int level);
real getInitVY(int i, int level);
......@@ -17,7 +20,7 @@ public:
real getInitPRESS(int i, int level);
private:
InitialConditionShearWave(real lx, real lz, real l0, real u0, real v0, real rho0);
InitialConditionShearWave(std::shared_ptr<ShearWaveParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct);
InitialConditionShearWave() {};
real rho;
......
......@@ -32,6 +32,4 @@ ShearWaveSimulationParameter::ShearWaveSimulationParameter(std::string kernelNam
oss << parameterStruct->vtkFilePath << "\\ShearWave\\viscosity" << viscosity << "\\ux_" << ux << "_uz_" << uz << "\\" << kernelName << "\\grid" << lx;
generateFileDirectionInMyStystem(oss.str());
this->filePath = oss.str();
initialCondition = InitialConditionShearWave::getNewInstance(lx, lz, l0, ux, uz, rho0);
}
\ No newline at end of file
#include "InitialConditionTaylorGreenVortexUx.h"
#include "Simulations\TaylorGreenVortexUx\TaylorGreenVortexUxParameterStruct.h"
#include "Utilities\Structs\GridInformationStruct.h"
#define _USE_MATH_DEFINES
#include <math.h>
InitialConditionTaylorGreenUx::InitialConditionTaylorGreenUx(real lx, real lz, real l0, real ux, real amplitude, real rho0)
InitialConditionTaylorGreenUx::InitialConditionTaylorGreenUx(std::shared_ptr<TaylorGreenVortexUxParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct)
{
this->Amp = amplitude;
this->L0 = l0;
this->Lx = lx;
this->Lz = lz;
this->rho = rho0;
this->ux = ux;
this->Amp = simParaStruct->amplitude;
this->L0 = simParaStruct->l0;
this->Lx = gridInfoStruct->lx;
this->Lz = gridInfoStruct->lz;
this->rho = simParaStruct->rho0;
this->ux = simParaStruct->ux;
}
std::shared_ptr<InitialConditionTaylorGreenUx> InitialConditionTaylorGreenUx::getNewInstance(real lx, real lz, real l0, real ux, real amplitude, real rho0)
std::shared_ptr<InitialConditionTaylorGreenUx> InitialConditionTaylorGreenUx::getNewInstance(std::shared_ptr<TaylorGreenVortexUxParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct)
{
return std::shared_ptr<InitialConditionTaylorGreenUx>(new InitialConditionTaylorGreenUx(lx, lz, l0, ux, amplitude, rho0));
return std::shared_ptr<InitialConditionTaylorGreenUx>(new InitialConditionTaylorGreenUx(simParaStruct, gridInfoStruct));
}
real InitialConditionTaylorGreenUx::getInitVX(int i, int level)
......
......@@ -5,10 +5,13 @@
#include <memory>
class InitialConditionTaylorGreenUx :public InitialConditionImp
struct TaylorGreenVortexUxParameterStruct;
struct GridInformationStruct;
class InitialConditionTaylorGreenUx : public InitialConditionImp
{
public:
static std::shared_ptr< InitialConditionTaylorGreenUx> getNewInstance(real lx, real lz, real l0, real ux, real amplitude, real rho0);
static std::shared_ptr<InitialConditionTaylorGreenUx> getNewInstance(std::shared_ptr<TaylorGreenVortexUxParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct);
real getInitVX(int i, int level);
real getInitVY(int i, int level);
......@@ -17,7 +20,7 @@ public:
real getInitPRESS(int i, int level);
private:
InitialConditionTaylorGreenUx(real lx, real lz, real l0, real ux, real amplitude, real rho0);
InitialConditionTaylorGreenUx(std::shared_ptr<TaylorGreenVortexUxParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct);
InitialConditionTaylorGreenUx() {};
real Amp;
......
#include "SimulationParameterTaylorGreenVortexUx.h"
#include "Simulations/TaylorGreenVortexUx/InitialConditions/InitialConditionTaylorGreenVortexUx.h"
#include "Simulations\TaylorGreenVortexUx\TaylorGreenVortexUxParameterStruct.h"
#include "Utilities\Structs\GridInformationStruct.h"
#include <sstream>
......@@ -30,6 +28,4 @@ SimulationParameterTaylorGreenUx::SimulationParameterTaylorGreenUx(std::string k
oss << tgvParameterStruct->vtkFilePath << "\\TaylorGreenVortex Ux\\" << viscosity << "\\ux_" << ux << "_amplitude_" << amplitude << "\\" << kernelName << "\\grid" << lx;
generateFileDirectionInMyStystem(oss.str());
this->filePath = oss.str();
initialCondition = InitialConditionTaylorGreenUx::getNewInstance(lx, lz, l0, ux, amplitude, rho0);
}
#include "InitialConditionTaylorGreenVortexUz.h"
#include "Simulations\TaylorGreenVortexUz\TaylorGreenVortexUzParameterStruct.h"
#include "Utilities\Structs\GridInformationStruct.h"
#define _USE_MATH_DEFINES
#include <math.h>
InitialConditionTaylorGreenUz::InitialConditionTaylorGreenUz(real lx, real lz, real l0, real uz, real amplitude, real rho0)
InitialConditionTaylorGreenUz::InitialConditionTaylorGreenUz(std::shared_ptr<TaylorGreenVortexUzParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct)
{
this->Amp = amplitude;
this->L0 = l0;
this->Lx = lx;
this->Lz = lz;
this->rho = rho0;
this->uz = uz;
this->Amp = simParaStruct->amplitude;
this->L0 = simParaStruct->l0;
this->Lx = gridInfoStruct->lx;
this->Lz = gridInfoStruct->lz;
this->rho = simParaStruct->rho0;
this->uz = simParaStruct->uz;
}
std::shared_ptr<InitialConditionTaylorGreenUz> InitialConditionTaylorGreenUz::getNewInstance(real lx, real lz, real l0, real uz, real amplitude, real rho0)
std::shared_ptr<InitialConditionTaylorGreenUz> InitialConditionTaylorGreenUz::getNewInstance(std::shared_ptr<TaylorGreenVortexUzParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct)
{
return std::shared_ptr<InitialConditionTaylorGreenUz>(new InitialConditionTaylorGreenUz(lx, lz, l0, uz, amplitude, rho0));
return std::shared_ptr<InitialConditionTaylorGreenUz>(new InitialConditionTaylorGreenUz(simParaStruct, gridInfoStruct));
}
real InitialConditionTaylorGreenUz::getInitVX(int i, int level)
......
......@@ -5,10 +5,13 @@
#include <memory>
struct TaylorGreenVortexUzParameterStruct;
struct GridInformationStruct;
class InitialConditionTaylorGreenUz :public InitialConditionImp
{
public:
static std::shared_ptr< InitialConditionTaylorGreenUz> getNewInstance(real lx, real lz, real l0, real uz, real amplitude, real rho0);
static std::shared_ptr< InitialConditionTaylorGreenUz> getNewInstance(std::shared_ptr<TaylorGreenVortexUzParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct);
real getInitVX(int i, int level);
real getInitVY(int i, int level);
......@@ -17,7 +20,7 @@ public:
real getInitPRESS(int i, int level);
private:
InitialConditionTaylorGreenUz(real lx, real lz, real l0, real u0, real amplitude, real rho0);
InitialConditionTaylorGreenUz(std::shared_ptr<TaylorGreenVortexUzParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct);
InitialConditionTaylorGreenUz() {};
real Amp;
......
......@@ -28,6 +28,4 @@ SimulationParameterTaylorGreenUz::SimulationParameterTaylorGreenUz(std::string k
oss << tgvParameterStruct->vtkFilePath << "\\TaylorGreenVortex Uz\\viscosity_" << viscosity << "\\uz_" << uz << "_amplitude_" << amplitude << "\\" << kernelName << "\\grid" << lx;
generateFileDirectionInMyStystem(oss.str());
this->filePath = oss.str();
initialCondition = InitialConditionTaylorGreenUz::getNewInstance(lx, lz, l0, uz, amplitude, rho0);
}
}
\ No newline at end of file
......@@ -6,20 +6,23 @@
#include "Utilities\Structs\SimulationDataStruct.h"
#include "Utilities\Structs\TestSimulationDataStruct.h"
#include "Simulations/TaylorGreenVortexUx/SimulationParameter/SimulationParameterTaylorGreenVortexUx.h"
#include "Simulations\TaylorGreenVortexUx\AnalyticalResults\AnalyticalResultsTaylorGreenVortexUx.h"
#include "Simulations\TaylorGreenVortexUx\InitialConditions\InitialConditionTaylorGreenVortexUx.h"
#include "Simulations/TaylorGreenVortexUx/LogFileInformation/LogFileInformationTaylorGreenVortexUx.h"
#include "Simulations\TaylorGreenVortexUx\SimulationInfo\SimulationInfoTaylorGreenVortexUx.h"
#include "Simulations\TaylorGreenVortexUx\AnalyticalResults\AnalyticalResultsTaylorGreenVortexUx.h"
#include "Simulations/TaylorGreenVortexUx/SimulationParameter/SimulationParameterTaylorGreenVortexUx.h"
#include "Simulations/TaylorGreenVortexUz/SimulationParameter/SimulationParameterTaylorGreenVortexUz.h"
#include "Simulations/TaylorGreenVortexUz/LogFileInformation/LogFileInformationTaylorGreenvortexUz.h"
#include "Simulations\TaylorGreenVortexUz\SimulationInfo\SimulationInfoTaylorGreenVortexUz.h"
#include "Simulations\TaylorGreenVortexUz\AnalyticalResults\AnalyticalResultsTaylorGreenVortexUz.h"
#include "Simulations\TaylorGreenVortexUz\InitialConditions\InitialConditionTaylorGreenVortexUz.h"
#include "Simulations/ShearWave/SimulationParameter/ShearWaveSimulationParameter.h"
#include "Simulations/ShearWave/LogFileInformation/ShearWaveLogFileInformation.h"
#include "Simulations\ShearWave\SimulationInfo\ShearWaveSimulationInfo.h"
#include "Simulations\ShearWave\AnalyticalResults\ShearWaveAnalyticalResults.h"
#include "Simulations\ShearWave\InitialConditions\InitialConditionShearWave.h"
#include "Tests/PhiAndNuTest/PhiAndNuTest.h"
#include "Tests\PhiAndNuTest\LogFileInformation\PhiAndNuLogFileInformation.h"
......@@ -167,6 +170,7 @@ std::shared_ptr<SimulationDataStruct> NumericalTestFactoryImp::makeTaylorGreenUx
for (int i = 0; i < gridInfoStruct.size(); i++) {
std::shared_ptr<TestSimulationDataStruct> aTestSimData = std::shared_ptr<TestSimulationDataStruct> (new TestSimulationDataStruct);
aTestSimData->simParameter = SimulationParameterTaylorGreenUx::getNewInstance(kernelName, viscosity, simParaStruct, gridInfoStruct.at(i));
aTestSimData->initialCondition = InitialConditionTaylorGreenUx::getNewInstance(simParaStruct, gridInfoStruct.at(i));
aTestSimData->simInformation = SimulationInfoTaylorGreenUx::getNewInstance(simID, kernelName, viscosity, simParaStruct, gridInfoStruct.at(i), numberOfSimulations);
simID++;
aTestSimData->analyticalResult = AnalyticalResultsTaylorGreenUx::getNewInstance(viscosity, simParaStruct);
......@@ -184,6 +188,7 @@ std::shared_ptr<SimulationDataStruct> NumericalTestFactoryImp::makeTaylorGreenUz
for (int i = 0; i < gridInfoStruct.size(); i++) {
std::shared_ptr<TestSimulationDataStruct> aTestSimData = std::shared_ptr<TestSimulationDataStruct>(new TestSimulationDataStruct);
aTestSimData->simParameter = SimulationParameterTaylorGreenUz::getNewInstance(kernelName, viscosity, simParaStruct, gridInfoStruct.at(i));
aTestSimData->initialCondition = InitialConditionTaylorGreenUz::getNewInstance(simParaStruct, gridInfoStruct.at(i));
aTestSimData->simInformation = SimulationInfoTaylorGreenUz::getNewInstance(simID, kernelName, viscosity, simParaStruct, gridInfoStruct.at(i), numberOfSimulations);
simID++;
aTestSimData->analyticalResult = AnalyticalResultsTaylorGreenUz::getNewInstance(viscosity, simParaStruct);
......@@ -201,6 +206,7 @@ std::shared_ptr<SimulationDataStruct> NumericalTestFactoryImp::makeShearWaveSimu
for (int i = 0; i < gridInfoStruct.size(); i++) {
std::shared_ptr<TestSimulationDataStruct> aTestSimData = std::shared_ptr<TestSimulationDataStruct>(new TestSimulationDataStruct);
aTestSimData->simParameter = ShearWaveSimulationParameter::getNewInstance(kernelName, viscosity, simParaStruct, gridInfoStruct.at(i));
aTestSimData->initialCondition = InitialConditionShearWave::getNewInstance(simParaStruct, gridInfoStruct.at(i));
aTestSimData->simInformation = ShearWaveSimulationInfo::getNewInstance(simID, kernelName, viscosity, simParaStruct, gridInfoStruct.at(i), numberOfSimulations);
simID++;
aTestSimData->analyticalResult = ShearWaveAnalyticalResults::getNewInstance(viscosity, simParaStruct);
......
......@@ -21,11 +21,8 @@ public:
virtual std::vector< int> getDevices() = 0;
virtual double getMaxVelocity() = 0;
virtual unsigned int getLx() = 0;
virtual unsigned int getLz() = 0;
virtual std::shared_ptr< InitialCondition> getInitialCondition() = 0;
};
#endif
......@@ -74,11 +74,6 @@ std::vector<int> SimulationParameterImp::getDevices()
return devices;
}
std::shared_ptr<InitialCondition> SimulationParameterImp::getInitialCondition()
{
return initialCondition;
}
std::shared_ptr<KernelConfiguration> SimulationParameterImp::getKernelConfiguration()
{
return kernelConfig;
......
......@@ -19,9 +19,9 @@ public:
unsigned int getTimeStepLength();
unsigned int getLx();
unsigned int getLz();
std::vector< int> getDevices();
std::shared_ptr< InitialCondition> getInitialCondition();
std::shared_ptr< KernelConfiguration> getKernelConfiguration();
std::vector<int> getDevices();
std::shared_ptr<KernelConfiguration> getKernelConfiguration();
protected:
SimulationParameterImp() {};
......@@ -39,8 +39,7 @@ protected:
unsigned int maxLevel, numberOfGridLevels;
unsigned int timeStepLength;
std::shared_ptr< InitialCondition> initialCondition;
std::shared_ptr< KernelConfiguration> kernelConfig;
std::shared_ptr<KernelConfiguration> kernelConfig;
};
#endif
......@@ -3,14 +3,16 @@
#include <memory>
class SimulationParameter;
class SimulationInfo;
class AnalyticalResults;
class InitialCondition;
class SimulationInfo;
class SimulationParameter;
struct TestSimulationDataStruct
{
std::shared_ptr< SimulationParameter> simParameter;
std::shared_ptr< SimulationInfo> simInformation;
std::shared_ptr< AnalyticalResults> analyticalResult;
std::shared_ptr<AnalyticalResults> analyticalResult;
std::shared_ptr<InitialCondition> initialCondition;
std::shared_ptr<SimulationInfo> simInformation;
std::shared_ptr<SimulationParameter> simParameter;
};
#endif
\ No newline at end of file
......@@ -6,12 +6,12 @@
#include <memory>
class AnalyticalResults;
class InitialCondition;
class DataWriter;
class SimulationParameter;
class SimulationResults;
class SimulationObserver;
class DataWriter;
class Parameter;
class SimulationInfo;
class TestSimulation
{
......@@ -21,6 +21,7 @@ public:
virtual std::shared_ptr<SimulationParameter> getSimulationParameter() = 0;
virtual std::shared_ptr<DataWriter> getDataWriter() = 0;
virtual std::shared_ptr<InitialCondition> getInitialCondition() = 0;
virtual bool getSimulationRun() = 0;
virtual std::shared_ptr<SimulationResults> getSimulationResults() = 0;
......
......@@ -25,6 +25,7 @@ TestSimulationImp::TestSimulationImp(std::shared_ptr<TestSimulationDataStruct> t
this->simPara = testSimData->simParameter;
this->simInfo = testSimData->simInformation;
this->analyticalResult = testSimData->analyticalResult;
this->initialCondition = testSimData->initialCondition;
this->simResults = simResults;
this->anaResultWriter = anaResultWriter;
this->toVectorWriter = toVectorWriter;
......@@ -54,6 +55,11 @@ std::shared_ptr<DataWriter> TestSimulationImp::getDataWriter()
return toVectorWriter;
}
std::shared_ptr<InitialCondition> TestSimulationImp::getInitialCondition()
{
return initialCondition;
}
std::shared_ptr<SimulationInfo> TestSimulationImp::getSimulationInfo()
{
return simInfo;
......
......@@ -21,6 +21,7 @@ public:
std::shared_ptr< SimulationParameter> getSimulationParameter();
std::shared_ptr< DataWriter> getDataWriter();
std::shared_ptr<InitialCondition> getInitialCondition();
std::shared_ptr<SimulationInfo> getSimulationInfo();
void registerSimulationObserver(std::shared_ptr< SimulationObserver> simObserver);
......@@ -46,6 +47,7 @@ private:
double calcAnalyticalResultWriteTime();
void writeAnalyticalResultsToVTK();
std::shared_ptr<InitialCondition> initialCondition;
std::shared_ptr<SimulationParameter> simPara;
std::shared_ptr<SimulationInfo> simInfo;
std::shared_ptr<SimulationResults> simResults;
......
......@@ -131,8 +131,8 @@ std::vector<std::shared_ptr<VirtualFluidSimulation>> VirtualFluidSimulationFacto
vfSim->setParameter(para);
testSim.at(i)->setParameter(para);
initInitialConditions(testSim.at(i)->getSimulationParameter()->getInitialCondition(), para);
std::shared_ptr<GridReaderforTesting> grid = makeGridReaderForTesting(testSim.at(i)->getSimulationParameter()->getInitialCondition(), para);
initInitialConditions(testSim.at(i)->getInitialCondition(), para);
std::shared_ptr<GridReaderforTesting> grid = makeGridReaderForTesting(testSim.at(i)->getInitialCondition(), para);
vfSim->setGridProvider(grid);
vfSim->setDataWriter(testSim.at(i)->getDataWriter());
......
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