mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated cloud source treatments
This commit is contained in:
@ -439,11 +439,11 @@ Foam::KinematicCloud<ParcelType>::SU(volVectorField& U) const
|
||||
|
||||
if (solution_.sourceActive())
|
||||
{
|
||||
if (solution_.semiImplicit("UTrans"))
|
||||
if (solution_.semiImplicit("U"))
|
||||
{
|
||||
return
|
||||
UTrans()/(mesh_.V()*this->db().time().deltaT())
|
||||
+ fvm::SuSp(-UCoeff().dimensionedInternalField()/mesh_.V(), U)
|
||||
+ fvm::SuSp(-UCoeff()/mesh_.V(), U)
|
||||
+ UCoeff()/mesh_.V()*U;
|
||||
}
|
||||
else
|
||||
|
||||
@ -219,6 +219,13 @@ public:
|
||||
inline PtrList<DimensionedField<scalar, volMesh> >&
|
||||
rhoTrans();
|
||||
|
||||
//- Return mass source term for specie i - specie eqn
|
||||
inline tmp<fvScalarMatrix> SYi
|
||||
(
|
||||
const label i,
|
||||
volScalarField& Yi
|
||||
) const;
|
||||
|
||||
//- Return tmp mass source for field i - fully explicit
|
||||
inline tmp<DimensionedField<scalar, volMesh> >
|
||||
Srho(const label i) const;
|
||||
@ -227,6 +234,9 @@ public:
|
||||
// - fully explicit
|
||||
inline tmp<DimensionedField<scalar, volMesh> > Srho() const;
|
||||
|
||||
//- Return total mass source term [kg/m3/s]
|
||||
inline tmp<fvScalarMatrix> Srho(volScalarField& rho) const;
|
||||
|
||||
|
||||
// Check
|
||||
|
||||
|
||||
@ -65,6 +65,62 @@ Foam::ReactingCloud<ParcelType>::rhoTrans()
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline Foam::tmp<Foam::fvScalarMatrix>
|
||||
Foam::ReactingCloud<ParcelType>::SYi
|
||||
(
|
||||
const label i,
|
||||
volScalarField& Yi
|
||||
) const
|
||||
{
|
||||
if (this->solution().sourceActive())
|
||||
{
|
||||
if (this->solution().semiImplicit("Yi"))
|
||||
{
|
||||
tmp<volScalarField> trhoTrans
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->name() + "rhoTrans",
|
||||
this->db().time().timeName(),
|
||||
this->db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar("zero", dimMass/dimTime/dimVolume, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& sourceField = trhoTrans();
|
||||
|
||||
sourceField.internalField() =
|
||||
rhoTrans_[i]/(this->db().time().deltaT()*this->mesh().V());
|
||||
|
||||
const dimensionedScalar YiSMALL("YiSMALL", dimless, SMALL);
|
||||
|
||||
return
|
||||
fvm::Sp(neg(sourceField)*sourceField/(Yi + YiSMALL), Yi)
|
||||
+ pos(sourceField)*sourceField;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(Yi, dimMass/dimTime));
|
||||
fvScalarMatrix& fvm = tfvm();
|
||||
|
||||
fvm.source() = -rhoTrans_[i]/this->db().time().deltaT();
|
||||
|
||||
return tfvm;
|
||||
}
|
||||
}
|
||||
|
||||
return tmp<fvScalarMatrix>(new fvScalarMatrix(Yi, dimMass/dimTime));
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
|
||||
Foam::ReactingCloud<ParcelType>::Srho(const label i) const
|
||||
@ -166,4 +222,80 @@ Foam::ReactingCloud<ParcelType>::Srho() const
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline Foam::tmp<Foam::fvScalarMatrix>
|
||||
Foam::ReactingCloud<ParcelType>::Srho(volScalarField& rho) const
|
||||
{
|
||||
if (this->solution().sourceActive())
|
||||
{
|
||||
if (this->solution().semiImplicit("rho"))
|
||||
{
|
||||
tmp<volScalarField> trhoTrans
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->name() + "rhoTrans",
|
||||
this->db().time().timeName(),
|
||||
this->db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar("zero", dimMass/dimTime/dimVolume, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
scalarField& sourceField = trhoTrans();
|
||||
|
||||
forAll(rhoTrans_, i)
|
||||
{
|
||||
sourceField += rhoTrans_[i];
|
||||
}
|
||||
sourceField /= this->db().time().deltaT()*this->mesh().V();
|
||||
|
||||
return fvm::SuSp(trhoTrans()/rho, rho);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(rho, dimMass/dimTime));
|
||||
fvScalarMatrix& fvm = tfvm();
|
||||
|
||||
tmp<volScalarField> trhoTrans
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->name() + "rhoTrans",
|
||||
this->db().time().timeName(),
|
||||
this->db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar("zero", dimMass, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
scalarField& sourceField = trhoTrans();
|
||||
|
||||
forAll(rhoTrans_, i)
|
||||
{
|
||||
sourceField += rhoTrans_[i];
|
||||
}
|
||||
|
||||
fvm.source() = -trhoTrans()/this->db().time().deltaT();
|
||||
|
||||
return tfvm;
|
||||
}
|
||||
}
|
||||
|
||||
return tmp<fvScalarMatrix>(new fvScalarMatrix(rho, dimMass/dimTime));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -117,8 +117,7 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar("zero", dimEnergy/dimTime/dimTemperature, 0.0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
dimensionedScalar("zero", dimEnergy/dimTime/dimTemperature, 0.0)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@ -127,17 +127,13 @@ Foam::ThermoCloud<ParcelType>::Sh(volScalarField& hs) const
|
||||
|
||||
if (this->solution().sourceActive())
|
||||
{
|
||||
if (this->solution().semiImplicit("hsTrans"))
|
||||
if (this->solution().semiImplicit("hs"))
|
||||
{
|
||||
const volScalarField Cp = thermo_.thermo().Cp();
|
||||
|
||||
return
|
||||
hsTrans()/(this->mesh().V()*this->db().time().deltaT())
|
||||
+ fvm::SuSp
|
||||
(
|
||||
-hsCoeff().dimensionedInternalField()/(Cp*this->mesh().V()),
|
||||
hs
|
||||
)
|
||||
+ fvm::SuSp(-hsCoeff()/(Cp*this->mesh().V()), hs)
|
||||
+ hsCoeff()/(Cp*this->mesh().V())*hs;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user