OpenLB 1.7
Loading...
Searching...
No Matches
advectionDiffusionForces.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2016 Robin Trunk
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
24#ifndef ADVECTION_DIFFUSION_FORCES_H
25#define ADVECTION_DIFFUSION_FORCES_H
26
27#include "core/unitConverter.h"
28
29namespace olb {
30
31template<typename T, typename DESCRIPTOR,
32 typename ADLattice=descriptors::D3Q7<descriptors::VELOCITY,descriptors::VELOCITY2>>
34public:
36 {
37 initArg = 0;
38 };
40 virtual void applyForce(T force[], Cell<T,DESCRIPTOR> *nsCell, Cell<T,ADLattice> *adCell, T vel[], int latticeR[])=0;
42 {
43 return initArg;
44 }
45private:
46 int initArg;
47};
48
49template<typename T, typename DESCRIPTOR,
50 typename ADLattice=descriptors::D3Q7<descriptors::VELOCITY,descriptors::VELOCITY2>>
51class AdvDiffDragForce3D : public AdvectionDiffusionForce3D<T,DESCRIPTOR,ADLattice> {
52public:
53 AdvDiffDragForce3D(UnitConverter<T,DESCRIPTOR> const& converter_, T St_);
54 AdvDiffDragForce3D(UnitConverter<T,DESCRIPTOR> const& converter_, T pRadius_, T pRho_);
55 ~AdvDiffDragForce3D() override {};
56 void applyForce(T force[], Cell<T,DESCRIPTOR> *nsCell, Cell<T,ADLattice> *adCell, T vel[], int latticeR[]) override;
57
58private:
59 int initArg;
60 T dragCoeff;
61};
62
63template<typename T, typename DESCRIPTOR,
64typename ADLattice=descriptors::D3Q7<descriptors::VELOCITY,descriptors::VELOCITY2>>
65class AdvDiffSNDragForce3D : public AdvectionDiffusionForce3D<T,DESCRIPTOR,ADLattice> {
66public:
67 AdvDiffSNDragForce3D(UnitConverter<T,DESCRIPTOR> const& converter_, T pRadius_, T pRho_);
68 ~AdvDiffSNDragForce3D() override {};
69 void applyForce(T force[], Cell<T,DESCRIPTOR> *nsCell, Cell<T,ADLattice> *adCell, T vel[], int latticeR[]) override;
70
71private:
72 int initArg;
73 T dragCoeff;
74 T Re_pCoeff;
75};
76
77template<typename T, typename DESCRIPTOR,
78typename ADLattice=descriptors::D3Q7<descriptors::VELOCITY,descriptors::VELOCITY2>>
79class AdvDiffBuoyancyForce3D : public AdvectionDiffusionForce3D<T,DESCRIPTOR,ADLattice> {
80public:
83 void applyForce(T force[], Cell<T,DESCRIPTOR> *nsCell, Cell<T,ADLattice> *adCell, T vel[], int latticeR[]) override;
84
85private:
86 int initArg;
87 T densDiff;
88 Vector<T,3> gravity;
89};
90
91template<typename T, typename DESCRIPTOR,
92typename ADLattice=descriptors::D3Q7<descriptors::VELOCITY,descriptors::VELOCITY2>>
93class AdvDiffRotatingForce3D : public AdvectionDiffusionForce3D<T,DESCRIPTOR,ADLattice> {
94public:
96 const UnitConverter<T,DESCRIPTOR>& converter_,
97 std::vector<T> axisPoint_,
98 std::vector<T> axisDirection_,
99 T w_, T* frac_,
100 bool centrifugeForceOn_ = true,
101 bool coriolisForceOn_ = true);
102 AdvDiffRotatingForce3D(UnitConverter<T,DESCRIPTOR> const& converter_, T pRadius_, T pRho_);
104 void applyForce(T force[], Cell<T,DESCRIPTOR> *nsCell, Cell<T,ADLattice> *adCell, T vel[], int latticeR[]);
105
106protected:
108 std::vector<T> axisPoint;
109 std::vector<T> axisDirection;
111 T w;
115
116};
117
118template<typename T, typename DESCRIPTOR,
120class AdvDiffMagneticWireForce3D : public AdvectionDiffusionForce3D<T,DESCRIPTOR,ADLattice> {
121public:
122 AdvDiffMagneticWireForce3D(SuperGeometry<T,3>& superGeometry_, UnitConverter<T,DESCRIPTOR> const& converter_, T pMass, AnalyticalF<3,T, T>& getMagForce);
124 void applyForce(T force[], Cell<T,DESCRIPTOR> *nsCell, Cell<T,ADLattice> *adCell, T vel[], int latticeR[]) override;
125
126private:
128 int initArg;
129 T _pMass;
130 T _conversionVelocity;
131 AnalyticalF<3,T, T>& _getMagForce;
132};
133
134}
135
136#endif
AdvDiffBuoyancyForce3D(UnitConverter< T, DESCRIPTOR > const &converter_, Vector< T, 3 > g, T pRho_)
void applyForce(T force[], Cell< T, DESCRIPTOR > *nsCell, Cell< T, ADLattice > *adCell, T vel[], int latticeR[]) override
AdvDiffDragForce3D(UnitConverter< T, DESCRIPTOR > const &converter_, T St_)
void applyForce(T force[], Cell< T, DESCRIPTOR > *nsCell, Cell< T, ADLattice > *adCell, T vel[], int latticeR[]) override
AdvDiffMagneticWireForce3D(SuperGeometry< T, 3 > &superGeometry_, UnitConverter< T, DESCRIPTOR > const &converter_, T pMass, AnalyticalF< 3, T, T > &getMagForce)
void applyForce(T force[], Cell< T, DESCRIPTOR > *nsCell, Cell< T, ADLattice > *adCell, T vel[], int latticeR[]) override
void applyForce(T force[], Cell< T, DESCRIPTOR > *nsCell, Cell< T, ADLattice > *adCell, T vel[], int latticeR[])
AdvDiffRotatingForce3D(UnitConverter< T, DESCRIPTOR > const &converter_, T pRadius_, T pRho_)
AdvDiffRotatingForce3D(SuperGeometry< T, 3 > &superGeometry_, const UnitConverter< T, DESCRIPTOR > &converter_, std::vector< T > axisPoint_, std::vector< T > axisDirection_, T w_, T *frac_, bool centrifugeForceOn_=true, bool coriolisForceOn_=true)
void applyForce(T force[], Cell< T, DESCRIPTOR > *nsCell, Cell< T, ADLattice > *adCell, T vel[], int latticeR[]) override
AdvDiffSNDragForce3D(UnitConverter< T, DESCRIPTOR > const &converter_, T pRadius_, T pRho_)
virtual void applyForce(T force[], Cell< T, DESCRIPTOR > *nsCell, Cell< T, ADLattice > *adCell, T vel[], int latticeR[])=0
AnalyticalF are applications from DD to XD, where X is set by the constructor.
Highest-level interface to Cell data.
Definition cell.h:148
Representation of a statistic for a parallel 2D geometry.
Conversion between physical and lattice units, as well as discretization.
Plain old scalar vector.
Definition vector.h:47
Top level namespace for all of OpenLB.
Unit conversion handling – header file.