64 Foam::IOobject Foam::momentumTransferSystem::io(
const phaseSystem& fluid)
const
66 typeIOobject<IOdictionary> result
69 fluid.mesh().time().constant(),
79 modelName<blendedDragModel>(),
80 modelName<blendedVirtualMassModel>(),
81 modelName<blendedLiftModel>(),
82 modelName<blendedWallLubricationModel>(),
83 modelName<blendedTurbulentDispersionModel>()
86 OStringStream modelEntriesString;
89 modelEntriesString<< modelEntries[i];
90 if (i < modelEntries.size() - 2) modelEntriesString<<
", ";
91 if (i == modelEntries.size() - 2) modelEntriesString<<
" and ";
94 if (!result.headerOk())
99 <<
"Specifying momentum transfer model entries - "
100 << modelEntriesString.str().c_str() <<
" - in "
101 << fluid.relativeObjectPath() <<
" is deprecated. These "
102 <<
"entries should now be specified in "
103 << result.relativeObjectPath() <<
"." <<
endl;
109 if (!fluid.found(modelEntries[i]))
continue;
112 <<
"Momentum transfer model entries - "
113 << modelEntriesString.str().c_str() <<
" - in "
114 << fluid.relativeObjectPath() <<
" are no longer used. These "
115 <<
"entries are now read from " << result.relativeObjectPath()
126 template<
class ModelType>
129 const word key = modelName<ModelType>();
133 ? fluid_.subDict(key)
138 void Foam::momentumTransferSystem::readModels()
141 generateBlendedInterfacialModels<blendedDragModel>
144 modelsDict<blendedDragModel>()
148 generateBlendedInterfacialModels<blendedVirtualMassModel>
151 modelsDict<blendedVirtualMassModel>()
155 generateBlendedInterfacialModels<blendedLiftModel>
158 modelsDict<blendedLiftModel>()
161 wallLubricationModels_ =
162 generateBlendedInterfacialModels<blendedWallLubricationModel>
165 modelsDict<blendedWallLubricationModel>()
168 turbulentDispersionModels_ =
169 generateBlendedInterfacialModels<blendedTurbulentDispersionModel>
172 modelsDict<blendedTurbulentDispersionModel>()
177 void Foam::momentumTransferSystem::addTmpField
179 tmp<surfaceScalarField>& result,
180 const tmp<surfaceScalarField>& field
185 result.ref() += field;
195 result = field().clone();
262 wallLubricationModels_,
263 wallLubricationModelIter
267 wallLubricationModelIter()->interface();
288 forAll(fluid_.movingPhases(), movingPhasei)
290 const phaseModel& phase = fluid_.movingPhases()[movingPhasei];
305 turbulentDispersionModels_,
306 turbulentDispersionModelIter
310 turbulentDispersionModelIter()->interface();
317 const volScalarField alpha12(interface.phase1() + interface.phase2());
323 /
max(alpha12, interface.phase1().residualAlpha())
324 )*fluid_.mesh().magSf()
331 /
max(alpha12, interface.phase2().residualAlpha())
332 )*fluid_.mesh().magSf()
335 addField(interface.phase1(),
"F", Df*snGradAlpha1By12, Fs);
336 addField(interface.phase2(),
"F", Df*snGradAlpha2By12, Fs);
380 wallLubricationModels_,
381 wallLubricationModelIter
385 wallLubricationModelIter()->interface();
406 forAll(fluid_.movingPhases(), movingPhasei)
408 const phaseModel& phase = fluid_.movingPhases()[movingPhasei];
423 turbulentDispersionModels_,
424 turbulentDispersionModelIter
428 turbulentDispersionModelIter()->interface();
435 const volScalarField alpha12(interface.phase1() + interface.phase2());
441 /
max(alpha12, interface.phase1().residualAlpha())
442 )*fluid_.mesh().magSf()
449 /
max(alpha12, interface.phase2().residualAlpha())
450 )*fluid_.mesh().magSf()
453 addField(interface.phase1(),
"F", Df*snGradAlpha1By12, Ffs);
454 addField(interface.phase2(),
"F", Df*snGradAlpha2By12, Ffs);
461 void Foam::momentumTransferSystem::invADVs
466 const label n = ADVs.size();
478 AD(i, j) = ADVs[i][j][ci];
495 ADVs[i][j][ci] = source[i];
502 template<
class GeoMesh>
503 void Foam::momentumTransferSystem::invADVs
505 PtrList<PtrList<GeometricField<scalar, GeoMesh>>>& ADVs
508 const label n = ADVs.size();
518 ADps[i].set(j, &ADVs[i][j]);
520 ADVs[i][j].dimensions().reset(
dimless/ADVs[i][j].dimensions());
532 ADps[i].set(j, &ADVs[i][j].boundaryFieldRef()[
patchi]);
541 void Foam::momentumTransferSystem::invADVs
557 invADVs[i].set(i, As[i].
clone());
563 labelList movingPhases(fluid_.phases().size(), -1);
564 forAll(fluid_.movingPhases(), movingPhasei)
566 movingPhases[fluid_.movingPhases()[movingPhasei].index()] =
584 Kds_.insert(dragModelIter.key(), tKd.ptr());
592 !interface.phase1().stationary()
593 && interface.phase1().U()()
594 .boundaryField()[
patchi].fixesValue()
597 !interface.phase2().stationary()
598 && interface.phase2().U()()
599 .boundaryField()[
patchi].fixesValue()
611 const phaseModel& otherPhase = iter.otherPhase();
624 invADVs[i][i] += Kdij;
625 invADVfs[i][i] += Kdijf;
627 const label j = movingPhases[otherPhase.
index()];
631 invADVs[i].set(j, -Kdij);
632 invADVfs[i].set(j, -Kdijf);
649 if (!invADVs[i].set(j))
694 if (i != -1 && !ADUDts.
set(i))
697 ADUDts.
set(i, DUDt.
A());
698 HDUDts.
set(i, DUDt.
H());
717 const phaseModel& otherPhase = iter.otherPhase();
731 invADVs[i][i] += AVm;
743 const label j = movingPhases[otherPhase.
index()];
749 invADVs[i][j] -= AVm;
764 momentumTransferSystem::invADVs(invADVs);
765 momentumTransferSystem::invADVs(invADVfs);
786 labelList movingPhases(fluid_.phases().size(), -1);
787 forAll(fluid_.movingPhases(), movingPhasei)
789 movingPhases[fluid_.movingPhases()[movingPhasei].index()] =
806 const phaseModel& otherPhase = iter.otherPhase();
822 invADVfs[i][i] += Kdfij;
824 const label j = movingPhases[otherPhase.
index()];
828 invADVfs[i].
set(j, -Kdfij);
838 if (!invADVfs[i].set(j))
872 if (i != -1 && !AUgradUs.
set(i))
875 AUgradUs.
set(i, UgradU.
A());
876 HUgradUs.
set(i, UgradU.
H());
895 const phaseModel& otherPhase = iter.otherPhase();
921 fluid_.MRF().absolute
923 phase.
phi()().oldTime()
932 const label j = movingPhases[otherPhase.
index()];
948 fluid_.MRF().absolute
950 otherPhase.
phi()().oldTime()
978 forAll(fluid_.movingPhases(), movingPhasei)
980 const phaseModel& phase = fluid_.movingPhases()[movingPhasei];
995 turbulentDispersionModels_,
996 turbulentDispersionModelIter
1000 turbulentDispersionModelIter()->interface();
1016 /
max(alpha1f + alpha2f, interface.phase1().residualAlpha())
1021 rAs[interface.phase1().index()],
1022 rAs[interface.phase2().index()]
1024 *turbulentDispersionModelIter()->
D()
1039 forAll(fluid_.movingPhases(), movingPhasei)
1041 const phaseModel& phase = fluid_.movingPhases()[movingPhasei];
1072 forAll(fluid_.movingPhases(), movingPhasei)
1074 const phaseModel& phase = fluid_.movingPhases()[movingPhasei];
1103 const phaseModel& otherPhase = iter.otherPhase();
1104 const label otherPhasei = otherPhase.
index();
1117 *(VmDdtCorrs[phasei] - VmDdtCorrs[otherPhasei]),
1134 labelList movingPhases(fluid_.phases().size(), -1);
1135 forAll(fluid_.movingPhases(), movingPhasei)
1137 movingPhases[fluid_.movingPhases()[movingPhasei].index()] =
1142 forAll(fluid_.movingPhases(), movingPhasei)
1159 const phaseModel& otherPhase = iter.otherPhase();
1162 const label j = movingPhases[otherPhase.
index()];
1175 K1*(j == -1 ? -Uphis[i] : (Uphis[j] - Uphis[i])),
1184 *(j == -1 ? -phase.
phi() : (otherPhase.
phi() - phase.
phi())),
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
static tmp< GeometricField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Internal &, const PtrList< Patch > &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
fileName relativeObjectPath() const
Return complete relativePath + object name.
static word groupName(Name name, const word &group)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool set(const label) const
Is element set.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
label size() const
Return the number of elements in the UPtrList.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
T lookupOrDefault(const word &, const T &) const
Find and return a T, if not found return the given default.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
tmp< volScalarField > A() const
Return the central coefficient.
tmp< VolField< Type > > H() const
Return the H operation source.
Class which provides interfacial momentum transfer between a number of phases. Drag,...
static const word propertiesName
Default name of the phase properties dictionary.
void dragCorrs(PtrList< volVectorField > &dragCorrs, PtrList< surfaceScalarField > &dragCorrf) const
Set the cell and faces drag correction fields.
PtrList< surfaceScalarField > ddtCorrs() const
Return the flux corrections for the cell-based algorithm. These.
momentumTransferSystem(const phaseSystem &)
Construct from a phase system.
PtrList< surfaceScalarField > Ffs() const
As Fs, but for the face-based algorithm.
PtrList< surfaceScalarField > Fs() const
Return the explicit force fluxes for the cell-based algorithm, that.
virtual ~momentumTransferSystem()
Destructor.
PtrList< PtrList< surfaceScalarField > > invADVfs(const PtrList< surfaceScalarField > &Afs, PtrList< surfaceScalarField > &HVmfs) const
Return the inverse of the central + drag + virtual mass.
virtual tmp< surfaceScalarField > alphaDByAf(const PtrList< volScalarField > &rAs) const
Return the phase diffusivity.
virtual bool read()
Read base phaseProperties dictionary.
Class to represent an interface between phases. Derivations can further specify the configuration of ...
virtual const autoPtr< surfaceVectorField > & Uf() const =0
Return the face velocity.
const dimensionedScalar & residualAlpha() const
Return the residual phase-fraction for given phase.
virtual tmp< fvVectorMatrix > DUDt() const =0
Return the substantive acceleration matrix.
virtual tmp< surfaceScalarField > phi() const =0
Return the volumetric flux.
label index() const
Return the index of the phase.
virtual tmp< volVectorField > U() const =0
Return the velocity.
virtual tmp< fvVectorMatrix > UgradU() const =0
Return the velocity transport matrix.
const word & name() const
Return the name of this phase.
virtual tmp< surfaceScalarField > pPrimef() const =0
Return the face-phase-pressure'.
virtual const volScalarField & rho() const =0
Return the density field.
Class to represent a system of phases.
Pimple no-loop control class. Implements various option flags, but leaves loop controls to the deriva...
static const dictionary & dict(const fvMesh &mesh, const word &algorithmName="PIMPLE")
Return the solution dictionary.
Motion of the mesh specified as a list of pointMeshMovers.
Enables the printing of a dictionary and subsequently looked-up defaulted entries.
virtual bool read()
Read object.
A class for managing temporary objects.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
pimpleControl pimple(mesh)
Calculate the first temporal derivative.
Calculate the divergence of the given field.
Calculate the face-flux of the given field.
Calculate the mesh motion flux and convert fluxes from absolute to relative and back.
Reconstruct volField from a face flux field.
Calculate the snGrad of the given volField.
Calculate the matrix for the first temporal derivative.
Calculate the matrix for the divergence of the given field and flux.
Calculate the matrix for implicit and explicit sources.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar F
Faraday constant: default SI units: [C/mol].
tmp< SurfaceField< typename innerProduct< vector, Type >::type > > flux(const VolField< Type > &vf)
Return the face-flux field obtained from the given volVectorField.
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
tmp< VolField< typename outerProduct< vector, Type >::type > > reconstruct(const SurfaceField< Type > &ssf)
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
tmp< SurfaceField< Type > > snGrad(const VolField< Type > &vf, const word &name)
tmp< SurfaceField< typename Foam::flux< Type >::type > > ddtCorr(const VolField< Type > &U, const SurfaceField< Type > &Uf)
static const coefficient D("D", dimTemperature, 257.14)
List< word > wordList
A List of words.
const dimensionSet & dimless
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void addField(const label phasei, const word &name, tmp< GeoField > field, PtrList< GeoField > &fieldList)
void LUBacksubstitute(const scalarSquareMatrix &luMmatrix, const labelList &pivotIndices, List< Type > &source)
LU back-substitution with given source, returning the solution.
void LUDecompose(scalarSquareMatrix &matrix, labelList &pivotIndices)
LU decompose the matrix with pivoting.
tmp< volScalarField > byDt(const volScalarField &vf)
Ostream & indentOrNl(Ostream &os)
Indent stream or add newline if indent level == 0.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)