Skip to content
Snippets Groups Projects
Commit 51e61681 authored by Anna Wellmann's avatar Anna Wellmann
Browse files

Add to string function for axis

parent c5ffb9fc
No related branches found
No related tags found
1 merge request!307[GPU] Add a cylinder geometry
...@@ -97,7 +97,7 @@ int main() ...@@ -97,7 +97,7 @@ int main()
const std::string path("./output/RotatingGrid"); const std::string path("./output/RotatingGrid");
const std::string simulationName = (rotOrInt == Int ? "RotatingGridInterpolationTest" : "RotatingGrid") + const std::string simulationName = (rotOrInt == Int ? "RotatingGridInterpolationTest" : "RotatingGrid") +
rotationStrings.at(initialRot) + "_inflowFrom" + sideTypeNames.at(inflowSide); rotationStrings.at(initialRot) + "around" + axis::to_string(rotationAxis) + "_inflowFrom" + sideTypeNames.at(inflowSide);
const real L = 1.0; const real L = 1.0;
const real Re = 2000.0; const real Re = 2000.0;
...@@ -196,6 +196,9 @@ int main() ...@@ -196,6 +196,9 @@ int main()
gridBuilder->setPressureBoundaryCondition(SideType::MZ, 0.0); gridBuilder->setPressureBoundaryCondition(SideType::MZ, 0.0);
gridBuilder->setVelocityBoundaryCondition(SideType::PZ, 0.0, 0.0, -velocityLB); gridBuilder->setVelocityBoundaryCondition(SideType::PZ, 0.0, 0.0, -velocityLB);
break; break;
case SideType::GEOMETRY:
throw std::runtime_error("Can't generate inflow at geometry.");
break;
} }
gridBuilder->setNoSlipBoundaryCondition(SideType::MX); gridBuilder->setNoSlipBoundaryCondition(SideType::MX);
......
#include "Axis.h"
std::string axis::to_string(Axis axis)
{
switch (axis) {
case x:
return "x";
case y:
return "y";
case z:
return "z";
}
return "Axis not found.";
}
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <array> #include <array>
#include <map> #include <map>
#include <string>
enum Axis { enum Axis {
x = 0, x = 0,
...@@ -14,4 +15,9 @@ const std::map<Axis, std::array<double, 3>> unitVectors{ { x, { 1, 0, 0 } }, ...@@ -14,4 +15,9 @@ const std::map<Axis, std::array<double, 3>> unitVectors{ { x, { 1, 0, 0 } },
{ y, { 0, 1, 0 } }, { y, { 0, 1, 0 } },
{ z, { 0, 0, 1 } } }; { z, { 0, 0, 1 } } };
#endif namespace axis
\ No newline at end of file {
std::string to_string(Axis axis);
}
#endif
...@@ -398,15 +398,16 @@ void UpdateGrid27::rotateGridInInitializationProcess(int level) ...@@ -398,15 +398,16 @@ void UpdateGrid27::rotateGridInInitializationProcess(int level)
SPtr<ParameterRotatingGrid> paraRot = para->getRotatingGridParameter(); SPtr<ParameterRotatingGrid> paraRot = para->getRotatingGridParameter();
real intendedRotation = (real)paraRot->initialGridRotation; real intendedRotation = (real)paraRot->initialGridRotation;
auto axis = paraRot->rotationalAxis; auto axisRotation = paraRot->rotationalAxis;
auto angularVelocityInSimulation = paraRot->parameterRotHost->angularVelocity; auto angularVelocityInSimulation = paraRot->parameterRotHost->angularVelocity;
paraRot->parameterRotHost->angularVelocity[axis] = intendedRotation / steps; paraRot->parameterRotHost->angularVelocity[axisRotation] = intendedRotation / steps;
paraRot->parameterRotDevice->angularVelocity[axis] = paraRot->parameterRotHost->angularVelocity[axis]; paraRot->parameterRotDevice->angularVelocity[axisRotation] = paraRot->parameterRotHost->angularVelocity[axisRotation];
VF_LOG_INFO("Intended initial rotation for the rotating grid: {}. Center point for the rotation: ({}, {}, {}), Axis : "
VF_LOG_INFO("Intended initial rotation for the rotating grid: {}. Center point for the rotation: ({}, {}, {}), Axis : {}, Angular Velocity: {}.", "{}, Angular Velocity: {}.",
intendedRotation, paraRot->parameterRotHost->centerPoint[0], paraRot->parameterRotHost->centerPoint[1], intendedRotation, paraRot->parameterRotHost->centerPoint[0], paraRot->parameterRotHost->centerPoint[1],
paraRot->parameterRotHost->centerPoint[2], axis, paraRot->parameterRotHost->angularVelocity[axis]); paraRot->parameterRotHost->centerPoint[2], axis::to_string(axisRotation),
paraRot->parameterRotHost->angularVelocity[axisRotation]);
for (int i = 0; i < steps; i++) { for (int i = 0; i < steps; i++) {
paraRot->parameterRotHost->gridAngle[0] += paraRot->parameterRotHost->angularVelocity[0]; paraRot->parameterRotHost->gridAngle[0] += paraRot->parameterRotHost->angularVelocity[0];
...@@ -433,8 +434,8 @@ void UpdateGrid27::rotateGridInInitializationProcess(int level) ...@@ -433,8 +434,8 @@ void UpdateGrid27::rotateGridInInitializationProcess(int level)
para->getParD(level)->neighborFineToCoarse); para->getParD(level)->neighborFineToCoarse);
} }
paraRot->parameterRotHost->angularVelocity[axis] = angularVelocityInSimulation[axis]; paraRot->parameterRotHost->angularVelocity[axisRotation] = angularVelocityInSimulation[axisRotation];
paraRot->parameterRotDevice->angularVelocity[axis] = angularVelocityInSimulation[axis]; paraRot->parameterRotDevice->angularVelocity[axisRotation] = angularVelocityInSimulation[axisRotation];
VF_LOG_INFO("Angle x {}", paraRot->parameterRotHost->gridAngle[0]); VF_LOG_INFO("Angle x {}", paraRot->parameterRotHost->gridAngle[0]);
VF_LOG_INFO("Angle y {}", paraRot->parameterRotHost->gridAngle[1]); VF_LOG_INFO("Angle y {}", paraRot->parameterRotHost->gridAngle[1]);
......
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