VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
LBMKernel.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
35#ifndef LBMKERNEL_H
36#define LBMKERNEL_H
37
38#include "LBMSystem.h"
39#include <PointerDefinitions.h>
40#include <array>
41#include <limits>
42#include <muParser.h>
43
44class BCSet;
45class DataSet3D;
46class Block3D;
47
50{
51public:
52 LBMKernel();
53 virtual ~LBMKernel() = default;
54
55 virtual SPtr<LBMKernel> clone() = 0;
56
57 virtual void calculate(int step) = 0;
58 virtual real getCalculationTime() = 0;
59
60 virtual void setBCSet(SPtr<BCSet> bcp);
61 virtual SPtr<BCSet> getBCSet() const;
62
64 virtual real getCollisionFactor() const;
65
66 virtual void setGhostLayerWidth(int witdh);
67 virtual int getGhostLayerWidth() const;
68
70 virtual SPtr<DataSet3D> getDataSet() const;
71
72 void setForcingX1(real forcingX1);
73 void setForcingX2(real forcingX2);
74 void setForcingX3(real forcingX3);
75
76 void setForcingX1(const mu::Parser &parser);
77 void setForcingX2(const mu::Parser &parser);
78 void setForcingX3(const mu::Parser &parser);
79
80 void setForcingX1(const std::string &muParserString);
81 void setForcingX2(const std::string &muParserString);
82 void setForcingX3(const std::string &muParserString);
83
84 void setIndex(int x1, int x2, int x3);
85
86 real getDeltaT() const;
87 void setDeltaT(real dt);
88
89 bool getCompressible() const;
90 void setCompressible(bool val);
91
92 bool getWithForcing() const;
93 void setWithForcing(bool val);
94
96 SPtr<Block3D> getBlock() const;
97
98 bool isInsideOfDomain(const int &x1, const int &x2, const int &x3) const;
99
100 void swapDistributions();
101
102 void setNX(std::array<int, 3> nx);
103 std::array<int, 3> getNX();
104
105protected:
110 bool compressible{ false };
111
112 // forcing
113 bool withForcing{ false };
114 mu::Parser muForcingX1;
115 mu::Parser muForcingX2;
116 mu::Parser muForcingX3;
117 int ix1, ix2, ix3;
118 real deltaT{ 1.0 };
119
121
122 std::array<int, 3> nx;
123
124private:
125 void checkFunction(mu::Parser fct);
126};
127
128#endif
129
A class provides an interface for boundary conditions in the calculation loop.
Definition BCSet.h:47
A class implements a block structure.
Definition Block3D.h:49
A class provides an interface for data structures in the kernel.
Definition DataSet3D.h:52
A base class provides basic functionality for LBM kernel.
Definition LBMKernel.h:50
mu::Parser muForcingX2
Definition LBMKernel.h:115
real deltaT
Definition LBMKernel.h:118
virtual void calculate(int step)=0
virtual ~LBMKernel()=default
std::array< int, 3 > nx
Definition LBMKernel.h:122
WPtr< Block3D > block
Definition LBMKernel.h:120
real collFactor
Definition LBMKernel.h:108
int ghostLayerWidth
Definition LBMKernel.h:109
virtual SPtr< LBMKernel > clone()=0
SPtr< BCSet > bcSet
Definition LBMKernel.h:107
bool withForcing
Definition LBMKernel.h:113
bool compressible
Definition LBMKernel.h:110
SPtr< DataSet3D > dataSet
Definition LBMKernel.h:106
mu::Parser muForcingX3
Definition LBMKernel.h:116
virtual real getCalculationTime()=0
mu::Parser muForcingX1
Definition LBMKernel.h:114
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
void swapDistributions()
SPtr< Block3D > getBlock() const
virtual void setDataSet(SPtr< DataSet3D > dataSet)
virtual real getCollisionFactor() const
Definition LBMKernel.cpp:59
virtual void setBCSet(SPtr< BCSet > bcp)
Definition LBMKernel.cpp:53
virtual void setCollisionFactor(real collFactor)
Definition LBMKernel.cpp:57
void setDeltaT(real dt)
void setForcingX3(real forcingX3)
Definition LBMKernel.cpp:72
bool getWithForcing() const
virtual SPtr< DataSet3D > getDataSet() const
virtual void setGhostLayerWidth(int witdh)
virtual SPtr< BCSet > getBCSet() const
Definition LBMKernel.cpp:55
bool isInsideOfDomain(const int &x1, const int &x2, const int &x3) const
void setNX(std::array< int, 3 > nx)
void setWithForcing(bool val)
bool getCompressible() const
virtual int getGhostLayerWidth() const
void setBlock(SPtr< Block3D > block)
void setIndex(int x1, int x2, int x3)
real getDeltaT() const
void setForcingX2(real forcingX2)
Definition LBMKernel.cpp:67
void setForcingX1(real forcingX1)
Definition LBMKernel.cpp:61
std::array< int, 3 > getNX()
void setCompressible(bool val)
UbTypeOp< typenameUbDuoT< N, UbDuo< A, B > >::ResultT >::RefT val(UbDuo< A, B > &d)
Definition UbTuple.h:393