80 const word& sourceName,
81 const word& modelType,
86 fv::cellSetOption(sourceName, modelType,
dict,
mesh),
90 flowDir_(Ubar_/
mag(Ubar_)),
91 relaxation_(coeffs_.getOrDefault<scalar>(
"relaxation", 1)),
110 if (propsFile.good())
112 Info<<
" Reading pressure gradient from file" <<
endl;
128 scalar magUbarAve = 0.0;
133 label celli = cells_[i];
134 scalar volCell = cv[celli];
135 magUbarAve += (flowDir_ &
U[celli])*volCell;
155 label celli = cells_[i];
156 scalar volCell = cv[celli];
157 rAUave +=
rAU[celli]*volCell;
166 scalar magUbarAve = this->magUbarAve(
U);
170 dGradP_ = relaxation_*(
mag(Ubar_) - magUbarAve)/rAUave;
175 label celli = cells_[i];
176 U[celli] += flowDir_*
rAU[celli]*dGradP_;
179 U.correctBoundaryConditions();
181 scalar
gradP = gradP0_ + dGradP_;
183 Info<<
"Pressure gradient source: uncorrected Ubar = " << magUbarAve
198 name_ + fieldNames_[fieldi] +
"Sup",
203 auto&
Su = tSu.ref();
205 scalar
gradP = gradP0_ + dGradP_;
220 this->addSup(eqn, fieldi);
243 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))
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
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.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const Field< Type > &iField)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, copy of internal field...
A special matrix type and solver, designed for finite volume solutions of scalar equations.
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.
Do not request registration (bool: false)
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
virtual void constrain(fvMatrix< vector > &eqn, const label fieldi)
Set 1/A coefficient.
static constexpr const zero Zero
Global zero (0)