mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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.
This commit is contained in:
@ -28,4 +28,8 @@ runApplication reconstructParMesh -constant
|
||||
|
||||
runApplication reconstructPar
|
||||
|
||||
runApplication setExprFields -latestTime ## -load-fields U
|
||||
|
||||
runApplication setExprBoundaryFields -latestTime ## -load-fields '(U)'
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
/*--------------------------------*- 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 setExprBoundaryFieldsDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Preload any required fields (optional)
|
||||
readFields ( U );
|
||||
|
||||
updateBCs
|
||||
{
|
||||
field windPowerDensity;
|
||||
|
||||
_value1
|
||||
{
|
||||
target value;
|
||||
variables ( "rho=1.2" );
|
||||
expression #{ 0.5*rho*cbrt(mag(U)) #};
|
||||
}
|
||||
|
||||
expressions
|
||||
(
|
||||
{ $_value1; patch inlet; }
|
||||
{ $_value1; patch outlet; }
|
||||
{ $_value1; patch sides; }
|
||||
{ $_value1; patch top; }
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,37 @@
|
||||
/*--------------------------------*- 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 );
|
||||
|
||||
_value1
|
||||
{
|
||||
variables ( "rho=1.2" );
|
||||
expression #{ 0.5*rho*cbrt(mag(U)) #};
|
||||
}
|
||||
|
||||
expressions
|
||||
(
|
||||
windPowerDensity
|
||||
{
|
||||
field windPowerDensity;
|
||||
create yes;
|
||||
$_value1;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user