OpenLB
1.7
Loading...
Searching...
No Matches
src
dynamics
shanChenDynGForcedPostProcessor2D.hh
Go to the documentation of this file.
1
/* This file is part of the OpenLB library
2
*
3
* Copyright (C) 2008 Orestis Malaspinas, Andrea Parmigiani, Jonas Latt
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 SHAN_CHEN_DYN_G_FORCED_POST_PROCESSOR_2D_HH
25
#define SHAN_CHEN_DYN_G_FORCED_POST_PROCESSOR_2D_HH
26
27
#include "
shanChenDynGForcedPostProcessor2D.h
"
28
#include "
interactionPotential.h
"
29
#include "
core/util.h
"
30
#include "
utilities/finiteDifference2D.h
"
31
32
namespace
olb
{
33
35
//
36
//
37
//template<typename T, typename DESCRIPTOR>
38
//ShanChenDynGForcedPostProcessor2D <T,DESCRIPTOR>::
39
//ShanChenDynGForcedPostProcessor2D(int x0_, int x1_, int y0_, int y1_, T G_,
40
// std::vector<T> rho0_, AnalyticalF<1,T,T>& iP_,
41
// std::vector<BlockStructureD<2>*> partners_)
42
// : x0(x0_), x1(x1_), y0(y0_), y1(y1_), G(G_), rho0(rho0_), interactionPotential(iP_), partners(partners_)
43
//{ }
44
//
45
//template<typename T, typename DESCRIPTOR>
46
//ShanChenDynGForcedPostProcessor2D <T,DESCRIPTOR>::
47
//ShanChenDynGForcedPostProcessor2D(T G_,
48
// std::vector<T> rho0_, AnalyticalF<1,T,T>& iP_,
49
// std::vector<BlockStructureD<2>*> partners_)
50
// : x0(0), x1(0), y0(0), y1(0), G(G_), rho0(rho0_), interactionPotential(iP_), partners(partners_)
51
//{ }
52
//
53
//template<typename T, typename DESCRIPTOR>
54
//void ShanChenDynGForcedPostProcessor2D<T,DESCRIPTOR>::
55
//processSubDomain( BlockLattice<T,DESCRIPTOR>& blockLattice,
56
// int x0_, int x1_, int y0_, int y1_ )
57
//{
58
// typedef DESCRIPTOR L;
59
// enum {
60
// uOffset = L::template index<descriptors::VELOCITY>(),
61
// forceOffset = L::template index<descriptors::FORCE>(),
62
// externalForceOffset = L::ExternalField::externalForceBeginsAt
63
// };
64
//
65
// BlockLattice<T,DESCRIPTOR> *partnerLattice = static_cast<BlockLattice<T,DESCRIPTOR> *>(partners[0]);
66
//
67
// int newX0, newX1, newY0, newY1;
68
// if ( util::intersect ( x0, x1, y0, y1,
69
// x0_, x1_, y0_, y1_,
70
// newX0, newX1, newY0, newY1 ) ) {
71
// int nx = newX1-newX0+3; // include a one-cell boundary
72
// int ny = newY1-newY0+3; // include a one-cell boundary
73
// int offsetX = newX0-1;
74
// int offsetY = newY0-1;
75
//
76
// BlockData<2,T,T> rhoField1(nx, ny);
77
// BlockData<2,T,T> rhoField2(nx, ny);
78
//
79
// // Compute density and velocity on every site of first lattice, and store result
80
// // in external scalars; envelope cells are included, because they are needed
81
// // to compute the interaction potential in what follows.
82
// for (int iX=newX0-1; iX<=newX1+1; ++iX) {
83
// for (int iY=newY0-1; iY<=newY1+1; ++iY) {
84
// Cell<T,DESCRIPTOR> cell = blockLattice.get(iX,iY);
85
// rhoField1.get(iX-offsetX, iY-offsetY) = cell.computeRho()*rho0[0];
86
// }
87
// }
88
//
89
// // Compute density and velocity on every site of second lattice, and store result
90
// // in external scalars; envelope cells are included, because they are needed
91
// // to compute the interaction potential in what follows.
92
// for (int iX=newX0-1; iX<=newX1+1; ++iX) {
93
// for (int iY=newY0-1; iY<=newY1+1; ++iY) {
94
// Cell<T,DESCRIPTOR> cell = partnerLattice->get(iX,iY);
95
// rhoField2.get(iX-offsetX, iY-offsetY) = cell.computeRho()*rho0[1];
96
// }
97
// }
98
//
99
// for (int iX=newX0; iX<=newX1; ++iX) {
100
// for (int iY=newY0; iY<=newY1; ++iY) {
101
// Cell<T,DESCRIPTOR>& blockCell = blockLattice.get(iX,iY);
102
// Cell<T,DESCRIPTOR>& partnerCell = partnerLattice->get(iX,iY);
103
//
104
// T* j = blockCell.template getFieldPointer<descriptors::VELOCITY>();
105
// lbm<DESCRIPTOR>::computeJ(blockCell,j);
106
// j = partnerCell.template getFieldPointer<descriptors::VELOCITY>();
107
// lbm<DESCRIPTOR>::computeJ(partnerCell,j);
108
//
109
// T blockOmega = blockLattice.getDynamics(iX, iY)->getOmega();
110
// T partnerOmega = partnerLattice.getDynamics(iX, iY)->getOmega();
111
// // Computation of the common velocity, shared among the two populations
112
// T rhoTot = rhoField1.get(iX-offsetX, iY-offsetY)*blockOmega +
113
// rhoField2.get(iX-offsetX, iY-offsetY)*partnerOmega;
114
//
115
// T uTot[DESCRIPTOR::d];
116
// T *blockU = blockCell.template getFieldPointer<descriptors::VELOCITY>(); // contains precomputed value rho*u
117
// T *partnerU = partnerCell.template getFieldPointer<descriptors::VELOCITY>(); // contains precomputed value rho*u
118
// for (int iD = 0; iD < DESCRIPTOR::d; ++iD) {
119
// uTot[iD] = (blockU[iD]*rho0[0]*blockOmega + partnerU[iD]*rho0[1]*partnerOmega) / rhoTot;
120
// }
121
//
122
// // Computation of the interaction potential
123
// T rhoBlockContribution[L::d] = {T(), T()};
124
// T rhoPartnerContribution[L::d] = {T(), T()};
125
// T psi2;
126
// T psi1;
127
// interactionPotential(&psi2, &rhoField2.get(iX-offsetX, iY-offsetY));
128
// interactionPotential(&psi1, &rhoField1.get(iX-offsetX, iY-offsetY));
129
// for (int iPop = 0; iPop < L::q; ++iPop) {
130
// int nextX = iX + descriptors::c<L>(iPop,0);
131
// int nextY = iY + descriptors::c<L>(iPop,1);
132
// T blockRho;
133
// T partnerRho;
134
// interactionPotential(&blockRho, &rhoField1.get(nextX-offsetX, nextY-offsetY));//rho0[0];
135
// interactionPotential(&partnerRho, &rhoField2.get(nextX-offsetX, nextY-offsetY));///rho0[1];
136
// for (int iD = 0; iD < L::d; ++iD) {
137
// rhoBlockContribution[iD] += psi2 * blockRho * descriptors::c<L>(iPop,iD)* descriptors::t<T,L>(iPop);
138
// rhoPartnerContribution[iD] += psi1 * partnerRho * descriptors::c<L>(iPop,iD)* descriptors::t<T,L>(iPop);
139
// }
140
// }
141
//
142
// // Computation and storage of the final velocity, consisting
143
// // of u and the momentum difference due to interaction
144
// // potential plus external force
145
// T *blockForce = blockCell.template getFieldPointer<descriptors::FORCE>();
146
// T *partnerForce = partnerCell.template getFieldPointer<descriptors::FORCE>();
147
// T *externalBlockForce = blockCell.template getFieldPointer<descriptors::EXTERNAL_FORCE>();
148
// T *externalPartnerForce = partnerCell.template getFieldPointer<descriptors::EXTERNAL_FORCE>();
149
//
150
// T *gForce = blockCell[L::ExternalField::gBeginsAt];
151
//
152
// for (int iD = 0; iD < L::d; ++iD) {
153
// blockU[iD] = uTot[iD];
154
// blockForce[iD] = externalBlockForce[iD] - G*util::fabs(gForce[(iD+1)%2])*rhoPartnerContribution[iD]/rhoField1.get(iX-offsetX, iY-offsetY);
155
// partnerU[iD] = uTot[iD];
156
// partnerForce[iD] = externalPartnerForce[iD] - G*util::fabs(gForce[(iD+1)%2])*rhoBlockContribution[iD]/rhoField2.get(iX-offsetX, iY-offsetY);
157
// }
158
// }
159
// }
160
// }
161
//}
162
//
163
//template<typename T, typename DESCRIPTOR>
164
//void ShanChenDynGForcedPostProcessor2D<T,DESCRIPTOR>::
165
//process(BlockLattice<T,DESCRIPTOR>& blockLattice)
166
//{
167
// processSubDomain(blockLattice, x0, x1, y0, y1);
168
//}
169
//
170
//
172
//
173
//template<typename T, typename DESCRIPTOR>
174
//ShanChenDynGForcedGenerator2D<T,DESCRIPTOR>::ShanChenDynGForcedGenerator2D (
175
// int x0_, int x1_, int y0_, int y1_, T G_, std::vector<T> rho0_, AnalyticalF<1,T,T>& iP_ )
176
// : LatticeCouplingGenerator2D<T,DESCRIPTOR>(x0_, x1_, y0_, y1_), G(G_), rho0(rho0_), interactionPotential(iP_)
177
//{ }
178
//
179
//template<typename T, typename DESCRIPTOR>
180
//ShanChenDynGForcedGenerator2D<T,DESCRIPTOR>::ShanChenDynGForcedGenerator2D (
181
// T G_, std::vector<T> rho0_, AnalyticalF<1,T,T>& iP_ )
182
// : LatticeCouplingGenerator2D<T,DESCRIPTOR>(0, 0, 0, 0), G(G_), rho0(rho0_), interactionPotential(iP_)
183
//{ }
184
//
185
//template<typename T, typename DESCRIPTOR>
186
//PostProcessor2D<T,DESCRIPTOR>* ShanChenDynGForcedGenerator2D<T,DESCRIPTOR>::generate (
187
// std::vector<BlockStructureD<2>*> partners) const
188
//{
189
// return new ShanChenDynGForcedPostProcessor2D<T,DESCRIPTOR>(
190
// this->x0,this->x1,this->y0,this->y1,G, rho0, interactionPotential, partners);
191
//}
192
//
193
//template<typename T, typename DESCRIPTOR>
194
//LatticeCouplingGenerator2D<T,DESCRIPTOR>* ShanChenDynGForcedGenerator2D<T,DESCRIPTOR>::clone() const
195
//{
196
// return new ShanChenDynGForcedGenerator2D<T,DESCRIPTOR>(*this);
197
//}
198
199
200
}
// namespace olb
201
202
#endif
finiteDifference2D.h
interactionPotential.h
olb
Top level namespace for all of OpenLB.
Definition
boundaryPostProcessors2D.h:34
shanChenDynGForcedPostProcessor2D.h
util.h
Set of functions commonly used in LB computations – header file.
Generated on Tue Mar 5 2024 09:57:47 for OpenLB by
1.10.0