67 writeForceFields_ = coeffs().lookupOrDefault(
"writeForceFields",
false);
69 const bool foundScale = coeffs().found(
"scale");
70 const bool foundOgn = coeffs().found(
"origin");
71 const bool foundDir = coeffs().found(
"direction");
72 const bool foundOgns = coeffs().found(
"origins");
73 const bool foundDirs = coeffs().found(
"directions");
77 (foundOgn && foundDir && !foundOgns && !foundDirs)
78 || (!foundOgn && !foundDir && foundOgns && foundDirs)
81 foundScale || foundOgn || foundDir || foundOgns || foundDirs;
96 directions_.setSize(1);
97 coeffs().lookup(
"origin") >> origins_.last();
98 coeffs().lookup(
"direction") >> directions_.last();
102 coeffs().lookup(
"origins") >> origins_;
103 coeffs().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),
static const Foam::dimensionedScalar C("C", Foam::dimTemperature, 234.5)
#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 > > New(const word &name, const Mesh &mesh, const dimensionSet &, const Field< 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 keyword definitions, which are a keyword followed by any number of values (e....
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.
Finite volume model abstract base class.
const dictionary & coeffs() const
Return dictionary.
virtual bool read(const dictionary &dict)
Read source dictionary.
Base fvModel for forcing functions.
void readCoeffs()
Non-virtual read.
void readLambda()
Read the forcing coefficients.
void writeForceFields() const
Optionally write the forcing fields:
dimensionedScalar lambda_
Forcing coefficient [1/s].
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.
dimensionedScalar regionLength() const
Calculate and return the volume average forcing region length.
virtual tmp< volScalarField::Internal > scale() const
Return the scale distribution.
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.
#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)
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.
word name(const bool)
Return a word representation of a bool.
const dimensionSet dimless
const dimensionSet dimLength
const dimensionSet dimTime
const dimensionSet dimVolume
dimensioned< scalar > mag(const dimensioned< Type > &)
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.
void evaluate(GeometricField< Type, PatchField, GeoMesh > &result, const Function1< Type > &func, const GeometricField< Type, PatchField, GeoMesh > &x)
const dimensionSet dimArea
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.