46 void Foam::fv::cloud::fail(
const fvMatrix<Type>& eqn)
const
49 <<
"Could not add a source for conservation of "
51 <<
" in the Lagrangian cloud " << cloud_.
name()
52 <<
" to the finite-volume equation for " << eqn.psi().name()
57 template<
class Type,
class ... AlphaRhoFieldTypes>
58 void Foam::fv::cloud::fail
60 const fvMatrix<Type>& eqn,
61 const AlphaRhoFieldTypes& ... alphaRhoFields
65 <<
"Could not add a source for conservation of "
67 <<
" in the Lagrangian cloud " << cloud_.name()
68 <<
" to the finite-volume equation for " << eqn.psi().name()
75 const word& phaseName,
76 const dimensionSet& dims
79 typedef HashTable<const CarrierEqn<scalar>*> carrierEqnTable;
82 const bool isMultiphase = carriedCloud_.carrierPhaseName() !=
word::null;
84 const clouds::coupledToConstantDensityFluid& ctcdfCloud =
85 refCastNull<const clouds::coupledToConstantDensityFluid>(cloud_);
88 if (!isPhase && !isMultiphase && dims ==
dimless &&
notNull(ctcdfCloud))
94 if (!isPhase && isMultiphase && dims ==
dimless &&
notNull(ctcdfCloud))
96 tmp<volScalarField::Internal> tS =
105 const carrierEqnTable carrierEqns =
106 coupledCloud_.carrierEqns<scalar>(
"1");
110 const uniformDimensionedScalarField& rhoPhase =
117 ctcdfCloud.rho()/rhoPhase
127 const uniformDimensionedScalarField& rhoPhase =
134 ctcdfCloud.rho()/rhoPhase
143 tmp<volScalarField::Internal> tS =
152 const carrierEqnTable carrierEqns =
153 coupledCloud_.carrierEqns<scalar>(
"rho");
173 <<
"Could not create material source "
174 << (isPhase ?
"for phase " + phaseName :
"").c_str()
177 return tmp<volScalarField::Internal>(
nullptr);
195 return S*sourceCoeff +
fvm::Sp(
S*internalCoeff, field);
200 void Foam::fv::cloud::addSupType
206 if (!coupledCloud_.hasCarrierEqns())
return;
211 const bool isMultiphase = carriedCloud_.carrierPhaseName() !=
word::null;
213 const bool hasCarrierEqn = coupledCloud_.hasCarrierEqn(field);
216 refCastNull<const clouds::coupledToConstantDensityFluid>(cloud_);
219 <<
"field=" << field.
name()
220 <<
", eqnField=" << eqn.
psi().name()
221 <<
", hasCarrierEqn(" << field.
name() <<
")=" << hasCarrierEqn <<
endl;
225 if (!isPhase && !isMultiphase && hasCarrierEqn &&
notNull(ctcdfCloud))
227 eqn += ctcdfCloud.
rhoByRhoc*coupledCloud_.carrierEqn(field);
231 else if (!isPhase && isMultiphase && hasCarrierEqn &&
notNull(ctcdfCloud))
240 else if (!isPhase && !hasCarrierEqn)
252 void Foam::fv::cloud::addSupType
255 fvMatrix<scalar>& eqn
258 if (!coupledCloud_.hasCarrierEqns())
return;
260 const word phaseName = alphaRhoOrField.group();
264 alphaRhoOrField.member() ==
"alpha"
265 && alphaRhoOrField.dimensions() ==
dimless;
267 alphaRhoOrField.member() ==
"rho"
268 && alphaRhoOrField.dimensions() ==
dimDensity;
273 const clouds::coupledToConstantDensityFluid& ctcdfCloud =
274 refCastNull<const clouds::coupledToConstantDensityFluid>(cloud_);
277 <<
"alphaRhoOrField=" << alphaRhoOrField.name()
278 <<
", eqnField=" << eqn.psi().name()
279 <<
", hasCarrierEqn(" << oneName <<
")="
280 << coupledCloud_.hasCarrierEqn<scalar>(oneName) <<
endl;
283 if (!isPhase && isRho)
285 eqn += coupledCloud_.carrierEqn<scalar>(rhoName);
288 else if (isPhase && isAlpha &&
notNull(ctcdfCloud))
293 *coupledCloud_.carrierEqn<scalar>(oneName);
298 addSupType<scalar>(alphaRhoOrField, eqn);
304 void Foam::fv::cloud::addSupType
307 const VolField<Type>& field,
311 if (!coupledCloud_.hasCarrierEqns())
return;
313 const word phaseName = alphaOrRho.group();
317 alphaOrRho.member() ==
"alpha"
318 && alphaOrRho.dimensions() ==
dimless;
320 alphaOrRho.member() ==
"rho"
323 const bool hasCarrierEqn = coupledCloud_.hasCarrierEqn(field);
328 const clouds::coupledToConstantDensityFluid& ctcdfCloud =
329 refCastNull<const clouds::coupledToConstantDensityFluid>(cloud_);
332 <<
"alphaOrRho=" << alphaOrRho.name()
333 <<
", field=" << field.name()
334 <<
", eqnField=" << eqn.psi().name()
335 <<
", hasCarrierEqn(" << field.name() <<
")=" << hasCarrierEqn <<
endl;
339 if (!isPhase && isRho && hasCarrierEqn &&
isNull(ctcdfCloud))
341 eqn += coupledCloud_.carrierEqn(field);
345 else if (!isPhase && isRho && hasCarrierEqn &&
notNull(ctcdfCloud))
347 eqn += ctcdfCloud.rho()*coupledCloud_.carrierEqn(field);
350 else if (!isPhase && isRho && !hasCarrierEqn)
356 else if (isPhase && isAlpha && hasCarrierEqn &&
notNull(ctcdfCloud))
361 *coupledCloud_.carrierEqn(field);
364 else if (isPhase && isAlpha && !hasCarrierEqn &&
notNull(ctcdfCloud))
371 fail(eqn, alphaOrRho, field);
376 void Foam::fv::cloud::addSupType
380 fvMatrix<scalar>& eqn
383 if (!coupledCloud_.hasCarrierEqns())
return;
385 const word phaseName = alphaOrRho.group();
389 alphaOrRho.member() ==
"alpha"
390 && alphaOrRho.dimensions() ==
dimless;
391 const bool isRhoField =
392 rhoOrField.member() ==
"rho"
396 <<
"alphaOrRho=" << alphaOrRho.name()
397 <<
", rhoOrField=" << rhoOrField.name()
398 <<
", eqnField=" << eqn.psi().name()
399 <<
", hasCarrierEqn(" << rhoOrField.name() <<
")="
400 << coupledCloud_.hasCarrierEqn(rhoOrField) <<
endl;
403 if (isPhase && isAlpha && isRhoField)
405 eqn += coupledCloud_.carrierEqn(rhoOrField);
410 addSupType<scalar>(alphaOrRho, rhoOrField, eqn);
416 void Foam::fv::cloud::addSupType
420 const VolField<Type>& field,
424 if (!coupledCloud_.hasCarrierEqns())
return;
426 const bool hasCarrierEqn = coupledCloud_.hasCarrierEqn(field);
429 <<
"alpha=" <<
alpha.name()
430 <<
", rho=" <<
rho.name()
431 <<
", field=" << field.name()
432 <<
", eqnField=" << eqn.psi().name()
433 <<
", hasCarrierEqn(" << field.name() <<
")=" << hasCarrierEqn <<
endl;
438 eqn += coupledCloud_.carrierEqn(field);
462 #define hasCarrierEqnType(Type, nullArg) \
463 || coupledCloud_.hasCarrierEqn<Type>(fieldName)
482 if (!coupledCloud_.hasCarrierEqns())
return;
484 const word oneName =
"1";
487 refCastNull<const clouds::coupledToConstantDensityFluid>(cloud_);
490 <<
", eqnField=" << eqn.
psi().name()
491 <<
", hasCarrierEqn(" << oneName <<
")="
492 << coupledCloud_.hasCarrierEqn<scalar>(oneName) <<
endl;
497 eqn += ctcdfCloud.
rhoByRhoc*coupledCloud_.carrierEqn<scalar>(oneName);
523 const bool outerCorrectors =
526 if (
pimple.firstIter() || outerCorrectors)
528 cloudPtr_->solve(
pimple.firstIter(),
pimple.finalIter());
533 cloudPtr_->solve(
true,
true);
540 cloudPtr_->storePosition();
552 cloudPtr_->topoChange(map);
558 cloudPtr_->mapMesh(map);
564 cloudPtr_->distribute(map);
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const GeoMesh &mesh, const dimensionSet &, const PrimitiveField< Type > &)
Return a temporary field constructed from name, mesh,.
Generic GeometricField class.
const Sources & sources() const
Return const-reference to the sources.
DimensionedField< Type, GeoMesh, PrimitiveField > Internal
Type of the internal field from which this GeometricField is derived.
static word group(const word &name)
Return group (extension part of name)
word group() const
Return group (extension part of name)
const word & name() const
Return name.
static word groupName(Name name, const word &group)
static word fieldsName(const AlphaRhoFieldType &alphaRhoField, const AlphaRhoFieldTypes &... alphaRhoFields)
Return the name of the product of the fields associated with a.
List of Lagrangian models, constructed as a (Lagrangian) mesh object. Provides similar functions to t...
bool addsSupToField(const word &fieldName) const
Return true if the LagrangianModels adds a source term to the.
LagrangianModels(const LagrangianMesh &mesh)
Construct for a mesh.
static word nameToCarrierName(const word &name)
Convert a name to its disambiguated carrier equivalent name. I.e.,.
Base class for clouds which are coupled to a constant density fluid.
const dimensionedScalar rhoByRhoc
Cloud/carrier density ratio.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Dimension set for the base types.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
const fvSolution & solution() const
Return the fvSolution.
Finite volume model that solves for the evolution of a cloud. Provides two-way coupling with a finite...
virtual bool movePoints()
Update for mesh motion.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual void preUpdateMesh()
Prepare for mesh update.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual ~cloud()
Destructor.
virtual void addSup(fvMatrix< scalar > &eqn) const
Add a source term to a field-less proxy equation.
virtual bool addsSupToField(const word &fieldName) const
Return true if the fvModel adds a source term to the given.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
Pimple no-loop control class. Implements various option flags, but leaves loop controls to the deriva...
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const fvMesh & mesh() const
Return the mesh.
A class for managing temporary objects.
A class for handling words, derived from string.
static const word null
An empty word.
#define hasCarrierEqnType(Type, nullArg)
pimpleControl pimple(mesh)
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define IMPLEMENT_FV_MODEL_ADD_FIELD_SUP(Type, modelType)
#define IMPLEMENT_FV_MODEL_ADD_ALPHA_RHO_FIELD_SUP(Type, modelType)
#define IMPLEMENT_FV_MODEL_ADD_RHO_FIELD_SUP(Type, modelType)
Calculate the matrix for implicit and explicit sources.
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
#define DebugInFunction
Report an information message using Foam::Info.
void correct(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiCorr, const SpType &Sp)
defineTypeNameAndDebug(bound, 0)
tmp< fvMatrix< Type > > S(const Pair< tmp< volScalarField::Internal >> &, const VolField< Type > &)
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const VolField< Type > &)
errorManipArg< error, int > exit(error &err, const int errNo=1)
const dimensionSet & dimless
Ostream & endl(Ostream &os)
Add newline and flush stream.
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
bool notNull(const T &t)
Return true if t is not a reference to the nullObject of type T.
const dimensionSet & dimTime
VolField< scalar > volScalarField
const dimensionSet & dimDensity
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
bool isNull(const T &t)
Return true if t is a reference to the nullObject of type T.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.