36#ifndef MULTIGPUGRIDHELPER_H
37#define MULTIGPUGRIDHELPER_H
56class MultipleGridBuilder;
90 std::optional<real> overlapOfSubdomains = std::nullopt);
122 real roughnessLength,
real roughnessLengthTemperature,
real surfaceHeatFlux,
real surfaceTemperature,
real heatingRate,
130 real velocityX = vf::basics::constant::c0o1,
131 real velocityY = vf::basics::constant::c0o1,
132 real velocityZ = vf::basics::constant::c0o1,
133 real shiftY = vf::basics::constant::c0o1,
134 real shiftZ = vf::basics::constant::c0o1,
161 void setGlobalPeriodicity();
162 void setLocalPeriodicity(
bool periodicX,
bool periodicY,
bool periodicZ);
164 void calculateNumberOfSubdomains();
167 void sortSplitLocations();
173 void checkForNeighbors();
176 void configureSubDomainGrids();
179 void setUpCommunicationNeighbors();
185 void addFineGridsToGridBuilder();
188 void addGeometriesToGridBuilder();
197 template <
typename function>
200 if (!createGridsHasBeenCalled) {
201 throw std::runtime_error(
202 "MultipleGridBuilderFacade::createGrids() has to be called before setting boundary conditions");
221 uint numberOfSubdomainsTotal;
224 std::vector<real> xSplits;
225 std::vector<real> ySplits;
226 std::vector<real> zSplits;
229 std::optional<real> overlapOfSubdomains = std::nullopt;
232 std::array<uint, 3> index;
233 std::array<bool, 3> periodicity {
false,
false,
false};
237 std::map<communication_directions::CommunicationDirection, bool> hasNeighbors = {
244 std::vector<std::pair<std::shared_ptr<Object>,
uint>> fineGrids;
247 std::vector<std::shared_ptr<Object>> geometries;
249 bool createGridsHasBeenCalled =
false;
250 real shiftOnXInY{}, shiftOnXInZ{}, shiftOnYInX{}, shiftOnYInZ{}, shiftOnZInX{}, shiftOnZInY{};
Simplifies the creation of the grids for a multi-gpu simulation.
SPtr< BoundingBox > getSubDomainBox() const
void setPeriodicShiftOnXBoundaryInZDirection(real shift)
void setPeriodicShiftOnYBoundaryInZDirection(real shift)
uint getIndex1D(uint xIndex, uint yIndex, uint zIndex) const
void setADOutflowBoundaryCondition(SideType sideType)
uint getZ3D(uint index1D) const
void setNumberOfLayersForRefinement(uint numberOfLayersFine, uint numberOfLayersBetweenLevels) const
add number of layers for refinements
void addDomainSplit(real coordinate, Axis direction)
split the domain in the passed direction at the passed coordinate
uint getX3D(uint index1D) const
void setADFluxBoundaryCondition(SideType sideType, real normalX, real normalY, real normalZ, real gradient, real deltaX)
void addFineGrid(std::shared_ptr< Object > gridShape, uint levelFine)
adds a fine grid
void setOverlapOfSubdomains(real overlap)
set the overlap of the subdomains
void setPressureBoundaryCondition(SideType sideType, real rho) const
void setADDirichletBoundaryCondition(SideType sideType, real value, real vx, real vy, real vz)
std::array< uint, 3 > convertToIndices3D(uint index1D) const
void setPeriodicShiftOnZBoundaryInXDirection(real shift)
void setPeriodicShiftOnZBoundaryInYDirection(real shift)
void setADNoFluxBoundaryCondition(SideType sideType)
void setSlipBoundaryCondition(SideType sideType, real normalX, real normalY, real normalZ) const
void setSurfaceLayerBoundaryCondition(SideType sideType, real normalX, real normalY, real normalZ, uint samplingOffset, real vonKarmanConstant, real roughnessLength, real roughnessLengthTemperature, real surfaceHeatFlux, real surfaceTemperature, real heatingRate, real deltaX, real deltaT, std::shared_ptr< GbSpatialData3D< real > > roughnessMap=nullptr) const
void setStressBoundaryCondition(SideType sideType, real normalX, real normalY, real normalZ, uint samplingOffset, real vonKarmanConstant, real roughnessLength, real deltaX, std::shared_ptr< GbSpatialData3D< real > > roughnessMap=nullptr) const
SPtr< MultipleGridBuilder > getGridBuilder() const
void setPeriodicBoundaryCondition(bool periodic_X, bool periodic_Y, bool periodic_Z)
uint getY3D(uint index1D) const
void setPeriodicShiftOnYBoundaryInXDirection(real shift)
void setVelocityBoundaryCondition(SideType sideType, real vx, real vy, real vz, std::optional< std::function< void(real x, real y, real z, real &vx, real &vy, real &vz)> > velocityProfile=std::nullopt) const
void createGrids(uint generatePart)
generate the subdomain which is specified by generatePart
std::array< uint, 3 > numberOfSubdomains
total number of subdomains in each coordinate direction (computed)
void setPrecursorBoundaryCondition(SideType sideType, SPtr< FileCollection > fileCollection, bool cycleFiles=false, real velocityX=vf::basics::constant::c0o1, real velocityY=vf::basics::constant::c0o1, real velocityZ=vf::basics::constant::c0o1, real shiftY=vf::basics::constant::c0o1, real shiftZ=vf::basics::constant::c0o1, std::vector< uint > fileLevelToGridLevelMap={}) const
void setADNeumannBoundaryCondition(SideType sideType, real gradient, real vx, real vy, real vz, real dx)
void setPeriodicShiftOnXBoundaryInYDirection(real shift)
void setNoSlipBoundaryCondition(SideType sideType) const
void addGeometry(SPtr< Object > gridShape)
adds a geometry to the fluid domain
std::shared_ptr< T > SPtr