VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
GridGenerator.h
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
33//=======================================================================================
34#ifndef GridReaderGenerator_H
35#define GridReaderGenerator_H
36
37#include "../GridProvider.h"
38
39#include <string>
40#include <vector>
41
43
44namespace vf::parallel
45{
46class Communicator;
47}
48
49
50namespace vf::gpu {
51
52class Parameter;
53class GridBuilder;
54class IndexRearrangementForStreams;
55class InterpolationCellGrouper;
56class BoundaryConditionFactory;
57
61 : public GridProvider
62{
63private:
65 std::vector<std::string> channelDirections;
67 std::vector<std::string> channelBoundaryConditions;
68
69 std::shared_ptr<GridBuilder> builder;
70 std::unique_ptr<const IndexRearrangementForStreams> indexRearrangement;
71 std::unique_ptr<const InterpolationCellGrouper> interpolationGrouper;
72 const uint mpiProcessID;
73
74public:
75 GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::parallel::Communicator& communicator);
76 ~GridGenerator() override;
78 void setIndexRearrangementForStreams(std::unique_ptr<IndexRearrangementForStreams>&& indexRearrangement);
79
81 void allocArrays_CoordNeighborGeo() override;
83 void allocArrays_BoundaryValues(const BoundaryConditionFactory* bcFactory) override;
85 void allocArrays_BoundaryQs() override;
86 void allocArrays_OffsetScale() override;
87 void allocArrays_taggedFluidNodes() override;
88
89 void tagFluidNodeIndices(const std::vector<uint>& taggedFluidNodeIndices, CollisionTemplate tag, uint level) override;
90 void sortFluidNodeTags() override;
91
92 virtual void setDimensions() override;
93 virtual void setBoundingBox() override;
94
95 virtual void initPeriodicNeigh(std::vector<std::vector<std::vector<unsigned int> > > periodV, std::vector<std::vector<unsigned int> > periodIndex, std::string way) override;
96 void initalGridInformations() override;
97
98private:
99 void setPressureValues(int channelSide) const;
100 void setPressRhoBC(int sizePerLevel, int level, int channelSide) const;
101
102 void setVelocityValues(int channelSide) const;
103 void setVelocity(int level, int sizePerLevel, int channelSide) const;
104
105 void setOutflowValues(int channelSide) const;
106 void setOutflow(int level, int sizePerLevel, int channelSide) const;
107
108 void setPressQs(int channelSide) const;
109 void setVelocityQs(int channelSide) const;
110 void setOutflowQs(int channelSide) const;
111 void setNoSlipQs(int channelSide) const;
112 void setGeoQs() const;
113 void modifyQElement(int channelSide, unsigned int level) const;
114
115 void initalQStruct(QforBoundaryConditions& Q,int channelSide, unsigned int level) const;
116 void printQSize(std::string bc,int channelSide, unsigned int level) const;
117 void setSizeNoSlip(int channelSide, unsigned int level) const;
118 void setSizeGeoQs(unsigned int level) const;
119 void setQ27Size(QforBoundaryConditions &Q, real* QQ, unsigned int sizeQ) const;
120 bool hasQs(int channelSide, unsigned int level) const;
121
122 void initalValuesDomainDecompostion();
123
125 void initPressureBoundaryCondition();
128 void initDirectionalPressureBoundaryConditions();
129
132 void initDirectionalConcentrationBoundaryConditions();
133
135 void initSubgridDistancesOfPressureBoundaryCondition(uint level);
137 void initSubgridDistancesOfDirectionalPressureBoundaryCondition(uint level);
138
140 std::string verifyNeighborIndices(int level) const;
146 std::string verifyNeighborIndex(int level, int index, int &invalidNodes, int &stopperNodes, int &wrongNeighbors) const;
153 std::string checkNeighbor(int level, real x, real y, real z, int index, int& numberOfWrongNeihgbors, int neighborIndex, real neighborX, real neighborY, real neighborZ, std::string direction) const;
158
159 static void getPointersToBoundaryConditions(real** subgridDistancesInDirections, real* subgridDistances, const unsigned int numberOfBCnodes);
161 static void initPointersToSubgridDistances(QforBoundaryConditions& boundaryCondition);
163 static void initPointersToSubgridDistances(QforDirectionalBoundaryCondition& boundaryCondition);
165 static void initPointersToSubgridDistances(QforDirectionalADBoundaryCondition& boundaryCondition);
166
167private:
169};
170
171}
172
173#endif
174
mapping the grid of grid generator to data structure for simulation
void allocArrays_BoundaryQs() override
allocates and initialized the sub-grid distances at the boundary conditions
virtual void initPeriodicNeigh(std::vector< std::vector< std::vector< unsigned int > > > periodV, std::vector< std::vector< unsigned int > > periodIndex, std::string way) override
void initalGridInformations() override
void tagFluidNodeIndices(const std::vector< uint > &taggedFluidNodeIndices, CollisionTemplate tag, uint level) override
void allocArrays_CoordNeighborGeo() override
allocates and initialized the data structures for Coordinates and node types
void allocArrays_taggedFluidNodes() override
void allocArrays_OffsetScale() override
virtual void setDimensions() override
void setIndexRearrangementForStreams(std::unique_ptr< IndexRearrangementForStreams > &&indexRearrangement)
overwrites the default IndexRearrangementForStreams
virtual void setBoundingBox() override
void allocArrays_BoundaryValues(const BoundaryConditionFactory *bcFactory) override
allocates and initialized the values at the boundary conditions
void sortFluidNodeTags() override
std::shared_ptr< Parameter > para
std::shared_ptr< CudaMemoryManager > cudaMemoryManager
An abstract class for communication between processes in parallel computation.
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
unsigned int uint
Definition DataTypes.h:47
@ z
Definition Axis.h:44
@ x
Definition Axis.h:42
@ y
Definition Axis.h:43
CollisionTemplate
An enumeration for selecting a template of the collision kernel (CumulantK17)
Definition Calculation.h:57