From ef9c6b5abce6cb46cd5d3c4aaf7822bbc6299d08 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 6 Sep 2017 14:20:58 +0100 Subject: [PATCH] ENH: kinematicSingleLayer: Refactored to remove "netMass" --- .../kinematicSingleLayer.C | 3 +- .../kinematicSingleLayer.H | 3 - .../kinematicSingleLayerI.H | 11 ---- .../thixotropicViscosity.C | 58 ++++++++++--------- 4 files changed, 33 insertions(+), 42 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index 58626e7a5c..a7e07f1447 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -890,8 +890,7 @@ void kinematicSingleLayer::preEvolveRegion() correctAlpha(); // Reset transfer fields - //availableMass_ = mass(); - availableMass_ = netMass(); + availableMass_ = mass(); cloudMassTrans_ == dimensionedScalar(dimMass, Zero); cloudDiameterTrans_ == dimensionedScalar(dimLength, Zero); primaryMassTrans_ == dimensionedScalar(dimMass, Zero); diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H index d839fe7da0..5c358ed7b4 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H @@ -489,9 +489,6 @@ public: //- Return the current film mass inline tmp mass() const; - //- Return the net film mass available over the next integration - inline tmp netMass() const; - //- Return the change in film mass due to sources/sinks inline tmp deltaMass() const; diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H index 2a3983eb55..db51f1b89b 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H @@ -200,17 +200,6 @@ inline tmp kinematicSingleLayer::mass() const } -inline tmp kinematicSingleLayer::netMass() const -{ - return - fvc::surfaceSum - ( - pos0(phi_)*phi_/(fvc::interpolate(delta_) + deltaSmall_) - )*time().deltaT() - + rho_*delta_*magSf(); -} - - inline tmp kinematicSingleLayer::deltaMass() const { return rhoSp_*magSf()*time().deltaT(); diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.C index d4c08e9b98..548558cd26 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.C @@ -69,7 +69,7 @@ thixotropicViscosity::thixotropicViscosity c_("c", pow(dimTime, d_.value() - scalar(1)), coeffDict_), mu0_("mu0", dimPressure*dimTime, coeffDict_), muInf_("muInf", mu0_.dimensions(), coeffDict_), - K_(1.0 - Foam::sqrt(muInf_/mu0_)), + K_(1 - sqrt(muInf_/mu0_)), lambda_ ( IOobject @@ -83,8 +83,8 @@ thixotropicViscosity::thixotropicViscosity film.regionMesh() ) { - lambda_.min(1.0); - lambda_.max(0.0); + lambda_.min(1); + lambda_.max(0); // Initialise viscosity to inf value because it cannot be evaluated yet mu_ = muInf_; @@ -108,7 +108,6 @@ void thixotropicViscosity::correct { const kinematicSingleLayer& film = filmType(); - // references to film fields const volVectorField& U = film.U(); const volVectorField& Uw = film.Uw(); const volScalarField& delta = film.delta(); @@ -118,50 +117,57 @@ void thixotropicViscosity::correct const Time& runTime = this->film().regionMesh().time(); // Shear rate - volScalarField gDot("gDot", alpha*mag(U - Uw)/(delta + film.deltaSmall())); + const volScalarField gDot + ( + "gDot", + alpha*mag(U - Uw)/(delta + film.deltaSmall()) + ); if (debug && runTime.writeTime()) { gDot.write(); } - dimensionedScalar deltaRho0("deltaRho0", deltaRho.dimensions(), ROOTVSMALL); - surfaceScalarField phiU(phi/fvc::interpolate(deltaRho + deltaRho0)); - - dimensionedScalar c0("c0", dimless/dimTime, ROOTVSMALL); - volScalarField coeff("coeff", -c_*pow(gDot, d_) + c0); - - // Limit the filmMass and deltaMass to calculate the effect of the added - // droplets with lambda = 0 to the film - const volScalarField filmMass + const dimensionedScalar deltaRho0 ( - "thixotropicViscosity:filmMass", - film.netMass() + dimensionedScalar("SMALL", dimMass, ROOTVSMALL) - ); - const volScalarField deltaMass - ( - "thixotropicViscosity:deltaMass", - max(dimensionedScalar(dimMass, Zero), film.deltaMass()) + "deltaRho0", + deltaRho.dimensions(), + ROOTVSMALL ); + const surfaceScalarField phiU(phi/fvc::interpolate(deltaRho + deltaRho0)); + + const dimensionedScalar c0("c0", dimless/dimTime, ROOTVSMALL); + const volScalarField coeff("coeff", -c_*pow(gDot, d_) + c0); + fvScalarMatrix lambdaEqn ( fvm::ddt(lambda_) + fvm::div(phiU, lambda_) - fvm::Sp(fvc::div(phiU), lambda_) == - a_*pow((1.0 - lambda_), b_) + a_*pow((1 - lambda_), b_) + fvm::SuSp(coeff, lambda_) - - fvm::Sp(deltaMass/(runTime.deltaT()*filmMass), lambda_) + + // Include the effect of the impinging droplets added with lambda = 0 + - fvm::Sp + ( + max + ( + film.rhoSp(), + dimensionedScalar("zero", film.rhoSp().dimensions(), 0) + )/(deltaRho + deltaRho0), + lambda_ + ) ); lambdaEqn.relax(); lambdaEqn.solve(); - lambda_.min(1.0); - lambda_.max(0.0); + lambda_.min(1); + lambda_.max(0); - mu_ = muInf_/(sqr(1.0 - K_*lambda_) + ROOTVSMALL); + mu_ = muInf_/(sqr(1 - K_*lambda_) + ROOTVSMALL); mu_.correctBoundaryConditions(); }