Files
openfoam/etc/caseDicts/annotated/setExprFieldsDict
Mark Olesen cd1350a87f ENH: support preloading fields for setExpr* utilities (#2014)
- can use either command-line option "-load-fields" or dictionary
  entry "readFields" to specify field names to be preloaded.

  Essentially the same functionality as with a readFields function
  object but with a lot less typing.

- tutorial examples provided by Ryan Danks <ryan.danks@rwdi.com>
  illustrate using setExpr* utilities to calculate a quantity
  as a post-processing step.
2021-03-17 21:42:37 +01:00

56 lines
1.5 KiB
C++

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object setExprFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Preload any required fields (optional)
readFields ( U );
expressions
(
T
{
field T;
dimensions [0 0 0 1 0 0 0];
constants
{
centre (0.21 0 0.01);
}
variables
(
"radius = 0.1"
);
condition
#{
// Within the radius
(mag(pos() - $[(vector)constants.centre]) < radius)
// but only +ve y!
&& pos((pos() - $[(vector)constants.centre]).y()) > 0
#};
expression
#{
300
+ 200 * (1 - mag(pos() - $[(vector)constants.centre]) / radius)
#};
}
);
// ************************************************************************* //