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

final

parent 44143c1a
No related branches found
No related tags found
No related merge requests found
Showing
with 62 additions and 142 deletions
macro(linkMathLink targetName)
include_directories(${MATHLINK_ROOT})
target_link_libraries(${targetName} wstp64i4m)
endmacro(linkMathLink)
\ No newline at end of file
...@@ -7,4 +7,6 @@ linkMPI(${targetName}) ...@@ -7,4 +7,6 @@ linkMPI(${targetName})
include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/fftw/Link.cmake) include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/fftw/Link.cmake)
linkFftw(${targetName}) linkFftw(${targetName})
include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Boost/Link.cmake) include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Boost/Link.cmake)
linkBoost(${targetName} "") linkBoost(${targetName} "")
\ No newline at end of file include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/MathLink/Link.cmake)
linkMathLink(${targetName})
\ No newline at end of file
#include "TaylorGreenVortexAnalyticalResults.h"
#define _USE_MATH_DEFINES
#include <math.h>
std::shared_ptr<AnalyticalResults> TaylorGreenAnalyticalResults::getNewInstance(double viscosity, double u0, double amplitude, double l0, double rho0)
{
return std::shared_ptr<AnalyticalResults>(new TaylorGreenAnalyticalResults(viscosity, u0, amplitude, l0, rho0));
}
void TaylorGreenAnalyticalResults::calc(std::shared_ptr< SimulationResults> simResults)
{
AnalyticalResults::init(simResults);
for (int i = 0; i < numberOfTimeSteps; i++) {
for (int j = 0; j < numberOfNodes; j++) {
vx.at(i).at(j) = (l0*u0) / xNodes + (amplitude * exp(timeStep.at(i)*viscosity*(((double)-4.0 * M_PI*M_PI) / (xNodes*xNodes) - ((double)4.0 * M_PI *M_PI) / (zNodes*zNodes)))*l0*cos(((double)2.0 * M_PI * z.at(i).at(j)) / zNodes) * sin(((double)2.0 * M_PI*x.at(i).at(j)) / xNodes)) / xNodes;
vy.at(i).at(j) = (double)0.0;
vz.at(i).at(j) = -((amplitude*exp(timeStep.at(i)*viscosity*(((double)-4.0 * M_PI*M_PI) / (xNodes*xNodes) - ((double)4.0 * M_PI*M_PI) / (zNodes*zNodes)))*l0*zNodes*cos(((double)2 * M_PI*x.at(i).at(j)) / xNodes) * sin((2 * M_PI*z.at(i).at(j)) / zNodes)) / (xNodes*xNodes));
press.at(i).at(j) = (double)0.0;
rho.at(i).at(j) = (amplitude*l0*l0 * rho0*(amplitude * zNodes*zNodes * cos(((double)2.0 * M_PI*z.at(i).at(j)) / zNodes)*cos(((double)2.0 * M_PI*z.at(i).at(j)) / zNodes) - (double)2.0 * exp(((double)4.0 * M_PI*M_PI * timeStep.at(i)*(xNodes*xNodes + zNodes*zNodes)*viscosity) / (xNodes*xNodes * zNodes*zNodes))*u0*(xNodes*xNodes - zNodes*zNodes)*cos(((double)2.0 * M_PI*z.at(i).at(j)) / zNodes) * sin(((double)2.0 * M_PI*x.at(i).at(j)) / xNodes) - amplitude*xNodes*xNodes * sin(((double)2.0 * M_PI*x.at(i).at(j)) / xNodes)*sin(((double)2.0 * M_PI*x.at(i).at(j)) / xNodes))) / ((double)2.0 * exp(((double)8.0 * M_PI*M_PI * timeStep.at(i)*(xNodes*xNodes + zNodes*zNodes)*viscosity) / (xNodes*xNodes * zNodes*zNodes))*xNodes*xNodes*xNodes*xNodes);
}
}
}
TaylorGreenAnalyticalResults::TaylorGreenAnalyticalResults(double viscosity, double u0, double amplitude, double l0, double rho0) : viscosity(viscosity), u0(u0), amplitude(amplitude), l0(l0), rho0(rho0)
{
}
\ No newline at end of file
#ifndef TAYLORGREENVORTEX_ANALYTICAL_RESULTS_H
#define TAYLORGREENVORTEX_ANALYTICAL_RESULTS_H
#include "Utilities\Results\AnalyticalResults\AnalyticalResult.h"
class TaylorGreenAnalyticalResults : public AnalyticalResults
{
public:
static std::shared_ptr< AnalyticalResults> getNewInstance(double viscosity, double u0, double amplitude, double l0, double rho0);
void calc(std::shared_ptr< SimulationResults> simResults);
private:
TaylorGreenAnalyticalResults() {};
TaylorGreenAnalyticalResults(double viscosity, double u0, double amplitude, double l0, double rho0);
double viscosity, rho0;
double l0;
double u0, amplitude;
};
#endif
\ No newline at end of file
#include "TaylorGreenLogFileInformation.h"
std::shared_ptr<TaylorGreenInformation> TaylorGreenInformation::getNewInstance(double u0, double amplitude, std::vector< bool> tests, std::vector<double> l, int l0)
{
return std::shared_ptr<TaylorGreenInformation>(new TaylorGreenInformation(u0, amplitude, tests, l, l0));
}
std::string TaylorGreenInformation::getOutput()
{
makeCenterHead("TaylorGreenVortex Information");
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();
}
std::string TaylorGreenInformation::getFilePathExtension()
{
std::ostringstream oss;
oss <<"TaylorGreenVortex\\u0_ " << u0 << "_Amplitude_ " << amplitude;
return oss.str();
}
TaylorGreenInformation::TaylorGreenInformation(double u0, double amplitude, std::vector< bool> tests, std::vector< double> l, int l0) : u0(u0), amplitude(amplitude), tests(tests), l(l), l0(l0)
{
}
#include "TaylorGreenVortexSimulationInfo.h"
#include <sstream>
std::shared_ptr<SimulationInfo> TaylorGreenVortexSimulationInfo::getNewInstance(double u0, double amplitude, int l0, int lx, double viscosity, std::string kernelName, int numberOfSimulations)
{
return std::shared_ptr<SimulationInfo>(new TaylorGreenVortexSimulationInfo(u0, amplitude, l0, lx, viscosity, kernelName, numberOfSimulations));
}
TaylorGreenVortexSimulationInfo::TaylorGreenVortexSimulationInfo(double u0, double amplitude, int l0, int lx, double viscosity, std::string kernelName, int numberOfSimulations) : SimulationInfoImp(lx, viscosity, kernelName, numberOfSimulations)
{
std::ostringstream oss;
oss << " u0: " << u0 / (lx / l0) << " Amplitude: " << amplitude / (lx / l0);
this->simulationParameterString = oss.str();
simulationName = "TaylorGreenVortex";
}
\ No newline at end of file
#include "TaylorGreenSimulationParameter.h"
#include "Simulation/TaylorGreenVortex/InitialConditions/InitialConditionTaylorGreenVortex.h"
#include "Utilities\KernelConfiguration\KernelConfigurationImp.h"
#include <sstream>
std::shared_ptr<SimulationParameter> TaylorGreenSimulationParameter::getNewInstance(std::string kernelName, real u0, real amplitude, real viscosity, real rho0, real lx, real lz, real l0, unsigned int numberOfTimeSteps, unsigned int basisTimeStepLength, unsigned int startStepCalculation, unsigned int ySliceForCalculation, std::string gridPath, unsigned int maxLevel, unsigned int numberOfGridLevels, bool writeFiles, unsigned int startStepFileWriter, std::string filePath, std::vector<int> devices)
{
return std::shared_ptr<SimulationParameter>(new TaylorGreenSimulationParameter(kernelName, u0, amplitude, viscosity, rho0, lx, lz, l0, numberOfTimeSteps, basisTimeStepLength, startStepCalculation, ySliceForCalculation, gridPath, maxLevel, numberOfGridLevels, writeFiles, startStepFileWriter, filePath, devices));
}
double TaylorGreenSimulationParameter::getMaxVelocity()
{
return u0 / (lx / l0);
}
TaylorGreenSimulationParameter::TaylorGreenSimulationParameter(std::string kernelName, real u0, real amplitude, real viscosity, real rho0, real lx, real lz, real l0, unsigned int numberOfTimeSteps, unsigned int basisTimeStepLength, unsigned int startStepCalculation, unsigned int ySliceForCalculation, std::string gridPath, unsigned int maxLevel, unsigned int numberOfGridLevels, bool writeFiles, unsigned int startStepFileWriter, std::string filePath, std::vector<int> devices)
:SimulationParameterImp("TaylorGreenVortex", viscosity, lx, lz, l0, numberOfTimeSteps, basisTimeStepLength, startStepCalculation, ySliceForCalculation, gridPath, maxLevel, numberOfGridLevels, writeFiles, startStepFileWriter, devices), u0(u0), amplitude(amplitude), rho0(rho0)
{
std::ostringstream oss;
oss << filePath << "\\" << kernelName << "\\TaylorGreenVortex\\" << viscosity << "\\u0_" << u0 << "_amplitude_" << amplitude << "\\grid" << lx;
generateFilePath(oss.str());
this->filePath = oss.str();
initialCondition = InitialConditionTaylorGreen::getNewInstance(lx, lz, l0, u0, amplitude, rho0);
kernelConfig = KernelConfigurationImp::getNewInstance(kernelName);
}
...@@ -10,20 +10,21 @@ std::shared_ptr<AnalyticalResults> ShearWaveAnalyticalResults::getNewInstance(do ...@@ -10,20 +10,21 @@ std::shared_ptr<AnalyticalResults> ShearWaveAnalyticalResults::getNewInstance(do
void ShearWaveAnalyticalResults::calc(std::shared_ptr<SimulationResults> simResults) void ShearWaveAnalyticalResults::calc(std::shared_ptr<SimulationResults> simResults)
{ {
AnalyticalResults::init(simResults); AnalyticalResultsImp::init(simResults);
for (int i = 0; i < numberOfTimeSteps; i++) { for (int i = 0; i < numberOfTimeSteps; i++) {
for (int j = 0; j < numberOfNodes; j++) { for (int j = 0; j < numberOfNodes; j++) {
vx.at(i).at(j) = (l0*u0) / xNodes; vx.at(i).at(j) = (l0*u0) / xNodes;
vy.at(i).at(j) = (double)0.0; vy.at(i).at(j) = (double)0.0;
vz.at(i).at(j) = (l0*v0*cos(((double)2.0 * M_PI*z.at(i).at(j)) / zNodes) * sin(((double)2.0 * M_PI*(x.at(i).at(j) + (l0*timeStep.at(i)*u0) / xNodes)) / xNodes)) / (exp(timeStep.at(i)*viscosity*(((double)4.0 * M_PI*M_PI) / xNodes*xNodes + ((double)4.0 * M_PI*M_PI) / zNodes*zNodes))*xNodes); vz.at(i).at(j) = (l0*v0*cos(((double)2.0 * M_PI*z.at(i).at(j)) / zNodes) * sin(((double)2.0 * M_PI*(x.at(i).at(j) + (l0*time.at(i)*u0) / xNodes)) / xNodes)) / (exp(time.at(i)*viscosity*(((double)4.0 * M_PI*M_PI) / xNodes*xNodes + ((double)4.0 * M_PI*M_PI) / zNodes*zNodes))*xNodes);
press.at(i).at(j) = (double)0.0; press.at(i).at(j) = (double)0.0;
rho.at(i).at(j) = (l0*l0 * rho0*v0*sin(((double)2.0 * M_PI*z.at(i).at(j)) / zNodes) * ((double)-4.0 * exp(((double)4.0 * M_PI*M_PI * timeStep.at(i)*viscosity*(xNodes*xNodes + zNodes*zNodes)) / (xNodes*xNodes * zNodes*zNodes))*u0*zNodes*cos(((double)2.0 * M_PI*(l0*timeStep.at(i)*u0 + x.at(i).at(j)*xNodes)) / (xNodes*xNodes)) + v0*xNodes*sin(((double)2.0 * M_PI*(l0*timeStep.at(i)*u0 + x.at(i).at(j)*xNodes)) / (xNodes*xNodes))*sin(((double)2.0 * M_PI*(l0*timeStep.at(i)*u0 + x.at(i).at(j)*xNodes)) / (xNodes*xNodes)) * sin((2 * M_PI*z.at(i).at(j)) / zNodes))) / ((double)2.0 * exp(((double)8.0 * M_PI*M_PI * timeStep.at(i)*viscosity*(xNodes*xNodes + zNodes*zNodes)) / (xNodes*xNodes * zNodes*zNodes))*xNodes*xNodes*xNodes); rho.at(i).at(j) = (l0*l0 * rho0*v0*sin(((double)2.0 * M_PI*z.at(i).at(j)) / zNodes) * ((double)-4.0 * exp(((double)4.0 * M_PI*M_PI * time.at(i)*viscosity*(xNodes*xNodes + zNodes*zNodes)) / (xNodes*xNodes * zNodes*zNodes))*u0*zNodes*cos(((double)2.0 * M_PI*(l0*time.at(i)*u0 + x.at(i).at(j)*xNodes)) / (xNodes*xNodes)) + v0*xNodes*sin(((double)2.0 * M_PI*(l0*time.at(i)*u0 + x.at(i).at(j)*xNodes)) / (xNodes*xNodes))*sin(((double)2.0 * M_PI*(l0*time.at(i)*u0 + x.at(i).at(j)*xNodes)) / (xNodes*xNodes)) * sin((2 * M_PI*z.at(i).at(j)) / zNodes))) / ((double)2.0 * exp(((double)8.0 * M_PI*M_PI * time.at(i)*viscosity*(xNodes*xNodes + zNodes*zNodes)) / (xNodes*xNodes * zNodes*zNodes))*xNodes*xNodes*xNodes);
} }
} }
calculated = true;
} }
ShearWaveAnalyticalResults::ShearWaveAnalyticalResults(double viscosity, double u0, double v0, double l0, double rho0) : viscosity(viscosity), u0(u0), v0(v0), l0(l0), rho0(rho0) ShearWaveAnalyticalResults::ShearWaveAnalyticalResults(double viscosity, double u0, double v0, double l0, double rho0) : AnalyticalResultsImp(), viscosity(viscosity), u0(u0), v0(v0), l0(l0), rho0(rho0)
{ {
} }
\ No newline at end of file
#ifndef SHEARWAVE_ANALYTICAL_RESULTS_H #ifndef SHEARWAVE_ANALYTICAL_RESULTS_H
#define SHEARWAVE_ANALYTICAL_RESULTS_H #define SHEARWAVE_ANALYTICAL_RESULTS_H
#include "Utilities\Results\AnalyticalResults\AnalyticalResult.h" #include "Utilities\Results\AnalyticalResults\AnalyticalResultImp.h"
class ShearWaveAnalyticalResults : public AnalyticalResults class ShearWaveAnalyticalResults : public AnalyticalResultsImp
{ {
public: public:
static std::shared_ptr< AnalyticalResults> getNewInstance(double viscosity, double u0, double v0, double l0, double rho0); static std::shared_ptr< AnalyticalResults> getNewInstance(double viscosity, double u0, double v0, double l0, double rho0);
void calc(std::shared_ptr< SimulationResults> simResults); void calc(std::shared_ptr< SimulationResults> simResults);
private: private:
ShearWaveAnalyticalResults() {}; ShearWaveAnalyticalResults() {};
ShearWaveAnalyticalResults(double viscosity, double u0, double v0, double l0, double rho0); ShearWaveAnalyticalResults(double viscosity, double u0, double v0, double l0, double rho0);
......
...@@ -24,7 +24,7 @@ real InitialConditionShearWave::getInitVX(int i, int level) ...@@ -24,7 +24,7 @@ real InitialConditionShearWave::getInitVX(int i, int level)
real x = getXCoord(i, level); real x = getXCoord(i, level);
real y = getYCoord(i, level); real y = getYCoord(i, level);
real z = getZCoord(i, level); real z = getZCoord(i, level);
if ((i != 0) && (x != XCoordstopnode) && (y != YCoordstopnode) && (z != ZCoordstopnode)) if ((i != 0) && (x != XCoordStopNode) && (y != YCoordStopNode) && (z != ZCoordStopNode))
{ {
real vx = l0 * u0 / lx; real vx = l0 * u0 / lx;
return vx; return vx;
...@@ -44,7 +44,7 @@ real InitialConditionShearWave::getInitVZ(int i, int level) ...@@ -44,7 +44,7 @@ real InitialConditionShearWave::getInitVZ(int i, int level)
real x = getXCoord(i, level); real x = getXCoord(i, level);
real y = getYCoord(i, level); real y = getYCoord(i, level);
real z = getZCoord(i, level); real z = getZCoord(i, level);
if ((i != 0) && (x != XCoordstopnode) && (y != YCoordstopnode) && (z != ZCoordstopnode)) if ((i != 0) && (x != XCoordStopNode) && (y != YCoordStopNode) && (z != ZCoordStopNode))
{ {
real vz = v0 * l0 / lx * cos((real)2.0 * M_PI * z /lz) * sin((real)2.0 * M_PI * x / lx); real vz = v0 * l0 / lx * cos((real)2.0 * M_PI * z /lz) * sin((real)2.0 * M_PI * x / lx);
return vz; return vz;
...@@ -58,7 +58,7 @@ real InitialConditionShearWave::getInitROH(int i, int level) ...@@ -58,7 +58,7 @@ real InitialConditionShearWave::getInitROH(int i, int level)
real x = getXCoord(i, level); real x = getXCoord(i, level);
real y = getYCoord(i, level); real y = getYCoord(i, level);
real z = getZCoord(i, level); real z = getZCoord(i, level);
if ((i != 0) && (x != XCoordstopnode) && (y != YCoordstopnode) && (z != ZCoordstopnode)) if ((i != 0) && (x != XCoordStopNode) && (y != YCoordStopNode) && (z != ZCoordStopNode))
{ {
real press = (l0*l0 * v0 * rho * sin(((real)2.0 * M_PI * z) / lz) * ((real)-4.0 * lz * u0 * cos((2 * M_PI * x) / lx) + lx * v0 * sin(((real)2.0 * M_PI * x) / lx)*sin(((real)2.0 * M_PI * x) / lx) * sin(((real)2.0 * M_PI * z) / lz))) / ((real)2.0 * lx*lx*lx); real press = (l0*l0 * v0 * rho * sin(((real)2.0 * M_PI * z) / lz) * ((real)-4.0 * lz * u0 * cos((2 * M_PI * x) / lx) + lx * v0 * sin(((real)2.0 * M_PI * x) / lx)*sin(((real)2.0 * M_PI * x) / lx) * sin(((real)2.0 * M_PI * z) / lz))) / ((real)2.0 * lx*lx*lx);
return press; return press;
......
...@@ -10,19 +10,27 @@ std::string ShearWaveInformation::getOutput() ...@@ -10,19 +10,27 @@ std::string ShearWaveInformation::getOutput()
makeCenterHead("ShearWave Information"); makeCenterHead("ShearWave Information");
for (int i = 0; i < tests.size(); i++) { for (int i = 0; i < tests.size(); i++) {
if (tests.at(i)) { if (tests.at(i)) {
oss << "Lx:" << l.at(i) << std::endl; oss << "Lx=" << l.at(i) << std::endl;
oss << "u0: " << u0 / (l.at(i) / l0) << std::endl; oss << "l0=" << l0 << std::endl;
oss << "v0: " << v0 / (l.at(i) / l0) << std::endl; oss << "u0=" << u0 / (l.at(i) / l0) << std::endl;
oss << "v0=" << v0 / (l.at(i) / l0) << std::endl;
oss << std::endl; oss << std::endl;
} }
} }
return oss.str(); return oss.str();
} }
std::string ShearWaveInformation::getFilePathExtension() std::string ShearWaveInformation::getFilePathExtensionOne()
{ {
std::ostringstream oss; std::ostringstream oss;
oss << "ShearWave\\u0_" << u0 << "_v0_" << v0; oss << "ShearWave\\";
return oss.str();
}
std::string ShearWaveInformation::getFilePathExtensionTwo()
{
std::ostringstream oss;
oss << "u0_" << u0 << "_v0_" << v0 << "\\";
return oss.str(); return oss.str();
} }
......
...@@ -15,7 +15,8 @@ public: ...@@ -15,7 +15,8 @@ public:
static std::shared_ptr<ShearWaveInformation> getNewInstance(double u0, double v0, std::vector< bool> tests, std::vector< real> l, int l0); static std::shared_ptr<ShearWaveInformation> getNewInstance(double u0, double v0, std::vector< bool> tests, std::vector< real> l, int l0);
std::string getOutput(); std::string getOutput();
std::string getFilePathExtension(); std::string getFilePathExtensionOne();
std::string getFilePathExtensionTwo();
private: private:
ShearWaveInformation() {}; ShearWaveInformation() {};
......
...@@ -22,10 +22,10 @@ double ShearWaveSimulationParameter::getMaxVelocity() ...@@ -22,10 +22,10 @@ double ShearWaveSimulationParameter::getMaxVelocity()
} }
ShearWaveSimulationParameter::ShearWaveSimulationParameter(std::string kernelName, real u0, real v0, real viscosity, real rho0, real lx, real lz, real l0, unsigned int numberOfTimeSteps, unsigned int basisTimeStepLength, unsigned int startStepCalculation, unsigned int ySliceForCalculation, std::string gridPath, unsigned int maxLevel, unsigned int numberOfGridLevels, bool writeFiles, unsigned int startStepFileWriter, std::string filePath, std::vector<int> devices) ShearWaveSimulationParameter::ShearWaveSimulationParameter(std::string kernelName, real u0, real v0, real viscosity, real rho0, real lx, real lz, real l0, unsigned int numberOfTimeSteps, unsigned int basisTimeStepLength, unsigned int startStepCalculation, unsigned int ySliceForCalculation, std::string gridPath, unsigned int maxLevel, unsigned int numberOfGridLevels, bool writeFiles, unsigned int startStepFileWriter, std::string filePath, std::vector<int> devices)
:SimulationParameterImp("ShearWave", viscosity, lx, lz, l0, numberOfTimeSteps, basisTimeStepLength, startStepCalculation, ySliceForCalculation, gridPath, maxLevel, numberOfGridLevels, writeFiles, startStepFileWriter, devices), u0(u0), v0(v0), rho0(rho0) :SimulationParameterImp("ShearWave", viscosity, lx, lz, l0, lx, numberOfTimeSteps, basisTimeStepLength, startStepCalculation, ySliceForCalculation, gridPath, maxLevel, numberOfGridLevels, writeFiles, startStepFileWriter, devices), u0(u0), v0(v0), rho0(rho0)
{ {
std::ostringstream oss; std::ostringstream oss;
oss << filePath << "\\" << kernelName << "\\ShearWave\\" << viscosity << "\\u0_" << u0 << "_v0_" << v0 << "\\grid" << lx; oss << filePath << "\\ShearWave\\viscosity" << viscosity << "\\u0_" << u0 << "_v0_" << v0 << "\\" << kernelName << "\\grid" << lx;
generateFilePath(oss.str()); generateFilePath(oss.str());
this->filePath = oss.str(); this->filePath = oss.str();
......
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