ENH: add coded Function1 (#2282)

- update coded templates with qualified names

GIT: add in missing PatchFunction1 constant() method

- was missed in a previous commit
This commit is contained in:
Mark Olesen
2021-12-03 15:33:07 +01:00
parent 8624d65c5a
commit 9a5125111e
31 changed files with 883 additions and 112 deletions

View File

@ -40,6 +40,16 @@ boundaryField
// For general testing purposes:
type exprFixedValue;
functions<scalar>
{
trigger
{
type functionObjectTrigger;
triggers (2 4);
defaultValue true;
}
}
variables
(
"Tcrit = 500"

View File

@ -23,8 +23,26 @@ boundaryField
inlet
{
type flowRateInletVelocity;
massFlowRate constant 5;
rhoInlet 1000; // Guess for rho
// massFlowRate constant 5;
massFlowRate
{
type coded;
name liquidIn;
code
#{
// Receives 'x' as the argument
static bool reported(false);
if (!reported)
{
Info<< "Using coded value for massFlowRate" << nl;
reported = true;
}
return 5;
#};
}
}
outlet

View File

@ -5,6 +5,12 @@ cd "${0%/*}" || exit # Run from this directory
./Allrun.pre
if ! canCompile
then
echo "-- No dynamicCode: replace coded Function1 with constant value"
foamDictionary -entry boundaryField/inlet/massFlowRate -set 'constant 5' 0/U
fi
runApplication decomposePar
#- Run without processorAgglomerator

View File

@ -5,6 +5,12 @@ cd "${0%/*}" || exit # Run from this directory
./Allrun.pre
if ! canCompile
then
echo "-- No dynamicCode: replace coded Function1 with constant value"
foamDictionary -entry boundaryField/inlet/massFlowRate -set 'constant 5' 0/U
fi
runApplication $(getApplication)
#------------------------------------------------------------------------------

View File

@ -70,7 +70,7 @@ boundaryField
{
baseVel = Function1<scalar>::New
(
"timeFunction", dict, &db()
"timeFunction", dict, this->whichDb()
);
}
@ -81,7 +81,7 @@ boundaryField
// ie, NewIfPresent
baseDir = Function1<vector>::New
(
"directionFunction", dict, &db()
"directionFunction", dict, this->whichDb()
);
InfoErr