DAPimpleFoam.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v4
5 
6  This class is modified from OpenFOAM's source code
7  applications/solvers/incompressible/pimpleFoam
8 
9  OpenFOAM: The Open Source CFD Toolbox
10 
11  Copyright (C): 2011-2016 OpenFOAM Foundation
12 
13  OpenFOAM License:
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28 \*---------------------------------------------------------------------------*/
29 
30 #include "DAPimpleFoam.H"
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 
37 defineTypeNameAndDebug(DAPimpleFoam, 0);
38 addToRunTimeSelectionTable(DASolver, DAPimpleFoam, dictionary);
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
42  char* argsAll,
43  PyObject* pyOptions)
44  : DASolver(argsAll, pyOptions),
45  pimplePtr_(nullptr),
46  pPtr_(nullptr),
47  UPtr_(nullptr),
48  phiPtr_(nullptr),
49  laminarTransportPtr_(nullptr),
50  turbulencePtr_(nullptr),
51  daTurbulenceModelPtr_(nullptr),
52  daFvSourcePtr_(nullptr),
53  fvSourcePtr_(nullptr),
54  PrPtr_(nullptr),
55  PrtPtr_(nullptr),
56  TPtr_(nullptr),
57  alphatPtr_(nullptr)
58 {
59  // check whether the temperature field exists in the 0 folder
60  hasTField_ = DAUtility::isFieldReadable(meshPtr_(), "T", "volScalarField");
61 }
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
65 {
66  /*
67  Description:
68  Initialize variables for DASolver
69  */
70 
71  Info << "Initializing fields for DAPimpleFoam" << endl;
72  Time& runTime = runTimePtr_();
73  fvMesh& mesh = meshPtr_();
75 #include "createFieldsPimple.H"
76 
77  // read the RAS model from constant/turbulenceProperties
78  const word turbModelName(
79  IOdictionary(
80  IOobject(
81  "turbulenceProperties",
82  mesh.time().constant(),
83  mesh,
84  IOobject::MUST_READ,
85  IOobject::NO_WRITE,
86  false))
87  .subDict("RAS")
88  .lookup("RASModel"));
90 
91 #include "createAdjoint.H"
92 
93  // initialize fvSource and the source term
94  const dictionary& allOptions = daOptionPtr_->getAllOptions();
95  if (allOptions.subDict("fvSource").toc().size() != 0)
96  {
97  hasFvSource_ = 1;
98  Info << "Computing fvSource" << endl;
99  word sourceName = allOptions.subDict("fvSource").toc()[0];
100  word fvSourceType = allOptions.subDict("fvSource").subDict(sourceName).getWord("type");
102  fvSourceType, mesh, daOptionPtr_(), daModelPtr_(), daIndexPtr_()));
103  daFvSourcePtr_->calcFvSource(fvSource);
104  }
105 
106  // reduceIO does not write mesh, but if there is a shape variable, set writeMesh to 1
107  dictionary dvSubDict = daOptionPtr_->getAllOptions().subDict("inputInfo");
108  forAll(dvSubDict.toc(), idxI)
109  {
110  word dvName = dvSubDict.toc()[idxI];
111  if (dvSubDict.subDict(dvName).getWord("type") == "volCoord")
112  {
113  reduceIOWriteMesh_ = 1;
114  break;
115  }
116  }
117 }
118 
120 {
121  /*
122  Description:
123  Call the primal solver to get converged state variables
124  */
125 
126 #include "createRefsPimple.H"
127 
128  // call correctNut, this is equivalent to turbulence->validate();
129  daTurbulenceModelPtr_->updateIntermediateVariables();
130 
131  Info << "\nStarting time loop\n"
132  << endl;
133 
134  label pimplePrintToScreen = 0;
135 
136  // we need to reduce the number of files written to the disk to minimize the file IO load
137  label reduceIO = daOptionPtr_->getAllOptions().subDict("unsteadyAdjoint").getLabel("reduceIO");
138  wordList additionalOutput;
139  if (reduceIO)
140  {
141  daOptionPtr_->getAllOptions().subDict("unsteadyAdjoint").readEntry<wordList>("additionalOutput", additionalOutput);
142  }
143 
144  scalar endTime = runTime.endTime().value();
145  scalar deltaT = runTime.deltaT().value();
146  label nInstances = round(endTime / deltaT);
147 
148  // main loop
149  label regModelFail = 0;
150  label fail = 0;
151  for (label iter = 1; iter <= nInstances; iter++)
152  {
153  ++runTime;
154 
155  // if we have unsteadyField in inputInfo, assign GlobalVar::inputFieldUnsteady to OF fields at each time step
156  this->updateInputFieldUnsteady();
157 
159 
160  if (printToScreen_)
161  {
162  Info << "Time = " << runTime.timeName() << nl << endl;
163 #include "CourantNo.H"
164  }
165 
166  // --- Pressure-velocity PIMPLE corrector loop
167  while (pimple.loop())
168  {
169  if (pimple.finalIter() && printToScreen_)
170  {
171  pimplePrintToScreen = 1;
172  }
173  else
174  {
175  pimplePrintToScreen = 0;
176  }
177 
178 #include "UEqnPimple.H"
179 
180  // --- Pressure corrector loop
181  while (pimple.correct())
182  {
183 #include "pEqnPimple.H"
184  }
185 
186  if (hasTField_)
187  {
188 #include "TEqnPimple.H"
189  }
190 
191  laminarTransport.correct();
192  daTurbulenceModelPtr_->correct(pimplePrintToScreen);
193 
194  // update the output field value at each iteration, if the regression model is active
195  fail = daRegressionPtr_->compute();
196  }
197 
198  regModelFail += fail;
199 
200  if (this->validateStates())
201  {
202  // write data to files and quit
203  runTime.writeNow();
204  mesh.write();
205  return 1;
206  }
207 
209  daRegressionPtr_->printInputInfo(printToScreen_);
212 
213  if (reduceIO && iter < nInstances)
214  {
215  this->writeAdjStates(reduceIOWriteMesh_, additionalOutput);
216  daRegressionPtr_->writeFeatures();
217  }
218  else
219  {
220  runTime.write();
221  daRegressionPtr_->writeFeatures();
222  }
223  }
224 
225  if (regModelFail != 0)
226  {
227  return 1;
228  }
229 
230  // need to save primalFinalTimeIndex_.
231  primalFinalTimeIndex_ = runTime.timeIndex();
232 
233  // write the mesh to files
234  mesh.write();
235 
236  Info << "End\n"
237  << endl;
238 
239  return 0;
240 }
241 
243  const double* psi,
244  const double* dFdW,
245  double* adjRes)
246 {
247  scalar adjResNorm = 0.0;
248 #ifdef CODI_ADR
249  label localAdjSize = daIndexPtr_->nLocalAdjointStates;
250  // calculate the adjoint residuals dRdWT*Psi - dFdW
251  this->assignVec2ResidualGradient(psi);
252  this->globalADTape_.evaluate();
253  this->assignStateGradient2Vec(adjRes);
254  // NOTE: we do NOT normalize dRdWOldTPsi!
255  // this->normalizeGradientVec(adjRes);
256  this->globalADTape_.clearAdjoints();
257  for (label i = 0; i < localAdjSize; i++)
258  {
259  adjRes[i] -= dFdW[i];
260  adjResNorm += adjRes[i] * adjRes[i];
261  }
262  reduce(adjResNorm, sumOp<scalar>());
263  adjResNorm = sqrt(adjResNorm);
264 #endif
265  return adjResNorm;
266 }
267 
269  Vec dFdW,
270  Vec psi)
271 {
272  /*
273  Description:
274  Solve the adjoint using the fixed-point iteration approach
275  */
276 
277 #ifdef CODI_ADR
278 
279  Info << "Solving adjoint using fixed-point iterations" << endl;
280 
281  PetscScalar* psiArray;
282  PetscScalar* dFdWArray;
283  VecGetArray(psi, &psiArray);
284  VecGetArray(dFdW, &dFdWArray);
285 
286  const fvSolution& myFvSolution = meshPtr_->thisDb().lookupObject<fvSolution>("fvSolution");
287  dictionary solverDictU = myFvSolution.subDict("solvers").subDict("U");
288  dictionary solverDictP = myFvSolution.subDict("solvers").subDict("p");
289  scalar fpRelaxU = daOptionPtr_->getAllOptions().subDict("adjEqnOption").lookupOrDefault<scalar>("fpRelaxU", 1.0);
290  scalar fpRelaxP = daOptionPtr_->getAllOptions().subDict("adjEqnOption").lookupOrDefault<scalar>("fpRelaxP", 1.0);
291  scalar fpRelaxPhi = daOptionPtr_->getAllOptions().subDict("adjEqnOption").lookupOrDefault<scalar>("fpRelaxPhi", 1.0);
292  label fpPrintInterval = daOptionPtr_->getAllOptions().subDict("adjEqnOption").lookupOrDefault<label>("fpPrintInterval", 10);
293  label useNonZeroInitGuess = daOptionPtr_->getAllOptions().subDict("adjEqnOption").getLabel("useNonZeroInitGuess");
294  label fpMaxIters = daOptionPtr_->getAllOptions().subDict("adjEqnOption").getLabel("fpMaxIters");
295  scalar fpRelTol = daOptionPtr_->getAllOptions().subDict("adjEqnOption").getScalar("fpRelTol");
296 
297  label localAdjSize = daIndexPtr_->nLocalAdjointStates;
298  double* adjRes = new double[localAdjSize];
299  for (label i = 0; i < localAdjSize; i++)
300  {
301  adjRes[i] = 0.0;
302  if (!useNonZeroInitGuess)
303  {
304  psiArray[i] = 0.0;
305  }
306  }
307 
308  volVectorField& U = const_cast<volVectorField&>(
309  meshPtr_->thisDb().lookupObject<volVectorField>("U"));
310 
311  volScalarField& p = const_cast<volScalarField&>(
312  meshPtr_->thisDb().lookupObject<volScalarField>("p"));
313 
314  surfaceScalarField& phi = const_cast<surfaceScalarField&>(
315  meshPtr_->thisDb().lookupObject<surfaceScalarField>("phi"));
316 
317  DATurbulenceModel& daTurb = const_cast<DATurbulenceModel&>(daModelPtr_->getDATurbulenceModel());
318 
319  volVectorField dPsiU("dPsiU", U);
320  volScalarField dPsiP("dPsiP", p);
321  scalarList turbVar(meshPtr_->nCells(), 0.0);
322  scalarList dPsiTurbVar(meshPtr_->nCells(), 0.0);
323 
324  // NOTE: we need only the fvm operators for the fixed-point preconditioner
325  // velocity
326  fvVectorMatrix psiUPC(
327  fvm::ddt(dPsiU)
328  + fvm::div(phi, dPsiU, "div(phi,U)")
329  - fvm::laplacian(daTurb.nuEff(), dPsiU));
330  psiUPC.relax(1.0);
331  // transpose the matrix
332  DAUtility::swapLists<scalar>(psiUPC.upper(), psiUPC.lower());
333  // make sure the boundary contribution to source hrs is zero
334  forAll(psiUPC.boundaryCoeffs(), patchI)
335  {
336  forAll(psiUPC.boundaryCoeffs()[patchI], faceI)
337  {
338  psiUPC.boundaryCoeffs()[patchI][faceI] = vector::zero;
339  }
340  }
341 
342  // pressure
343  volScalarField rAU(1.0 / psiUPC.A());
344  fvScalarMatrix psiPPC(
345  fvm::laplacian(rAU, dPsiP));
346  // transpose the matrix
347  DAUtility::swapLists(psiPPC.upper(), psiPPC.lower());
348  // make sure the boundary contribution to source hrs is zero
349  forAll(psiPPC.boundaryCoeffs(), patchI)
350  {
351  forAll(psiPPC.boundaryCoeffs()[patchI], faceI)
352  {
353  psiPPC.boundaryCoeffs()[patchI][faceI] = 0.0;
354  }
355  }
356 
357  // first, we setup the AD environment for dRdWT*Psi
358  this->globalADTape_.reset();
359  this->globalADTape_.setActive();
360 
363  this->calcResiduals();
365  this->globalADTape_.setPassive();
366  // AD ready to use
367 
368  // print the initial residual
369  scalar adjResL2Norm0 = this->calcAdjointResiduals(psiArray, dFdWArray, adjRes);
370  Info << "Iter: 0. L2 Norm Residual: " << adjResL2Norm0 << ". "
371  << runTimePtr_->elapsedCpuTime() << " s" << endl;
372 
373  for (label n = 1; n <= fpMaxIters; n++)
374  {
375  // U
376  forAll(dPsiU, cellI)
377  {
378  for (label comp = 0; comp < 3; comp++)
379  {
380  label localIdx = daIndexPtr_->getLocalAdjointStateIndex("U", cellI, comp);
381  psiUPC.source()[cellI][comp] = adjRes[localIdx];
382  }
383  }
384  forAll(dPsiU, cellI)
385  {
386  for (label comp = 0; comp < 3; comp++)
387  {
388  dPsiU[cellI][comp] = 0;
389  }
390  }
391  psiUPC.solve(solverDictU);
392 
393  forAll(dPsiU, cellI)
394  {
395  for (label comp = 0; comp < 3; comp++)
396  {
397  label localIdx = daIndexPtr_->getLocalAdjointStateIndex("U", cellI, comp);
398  psiArray[localIdx] -= dPsiU[cellI][comp].value() * fpRelaxU.value();
399  }
400  }
401 
402  for (label i = 0; i < 2; i++)
403  {
404  // p
405  // update the adjoint residual
406  this->calcAdjointResiduals(psiArray, dFdWArray, adjRes);
407 
408  forAll(dPsiP, cellI)
409  {
410  label localIdx = daIndexPtr_->getLocalAdjointStateIndex("p", cellI);
411  psiPPC.source()[cellI] = adjRes[localIdx];
412  }
413  forAll(dPsiP, cellI)
414  {
415  dPsiP[cellI] = 0;
416  }
417  psiPPC.solve(solverDictP);
418 
419  forAll(dPsiP, cellI)
420  {
421  label localIdx = daIndexPtr_->getLocalAdjointStateIndex("p", cellI);
422  psiArray[localIdx] -= dPsiP[cellI].value() * fpRelaxP.value();
423  }
424  // update the adjoint residual
425  this->calcAdjointResiduals(psiArray, dFdWArray, adjRes);
426 
427  // phi
428  forAll(meshPtr_->faces(), faceI)
429  {
430  label localIdx = daIndexPtr_->getLocalAdjointStateIndex("phi", faceI);
431  psiArray[localIdx] += adjRes[localIdx] * fpRelaxPhi.value();
432  }
433  }
434 
435  // update the adjoint residual
436  this->calcAdjointResiduals(psiArray, dFdWArray, adjRes);
437 
438  // turbulence vars
439  forAll(stateInfo_["modelStates"], idxI)
440  {
441 
442  const word turbVarName = stateInfo_["modelStates"][idxI];
443  scalar fpRelaxTurbVar = daOptionPtr_->getAllOptions().subDict("adjEqnOption").lookupOrDefault<scalar>("fpRelax" + turbVarName, 1.0);
444  forAll(turbVar, cellI)
445  {
446  label localIdx = daIndexPtr_->getLocalAdjointStateIndex(turbVarName, cellI);
447  turbVar[cellI] = adjRes[localIdx];
448  }
449  daTurbulenceModelPtr_->solveAdjointFP(turbVarName, turbVar, dPsiTurbVar);
450  forAll(dPsiTurbVar, cellI)
451  {
452  label localIdx = daIndexPtr_->getLocalAdjointStateIndex(turbVarName, cellI);
453  psiArray[localIdx] -= dPsiTurbVar[cellI].value() * fpRelaxTurbVar.value();
454  }
455  }
456 
457  // update the residual and print to the screen
458  scalar adjResL2Norm = this->calcAdjointResiduals(psiArray, dFdWArray, adjRes);
459  if (n % fpPrintInterval == 0 || n == fpMaxIters || (adjResL2Norm / adjResL2Norm0) < fpRelTol)
460  {
461  Info << "Iter: " << n << ". L2 Norm Residual: " << adjResL2Norm << ". "
462  << runTimePtr_->elapsedCpuTime() << " s" << endl;
463 
464  if ((adjResL2Norm / adjResL2Norm0) < fpRelTol)
465  {
466  break;
467  }
468  }
469  }
470 
471  // **********************************************************************************************
472  // clean up OF vars's AD seeds by deactivating the inputs and call the forward func one more time
473  // **********************************************************************************************
476  this->calcResiduals();
477 
478  delete[] adjRes;
479  VecRestoreArray(psi, &psiArray);
480  VecRestoreArray(dFdW, &dFdWArray);
481 #endif
482 
483  return 0;
484 }
485 
486 } // End namespace Foam
487 
488 // ************************************************************************* //
U
volVectorField & U
Definition: createRefsPimpleDyM.H:7
Foam::DASolver::updateStateBoundaryConditions
void updateStateBoundaryConditions()
update the boundary conditions for all states and intermediate variables
Definition: DASolver.C:2608
Foam::DATurbulenceModel::nuEff
tmp< volScalarField > nuEff() const
return effective viscosity
Definition: DATurbulenceModel.C:220
Foam::DASolver::printToScreen_
label printToScreen_
whether to print primal information to the screen
Definition: DASolver.H:150
pimple
pimpleControlDF & pimple
Definition: createRefsPimpleDyM.H:5
Foam::DASolver::stateInfo_
HashTable< wordList > stateInfo_
the stateInfo_ list from DAStateInfo object
Definition: DASolver.H:120
Foam::DASolver::daRegressionPtr_
autoPtr< DARegression > daRegressionPtr_
DARegression pointer.
Definition: DASolver.H:111
Foam::DASolver::daModelPtr_
autoPtr< DAModel > daModelPtr_
DAModel pointer.
Definition: DASolver.H:84
Foam::DASolver::registerStateVariableInput4AD
void registerStateVariableInput4AD(const label oldTimeLevel=0)
register all state variables as the input for reverse-mode AD
Definition: DASolver.C:1722
Foam::DASolver::daIndexPtr_
autoPtr< DAIndex > daIndexPtr_
DAIndex pointer.
Definition: DASolver.H:87
Foam::DASolver::primalFinalTimeIndex_
label primalFinalTimeIndex_
the final time index from the primal solve. for steady state cases it can converge before endTime
Definition: DASolver.H:168
Foam::DASolver
Definition: DASolver.H:54
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(DAFunction, DAFunctionForce, dictionary)
Foam::DASolver::assignVec2ResidualGradient
void assignVec2ResidualGradient(const double *vecX)
assign the reverse-mode AD input seeds from vecX to the residuals in OpenFOAM
Definition: DASolver.C:2208
DAPimpleFoam.H
Foam::DASolver::daOptionPtr_
autoPtr< DAOption > daOptionPtr_
DAOption pointer.
Definition: DASolver.H:81
Foam::DAPimpleFoam::hasFvSource_
label hasFvSource_
whether to have fvSource term
Definition: DAPimpleFoam.H:85
Foam::DASolver::registerResidualOutput4AD
void registerResidualOutput4AD()
register all residuals as the output for reverse-mode AD
Definition: DASolver.C:2035
fvSource
volScalarField & fvSource
Definition: createRefsHeatTransfer.H:7
Foam::DATurbulenceModel::New
static autoPtr< DATurbulenceModel > New(const word modelType, const fvMesh &mesh, const DAOption &daOption)
Definition: DATurbulenceModel.C:161
createAdjoint.H
Foam::DAPimpleFoam::DAPimpleFoam
DAPimpleFoam(char *argsAll, PyObject *pyOptions)
Definition: DAPimpleFoam.C:41
Foam::DASolver::printIntervalUnsteady_
label printIntervalUnsteady_
how frequent do you want to print the primal info default is every 100 steps
Definition: DASolver.H:162
Foam::DAPimpleFoam::reduceIOWriteMesh_
label reduceIOWriteMesh_
whether to write mesh for the reduceIO
Definition: DAPimpleFoam.H:100
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
Foam::DASolver::isPrintTime
label isPrintTime(const Time &runTime, const label printInterval) const
Definition: DASolver.C:2508
createFieldsPimple.H
Foam::DAUtility::swapLists
static void swapLists(List< classType > &a, List< classType > &b)
swap two lists
Definition: DAUtility.H:204
Foam::DAPimpleFoam::solveAdjointFP
virtual label solveAdjointFP(Vec dFdW, Vec psi)
solve the adjoint equation using the fixed-point iteration method
Definition: DAPimpleFoam.C:268
Foam::DASolver::validateStates
label validateStates()
check if the state variables have valid values
Definition: DASolver.C:3382
p
volScalarField & p
Definition: createRefsPimpleDyM.H:6
Foam::DASolver::deactivateStateVariableInput4AD
void deactivateStateVariableInput4AD(const label oldTimeLevel=0)
deactivate all state variables as the input for reverse-mode AD
Definition: DASolver.C:1879
Foam::DAFvSource::New
static autoPtr< DAFvSource > New(const word modelType, const fvMesh &mesh, const DAOption &daOption, const DAModel &daModel, const DAIndex &daIndex)
Definition: DAFvSource.C:47
Foam::DAPimpleFoam::calcAdjointResiduals
scalar calcAdjointResiduals(const double *psi, const double *dFdW, double *adjRes)
Definition: DAPimpleFoam.C:242
Foam::DASolver::calcResiduals
void calcResiduals(label isPC=0)
calculate the residuals
Definition: DASolver.C:2592
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(DAFunction, 0)
phi
surfaceScalarField & phi
Definition: createRefsPimpleDyM.H:8
Foam
Definition: checkGeometry.C:32
TEqnPimple.H
Foam::DAPimpleFoam::initSolver
virtual void initSolver()
initialize fields and variables
Definition: DAPimpleFoam.C:64
Foam::DASolver::assignStateGradient2Vec
void assignStateGradient2Vec(double *vecY, const label oldTimeLevel=0)
set the reverse-mode AD derivatives from the state variables in OpenFOAM to vecY
Definition: DASolver.C:2295
allOptions
const dictionary & allOptions
Definition: createRefsPimpleDyM.H:14
laminarTransport
singlePhaseTransportModel & laminarTransport
Definition: createRefsPimpleDyM.H:9
forAll
forAll(nuTilda1, cellI)
Definition: nuTilda1EqnIrkPimple.H:19
Foam::DAPimpleFoam::daTurbulenceModelPtr_
autoPtr< DATurbulenceModel > daTurbulenceModelPtr_
DATurbulenceModel pointer.
Definition: DAPimpleFoam.H:76
Foam::DATurbulenceModel
Definition: DATurbulenceModel.H:52
Foam::DASolver::runTimePtr_
autoPtr< Time > runTimePtr_
runTime pointer
Definition: DASolver.H:75
Foam::DASolver::meshPtr_
autoPtr< fvMesh > meshPtr_
fvMesh pointer
Definition: DASolver.H:78
rAU
volScalarField rAU(1.0/UEqn.A())
Foam::DAPimpleFoam::daFvSourcePtr_
autoPtr< DAFvSource > daFvSourcePtr_
DASource pointer.
Definition: DAPimpleFoam.H:79
UEqnPimple.H
Foam::DAUtility::isFieldReadable
static label isFieldReadable(const fvMesh &mesh, const word fieldName, const word fieldType)
Definition: DAUtility.C:817
Foam::DASolver::updateInputFieldUnsteady
void updateInputFieldUnsteady()
assign the inputFieldUnsteady values to the OF field vars
Definition: DASolver.C:3924
createRefsPimple.H
Foam::DAPimpleFoam::solvePrimal
virtual label solvePrimal()
solve the primal equations
Definition: DAPimpleFoam.C:119
runTime
Time & runTime
Definition: createRefsHeatTransfer.H:1
Foam::DASolver::writeAdjStates
void writeAdjStates(const label writeMesh, const wordList &additionalOutput)
write state variables that are NO_WRITE to disk
Definition: DASolver.C:2778
pEqnPimple.H
Foam::DAPimpleFoam::hasTField_
label hasTField_
whether to have the temperature field
Definition: DAPimpleFoam.H:115
Foam::DASolver::printElapsedTime
void printElapsedTime(const Time &runTime, const label printToScreen)
Definition: DASolver.H:256
createPimpleControlPython.H
psi
const volScalarField & psi
Definition: createRefsRhoPimple.H:14
Foam::DASolver::calcAllFunctions
void calcAllFunctions(label print=0)
calculate the values of all objective functions and print them to screen
Definition: DASolver.C:204