diff --git a/apps/gpu/FlowAroundSphere/FlowAroundSphere.cpp b/apps/gpu/FlowAroundSphere/FlowAroundSphere.cpp index a11e1c692b896503ee0cabd01e8de993c3de49be..d42c82f3b9350ea086b2d23a7ea16de7b8ea935a 100644 --- a/apps/gpu/FlowAroundSphere/FlowAroundSphere.cpp +++ b/apps/gpu/FlowAroundSphere/FlowAroundSphere.cpp @@ -54,6 +54,7 @@ #include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" #include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" #include "GridGenerator/grid/GridFactory.h" + #include "GridGenerator/geometries/Sphere/Sphere.h" ////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp index 02d61a83456090a3b96b207de5761b70d9b30fca..7b8445eac1e3b54f45f5a56e3e6ca04260354770 100644 --- a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp +++ b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp @@ -129,6 +129,7 @@ uint Side::getIndex(SPtr<Grid> grid, std::string coord, real constant, real v1, return INVALID_INDEX; } + for (int dir = 0; dir <= grids[level]->getEndDirection(); dir++) void MX::addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition) { diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h index 260bc18967296e63cc21fc0454c86cdcb65e8719..d4c9e3a4bcab73d368c863ee57d66f692126fa06 100644 --- a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h +++ b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h @@ -84,6 +84,27 @@ private: static uint getIndex(SPtr<Grid> grid, std::string coord, real constant, real v1, real v2); }; +class Geometry : public Side +{ +public: + void addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<gg::BoundaryCondition> boundaryCondition) override; + + int getCoordinate() const override + { + return X_INDEX; + } + + int getDirection() const override + { + return NEGATIVE_DIR; + } + + SideType whoAmI() const override + { + return SideType::GEOMETRY; + } +}; + class MX : public Side { public: @@ -233,7 +254,7 @@ public: case SideType::PZ: return SPtr<Side>(new PZ()); case SideType::GEOMETRY: - throw std::runtime_error("SideFactory::make() - SideType::GEOMETRY not supported."); + return SPtr<Side>(new Geometry()); default: throw std::runtime_error("SideFactory::make() - SideType not valid."); } diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp index 20c285c13aa2c7644fc1ac6ea6a87b5d8dc7f72c..4dee776a6692daaa02eeec39dca0c71c565b41d5 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp +++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp @@ -28,7 +28,7 @@ // //! \file LevelGridBuilder.cpp //! \ingroup grid -//! \author Soeren Peters, Stephan Lenz, Martin Schönherr +//! \author Soeren Peters, Stephan Lenz, Martin Sch�nherr //======================================================================================= #include "LevelGridBuilder.h" @@ -92,37 +92,40 @@ void LevelGridBuilder::setSlipBoundaryCondition(SideType sideType, real nomalX, void LevelGridBuilder::setVelocityBoundaryCondition(SideType sideType, real vx, real vy, real vz) { - SPtr<VelocityBoundaryCondition> velocityBoundaryCondition = VelocityBoundaryCondition::make(vx, vy, vz); + if (sideType == SideType::GEOMETRY) + setVelocityGeometryBoundaryCondition(vx, vy, vz); + else + { + SPtr<VelocityBoundaryCondition> velocityBoundaryCondition = VelocityBoundaryCondition::make(vx, vy, vz); - auto side = SideFactory::make(sideType); + auto side = SideFactory::make(sideType); - velocityBoundaryCondition->side = side; - velocityBoundaryCondition->side->addIndices(grids, 0, velocityBoundaryCondition); + velocityBoundaryCondition->side = side; + velocityBoundaryCondition->side->addIndices(grids, 0, velocityBoundaryCondition); - velocityBoundaryCondition->fillVelocityLists(); + velocityBoundaryCondition->fillVelocityLists(); - boundaryConditions[0]->velocityBoundaryConditions.push_back(velocityBoundaryCondition); + boundaryConditions[0]->velocityBoundaryConditions.push_back(velocityBoundaryCondition); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Velocity BC on level " << 0 << " with " << (int)velocityBoundaryCondition->indices.size() <<"\n"; + *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Velocity BC on level " << 0 << " with " << (int)velocityBoundaryCondition->indices.size() <<"\n"; + } } void LevelGridBuilder::setVelocityGeometryBoundaryCondition(real vx, real vy, real vz) { - geometryHasValues = true; - for (uint level = 0; level < getNumberOfGridLevels(); level++) { - if (boundaryConditions[level]->geometryBoundaryCondition != nullptr) - { - boundaryConditions[level]->geometryBoundaryCondition->vx = vx; - boundaryConditions[level]->geometryBoundaryCondition->vy = vy; - boundaryConditions[level]->geometryBoundaryCondition->vz = vz; - boundaryConditions[level]->geometryBoundaryCondition->side->addIndices(grids, level, boundaryConditions[level]->geometryBoundaryCondition); + if (boundaryConditions[level]->geometryBoundaryCondition != nullptr) + { + boundaryConditions[level]->geometryBoundaryCondition->vx = vx; + boundaryConditions[level]->geometryBoundaryCondition->vy = vy; + boundaryConditions[level]->geometryBoundaryCondition->vz = vz; + boundaryConditions[level]->geometryBoundaryCondition->side->addIndices(grids, level, boundaryConditions[level]->geometryBoundaryCondition); boundaryConditions[level]->geometryBoundaryCondition->fillVelocityLists(); *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Geometry Velocity BC on level " << level << " with " << (int)boundaryConditions[level]->geometryBoundaryCondition->indices.size() <<"\n"; - } + } } } @@ -159,7 +162,10 @@ void LevelGridBuilder::setNoSlipBoundaryCondition(SideType sideType) noSlipBoundaryCondition->side = side; noSlipBoundaryCondition->side->addIndices(grids, level, noSlipBoundaryCondition); - boundaryConditions[level]->noSlipBoundaryConditions.push_back(noSlipBoundaryCondition); + noSlipBoundaryCondition->fillVelocityLists(); + + // effectively just a wrapper for velocityBC with zero velocity. No distinction in GridGenerator. + boundaryConditions[level]->velocityBoundaryConditions.push_back(noSlipBoundaryCondition); } } @@ -469,9 +475,9 @@ void LevelGridBuilder::getGeometryValues(real* vx, real* vy, real* vz, int level { for (uint i = 0; i < boundaryConditions[level]->geometryBoundaryCondition->indices.size(); i++) { - vx[i] = boundaryConditions[level]->geometryBoundaryCondition->getVx(i); - vy[i] = boundaryConditions[level]->geometryBoundaryCondition->getVy(i); - vz[i] = boundaryConditions[level]->geometryBoundaryCondition->getVz(i); + vx[i] = boundaryConditions[level]->geometryBoundaryCondition->getVx(i); + vy[i] = boundaryConditions[level]->geometryBoundaryCondition->getVy(i); + vz[i] = boundaryConditions[level]->geometryBoundaryCondition->getVz(i); } } diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h index f2325435d99140f33eee9844c13908de87788558..b4a461ec764d0a97efd83ec7f4899814fe99a489 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h +++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h @@ -28,7 +28,7 @@ // //! \file LevelGridBuilder.h //! \ingroup grid -//! \author Soeren Peters, Stephan Lenz, Martin Schönherr +//! \author Soeren Peters, Stephan Lenz, Martin Sch�nherr //======================================================================================= #ifndef LEVEL_GRID_BUILDER_H #define LEVEL_GRID_BUILDER_H @@ -131,7 +131,7 @@ protected: std::vector<SPtr<PressureBoundaryCondition>> pressureBoundaryConditions; - std::vector<SPtr<VelocityBoundaryCondition> > noSlipBoundaryConditions; + std::vector<SPtr<VelocityBoundaryCondition>> noSlipBoundaryConditions; SPtr<GeometryBoundaryCondition> geometryBoundaryCondition; }; diff --git a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp index 565a02a2807ef15679bf08fa001ea9a03f78ca4e..c36a8cb70e6bb36dccb9179b9c014e5fb7464a30 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp +++ b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp @@ -28,7 +28,7 @@ // //! \file MultipleGridBuilder.cpp //! \ingroup grid -//! \author Soeren Peters, Stephan Lenz, Martin Schönherr +//! \author Soeren Peters, Stephan Lenz, Martin Sch�nherr //======================================================================================= #include "MultipleGridBuilder.h"