79 const word& sourceName,
80 const word& modelType,
86 Ubar_(coeffs_.get<
vector>(
"Ubar")),
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
183 <<
", pressure gradient = " <<
gradP <<
endl;
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();
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Input from file stream, using an ISstream.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
bool good() const noexcept
True if next operation might succeed.
virtual void correct()
Solve the turbulence equations and correct the turbulence viscosity.
virtual bool read()
Re-read model coefficients if they have changed.
bool writeTime() const noexcept
True if this is a write time.
static word timeName(const scalar t, const int precision=precision_)
fileName timePath() const
Return current time path.
A List with indirect addressing. Like IndirectList but does not store addressing.
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
A special matrix type and solver, designed for finite volume solutions of scalar equations....
tmp< volScalarField > A() const
Return the central coefficient.
const dimensionSet & dimensions() const noexcept
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
Intermediate abstract class for handling cell-set options for the derived fvOptions.
Applies the force within a specified region to maintain the specified mean velocity for incompressibl...
virtual void constrain(fvMatrix< vector > &eqn, const label fieldi)
Set 1/A coefficient.
scalar gradP0_
Pressure gradient before correction.
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Add explicit contribution to momentum equation.
void writeProps(const scalar gradP) const
Write the pressure gradient to file (for restarts etc)
virtual scalar magUbarAve(const volVectorField &U) const
Base abstract class for handling finite volume options (i.e. fvOption).
const fvMesh & mesh_
Reference to the mesh database.
wordList fieldNames_
Field names to apply source to - populated by derived models.
dictionary coeffs_
Dictionary containing source coefficients.
void resetApplied()
Resize/reset applied flag list for all fieldNames_ entries.
const word name_
Source name.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
volVectorField gradP(fvc::grad(p))
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
tmp< volScalarField > rAU
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
static constexpr const zero Zero
Global zero (0)
const dimensionSet dimVolume(pow3(dimLength))
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
IOdictionary propsDict(dictIO)