OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
olb::ForceCoupling3D Struct Reference

#include <freeEnergyCoupling3D.h>

+ Collaboration diagram for olb::ForceCoupling3D:

Public Member Functions

template<typename CELLS >
void apply (CELLS &cells) any_platform
 

Static Public Attributes

static constexpr OperatorScope scope = OperatorScope::PerCell
 

Detailed Description

Definition at line 114 of file freeEnergyCoupling3D.h.

Member Function Documentation

◆ apply()

template<typename CELLS >
void olb::ForceCoupling3D::apply ( CELLS & cells)
inline

Definition at line 120 of file freeEnergyCoupling3D.h.

120 {
121
122 using V = typename CELLS::template value_t<names::A>::value_t;
123 using DESCRIPTOR = typename CELLS::template value_t<names::A>::descriptor_t;
124
125 // Get the cell of the first lattice
126 auto& cellA = cells.template get<names::A>();
127
128 // Get the cell of the second lattice
129 auto& cellB = cells.template get<names::B>();
130
131 V phi = cellA.computeRho();
132 V rho = cellB.computeRho();
133
134 // Calculatations for lattice A.
135 auto cellA1 = cellA.neighbor(descriptors::c<DESCRIPTOR>(1));
136 auto cellA2 = cellA.neighbor(descriptors::c<DESCRIPTOR>(2));
137 auto cellA3 = cellA.neighbor(descriptors::c<DESCRIPTOR>(3));
138 auto cellA4 = cellA.neighbor(descriptors::c<DESCRIPTOR>(4));
139 auto cellA5 = cellA.neighbor(descriptors::c<DESCRIPTOR>(5));
140 auto cellA6 = cellA.neighbor(descriptors::c<DESCRIPTOR>(6));
141 auto cellA7 = cellA.neighbor(descriptors::c<DESCRIPTOR>(7));
142 auto cellA8 = cellA.neighbor(descriptors::c<DESCRIPTOR>(8));
143 auto cellA9 = cellA.neighbor(descriptors::c<DESCRIPTOR>(9));
144 auto cellA10 = cellA.neighbor(descriptors::c<DESCRIPTOR>(10));
145 auto cellA11 = cellA.neighbor(descriptors::c<DESCRIPTOR>(11));
146 auto cellA12 = cellA.neighbor(descriptors::c<DESCRIPTOR>(12));
147 auto cellA13 = cellA.neighbor(descriptors::c<DESCRIPTOR>(13));
148 auto cellA14 = cellA.neighbor(descriptors::c<DESCRIPTOR>(14));
149 auto cellA15 = cellA.neighbor(descriptors::c<DESCRIPTOR>(15));
150 auto cellA16 = cellA.neighbor(descriptors::c<DESCRIPTOR>(16));
151 auto cellA17 = cellA.neighbor(descriptors::c<DESCRIPTOR>(17));
152 auto cellA18 = cellA.neighbor(descriptors::c<DESCRIPTOR>(18));
153
154 V gradMuPhiX = 1./12. * (
155 - cellA6.template getField<descriptors::CHEM_POTENTIAL>()
156 - cellA7.template getField<descriptors::CHEM_POTENTIAL>()
157 - cellA4.template getField<descriptors::CHEM_POTENTIAL>()
158 - 2 * cellA1.template getField<descriptors::CHEM_POTENTIAL>()
159 - cellA5.template getField<descriptors::CHEM_POTENTIAL>()
160 + cellA14.template getField<descriptors::CHEM_POTENTIAL>()
161 + 2 * cellA10.template getField<descriptors::CHEM_POTENTIAL>()
162 + cellA13.template getField<descriptors::CHEM_POTENTIAL>()
163 + cellA16.template getField<descriptors::CHEM_POTENTIAL>()
164 + cellA15.template getField<descriptors::CHEM_POTENTIAL>());
165
166 V gradMuPhiY = 1./12. * (
167 - cellA4.template getField<descriptors::CHEM_POTENTIAL>()
168 - cellA14.template getField<descriptors::CHEM_POTENTIAL>()
169 - cellA8.template getField<descriptors::CHEM_POTENTIAL>()
170 - 2 * cellA2.template getField<descriptors::CHEM_POTENTIAL>()
171 - cellA9.template getField<descriptors::CHEM_POTENTIAL>()
172 + cellA18.template getField<descriptors::CHEM_POTENTIAL>()
173 + 2 * cellA11.template getField<descriptors::CHEM_POTENTIAL>()
174 + cellA17.template getField<descriptors::CHEM_POTENTIAL>()
175 + cellA5.template getField<descriptors::CHEM_POTENTIAL>()
176 + cellA13.template getField<descriptors::CHEM_POTENTIAL>());
177
178 V gradMuPhiZ = 1./12. * (
179 - cellA8.template getField<descriptors::CHEM_POTENTIAL>()
180 - cellA18.template getField<descriptors::CHEM_POTENTIAL>()
181 - cellA6.template getField<descriptors::CHEM_POTENTIAL>()
182 - 2 * cellA3.template getField<descriptors::CHEM_POTENTIAL>()
183 - cellA16.template getField<descriptors::CHEM_POTENTIAL>()
184 + cellA7.template getField<descriptors::CHEM_POTENTIAL>()
185 + 2 * cellA12.template getField<descriptors::CHEM_POTENTIAL>()
186 + cellA15.template getField<descriptors::CHEM_POTENTIAL>()
187 + cellA9.template getField<descriptors::CHEM_POTENTIAL>()
188 + cellA17.template getField<descriptors::CHEM_POTENTIAL>());
189
190
191 // Calculatations for lattice B.
192 auto cellB1 = cellB.neighbor(descriptors::c<DESCRIPTOR>(1));
193 auto cellB2 = cellB.neighbor(descriptors::c<DESCRIPTOR>(2));
194 auto cellB3 = cellB.neighbor(descriptors::c<DESCRIPTOR>(3));
195 auto cellB4 = cellB.neighbor(descriptors::c<DESCRIPTOR>(4));
196 auto cellB5 = cellB.neighbor(descriptors::c<DESCRIPTOR>(5));
197 auto cellB6 = cellB.neighbor(descriptors::c<DESCRIPTOR>(6));
198 auto cellB7 = cellB.neighbor(descriptors::c<DESCRIPTOR>(7));
199 auto cellB8 = cellB.neighbor(descriptors::c<DESCRIPTOR>(8));
200 auto cellB9 = cellB.neighbor(descriptors::c<DESCRIPTOR>(9));
201 auto cellB10 = cellB.neighbor(descriptors::c<DESCRIPTOR>(10));
202 auto cellB11 = cellB.neighbor(descriptors::c<DESCRIPTOR>(11));
203 auto cellB12 = cellB.neighbor(descriptors::c<DESCRIPTOR>(12));
204 auto cellB13 = cellB.neighbor(descriptors::c<DESCRIPTOR>(13));
205 auto cellB14 = cellB.neighbor(descriptors::c<DESCRIPTOR>(14));
206 auto cellB15 = cellB.neighbor(descriptors::c<DESCRIPTOR>(15));
207 auto cellB16 = cellB.neighbor(descriptors::c<DESCRIPTOR>(16));
208 auto cellB17 = cellB.neighbor(descriptors::c<DESCRIPTOR>(17));
209 auto cellB18 = cellB.neighbor(descriptors::c<DESCRIPTOR>(18));
210
211 V gradMuRhoX = 1./12. * (
212 - cellB6.template getField<descriptors::CHEM_POTENTIAL>()
213 - cellB7.template getField<descriptors::CHEM_POTENTIAL>()
214 - cellB4.template getField<descriptors::CHEM_POTENTIAL>()
215 - 2 * cellB1.template getField<descriptors::CHEM_POTENTIAL>()
216 - cellB5.template getField<descriptors::CHEM_POTENTIAL>()
217 + cellB14.template getField<descriptors::CHEM_POTENTIAL>()
218 + 2 * cellB10.template getField<descriptors::CHEM_POTENTIAL>()
219 + cellB13.template getField<descriptors::CHEM_POTENTIAL>()
220 + cellB16.template getField<descriptors::CHEM_POTENTIAL>()
221 + cellB15.template getField<descriptors::CHEM_POTENTIAL>());
222
223 V gradMuRhoY = 1./12. * (
224 - cellB4.template getField<descriptors::CHEM_POTENTIAL>()
225 - cellB14.template getField<descriptors::CHEM_POTENTIAL>()
226 - cellB8.template getField<descriptors::CHEM_POTENTIAL>()
227 - 2 * cellB2.template getField<descriptors::CHEM_POTENTIAL>()
228 - cellB9.template getField<descriptors::CHEM_POTENTIAL>()
229 + cellB18.template getField<descriptors::CHEM_POTENTIAL>()
230 + 2 * cellB11.template getField<descriptors::CHEM_POTENTIAL>()
231 + cellB17.template getField<descriptors::CHEM_POTENTIAL>()
232 + cellB5.template getField<descriptors::CHEM_POTENTIAL>()
233 + cellB13.template getField<descriptors::CHEM_POTENTIAL>());
234
235 V gradMuRhoZ = 1./12. * (
236 - cellB8.template getField<descriptors::CHEM_POTENTIAL>()
237 - cellB18.template getField<descriptors::CHEM_POTENTIAL>()
238 - cellB6.template getField<descriptors::CHEM_POTENTIAL>()
239 - 2 * cellB3.template getField<descriptors::CHEM_POTENTIAL>()
240 - cellB16.template getField<descriptors::CHEM_POTENTIAL>()
241 + cellB7.template getField<descriptors::CHEM_POTENTIAL>()
242 + 2 * cellB12.template getField<descriptors::CHEM_POTENTIAL>()
243 + cellB15.template getField<descriptors::CHEM_POTENTIAL>()
244 + cellB9.template getField<descriptors::CHEM_POTENTIAL>()
245 + cellB17.template getField<descriptors::CHEM_POTENTIAL>());
246
247 V psi = 0.;
248 V gradMuPsiX = 0.;
249 V gradMuPsiY = 0.;
250 V gradMuPsiZ = 0.;
251
252 V forceX = - rho*gradMuRhoX - phi*gradMuPhiX - psi*gradMuPsiX;
253 V forceY = - rho*gradMuRhoY - phi*gradMuPhiY - psi*gradMuPsiY;
254 V forceZ = - rho*gradMuRhoZ - phi*gradMuPhiZ - psi*gradMuPsiZ;
255
256 cellB.template setField<descriptors::FORCE>({forceX, forceY, forceZ});
257
258 V u[3];
259 cellB.computeU(u);
260
261 cellA.template setField<descriptors::FORCE>(u);
262
263 }

Member Data Documentation

◆ scope

constexpr OperatorScope olb::ForceCoupling3D::scope = OperatorScope::PerCell
staticconstexpr

Definition at line 117 of file freeEnergyCoupling3D.h.


The documentation for this struct was generated from the following file: