diff --git a/apps/gpu/RotatingGrid/RotatingGrid.cpp b/apps/gpu/RotatingGrid/RotatingGrid.cpp index 3e70d42cae1ceeee6db0d6c3890f18bf68ffee1a..8c100d4d7721ec8e483aedaf17fcb2c06c9215e0 100644 --- a/apps/gpu/RotatingGrid/RotatingGrid.cpp +++ b/apps/gpu/RotatingGrid/RotatingGrid.cpp @@ -97,7 +97,7 @@ int main() const std::string path("./output/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 Re = 2000.0; @@ -196,6 +196,9 @@ int main() gridBuilder->setPressureBoundaryCondition(SideType::MZ, 0.0); gridBuilder->setVelocityBoundaryCondition(SideType::PZ, 0.0, 0.0, -velocityLB); break; + case SideType::GEOMETRY: + throw std::runtime_error("Can't generate inflow at geometry."); + break; } gridBuilder->setNoSlipBoundaryCondition(SideType::MX); diff --git a/src/basics/geometry3d/Axis.cpp b/src/basics/geometry3d/Axis.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8d83ca8fbeab7994ede3bd9a0032b7e1583fecb9 --- /dev/null +++ b/src/basics/geometry3d/Axis.cpp @@ -0,0 +1,14 @@ +#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 diff --git a/src/basics/geometry3d/Axis.h b/src/basics/geometry3d/Axis.h index 5662483f69a94eb549adbcd16995b85d5c5d0e47..4bd924db197f35c73a45420031d490f0be957020 100644 --- a/src/basics/geometry3d/Axis.h +++ b/src/basics/geometry3d/Axis.h @@ -3,6 +3,7 @@ #include <array> #include <map> +#include <string> enum Axis { x = 0, @@ -14,4 +15,9 @@ const std::map<Axis, std::array<double, 3>> unitVectors{ { x, { 1, 0, 0 } }, { y, { 0, 1, 0 } }, { z, { 0, 0, 1 } } }; -#endif \ No newline at end of file +namespace axis +{ +std::string to_string(Axis axis); +} + +#endif diff --git a/src/gpu/core/Calculation/UpdateGrid27.cpp b/src/gpu/core/Calculation/UpdateGrid27.cpp index 894c945b1be26a3dbf4c37c6acd5d6c01f5c8c37..118dd22edfe1d35f7ba56d68751ac1f7d434c673 100644 --- a/src/gpu/core/Calculation/UpdateGrid27.cpp +++ b/src/gpu/core/Calculation/UpdateGrid27.cpp @@ -398,15 +398,16 @@ void UpdateGrid27::rotateGridInInitializationProcess(int level) SPtr<ParameterRotatingGrid> paraRot = para->getRotatingGridParameter(); real intendedRotation = (real)paraRot->initialGridRotation; - auto axis = paraRot->rotationalAxis; + auto axisRotation = paraRot->rotationalAxis; auto angularVelocityInSimulation = paraRot->parameterRotHost->angularVelocity; - paraRot->parameterRotHost->angularVelocity[axis] = intendedRotation / steps; - paraRot->parameterRotDevice->angularVelocity[axis] = paraRot->parameterRotHost->angularVelocity[axis]; + paraRot->parameterRotHost->angularVelocity[axisRotation] = intendedRotation / steps; + paraRot->parameterRotDevice->angularVelocity[axisRotation] = paraRot->parameterRotHost->angularVelocity[axisRotation]; - - VF_LOG_INFO("Intended initial rotation for the rotating grid: {}. Center point for the rotation: ({}, {}, {}), Axis : {}, Angular Velocity: {}.", + VF_LOG_INFO("Intended initial rotation for the rotating grid: {}. Center point for the rotation: ({}, {}, {}), Axis : " + "{}, Angular Velocity: {}.", 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++) { paraRot->parameterRotHost->gridAngle[0] += paraRot->parameterRotHost->angularVelocity[0]; @@ -433,8 +434,8 @@ void UpdateGrid27::rotateGridInInitializationProcess(int level) para->getParD(level)->neighborFineToCoarse); } - paraRot->parameterRotHost->angularVelocity[axis] = angularVelocityInSimulation[axis]; - paraRot->parameterRotDevice->angularVelocity[axis] = angularVelocityInSimulation[axis]; + paraRot->parameterRotHost->angularVelocity[axisRotation] = angularVelocityInSimulation[axisRotation]; + paraRot->parameterRotDevice->angularVelocity[axisRotation] = angularVelocityInSimulation[axisRotation]; VF_LOG_INFO("Angle x {}", paraRot->parameterRotHost->gridAngle[0]); VF_LOG_INFO("Angle y {}", paraRot->parameterRotHost->gridAngle[1]);