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