58 if (mesh_.time().outputTime())
65 mesh_.time().timeName(),
72 propsDict.
add(
"gradient", gradP);
73 propsDict.regIOobject::write();
80 Foam::fv::meanVelocityForce::meanVelocityForce
82 const word& sourceName,
83 const word& modelType,
89 Ubar_(coeffs_.lookup(
"Ubar")),
92 flowDir_(Ubar_/
mag(Ubar_)),
93 relaxation_(coeffs_.lookupOrDefault<scalar>(
"relaxation", 1.0)),
96 coeffs_.lookup(
"fieldNames") >> fieldNames_;
98 if (fieldNames_.size() != 1)
102 "Foam::fv::meanVelocityForce::" 107 "const dictionary&, " 110 ) <<
"Source can only be applied to a single field. Current " 114 applied_.setSize(fieldNames_.size(),
false);
119 mesh_.time().timePath()/
"uniform"/(name_ +
"Properties")
122 if (propsFile.
good())
124 Info<<
" Reading pressure gradient from file" <<
endl;
126 propsDict.
lookup(
"gradient") >> gradP0_;
129 Info<<
" Initial pressure gradient = " << gradP0_ <<
nl <<
endl;
140 scalar magUbarAve = 0.0;
145 label cellI = cells_[i];
146 scalar volCell = cv[cellI];
147 magUbarAve += (flowDir_ & U[cellI])*volCell;
167 label cellI = cells_[i];
168 scalar volCell = cv[cellI];
169 rAUave += rAU[cellI]*volCell;
178 scalar magUbarAve = this->magUbarAve(U);
182 dGradP_ = relaxation_*(
mag(Ubar_) - magUbarAve)/rAUave;
187 label cellI = cells_[i];
188 U[cellI] += flowDir_*rAU[cellI]*dGradP_;
191 scalar gradP = gradP0_ + dGradP_;
193 Info<<
"Pressure gradient source: uncorrected Ubar = " << magUbarAve
194 <<
", pressure gradient = " << gradP <<
endl;
210 name_ + fieldNames_[fieldI] +
"Sup",
211 mesh_.time().timeName(),
220 scalar gradP = gradP0_ + dGradP_;
235 this->addSup(eqn, fieldI);
254 mesh_.time().timeName(),
265 rAPtr_() = 1.0/eqn.
A();
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
defineTypeNameAndDebug(cellSetOption, 0)
Cell-set options abtract base class. Provides a base set of controls, e.g.
Mesh data needed to do the Finite Volume discretisation.
const dimensionSet & dimensions() const
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensioned< scalar > mag(const dimensioned< Type > &)
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
virtual void addSup(fvMatrix< vector > &eqn, const label fieldI)
Add explicit contribution to momentum equation.
A list of keyword definitions, which are a keyword followed by any number of values (e...
virtual scalar magUbarAve(const volVectorField &U) const
Calculate and return the magnitude of the mean velocity.
static const dictionary null
Null dictionary.
tmp< GeometricField< Type, fvPatchField, volMesh > > Su(const GeometricField< Type, fvPatchField, volMesh > &su, const GeometricField< Type, fvPatchField, volMesh > &vf)
virtual void constrain(fvMatrix< vector > &eqn, const label fieldI)
Set 1/A coefficient.
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A List with indirect addressing.
addToRunTimeSelectionTable(option, fixedTemperatureConstraint, dictionary)
IOdictionary propsDict(IOobject( "particleTrackProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED ))
bool good() const
Return true if next operation might succeed.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Macros for easy insertion into run-time selection tables.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
virtual void correct(volVectorField &U)
Correct the pressure gradient.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
tmp< volScalarField > A() const
Return the central coefficient.
volScalarField rAU(1.0/UEqn.A())
void writeProps(const scalar gradP) const
Write the pressure gradient to file (for restarts etc)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const dimensionSet dimVolume(pow3(dimLength))
A special matrix type and solver, designed for finite volume solutions of scalar equations.