67 writeForceFields_ =
dict.lookupOrDefault(
"writeForceFields",
false);
69 const bool foundScale =
dict.found(
"scale");
70 const bool foundOgn =
dict.found(
"origin");
71 const bool foundDir =
dict.found(
"direction");
72 const bool foundOgns =
dict.found(
"origins");
73 const bool foundDirs =
dict.found(
"directions");
77 (foundOgn && foundDir && !foundOgns && !foundDirs)
78 || (!foundOgn && !foundDir && foundOgns && foundDirs)
81 foundScale || foundOgn || foundDir || foundOgns || foundDirs;
96 directions_.setSize(1);
97 dict.lookup(
"origin") >> origins_.last();
98 dict.lookup(
"direction") >> directions_.last();
102 dict.lookup(
"origins") >> origins_;
103 dict.lookup(
"directions") >> directions_;
108 || directions_.size() == 0
109 || origins_.size() != directions_.size()
113 <<
"The same, non-zero number of origins and "
119 directions_[i] /=
mag(directions_[i]);
123 if (!foundAll && foundAny)
126 <<
"The scaling specification is incomplete. \"scale\", "
127 <<
"\"origin\" and \"direction\" (or \"origins\" and "
128 <<
"\"directions\"), must all be specified in order to scale "
129 <<
"the forcing. The forcing will be applied uniformly across "
177 scale =
max(scale, scale_->value(
x));
195 if (lambdaBoundary_.value() > 0)
201 if (!bm[
patchi].coupled())
204 = lambdaBoundary_.value()
216 if (writeForceFields_)
218 Info<<
" Writing forcing fields: forcing:scale, forcing:forceCoeff"
222 forceCoeff()().
write();
232 const word& modelType,
238 writeForceFields_(false),
255 readCoeffs(coeffs(
dict));
#define forAll(list, i)
Loop across all elements in list.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Mesh &mesh, const dimensionSet &, const PrimitiveField< Type > &)
Return a temporary field constructed from name, mesh,.
static autoPtr< Function1< Type > > New(const word &name, const Function1s::unitConversions &units, const dictionary &dict)
Select from dictionary.
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
void clear()
Delete object (if the pointer is valid) and set pointer to.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
const dimensionSet & dimensions() const
Return const reference to dimensions.
const word & name() const
Return const reference to name.
Mesh data needed to do the Finite Volume discretisation.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Finite volume model abstract base class.
static const dictionary & coeffs(const word &modelType, const dictionary &)
Return the coefficients sub-dictionary for a given model type.
virtual bool read(const dictionary &dict)
Read source dictionary.
Base fvModel for forcing functions.
void writeForceFields() const
Optionally write the forcing fields:
dimensionedScalar lambda_
Forcing coefficient [1/s].
void readCoeffs(const dictionary &dict)
Non-virtual read.
dimensionedScalar lambdaBoundary_
Optional boundary forcing coefficient [1/s].
forcing(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
virtual bool read(const dictionary &dict)
Read dictionary.
virtual tmp< volScalarField::Internal > forceCoeff() const
Return the force coefficient.
void readLambda(const dictionary &dict)
Read the forcing coefficients.
dimensionedScalar regionLength() const
Calculate and return the volume average forcing region length.
virtual tmp< volScalarField::Internal > scale() const
Return the scale distribution.
const vectorField & cellCentres() const
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Calculate the gradient of the given field.
Volume integrate volField creating a volField.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar c
Speed of light in a vacuum.
defineTypeNameAndDebug(bound, 0)
dimensioned< Type > domainIntegrate(const VolField< Type > &vf)
tmp< VolField< typename outerProduct< vector, Type >::type > > grad(const SurfaceField< Type > &ssf)
static const coefficient C("C", dimTemperature, 234.5)
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimless
const dimensionSet dimLength
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
const dimensionSet dimTime
void evaluate(GeometricField< Type, GeoMesh > &result, const Function1< Type > &func, const GeometricField< Type, GeoMesh > &x)
const dimensionSet dimVolume
word typedName(Name name)
Return the name of the object within the given type.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
const dimensionSet dimArea
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.