Go to the documentation of this file.
51 directionalPressureGradientExplicitSource,
71 "volumetricFlowRateTable",
96 label faceI = fZone[i];
99 label facePatchId = -1;
109 if (isA<coupledPolyPatch>(pp))
111 if (refCast<const coupledPolyPatch>(pp).owner())
120 else if (!isA<emptyPolyPatch>(pp))
149 if (mesh_.time().outputTime())
155 name_ +
"Properties",
156 mesh_.time().timeName(),
174 const word& sourceName,
175 const word& modelType,
181 model_(PressureDropModelNames_.read(coeffs_.lookup(
"model"))),
185 flowDir_(coeffs_.lookup(
"flowDir")),
192 faceZoneName_(coeffs_.lookup(
"faceZone")),
193 zoneID_(mesh_.faceZones().findZoneID(faceZoneName_)),
196 relaxationFactor_(coeffs_.lookupOrDefault<scalar>(
"relaxationFactor",0.3)),
197 cellFaceMap_(cells_.size(), -1)
199 coeffs_.lookup(
"fieldNames") >> fieldNames_;
201 flowDir_ /=
mag(flowDir_);
203 if (fieldNames_.size() != 1)
206 <<
"Source can only be applied to a single field. Current "
213 <<
type() <<
" " << this->
name() <<
": "
214 <<
" Unknown face zone name: " << faceZoneName_
215 <<
". Valid face zones are: " << mesh_.faceZones().names()
219 if (model_ == pVolumetricFlowRateTable)
223 else if (model_ == pConstant)
225 coeffs_.lookup(
"pressureDrop") >> pressureDrop_;
227 else if (model_ == pDarcyForchheimer)
229 coeffs_.lookup(
"D") >> D_;
230 coeffs_.lookup(
"I") >> I_;
231 coeffs_.lookup(
"length") >> length_;
236 <<
"Did not find mode " << model_
238 <<
"Please set 'model' to one of "
239 << PressureDropModelNames_.toc()
243 applied_.setSize(fieldNames_.size(),
false);
248 mesh_.time().timePath()/
"uniform"/(name_ +
"Properties")
251 if (propsFile.
good())
253 Info<<
" Reading pressure gradient from file" <<
endl;
258 Info<<
" Initial pressure gradient = " << gradP0_ <<
nl <<
endl;
280 case pDarcyForchheimer:
292 gradPporous_ = -flowDir_*(D_*
nu + I_*0.5*magUn)*magUn*length_;
308 - flowDir_*(D_*
mu + I_*0.5*
rho*magUn)*magUn*length_;
313 gradPporous_ = -flowDir_*pressureDrop_;
317 case pVolumetricFlowRateTable:
319 scalar volFlowRate = 0;
324 label faceI = faceId_[i];
325 if (facePatchId_[i] != -1)
327 label patchI = facePatchId_[i];
328 totalphi +=
phi.boundaryField()[patchI][faceI];
332 totalphi +=
phi[faceI];
339 volFlowRate =
mag(totalphi);
351 volFlowRate =
mag(totalphi)/rhoAve;
354 gradPporous_ = -flowDir_*flowRate_(volFlowRate);
359 const faceZone& fZone = mesh_.faceZones()[zoneID_];
361 labelList meshToLocal(mesh_.nCells(), -1);
364 meshToLocal[cells_[i]] = i;
373 label masterCellI = mc[i];
375 if (meshToLocal[masterCellI] != -1 && masterCellI != -1)
377 faceToCellIndex[i] = meshToLocal[masterCellI];
379 else if (meshToLocal[masterCellI] == -1)
382 <<
"Did not find cell " << masterCellI
383 <<
"in cellZone :" << cellSetName()
396 forAll(
U.boundaryField(), patchI)
404 else if (!isA<emptyFvPatchScalarField>(pf))
412 label faceI = fZone[i];
417 label sourceCellId = sc[i];
418 if (mesh_.isInternalFace(faceI))
420 scalar
w = mesh_.magSf()[faceI];
421 UfCells[
cellId] +=
U[sourceCellId]*
w;
426 label patchI = pbm.
patchID()[faceI-mesh_.nInternalFaces()];
427 label localFaceI = pbm[patchI].whichFace(faceI);
429 scalar
w = mesh_.magSf().boundaryField()[patchI][localFaceI];
431 if (upwindValues.set(patchI))
433 UfCells[
cellId] += upwindValues[patchI][localFaceI]*
w;
440 UfCells /= UfCellWeights;
444 label cellI = cells_[i];
446 const vector Ufnorm = UfCells[i]/
mag(UfCells[i]);
453 (D & UfCells[i]) -
U[cellI]
459 Info<<
"Difference mag(U) = "
460 <<
mag(UfCells[i]) -
mag(
U[cellI])
462 Info<<
"Pressure drop in flowDir direction : "
463 << gradPporous_[i] <<
endl;
464 Info<<
"UfCell:= " << UfCells[i] <<
"U : " <<
U[cellI] <<
endl;
468 writeProps(gradP0_ + dGradP_);
482 name_ + fieldNames_[fieldI] +
"Sup",
483 mesh_.time().timeName(),
505 this->addSup(eqn, fieldI);
515 if (invAPtr_.empty())
524 mesh_.time().timeName(),
535 invAPtr_() = 1.0/eqn.
A();
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0))
A class for handling words, derived from string.
Cell-set options abtract base class. Provides a base set of controls, e.g.
const dimensionedScalar mu
Atomic mass unit.
#define forAll(list, i)
Loop across all elements in list.
const dimensionSet dimVelocity
const dimensionSet & dimensions() const
virtual void constrain(fvMatrix< vector > &eqn, const label fieldI)
Set 1/A coefficient.
static const word propertiesName
Default name of the turbulence properties dictionary.
label zoneID_
Id for the face zone.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Type gSum(const FieldField< Field, Type > &f)
dimensioned< scalar > mag(const dimensioned< Type > &)
const fvMesh & mesh_
Reference to the mesh database.
Field< vector > vectorField
Specialisation of Field<T> for vector.
const faceZoneMesh & faceZones() const
Return face zone mesh.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
const labelList & patchID() const
Per boundary face label the patch index.
directionalPressureGradientExplicitSource(const directionalPressureGradientExplicitSource &)
Disallow default bitwise copy construct.
virtual bool coupled() const
Return true if this patch field is coupled.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
static const NamedEnum< pressureDropModel, 3 > PressureDropModelNames_
const dimensionSet dimArea(sqr(dimLength))
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
tmp< GeometricField< Type, fvPatchField, volMesh > > Su(const GeometricField< Type, fvPatchField, volMesh > &su, const GeometricField< Type, fvPatchField, volMesh > &vf)
A subset of mesh faces organised as a primitive patch.
A patch is a list of labels that address the faces in the global face list.
labelList facePatchId_
Local list of patch ID per face.
const labelList & slaveCells() const
Return labels of slave cells.
IOdictionary propsDict(IOobject("particleTrackProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED))
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Macros for easy insertion into run-time selection tables.
Generic dimensioned Type class.
tmp< volScalarField > A() const
Return the central coefficient.
dimensionedVector gradP("gradP", dimensionSet(0, 1, -2, 0, 0), vector::zero)
Mesh data needed to do the Finite Volume discretisation.
label start() const
Return start label of this patch in the polyMesh face list.
pressureDropModel
Modes of pressure drop.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual tmp< Field< Type > > patchNeighbourField() const
Return patchField on the opposite patch of a coupled patch.
volScalarField rAU("rAU", 1.0/UEqn().A())
defineTypeNameAndDebug(option, 0)
void setSize(const label)
Reset size of List.
const labelList & masterCells() const
Return labels of master cells (cells next to the master face.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
addToRunTimeSelectionTable(option, fixedTemperatureConstraint, dictionary)
label whichFace(const label l) const
Return label of face in patch from global face label.
virtual void addSup(fvMatrix< vector > &eqn, const label fieldI)
Add explicit contribution to momentum equation.
Templated wrapper class to provide compressible turbulence models thermal diffusivity based thermal t...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
tmp< volScalarField > nu() const
Return the laminar viscosity.
void writeProps(const vectorField &gradP) const
Write the pressure gradient to file (for restarts etc)
label size() const
Return the number of elements in the PtrList.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
labelList faceId_
Local list of face IDs.
A List with indirect addressing.
Templated abstract base class for single-phase incompressible turbulence models.
void size(const label)
Override size to be inconsistent with allocated storage.
scalar gSumProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
tensor rotationTensor(const vector &n1, const vector &n2)
bool good() const
Return true if next operation might succeed.
virtual void correct(volVectorField &U)
Correct the pressure gradient.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
const dimensionSet dimVolume(pow3(dimLength))
Generic GeometricField class.
const boolList & flipMap() const
Return face flip map.
word name(const complex &)
Return a string representation of a complex.
static const dictionary null
Null dictionary.
Initialise the NamedEnum HashTable from the static list of names.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...