objective.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2007-2020 PCOpt/NTUA
9  Copyright (C) 2013-2020 FOSS GP
10  Copyright (C) 2019-2020 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
13  This file is part of OpenFOAM.
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 "objective.H"
31 #include "createZeroField.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 
40 defineTypeNameAndDebug(objective, 0);
41 defineRunTimeSelectionTable(objective, objective);
42 
43 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
44 
45 void objective::makeFolder()
46 {
47  if (Pstream::master())
48  {
49  const Time& time = mesh_.time();
50  objFunctionFolder_ =
51  time.globalPath()/"optimisation"/type()/time.timeName();
52 
53  mkDir(objFunctionFolder_);
54  }
55 }
56 
57 
58 void objective::setObjectiveFilePtr() const
59 {
60  objFunctionFilePtr_.reset
61  (
62  new OFstream(objFunctionFolder_/objectiveName_ + adjointSolverName_)
63  );
64 }
65 
66 
67 void objective::setInstantValueFilePtr() const
68 {
69  instantValueFilePtr_.reset
70  (
71  new OFstream
72  (
73  objFunctionFolder_/objectiveName_ + "Instant" + adjointSolverName_
74  )
75  );
76 }
77 
78 
79 void objective::setMeanValueFilePtr() const
80 {
81  meanValueFilePtr_.reset
82  (
83  new OFstream
84  (
85  objFunctionFolder_/objectiveName_ + "Mean" + adjointSolverName_
86  )
87  );
88 }
89 
90 
91 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
92 
93 const dictionary& objective::dict() const
94 {
95  return dict_;
96 }
97 
98 
99 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
100 
101 objective::objective
102 (
103  const fvMesh& mesh,
104  const dictionary& dict,
105  const word& adjointSolverName,
106  const word& primalSolverName
107 )
108 :
109  localIOdictionary
110  (
111  IOobject
112  (
113  dict.dictName(),
114  mesh.time().timeName(),
115  fileName("uniform")/fileName("objectives")/adjointSolverName,
116  mesh,
117  IOobject::READ_IF_PRESENT,
118  IOobject::AUTO_WRITE
119  ),
120  // avoid type checking since dictionary is read using the
121  // derived type name and type() will result in "objective"
122  // here
123  word::null
124  ),
125  mesh_(mesh),
126  dict_(dict),
127  adjointSolverName_(adjointSolverName),
128  primalSolverName_(primalSolverName),
129  objectiveName_(dict.dictName()),
130  computeMeanFields_(false), // is reset in derived classes
131  nullified_(false),
132  normalize_(dict.getOrDefault<bool>("normalize", false)),
133 
134  J_(Zero),
135  JMean_(this->getOrDefault<scalar>("JMean", Zero)),
136  weight_(Zero),
137  normFactor_(nullptr),
138  target_(dict.getOrDefault<scalar>("target", Zero)),
139 
140  integrationStartTimePtr_(nullptr),
141  integrationEndTimePtr_(nullptr),
142 
143  // Initialize pointers to nullptr.
144  // Not all of them are required for each objective function.
145  // Each child should allocate whatever is needed.
146 
147  dJdbPtr_(nullptr),
148  bdJdbPtr_(nullptr),
149  bdSdbMultPtr_(nullptr),
150  bdndbMultPtr_(nullptr),
151  bdxdbMultPtr_(nullptr),
152  bdxdbDirectMultPtr_(nullptr),
153  bEdgeContribution_(nullptr),
154  bdJdStressPtr_(nullptr),
155  divDxDbMultPtr_(nullptr),
156  gradDxDbMultPtr_(nullptr),
157 
158  objFunctionFolder_("word"),
159  objFunctionFilePtr_(nullptr),
160  instantValueFilePtr_(nullptr),
161  meanValueFilePtr_(nullptr)
162 {
163  makeFolder();
164  // Read integration start and end times, if present.
165  // For unsteady runs only
166  if (dict.found("integrationStartTime"))
167  {
169  (
170  new scalar(dict.get<scalar>("integrationStartTime"))
171  );
172  }
173  if (dict.found("integrationEndTime"))
174  {
176  (
177  new scalar(dict.get<scalar>("integrationEndTime"))
178  );
179  }
180 
181  // Set normalization factor, if present
182  if (normalize_)
183  {
184  scalar normFactor(Zero);
185  if (dict.readIfPresent("normFactor", normFactor))
186  {
187  normFactor_.reset(new scalar(normFactor));
188  }
189  else if (this->readIfPresent("normFactor", normFactor))
190  {
191  normFactor_.reset(new scalar(normFactor));
192  }
193  }
194 }
195 
196 
197 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
198 
199 autoPtr<objective> objective::New
200 (
201  const fvMesh& mesh,
202  const dictionary& dict,
203  const word& objectiveType,
204  const word& adjointSolverName,
205  const word& primalSolverName
206 )
207 {
208  auto cstrIter = objectiveConstructorTablePtr_->cfind(objectiveType);
209 
210  if (!cstrIter.found())
211  {
213  (
214  dict,
215  "objective",
216  objectiveType,
217  *objectiveConstructorTablePtr_
218  ) << exit(FatalIOError);
219  }
220 
221  return autoPtr<objective>
222  (
223  cstrIter()
224  (
225  mesh,
226  dict,
227  adjointSolverName,
228  primalSolverName
229  )
230  );
231 }
232 
233 
234 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
235 
236 bool objective::readDict(const dictionary& dict)
237 {
238  dict_ = dict;
239  return true;
240 }
241 
242 
243 scalar objective::JCycle() const
244 {
245  scalar J(J_);
246  if
247  (
248  computeMeanFields_
249  || (hasIntegrationStartTime() && hasIntegrationEndTime())
250  )
251  {
252  J = JMean_;
253  }
254 
255  // Subtract target, in case the objective is used as a constraint
256  J -= target_;
257 
258  // Normalize here, in order to get the correct value for line search
259  if (normalize_ && normFactor_.valid())
260  {
261  J /= normFactor_();
262  }
263 
264  return J;
265 }
266 
267 
268 void objective::updateNormalizationFactor()
269 {
270  if (normalize_ && normFactor_.empty())
271  {
272  normFactor_.reset(new scalar(JCycle()));
273  }
274 }
275 
276 
277 void objective::accumulateJMean(solverControl& solverControl)
278 {
279  if (solverControl.doAverageIter())
280  {
281  const label iAverageIter = solverControl.averageIter();
282  if (iAverageIter == 0)
283  {
284  JMean_ = Zero;
285  }
286  scalar avIter(iAverageIter);
287  scalar oneOverItP1 = 1./(avIter + 1);
288  scalar mult = avIter*oneOverItP1;
289  JMean_ = JMean_*mult + J_*oneOverItP1;
290  }
291 }
292 
293 
294 void objective::accumulateJMean()
295 {
296  if (hasIntegrationStartTime() && hasIntegrationEndTime())
297  {
298  const scalar time = mesh_.time().value();
299  if (isWithinIntegrationTime())
300  {
301  const scalar dt = mesh_.time().deltaT().value();
302  const scalar elapsedTime = time - integrationStartTimePtr_();
303  const scalar denom = elapsedTime + dt;
304  JMean_ = (JMean_*elapsedTime + J_*dt)/denom;
305  }
306  }
307  else
308  {
310  << "Unallocated integration start or end time"
311  << exit(FatalError);
312  }
313 }
314 
315 
316 scalar objective::weight() const
317 {
318  return weight_;
319 }
320 
321 
322 bool objective::normalize() const
323 {
324  return normalize_;
325 }
326 
327 
328 void objective::doNormalization()
329 {
330  if (normalize_ && normFactor_.valid())
331  {
332  const scalar oneOverNorm(1./normFactor_());
333 
334  if (hasdJdb())
335  {
336  dJdbPtr_().primitiveFieldRef() *= oneOverNorm;
337  }
338  if (hasBoundarydJdb())
339  {
340  bdJdbPtr_() *= oneOverNorm;
341  }
342  if (hasdSdbMult())
343  {
344  bdSdbMultPtr_() *= oneOverNorm;
345  }
346  if (hasdndbMult())
347  {
348  bdndbMultPtr_() *= oneOverNorm;
349  }
350  if (hasdxdbMult())
351  {
352  bdxdbMultPtr_() *= oneOverNorm;
353  }
354  if (hasdxdbDirectMult())
355  {
356  bdxdbDirectMultPtr_() *= oneOverNorm;
357  }
358  if (hasBoundaryEdgeContribution())
359  {
360  bEdgeContribution_() *= oneOverNorm;
361  }
362  if (hasDivDxDbMult())
363  {
364  divDxDbMultPtr_() *= oneOverNorm;
365  }
366  if (hasGradDxDbMult())
367  {
368  gradDxDbMultPtr_() *= oneOverNorm;
369  }
370  if (hasBoundarydJdStress())
371  {
372  bdJdStressPtr_() *= oneOverNorm;
373  }
374  }
375 }
376 
377 
378 bool objective::isWithinIntegrationTime() const
379 {
380  if (hasIntegrationStartTime() && hasIntegrationEndTime())
381  {
382  const scalar time = mesh_.time().value();
383  return
384  (
385  time >= integrationStartTimePtr_()
386  && time <= integrationEndTimePtr_()
387  );
388  }
389  else
390  {
392  << "Unallocated integration start or end time"
393  << exit(FatalError);
394  }
395  return false;
396 }
397 
398 
399 void objective::incrementIntegrationTimes(const scalar timeSpan)
400 {
401  if (hasIntegrationStartTime() && hasIntegrationEndTime())
402  {
403  integrationStartTimePtr_() += timeSpan;
404  integrationEndTimePtr_() += timeSpan;
405  }
406  else
407  {
409  << "Unallocated integration start or end time"
410  << exit(FatalError);
411  }
412 }
413 
414 
415 const volScalarField& objective::dJdb()
416 {
417  if (dJdbPtr_.empty())
418  {
419  // If pointer is not set, set it to a zero field
420  dJdbPtr_.reset
421  (
422  createZeroFieldPtr<scalar>
423  (
424  mesh_,
425  ("dJdb_" + objectiveName_),
426  dimensionSet(0, 5, -2, 0, 0, 0, 0)
427  )
428  );
429  }
430 
431  return dJdbPtr_();
432 }
433 
434 
435 const fvPatchVectorField& objective::boundarydJdb(const label patchI)
436 {
437  if (bdJdbPtr_.empty())
438  {
439  bdJdbPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
440  }
441  return bdJdbPtr_()[patchI];
442 }
443 
444 
445 const fvPatchVectorField& objective::dSdbMultiplier(const label patchI)
446 {
447  if (bdSdbMultPtr_.empty())
448  {
449  bdSdbMultPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
450  }
451  return bdSdbMultPtr_()[patchI];
452 }
453 
454 
455 const fvPatchVectorField& objective::dndbMultiplier(const label patchI)
456 {
457  if (bdndbMultPtr_.empty())
458  {
459  bdndbMultPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
460  }
461  return bdndbMultPtr_()[patchI];
462 }
463 
464 
465 const fvPatchVectorField& objective::dxdbMultiplier(const label patchI)
466 {
467  if (bdxdbMultPtr_.empty())
468  {
469  bdxdbMultPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
470  }
471  return bdxdbMultPtr_()[patchI];
472 }
473 
474 
475 const fvPatchVectorField& objective::dxdbDirectMultiplier(const label patchI)
476 {
477  if (bdxdbDirectMultPtr_.empty())
478  {
479  bdxdbDirectMultPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
480  }
481  return bdxdbDirectMultPtr_()[patchI];
482 }
483 
484 
485 const vectorField& objective::boundaryEdgeMultiplier
486 (
487  const label patchI,
488  const label edgeI
489 )
490 {
491  if (bdxdbDirectMultPtr_.empty())
492  {
494  << "Unallocated boundaryEdgeMultiplier field"
495  << exit(FatalError);
496  }
497  return bEdgeContribution_()[patchI][edgeI];
498 }
499 
500 
501 const fvPatchTensorField& objective::boundarydJdStress(const label patchI)
502 {
503  if (bdJdStressPtr_.empty())
504  {
505  bdJdStressPtr_.reset(createZeroBoundaryPtr<tensor>(mesh_));
506  }
507  return bdJdStressPtr_()[patchI];
508 }
509 
510 
511 const boundaryVectorField& objective::boundarydJdb()
512 {
513  if (bdJdbPtr_.empty())
514  {
515  bdJdbPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
516  }
517  return bdJdbPtr_();
518 }
519 
520 
521 const boundaryVectorField& objective::dSdbMultiplier()
522 {
523  if (bdSdbMultPtr_.empty())
524  {
525  bdSdbMultPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
526  }
527  return bdSdbMultPtr_();
528 }
529 
530 
531 const boundaryVectorField& objective::dndbMultiplier()
532 {
533  if (bdndbMultPtr_.empty())
534  {
535  bdndbMultPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
536  }
537  return bdndbMultPtr_();
538 }
539 
540 
541 const boundaryVectorField& objective::dxdbMultiplier()
542 {
543  if (bdxdbMultPtr_.empty())
544  {
545  bdxdbMultPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
546  }
547  return bdxdbMultPtr_();
548 }
549 
550 
551 const boundaryVectorField& objective::dxdbDirectMultiplier()
552 {
553  if (bdxdbDirectMultPtr_.empty())
554  {
555  bdxdbDirectMultPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
556  }
557  return bdxdbDirectMultPtr_();
558 }
559 
560 
561 const vectorField3& objective::boundaryEdgeMultiplier()
562 {
563  if (bdxdbDirectMultPtr_.empty())
564  {
566  << "Unallocated boundaryEdgeMultiplier field"
567  << endl << endl
568  << exit(FatalError);
569  }
570  return bEdgeContribution_();
571 }
572 
573 
574 const boundaryTensorField& objective::boundarydJdStress()
575 {
576  if (bdJdStressPtr_.empty())
577  {
578  bdJdStressPtr_.reset(createZeroBoundaryPtr<tensor>(mesh_));
579  }
580  return bdJdStressPtr_();
581 }
582 
583 
584 const volScalarField& objective::divDxDbMultiplier()
585 {
586  if (divDxDbMultPtr_.empty())
587  {
588  // If pointer is not set, set it to a zero field
589  divDxDbMultPtr_.reset
590  (
591  createZeroFieldPtr<scalar>
592  (
593  mesh_,
594  ("divDxDbMult"+objectiveName_),
595  // Variable dimensions!!
596  // Dummy dimensionless. Only the internalField will be used
597  dimless
598  )
599  );
600  }
601  return divDxDbMultPtr_();
602 }
603 
604 
605 const volTensorField& objective::gradDxDbMultiplier()
606 {
607  if (gradDxDbMultPtr_.empty())
608  {
609  // If pointer is not set, set it to a zero field
610  gradDxDbMultPtr_.reset
611  (
612  createZeroFieldPtr<tensor>
613  (
614  mesh_,
615  ("gradDxDbMult"+objectiveName_),
616  // Variable dimensions!!
617  dimensionSet(pow2(dimLength)/pow3(dimTime))
618  )
619  );
620  }
621  return gradDxDbMultPtr_();
622 }
623 
624 
625 void objective::nullify()
626 {
627  if (!nullified_)
628  {
629  if (hasdJdb())
630  {
631  dJdbPtr_() == dimensionedScalar(dJdbPtr_().dimensions(), Zero);
632  }
633  if (hasBoundarydJdb())
634  {
635  bdJdbPtr_() == vector::zero;
636  }
637  if (hasdSdbMult())
638  {
639  bdSdbMultPtr_() == vector::zero;
640  }
641  if (hasdndbMult())
642  {
643  bdndbMultPtr_() == vector::zero;
644  }
645  if (hasdxdbMult())
646  {
647  bdxdbMultPtr_() == vector::zero;
648  }
649  if (hasdxdbDirectMult())
650  {
651  bdxdbDirectMultPtr_() == vector::zero;
652  }
653  if (hasBoundaryEdgeContribution())
654  {
655  for (Field<vectorField>& field : bEdgeContribution_())
656  {
658  }
659  }
660  if (hasBoundarydJdStress())
661  {
662  bdJdStressPtr_() == tensor::zero;
663  }
664  if (hasDivDxDbMult())
665  {
666  divDxDbMultPtr_() ==
667  dimensionedScalar(divDxDbMultPtr_().dimensions(), Zero);
668  }
669  if (hasGradDxDbMult())
670  {
671  gradDxDbMultPtr_() ==
672  dimensionedTensor(gradDxDbMultPtr_().dimensions(), Zero);
673  }
674 
675  nullified_ = true;
676  }
677 }
678 
679 
680 bool objective::write(const bool valid) const
681 {
682  if (Pstream::master())
683  {
684  // File is opened only upon invocation of the write function
685  // in order to avoid various instantiations of the same objective
686  // opening the same file
687  if (objFunctionFilePtr_.empty())
688  {
689  setObjectiveFilePtr();
690  }
691 
692  objFunctionFilePtr_() << mesh_.time().value() << tab << J_ << endl;
693  }
694 
695  return true;
696 }
697 
698 
699 void objective::writeInstantaneousValue() const
700 {
701  if (Pstream::master())
702  {
703  // File is opened only upon invocation of the write function
704  // in order to avoid various instantiations of the same objective
705  // opening the same file
706  if (instantValueFilePtr_.empty())
707  {
708  setInstantValueFilePtr();
709  }
710 
711  instantValueFilePtr_() << mesh_.time().value() << tab << J_ << endl;
712  }
713 }
714 
715 
716 void objective::writeInstantaneousSeparator() const
717 {
718  if (Pstream::master())
719  {
720  if (instantValueFilePtr_.valid())
721  {
722  instantValueFilePtr_() << endl;
723  }
724  }
725 }
726 
727 
728 void objective::writeMeanValue() const
729 {
730  if (Pstream::master())
731  {
732  // Write mean value if necessary
733  // Covers both steady and unsteady runs
734  if
735  (
736  computeMeanFields_
737  || (hasIntegrationStartTime() && hasIntegrationEndTime())
738  )
739  {
740  // File is opened only upon invocation of the write function
741  // in order to avoid various instantiations of the same objective
742  // opening the same file
743  if (meanValueFilePtr_.empty())
744  {
745  setMeanValueFilePtr();
746  }
747 
748  meanValueFilePtr_()
749  << mesh_.time().value() << tab << JMean_ << endl;
750  }
751  }
752 }
753 
754 
755 bool objective::writeData(Ostream& os) const
756 {
757  os.writeEntry("JMean", JMean_);
758  if (normFactor_.valid())
759  {
760  os.writeEntry("normFactor", normFactor_());
761  }
762  return os.good();
763 }
764 
765 
766 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
767 
768 } // End namespace Foam
769 
770 // ************************************************************************* //
Foam::objective::normFactor_
autoPtr< scalar > normFactor_
Normalization factor.
Definition: objective.H:86
Foam::autoPtr::reset
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
Definition: autoPtrI.H:109
Foam::volTensorField
GeometricField< tensor, fvPatchField, volMesh > volTensorField
Definition: volFieldsFwd.H:64
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
Definition: dimensionSets.H:50
Foam::objective::integrationStartTimePtr_
autoPtr< scalar > integrationStartTimePtr_
Objective integration start and end times (for unsteady flows)
Definition: objective.H:94
Foam::objective::normalize_
bool normalize_
Definition: objective.H:74
Foam::baseIOdictionary::writeData
virtual bool writeData(Ostream &) const
The writeData function required by regIOobject write operation.
Definition: baseIOdictionaryIO.C:51
Foam::objective::objectiveName_
const word objectiveName_
Definition: objective.H:71
Foam::dictionary::New
static autoPtr< dictionary > New(Istream &is)
Construct top-level dictionary on freestore from Istream.
Definition: dictionaryIO.C:69
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:53
Foam::pow2
dimensionSet pow2(const dimensionSet &ds)
Definition: dimensionSet.C:367
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:785
dictName
const word dictName("blockMeshDict")
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::IOobject::time
const Time & time() const
Return time.
Definition: IOobject.C:449
Foam::objective::adjointSolverName_
const word adjointSolverName_
Definition: objective.H:69
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:54
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:397
Foam::vectorField3
Field< Field< vectorField > > vectorField3
Definition: objectiveFwd.H:39
createZeroField.H
Foam::pow3
dimensionedScalar pow3(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:89
Foam::boundaryTensorField
volTensorField::Boundary boundaryTensorField
Definition: boundaryFieldsFwd.H:56
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
field
rDeltaTY field()
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
timeName
word timeName
Definition: getTimeIndex.H:3
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::objective::integrationEndTimePtr_
autoPtr< scalar > integrationEndTimePtr_
Definition: objective.H:95
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::UPstream::master
static bool master(const label communicator=0)
Am I the master process.
Definition: UPstream.H:439
Foam::fvPatchVectorField
fvPatchField< vector > fvPatchVectorField
Definition: fvPatchFieldsFwd.H:43
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:372
Foam::tab
constexpr char tab
Definition: Ostream.H:384
Foam::dictionary::write
void write(Ostream &os, const bool subDict=true) const
Write dictionary, normally with sub-dictionary formatting.
Definition: dictionaryIO.C:206
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::objective::mesh_
const fvMesh & mesh_
Definition: objective.H:67
bool
bool
Definition: EEqn.H:20
Foam::TimePaths::globalPath
fileName globalPath() const
Return global path for the case.
Definition: TimePathsI.H:72
Foam::objective::dict_
dictionary dict_
Definition: objective.H:68
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:248
Foam::VectorSpace< Vector< scalar >, scalar, 3 >::zero
static const Vector< scalar > zero
Definition: VectorSpace.H:115
Foam::fvPatchTensorField
fvPatchField< tensor > fvPatchTensorField
Definition: fvPatchFieldsFwd.H:46
Foam::mkDir
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Definition: MSwindows.C:507
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
objective.H
Foam::boundaryVectorField
volVectorField::Boundary boundaryVectorField
Definition: boundaryFieldsFwd.H:55
Foam::dimensionedTensor
dimensioned< tensor > dimensionedTensor
Dimensioned tensor obtained from generic dimensioned type.
Definition: dimensionedTensor.H:52
Foam::normalize
quaternion normalize(const quaternion &q)
Return the normalized (unit) quaternion of the given quaternion.
Definition: quaternionI.H:661
Foam::dictionary::readIfPresent
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:417