68 auto&
kCoeff = tkCoeff.ref();
72 const scalar a =
aZone_[i];
81 for (label celli : cz)
106 auto& epsilonCoeff = tepsilonCoeff.ref();
110 const scalar a = aZone_[i];
111 const scalar
N = NZone_[i];
112 const scalar Cep = CepZone_[i];
113 const scalar Cd = CdZone_[i];
115 for (label zonei : zoneIDs_[i])
117 const cellZone& cz = mesh_.cellZones()[zonei];
119 for (label celli : cz)
121 epsilonCoeff[celli] = Cep*Cd*a*
N*
mag(
U[celli]);
126 epsilonCoeff.correctBoundaryConditions();
128 return tepsilonCoeff;
134Foam::fv::multiphaseMangrovesTurbulenceModel::multiphaseMangrovesTurbulenceModel
137 const word& modelType,
150 epsilonName_(
"epsilon")
166 if (eqn.
psi().
name() == epsilonName_)
174 else if (eqn.
psi().
name() == kName_)
194 if (eqn.
psi().
name() == epsilonName_)
202 else if (eqn.
psi().
name() == kName_)
204 fvMatrix<scalar> kEqn
217 if (!coeffs_.readIfPresent(
"epsilonNames", fieldNames_))
219 if (coeffs_.found(
"epsilon"))
221 fieldNames_.resize(1);
222 coeffs_.readEntry(
"epsilon", fieldNames_.first());
226 fieldNames_.resize(2);
227 fieldNames_[0] =
"epsilon";
228 fieldNames_[1] =
"k";
234 const dictionary& regionsDict(coeffs_.subDict(
"regions"));
248 const word zoneName(modelDict.get<word>(
"cellZone"));
250 zoneIDs_[i] = mesh_.cellZones().indices(zoneName);
251 if (zoneIDs_[i].empty())
254 <<
"Unable to find cellZone " << zoneName <<
nl
255 <<
"Valid cellZones are:" << mesh_.cellZones().names()
259 modelDict.readEntry(
"a", aZone_[i]);
260 modelDict.readEntry(
"N", NZone_[i]);
261 modelDict.readEntry(
"Ckp", CkpZone_[i]);
262 modelDict.readEntry(
"Cep", CepZone_[i]);
263 modelDict.readEntry(
"Cd", CdZone_[i]);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
@ NO_REGISTER
Do not request registration (bool: false).
const word & name() const noexcept
Return the object name.
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect,...
wordList toc() const
Return the table of contents.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
const GeometricField< Type, fvPatchField, volMesh > & psi(const label i=0) const
Return psi.
Mesh data needed to do the Finite Volume discretisation.
labelListList zoneIDs_
Zone indices.
word UName_
Name of U; default = U.
tmp< volScalarField > kCoeff(const volVectorField &U) const
Return the k coefficient.
word epsilonName_
Name of epsilon; default = epsilon.
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Add implicit contribution to momentum equation.
virtual bool read(const dictionary &dict)
Read dictionary.
scalarList aZone_
Width of the vegetation element.
scalarList NZone_
Number of plants per unit of area.
tmp< volScalarField > epsilonCoeff(const volVectorField &U) const
Return the epsilon coefficient.
word kName_
Name of k; default = k.
scalarList CdZone_
Drag coefficient.
Base abstract class for handling finite volume options (i.e. fvOption).
const word & name() const noexcept
Return const access to the source name.
const fvMesh & mesh_
Reference to the mesh database.
wordList fieldNames_
Field names to apply source to - populated by derived models.
option(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
virtual bool read(const dictionary &dict)
Read 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.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Calculate the finiteVolume matrix for implicit and explicit sources.
Namespace for finite-volume.
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
List< word > wordList
List of word.
GeometricField< vector, fvPatchField, volMesh > volVectorField
const dimensionSet dimless
Dimensionless.
bool read(const char *buf, int32_t &val)
Same as readInt32.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.
const Vector< label > N(dict.get< Vector< label > >("N"))