diff --git a/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C index 149dd60bf2..fbb3c322c5 100644 --- a/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C @@ -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 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(addedMass_, sumOp()) << nl << indent << "current mass = " << gSum((deltaRho_*magSf_)()) << nl - << indent << "detached mass = " - << returnReduce(detachedMass_, sumOp()) << 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::surfaceFilmModels::kinematicSingleLayer::Srho() const { - tmp > tSrho + return tmp > ( new DimensionedField ( @@ -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 - ( - 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; } diff --git a/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.H b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.H index cc9f6c7ef8..2dc3e41452 100644 --- a/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.H +++ b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.H @@ -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 pu(); diff --git a/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.C b/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.C index 103ab3bf6d..b277192e25 100644 --- a/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.C +++ b/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.C @@ -252,6 +252,75 @@ Foam::surfaceFilmModels::noFilm::massPhaseChangeForPrimary() const } +Foam::tmp > +Foam::surfaceFilmModels::noFilm::Srho() const +{ + return tmp > + ( + new DimensionedField + ( + IOobject + ( + "noFilm::Srho", + time_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh_, + dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) + ) + ); +} + + +Foam::tmp > +Foam::surfaceFilmModels::noFilm::Srho(const label) const +{ + return tmp > + ( + new DimensionedField + ( + 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::surfaceFilmModels::noFilm::Sh() const +{ + return tmp > + ( + new DimensionedField + ( + 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 diff --git a/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.H b/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.H index 7d5fb40021..e4616151fd 100644 --- a/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.H +++ b/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.H @@ -175,6 +175,23 @@ public: virtual void evolveFilm(); + // Source fields + + // Mapped into primary region + + //- Return total mass source - Eulerian phase only + virtual tmp > Srho() const; + + //- Return mass source for specie i - Eulerian phase only + virtual tmp > Srho + ( + const label i + ) const; + + //- Return enthalpy source - Eulerian phase only + virtual tmp > Sh() const; + + // I-O //- Provide some feedback diff --git a/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.C b/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.C index acff2f41a1..9110dd3570 100644 --- a/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.C +++ b/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.C @@ -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::surfaceFilmModels::thermoSingleLayer::Srho() const +{ + tmp > tSrho + ( + new DimensionedField + ( + 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 + ( + 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::surfaceFilmModels::thermoSingleLayer::Srho(const label i) const { diff --git a/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.H b/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.H index a5c5b892e7..5b35d67879 100644 --- a/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.H +++ b/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.H @@ -317,6 +317,9 @@ public: // Mapped into primary region + //- Return total mass source - Eulerian phase only + virtual tmp > Srho() const; + //- Return mass source for specie i - Eulerian phase only virtual tmp > Srho (