ENH: Updates to surfaceFilm lib - structure, sources

This commit is contained in:
andy
2010-09-17 13:23:36 +01:00
parent 255aecb58b
commit 3013a98081
6 changed files with 164 additions and 93 deletions

View File

@ -67,7 +67,6 @@ bool Foam::surfaceFilmModels::kinematicSingleLayer::read()
solution.lookup("nNonOrthCorr") >> nNonOrthCorr_; solution.lookup("nNonOrthCorr") >> nNonOrthCorr_;
coeffs_.lookup("Cf") >> Cf_; coeffs_.lookup("Cf") >> Cf_;
coeffs_.lookup("deltaStable") >> deltaStable_;
return true; return true;
} }
@ -184,7 +183,7 @@ void Foam::surfaceFilmModels::kinematicSingleLayer::correctThermoFields()
FatalErrorIn FatalErrorIn
( (
"void Foam::surfaceFilmModels::kinematicSingleLayer::" "void Foam::surfaceFilmModels::kinematicSingleLayer::"
"correctThermo()" "correctThermoFields()"
) << "Kinematic surface film must use " ) << "Kinematic surface film must use "
<< thermoModelTypeNames_[thermoModel_] << "thermodynamics" << endl; << thermoModelTypeNames_[thermoModel_] << "thermodynamics" << endl;
} }
@ -224,10 +223,6 @@ transferPrimaryRegionFields()
rhoSp_.field() /= magSf_*deltaT; rhoSp_.field() /= magSf_*deltaT;
USp_.field() /= magSf_*deltaT; USp_.field() /= magSf_*deltaT;
pSp_.field() /= magSf_*deltaT; pSp_.field() /= magSf_*deltaT;
// reset transfer to primary fields
massForPrimary_ == dimensionedScalar("zero", dimMass, 0.0);
diametersForPrimary_ == dimensionedScalar("zero", dimLength, -1.0);
} }
@ -275,40 +270,11 @@ Foam::surfaceFilmModels::kinematicSingleLayer::pp()
} }
void Foam::surfaceFilmModels::kinematicSingleLayer::correctDetachedFilm()
{
const scalarField gNorm = this->gNorm();
forAll(gNorm, i)
{
if (gNorm[i] > SMALL)
{
scalar ddelta = max(0.0, delta_[i] - deltaStable_.value());
massForPrimary_[i] =
max
(
0.0,
ddelta*rho_[i]*magSf_[i] - massPhaseChangeForPrimary_[i]
);
}
}
}
void Foam::surfaceFilmModels::kinematicSingleLayer::updateSubmodels() void Foam::surfaceFilmModels::kinematicSingleLayer::updateSubmodels()
{ {
correctDetachedFilm();
// Update injection model - mass returned is actual mass injected // Update injection model - mass returned is actual mass injected
injection_->correct(massForPrimary_, diametersForPrimary_); injection_->correct(massForPrimary_, diametersForPrimary_);
// Update cumulative detached mass counter
detachedMass_ += sum(massForPrimary_.field());
// Push values to boundaries ready for transfer to the primary region
massForPrimary_.correctBoundaryConditions();
diametersForPrimary_.correctBoundaryConditions();
// Update source fields // Update source fields
const dimensionedScalar deltaT = time_.deltaT(); const dimensionedScalar deltaT = time_.deltaT();
rhoSp_ -= (massForPrimary_ + massPhaseChangeForPrimary_)/magSf_/deltaT; rhoSp_ -= (massForPrimary_ + massPhaseChangeForPrimary_)/magSf_/deltaT;
@ -450,6 +416,12 @@ Foam::surfaceFilmModels::kinematicSingleLayer::solveMomentum
updateSurfaceVelocities(); updateSurfaceVelocities();
volScalarField mLossCoeff
(
"mLossCoeff",
(massForPrimary_ + massPhaseChangeForPrimary_)/magSf_/time_.deltaT()
);
// Momentum // Momentum
tmp<fvVectorMatrix> tUEqn tmp<fvVectorMatrix> tUEqn
( (
@ -459,12 +431,7 @@ Foam::surfaceFilmModels::kinematicSingleLayer::solveMomentum
USp_ USp_
+ tau(U_) + tau(U_)
+ fvc::grad(sigma_) + fvc::grad(sigma_)
- fvm::Sp + fvm::SuSp(-mLossCoeff, U_)
(
(massForPrimary_ + massPhaseChangeForPrimary_)
/magSf_/time_.deltaT(),
U_
)
); );
fvVectorMatrix& UEqn = tUEqn(); fvVectorMatrix& UEqn = tUEqn();
@ -661,7 +628,6 @@ Foam::surfaceFilmModels::kinematicSingleLayer::kinematicSingleLayer
cumulativeContErr_(0.0), cumulativeContErr_(0.0),
Cf_(readScalar(coeffs_.lookup("Cf"))), Cf_(readScalar(coeffs_.lookup("Cf"))),
deltaStable_(coeffs_.lookup("deltaStable")),
initialisedThermo_(false), initialisedThermo_(false),
rho_ rho_
@ -825,7 +791,7 @@ Foam::surfaceFilmModels::kinematicSingleLayer::kinematicSingleLayer
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
filmRegion_, filmRegion_,
dimensionedScalar("zero", dimMass, 0), dimensionedScalar("zero", dimMass, 0.0),
zeroGradientFvPatchScalarField::typeName zeroGradientFvPatchScalarField::typeName
), ),
@ -963,8 +929,7 @@ Foam::surfaceFilmModels::kinematicSingleLayer::kinematicSingleLayer
injection_(injectionModel::New(*this, coeffs_)), injection_(injectionModel::New(*this, coeffs_)),
addedMass_(0.0), addedMass_(0.0)
detachedMass_(0.0)
{ {
initialise(); initialise();
} }
@ -1227,19 +1192,19 @@ void Foam::surfaceFilmModels::kinematicSingleLayer::info() const
<< returnReduce<scalar>(addedMass_, sumOp<scalar>()) << nl << returnReduce<scalar>(addedMass_, sumOp<scalar>()) << nl
<< indent << "current mass = " << indent << "current mass = "
<< gSum((deltaRho_*magSf_)()) << nl << gSum((deltaRho_*magSf_)()) << nl
<< indent << "detached mass = "
<< returnReduce<scalar>(detachedMass_, sumOp<scalar>()) << nl
<< indent << "min/max(mag(U)) = " << min(mag(U_)).value() << ", " << indent << "min/max(mag(U)) = " << min(mag(U_)).value() << ", "
<< max(mag(U_)).value() << nl << max(mag(U_)).value() << nl
<< indent << "min/max(delta) = " << min(delta_).value() << ", " << indent << "min/max(delta) = " << min(delta_).value() << ", "
<< max(delta_).value() << nl; << max(delta_).value() << nl;
injection_->info();
} }
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> > Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::surfaceFilmModels::kinematicSingleLayer::Srho() const Foam::surfaceFilmModels::kinematicSingleLayer::Srho() const
{ {
tmp<DimensionedField<scalar, volMesh> > tSrho return tmp<DimensionedField<scalar, volMesh> >
( (
new DimensionedField<scalar, volMesh> new DimensionedField<scalar, volMesh>
( (
@ -1256,38 +1221,6 @@ Foam::surfaceFilmModels::kinematicSingleLayer::Srho() const
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
) )
); );
scalarField& Srho = tSrho();
const scalarField& V = mesh_.V();
const scalar dt = time_.deltaTValue();
forAll(filmBottomPatchIDs_, i)
{
const label primaryPatchI = primaryPatchIDs_[i];
const directMappedWallPolyPatch& wpp =
refCast<const directMappedWallPolyPatch>
(
mesh_.boundaryMesh()[primaryPatchI]
);
const mapDistribute& distMap = wpp.map();
const label filmPatchI = filmBottomPatchIDs_[i];
scalarField patchMass =
massPhaseChangeForPrimary_.boundaryField()[filmPatchI];
distMap.distribute(patchMass);
const unallocLabelList& cells = wpp.faceCells();
forAll(patchMass, j)
{
Srho[cells[j]] = patchMass[j]/(V[cells[j]]*dt);
}
}
return tSrho;
} }

View File

@ -120,9 +120,6 @@ protected:
//- Skin frition coefficient for film/primary region interface //- Skin frition coefficient for film/primary region interface
scalar Cf_; scalar Cf_;
//- Stable film thickness - film cannot detach until reached
dimensionedScalar deltaStable_;
// Thermo properties // Thermo properties
@ -231,12 +228,6 @@ protected:
scalar addedMass_; scalar addedMass_;
// Detached surface properties
//- Cumulative mass detached [kg]
scalar detachedMass_;
// Protected member functions // Protected member functions
//- Initialise the film model - called on construction //- Initialise the film model - called on construction
@ -254,9 +245,6 @@ protected:
//- Transfer fields from the primary region to the film region //- Transfer fields from the primary region to the film region
virtual void transferPrimaryRegionFields(); virtual void transferPrimaryRegionFields();
//- Correct the source terms for film that detaches from film region
virtual void correctDetachedFilm();
// Explicit pressure source contribution // Explicit pressure source contribution
virtual tmp<volScalarField> pu(); virtual tmp<volScalarField> pu();

View File

@ -252,6 +252,75 @@ Foam::surfaceFilmModels::noFilm::massPhaseChangeForPrimary() const
} }
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::surfaceFilmModels::noFilm::Srho() const
{
return tmp<DimensionedField<scalar, volMesh> >
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"noFilm::Srho",
time_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
);
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::surfaceFilmModels::noFilm::Srho(const label) const
{
return tmp<DimensionedField<scalar, volMesh> >
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"kinematicSingleLayer::Srho(i)",
time_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
);
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::surfaceFilmModels::noFilm::Sh() const
{
return tmp<DimensionedField<scalar, volMesh> >
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"kinematicSingleLayer::Sh",
time_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0)
)
);
}
void Foam::surfaceFilmModels::noFilm::info() const void Foam::surfaceFilmModels::noFilm::info() const
{ {
// do nothing // do nothing

View File

@ -175,6 +175,23 @@ public:
virtual void evolveFilm(); virtual void evolveFilm();
// Source fields
// Mapped into primary region
//- Return total mass source - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho() const;
//- Return mass source for specie i - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho
(
const label i
) const;
//- Return enthalpy source - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Sh() const;
// I-O // I-O
//- Provide some feedback //- Provide some feedback

View File

@ -207,6 +207,12 @@ void Foam::surfaceFilmModels::thermoSingleLayer::solveEnergy()
updateSurfaceTemperatures(); updateSurfaceTemperatures();
volScalarField mLossCoeff
(
"mLossCoeff",
massForPrimary_/magSf_/time_.deltaT()
);
solve solve
( (
fvm::ddt(deltaRho_, hs_) fvm::ddt(deltaRho_, hs_)
@ -215,7 +221,7 @@ void Foam::surfaceFilmModels::thermoSingleLayer::solveEnergy()
// fvm::Sp(hsSp_/hs_, hs_) // fvm::Sp(hsSp_/hs_, hs_)
hsSp_ hsSp_
+ q(hs_) + q(hs_)
- fvm::Sp(massForPrimary_/magSf_/time_.deltaT(), hs_) - fvm::Sp(mLossCoeff, hs_)
); );
correctThermoFields(); correctThermoFields();
@ -577,6 +583,61 @@ void Foam::surfaceFilmModels::thermoSingleLayer::info() const
} }
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::surfaceFilmModels::thermoSingleLayer::Srho() const
{
tmp<DimensionedField<scalar, volMesh> > tSrho
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"thermoSingleLayer::Srho",
time_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
);
scalarField& Srho = tSrho();
const scalarField& V = mesh_.V();
const scalar dt = time_.deltaTValue();
forAll(filmBottomPatchIDs_, i)
{
const label primaryPatchI = primaryPatchIDs_[i];
const directMappedWallPolyPatch& wpp =
refCast<const directMappedWallPolyPatch>
(
mesh_.boundaryMesh()[primaryPatchI]
);
const mapDistribute& distMap = wpp.map();
const label filmPatchI = filmBottomPatchIDs_[i];
scalarField patchMass =
massPhaseChangeForPrimary_.boundaryField()[filmPatchI];
distMap.distribute(patchMass);
const unallocLabelList& cells = wpp.faceCells();
forAll(patchMass, j)
{
Srho[cells[j]] = patchMass[j]/(V[cells[j]]*dt);
}
}
return tSrho;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> > Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::surfaceFilmModels::thermoSingleLayer::Srho(const label i) const Foam::surfaceFilmModels::thermoSingleLayer::Srho(const label i) const
{ {

View File

@ -317,6 +317,9 @@ public:
// Mapped into primary region // Mapped into primary region
//- Return total mass source - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho() const;
//- Return mass source for specie i - Eulerian phase only //- Return mass source for specie i - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho virtual tmp<DimensionedField<scalar, volMesh> > Srho
( (