Loading...
Searching...
No Matches
setExprFields.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) 2019-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Application
27 setExprFields
28
29Group
30 grpPreProcessingUtilities
31
32Description
33 Set values on a selected set of cells/patch-faces via a dictionary.
34
35Note
36 Based on funkySetFields from
37 Bernhard Gschaider <bgschaid@hfd-research.com>
38
39\*---------------------------------------------------------------------------*/
40
41#include "argList.H"
42#include "Time.H"
43#include "fvMesh.H"
44#include "pointMesh.H"
45#include "volFields.H"
46#include "surfaceFields.H"
47#include "pointFields.H"
48#include "exprOps.H"
49#include "volumeExprDriver.H"
50#include "timeSelector.H"
51#include "readFields.H"
52
53
54using namespace Foam;
55
57
59{
60 switch (geoType)
61 {
62 case FieldAssociation::POINT_DATA : return "points"; break;
63 case FieldAssociation::FACE_DATA : return "faces"; break;
64 case FieldAssociation::VOLUME_DATA : return "cells"; break;
65 default: break;
66 }
67 return "unknown";
68}
69
70
71//- Simple control structure to with collected switches to simplify passing
72struct setExprFieldsControl
73{
74 bool dryRun;
75 bool debugParsing;
76 bool cacheVariables;
77 bool hasDimensions;
78 bool createNew;
79 bool keepPatches;
80 bool correctPatches;
81 bool correctBCs;
82 IOstreamOption streamOpt;
83};
84
85
86template<class Type>
88(
89 bool correctBCs,
91)
92{
93 if (correctBCs)
94 {
95 Info<< "Correcting boundary conditions: " << field.name() << nl;
96 field.correctBoundaryConditions();
97 }
98}
99
100
101template<class Type>
103(
104 bool correctBCs,
106)
107{
108 if (correctBCs)
109 {
110 Info<< "Correcting boundary conditions: " << field.name() << nl;
111 field.correctBoundaryConditions();
112 }
113}
114
115
116template<class Type>
118(
119 bool correctBCs,
121)
122{}
123
124
125template<class GeoField>
126bool setField
127(
128 const word& fieldName,
129 const GeoField& evaluated,
130 const boolField& fieldMask,
131 const dimensionSet& dims,
132 const wordList& valuePatches,
133
134 const setExprFieldsControl& ctrl
135)
136{
137 Info<< "setField(" << fieldName << "): "
139
140 const auto& mesh = evaluated.mesh();
141
142 tmp<GeoField> toutput;
143
144 if (ctrl.createNew)
145 {
146 // Create with zero
147 toutput = GeoField::New
148 (
149 fieldName,
150 mesh,
151 Foam::zero{}, // value
152 dims
153 );
154 }
155 else
156 {
157 // Read
158 toutput = tmp<GeoField>::New
159 (
161 (
162 fieldName,
163 mesh.thisDb().time().timeName(),
164 mesh.thisDb(),
168 ),
169 mesh
170 );
171 }
172
173 auto& output = toutput.ref();
174
175 label numValuesChanged = 0;
176
177 // Internal field
178 if (fieldMask.empty())
179 {
180 // No field-mask - set entire internal field
181 numValuesChanged = output.size();
182
183 output.primitiveFieldRef() = evaluated;
184 }
185 else
186 {
187 auto& internal = output.primitiveFieldRef();
188
189 forAll(internal, idx)
190 {
191 if (fieldMask[idx])
192 {
193 internal[idx] = evaluated[idx];
194 ++numValuesChanged;
195 }
196 }
197 }
198
199 // Boundary fields
200 forAll(evaluated.boundaryField(), patchi)
201 {
202 auto& pf = output.boundaryFieldRef()[patchi];
203
204 if (pf.patch().coupled())
205 {
206 pf == evaluated.boundaryField()[patchi];
207 }
208 }
209
210 doCorrectBoundaryConditions(ctrl.correctBCs, output);
211
212 const label numTotal = returnReduce(output.size(), sumOp<label>());
213 reduce(numValuesChanged, sumOp<label>());
214
215 if (numValuesChanged == numTotal)
216 {
217 Info<< "Set all ";
218 }
219 else
220 {
221 Info<< "Set " << numValuesChanged << " of ";
222 }
223 Info<< numTotal << " values" << endl;
224
225 if (ctrl.hasDimensions)
226 {
227 Info<< "Setting dimensions to " << dims << endl;
228 output.dimensions().reset(dims);
229 }
230
231 if (ctrl.dryRun)
232 {
233 Info<< "(dry-run): Writing to " << output.name() << nl;
234 }
235 else
236 {
237 Info<< "Writing to " << output.name() << nl;
238 output.writeObject(ctrl.streamOpt, true);
239 }
240
241 return true;
242}
243
244
245void evaluate
246(
247 const fvMesh& mesh,
248 const word& fieldName,
249 const expressions::exprString& valueExpr_,
250 const expressions::exprString& maskExpr_,
251 const dictionary& dict,
252 const dimensionSet& dims,
253 const wordList& valuePatches,
254
255 const setExprFieldsControl& ctrl
256)
257{
258 word oldFieldType;
259
260 if (ctrl.createNew)
261 {
262 Info<< "Set new field: " << fieldName;
263 }
264 else
265 {
267 (
268 fieldName,
269 mesh.thisDb().time().timeName(),
270 mesh.thisDb(),
273 );
274
275 if (!io.typeHeaderOk<regIOobject>(false))
276 {
278 << "Field '" << fieldName
279 << "' seems to be missing. Use 'create'" << nl
280 << exit(FatalError);
281 }
282
283 oldFieldType = io.headerClassName();
284
285 Info<< "Modify field: " << fieldName
286 << " (type: " << oldFieldType << ')';
287 }
288
289
290 Info<< " time=" << mesh.thisDb().time().timeName() << nl
291 << "Expression:" << nl
292 << ">>>>" << nl
293 << valueExpr_.c_str() << nl
294 << "<<<<" << nl;
295
296 bool evalFieldMask =
297 (maskExpr_.size() && maskExpr_ != "true" && maskExpr_ != "1");
298
299 if (evalFieldMask)
300 {
301 Info<< "field-mask:" << nl
302 << ">>>>" << nl
303 << maskExpr_.c_str() << nl
304 << "<<<<" << nl;
305 }
306
307 if (ctrl.keepPatches)
308 {
309 Info<< "Keeping patches unaltered" << endl;
310 }
311 else if (!valuePatches.empty())
312 {
313 Info<< "Setting patches " << flatOutput(valuePatches)
314 << " to fixed value" << endl;
315 }
316
317 Info<< endl;
318
320
321 driver.setCaching(ctrl.cacheVariables);
322
323 driver.readDict(dict);
324
325 if (ctrl.debugParsing)
326 {
327 Info<< "Parsing expression: " << valueExpr_ << "\nand field-mask "
328 << maskExpr_ << nl << endl;
329 driver.setDebugging(true, true);
330 }
331
332
333 driver.clearVariables();
334
335
336 // Handle "field-mask" evaluation
337
338 boolField fieldMask;
339 FieldAssociation maskFieldAssoc(FieldAssociation::NO_DATA);
340
341 if (evalFieldMask)
342 {
343 if (ctrl.debugParsing)
344 {
345 Info<< "Parsing field-mask:" << maskExpr_ << endl;
346 }
347
348 driver.parse(maskExpr_);
349 if (ctrl.debugParsing)
350 {
351 Info<< "Parsed field-mask" << endl;
352 }
353
354 if (driver.isLogical())
355 {
356 auto& result = driver.result();
357 if (result.is_bool())
358 {
359 fieldMask = result.getResult<bool>();
360 maskFieldAssoc = driver.fieldAssociation();
361 }
362 }
363
364 // Slightly pedantic...
365 driver.clearField();
366 driver.clearResult();
367
368 evalFieldMask = (maskFieldAssoc != FieldAssociation::NO_DATA);
369
370 if (!evalFieldMask)
371 {
373 << " mask: " << maskExpr_
374 << " does not evaluate to a logical expression: "
375 << driver.resultType() << nl
376 #ifdef FULLDEBUG
377 << "contents: " << fieldMask
378 #endif
379 << exit(FatalError);
380 }
381
382 if (ctrl.debugParsing)
383 {
384 Info<< "Field-mask evaluates to "
385 << fieldMask << nl;
386 }
387 }
388
389 if (ctrl.debugParsing)
390 {
391 Info<< "Parsing expression:" << valueExpr_ << endl;
392 }
393
394 driver.parse(valueExpr_);
395
396 if (ctrl.debugParsing)
397 {
398 Info<< "Parsed expression" << endl;
399 }
400
401 if (evalFieldMask && maskFieldAssoc != driver.fieldAssociation())
402 {
404 << "Mismatch between field-mask geometric type ("
405 << fieldGeoType(maskFieldAssoc) << ") and" << nl
406 << "expression geometric type ("
407 << fieldGeoType(driver.fieldAssociation()) << ')' << nl
408 << nl
409 << "expression: " << valueExpr_ << nl
410 << "field-mask: " << maskExpr_ << nl
411 << nl
412 << exit(FatalError);
413 }
414
415 if (!oldFieldType.empty() && driver.resultType() != oldFieldType)
416 {
418 << "Inconsistent types: " << fieldName << " is "
419 << oldFieldType
420 << " but the expression evaluates to "
421 << driver.resultType()
422 << exit(FatalError);
423 }
424
425 Info<< "Dispatch ... " << driver.resultType() << nl;
426
427
428 bool applied = false;
429 switch (driver.fieldAssociation())
430 {
431 #undef doLocalCode
432 #define doLocalCode(GeoField) \
433 { \
434 const auto* ptr = driver.isResultType<GeoField>(); \
435 if (ptr) \
436 { \
437 applied = setField \
438 ( \
439 fieldName, \
440 *ptr, \
441 fieldMask, \
442 dims, \
443 valuePatches, \
444 ctrl \
445 ); \
446 break; \
447 } \
448 }
449
450 case FieldAssociation::VOLUME_DATA:
451 {
457 break;
458 }
459 case FieldAssociation::FACE_DATA:
460 {
466 break;
467 }
468 case FieldAssociation::POINT_DATA:
469 {
475 break;
476 }
477
478 default: break;
479 #undef doLocalCode
480 }
481
482 if (!applied)
483 {
485 << "Expression evaluates to an unsupported type: "
486 << driver.resultType() << nl << nl
487 << "Expression " << valueExpr_ << nl << endl
488 << exit(FatalError);
489 }
490}
491
492
493// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
494
495int main(int argc, char *argv[])
496{
497 // Normally without functionObjects, with -withFunctionObjects to enable
499
500 // No -constant, no special treatment for 0/
502
504 (
505 "ascii",
506 "Write in ASCII format instead of the controlDict setting"
507 );
509 (
510 "dict",
511 "file",
512 "Alternative dictionary for setExprFieldsDict"
513 );
515 (
516 "Evaluate but do not write"
517 );
519 (
520 "Additional verbosity",
521 true // Advanced option
522 );
524 (
525 "load-fields",
526 "wordList",
527 "Specify field or fields to preload. Eg, 'T' or '(p T U)'",
528 true // Advanced option
529 );
531 (
532 "field",
533 "name",
534 "The field to create/overwrite"
535 " (command-line operation)",
536 true // Advanced option
537 );
539 (
540 "expression",
541 "expr",
542 "The expression to evaluate"
543 " (command-line operation)",
544 true // Advanced option
545 );
547 (
548 "field-mask",
549 "logic",
550 "The field mask (logical condition) when to apply the expression"
551 " (command-line operation)",
552 true // Advanced option
553 );
554 argList::addOptionCompat("field-mask", {"condition", 2106});
556 (
557 "dimensions",
558 "dims",
559 "The dimensions for created fields"
560 " (command-line operation)",
561 true // Advanced option
562 );
563
565 (
566 "debug-parser",
567 "Additional debugging information",
568 true // Advanced option
569 );
571 (
572 "no-variable-cache",
573 "Disable caching of expression variables",
574 true // Advanced option
575 );
577 (
578 "create",
579 "Create a new field"
580 " (command-line operation)",
581 true // Advanced option
582 );
584 (
585 "keepPatches",
586 "Leave patches unaltered"
587 " (command-line operation)",
588 true // Advanced option
589 );
591 (
592 "value-patches",
593 "(patches)",
594 "A list of patches that receive a fixed value"
595 " (command-line operation)",
596 true // Advanced option
597 );
599 (
600 "dummy-phi",
601 "Provide a zero phi field"
602 " (command-line operation)",
603 true // Advanced option
604 );
605
606 // Future?
607 #if 0
609 (
610 "noCorrectPatches",
611 ""
612 );
614 (
615 "correctResultBoundaryFields",
616 "",
617 true
618 );
619 #endif
620
621 #include "addRegionOption.H"
622 #include "setRootCase.H"
623
624 #include "createTime.H"
625
626 const word dictName("setExprFieldsDict");
627
629
630 if (times.empty())
631 {
633 << "No times selected." << nl
634 << exit(FatalError);
635 }
636
637 // Disable dimension checking during operations
639
640 #include "createNamedMesh.H"
641
643
644 autoPtr<IOdictionary> exprDictPtr;
645
646 // Sort out conflicts
647
648 const bool useCommandArgs = args.found("field");
649
650 if (useCommandArgs)
651 {
652 bool fatalCombination = false;
653
654 if (args.found("dict"))
655 {
656 fatalCombination = true;
658 << "Cannot specify both dictionary and command-line arguments"
659 << nl << endl;
660 }
661
662 if (args.found("create") && args.found("keepPatches"))
663 {
664 fatalCombination = true;
666 << "Cannot specify both 'create' and 'keepPatches'" << nl
667 << endl;
668 }
669
670 if (!args.found("expression"))
671 {
672 fatalCombination = true;
674 << "Missing mandatory 'expression' option'" << nl
675 << endl;
676 }
677 if (fatalCombination)
678 {
680 << exit(FatalError);
681 }
682 }
683 else
684 {
685 // Carp about inapplicable options (non-fatal)
686
687 wordHashSet badOptions
688 ({
689 "create", "keepPatches", "value-patches",
690 "field-mask", "expression", "dimensions"
691 });
692 badOptions.retain(args.options());
693
694 if (!badOptions.empty())
695 {
696 // Non-fatal (warning)
698 << "Using a dictionary. Cannot specify these options:" << nl
699 << flatOutput(badOptions.sortedToc()) << nl
700 << endl;
701 }
702
704 exprDictPtr.reset(new IOdictionary(dictIO));
705 }
706
707 forAll(times, timei)
708 {
709 runTime.setTime(times[timei], timei);
710
711 Info<< "\nTime = " << runTime.timeName() << endl;
712
713 mesh.readUpdate();
714
715 // preload fields specified on command-line
716 if (timei == 0)
717 {
718 wordList preloadFields;
719 args.readListIfPresent("load-fields", preloadFields);
720 readFieldsHandler(mesh).execute(preloadFields);
721 }
722
723 if (args.found("dummy-phi") && !dummyPhi)
724 {
725 Info<< "Adding a dummy phi" << endl;
726 dummyPhi.reset
727 (
729 (
731 (
732 "phi",
733 mesh.thisDb().time().constant(),
734 mesh.thisDb(),
737 ),
738 mesh,
740 )
741 );
742 }
743
744 if (args.allowFunctionObjects())
745 {
746 runTime.functionObjects().start();
747 }
748
749 if (useCommandArgs)
750 {
751 const word fieldName(args.get<word>("field"));
752
753 Info<< "Using command-line options for "
754 << fieldName << nl << endl;
755
756 setExprFieldsControl ctrl;
757
758 ctrl.dryRun = args.dryRun();
759 ctrl.debugParsing = args.found("debug-parser");
760 ctrl.cacheVariables = !args.found("no-variable-caching");
761
762 ctrl.createNew = args.found("create");
763 ctrl.keepPatches = args.found("keepPatches");
764 ctrl.correctPatches = !args.found("noCorrectPatches");
765 ctrl.correctBCs = args.found("correctResultBoundaryFields");
766 ctrl.hasDimensions = args.found("dimensions");
767 ctrl.streamOpt.format(runTime.writeFormat());
768 if (args.found("ascii"))
769 {
770 ctrl.streamOpt.format(IOstreamOption::ASCII);
771 }
772
773 expressions::exprString valueExpr_(args["expression"]);
774
775 expressions::exprString maskExpr_;
776 args.readIfPresent("field-mask", maskExpr_);
777
778 dimensionSet dims;
779 if (ctrl.hasDimensions)
780 {
781 ITstream is(args.lookup("dimensions"));
782 is >> dims;
783 }
784
786 (
787 mesh,
788 fieldName,
789 valueExpr_,
790 maskExpr_,
792 dims,
793 args.getList<word>("value-patches", false),
794
795 ctrl
796 );
797 }
798 else if (exprDictPtr)
799 {
800 const dictionary& exprDict = *exprDictPtr;
801
802 // preload fields specified in dictionary
803 {
804 wordList preloadFields;
805 exprDict.readIfPresent("readFields", preloadFields);
806 readFieldsHandler(mesh).execute(preloadFields);
807 }
808
809 // Read set construct info from dictionary
810 PtrList<entry> actions(exprDict.lookup("expressions"));
811
812 for (const entry& dEntry : actions)
813 {
814 if (!dEntry.isDict())
815 {
816 Info<< "Ignore non-dictionary entry: "
817 << dEntry.keyword() << nl;
818 continue;
819 }
820
821 const dictionary& dict = dEntry.dict();
822
823 setExprFieldsControl ctrl;
824
825 ctrl.dryRun = args.dryRun();
826 ctrl.debugParsing = args.found("debug-parser");
827 ctrl.cacheVariables = !args.found("no-variable-caching");
828
829 ctrl.createNew = dict.getOrDefault("create", false);
830 ctrl.keepPatches = dict.getOrDefault("keepPatches", false);
831
832 ctrl.correctPatches = !args.found("noCorrectPatches");
833 ctrl.correctBCs = args.found("correctResultBoundaryFields");
834 ctrl.streamOpt.format(runTime.writeFormat());
835 if (args.found("ascii"))
836 {
837 ctrl.streamOpt.format(IOstreamOption::ASCII);
838 }
839
840 if (ctrl.createNew && ctrl.keepPatches)
841 {
843 << "Cannot specify both 'create' and 'keepPatches'"
844 << nl << endl
845 << exit(FatalIOError);
846 }
847
848 // Local override
849 dict.readIfPresent
850 (
851 "correctResultBoundaryFields",
852 ctrl.correctBCs
853 );
854
855
856 const word fieldName(dict.get<word>("field"));
857
858 expressions::exprString valueExpr_("expression", dict);
859
860 expressions::exprString maskExpr_;
861 {
862 const entry* eptr = dict.findCompat
863 (
864 "fieldMask", {{"condition", 2106}},
866 );
867
868 if (eptr)
869 {
870 maskExpr_.readEntry(eptr->keyword(), dict);
871 maskExpr_.trim();
872 }
873 }
874
875 // Optional: "dimensions"
876 dimensionSet dims;
877 ctrl.hasDimensions = dims.readIfPresent("dimensions", dict);
878
879 if (args.verbose() && !timei)
880 {
881 // Report once
882 Info<< "Processing" << dict << nl;
883 }
884
886 (
887 mesh,
888 fieldName,
889 valueExpr_,
890 maskExpr_,
891 dict,
892 dims,
893 dict.getOrDefault<wordList>("valuePatches", wordList()),
894
895 ctrl
896 );
897 }
898 }
899 else
900 {
902 << "No command-line or dictionary??" << nl << endl
903 << exit(FatalError);
904 }
905 }
906
907 Info<< "\nEnd\n" << endl;
908
909 return 0;
910}
911
912
913// ************************************************************************* //
Required Classes.
Generic GeometricField class.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
@ ASCII
"ascii" (normal default)
An input stream of tokens.
Definition ITstream.H:56
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
bool empty() const noexcept
True if List is empty (ie, size() is zero).
Definition UList.H:701
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
Definition argList.C:562
static void addVerboseOption(const string &usage="", bool advanced=false)
Enable a 'verbose' bool option, with usage information.
Definition argList.C:535
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
Definition argList.C:519
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
Definition argList.C:389
static void addOption(const word &optName, const string &param="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Definition argList.C:400
static void addOptionCompat(const word &optName, std::pair< const char *, int > compat)
Specify an alias for the option name.
Definition argList.C:433
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
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return an entry data stream. FatalIOError if not found, or not a stream.
Definition dictionary.C:367
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
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
static bool checking(bool on) noexcept
Turn dimension checking on/off.
bool readIfPresent(const word &entryName, const dictionary &dict)
Update the dimensions from dictionary entry. FatalIOError if it is found and the number of tokens is ...
A keyword and a list of tokens is an 'entry'.
Definition entry.H:66
const keyType & keyword() const noexcept
Return keyword.
Definition entry.H:231
The field association for mesh (patch/volume) values.
A variant of Foam::string with expansion of dictionary variables into a comma-separated form.
Definition exprString.H:58
void trim()
Inplace trim leading and trailing whitespace.
Definition exprString.C:60
bool readEntry(const word &keyword, const dictionary &dict, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ)
Read/expand entry with dictionary variables, and strip any embedded C/C++ comments from the input.
Definition exprString.C:67
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
@ LITERAL
String literal.
Definition keyType.H:82
A traits class, which is primarily used for primitives and vector-space.
Definition pTraits.H:64
A simple field-loader, as per the readFields function object.
Definition readFields.H:45
bool execute(const UList< word > &fieldNames)
Definition readFields.H:180
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition regIOobject.H:71
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options and also set the runTime to the first i...
A class for managing temporary objects.
Definition tmp.H:75
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition tmp.H:215
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Definition tmpI.H:235
A class for handling words, derived from Foam::string.
Definition word.H:66
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
rDeltaTY field()
dynamicFvMesh & mesh
engineTime & runTime
Required Classes.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition error.H:629
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
Operations involving expressions.
const auto & io
const word dictName("faMeshDefinition")
#define doLocalCode(FieldType, Variable)
return returnReduce(nRefine-oldNRefine, sumOp< label >())
volumeExpr::parseDriver volumeExprDriver
Typedef for volumeExpr parseDriver.
const wordList internal
Standard volume internal field types (scalar, vector, tensor, etc).
string evaluate(label fieldWidth, const std::string &s, size_t pos=0, size_t len=std::string::npos)
String evaluation with specified (positive, non-zero) field width.
Namespace for OpenFOAM.
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
List< word > wordList
List of word.
Definition fileName.H:60
GeometricField< vector, fvPatchField, volMesh > volVectorField
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
Definition HashSet.H:80
GeometricField< tensor, pointPatchField, pointMesh > pointTensorField
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
GeometricField< sphericalTensor, pointPatchField, pointMesh > pointSphericalTensorField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Field< bool > boolField
Specialisation of Field<T> for bool.
Definition boolField.H:47
messageStream Info
Information stream (stdout output on master, null elsewhere).
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
List< instant > instantList
List of instants.
Definition instantList.H:41
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
GeometricField< symmTensor, pointPatchField, pointMesh > pointSymmTensorField
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
GeometricField< tensor, fvPatchField, volMesh > volTensorField
GeometricField< tensor, fvsPatchField, surfaceMesh > surfaceTensorField
GeometricField< sphericalTensor, fvPatchField, volMesh > volSphericalTensorField
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
Definition FlatOutput.H:217
GeometricField< sphericalTensor, fvsPatchField, surfaceMesh > surfaceSphericalTensorField
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
static void doCorrectBoundaryConditions(bool correctBCs, VolumeField< Type > &field)
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
word fieldGeoType(const expressions::FieldAssociation geoType)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
GeometricField< symmTensor, fvsPatchField, surfaceMesh > surfaceSymmTensorField
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
dictionary dict
surfacesMesh setField(triSurfaceToAgglom)
IOobject dictIO
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299
Foam::surfaceFields.