60 const Foam::word Foam::fv::codedFvModel::codeOptions
67 "codedFvModelTemplate.C"
72 "codedFvModelTemplate.H"
78 void Foam::fv::codedFvModel::readCoeffs(
const dictionary&
dict)
80 fieldName_ =
dict.lookup<word>(
"field");
84 Foam::word Foam::fv::codedFvModel::fieldPrimitiveTypeName()
const
86 #define fieldPrimitiveTypeNameTernary(Type, nullArg) \
87 mesh().foundObject<VolField<Type>>(fieldName_) \
88 ? pTraits<Type>::typeName \
93 #undef fieldPrimitiveTypeNameTernary
97 Foam::fvModel& Foam::fv::codedFvModel::redirectFvModel()
const
99 if (!redirectFvModelPtr_.valid())
101 const word primitiveTypeName = fieldPrimitiveTypeName();
103 const_cast<codedFvModel&
>(*this).varSubstitutions().set
106 {
"TemplateType", primitiveTypeName},
107 {
"SourceType", primitiveTypeName +
"Source"}
111 updateLibrary(coeffsDict_);
113 dictionary constructDict(coeffsDict_);
114 constructDict.set(
"type",
name());
123 return redirectFvModelPtr_();
128 void Foam::fv::codedFvModel::addSupType
130 const VolField<Type>& field,
139 <<
"codedFvModel::addSup for source " <<
name() <<
endl;
142 redirectFvModel().addSup(field, eqn);
148 void Foam::fv::codedFvModel::addSupType
151 const VolField<Type>& field,
160 <<
"codedFvModel::addSup for source " <<
name() <<
endl;
163 redirectFvModel().addSup(
rho, field, eqn);
169 void Foam::fv::codedFvModel::addSupType
173 const VolField<Type>& field,
182 <<
"codedFvModel::addSup for source " <<
name() <<
endl;
185 redirectFvModel().addSup(
alpha,
rho, field, eqn);
195 const word& modelType,
211 fieldName_(
word::null),
212 coeffsDict_(coeffs(
dict))
214 readCoeffs(coeffsDict_);
241 bool Foam::
fv::codedFvModel::movePoints()
243 return redirectFvModel().movePoints();
249 redirectFvModel().topoChange(map);
255 redirectFvModel().mapMesh(map);
261 redirectFvModel().distribute(map);
269 redirectFvModelPtr_.clear();
270 coeffsDict_ = coeffs(
dict);
271 readCoeffs(coeffsDict_);
273 updateLibrary(coeffsDict_);
Macros for easy insertion into run-time selection tables.
Base class for coded functionObjects, fvModels, Function1, Function2.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
HashTable< string > & varSubstitutions()
void read(const dictionary &contextDict, const dictionary &codeDict)
Mesh data needed to do the Finite Volume discretisation.
Finite volume model abstract base class.
static autoPtr< fvModel > New(const word &name, const fvMesh &mesh, const dictionary &dict)
Return a reference to the selected fvModel.
virtual bool read(const dictionary &dict)
Read source dictionary.
Constructs on-the-fly fvModel source from user-supplied code.
codedFvModel(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
static const word null
An empty word.
#define fieldPrimitiveTypeNameTernary(Type, nullArg)
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
A special matrix type and solver, designed for finite volume solutions of scalar equations.
#define IMPLEMENT_FV_MODEL_ADD_FIELD_SUP(Type, modelType)
#define IMPLEMENT_FV_MODEL_ADD_ALPHA_RHO_FIELD_SUP(Type, modelType)
#define IMPLEMENT_FV_MODEL_ADD_RHO_FIELD_SUP(Type, modelType)
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
addToRunTimeSelectionTable(fvConstraint, bound, dictionary)
defineTypeNameAndDebug(bound, 0)
List< word > wordList
A List of words.
Ostream & endl(Ostream &os)
Add newline and flush stream.
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
VolField< scalar > volScalarField
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
Ostream & indent(Ostream &os)
Indent stream.