Loading...
Searching...
No Matches
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-2023 PCOpt/NTUA
9 Copyright (C) 2013-2023 FOSS GP
10 Copyright (C) 2019-2021 OpenCFD Ltd.
11-------------------------------------------------------------------------------
12License
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#include "IOmanip.H"
33
34// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36namespace Foam
37{
38
39// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40
43
44// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
45
46void objective::makeFolder()
47{
48 if (Pstream::master())
49 {
50 const Time& time = mesh_.time();
52 time.globalPath()/"optimisation"/type()/time.timeName();
54 {
56 }
57
59 }
60}
61
62
64{
75 (
76 new OFstream
77 (
79 )
80 );
81}
82
83
85{
87 (
88 new OFstream
89 (
91 )
92 );
93}
94
95
96// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
97
98const dictionary& objective::dict() const
100 return dict_;
101}
102
103
104// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
105
106objective::objective
107(
108 const fvMesh& mesh,
109 const dictionary& dict,
110 const word& adjointSolverName,
111 const word& primalSolverName
112)
113:
115 (
117 (
118 adjointSolverName + "_" + dict.dictName(),
119 mesh.time().timeName(),
120 fileName("uniform")/fileName("objectives")/adjointSolverName,
121 mesh,
122 IOobject::READ_IF_PRESENT,
123 IOobject::AUTO_WRITE
124 ),
125 // avoid type checking since dictionary is read using the
126 // derived type name and type() will result in "objective"
127 // here
128 word::null
129 ),
130 mesh_(mesh),
131 dict_(dict),
132 adjointSolverName_(adjointSolverName),
133 primalSolverName_(primalSolverName),
134 objectiveName_(dict.dictName()),
135 computeMeanFields_(false), // is reset in derived classes
136 nullified_(false),
137 normalize_
138 (
139 dict.getOrDefaultCompat<bool>
140 (
141 "normalise", {{"normalize", 2406}}, false
142 )
143 ),
144 shouldWrite_(true),
145
146 J_(Zero),
147 JMean_(this->getOrDefault<scalar>("JMean", Zero)),
148 weight_(dict.get<scalar>("weight")),
149 computed_(false),
150 normFactor_(nullptr),
151 target_
152 (
153 dict.found("target") ?
154 autoPtr<scalar>::New(dict.get<scalar>("target")) :
155 nullptr
156 ),
157 targetLeft_
158 (
159 dict.found("targetLeft") ?
160 autoPtr<scalar>::New(dict.get<scalar>("targetLeft")) :
161 nullptr
162 ),
163 integrationStartTimePtr_(nullptr),
164 integrationEndTimePtr_(nullptr),
165 fieldNames_(),
166
167 // Initialize pointers to nullptr.
168 // Not all of them are required for each objective function.
169 // Each child should allocate whatever is needed.
170
171 dJdbPtr_(nullptr),
172 dJdbFieldPtr_(nullptr),
173 bdJdbPtr_(nullptr),
174 bdSdbMultPtr_(nullptr),
175 bdndbMultPtr_(nullptr),
176 bdxdbMultPtr_(nullptr),
177 bdxdbDirectMultPtr_(nullptr),
178 bEdgeContribution_(nullptr),
179 divDxDbMultPtr_(nullptr),
180 gradDxDbMultPtr_(nullptr),
181
182 objFunctionFolder_("word"),
183 objFunctionFilePtr_(nullptr),
184 instantValueFilePtr_(nullptr),
185 meanValueFilePtr_(nullptr),
186 width_(IOstream::defaultPrecision() + 5)
187{
188 makeFolder();
189 // Read integration start and end times, if present.
190 // For unsteady runs only
191 if (dict.found("integrationStartTime"))
192 {
193 integrationStartTimePtr_.reset
194 (
195 new scalar(dict.get<scalar>("integrationStartTime"))
196 );
197 }
198 if (dict.found("integrationEndTime"))
199 {
200 integrationEndTimePtr_.reset
201 (
202 new scalar(dict.get<scalar>("integrationEndTime"))
203 );
204 }
205
206 // Set normalization factor, if present
207 if (normalize_)
208 {
209 scalar normFactor(Zero);
210 if (dict.readIfPresent("normFactor", normFactor))
211 {
212 normFactor_.reset(new scalar(normFactor));
213 }
214 else if (this->readIfPresent("normFactor", normFactor))
215 {
216 normFactor_.reset(new scalar(normFactor));
217 }
218 }
219
220 // Set the weight factor in case of continuation
221 this->readIfPresent("weight", weight_);
222}
223
224
225// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
226
228(
229 const fvMesh& mesh,
230 const dictionary& dict,
231 const word& objectiveType,
232 const word& adjointSolverName,
233 const word& primalSolverName
234)
235{
236 auto* ctorPtr = objectiveConstructorTable(objectiveType);
237
238 if (!ctorPtr)
239 {
241 (
242 dict,
243 "objective",
244 objectiveType,
245 *objectiveConstructorTablePtr_
246 ) << exit(FatalIOError);
247 }
248
249 return autoPtr<objective>
250 (
251 ctorPtr
252 (
253 mesh,
254 dict,
255 adjointSolverName,
256 primalSolverName
258 );
259}
260
261
262// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
263
265{
266 dict_ = dict;
267 return true;
268}
269
270
271scalar objective::JCycle(bool negate) const
272{
273 scalar J(J_);
274 if
275 (
278 )
279 {
280 J = JMean_;
281 }
282
283 // Subtract target, in case the objective is used as a constraint
284 if (target_)
285 {
286 if (negate)
287 {
288 J = - J + targetLeft_();
289 }
290 else
291 {
292 J -= target_();
293 }
294 }
295
296 // Normalize here, in order to get the correct value for line search
297 if (normalize_ && normFactor_)
298 {
299 J /= normFactor_();
301 J *= weight_;
302
303 return J;
304}
305
306
308{
309 if (normalize_ && !normFactor_)
310 {
311 scalar J(JCycle()/weight_);
312 normFactor_.reset(new scalar(J));
314 << "objective " << name() << ":: updating norm factor "
315 << "to " << normFactor_()
316 << " for time = " << mesh_.time().timeName() << endl;
317 }
318}
319
320
321void objective::accumulateJMean(solverControl& solverControl)
322{
323 if (solverControl.doAverageIter())
324 {
325 const label iAverageIter = solverControl.averageIter();
326 if (iAverageIter == 0)
327 {
328 JMean_ = Zero;
329 }
330 scalar avIter(iAverageIter);
331 scalar oneOverItP1 = 1./(avIter + 1);
332 scalar mult = avIter*oneOverItP1;
333 JMean_ = JMean_*mult + J_*oneOverItP1;
334 }
335}
336
337
339{
341 {
342 const scalar time = mesh_.time().value();
344 {
345 const scalar dt = mesh_.time().deltaTValue();
346 const scalar elapsedTime = time - integrationStartTimePtr_();
347 const scalar denom = elapsedTime + dt;
348 JMean_ = (JMean_*elapsedTime + J_*dt)/denom;
349 }
350 }
351 else
352 {
354 << "Unallocated integration start or end time"
355 << exit(FatalError);
356 }
357}
358
360scalar objective::weight() const
361{
362 return weight_;
363}
364
366bool objective::normalize() const
367{
368 return normalize_;
369}
370
371
373{
374 if (normalize_ && normFactor_)
375 {
376 const scalar oneOverNorm(1./normFactor_());
377
378 if (hasdJdb())
379 {
380 dJdbPtr_().primitiveFieldRef() *= oneOverNorm;
381 }
382 if (hasdJdbField())
383 {
384 dJdbFieldPtr_() *= oneOverNorm;
385 }
386 if (hasBoundarydJdb())
387 {
388 bdJdbPtr_() *= oneOverNorm;
389 }
390 if (hasdSdbMult())
391 {
392 bdSdbMultPtr_() *= oneOverNorm;
393 }
394 if (hasdndbMult())
395 {
396 bdndbMultPtr_() *= oneOverNorm;
397 }
398 if (hasdxdbMult())
399 {
400 bdxdbMultPtr_() *= oneOverNorm;
401 }
402 if (hasdxdbDirectMult())
403 {
404 bdxdbDirectMultPtr_() *= oneOverNorm;
405 }
407 {
408 bEdgeContribution_() *= oneOverNorm;
409 }
410 if (hasDivDxDbMult())
411 {
412 divDxDbMultPtr_() *= oneOverNorm;
413 }
414 if (hasGradDxDbMult())
416 gradDxDbMultPtr_() *= oneOverNorm;
417 }
418 }
419}
420
421
423{
425 {
426 const scalar time = mesh_.time().value();
427 return
428 (
431 );
432 }
433 else
434 {
436 << "Unallocated integration start or end time for objective '"
438 << exit(FatalError);
439 }
440 return false;
441}
442
443
444void objective::incrementIntegrationTimes(const scalar timeSpan)
445{
447 {
448 integrationStartTimePtr_() += timeSpan;
449 integrationEndTimePtr_() += timeSpan;
450 }
451 else
452 {
454 << "Unallocated integration start or end time"
455 << exit(FatalError);
456 }
457}
458
459
461{
462 // Objective function value
463 J();
464
465 // volFields
466 update_dJdb();
470
471 // boundaryFields
478}
479
480
482{
483 if (!nullified_)
484 {
485 if (hasdJdb())
486 {
487 dJdbPtr_() == Zero;
488 }
489 if (hasdJdbField())
490 {
491 dJdbFieldPtr_() = Zero;
492 }
493 if (hasBoundarydJdb())
494 {
495 bdJdbPtr_() == Zero;
496 }
497 if (hasdSdbMult())
498 {
499 bdSdbMultPtr_() == Zero;
500 }
501 if (hasdndbMult())
502 {
503 bdndbMultPtr_() == Zero;
504 }
505 if (hasdxdbMult())
506 {
507 bdxdbMultPtr_() == Zero;
508 }
509 if (hasdxdbDirectMult())
510 {
512 }
514 {
515 for (auto& field : bEdgeContribution_())
516 {
517 field = Zero;
518 }
519 }
520 if (hasDivDxDbMult())
521 {
523 }
524 if (hasGradDxDbMult())
525 {
528
529 nullified_ = true;
530 }
531}
532
533
534bool objective::write(const bool valid) const
535{
536 if (Pstream::master())
537 {
538 // File is opened only upon invocation of the write function
539 // in order to avoid various instantiations of the same objective
540 // opening the same file
542 {
544 OFstream& file = objFunctionFilePtr_();
545 file.setf(std::ios_base::left);
546
547 if (target_)
548 {
549 file<< setw(width_) << "#target" << " "
550 << setw(width_) << target_() << endl;
551 }
552 if (targetLeft_)
553 {
554 file<< setw(width_) << "#targetLeft" << " "
555 << setw(width_) << targetLeft_() << endl;
556 }
557 if (normalize_)
558 {
559 file<< setw(width_) << "#normFactor " << " "
560 << setw(width_) << normFactor_() << endl;
561 }
563 file<< setw(4) << "#" << " ";
564 file<< setw(width_) << "J" << " ";
565 file<< setw(width_) << "JCycle" << " ";
566 if (targetLeft_)
567 {
568 file<< setw(width_) << "JCycleLeft" << " ";
569 }
571 file<< endl;
572 }
573
574 OFstream& file = objFunctionFilePtr_();
575 file<< setw(4) << mesh_.time().value() << " ";
576 file<< setw(width_) << J_ << " ";
577 file<< setw(width_) << JCycle() << " ";
578 if (targetLeft_)
579 {
580 file<< setw(width_) << JCycle(true) << " ";
581 }
583 file<< endl;
584 }
585
586 return true;
587}
588
589
591{
592 if (Pstream::master())
593 {
594 // File is opened only upon invocation of the write function
595 // in order to avoid various instantiations of the same objective
596 // opening the same file
597 unsigned int width = IOstream::defaultPrecision() + 6;
599 {
601 }
604 << setw(width) << mesh_.time().value() << tab << J_ << endl;
605 }
606}
607
608
610{
611 if (Pstream::master())
612 {
616 }
617 }
618}
619
620
621void objective::writeMeanValue() const
622{
623 if (Pstream::master())
624 {
625 // Write mean value if necessary
626 // Covers both steady and unsteady runs
627 if
628 (
631 )
632 {
633 // File is opened only upon invocation of the write function
634 // in order to avoid various instantiations of the same objective
635 // opening the same file
637 {
639 }
640
642 << mesh_.time().value() << tab << JMean_ << endl;
643 }
644 }
645}
646
647
649{
650 os.writeEntry("JMean", JMean_);
651 if (normFactor_)
652 {
653 os.writeEntry("normFactor", normFactor_());
654 }
655 os.writeEntry("weight", weight_);
656 return os.good();
657}
658
660void objective::addHeaderInfo() const
661{
662 // Does nothing in base
663}
664
667{
668 // Does nothing in base
669}
670
671
673{
674 // Does nothing in base
675}
676
677
678// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
679
680} // End namespace Foam
681
682// ************************************************************************* //
Istream and Ostream manipulators taking arguments.
propsDict readIfPresent("fields", acceptFields)
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
const Time & time() const noexcept
Return Time associated with the objectRegistry.
Definition IOobject.C:456
std::ios_base::fmtflags setf(std::ios_base::fmtflags f)
Set stream flag(s), return old stream flags.
Definition IOstream.H:506
static unsigned int defaultPrecision() noexcept
Return the default precision.
Definition IOstream.H:437
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
Definition OFstream.H:75
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
scalar deltaTValue() const noexcept
Return time step value.
Definition TimeStateI.H:49
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Definition Time.C:714
fileName globalPath() const
The global path for the case = rootPath/globalCaseName.
Definition TimePathsI.H:108
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Definition UPstream.H:1714
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
Definition autoPtrI.H:37
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition autoPtr.H:178
const word & name() const
Name function is needed to disambiguate those inherited from regIOobject and dictionary.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
T getOrDefaultCompat(const word &keyword, std::initializer_list< std::pair< const char *, int > > compat, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value using any compatibility names if needed.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition dictionary.H:487
word dictName() const
The local dictionary name (final part of scoped name).
Definition dictionaryI.H:53
const Type & value() const noexcept
Return const reference to value.
A class for handling file names.
Definition fileName.H:75
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
const Time & time() const
Return the top-level database.
Definition fvMesh.H:360
const word & name() const
Return reference to name.
Definition fvMesh.H:387
localIOdictionary is derived from IOdictionary but excludes parallel master reading.
localIOdictionary(const IOobject &io, const dictionary *fallback=nullptr)
Construct given an IOobject and optional fallback dictionary content.
Abstract base class for objective functions. No point in making this runTime selectable since its chi...
Definition objective.H:58
virtual void writeInstantaneousSeparator() const
Append a blank line after the end of optimisation cycle to the file holding the instantaneous objecti...
Definition objective.C:602
bool hasdSdbMult() const noexcept
Definition objectiveI.H:181
virtual void writeInstantaneousValue() const
Write objective function history at each primal solver iteration.
Definition objective.C:583
virtual void update_dxdbMultiplier()
Update d (x) / db multiplier. Surface-based sensitivity term.
Definition objective.H:515
autoPtr< OFstream > instantValueFilePtr_
File to keep the objective values at each iteration of the primal solver.
Definition objective.H:215
virtual void update_gradDxDbMultiplier()
Update grad( dx/db multiplier). Volume-based sensitivity term.
Definition objective.H:540
bool hasIntegrationStartTime() const noexcept
Definition objectiveI.H:223
autoPtr< boundaryVectorField > bdJdbPtr_
Contribution to field sensitivity derivatives.
Definition objective.H:156
virtual void update_dxdbDirectMultiplier()
Update d (x) / db multiplier. Surface and volume-based sensitivity term.
Definition objective.H:522
virtual bool write(const bool valid=true) const
Write objective function history.
Definition objective.C:527
virtual void accumulateJMean()
Accumulate contribution for the mean objective value.
Definition objective.C:331
const fvMesh & mesh_
Definition objective.H:63
virtual void update()=0
Update objective function derivatives.
Definition objective.C:453
scalar JMean_
Average objective value.
Definition objective.H:81
autoPtr< boundaryVectorField > bdSdbMultPtr_
Term multiplying delta(n dS)/delta b.
Definition objective.H:161
const word objectiveName_
Definition objective.H:67
static autoPtr< objective > New(const fvMesh &mesh, const dictionary &dict, const word &objectiveType, const word &adjointSolverName, const word &primalSolverName)
Return a reference to the selected turbulence model.
Definition objective.C:221
virtual void update_dJdbField()
Definition objective.H:491
void setMeanValueFilePtr() const
Set the output file ptr for the mean value.
Definition objective.C:77
virtual void writeMeanValue() const
Write mean objective function history.
Definition objective.C:614
autoPtr< OFstream > objFunctionFilePtr_
File to keep the objective values after the end of the primal solver.
Definition objective.H:209
autoPtr< OFstream > meanValueFilePtr_
File to keep the average objective values after the end of the primal solver.
Definition objective.H:221
virtual void update_divDxDbMultiplier()
Update div( dx/db multiplier). Volume-based sensitivity term.
Definition objective.H:534
virtual void addHeaderColumns() const
Write headers for additional columns.
Definition objective.C:659
bool hasGradDxDbMult() const noexcept
Definition objectiveI.H:217
bool hasBoundarydJdb() const noexcept
Definition objectiveI.H:175
bool hasdJdb() const noexcept
Definition objectiveI.H:163
virtual scalar weight() const
Return the objective function weight.
Definition objective.C:353
virtual bool writeData(Ostream &os) const
Write averaged objective for continuation.
Definition objective.C:641
autoPtr< scalar > targetLeft_
Target on the left hand-side of a double inequality, for double sided constraints.
Definition objective.H:116
autoPtr< boundaryVectorField > bdxdbDirectMultPtr_
Term multiplying delta(x)/delta b at the boundary for objectives that directly depend on x,...
Definition objective.H:178
virtual void update_boundarydJdb()
Update objective function derivative term.
Definition objective.H:497
virtual void nullify()
Nullify adjoint contributions.
Definition objective.C:474
dictionary dict_
Definition objective.H:64
autoPtr< scalar > integrationStartTimePtr_
Objective integration start and end times (for unsteady flows).
Definition objective.H:121
bool hasIntegrationEndTime() const noexcept
Definition objectiveI.H:229
bool hasdndbMult() const noexcept
Definition objectiveI.H:187
void setObjectiveFilePtr() const
Set the output file ptr.
Definition objective.C:56
autoPtr< scalar > normFactor_
Normalization factor.
Definition objective.H:101
virtual scalar JCycle(bool negate=false) const
Return the objective function of the optimisation cycle.
Definition objective.C:264
scalar weight_
Objective weight.
Definition objective.H:86
bool computeMeanFields_
Definition objective.H:68
virtual bool readDict(const dictionary &dict)
Definition objective.C:257
unsigned int width_
Default width of entries when writing in the objective files.
Definition objective.H:226
virtual scalar J()=0
Return the instantaneous objective function value.
autoPtr< scalar > integrationEndTimePtr_
Definition objective.H:122
virtual void update_dSdbMultiplier()
Update d (normal dS) / db multiplier. Surface-based sensitivity term.
Definition objective.H:503
virtual void addHeaderInfo() const
Write any information that needs to go the header of the file.
Definition objective.C:653
bool hasdJdbField() const noexcept
Definition objectiveI.H:169
virtual void update_dndbMultiplier()
Update d (normal) / db multiplier. Surface-based sensitivity term.
Definition objective.H:509
autoPtr< volScalarField > divDxDbMultPtr_
Multiplier of d(Volume)/db.
Definition objective.H:194
bool hasDivDxDbMult() const noexcept
Definition objectiveI.H:211
scalar J_
Objective function value and weight.
Definition objective.H:76
bool hasBoundaryEdgeContribution() const noexcept
Definition objectiveI.H:205
void setInstantValueFilePtr() const
Set the output file ptr for the instantaneous value.
Definition objective.C:65
virtual void incrementIntegrationTimes(const scalar timeSpan)
Increment integration times.
Definition objective.C:437
virtual void doNormalization()
Normalize all fields allocated by the objective.
Definition objective.C:365
virtual bool normalize() const
Is the objective normalized.
Definition objective.C:359
const dictionary & dict() const
Return objective dictionary.
Definition objective.C:91
const word primalSolverName_
Definition objective.H:66
virtual void updateNormalizationFactor()
Update normalization factors, for objectives in which the factor is not known a priori.
Definition objective.C:300
virtual void update_dJdb()
Definition objective.H:488
fileName objFunctionFolder_
Output file variables.
Definition objective.H:204
autoPtr< scalar > target_
Target value, in case the objective is used as a constraint.
Definition objective.H:110
autoPtr< boundaryVectorField > bdndbMultPtr_
Term multiplying delta(n)/delta b.
Definition objective.H:166
virtual void update_boundaryEdgeContribution()
Update boundary edge contributions.
Definition objective.H:528
autoPtr< boundaryVectorField > bdxdbMultPtr_
Term multiplying delta(x)/delta b at the boundary.
Definition objective.H:171
const word adjointSolverName_
Definition objective.H:65
virtual void addColumnValues() const
Write information to additional columns.
Definition objective.C:665
bool hasdxdbDirectMult() const noexcept
Definition objectiveI.H:199
virtual bool isWithinIntegrationTime() const
Check whether this is an objective integration time.
Definition objective.C:415
autoPtr< vectorField3 > bEdgeContribution_
Contribution located in specific parts of a patch. Mainly intended for patch boundary edges contribut...
Definition objective.H:185
bool hasdxdbMult() const noexcept
Definition objectiveI.H:193
autoPtr< volTensorField > gradDxDbMultPtr_
Emerging from volume objectives that include spatial derivatives.
Definition objective.H:199
static word defaultRegion
Return the default region name.
Definition polyMesh.H:406
Base class for solver control classes.
bool doAverageIter() const
Whether or not to add fields of the current iteration to the average fields.
label & averageIter()
Return average iteration index reference.
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
rDeltaTY field()
dynamicFvMesh & mesh
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition error.H:637
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
OBJstream os(runTime.globalPath()/outputName)
const word dictName("faMeshDefinition")
word timeName
Definition getTimeIndex.H:3
#define DebugInfo
Report an information message using Foam::Info.
Namespace for OpenFOAM.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Definition POSIX.C:616
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition POSIX.C:801
Omanip< int > setw(const int i)
Definition IOmanip.H:199
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
void negate(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
constexpr char tab
The tab '\t' character(0x09).
Definition Ostream.H:49
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict