mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: film sub-models - enabled smooth restart for models which accumulate data
This commit is contained in:
@ -339,6 +339,8 @@ void curvatureSeparation::correct
|
||||
diameterToInject = separated*delta;
|
||||
availableMass -= separated*availableMass;
|
||||
|
||||
addToInjectedMass(sum(separated*availableMass));
|
||||
|
||||
if (debug && mesh.time().outputTime())
|
||||
{
|
||||
volScalarField volFnet
|
||||
@ -358,6 +360,8 @@ void curvatureSeparation::correct
|
||||
volFnet.correctBoundaryConditions();
|
||||
volFnet.write();
|
||||
}
|
||||
|
||||
injectionModel::correct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -137,6 +137,8 @@ void drippingInjection::correct
|
||||
|
||||
// Retrieve new particle diameter sample
|
||||
diam = parcelDistribution_->sample();
|
||||
|
||||
addToInjectedMass(massDrip[cellI]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -151,6 +153,8 @@ void drippingInjection::correct
|
||||
diameterToInject[cellI] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
injectionModel::correct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -39,11 +39,20 @@ namespace surfaceFilmModels
|
||||
defineTypeNameAndDebug(injectionModel, 0);
|
||||
defineRunTimeSelectionTable(injectionModel, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void injectionModel::addToInjectedMass(const scalar dMass)
|
||||
{
|
||||
injectedMass_ += dMass;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
injectionModel::injectionModel(surfaceFilmModel& owner)
|
||||
:
|
||||
filmSubModelBase(owner)
|
||||
filmSubModelBase(owner),
|
||||
injectedMass_(0.0)
|
||||
{}
|
||||
|
||||
|
||||
@ -54,7 +63,8 @@ injectionModel::injectionModel
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
filmSubModelBase(owner, dict, typeName, modelType)
|
||||
filmSubModelBase(owner, dict, typeName, modelType),
|
||||
injectedMass_(0.0)
|
||||
{}
|
||||
|
||||
|
||||
@ -64,6 +74,27 @@ injectionModel::~injectionModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void injectionModel::correct()
|
||||
{
|
||||
if (outputTime())
|
||||
{
|
||||
scalar injectedMass0 = getModelProperty<scalar>("injectedMass");
|
||||
injectedMass0 += returnReduce(injectedMass_, sumOp<scalar>());
|
||||
setModelProperty<scalar>("injectedMass", injectedMass0);
|
||||
injectedMass_ = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scalar injectionModel::injectedMassTotal() const
|
||||
{
|
||||
scalar injectedMass0 = getModelProperty<scalar>("injectedMass");
|
||||
return injectedMass0 + returnReduce(injectedMass_, sumOp<scalar>());
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace surfaceFilmModels
|
||||
|
||||
@ -59,6 +59,12 @@ class injectionModel
|
||||
{
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Injected mass
|
||||
scalar injectedMass_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
@ -68,6 +74,17 @@ private:
|
||||
void operator=(const injectionModel&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Add to injected mass
|
||||
void addToInjectedMass(const scalar dMass);
|
||||
|
||||
//- Correct
|
||||
void correct();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -128,6 +145,9 @@ public:
|
||||
scalarField& massToInject,
|
||||
scalarField& diameterToInject
|
||||
) = 0;
|
||||
|
||||
//- Return the total mass injected
|
||||
scalar injectedMassTotal() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -40,8 +40,7 @@ injectionModelList::injectionModelList(surfaceFilmModel& owner)
|
||||
:
|
||||
PtrList<injectionModel>(),
|
||||
owner_(owner),
|
||||
dict_(dictionary::null),
|
||||
injectedMassTotal_(0.0)
|
||||
dict_(dictionary::null)
|
||||
{}
|
||||
|
||||
|
||||
@ -53,8 +52,7 @@ injectionModelList::injectionModelList
|
||||
:
|
||||
PtrList<injectionModel>(),
|
||||
owner_(owner),
|
||||
dict_(dict),
|
||||
injectedMassTotal_(0.0)
|
||||
dict_(dict)
|
||||
{
|
||||
const wordList activeModels(dict.lookup("injectionModels"));
|
||||
|
||||
@ -109,9 +107,6 @@ void injectionModelList::correct
|
||||
im.correct(availableMass, massToInject, diameterToInject);
|
||||
}
|
||||
|
||||
injectedMassTotal_ += sum(massToInject.internalField());
|
||||
|
||||
|
||||
// Push values to boundaries ready for transfer to the primary region
|
||||
massToInject.correctBoundaryConditions();
|
||||
diameterToInject.correctBoundaryConditions();
|
||||
@ -120,8 +115,14 @@ void injectionModelList::correct
|
||||
|
||||
void injectionModelList::info(Ostream& os) const
|
||||
{
|
||||
os << indent << "injected mass = "
|
||||
<< returnReduce<scalar>(injectedMassTotal_, sumOp<scalar>()) << nl;
|
||||
scalar injectedMass = 0.0;
|
||||
forAll(*this, i)
|
||||
{
|
||||
const injectionModel& im = operator[](i);
|
||||
injectedMass += im.injectedMassTotal();
|
||||
}
|
||||
|
||||
os << indent << "injected mass = " << injectedMass << nl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -65,9 +65,6 @@ private:
|
||||
//- Dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- Cumulative mass injected total
|
||||
scalar injectedMassTotal_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
@ -103,8 +103,12 @@ void removeInjection::correct
|
||||
scalar dMass = ddelta*rho[cellI]*magSf[cellI];
|
||||
massToInject[cellI] += dMass;
|
||||
availableMass[cellI] -= dMass;
|
||||
|
||||
addToInjectedMass(dMass);
|
||||
}
|
||||
}
|
||||
|
||||
injectionModel::correct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -94,6 +94,14 @@ void phaseChangeModel::correct
|
||||
|
||||
availableMass -= dMass;
|
||||
dMass.correctBoundaryConditions();
|
||||
|
||||
if (outputTime())
|
||||
{
|
||||
scalar phaseChangeMass = getModelProperty<scalar>("phaseChangeMass");
|
||||
phaseChangeMass += returnReduce(totalMassPC_, sumOp<scalar>());
|
||||
setModelProperty<scalar>("phaseChangeMass", phaseChangeMass);
|
||||
totalMassPC_ = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -103,8 +111,10 @@ void phaseChangeModel::info(Ostream& os) const
|
||||
returnReduce(latestMassPC_, sumOp<scalar>())
|
||||
/owner_.time().deltaTValue();
|
||||
|
||||
os << indent << "mass phase change = "
|
||||
<< returnReduce(totalMassPC_, sumOp<scalar>()) << nl
|
||||
scalar phaseChangeMass = getModelProperty<scalar>("phaseChangeMass");
|
||||
phaseChangeMass += returnReduce(totalMassPC_, sumOp<scalar>());
|
||||
|
||||
os << indent << "mass phase change = " << phaseChangeMass << nl
|
||||
<< indent << "vapourisation rate = " << massPCRate << nl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user