CodedFunction1: New Function1 which uses codeStream to dynamically compile the value function code
For example in the new tutorial case:
tutorials/incompressible/pimpleFoam/laminar/pitzDailyPulse
a cosine bell velocity pulse is specified at the inlet by directly defining the
code for it:
inlet
{
type uniformFixedValue;
uniformValue coded;
name pulse;
codeInclude
#{
#include "mathematicalConstants.H"
#};
code
#{
return vector
(
0.5*(1 - cos(constant::mathematical::twoPi*min(x/0.3, 1))),
0,
0
);
#};
}
which is then compiled automatically and linked into the running pimpleFoam
dynamically and executed to set the inlet velocity.
This commit is contained in:
@ -193,13 +193,9 @@ bool Foam::codedFunctionObject::read(const dictionary& dict)
|
||||
// The name keyword is "name". "redirectType" is also maintained here
|
||||
// for backwards compatibility, but "name" is taken in preference and
|
||||
// is printed in the error message if neither keyword is present.
|
||||
name_ = word::null;
|
||||
name_ = dict.lookupOrDefault("redirectType", name_);
|
||||
name_ = dict.lookupOrDefault("name", name_);
|
||||
if (name_ == word::null)
|
||||
{
|
||||
dict.lookup("name"); // <-- generate error message with "name" in it
|
||||
}
|
||||
name_ = dict.found("redirectType")
|
||||
? dict.lookup<word>("redirectType")
|
||||
: dict.lookup<word>("name");
|
||||
|
||||
updateLibrary(name_);
|
||||
return redirectFunctionObject().read(dict);
|
||||
|
||||
Reference in New Issue
Block a user