45 void Foam::fv::massSource::readCoeffs()
47 phaseName_ = coeffs().lookupOrDefault<word>(
"phase",
word::null);
50 coeffs().lookupOrDefault<word>
58 mesh().foundObject<basicThermo>
64 const basicThermo& thermo =
65 mesh().lookupObject<basicThermo>
69 heName_ = thermo.he().name();
70 TName_ = thermo.T().name();
74 const dictionary& fieldCoeffs = coeffs().subDict(
"fieldValues");
77 fieldValues_.set(iter().keyword(),
nullptr);
80 #define callReadFieldValues(Type, nullArg) readFieldValues<Type>(); 82 #undef callReadFieldValues 89 void Foam::fv::massSource::readFieldValues()
91 const dictionary& fieldCoeffs = coeffs().subDict(
"fieldValues");
95 const word& fieldName = iter().keyword();
97 if (
mesh().foundObject<VolField<Type>>(fieldName))
102 objectFunction1::New<VolField>
116 void Foam::fv::massSource::addGeneralSupType
119 const word& fieldName
122 const scalar t =
mesh().time().value();
123 const scalar massFlowRate = massFlowRate_->value(t);
124 const Type value = fieldValues_[fieldName]->value<Type>(t);
130 eqn.source()[cells[i]] -=
131 mesh().V()[cells[i]]/set_.V()*massFlowRate*value;
137 void Foam::fv::massSource::addSupType
140 const word& fieldName
143 addGeneralSupType(eqn, fieldName);
147 void Foam::fv::massSource::addSupType
149 fvMatrix<scalar>& eqn,
150 const word& fieldName
155 if (fieldName == rhoName_)
157 const scalar t =
mesh().time().value();
158 const scalar massFlowRate = massFlowRate_->value(t);
162 eqn.source()[cells[i]] -=
163 mesh().V()[cells[i]]/set_.V()*massFlowRate;
166 else if (fieldName == heName_ && fieldValues_.found(TName_))
168 if (fieldValues_.found(heName_))
171 <<
"Source " <<
name() <<
" defined for both field " << heName_
172 <<
" and " << TName_ <<
". Only one of these should be present." 176 const scalar t =
mesh().time().value();
177 const scalar massFlowRate = massFlowRate_->value(t);
178 const scalar T = fieldValues_[TName_]->value<scalar>(t);
179 const basicThermo& thermo =
180 mesh().lookupObject<basicThermo>
191 eqn.source()[cells[i]] -=
192 mesh().V()[cells[i]]/set_.V()*massFlowRate*hs[i];
197 addGeneralSupType(eqn, fieldName);
203 void Foam::fv::massSource::addSupType
207 const word& fieldName
210 addSupType(eqn, fieldName);
215 void Foam::fv::massSource::addSupType
220 const word& fieldName
223 addSupType(eqn, fieldName);
232 const word& modelType,
237 fvModel(name, modelType, dict, mesh),
238 set_(coeffs(), mesh),
259 && !(fieldName == rhoName_)
260 && !(fieldName == heName_ && fieldValues_.found(TName_))
261 && !fieldValues_.found(fieldName)
265 <<
"No value supplied for field " << fieldName <<
" in " 279 if (fieldValues_.found(TName_))
281 fieldNames[
findIndex(fieldNames, TName_)] = heName_;
299 set_.updateMesh(mpm);
#define IMPLEMENT_FV_MODEL_ADD_ALPHA_RHO_SUP(Type, modelType)
defineTypeNameAndDebug(fixedTemperatureConstraint, 0)
#define forAll(list, i)
Loop across all elements in list.
A list of keyword definitions, which are a keyword followed by any number of values (e...
virtual bool read(const dictionary &dict)
Read source dictionary.
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Ostream & endl(Ostream &os)
Add newline and flush stream.
Finite volume model abstract base class.
word group() const
Return group (extension part of name)
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
static List< word > fieldNames
GeometricField< scalar, fvPatchField, volMesh > volScalarField
A class for handling words, derived from string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static word groupName(Name name, const word &group)
massSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
static const word null
An empty word.
List< label > labelList
A List of labels.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
#define IMPLEMENT_FV_MODEL_ADD_SUP(Type, modelType)
static const word dictName
Name of the thermophysical properties dictionary.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
#define callReadFieldValues(Type, nullArg)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
word name(const complex &)
Return a string representation of a complex.
addToRunTimeSelectionTable(fvConstraint, fixedTemperatureConstraint, dictionary)
FOR_ALL_FIELD_TYPES(IMPLEMENT_FV_MODEL_ADD_SUP, fv::massSource)
virtual bool addsSupToField(const word &fieldName) const
Return true if the fvModel adds a source term to the given.
#define WarningInFunction
Report a warning using Foam::Warning.
#define IMPLEMENT_FV_MODEL_ADD_RHO_SUP(Type, modelType)
Mesh data needed to do the Finite Volume discretisation.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
virtual void updateMesh(const mapPolyMesh &)
Update for mesh changes.
virtual bool read(const dictionary &dict)
Read source dictionary.
This fvModel applies a mass source to the continuity equation and to all field equations.
static autoPtr< Function1< scalar > > New(const word &name, const dictionary &dict)
Selector.