41 return mesh_.time().libs();
48 return "fvOption::" +
name_;
89 if (codeAddSup_.empty())
97 if (codeAddSupRho_.empty())
115 <<
"compile " << name_ <<
" sha1: " << context.
sha1() <<
endl;
122 "-I$(LIB_SRC)/finiteVolume/lnInclude \\\n"
123 "-I$(LIB_SRC)/fvOptions/lnInclude \\\n"
124 "-I$(LIB_SRC)/meshTools/lnInclude \\\n"
125 "-I$(LIB_SRC)/sampling/lnInclude \\\n"
127 +
"\n\nLIB_LIBS = \\\n"
128 " -lfiniteVolume \\\n"
143 const word& modelType,
166 coeffs_.readEntry(
"fields", fieldNames_);
170 dict.readCompat<
word>(
"name", {{
"redirectType", 1706}}, name_);
177 ctx.readEntry(
"codeCorrect", codeCorrect_);
182 const bool mandatory =
184 !ctx.findEntry(
"codeAddSup")
185 && !ctx.findEntry(
"codeAddSupRho")
188 ctx.readEntry(
"codeAddSup", codeAddSup_, mandatory);
189 ctx.readEntry(
"codeAddSupRho", codeAddSupRho_, mandatory);
194 coeffs_.lookupEntryCompat
197 {{
"codeSetValue", 1812 }},
210 if (!redirectOptionPtr_)
213 constructDict.
set(
"type", name_);
214 constructDict.
changeKeyword(modelType_ &
"Coeffs", name_ &
"Coeffs");
223 return *redirectOptionPtr_;
235 <<
">::correct for source " << name_ <<
endl;
251 <<
">::addSup for source " << name_ <<
endl;
268 <<
">::addSup(rho) for source " << name_ <<
endl;
284 <<
">::constrain for source " << name_ <<
endl;
286 updateLibrary(name_);
287 redirectOption().constrain(eqn, fieldi);
Generic GeometricField class.
void updateLibrary(const word &name, const dynamicCodeContext &context) const
Update library as required, using the given context.
void setCodeContext(const dictionary &dict)
Set code context from a dictionary.
dynamicCodeContext & codeContext()
Access to the dynamic code context.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool changeKeyword(const keyType &oldKeyword, const keyType &newKeyword, bool overwrite=false)
Change the keyword for an entry,.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
A table of dynamically loaded libraries.
Encapsulation of dynamic code dictionaries.
const string & libs() const noexcept
The code libs (LIB_LIBS).
const SHA1 & sha1() const noexcept
The SHA1 calculated from options, libs, include, code, etc.
const string & options() const noexcept
The code options (Make/options).
Tools for handling dynamic code compilation.
void addCopyFile(const fileName &name)
Add a file template name, which will be found and filtered.
void setFilterVariable(const word &key, const std::string &value)
Define a filter variable.
void addCompileFile(const fileName &name)
Add a file template name, which will be found and filtered.
void setMakeOptions(const std::string &content)
Define contents for Make/options.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Mesh data needed to do the Finite Volume discretisation.
CodedSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
autoPtr< fv::option > redirectOptionPtr_
Underlying code.
virtual void prepare(dynamicCode &, const dynamicCodeContext &) const
Adapt the context for the current object.
virtual void addSup(fvMatrix< Type > &eqn, const label fieldi)
Explicit/implicit matrix contributions.
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual void constrain(fvMatrix< Type > &eqn, const label fieldi)
Set value.
static constexpr const char *const codeTemplateC
Name of the C code template to be used.
virtual const dictionary & codeDict() const
Get the dictionary to initialize the code context.
fv::option & redirectOption() const
Dynamically compiled fvOption.
virtual void clearRedirect() const
Clear redirected object(s).
static constexpr const char *const codeTemplateH
Name of the H code template to be used.
virtual void correct(GeometricField< Type, fvPatchField, volMesh > &)
Correct field.
virtual dlLibraryTable & libs() const
Mutable access to the loaded dynamic libraries.
virtual string description() const
Description (type + name) for the output.
Intermediate abstract class for handling cell-set options for the derived fvOptions.
virtual bool read(const dictionary &dict)
Read source dictionary.
cellSetOption(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Base abstract class for handling finite volume options (i.e. fvOption).
const word modelType_
Model type.
const word & name() const noexcept
Return const access to the source name.
const fvMesh & mesh_
Reference to the mesh database.
static autoPtr< option > New(const word &name, const dictionary &dict, const fvMesh &mesh)
Return a reference to the selected fvOption model.
wordList fieldNames_
Field names to apply source to - populated by derived models.
dictionary dict_
Top level source dictionary.
dictionary coeffs_
Dictionary containing source coefficients.
void resetApplied()
Resize/reset applied flag list for all fieldNames_ entries.
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
A traits class, which is primarily used for primitives and vector-space.
A class for handling character strings derived from std::string.
A class for handling words, derived from Foam::string.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
#define DebugInfo
Report an information message using Foam::Info.
Namespace for finite-volume.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.