Commit 3013a980 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Updates to surfaceFilm lib - structure, sources

parent 255aecb5
......@@ -67,7 +67,6 @@ bool Foam::surfaceFilmModels::kinematicSingleLayer::read()
solution.lookup("nNonOrthCorr") >> nNonOrthCorr_;
coeffs_.lookup("Cf") >> Cf_;
coeffs_.lookup("deltaStable") >> deltaStable_;
return true;
}
......@@ -184,7 +183,7 @@ void Foam::surfaceFilmModels::kinematicSingleLayer::correctThermoFields()
FatalErrorIn
(
"void Foam::surfaceFilmModels::kinematicSingleLayer::"
"correctThermo()"
"correctThermoFields()"
) << "Kinematic surface film must use "
<< thermoModelTypeNames_[thermoModel_] << "thermodynamics" << endl;
}
......@@ -224,10 +223,6 @@ transferPrimaryRegionFields()
rhoSp_.field() /= magSf_*deltaT;
USp_.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()
{
correctDetachedFilm();
// Update injection model - mass returned is actual mass injected
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
const dimensionedScalar deltaT = time_.deltaT();
rhoSp_ -= (massForPrimary_ + massPhaseChangeForPrimary_)/magSf_/deltaT;
......@@ -450,6 +416,12 @@ Foam::surfaceFilmModels::kinematicSingleLayer::solveMomentum
updateSurfaceVelocities();
volScalarField mLossCoeff
(
"mLossCoeff",
(massForPrimary_ + massPhaseChangeForPrimary_)/magSf_/time_.deltaT()
);
// Momentum
tmp<fvVectorMatrix> tUEqn
(
......@@ -459,12 +431,7 @@ Foam::surfaceFilmModels::kinematicSingleLayer::solveMomentum
USp_
+ tau(U_)
+ fvc::grad(sigma_)
- fvm::Sp
(
(massForPrimary_ + massPhaseChangeForPrimary_)
/magSf_/time_.deltaT(),
U_
)
+ fvm::SuSp(-mLossCoeff, U_)
);
fvVectorMatrix& UEqn = tUEqn();
......@@ -661,7 +628,6 @@ Foam::surfaceFilmModels::kinematicSingleLayer::kinematicSingleLayer
cumulativeContErr_(0.0),
Cf_(readScalar(coeffs_.lookup("Cf"))),
deltaStable_(coeffs_.lookup("deltaStable")),
initialisedThermo_(false),
rho_
......@@ -825,7 +791,7 @@ Foam::surfaceFilmModels::kinematicSingleLayer::kinematicSingleLayer
IOobject::NO_WRITE
),
filmRegion_,
dimensionedScalar("zero", dimMass, 0),
dimensionedScalar("zero", dimMass, 0.0),
zeroGradientFvPatchScalarField::typeName
),
......@@ -963,8 +929,7 @@ Foam::surfaceFilmModels::kinematicSingleLayer::kinematicSingleLayer
injection_(injectionModel::New(*this, coeffs_)),
addedMass_(0.0),
detachedMass_(0.0)
addedMass_(0.0)
{
initialise();
}
......@@ -1227,19 +1192,19 @@ void Foam::surfaceFilmModels::kinematicSingleLayer::info() const
<< returnReduce<scalar>(addedMass_, sumOp<scalar>()) << nl
<< indent << "current mass = "
<< gSum((deltaRho_*magSf_)()) << nl
<< indent << "detached mass = "
<< returnReduce<scalar>(detachedMass_, sumOp<scalar>()) << nl
<< indent << "min/max(mag(U)) = " << min(mag(U_)).value() << ", "
<< max(mag(U_)).value() << nl
<< indent << "min/max(delta) = " << min(delta_).value() << ", "
<< max(delta_).value() << nl;
injection_->info();
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::surfaceFilmModels::kinematicSingleLayer::Srho() const
{
tmp<DimensionedField<scalar, volMesh> > tSrho
return tmp<DimensionedField<scalar, volMesh> >
(
new DimensionedField<scalar, volMesh>
(
......@@ -1256,38 +1221,6 @@ Foam::surfaceFilmModels::kinematicSingleLayer::Srho() const
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;
}
......
......@@ -120,9 +120,6 @@ protected:
//- Skin frition coefficient for film/primary region interface
scalar Cf_;
//- Stable film thickness - film cannot detach until reached
dimensionedScalar deltaStable_;
// Thermo properties
......@@ -231,12 +228,6 @@ protected:
scalar addedMass_;
// Detached surface properties
//- Cumulative mass detached [kg]
scalar detachedMass_;
// Protected member functions
//- Initialise the film model - called on construction
......@@ -254,9 +245,6 @@ protected:
//- Transfer fields from the primary region to the film region
virtual void transferPrimaryRegionFields();
//- Correct the source terms for film that detaches from film region
virtual void correctDetachedFilm();
// Explicit pressure source contribution
virtual tmp<volScalarField> pu();
......
......@@ -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
{
// do nothing
......
......@@ -175,6 +175,23 @@ public:
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
//- Provide some feedback
......
......@@ -207,6 +207,12 @@ void Foam::surfaceFilmModels::thermoSingleLayer::solveEnergy()
updateSurfaceTemperatures();
volScalarField mLossCoeff
(
"mLossCoeff",
massForPrimary_/magSf_/time_.deltaT()
);
solve
(
fvm::ddt(deltaRho_, hs_)
......@@ -215,7 +221,7 @@ void Foam::surfaceFilmModels::thermoSingleLayer::solveEnergy()
// fvm::Sp(hsSp_/hs_, hs_)
hsSp_
+ q(hs_)
- fvm::Sp(massForPrimary_/magSf_/time_.deltaT(), hs_)
- fvm::Sp(mLossCoeff, hs_)
);
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::surfaceFilmModels::thermoSingleLayer::Srho(const label i) const
{
......
......@@ -317,6 +317,9 @@ public:
// 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
(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment