79 const word& sourceName,
80 const word& modelType,
85 fv::cellSetOption(sourceName, modelType,
dict,
mesh),
89 flowDir_(Ubar_/
mag(Ubar_)),
90 relaxation_(coeffs_.getOrDefault<scalar>(
"relaxation", 1)),
109 if (propsFile.good())
111 Info<<
" Reading pressure gradient from file" <<
endl;
127 scalar magUbarAve = 0.0;
132 label celli = cells_[i];
133 scalar volCell = cv[celli];
134 magUbarAve += (flowDir_ &
U[celli])*volCell;
154 label celli = cells_[i];
155 scalar volCell = cv[celli];
156 rAUave +=
rAU[celli]*volCell;
165 scalar magUbarAve = this->magUbarAve(
U);
169 dGradP_ = relaxation_*(
mag(Ubar_) - magUbarAve)/rAUave;
174 label celli = cells_[i];
175 U[celli] += flowDir_*
rAU[celli]*dGradP_;
178 U.correctBoundaryConditions();
180 scalar
gradP = gradP0_ + dGradP_;
182 Info<<
"Pressure gradient source: uncorrected Ubar = " << magUbarAve
199 name_ + fieldNames_[fieldi] +
"Sup",
200 mesh_.time().timeName(),
209 scalar
gradP = gradP0_ + dGradP_;
224 this->addSup(eqn, fieldi);
243 mesh_.time().timeName(),
254 rAPtr_() = 1.0/eqn.
A();
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
virtual scalar magUbarAve(const volVectorField &U) const
Calculate and return the magnitude of the mean velocity averaged over the selected cellSet...
void size(const label n)
Older name for setAddressableSize.
virtual void correct(volVectorField &U)
Correct the pressure gradient.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
wordList fieldNames_
Field names to apply source to - populated by derived models.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
defineTypeNameAndDebug(atmAmbientTurbSource, 0)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
fileName timePath() const
Return current time path = path/timeName.
const fvMesh & mesh_
Reference to the mesh database.
constexpr char nl
The newline '\n' character (0x0a)
virtual bool read(const dictionary &dict)
Read source dictionary.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ignore writing from objectRegistry::writeObject()
bool writeTime() const noexcept
True if this is a write interval.
const Time & time() const
Return the top-level database.
tmp< volScalarField > rAU
Macros for easy insertion into run-time selection tables.
IOdictionary propsDict(dictIO)
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
volVectorField gradP(fvc::grad(p))
void writeProps(const scalar gradP) const
Write the pressure gradient to file (for restarts etc)
meanVelocityForce(const word &sourceName, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect...
const dimensionSet dimVolume(pow3(dimLength))
const word name_
Source name.
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Add explicit contribution to momentum equation.
A class for handling words, derived from Foam::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.
addToRunTimeSelectionTable(option, atmAmbientTurbSource, dictionary)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
tmp< volScalarField > A() const
Return the central coefficient.
const dimensionSet & dimensions() const noexcept
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing. Like IndirectList but does not store addressing. ...
void resetApplied()
Resize/reset applied flag list for all fieldNames_ entries.
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.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
messageStream Info
Information stream (stdout output on master, null elsewhere)
scalar gradP0_
Pressure gradient before correction.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Defines the attributes of an object for which implicit objectRegistry management is supported...
dictionary coeffs_
Dictionary containing source coefficients.
virtual void constrain(fvMatrix< vector > &eqn, const label fieldi)
Set 1/A coefficient.
static constexpr const zero Zero
Global zero (0)