VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
GridReader.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//
32//=======================================================================================
33#ifndef GridReaderFiles_H
34#define GridReaderFiles_H
35
36#include "../GridProvider.h"
37
38#include <memory>
39#include <string>
40#include <vector>
41
43
44namespace vf::gpu {
45
46class Parameter;
47class BoundaryValues;
48class BoundaryQs;
49class CoordNeighborGeoV;
50
52{
53private:
54 bool binaer;
55 std::vector<std::string> channelDirections;
56 std::vector<std::string> channelBoundaryConditions;
57 std::shared_ptr<CoordNeighborGeoV> neighX, neighY, neighZ, neighWSB;
58 std::vector<std::shared_ptr<BoundaryValues>> BC_Values;
59
60 std::vector<std::vector<real>> velocityX_BCvalues, velocityY_BCvalues, velocityZ_BCvalues;
61 std::vector<std::vector<std::vector<real>>> velocityQs;
62 std::vector<std::vector<int>> velocityIndex;
63
64 std::vector<std::vector<real>> pressureBCvalues;
65 std::vector<std::vector<real>> outflowBCvalues;
66
67public:
68 GridReader(FILEFORMAT format, std::shared_ptr<Parameter> para,
69 std::shared_ptr<CudaMemoryManager> cudaMemoryManager);
70 ~GridReader() = default;
71 void allocArrays_CoordNeighborGeo() override;
72 void allocArrays_BoundaryValues(const BoundaryConditionFactory* bcFactory) override;
73 void allocArrays_OffsetScale() override;
74 void allocArrays_taggedFluidNodes() override;
75
76 void tagFluidNodeIndices(const std::vector<uint> &taggedFluidNodeIndices, CollisionTemplate tag, uint level) override;
77
78 void sortFluidNodeTags() override;
79
80 void initalValuesDomainDecompostion(int level);
81
83
84 void allocArrays_BoundaryQs() override;
85 bool getBinaer();
86 void setDimensions() override;
87 void setBoundingBox() override;
88 void initPeriodicNeigh(std::vector<std::vector<std::vector<unsigned int>>> periodV,
89 std::vector<std::vector<unsigned int>> periodIndex, std::string way) override;
90
91private:
92 void makeReader(std::shared_ptr<Parameter> para);
93 void makeReader(std::vector<std::shared_ptr<BoundaryQs>> &BC_Qs, std::shared_ptr<Parameter> para);
94
95 void setPressureValues(int channelSide) const;
96 void setPressRhoBC(int sizePerLevel, int level, int channelSide) const;
97
98 void fillVelocityVectors(int channelSide);
99 void setVelocityValues();
100 void setVelocity(int level, int sizePerLevel) const;
101
102 void setOutflowValues(int channelSide) const;
103 void setOutflow(int level, int sizePerLevel, int channelSide) const;
104
105 // void fillVelocityQVectors(int channelSide);
106 void setPressQs(std::shared_ptr<BoundaryQs> boundaryQ) const;
107 void setVelocityQs(std::shared_ptr<BoundaryQs> boundaryQ);
108 void setOutflowQs(std::shared_ptr<BoundaryQs> boundaryQ) const;
109 void setNoSlipQs(std::shared_ptr<BoundaryQs> boundaryQ) const;
110 void setGeoQs(std::shared_ptr<BoundaryQs> boundaryQ) const;
111 void modifyQElement(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
112
113 void initalVectorForQStruct(std::vector<std::vector<std::vector<real>>> &Qs, std::vector<std::vector<int>> &index,
114 std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
115 void copyVectorsToQStruct(std::vector<std::vector<real>> &Qs, std::vector<int> &index,
117 void initalQStruct(QforBoundaryConditions &Q, std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
118 void printQSize(std::string bc, std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
119 void setSizeNoSlip(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
120 void setSizeGeoQs(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
121 void setQ27Size(QforBoundaryConditions &Q, real *QQ, unsigned int sizeQ) const;
122 bool hasQs(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
123
124public:
125 void initalGridInformations() override;
126};
127
128}
129
130#endif
131
std::shared_ptr< Parameter > para
std::shared_ptr< CudaMemoryManager > cudaMemoryManager
void allocArrays_BoundaryQs() override
void setDimensions() override
void allocArrays_taggedFluidNodes() override
void setBoundingBox() override
void setChannelBoundaryCondition()
void allocArrays_BoundaryValues(const BoundaryConditionFactory *bcFactory) override
void tagFluidNodeIndices(const std::vector< uint > &taggedFluidNodeIndices, CollisionTemplate tag, uint level) override
void allocArrays_CoordNeighborGeo() override
void sortFluidNodeTags() override
void initPeriodicNeigh(std::vector< std::vector< std::vector< unsigned int > > > periodV, std::vector< std::vector< unsigned int > > periodIndex, std::string way) override
void initalValuesDomainDecompostion(int level)
void allocArrays_OffsetScale() override
void initalGridInformations() override
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
unsigned int uint
Definition DataTypes.h:47
CollisionTemplate
An enumeration for selecting a template of the collision kernel (CumulantK17)
Definition Calculation.h:57