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-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
26 Application
27  setExprFields
28 
29 Group
30  grpPreProcessingUtilities
31 
32 Description
33  Set values on a selected set of cells/patch-faces via a dictionary.
34 
35 Note
36  Based on funkySetFields
37  Copyright 2006-2018 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 "surfaceFields.H"
48 #include "pointFields.H"
49 #include "exprOps.H"
50 #include "volumeExprDriver.H"
51 #include "timeSelector.H"
52 #include "dlLibraryTable.H"
53 
54 
55 using namespace Foam;
56 
58 
59 word fieldGeoType(const FieldAssociation geoType)
60 {
61  switch (geoType)
62  {
63  case FieldAssociation::VOLUME_DATA : return "cells"; break;
64  case FieldAssociation::SURFACE_DATA : return "faces"; break;
65  case FieldAssociation::POINT_DATA : return "points"; break;
66  default: break;
67  }
68 
69  return "unknown";
70 }
71 
72 
73 //- Simple control structure to with collected switches to simplify passing
74 struct setExprFieldsControl
75 {
76  bool dryRun;
77  bool debugParsing;
78  bool cacheVariables;
79  bool useDimension;
80  bool createNew;
81  bool keepPatches;
82  bool correctPatches;
83  bool correctBCs;
84 };
85 
86 
87 template<class Type>
88 void doCorrectBoundaryConditions
89 (
90  bool correctBCs,
92 )
93 {
94  if (correctBCs)
95  {
96  Info<< "Correcting boundary conditions: " << field.name() << nl;
97  field.correctBoundaryConditions();
98  }
99 }
100 
101 
102 template<class Type>
103 void doCorrectBoundaryConditions
104 (
105  bool correctBCs,
107 )
108 {
109  if (correctBCs)
110  {
111  Info<< "Correcting boundary conditions: " << field.name() << nl;
112  field.correctBoundaryConditions();
113  }
114 }
115 
116 
117 template<class Type>
118 void doCorrectBoundaryConditions
119 (
120  bool correctBCs,
122 )
123 {}
124 
125 
126 template<class GeoField, class Mesh>
127 void setField
128 (
129  const word& fieldName,
130  const Mesh& mesh,
131  const GeoField& result,
132  const scalarField& cond,
133  const dimensionSet& dims,
134  const wordList& valuePatches,
135 
136  const setExprFieldsControl& ctrl
137 )
138 {
139  Info<< "setField(" << fieldName << "): "
141 
142  tmp<GeoField> toutput;
143 
144  if (ctrl.createNew)
145  {
146  // Create with zero
147  toutput = GeoField::New
148  (
149  fieldName,
150  mesh,
152  );
153  }
154  else
155  {
156  // Read
157  toutput = tmp<GeoField>::New
158  (
159  IOobject
160  (
161  fieldName,
162  mesh.thisDb().time().timeName(),
163  mesh.thisDb(),
166  false // No register
167  ),
168  mesh
169  );
170  }
171 
172  auto& output = toutput.ref();
173 
174  label setCells = 0;
175 
176  if (cond.empty())
177  {
178  // No condition
179  output = result;
180 
181  setCells = output.size();
182  }
183  else
184  {
185  forAll(output, celli)
186  {
187  if (expressions::boolOp<scalar>()(cond[celli]))
188  {
189  output[celli] = result[celli];
190  ++setCells;
191  }
192  }
193  }
194 
195  const label totalCells = returnReduce(output.size(), plusOp<label>());
196  reduce(setCells, plusOp<label>());
197 
198  forAll(result.boundaryField(), patchi)
199  {
200  auto& pf = output.boundaryFieldRef()[patchi];
201 
202  if (pf.patch().coupled())
203  {
204  pf == result.boundaryField()[patchi];
205  }
206  }
207 
208 
209  if (setCells == totalCells)
210  {
211  Info<< "Set all ";
212  }
213  else
214  {
215  Info<< "Set " << setCells << " of ";
216  }
217  Info<< totalCells << " cells" << endl;
218 
219 
220  doCorrectBoundaryConditions(ctrl.correctBCs, output);
221 
222  if (ctrl.useDimension)
223  {
224  Info<< "Setting dimension to " << dims << endl;
225  output.dimensions().reset(dims);
226  }
227 
228  if (ctrl.dryRun)
229  {
230  Info<< "(dry-run): Writing to " << output.name() << nl;
231  }
232  else
233  {
234  Info<< "Writing to " << output.name() << nl;
235  output.write();
236  }
237 }
238 
239 
240 void evaluate
241 (
242  const fvMesh& mesh,
243  const word& fieldName,
244  const expressions::exprString& expression,
245  const expressions::exprString& condition,
246  const dictionary& dict,
247  const dimensionSet& dims,
248  const wordList& valuePatches,
249 
250  const setExprFieldsControl& ctrl
251 )
252 {
253  word oldFieldType;
254 
255  if (ctrl.createNew)
256  {
257  Info<< "Set new field: " << fieldName;
258  }
259  else
260  {
261  IOobject io
262  (
263  fieldName,
264  mesh.thisDb().time().timeName(),
265  mesh.thisDb(),
268  );
269  io.typeHeaderOk<IOobject>(false);
270 
271  oldFieldType = io.headerClassName();
272 
273  if (oldFieldType == IOobject::typeName)
274  {
276  << "Field " << fieldName << " is "
277  << oldFieldType
278  << ". Seems that it does not exist. Use 'create'"
279  << nl
280  << exit(FatalError);
281  }
282 
283  Info<< "Modify field: " << fieldName
284  << " (type " << oldFieldType << ')';
285  }
286 
287  Info<< " time=" << mesh.thisDb().time().timeName() << nl
288  << "Expression:" << nl
289  << ">>>>" << nl
290  << expression.c_str() << nl
291  << "<<<<" << nl
292  << "Condition:" << nl
293  << ">>>>" << nl
294  << condition.c_str() << nl
295  << "<<<<" << nl;
296 
297  if (ctrl.keepPatches)
298  {
299  Info<< "Keeping patches unaltered" << endl;
300  }
301  else if (!valuePatches.empty())
302  {
303  Info<< "Setting patches " << flatOutput(valuePatches)
304  << " to fixed value" << endl;
305  }
306 
307  Info<< endl;
308 
310  (
311  mesh,
312  ctrl.cacheVariables
313  );
314 
315  driver.readDict(dict);
316 
317  if (ctrl.debugParsing)
318  {
319  Info<< "Parsing expression: " << expression << "\nand condition "
320  << condition << nl << endl;
321  driver.setDebugging(true, true);
322  }
323 
324 
325  driver.clearVariables();
326 
327  scalarField conditionField;
328 
329  bool evaluatedCondition = false;
330 
332 
333  if (condition.size() && condition != "true")
334  {
335  if (ctrl.debugParsing)
336  {
337  Info<< "Parsing condition:" << condition << endl;
338  }
339 
340  driver.parse(condition);
341  if (ctrl.debugParsing)
342  {
343  Info<< "Parsed condition" << endl;
344  }
345 
346  // Process any/all scalar fields. May help with diagnosis
347 
348  bool goodCond = true;
349  while (goodCond)
350  {
351  // volScalarField
352  {
353  const auto* ptr = driver.isResultType<volScalarField>();
354  if (ptr)
355  {
356  conditionField = ptr->internalField();
357  break;
358  }
359  }
360 
361  // surfaceScalarField
362  {
363  const auto* ptr = driver.isResultType<surfaceScalarField>();
364  if (ptr)
365  {
366  conditionField = ptr->internalField();
367  conditionDataType = FieldAssociation::SURFACE_DATA;
368  break;
369  }
370  }
371 
372  // pointScalarField
373  {
374  const auto* ptr = driver.isResultType<pointScalarField>();
375  if (ptr)
376  {
377  conditionField = ptr->internalField();
378  conditionDataType = FieldAssociation::POINT_DATA;
379  break;
380  }
381  }
382 
383  // No matching field types
384  goodCond = false;
385  }
386 
387  // Verify that it also logical
388  goodCond = goodCond && driver.isLogical();
389 
390  if (!goodCond)
391  {
393  << " condition: " << condition
394  << " does not evaluate to a logical expression: "
395  << driver.resultType() << nl
396  #ifdef FULLDEBUG
397  << "contents: " << conditionField
398  #endif
399  << exit(FatalError);
400  }
401 
402  if (ctrl.debugParsing)
403  {
404  Info<< "Condition evaluates to "
405  << conditionField << nl;
406  }
407 
408  evaluatedCondition = true;
409  }
410 
411  if (ctrl.debugParsing)
412  {
413  Info<< "Parsing expression:" << expression << endl;
414  }
415 
416  driver.parse(expression);
417 
418  if (ctrl.debugParsing)
419  {
420  Info<< "Parsed expression" << endl;
421  }
422 
423  if (evaluatedCondition)
424  {
425  if (conditionDataType != driver.fieldAssociation())
426  {
428  << "Mismatch between condition geometric type ("
429  << fieldGeoType(conditionDataType) << ") and" << nl
430  << "expression geometric type ("
431  << fieldGeoType(driver.fieldAssociation()) << ')' << nl
432  << nl
433  << "Expression: " << expression << nl
434  << "Condition: " << condition << nl
435  << nl
436  << exit(FatalError);
437  }
438  }
439 
440  if (!ctrl.createNew && driver.resultType() != oldFieldType)
441  {
443  << "Inconsistent types: " << fieldName << " is "
444  << oldFieldType
445  << " but the expression evaluates to "
446  << driver.resultType()
447  << exit(FatalError);
448  }
449 
450  Info<< "Dispatch ... " << driver.resultType() << nl;
451 
452  #undef setFieldDispatch
453  #define setFieldDispatch(FieldType) \
454  { \
455  /* FieldType */ \
456  const auto* ptr = driver.isResultType<FieldType>(); \
457  if (ptr) \
458  { \
459  /* driver.getResult<FieldType>(correctPatches), */ \
460  \
461  setField \
462  ( \
463  fieldName, \
464  mesh, \
465  *ptr, \
466  conditionField, \
467  dims, \
468  valuePatches, \
469  ctrl \
470  ); \
471  return; \
472  } \
473  } \
474 
475 
476  setFieldDispatch(volScalarField);
477  setFieldDispatch(volVectorField);
478  setFieldDispatch(volTensorField);
479  setFieldDispatch(volSymmTensorField);
480  setFieldDispatch(volSphericalTensorField);
481 
482  setFieldDispatch(surfaceScalarField);
483  setFieldDispatch(surfaceVectorField);
484  setFieldDispatch(surfaceTensorField);
485  setFieldDispatch(surfaceSymmTensorField);
486  setFieldDispatch(surfaceSphericalTensorField);
487 
488  #undef setFieldDispatch
489  #define setFieldDispatch(FieldType) \
490  { \
491  /* FieldType */ \
492  const auto* ptr = driver.isResultType<FieldType>(); \
493  \
494  if (ptr) \
495  { \
496  /* driver.getResult<FieldType>(correctPatches), */ \
497  \
498  setField \
499  ( \
500  fieldName, \
501  pointMesh::New(mesh), \
502  *ptr, \
503  conditionField, \
504  dims, \
505  valuePatches, \
506  ctrl \
507  ); \
508  return; \
509  } \
510  } \
511 
512  setFieldDispatch(pointScalarField);
513  setFieldDispatch(pointVectorField);
514  setFieldDispatch(pointTensorField);
515  setFieldDispatch(pointSymmTensorField);
516  setFieldDispatch(pointSphericalTensorField);
517 
518  #undef setFieldDispatch
519 
520  // Nothing dispatched?
521 
523  << "Expression evaluates to an unsupported type: "
524  << driver.resultType() << nl << nl
525  << "Expression " << expression << nl << endl
526  << exit(FatalError);
527 }
528 
529 
530 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
531 
532 int main(int argc, char *argv[])
533 {
535 
536  // No -constant, no special treatment for 0/
538 
540  (
541  "dict",
542  "file",
543  "Alternative dictionary for setExprFieldsDict"
544  );
545 
547  (
548  "dry-run",
549  "Evaluate but do not write"
550  );
551 
553  (
554  "verbose",
555  "Additional verbosity",
556  true // Advanced option
557  );
558 
560  (
561  "field",
562  "name",
563  "The field to overwrite command-line operation)",
564  true // Advanced option
565  );
567  (
568  "expression",
569  "expr",
570  "The expression to evaluate (command-line operation)",
571  true // Advanced option
572  );
574  (
575  "condition",
576  "logic",
577  "The logical condition when to apply the expression"
578  " (command-line operation)",
579  true // Advanced option
580  );
582  (
583  "dimension",
584  "dims",
585  "The dimensions to apply for created fields"
586  " (command-line operation)",
587  true // Advanced option
588  );
590  (
591  "debug-parser",
592  "Additional debugging information",
593  true // Advanced option
594  );
596  (
597  "no-variable-cache",
598  "Disable caching of expression variables",
599  true // Advanced option
600  );
602  (
603  "create",
604  "Create a new field (command-line operation)",
605  true // Advanced option
606  );
608  (
609  "keepPatches",
610  "Leave patches unaltered"
611  " (command-line operation)",
612  true // Advanced option
613  );
615  (
616  "value-patches",
617  "(patches)",
618  "A list of patches that receive a fixed value"
619  " (command-line operation)",
620  true // Advanced option
621  );
623  (
624  "dummy-phi",
625  "(command-line operation)",
626  true // Advanced option
627  );
628 
629  // Future?
630  #if 0
632  (
633  "noCorrectPatches",
634  ""
635  );
637  (
638  "correctResultBoundaryFields",
639  "",
640  true
641  );
642  #endif
643 
644  #include "addRegionOption.H"
645  #include "setRootCase.H"
646 
647  #include "createTime.H"
648 
649  const bool dryrun = args.found("dry-run");
650  const bool verbose = args.found("verbose");
651 
652  const word dictName("setExprFieldsDict");
653 
655 
656  if (times.size() < 1)
657  {
659  << "No times selected." << exit(FatalError);
660  }
661 
662  // Disable dimension checking during operation
663  dimensionSet::debug = false;
664 
665  #include "createNamedMesh.H"
666 
668 
669  autoPtr<IOdictionary> exprDictPtr;
670 
671  // Sort out conflicts
672 
673  const bool useCommandArgs = args.found("field");
674 
675  if (useCommandArgs)
676  {
677  if (args.found("dict"))
678  {
680  << "Cannot specify both dictionary and command-line arguments"
681  << nl
682  << endl;
683  }
684 
685  if (args.found("create") && args.found("keepPatches"))
686  {
688  << "Cannot specify both 'create' and 'keepPatches'" << nl
689  << endl;
690  }
691  }
692  else
693  {
694  // Carp about inapplicable options
695 
696  wordHashSet badOptions
697  ({
698  "create", "keepPatches", "valuePatches",
699  "dimension", "condition", "expression"
700  });
701 
702  badOptions.retain(args.options());
703 
704  if (!badOptions.empty())
705  {
707  << "Using a dictionary. Cannot specify command options:" << nl
708  << nl
709  << flatOutput(badOptions.sortedToc()) << nl
710  << endl;
711  }
712 
713  #include "setSystemMeshDictionaryIO.H"
714  exprDictPtr.reset(new IOdictionary(dictIO));
715  }
716 
717 
718  forAll(times, timei)
719  {
720  runTime.setTime(times[timei], timei);
721 
722  Info<< "\nTime = " << runTime.timeName() << endl;
723 
724  mesh.readUpdate();
725 
726  if (args.found("dummy-phi") && !dummyPhi)
727  {
728  Info<< "Adding a dummy phi" << endl;
729  dummyPhi.reset
730  (
732  (
733  IOobject
734  (
735  "phi",
736  mesh.thisDb().time().constant(),
737  mesh.thisDb(),
740  ),
741  mesh,
743  )
744  );
745  }
746 
747  if (args.found("withFunctionObjects"))
748  {
750  }
751 
752  if (args.found("field"))
753  {
754  const word fieldName(args.get<word>("field"));
755 
756  Info<< "Using command-line options for "
757  << fieldName << nl << endl;
758 
759  setExprFieldsControl ctrl;
760 
761  ctrl.dryRun = dryrun;
762  ctrl.debugParsing = args.found("debug-parser");
763  ctrl.cacheVariables = !args.found("no-variable-caching");
764 
765  ctrl.createNew = args.found("create");
766  ctrl.keepPatches = args.found("keepPatches");
767  ctrl.correctPatches = !args.found("noCorrectPatches");
768  ctrl.correctBCs = args.found("correctResultBoundaryFields");
769  ctrl.useDimension = args.found("dimension");
770 
772  expression
773  (
774  args[expression],
776  );
777 
778  expressions::exprString condition;
779  if (args.found("condition"))
780  {
781  args.readIfPresent("condition", condition);
782  }
783 
784  dimensionSet dims;
785 
786  if (ctrl.useDimension)
787  {
788  ITstream is(args.lookup("dimension"));
789  is >> dims;
790  }
791 
792  evaluate
793  (
794  mesh,
795  fieldName,
796  expression,
797  condition,
799  dims,
800  args.getList<word>("valuePatches", false),
801 
802  ctrl
803  );
804  }
805  else if (exprDictPtr)
806  {
807  const dictionary& exprDict = *exprDictPtr;
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 = 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  ctrl.correctPatches = !args.found("noCorrectPatches");
832  ctrl.correctBCs = args.found("correctResultBoundaryFields");
833 
834  if (ctrl.createNew && ctrl.keepPatches)
835  {
837  << "Cannot specify both 'create' and 'keepPatches'"
838  << nl << endl
839  << exit(FatalIOError);
840  }
841 
842  // Local override
844  (
845  "correctResultBoundaryFields",
846  ctrl.correctBCs
847  );
848 
849 
850  const word fieldName(dict.get<word>("field"));
851 
852  expressions::exprString expression
853  (
854  dict.get<string>("expression"),
855  dict
856  );
857 
858  expressions::exprString condition;
859 
860  if (dict.found("condition"))
861  {
862  condition =
864  (
865  dict.get<string>("condition"),
866  dict
867  );
868  }
869 
870  ctrl.useDimension = dict.found("dimension");
871 
872  dimensionSet dims;
873  if (ctrl.useDimension)
874  {
875  dict.lookup("dimension") >> dims;
876  }
877 
878  wordList valuePatches;
879  dict.readIfPresent("valuePatches", valuePatches);
880 
881  if (verbose && !timei)
882  {
883  // Report once
884  Info<< "Processing" << dict << nl;
885  }
886 
887  evaluate
888  (
889  mesh,
890  fieldName,
891  expression,
892  condition,
893  dict,
894  dims,
895  valuePatches,
896 
897  ctrl
898  );
899  }
900  }
901  else
902  {
904  << "No command-line or dictionary??" << nl << endl
905  << exit(FatalError);
906  }
907  }
908 
909  Info<< "\nEnd\n" << endl;
910 
911  return 0;
912 }
913 
914 
915 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::entry
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:67
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
volFields.H
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::autoPtr::reset
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
Definition: autoPtrI.H:109
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::output
static Ostream & output(Ostream &os, const IntRange< T > &range)
Definition: IntRanges.C:66
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:94
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::dictionary::found
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
Definition: dictionary.C:364
Foam::fvMesh::thisDb
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
Definition: fvMesh.H:287
Foam::expressions::patchExpr::POINT_DATA
Point data.
Definition: patchExprFwd.H:60
Foam::IOobject::typeHeaderOk
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (uses typeFilePath to find file) and check its info.
Definition: IOobjectTemplates.C:39
Foam::objectRegistry::time
const Time & time() const
Return time.
Definition: objectRegistry.H:186
Foam::expressions::volumeExpr::parseDriver
Driver for volume, surface, point field expressions.
Definition: volumeExprDriver.H:229
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
Foam::expressions::patchExpr::SURFACE_DATA
Surface data.
Definition: patchExprFwd.H:61
dictName
const word dictName("blockMeshDict")
Foam::argList::options
const HashTable< string > & options() const
Return options.
Definition: argListI.H:139
Foam::Time::functionObjects
const functionObjectList & functionObjects() const
Return the list of function objects.
Definition: Time.H:499
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
surfaceFields.H
Foam::surfaceFields.
Foam::dictionary::get
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:81
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:65
Foam::HashSet< word >
Foam::HashTable::retain
label retain(const HashTable< AnyType, Key, AnyHash > &other)
Retain table entries given by keys of the other hash-table.
Foam::argList::get
T get(const label index) const
Get a value from the argument at index.
Definition: argListI.H:251
Foam::argList::readIfPresent
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
Definition: argListI.H:296
setSystemMeshDictionaryIO.H
Foam::functionObjectList::start
bool start()
Called at the start of the time-loop.
Definition: functionObjectList.C:665
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::dictionary::null
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition: dictionary.H:385
Foam::fvMesh::readUpdate
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
Definition: fvMesh.C:643
Foam::expressions::patchExpr::FieldAssociation
FieldAssociation
The field association for patch expressions (mutually exclusive)
Definition: patchExprFwd.H:57
Foam::expressions::volumeExpr::VOLUME_DATA
Volume data.
Definition: volumeExprFwd.H:60
Foam::reduce
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Definition: PstreamReduceOps.H:51
Foam::argList::noFunctionObjects
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
Definition: argList.C:467
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:228
Foam::argList::lookup
ITstream lookup(const word &optName) const
Return an input stream from the named option.
Definition: argListI.H:157
Foam::Field< scalar >
Foam::ITstream
An input stream of tokens.
Definition: ITstream.H:55
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
argList.H
Foam::expressions::volumeExpr::FieldAssociation
FieldAssociation
The field association for volume expressions (mutually exclusive)
Definition: volumeExprFwd.H:55
addRegionOption.H
volumeExprDriver.H
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
Foam::IOstream::name
virtual const fileName & name() const
Return the name of the stream.
Definition: IOstream.C:39
setField
surfacesMesh setField(triSurfaceToAgglom)
field
rDeltaTY field()
Foam::PtrList< entry >
Foam::dictionary::lookup
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.C:424
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
createNamedMesh.H
Foam::expressions::boolOp
Convert [0-1] values (usually scalars) as false/true.
Definition: exprOps.H:56
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:43
dictIO
IOobject dictIO
Definition: setConstantMeshDictionaryIO.H:1
Foam::Ostream::write
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::flatOutput
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
Definition: FlatOutput.H:217
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::argList::addBoolOption
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
Definition: argList.C:338
Time.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
setRootCase.H
Foam::plusOp
Definition: ops.H:215
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::timeSelector::addOptions
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
Definition: timeSelector.C:108
Foam::List< word >
Foam::pTraits
Traits class for primitives.
Definition: pTraits.H:54
Foam::Time::setTime
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
Definition: Time.C:1003
Foam::expressions::exprString
Definition: exprString.H:60
dlLibraryTable.H
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
timeSelector.H
createTime.H
Foam::argList::getList
List< T > getList(const label index) const
Get a List of values from the argument at index.
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:401
Foam::timeSelector::select0
static instantList select0(Time &runTime, const argList &args)
Definition: timeSelector.C:241
Foam::TimePaths::constant
const word & constant() const
Return constant name.
Definition: TimePathsI.H:88
Foam::dictionary::getOrDefault
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:122
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::IOobject::NO_READ
Definition: IOobject.H:123
Foam::argList::addOption
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:349
args
Foam::argList args(argc, argv)
pointFields.H
pointMesh.H
Foam::dictionary::readIfPresent
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:417
Foam::stringOps::evaluate
string evaluate(const std::string &s, size_t pos=0, size_t len=std::string::npos)
Definition: stringOpsEvaluate.C:37
exprOps.H
Operations involving expressions.
Foam::argList::found
bool found(const word &optName) const
Return true if the named option is found.
Definition: argListI.H:151
Foam::IOobject::MUST_READ
Definition: IOobject.H:120