58 if (mesh_.time().writeTime())
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(
"fields") >> fieldNames_;
98 if (fieldNames_.size() != 1)
104 applied_.setSize(fieldNames_.size(),
false);
109 mesh_.time().timePath()/
"uniform"/(name_ +
"Properties")
112 if (propsFile.
good())
114 Info<<
" Reading pressure gradient from file" <<
endl;
116 propsDict.
lookup(
"gradient") >> gradP0_;
119 Info<<
" Initial pressure gradient = " << gradP0_ <<
nl <<
endl;
130 scalar magUbarAve = 0.0;
135 label celli = cells_[i];
136 scalar volCell = cv[celli];
137 magUbarAve += (flowDir_ & U[celli])*volCell;
157 label celli = cells_[i];
158 scalar volCell = cv[celli];
159 rAUave += rAU[celli]*volCell;
168 scalar magUbarAve = this->magUbarAve(U);
172 dGradP_ = relaxation_*(
mag(Ubar_) - magUbarAve)/rAUave;
177 label celli = cells_[i];
178 U[celli] += flowDir_*rAU[celli]*dGradP_;
181 scalar gradP = gradP0_ + dGradP_;
183 Info<<
"Pressure gradient source: uncorrected Ubar = " << magUbarAve
184 <<
", pressure gradient = " << gradP <<
endl;
200 name_ + fieldNames_[fieldi] +
"Sup",
201 mesh_.time().timeName(),
210 scalar gradP = gradP0_ + dGradP_;
225 this->addSup(eqn, fieldi);
244 mesh_.time().timeName(),
255 rAPtr_() = 1.0/eqn.
A();
defineTypeNameAndDebug(option, 0)
virtual scalar magUbarAve(const volVectorField &U) const
Calculate and return the magnitude of the mean velocity.
virtual void correct(volVectorField &U)
Correct the pressure gradient.
#define forAll(list, i)
Loop across all elements in list.
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 list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static const dictionary null
Null dictionary.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
addToRunTimeSelectionTable(option, fixedTemperatureConstraint, dictionary)
tmp< volScalarField > rAU
bool good() const
Return true if next operation might succeed.
IOdictionary propsDict(IOobject("particleTrackProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED))
Macros for easy insertion into run-time selection tables.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
void writeProps(const scalar gradP) const
Write the pressure gradient to file (for restarts etc)
const dimensionSet dimVolume(pow3(dimLength))
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Add explicit contribution to momentum equation.
A class for handling words, derived from string.
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.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
tmp< volScalarField > A() const
Return the central coefficient.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A special matrix type and solver, designed for finite volume solutions of scalar equations.
dimensioned< scalar > mag(const dimensioned< Type > &)
Cell-set options abtract base class. Provides a base set of controls, e.g.:
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
virtual void constrain(fvMatrix< vector > &eqn, const label fieldi)
Set 1/A coefficient.
const dimensionSet & dimensions() const