VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
GridBuilder.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 GridBuilder_H
35#define GridBuilder_H
36
37#include <vector>
38#include <string>
39#include <memory>
40
42
43#define GEOMQS 6
44#define INLETQS 0
45#define OUTLETQS 1
46#define TOPQS 2
47#define BOTTOMQS 3
48#define FRONTQS 4
49#define BACKQS 5
50
51#define QFILES 7
52
53namespace vf::gpu {
54
55struct Vertex;
56class GridWrapper;
57class Transformator;
58class ArrowTransformator;
60class TransientBCInputFileReader;
61
62class BoundingBox;
63class Grid;
64
65enum class SideType;
66
67namespace grid_generator
68{
69class BoundaryCondition;
70}
71class GeometryBoundaryCondition;
72
74{
75public:
77 {
78 CPU, GPU
79 };
80
81 virtual ~GridBuilder() {}
82 virtual void getGridInformations(std::vector<int>& gridX, std::vector<int>& gridY, std::vector<int>& gridZ, std::vector<int>& distX, std::vector<int>& distY, std::vector<int>& distZ) = 0;
83 virtual uint getNumberOfGridLevels() const = 0;
84
85 virtual void writeArrows(std::string fileName) const = 0;
86
87 virtual SPtr<Grid> getGrid(uint level) = 0;
88
89 virtual unsigned int getNumberOfNodes(unsigned int level) const = 0;
91 uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative,
92 uint *geo, const int level) const = 0;
93 virtual void getDimensions(int &nx, int &ny, int &nz, const int level) const = 0;
94 virtual uint getNumberOfNodesCF(int level) = 0;
95 virtual uint getNumberOfNodesFC(int level) = 0;
96 virtual void getGridInterfaceIndices(uint* iCellCfc, uint* iCellCff, uint* iCellFcc, uint* iCellFcf, int level) const = 0;
97
98 virtual void getOffsetFC(real* xOffCf, real* yOffCf, real* zOffCf, int level) = 0;
99 virtual void getOffsetCF(real* xOffFc, real* yOffFc, real* zOffFc, int level) = 0;
100
101 virtual uint getSlipSize(int level) const = 0;
102 virtual void getSlipValues(real *normalX, real *normalY, real *normalZ, int *indices, int level) const = 0;
103 virtual void getSlipQs(real* qs[27], int level) const = 0;
104
105 virtual uint getStressSize(int level) const = 0;
106 virtual void getStressValues(real* normalX, real* normalY, real* normalZ, int* indices, uint* samplingIndices, real* samplingDistance, real* vonKarmanConstants,
107 real* roughnessLengths, int level) const = 0;
108 virtual void getStressQs(real* qs[27], int level) const = 0;
109 virtual uint getSurfaceLayerSize(int level) const = 0;
110 virtual void getSurfaceLayerValues(real* normalX, real* normalY, real* normalZ, int* indices, real* samplingDistances,
111 uint* samplingIndices, real* vonKarmanConstants, real* roughnessLengths,
113 real* heatingRates, int level) const = 0;
114 virtual void getSurfaceLayerQs(real* qs[27], int level) const = 0;
115 virtual uint getVelocitySize(int level) const = 0;
116 virtual void getVelocityValues(real* vx, real* vy, real* vz, int* indices, int level) const = 0;
117 virtual void getVelocityQs(real* qs[27], int level) const = 0;
118
119 virtual uint getPressureSize(int level) const = 0;
120 virtual void getPressureValues(real *rho, int *indices, int *neighborIndices, int level) const = 0;
121 virtual void getPressureQs(real *qs[27], int level) const = 0;
122
123 virtual size_t getNumberOfPressureBoundaryConditions(uint level) const = 0;
125 virtual void getPressureValues(real* density, int* indices, int* neighborIndices, uint level,
127 virtual void getPressureQs(real* qs[27], uint level, uint indexInBoundaryConditionVector) const = 0;
129
130 virtual uint getPrecursorSize(int level) const = 0;
132 real* weights0PP, real* weights0PM, real* weights0MP, real* weights0MM,
133 int* indices, std::vector<SPtr<TransientBCInputFileReader>>& reader,
134 int& numberOfPrecursorNodes, size_t& numberOfQuantities, uint& timeStepsBetweenReads,
135 real& velocityX, real& velocityY, real& velocityZ, int level) const = 0;
136
137 virtual void getPrecursorQs(real* qs[27], int level) const = 0;
138
139 virtual uint getADNoFluxSize(int level) const = 0;
140 virtual void getADNoFluxValues(int* indices, int level) const = 0;
141 virtual void getADNoFluxQs(real* qs[27], int level) const = 0;
142
143 virtual uint getADFluxSize(int level) const = 0;
144 virtual void getADFluxValues(real* normalX, real* normalY, real* normalZ, real* gradient, int* indices, int level) const = 0;
145 virtual void getADFluxQs(real* qs[27], int level) const = 0;
146
147 virtual uint getADDirichletSize(int level) const = 0;
148 virtual void getADDirichletValues(real* values, real* vx, real* vy, real* vz, int* indices, int level) const = 0;
149 virtual void getADDirichletQs(real* qs[27], int level) const = 0;
150
151 virtual uint getADNeumannSize(int level) const = 0;
152 virtual void getADNeumannValues(real* gradients, real* vx, real* vy, real* vz, int* indices, int level) const = 0;
153 virtual void getADNeumannQs(real* qs[27], int level) const = 0;
154
155 virtual size_t getNumberOfADOutflowBoundaryConditions(uint level) const = 0;
157 virtual void getADOutflowValues(int* indices, int* neighborIndices, uint level,
159 virtual void getADOutflowQs(real* qs[27], uint level, uint indexInBoundaryConditionVector) const = 0;
161
162 virtual uint getGeometrySize(int level) const = 0;
163 virtual void getGeometryIndices(int *indices, int level) const = 0;
164 virtual void getGeometryQs(real *qs[27], int level) const = 0;
165 virtual bool hasGeometryValues() const = 0;
166 virtual void getGeometryValues(real *vx, real *vy, real *vz, int level) const = 0;
167
169
171
172 virtual uint getCommunicationProcess(int direction) = 0;
173
174 virtual uint getNumberOfFluidNodes(unsigned int level) const = 0;
175 virtual void getFluidNodeIndices(uint *fluidNodeIndices, const int level) const = 0;
176 virtual uint getNumberOfFluidNodesBorder(unsigned int level) const = 0;
177 virtual void getFluidNodeIndicesBorder(uint *fluidNodeIndices, const int level) const = 0;
178
179 virtual uint getNumberOfSendIndices(int direction, uint level) = 0;
180 virtual uint getNumberOfReceiveIndices(int direction, uint level) = 0;
181 virtual void getSendIndices(uint *sendIndices, int direction, int level) = 0;
182 virtual void getReceiveIndices(uint *sendIndices, int direction, int level) = 0;
183
184 virtual void findFluidNodes(bool splitDomain) = 0;
185
186 virtual void addFluidNodeIndicesMacroVars(const std::vector<uint>& fluidNodeIndicesMacroVars, uint level) = 0;
187 virtual void addFluidNodeIndicesApplyBodyForce(const std::vector<uint>& fluidNodeIndicesApplyBodyForce, uint level) = 0;
188 virtual void addFluidNodeIndicesAllFeatures(const std::vector<uint>& fluidNodeIndicesAllFeatures, uint level) = 0;
190 virtual void sortFluidNodeIndicesMacroVars(uint level) = 0;
192 virtual void sortFluidNodeIndicesAllFeatures(uint level) = 0;
193 virtual uint getNumberOfFluidNodesMacroVars(uint level) const = 0;
194 virtual void getFluidNodeIndicesMacroVars(uint *fluidNodeIndicesMacroVars, int level) const = 0;
196 virtual void getFluidNodeIndicesApplyBodyForce(uint *fluidNodeIndicesApplyBodyForce, int level) const = 0;
198 virtual void getFluidNodeIndicesAllFeatures(uint *fluidNodeIndicesAllFeatures, int level) const = 0;
199
200
201};
202
203}
204
205#endif
206
virtual void getGeometryValues(real *vx, real *vy, real *vz, int level) const =0
virtual SPtr< Grid > getGrid(uint level)=0
virtual uint getPressureSize(int level) const =0
virtual bool hasGeometryValues() const =0
virtual void getOffsetCF(real *xOffFc, real *yOffFc, real *zOffFc, int level)=0
virtual uint getNumberOfFluidNodesAllFeatures(uint level) const =0
virtual void getVelocityQs(real *qs[27], int level) const =0
virtual void getSurfaceLayerQs(real *qs[27], int level) const =0
virtual void getGridInterfaceIndices(uint *iCellCfc, uint *iCellCff, uint *iCellFcc, uint *iCellFcf, int level) const =0
virtual uint getADDirichletSize(int level) const =0
virtual void getFluidNodeIndicesMacroVars(uint *fluidNodeIndicesMacroVars, int level) const =0
virtual void getFluidNodeIndicesAllFeatures(uint *fluidNodeIndicesAllFeatures, int level) const =0
virtual void getStressQs(real *qs[27], int level) const =0
virtual void getSlipValues(real *normalX, real *normalY, real *normalZ, int *indices, int level) const =0
virtual void getPressureValues(real *rho, int *indices, int *neighborIndices, int level) const =0
virtual size_t getPressureBoundaryConditionDirection(uint level, uint indexInBoundaryConditionVector) const =0
virtual uint getSurfaceLayerSize(int level) const =0
virtual void sortFluidNodeIndicesApplyBodyForce(uint level)=0
virtual size_t getNumberOfADOutflowBoundaryConditions(uint level) const =0
virtual void getOffsetFC(real *xOffCf, real *yOffCf, real *zOffCf, int level)=0
virtual uint getVelocitySize(int level) const =0
virtual void getReceiveIndices(uint *sendIndices, int direction, int level)=0
virtual uint getNumberOfNodesCF(int level)=0
virtual uint getNumberOfFluidNodesBorder(unsigned int level) const =0
virtual void getGridInformations(std::vector< int > &gridX, std::vector< int > &gridY, std::vector< int > &gridZ, std::vector< int > &distX, std::vector< int > &distY, std::vector< int > &distZ)=0
virtual uint getCommunicationProcess(int direction)=0
virtual void getADOutflowQs(real *qs[27], uint level, uint indexInBoundaryConditionVector) const =0
virtual void getSlipQs(real *qs[27], int level) const =0
virtual void getFluidNodeIndices(uint *fluidNodeIndices, const int level) const =0
virtual uint getADNeumannSize(int level) const =0
virtual void addFluidNodeIndicesApplyBodyForce(const std::vector< uint > &fluidNodeIndicesApplyBodyForce, uint level)=0
virtual void addAllFluidNodeIndicesToAllFeatures(uint level)=0
virtual void getADNoFluxValues(int *indices, int level) const =0
virtual void sortFluidNodeIndicesMacroVars(uint level)=0
virtual uint getGeometrySize(int level) const =0
virtual void getADDirichletValues(real *values, real *vx, real *vy, real *vz, int *indices, int level) const =0
virtual size_t getADOutflowBoundaryConditionDirection(uint level, uint indexInBoundaryConditionVector) const =0
virtual uint getNumberOfReceiveIndices(int direction, uint level)=0
virtual size_t getSizeOfPressureBoundaryCondition(uint level, uint indexInBoundaryConditionVector) const =0
virtual void addFluidNodeIndicesAllFeatures(const std::vector< uint > &fluidNodeIndicesAllFeatures, uint level)=0
virtual uint getNumberOfGridLevels() const =0
virtual void sortFluidNodeIndicesAllFeatures(uint level)=0
virtual void addFluidNodeIndicesMacroVars(const std::vector< uint > &fluidNodeIndicesMacroVars, uint level)=0
virtual void getADNoFluxQs(real *qs[27], int level) const =0
virtual void getADFluxValues(real *normalX, real *normalY, real *normalZ, real *gradient, int *indices, int level) const =0
virtual void getDimensions(int &nx, int &ny, int &nz, const int level) const =0
virtual uint getNumberOfSendIndices(int direction, uint level)=0
virtual void getSurfaceLayerValues(real *normalX, real *normalY, real *normalZ, int *indices, real *samplingDistances, uint *samplingIndices, real *vonKarmanConstants, real *roughnessLengths, real *roughnessLengthsTemperature, real *surfaceHeatFluxes, real *surfaceTemperatures, real *heatingRates, int level) const =0
virtual uint getNumberOfFluidNodesApplyBodyForce(uint level) const =0
virtual SPtr< grid_generator::BoundaryCondition > getBoundaryCondition(SideType side, uint level) const =0
virtual void getVelocityValues(real *vx, real *vy, real *vz, int *indices, int level) const =0
virtual uint getNumberOfNodesFC(int level)=0
virtual uint getNumberOfFluidNodes(unsigned int level) const =0
virtual void getGeometryQs(real *qs[27], int level) const =0
virtual void getADNeumannValues(real *gradients, real *vx, real *vy, real *vz, int *indices, int level) const =0
virtual void getFluidNodeIndicesBorder(uint *fluidNodeIndices, const int level) const =0
virtual uint getADFluxSize(int level) const =0
virtual uint getPrecursorSize(int level) const =0
virtual SPtr< GeometryBoundaryCondition > getGeometryBoundaryCondition(uint level) const =0
virtual unsigned int getNumberOfNodes(unsigned int level) const =0
virtual void getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, uint *geo, const int level) const =0
virtual void getADFluxQs(real *qs[27], int level) const =0
virtual size_t getNumberOfPressureBoundaryConditions(uint level) const =0
virtual uint getADNoFluxSize(int level) const =0
virtual void getGeometryIndices(int *indices, int level) const =0
virtual uint getNumberOfFluidNodesMacroVars(uint level) const =0
virtual void getSendIndices(uint *sendIndices, int direction, int level)=0
virtual void findFluidNodes(bool splitDomain)=0
virtual void getPressureValues(real *density, int *indices, int *neighborIndices, uint level, uint indexInBoundaryConditionVector) const =0
virtual void getADDirichletQs(real *qs[27], int level) const =0
virtual uint getSlipSize(int level) const =0
virtual void getPressureQs(real *qs[27], int level) const =0
virtual size_t getSizeOfADOutflowBoundaryCondition(uint level, uint indexInBoundaryConditionVector) const =0
virtual uint getStressSize(int level) const =0
virtual void getStressValues(real *normalX, real *normalY, real *normalZ, int *indices, uint *samplingIndices, real *samplingDistance, real *vonKarmanConstants, real *roughnessLengths, int level) const =0
virtual void getPrecursorValues(uint *neighbor0PP, uint *neighbor0PM, uint *neighbor0MP, uint *neighbor0MM, real *weights0PP, real *weights0PM, real *weights0MP, real *weights0MM, int *indices, std::vector< SPtr< TransientBCInputFileReader > > &reader, int &numberOfPrecursorNodes, size_t &numberOfQuantities, uint &timeStepsBetweenReads, real &velocityX, real &velocityY, real &velocityZ, int level) const =0
virtual void getADOutflowValues(int *indices, int *neighborIndices, uint level, uint indexInBoundaryConditionVector) const =0
virtual void writeArrows(std::string fileName) const =0
virtual void getFluidNodeIndicesApplyBodyForce(uint *fluidNodeIndicesApplyBodyForce, int level) const =0
virtual void getPrecursorQs(real *qs[27], int level) const =0
virtual void getADNeumannQs(real *qs[27], int level) const =0
virtual void getPressureQs(real *qs[27], uint level, uint indexInBoundaryConditionVector) const =0
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
unsigned int uint
Definition DataTypes.h:47
SideType
Definition Side.h:63