DAResidualPimpleFoam.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v4
5 
6 \*---------------------------------------------------------------------------*/
7 
8 #include "DAResidualPimpleFoam.H"
9 
10 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
11 
12 namespace Foam
13 {
14 
15 defineTypeNameAndDebug(DAResidualPimpleFoam, 0);
16 addToRunTimeSelectionTable(DAResidual, DAResidualPimpleFoam, dictionary);
17 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
18 
20  const word modelType,
21  const fvMesh& mesh,
22  const DAOption& daOption,
23  const DAModel& daModel,
24  const DAIndex& daIndex)
25  : DAResidual(modelType, mesh, daOption, daModel, daIndex),
26  // initialize and register state variables and their residuals, we use macros defined in macroFunctions.H
27  setResidualClassMemberVector(U, dimensionSet(0, 1, -2, 0, 0, 0, 0)),
28  setResidualClassMemberScalar(p, dimensionSet(0, 0, -1, 0, 0, 0, 0)),
30  TResPtr_(nullptr),
31  fvSource_(const_cast<volVectorField&>(
32  mesh_.thisDb().lookupObject<volVectorField>("fvSource"))),
33  daTurb_(const_cast<DATurbulenceModel&>(daModel.getDATurbulenceModel())),
34  // create simpleControl
35  pimple_(const_cast<fvMesh&>(mesh))
36 {
37  // initialize fvSource
38  const dictionary& allOptions = daOption.getAllOptions();
39  if (allOptions.subDict("fvSource").toc().size() != 0)
40  {
41  hasFvSource_ = 1;
42  }
43 
44  // check whether to include the temperature field
45  hasTField_ = DAUtility::isFieldReadable(mesh, "T", "volScalarField");
46  if (hasTField_)
47  {
48 
49  TResPtr_.reset(new volScalarField(
50  IOobject(
51  "TRes",
52  mesh.time().timeName(),
53  mesh,
54  IOobject::NO_READ,
55  IOobject::NO_WRITE),
56  mesh,
57  dimensionedScalar("TRes", dimensionSet(0, 0, -1, 1, 0, 0, 0), 0.0),
58  zeroGradientFvPatchField<scalar>::typeName));
59 
60  // initialize the Prandtl number from transportProperties
61  IOdictionary transportProperties(
62  IOobject(
63  "transportProperties",
64  mesh.time().constant(),
65  mesh,
66  IOobject::MUST_READ,
67  IOobject::NO_WRITE,
68  false));
69  Pr_ = readScalar(transportProperties.lookup("Pr"));
70  Prt_ = readScalar(transportProperties.lookup("Prt"));
71  }
72 }
73 
74 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
75 
77 {
78  /*
79  Description:
80  Clear all members to avoid memory leak because we will initalize
81  multiple objects of DAResidual. Here we need to delete all members
82  in the parent and child classes
83  */
84  URes_.clear();
85  pRes_.clear();
86  phiRes_.clear();
87 
88  if (hasTField_)
89  {
90  TResPtr_->clear();
91  }
92 }
93 
94 void DAResidualPimpleFoam::calcResiduals(const dictionary& options)
95 {
96  /*
97  Description:
98  This is the function to compute residuals.
99 
100  Input:
101  options.isPC: 1 means computing residuals for preconditioner matrix.
102  This essentially use the first order scheme for div(phi,U)
103 
104  p_, U_, phi_, etc: State variables in OpenFOAM
105 
106  Output:
107  URes_, pRes_, phiRes_: residual field variables
108  */
109 
110  // We dont support MRF and fvOptions so all the related lines are commented
111  // out for now
112 
113  // ******** U Residuals **********
114  // copied and modified from UEqn.H
115 
116  word divUScheme = "div(phi,U)";
117 
118  label isPC = options.getLabel("isPC");
119 
120  if (isPC)
121  {
122  divUScheme = "div(pc)";
123  }
124 
125  if (hasFvSource_)
126  {
127  DAFvSource& daFvSource(const_cast<DAFvSource&>(
128  mesh_.thisDb().lookupObject<DAFvSource>("DAFvSource")));
129  // update the actuator source term
130  daFvSource.calcFvSource(fvSource_);
131  }
132 
133  fvVectorMatrix UEqn(
134  fvm::ddt(U_)
135  + fvm::div(phi_, U_, divUScheme)
137  - fvSource_);
138 
139  // NOTE: we need to call UEqn.relax here because it does some BC treatment, but we need to
140  // force the relaxation factor to be 1.0 because the last pimple loop does not use relaxation
141  UEqn.relax(1.0);
142 
143  URes_ = (UEqn & U_) + fvc::grad(p_);
144  normalizeResiduals(URes);
145 
146  // ******** p Residuals **********
147  // copied and modified from pEqn.H
148  // NOTE manually set pRefCell and pRefValue
149  label pRefCell = 0;
150  scalar pRefValue = 0.0;
151 
152  volScalarField rAU(1.0 / UEqn.A());
153  //***************** NOTE *******************
154  // constrainHbyA has been used since OpenFOAM-v1606; however, it may degrade the accuracy of derivatives
155  // because constraining variables will create discontinuity. Here we have a option to use the old
156  // implementation in OpenFOAM-3.0+ and before (no constraint for HbyA)
157  autoPtr<volVectorField> HbyAPtr = nullptr;
158  label useConstrainHbyA = daOption_.getOption<label>("useConstrainHbyA");
159  if (useConstrainHbyA)
160  {
161  HbyAPtr.reset(new volVectorField(constrainHbyA(rAU * UEqn.H(), U_, p_)));
162  }
163  else
164  {
165  HbyAPtr.reset(new volVectorField("HbyA", U_));
166  HbyAPtr() = rAU * UEqn.H();
167  }
168  volVectorField& HbyA = HbyAPtr();
169 
170  surfaceScalarField phiHbyA(
171  "phiHbyA",
172  fvc::flux(HbyA));
173 
174  if (p_.needReference())
175  {
176  adjustPhi(phiHbyA, U_, p_);
177  }
178 
179  tmp<volScalarField> rAtU(rAU);
180 
181  if (pimple_.consistent())
182  {
183  rAtU = 1.0 / max(1.0 / rAU - UEqn.H1(), 0.1 / rAU);
184  phiHbyA +=
185  fvc::interpolate(rAtU() - rAU) * fvc::snGrad(p_) * mesh_.magSf();
186  HbyA -= (rAU - rAtU()) * fvc::grad(p_);
187  }
188 
189  fvScalarMatrix pEqn(
190  fvm::laplacian(rAtU(), p_)
191  == fvc::div(phiHbyA));
192 
193  pEqn.setReference(pRefCell, pRefValue);
194 
195  pRes_ = pEqn & p_;
196  normalizeResiduals(pRes);
197 
198  // ******** phi Residuals **********
199  // copied and modified from pEqn.H
200  phiRes_ = phiHbyA - pEqn.flux() - phi_;
201  // need to normalize phiRes
202  normalizePhiResiduals(phiRes);
203 
204  if (hasTField_)
205  {
206  volScalarField& alphat = const_cast<volScalarField&>(
207  mesh_.thisDb().lookupObject<volScalarField>("alphat"));
208 
209  volScalarField& T = const_cast<volScalarField&>(
210  mesh_.thisDb().lookupObject<volScalarField>("T"));
211 
212  volScalarField& TRes_ = TResPtr_();
213 
214  // ******** T Residuals **************
215  volScalarField alphaEff("alphaEff", daTurb_.nu() / Pr_ + alphat);
216 
217  fvScalarMatrix TEqn(
218  fvm::ddt(T)
219  + fvm::div(phi_, T)
220  - fvm::laplacian(alphaEff, T));
221 
222  TEqn.relax(1.0);
223 
224  TRes_ = TEqn & T;
225  normalizeResiduals(TRes);
226  }
227 }
228 
230 {
231  /*
232  Description:
233  Calculate the diagonal block of the preconditioner matrix dRdWTPC using the fvMatrix
234  */
235 
236  const labelUList& owner = mesh_.owner();
237  const labelUList& neighbour = mesh_.neighbour();
238 
239  PetscScalar val;
240 
241  dictionary normStateDict = daOption_.getAllOptions().subDict("normalizeStates");
242  wordList normResDict = daOption_.getOption<wordList>("normalizeResiduals");
243 
244  scalar UScaling = 1.0;
245  if (normStateDict.found("U"))
246  {
247  UScaling = normStateDict.getScalar("U");
248  }
249  scalar UResScaling = 1.0;
250 
251  fvVectorMatrix UEqn(
252  fvm::ddt(U_)
253  + fvm::div(phi_, U_, "div(pc)")
255  - fvSource_);
256 
257  UEqn.relax(1.0);
258 
259  // set diag
260  forAll(U_, cellI)
261  {
262  if (normResDict.found("URes"))
263  {
264  UResScaling = mesh_.V()[cellI];
265  }
266  for (label i = 0; i < 3; i++)
267  {
268  PetscInt rowI = daIndex_.getGlobalAdjointStateIndex("U", cellI, i);
269  PetscInt colI = rowI;
270  scalarField D = UEqn.D();
271  scalar val1 = D[cellI] * UScaling / UResScaling;
272  assignValueCheckAD(val, val1);
273  MatSetValues(PCMat, 1, &rowI, 1, &colI, &val, INSERT_VALUES);
274  }
275  }
276 
277  // set lower/owner
278  for (label faceI = 0; faceI < daIndex_.nLocalInternalFaces; faceI++)
279  {
280  label ownerCellI = owner[faceI];
281  label neighbourCellI = neighbour[faceI];
282 
283  if (normResDict.found("URes"))
284  {
285  UResScaling = mesh_.V()[neighbourCellI];
286  }
287 
288  for (label i = 0; i < 3; i++)
289  {
290  PetscInt rowI = daIndex_.getGlobalAdjointStateIndex("U", neighbourCellI, i);
291  PetscInt colI = daIndex_.getGlobalAdjointStateIndex("U", ownerCellI, i);
292  scalar val1 = UEqn.lower()[faceI] * UScaling / UResScaling;
293  assignValueCheckAD(val, val1);
294  MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
295  }
296  }
297 
298  // set upper/neighbour
299  for (label faceI = 0; faceI < daIndex_.nLocalInternalFaces; faceI++)
300  {
301  label ownerCellI = owner[faceI];
302  label neighbourCellI = neighbour[faceI];
303 
304  if (normResDict.found("URes"))
305  {
306  UResScaling = mesh_.V()[ownerCellI];
307  }
308 
309  for (label i = 0; i < 3; i++)
310  {
311  PetscInt rowI = daIndex_.getGlobalAdjointStateIndex("U", ownerCellI, i);
312  PetscInt colI = daIndex_.getGlobalAdjointStateIndex("U", neighbourCellI, i);
313  scalar val1 = UEqn.upper()[faceI] * UScaling / UResScaling;
314  assignValueCheckAD(val, val1);
315  MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
316  }
317  }
318 
319  label pRefCell = 0;
320  scalar pRefValue = 0.0;
321 
322  volScalarField rAU(1.0 / UEqn.A());
323  autoPtr<volVectorField> HbyAPtr = nullptr;
324  label useConstrainHbyA = daOption_.getOption<label>("useConstrainHbyA");
325  if (useConstrainHbyA)
326  {
327  HbyAPtr.reset(new volVectorField(constrainHbyA(rAU * UEqn.H(), U_, p_)));
328  }
329  else
330  {
331  HbyAPtr.reset(new volVectorField("HbyA", U_));
332  HbyAPtr() = rAU * UEqn.H();
333  }
334  volVectorField& HbyA = HbyAPtr();
335 
336  surfaceScalarField phiHbyA(
337  "phiHbyA",
338  fvc::flux(HbyA));
339 
340  if (p_.needReference())
341  {
342  adjustPhi(phiHbyA, U_, p_);
343  }
344 
345  tmp<volScalarField> rAtU(rAU);
346 
347  if (pimple_.consistent())
348  {
349  rAtU = 1.0 / max(1.0 / rAU - UEqn.H1(), 0.1 / rAU);
350  phiHbyA +=
351  fvc::interpolate(rAtU() - rAU) * fvc::snGrad(p_) * mesh_.magSf();
352  HbyA -= (rAU - rAtU()) * fvc::grad(p_);
353  }
354 
355  fvScalarMatrix pEqn(
356  fvm::laplacian(rAtU(), p_)
357  == fvc::div(phiHbyA));
358 
359  pEqn.setReference(pRefCell, pRefValue);
360 
361  // ********* p
362  scalar pScaling = 1.0;
363  if (normStateDict.found("p"))
364  {
365  pScaling = normStateDict.getScalar("p");
366  }
367  scalar pResScaling = 1.0;
368  // set diag
369  forAll(p_, cellI)
370  {
371  if (normResDict.found("pRes"))
372  {
373  pResScaling = mesh_.V()[cellI];
374  }
375 
376  PetscInt rowI = daIndex_.getGlobalAdjointStateIndex("p", cellI);
377  PetscInt colI = rowI;
378  scalarField D = pEqn.D();
379  scalar val1 = D[cellI] * pScaling / pResScaling;
380  assignValueCheckAD(val, val1);
381  MatSetValues(PCMat, 1, &rowI, 1, &colI, &val, INSERT_VALUES);
382  }
383 
384  // set lower/owner
385  for (label faceI = 0; faceI < daIndex_.nLocalInternalFaces; faceI++)
386  {
387  label ownerCellI = owner[faceI];
388  label neighbourCellI = neighbour[faceI];
389 
390  if (normResDict.found("pRes"))
391  {
392  pResScaling = mesh_.V()[neighbourCellI];
393  }
394 
395  PetscInt rowI = daIndex_.getGlobalAdjointStateIndex("p", neighbourCellI);
396  PetscInt colI = daIndex_.getGlobalAdjointStateIndex("p", ownerCellI);
397  scalar val1 = pEqn.lower()[faceI] * pScaling / pResScaling;
398  assignValueCheckAD(val, val1);
399  MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
400  }
401 
402  // set upper/neighbour
403  for (label faceI = 0; faceI < daIndex_.nLocalInternalFaces; faceI++)
404  {
405  label ownerCellI = owner[faceI];
406  label neighbourCellI = neighbour[faceI];
407 
408  if (normResDict.found("pRes"))
409  {
410  pResScaling = mesh_.V()[ownerCellI];
411  }
412 
413  PetscInt rowI = daIndex_.getGlobalAdjointStateIndex("p", ownerCellI);
414  PetscInt colI = daIndex_.getGlobalAdjointStateIndex("p", neighbourCellI);
415  scalar val1 = pEqn.upper()[faceI] * pScaling / pResScaling;
416  assignValueCheckAD(val, val1);
417  MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
418  }
419 
420  if (hasTField_)
421  {
422  volScalarField& alphat = const_cast<volScalarField&>(
423  mesh_.thisDb().lookupObject<volScalarField>("alphat"));
424 
425  volScalarField& T = const_cast<volScalarField&>(
426  mesh_.thisDb().lookupObject<volScalarField>("T"));
427 
428  volScalarField alphaEff("alphaEff", daTurb_.nu() / Pr_ + alphat);
429 
430  fvScalarMatrix TEqn(
431  fvm::ddt(T)
432  + fvm::div(phi_, T)
433  - fvm::laplacian(alphaEff, T));
434 
435  TEqn.relax(1.0);
436 
437  scalar TScaling = 1.0;
438  if (normStateDict.found("T"))
439  {
440  TScaling = normStateDict.getScalar("T");
441  }
442  scalar TResScaling = 1.0;
443  // set diag
444  forAll(T, cellI)
445  {
446  if (normResDict.found("TRes"))
447  {
448  TResScaling = mesh_.V()[cellI];
449  }
450 
451  PetscInt rowI = daIndex_.getGlobalAdjointStateIndex("T", cellI);
452  PetscInt colI = rowI;
453  scalarField D = TEqn.D();
454  scalar val1 = D[cellI] * TScaling / TResScaling;
455  assignValueCheckAD(val, val1);
456  MatSetValues(PCMat, 1, &rowI, 1, &colI, &val, INSERT_VALUES);
457  }
458 
459  // set lower/owner
460  for (label faceI = 0; faceI < daIndex_.nLocalInternalFaces; faceI++)
461  {
462  label ownerCellI = owner[faceI];
463  label neighbourCellI = neighbour[faceI];
464 
465  if (normResDict.found("TRes"))
466  {
467  TResScaling = mesh_.V()[neighbourCellI];
468  }
469 
470  PetscInt rowI = daIndex_.getGlobalAdjointStateIndex("T", neighbourCellI);
471  PetscInt colI = daIndex_.getGlobalAdjointStateIndex("T", ownerCellI);
472  scalar val1 = TEqn.lower()[faceI] * TScaling / TResScaling;
473  assignValueCheckAD(val, val1);
474  MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
475  }
476 
477  // set upper/neighbour
478  for (label faceI = 0; faceI < daIndex_.nLocalInternalFaces; faceI++)
479  {
480  label ownerCellI = owner[faceI];
481  label neighbourCellI = neighbour[faceI];
482 
483  if (normResDict.found("TRes"))
484  {
485  TResScaling = mesh_.V()[ownerCellI];
486  }
487 
488  PetscInt rowI = daIndex_.getGlobalAdjointStateIndex("T", ownerCellI);
489  PetscInt colI = daIndex_.getGlobalAdjointStateIndex("T", neighbourCellI);
490  scalar val1 = TEqn.upper()[faceI] * TScaling / TResScaling;
491  assignValueCheckAD(val, val1);
492  MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
493  }
494  }
495 }
496 
498 {
499  /*
500  Description:
501  Update the intermediate variables that depend on the state variables
502  */
503 
504  // nothing to update for DAPimpleFoam
505 }
506 
508 {
509  /*
510  Description:
511  Update the boundary condition for all the states in the selected solver
512  */
513 
514  U_.correctBoundaryConditions();
515  p_.correctBoundaryConditions();
516  if (hasTField_)
517  {
518  volScalarField& T = const_cast<volScalarField&>(
519  mesh_.thisDb().lookupObject<volScalarField>("T"));
520  T.correctBoundaryConditions();
521  }
522 }
523 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
524 
525 } // End namespace Foam
526 
527 // ************************************************************************* //
DAResidualPimpleFoam.H
Foam::DAResidualPimpleFoam::calcResiduals
virtual void calcResiduals(const dictionary &options)
compute residual
Definition: DAResidualPimpleFoam.C:94
Foam::DAFvSource
Definition: DAFvSource.H:34
Foam::DAResidualPimpleFoam::daTurb_
DATurbulenceModel & daTurb_
DATurbulenceModel object.
Definition: DAResidualPimpleFoam.H:50
U
volVectorField & U
Definition: createRefsPimpleDyM.H:7
Foam::DAResidualPimpleFoam::p_
volScalarField & p_
Definition: DAResidualPimpleFoam.H:37
pRefValue
scalar & pRefValue
Definition: createRefsPimpleDyM.H:12
useConstrainHbyA
label useConstrainHbyA
Definition: pEqnPimpleDyM.H:7
Foam::DAResidualPimpleFoam::pimple_
pimpleControl pimple_
pimpleControl object which will be initialized in this class
Definition: DAResidualPimpleFoam.H:53
Foam::DAResidual::mesh_
const fvMesh & mesh_
fvMesh
Definition: DAResidual.H:49
Foam::DATurbulenceModel::divDevReff
tmp< fvVectorMatrix > divDevReff(volVectorField &U)
divDev terms
Definition: DATurbulenceModel.C:411
D
volVectorField & D
Definition: createRefsSolidDisplacement.H:8
Foam::DAOption
Definition: DAOption.H:29
Foam::DAIndex::getGlobalAdjointStateIndex
label getGlobalAdjointStateIndex(const word stateName, const label idxI, const label comp=-1) const
get global adjoint index for a given state name, cell/face indxI and its component (optional,...
Definition: DAIndex.C:661
Foam::DAResidualPimpleFoam::updateIntermediateVariables
virtual void updateIntermediateVariables()
update any intermediate variables that are dependent on state variables and are used in calcResiduals
Definition: DAResidualPimpleFoam.C:497
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(DAFunction, DAFunctionForce, dictionary)
UEqn
fvVectorMatrix & UEqn
Definition: UEqnPimpleDyM.H:15
Foam::DAResidualPimpleFoam::fvSource_
volVectorField & fvSource_
fvSource term
Definition: DAResidualPimpleFoam.H:47
Foam::DAResidualPimpleFoam::U_
volVectorField & U_
Definition: DAResidualPimpleFoam.H:34
Foam::DAFvSource::calcFvSource
virtual void calcFvSource(volVectorField &fvSource)
compute the FvSource term
Definition: DAFvSource.C:90
Foam::DAResidualPimpleFoam::hasFvSource_
label hasFvSource_
whether to has fvSource term
Definition: DAResidualPimpleFoam.H:56
Foam::DAResidualPimpleFoam::correctBoundaryConditions
virtual void correctBoundaryConditions()
update the boundary condition for all the states in the selected solver
Definition: DAResidualPimpleFoam.C:507
normalizeResiduals
#define normalizeResiduals(resName)
Definition: DAMacroFunctions.H:28
Foam::DAOption::getOption
classType getOption(const word key) const
get an option from subDict and key
Definition: DAOption.H:92
Foam::DAResidualPimpleFoam::phi_
surfaceScalarField & phi_
Definition: DAResidualPimpleFoam.H:40
Foam::DAResidualPimpleFoam::URes_
volVectorField URes_
Definition: DAResidualPimpleFoam.H:35
Foam::DAResidual::daIndex_
const DAIndex & daIndex_
DAIndex.
Definition: DAResidual.H:58
pRefCell
label & pRefCell
Definition: createRefsPimpleDyM.H:11
Foam::DAOption::getAllOptions
const dictionary & getAllOptions() const
return a reference of allOptions_ dictionary
Definition: DAOption.H:56
Foam::DAResidual::daOption_
const DAOption & daOption_
DAOption object.
Definition: DAResidual.H:52
HbyA
volVectorField & HbyA
Definition: pEqnPimpleDyM.H:17
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
setResidualClassMemberPhi
#define setResidualClassMemberPhi(stateName)
Definition: DAMacroFunctions.H:83
phiHbyA
phiHbyA
Definition: pEqnRhoSimpleC.H:36
Foam::DAIndex
Definition: DAIndex.H:32
p
volScalarField & p
Definition: createRefsPimpleDyM.H:6
assignValueCheckAD
#define assignValueCheckAD(valA, valB)
Definition: DAMacroFunctions.H:103
Foam::DAResidualPimpleFoam::phiRes_
surfaceScalarField phiRes_
Definition: DAResidualPimpleFoam.H:41
Foam::DAResidualPimpleFoam::DAResidualPimpleFoam
DAResidualPimpleFoam(const word modelType, const fvMesh &mesh, const DAOption &daOption, const DAModel &daModel, const DAIndex &daIndex)
Definition: DAResidualPimpleFoam.C:19
setResidualClassMemberVector
#define setResidualClassMemberVector(stateName, stateUnit)
Definition: DAMacroFunctions.H:68
Foam::DAModel
Definition: DAModel.H:57
Foam::DAResidualPimpleFoam::Pr_
scalar Pr_
Definition: DAResidualPimpleFoam.H:61
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(DAFunction, 0)
phi
surfaceScalarField & phi
Definition: createRefsPimpleDyM.H:8
Foam
Definition: checkGeometry.C:32
T
volScalarField & T
Definition: createRefsHeatTransfer.H:5
Foam::DAResidualPimpleFoam::hasTField_
label hasTField_
whether to include the temperature field
Definition: DAResidualPimpleFoam.H:59
rAtU
tmp< volScalarField > rAtU(rAU)
allOptions
const dictionary & allOptions
Definition: createRefsPimpleDyM.H:14
Foam::DATurbulenceModel::nu
tmp< volScalarField > nu() const
get the nu field
Definition: DATurbulenceModel.C:267
adjustPhi
adjustPhi(phiHbyA, U, p)
alphaEff
volScalarField alphaEff("alphaEff", turbulencePtr_->nu()/Pr+alphat)
forAll
forAll(nuTilda1, cellI)
Definition: nuTilda1EqnIrkPimple.H:19
Foam::DAIndex::nLocalInternalFaces
label nLocalInternalFaces
local internal face size
Definition: DAIndex.H:98
Foam::DAResidual
Definition: DAResidual.H:36
Foam::DATurbulenceModel
Definition: DATurbulenceModel.H:52
alphat
volScalarField & alphat
Definition: TEqnPimpleDyM.H:5
rAU
volScalarField rAU(1.0/UEqn.A())
Foam::DAResidualPimpleFoam::clear
virtual void clear()
clear the members
Definition: DAResidualPimpleFoam.C:76
Foam::DAUtility::isFieldReadable
static label isFieldReadable(const fvMesh &mesh, const word fieldName, const word fieldType)
Definition: DAUtility.C:817
HbyAPtr
autoPtr< volVectorField > HbyAPtr
Definition: pEqnPimpleDyM.H:6
Foam::DAResidualPimpleFoam::TResPtr_
autoPtr< volScalarField > TResPtr_
Definition: DAResidualPimpleFoam.H:43
Foam::DAResidualPimpleFoam::pRes_
volScalarField pRes_
Definition: DAResidualPimpleFoam.H:38
setResidualClassMemberScalar
#define setResidualClassMemberScalar(stateName, stateUnit)
Definition: DAMacroFunctions.H:53
TEqn
fvScalarMatrix TEqn(fvm::ddt(T)+fvm::div(phi, T) - fvm::laplacian(alphaEff, T))
normalizePhiResiduals
#define normalizePhiResiduals(resName)
Definition: DAMacroFunctions.H:37
Foam::DAResidualPimpleFoam::Prt_
scalar Prt_
Definition: DAResidualPimpleFoam.H:63
Foam::DAResidualPimpleFoam::calcPCMatWithFvMatrix
virtual void calcPCMatWithFvMatrix(Mat PCMat)
calculating the adjoint preconditioner matrix using fvMatrix
Definition: DAResidualPimpleFoam.C:229