From f6830c206de9cd1ea91d108f443db0002044c1c0 Mon Sep 17 00:00:00 2001 From: graham Date: Thu, 21 Apr 2011 10:29:22 +0100 Subject: [PATCH] STYLE: Line endings, trailing whitespace. Caught by pre-commit hook on branch merge. --- .../multiphase/cavitatingFoam/readControls.H | 1 - .../kinematicSingleLayer.C | 2262 ++++++++--------- .../kinematicSingleLayer.H | 1046 ++++---- .../curvatureSeparation/curvatureSeparation.H | 2 +- .../phaseChangeModel/phaseChangeModel.C | 2 +- .../reactingParcelFilmFoam/cylinder/0.org/0/U | 2 +- .../reactingParcelFilmFoam/cylinder/0.org/U | 2 +- .../reactingParcelFilmFoam/cylinder/0/0/U | 2 +- .../reactingParcelFilmFoam/cylinder/0/U | 2 +- .../reactingParcelFilmFoam/cylinder/Allclean | 1 - .../reactingParcelFilmFoam/cylinder/Allrun | 1 - .../cylinder/Allrun.pre | 1 - .../cylinder/constant/foam.inp | 1 - .../cylinder/constant/polyMesh.save/boundary | 2 +- .../cylinder/constant/polyMesh.save/faceZones | 2 +- .../constant/polyMesh.save/sets/wallFilmFaces | 400 +-- .../cylinder/constant/polyMesh/boundary | 2 +- .../cylinder/wallFilmRegion.setSet | 1 - .../hotBoxes/Allrun.pre | 1 - .../hotBoxes/constant/surfaceFilmProperties | 2 +- .../hotBoxes/patchifyObstacles | 10 +- .../splashPanel/0.org/U | 2 +- .../reactingParcelFilmFoam/splashPanel/0/U | 2 +- .../splashPanel/Allclean | 1 - .../reactingParcelFilmFoam/splashPanel/Allrun | 1 - .../splashPanel/Allrun.pre | 1 - .../splashPanel/constant/foam.inp | 1 - .../splashPanel/constant/polyMesh/boundary | 2 +- .../createWallFilmRegionPatches.setSet | 1 - .../system/wallFilmRegion/createPatchDict | 4 +- 30 files changed, 1874 insertions(+), 1886 deletions(-) diff --git a/applications/solvers/multiphase/cavitatingFoam/readControls.H b/applications/solvers/multiphase/cavitatingFoam/readControls.H index 0dd2b77780..234478955b 100644 --- a/applications/solvers/multiphase/cavitatingFoam/readControls.H +++ b/applications/solvers/multiphase/cavitatingFoam/readControls.H @@ -4,4 +4,3 @@ scalar maxAcousticCo ( readScalar(runTime.controlDict().lookup("maxAcousticCo")) ); - diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index d5c5471e66..81bc701c4e 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -1,1131 +1,1131 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "kinematicSingleLayer.H" -#include "fvm.H" -#include "fvcDiv.H" -#include "fvcLaplacian.H" -#include "fvcSnGrad.H" -#include "fvcReconstruct.H" -#include "fvcVolumeIntegrate.H" -#include "addToRunTimeSelectionTable.H" -#include "directMappedWallPolyPatch.H" -#include "mapDistribute.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace regionModels -{ -namespace surfaceFilmModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(kinematicSingleLayer, 0); - -addToRunTimeSelectionTable(surfaceFilmModel, kinematicSingleLayer, mesh); - -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -bool kinematicSingleLayer::read() -{ - if (surfaceFilmModel::read()) - { - const dictionary& solution = this->solution().subDict("PISO"); - solution.lookup("momentumPredictor") >> momentumPredictor_; - solution.lookup("nOuterCorr") >> nOuterCorr_; - solution.lookup("nCorr") >> nCorr_; - solution.lookup("nNonOrthCorr") >> nNonOrthCorr_; - - coeffs_.lookup("Cf") >> Cf_; - - return true; - } - else - { - return false; - } -} - - -void kinematicSingleLayer::correctThermoFields() -{ - if (thermoModel_ == tmConstant) - { - rho_ == dimensionedScalar(coeffs_.lookup("rho0")); - mu_ == dimensionedScalar(coeffs_.lookup("mu0")); - sigma_ == dimensionedScalar(coeffs_.lookup("sigma0")); - } - else - { - FatalErrorIn - ( - "void Foam::surfaceFilmModels::kinematicSingleLayer::" - "correctThermo()" - ) << "Kinematic surface film must use " - << thermoModelTypeNames_[thermoModel_] << "thermodynamics" << endl; - } -} - - -void kinematicSingleLayer::resetPrimaryRegionSourceTerms() -{ - if (debug) - { - Info<< "kinematicSingleLayer::resetPrimaryRegionSourceTerms()" << endl; - } - - rhoSpPrimary_ == dimensionedScalar("zero", rhoSp_.dimensions(), 0.0); - USpPrimary_ == dimensionedVector("zero", USp_.dimensions(), vector::zero); - pSpPrimary_ == dimensionedScalar("zero", pSp_.dimensions(), 0.0); -} - - -void kinematicSingleLayer::transferPrimaryRegionThermoFields() -{ - if (debug) - { - Info<< "kinematicSingleLayer::" - << "transferPrimaryRegionThermoFields()" << endl; - } - // Update fields from primary region via direct mapped - // (coupled) boundary conditions - UPrimary_.correctBoundaryConditions(); - pPrimary_.correctBoundaryConditions(); - rhoPrimary_.correctBoundaryConditions(); - muPrimary_.correctBoundaryConditions(); -} - - -void kinematicSingleLayer::transferPrimaryRegionSourceFields() -{ - if (debug) - { - Info<< "kinematicSingleLayer::" - << "transferPrimaryRegionSourceFields()" << endl; - } - - // Retrieve the source fields from the primary region via direct mapped - // (coupled) boundary conditions - // - fields require transfer of values for both patch AND to push the - // values into the first layer of internal cells - rhoSp_.correctBoundaryConditions(); - USp_.correctBoundaryConditions(); - pSp_.correctBoundaryConditions(); - - // Convert accummulated source terms into per unit area per unit time - // Note: boundary values will still have original (neat) values - const scalar deltaT = time_.deltaTValue(); - rhoSp_.field() /= magSf()*deltaT; - USp_.field() /= magSf()*deltaT; - pSp_.field() /= magSf()*deltaT; -} - - -tmp kinematicSingleLayer::pu() -{ - return tmp - ( - new volScalarField - ( - IOobject - ( - "pu", - time_.timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - pPrimary_ // pressure (mapped from primary region) - - pSp_ // accumulated particle impingement - - fvc::laplacian(sigma_, delta_) // surface tension - ) - ); -} - - -tmp kinematicSingleLayer::pp() -{ - return tmp - ( - new volScalarField - ( - IOobject - ( - "pp", - time_.timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - -rho_*gNormClipped() // hydrostatic effect only - ) - ); -} - - -void kinematicSingleLayer::updateSubmodels() -{ - if (debug) - { - Info<< "kinematicSingleLayer::updateSubmodels()" << endl; - } - - // Update injection model - mass returned is mass available for injection - injection_.correct(availableMass_, cloudMassTrans_, cloudDiameterTrans_); - - // Update source fields - const dimensionedScalar deltaT = time().deltaT(); - rhoSp_ += cloudMassTrans_/magSf()/deltaT; -} - - -void kinematicSingleLayer::continuityCheck() -{ - const volScalarField deltaRho0(deltaRho_); - - solveContinuity(); - - if (debug) - { - const volScalarField mass(deltaRho_*magSf()); - const dimensionedScalar totalMass = - fvc::domainIntegrate(mass) - + dimensionedScalar("SMALL", dimMass*dimVolume, ROOTVSMALL); - - const scalar sumLocalContErr = - ( - fvc::domainIntegrate(mag(mass - magSf()*deltaRho0))/totalMass - ).value(); - - const scalar globalContErr = - ( - fvc::domainIntegrate(mass - magSf()*deltaRho0)/totalMass - ).value(); - - cumulativeContErr_ += globalContErr; - - Info<< "Surface film: " << type() << nl - << " time step continuity errors: sum local = " - << sumLocalContErr << ", global = " << globalContErr - << ", cumulative = " << cumulativeContErr_ << endl; - } -} - - -void kinematicSingleLayer::solveContinuity() -{ - if (debug) - { - Info<< "kinematicSingleLayer::solveContinuity()" << endl; - } - - solve - ( - fvm::ddt(deltaRho_) - + fvc::div(phi_) - == - - rhoSp_ - ); -} - - -void kinematicSingleLayer::updateSurfaceVelocities() -{ - // Push boundary film velocity values into internal field - for (label i=0; i(Uw_, pp.faceCells()) = - U_.boundaryField()[patchI]; - } - Uw_ -= nHat()*(Uw_ & nHat()); - Uw_.correctBoundaryConditions(); - - // TODO: apply quadratic profile to determine surface velocity - Us_ = U_; - Us_.correctBoundaryConditions(); -} - - -tmp kinematicSingleLayer::tau(volVectorField& U) const -{ - // Calculate shear stress - volScalarField Cs("Cs", rho_*Cf_*mag(Us_ - U)); - volScalarField Cw - ( - "Cw", - mu_/(0.3333*(delta_ + dimensionedScalar("SMALL", dimLength, SMALL))) - ); - Cw.min(1.0e+06); - - return - ( - - fvm::Sp(Cs, U) + Cs*Us_ // surface contribution - - fvm::Sp(Cw, U) + Cw*Uw_ // wall contribution - ); -} - - -tmp kinematicSingleLayer::solveMomentum -( - const volScalarField& pu, - const volScalarField& pp -) -{ - if (debug) - { - Info<< "kinematicSingleLayer::solveMomentum()" << endl; - } - - updateSurfaceVelocities(); - - // Momentum - tmp tUEqn - ( - fvm::ddt(deltaRho_, U_) - + fvm::div(phi_, U_) - == - - USp_ - + tau(U_) - + fvc::grad(sigma_) - - fvm::SuSp(rhoSp_, U_) - ); - - fvVectorMatrix& UEqn = tUEqn(); - - UEqn.relax(); - - if (momentumPredictor_) - { - solve - ( - UEqn - == - fvc::reconstruct - ( - - fvc::interpolate(delta_) - * ( - regionMesh().magSf() - * ( - fvc::snGrad(pu, "snGrad(p)") - + fvc::snGrad(pp, "snGrad(p)")*fvc::interpolate(delta_) - + fvc::snGrad(delta_)*fvc::interpolate(pp) - ) - - (fvc::interpolate(rho_*gTan()) & regionMesh().Sf()) - ) - ) - ); - - // Remove any patch-normal components of velocity - U_ -= nHat()*(nHat() & U_); - U_.correctBoundaryConditions(); - } - - return tUEqn; -} - - -void kinematicSingleLayer::solveThickness -( - const volScalarField& pu, - const volScalarField& pp, - const fvVectorMatrix& UEqn -) -{ - if (debug) - { - Info<< "kinematicSingleLayer::solveThickness()" << endl; - } - - volScalarField rUA(1.0/UEqn.A()); - U_ = rUA*UEqn.H(); - - surfaceScalarField deltarUAf(fvc::interpolate(delta_*rUA)); - surfaceScalarField rhof(fvc::interpolate(rho_)); - - surfaceScalarField phiAdd - ( - "phiAdd", - regionMesh().magSf() - * ( - fvc::snGrad(pu, "snGrad(p)") - + fvc::snGrad(pp, "snGrad(p)")*fvc::interpolate(delta_) - ) - - (fvc::interpolate(rho_*gTan()) & regionMesh().Sf()) - ); - constrainFilmField(phiAdd, 0.0); - - surfaceScalarField phid - ( - "phid", - (fvc::interpolate(U_*rho_) & regionMesh().Sf()) - - deltarUAf*phiAdd*rhof - ); - constrainFilmField(phid, 0.0); - - surfaceScalarField ddrhorUAppf - ( - "deltaCoeff", - fvc::interpolate(delta_)*deltarUAf*rhof*fvc::interpolate(pp) - ); -// constrainFilmField(ddrhorUAppf, 0.0); - - for (int nonOrth=0; nonOrth<=nNonOrthCorr_; nonOrth++) - { - // Film thickness equation - fvScalarMatrix deltaEqn - ( - fvm::ddt(rho_, delta_) - + fvm::div(phid, delta_) - - fvm::laplacian(ddrhorUAppf, delta_) - == - - rhoSp_ - ); - - deltaEqn.solve(); - - if (nonOrth == nNonOrthCorr_) - { - phiAdd += - fvc::interpolate(pp) - * fvc::snGrad(delta_) - * regionMesh().magSf(); - - phi_ == deltaEqn.flux(); - } - } - - // Bound film thickness by a minimum of zero - delta_.max(0.0); - - // Update U field - U_ -= fvc::reconstruct(deltarUAf*phiAdd); - - // Remove any patch-normal components of velocity - U_ -= nHat()*(nHat() & U_); - - U_.correctBoundaryConditions(); - - // Continuity check - continuityCheck(); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -kinematicSingleLayer::kinematicSingleLayer -( - const word& modelType, - const fvMesh& mesh, - const dimensionedVector& g, - const bool readFields -) -: - surfaceFilmModel(modelType, mesh, g), - - momentumPredictor_(solution().subDict("PISO").lookup("momentumPredictor")), - nOuterCorr_(readLabel(solution().subDict("PISO").lookup("nOuterCorr"))), - nCorr_(readLabel(solution().subDict("PISO").lookup("nCorr"))), - nNonOrthCorr_ - ( - readLabel(solution().subDict("PISO").lookup("nNonOrthCorr")) - ), - - cumulativeContErr_(0.0), - - Cf_(readScalar(coeffs().lookup("Cf"))), - - rho_ - ( - IOobject - ( - "rhof", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimDensity, 0.0), - zeroGradientFvPatchScalarField::typeName - ), - mu_ - ( - IOobject - ( - "muf", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimPressure*dimTime, 0.0), - zeroGradientFvPatchScalarField::typeName - ), - sigma_ - ( - IOobject - ( - "sigmaf", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimMass/sqr(dimTime), 0.0), - zeroGradientFvPatchScalarField::typeName - ), - - delta_ - ( - IOobject - ( - "deltaf", - time().timeName(), - regionMesh(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - regionMesh() - ), - U_ - ( - IOobject - ( - "Uf", - time().timeName(), - regionMesh(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - regionMesh() - ), - Us_ - ( - IOobject - ( - "Usf", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - U_, - zeroGradientFvPatchScalarField::typeName - ), - Uw_ - ( - IOobject - ( - "Uwf", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - U_, - zeroGradientFvPatchScalarField::typeName - ), - deltaRho_ - ( - IOobject - ( - delta_.name() + "*" + rho_.name(), - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", delta_.dimensions()*rho_.dimensions(), 0.0), - zeroGradientFvPatchScalarField::typeName - ), - - phi_ - ( - IOobject - ( - "phi", - time().timeName(), - regionMesh(), - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - regionMesh(), - dimLength*dimMass/dimTime - ), - - primaryMassTrans_ - ( - IOobject - ( - "primaryMassTrans", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimMass, 0.0), - zeroGradientFvPatchScalarField::typeName - ), - cloudMassTrans_ - ( - IOobject - ( - "cloudMassTrans", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimMass, 0.0), - zeroGradientFvPatchScalarField::typeName - ), - cloudDiameterTrans_ - ( - IOobject - ( - "cloudDiameterTrans", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimLength, -1.0), - zeroGradientFvPatchScalarField::typeName - ), - - USp_ - ( - IOobject - ( - "USpf", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - regionMesh(), - dimensionedVector - ( - "zero", dimMass*dimVelocity/dimArea/dimTime, vector::zero - ), - this->mappedPushedFieldPatchTypes() - ), - pSp_ - ( - IOobject - ( - "pSpf", - time_.timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimPressure, 0.0), - this->mappedPushedFieldPatchTypes() - ), - rhoSp_ - ( - IOobject - ( - "rhoSpf", - time_.timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimMass/dimTime/dimArea, 0.0), - this->mappedPushedFieldPatchTypes() - ), - - USpPrimary_ - ( - IOobject - ( - USp_.name(), // must have same name as USp_ to enable mapping - time().timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - primaryMesh(), - dimensionedVector("zero", USp_.dimensions(), vector::zero) - ), - pSpPrimary_ - ( - IOobject - ( - pSp_.name(), // must have same name as pSp_ to enable mapping - time().timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - primaryMesh(), - dimensionedScalar("zero", pSp_.dimensions(), 0.0) - ), - rhoSpPrimary_ - ( - IOobject - ( - rhoSp_.name(), // must have same name as rhoSp_ to enable mapping - time().timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - primaryMesh(), - dimensionedScalar("zero", rhoSp_.dimensions(), 0.0) - ), - - UPrimary_ - ( - IOobject - ( - "U", // must have same name as U to enable mapping - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - regionMesh(), - dimensionedVector("zero", dimVelocity, vector::zero), - this->mappedFieldAndInternalPatchTypes() - ), - pPrimary_ - ( - IOobject - ( - "p", // must have same name as p to enable mapping - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimPressure, 0.0), - this->mappedFieldAndInternalPatchTypes() - ), - rhoPrimary_ - ( - IOobject - ( - "rho", // must have same name as rho to enable mapping - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimDensity, 0.0), - this->mappedFieldAndInternalPatchTypes() - ), - muPrimary_ - ( - IOobject - ( - "mu", // must have same name as mu to enable mapping - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimPressure*dimTime, 0.0), - this->mappedFieldAndInternalPatchTypes() - ), - - availableMass_(regionMesh().nCells(), 0.0), - - injection_(*this, coeffs_), - - addedMassTotal_(0.0) -{ - if (readFields) - { - transferPrimaryRegionThermoFields(); - - correctThermoFields(); - - deltaRho_ == delta_*rho_; - phi_ = fvc::interpolate(deltaRho_*U_) & regionMesh().Sf(); - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -kinematicSingleLayer::~kinematicSingleLayer() -{} - - -// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // - -void kinematicSingleLayer::addSources -( - const label patchI, - const label faceI, - const scalar massSource, - const vector& momentumSource, - const scalar pressureSource, - const scalar energySource -) -{ - if (debug) - { - Info<< "\nSurface film: " << type() << ": adding to film source:" << nl - << " mass = " << massSource << nl - << " momentum = " << momentumSource << nl - << " pressure = " << pressureSource << endl; - } - - rhoSpPrimary_.boundaryField()[patchI][faceI] -= massSource; - USpPrimary_.boundaryField()[patchI][faceI] -= momentumSource; - pSpPrimary_.boundaryField()[patchI][faceI] -= pressureSource; - - addedMassTotal_ += massSource; -} - - -void kinematicSingleLayer::preEvolveRegion() -{ - if (debug) - { - Info<< "kinematicSingleLayer::preEvolveRegion()" << endl; - } - - transferPrimaryRegionThermoFields(); - - correctThermoFields(); - - transferPrimaryRegionSourceFields(); - - // Reset transfer fields -// availableMass_ = mass(); - availableMass_ = netMass(); - cloudMassTrans_ == dimensionedScalar("zero", dimMass, 0.0); - cloudDiameterTrans_ == dimensionedScalar("zero", dimLength, -1.0); -} - - -void kinematicSingleLayer::evolveRegion() -{ - if (debug) - { - Info<< "kinematicSingleLayer::evolveRegion()" << endl; - } - - updateSubmodels(); - - // Solve continuity for deltaRho_ - solveContinuity(); - - // Implicit pressure source coefficient - constant - tmp tpp(this->pp()); - - for (int oCorr=0; oCorr tpu(this->pu()); - - // Solve for momentum for U_ - tmp UEqn = solveMomentum(tpu(), tpp()); - - // Film thickness correction loop - for (int corr=1; corr<=nCorr_; corr++) - { - // Solve thickness for delta_ - solveThickness(tpu(), tpp(), UEqn()); - } - } - - // Update deltaRho_ with new delta_ - deltaRho_ == delta_*rho_; - - // Update film wall and surface velocities - updateSurfaceVelocities(); - - // Reset source terms for next time integration - resetPrimaryRegionSourceTerms(); -} - - -scalar kinematicSingleLayer::CourantNumber() const -{ - scalar CoNum = 0.0; - - if (regionMesh().nInternalFaces() > 0) - { - const scalar deltaT = time_.deltaTValue(); - - const surfaceScalarField SfUfbyDelta - ( - regionMesh().surfaceInterpolation::deltaCoeffs()*mag(phi_) - ); - const surfaceScalarField rhoDelta(fvc::interpolate(rho_*delta_)); - const surfaceScalarField& magSf = regionMesh().magSf(); - - forAll(rhoDelta, i) - { - if (rhoDelta[i] > ROOTVSMALL) - { - CoNum = max(CoNum, SfUfbyDelta[i]/rhoDelta[i]/magSf[i]*deltaT); - } - } - } - - reduce(CoNum, maxOp()); - - Info<< "Film max Courant number: " << CoNum << endl; - - return CoNum; -} - - -const volVectorField& kinematicSingleLayer::U() const -{ - return U_; -} - - -const volVectorField& kinematicSingleLayer::Us() const -{ - return Us_; -} - - -const volVectorField& kinematicSingleLayer::Uw() const -{ - return Uw_; -} - - -const surfaceScalarField& kinematicSingleLayer::phi() const -{ - return phi_; -} - - -const volScalarField& kinematicSingleLayer::rho() const -{ - return rho_; -} - - -const volScalarField& kinematicSingleLayer::T() const -{ - FatalErrorIn - ( - "const volScalarField& kinematicSingleLayer::T() const" - ) << "T field not available for " << type() << abort(FatalError); - - return volScalarField::null(); -} - - -const volScalarField& kinematicSingleLayer::Ts() const -{ - FatalErrorIn - ( - "const volScalarField& kinematicSingleLayer::Ts() const" - ) << "Ts field not available for " << type() << abort(FatalError); - - return volScalarField::null(); -} - - -const volScalarField& kinematicSingleLayer::Tw() const -{ - FatalErrorIn - ( - "const volScalarField& kinematicSingleLayer::Tw() const" - ) << "Tw field not available for " << type() << abort(FatalError); - - return volScalarField::null(); -} - - -const volScalarField& kinematicSingleLayer::Cp() const -{ - FatalErrorIn - ( - "const volScalarField& kinematicSingleLayer::Cp() const" - ) << "Cp field not available for " << type() << abort(FatalError); - - return volScalarField::null(); -} - - -const volScalarField& kinematicSingleLayer::kappa() const -{ - FatalErrorIn - ( - "const volScalarField& kinematicSingleLayer::kappa() const" - ) << "kappa field not available for " << type() << abort(FatalError); - - return volScalarField::null(); -} - - -tmp kinematicSingleLayer::primaryMassTrans() const -{ - return tmp - ( - new volScalarField - ( - IOobject - ( - "kinematicSingleLayer::primaryMassTrans", - time().timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - primaryMesh(), - dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) - ) - ); -} - - -const volScalarField& kinematicSingleLayer::cloudMassTrans() const -{ - return cloudMassTrans_; -} - - -const volScalarField& kinematicSingleLayer::cloudDiameterTrans() const -{ - return cloudDiameterTrans_; -} - - -void kinematicSingleLayer::info() const -{ - Info<< "\nSurface film: " << type() << endl; - - Info<< indent << "added mass = " - << returnReduce(addedMassTotal_, sumOp()) << nl - << indent << "current mass = " - << gSum((deltaRho_*magSf())()) << 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(Info); -} - - -tmp > kinematicSingleLayer::Srho() const -{ - return tmp > - ( - new DimensionedField - ( - IOobject - ( - "kinematicSingleLayer::Srho", - time().timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - primaryMesh(), - dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) - ) - ); -} - - -tmp > kinematicSingleLayer::Srho -( - const label i -) const -{ - return tmp > - ( - new DimensionedField - ( - IOobject - ( - "kinematicSingleLayer::Srho(" + Foam::name(i) + ")", - time().timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - primaryMesh(), - dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) - ) - ); -} - - -tmp > kinematicSingleLayer::Sh() const -{ - return tmp > - ( - new DimensionedField - ( - IOobject - ( - "kinematicSingleLayer::Sh", - time().timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - primaryMesh(), - dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0) - ) - ); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace surfaceFilmModels -} // End namespace regionModels -} // End namespace Foam - -// ************************************************************************* // +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "kinematicSingleLayer.H" +#include "fvm.H" +#include "fvcDiv.H" +#include "fvcLaplacian.H" +#include "fvcSnGrad.H" +#include "fvcReconstruct.H" +#include "fvcVolumeIntegrate.H" +#include "addToRunTimeSelectionTable.H" +#include "directMappedWallPolyPatch.H" +#include "mapDistribute.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(kinematicSingleLayer, 0); + +addToRunTimeSelectionTable(surfaceFilmModel, kinematicSingleLayer, mesh); + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +bool kinematicSingleLayer::read() +{ + if (surfaceFilmModel::read()) + { + const dictionary& solution = this->solution().subDict("PISO"); + solution.lookup("momentumPredictor") >> momentumPredictor_; + solution.lookup("nOuterCorr") >> nOuterCorr_; + solution.lookup("nCorr") >> nCorr_; + solution.lookup("nNonOrthCorr") >> nNonOrthCorr_; + + coeffs_.lookup("Cf") >> Cf_; + + return true; + } + else + { + return false; + } +} + + +void kinematicSingleLayer::correctThermoFields() +{ + if (thermoModel_ == tmConstant) + { + rho_ == dimensionedScalar(coeffs_.lookup("rho0")); + mu_ == dimensionedScalar(coeffs_.lookup("mu0")); + sigma_ == dimensionedScalar(coeffs_.lookup("sigma0")); + } + else + { + FatalErrorIn + ( + "void Foam::surfaceFilmModels::kinematicSingleLayer::" + "correctThermo()" + ) << "Kinematic surface film must use " + << thermoModelTypeNames_[thermoModel_] << "thermodynamics" << endl; + } +} + + +void kinematicSingleLayer::resetPrimaryRegionSourceTerms() +{ + if (debug) + { + Info<< "kinematicSingleLayer::resetPrimaryRegionSourceTerms()" << endl; + } + + rhoSpPrimary_ == dimensionedScalar("zero", rhoSp_.dimensions(), 0.0); + USpPrimary_ == dimensionedVector("zero", USp_.dimensions(), vector::zero); + pSpPrimary_ == dimensionedScalar("zero", pSp_.dimensions(), 0.0); +} + + +void kinematicSingleLayer::transferPrimaryRegionThermoFields() +{ + if (debug) + { + Info<< "kinematicSingleLayer::" + << "transferPrimaryRegionThermoFields()" << endl; + } + // Update fields from primary region via direct mapped + // (coupled) boundary conditions + UPrimary_.correctBoundaryConditions(); + pPrimary_.correctBoundaryConditions(); + rhoPrimary_.correctBoundaryConditions(); + muPrimary_.correctBoundaryConditions(); +} + + +void kinematicSingleLayer::transferPrimaryRegionSourceFields() +{ + if (debug) + { + Info<< "kinematicSingleLayer::" + << "transferPrimaryRegionSourceFields()" << endl; + } + + // Retrieve the source fields from the primary region via direct mapped + // (coupled) boundary conditions + // - fields require transfer of values for both patch AND to push the + // values into the first layer of internal cells + rhoSp_.correctBoundaryConditions(); + USp_.correctBoundaryConditions(); + pSp_.correctBoundaryConditions(); + + // Convert accummulated source terms into per unit area per unit time + // Note: boundary values will still have original (neat) values + const scalar deltaT = time_.deltaTValue(); + rhoSp_.field() /= magSf()*deltaT; + USp_.field() /= magSf()*deltaT; + pSp_.field() /= magSf()*deltaT; +} + + +tmp kinematicSingleLayer::pu() +{ + return tmp + ( + new volScalarField + ( + IOobject + ( + "pu", + time_.timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + pPrimary_ // pressure (mapped from primary region) + - pSp_ // accumulated particle impingement + - fvc::laplacian(sigma_, delta_) // surface tension + ) + ); +} + + +tmp kinematicSingleLayer::pp() +{ + return tmp + ( + new volScalarField + ( + IOobject + ( + "pp", + time_.timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + -rho_*gNormClipped() // hydrostatic effect only + ) + ); +} + + +void kinematicSingleLayer::updateSubmodels() +{ + if (debug) + { + Info<< "kinematicSingleLayer::updateSubmodels()" << endl; + } + + // Update injection model - mass returned is mass available for injection + injection_.correct(availableMass_, cloudMassTrans_, cloudDiameterTrans_); + + // Update source fields + const dimensionedScalar deltaT = time().deltaT(); + rhoSp_ += cloudMassTrans_/magSf()/deltaT; +} + + +void kinematicSingleLayer::continuityCheck() +{ + const volScalarField deltaRho0(deltaRho_); + + solveContinuity(); + + if (debug) + { + const volScalarField mass(deltaRho_*magSf()); + const dimensionedScalar totalMass = + fvc::domainIntegrate(mass) + + dimensionedScalar("SMALL", dimMass*dimVolume, ROOTVSMALL); + + const scalar sumLocalContErr = + ( + fvc::domainIntegrate(mag(mass - magSf()*deltaRho0))/totalMass + ).value(); + + const scalar globalContErr = + ( + fvc::domainIntegrate(mass - magSf()*deltaRho0)/totalMass + ).value(); + + cumulativeContErr_ += globalContErr; + + Info<< "Surface film: " << type() << nl + << " time step continuity errors: sum local = " + << sumLocalContErr << ", global = " << globalContErr + << ", cumulative = " << cumulativeContErr_ << endl; + } +} + + +void kinematicSingleLayer::solveContinuity() +{ + if (debug) + { + Info<< "kinematicSingleLayer::solveContinuity()" << endl; + } + + solve + ( + fvm::ddt(deltaRho_) + + fvc::div(phi_) + == + - rhoSp_ + ); +} + + +void kinematicSingleLayer::updateSurfaceVelocities() +{ + // Push boundary film velocity values into internal field + for (label i=0; i(Uw_, pp.faceCells()) = + U_.boundaryField()[patchI]; + } + Uw_ -= nHat()*(Uw_ & nHat()); + Uw_.correctBoundaryConditions(); + + // TODO: apply quadratic profile to determine surface velocity + Us_ = U_; + Us_.correctBoundaryConditions(); +} + + +tmp kinematicSingleLayer::tau(volVectorField& U) const +{ + // Calculate shear stress + volScalarField Cs("Cs", rho_*Cf_*mag(Us_ - U)); + volScalarField Cw + ( + "Cw", + mu_/(0.3333*(delta_ + dimensionedScalar("SMALL", dimLength, SMALL))) + ); + Cw.min(1.0e+06); + + return + ( + - fvm::Sp(Cs, U) + Cs*Us_ // surface contribution + - fvm::Sp(Cw, U) + Cw*Uw_ // wall contribution + ); +} + + +tmp kinematicSingleLayer::solveMomentum +( + const volScalarField& pu, + const volScalarField& pp +) +{ + if (debug) + { + Info<< "kinematicSingleLayer::solveMomentum()" << endl; + } + + updateSurfaceVelocities(); + + // Momentum + tmp tUEqn + ( + fvm::ddt(deltaRho_, U_) + + fvm::div(phi_, U_) + == + - USp_ + + tau(U_) + + fvc::grad(sigma_) + - fvm::SuSp(rhoSp_, U_) + ); + + fvVectorMatrix& UEqn = tUEqn(); + + UEqn.relax(); + + if (momentumPredictor_) + { + solve + ( + UEqn + == + fvc::reconstruct + ( + - fvc::interpolate(delta_) + * ( + regionMesh().magSf() + * ( + fvc::snGrad(pu, "snGrad(p)") + + fvc::snGrad(pp, "snGrad(p)")*fvc::interpolate(delta_) + + fvc::snGrad(delta_)*fvc::interpolate(pp) + ) + - (fvc::interpolate(rho_*gTan()) & regionMesh().Sf()) + ) + ) + ); + + // Remove any patch-normal components of velocity + U_ -= nHat()*(nHat() & U_); + U_.correctBoundaryConditions(); + } + + return tUEqn; +} + + +void kinematicSingleLayer::solveThickness +( + const volScalarField& pu, + const volScalarField& pp, + const fvVectorMatrix& UEqn +) +{ + if (debug) + { + Info<< "kinematicSingleLayer::solveThickness()" << endl; + } + + volScalarField rUA(1.0/UEqn.A()); + U_ = rUA*UEqn.H(); + + surfaceScalarField deltarUAf(fvc::interpolate(delta_*rUA)); + surfaceScalarField rhof(fvc::interpolate(rho_)); + + surfaceScalarField phiAdd + ( + "phiAdd", + regionMesh().magSf() + * ( + fvc::snGrad(pu, "snGrad(p)") + + fvc::snGrad(pp, "snGrad(p)")*fvc::interpolate(delta_) + ) + - (fvc::interpolate(rho_*gTan()) & regionMesh().Sf()) + ); + constrainFilmField(phiAdd, 0.0); + + surfaceScalarField phid + ( + "phid", + (fvc::interpolate(U_*rho_) & regionMesh().Sf()) + - deltarUAf*phiAdd*rhof + ); + constrainFilmField(phid, 0.0); + + surfaceScalarField ddrhorUAppf + ( + "deltaCoeff", + fvc::interpolate(delta_)*deltarUAf*rhof*fvc::interpolate(pp) + ); +// constrainFilmField(ddrhorUAppf, 0.0); + + for (int nonOrth=0; nonOrth<=nNonOrthCorr_; nonOrth++) + { + // Film thickness equation + fvScalarMatrix deltaEqn + ( + fvm::ddt(rho_, delta_) + + fvm::div(phid, delta_) + - fvm::laplacian(ddrhorUAppf, delta_) + == + - rhoSp_ + ); + + deltaEqn.solve(); + + if (nonOrth == nNonOrthCorr_) + { + phiAdd += + fvc::interpolate(pp) + * fvc::snGrad(delta_) + * regionMesh().magSf(); + + phi_ == deltaEqn.flux(); + } + } + + // Bound film thickness by a minimum of zero + delta_.max(0.0); + + // Update U field + U_ -= fvc::reconstruct(deltarUAf*phiAdd); + + // Remove any patch-normal components of velocity + U_ -= nHat()*(nHat() & U_); + + U_.correctBoundaryConditions(); + + // Continuity check + continuityCheck(); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +kinematicSingleLayer::kinematicSingleLayer +( + const word& modelType, + const fvMesh& mesh, + const dimensionedVector& g, + const bool readFields +) +: + surfaceFilmModel(modelType, mesh, g), + + momentumPredictor_(solution().subDict("PISO").lookup("momentumPredictor")), + nOuterCorr_(readLabel(solution().subDict("PISO").lookup("nOuterCorr"))), + nCorr_(readLabel(solution().subDict("PISO").lookup("nCorr"))), + nNonOrthCorr_ + ( + readLabel(solution().subDict("PISO").lookup("nNonOrthCorr")) + ), + + cumulativeContErr_(0.0), + + Cf_(readScalar(coeffs().lookup("Cf"))), + + rho_ + ( + IOobject + ( + "rhof", + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimDensity, 0.0), + zeroGradientFvPatchScalarField::typeName + ), + mu_ + ( + IOobject + ( + "muf", + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimPressure*dimTime, 0.0), + zeroGradientFvPatchScalarField::typeName + ), + sigma_ + ( + IOobject + ( + "sigmaf", + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimMass/sqr(dimTime), 0.0), + zeroGradientFvPatchScalarField::typeName + ), + + delta_ + ( + IOobject + ( + "deltaf", + time().timeName(), + regionMesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + regionMesh() + ), + U_ + ( + IOobject + ( + "Uf", + time().timeName(), + regionMesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + regionMesh() + ), + Us_ + ( + IOobject + ( + "Usf", + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + U_, + zeroGradientFvPatchScalarField::typeName + ), + Uw_ + ( + IOobject + ( + "Uwf", + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + U_, + zeroGradientFvPatchScalarField::typeName + ), + deltaRho_ + ( + IOobject + ( + delta_.name() + "*" + rho_.name(), + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", delta_.dimensions()*rho_.dimensions(), 0.0), + zeroGradientFvPatchScalarField::typeName + ), + + phi_ + ( + IOobject + ( + "phi", + time().timeName(), + regionMesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + regionMesh(), + dimLength*dimMass/dimTime + ), + + primaryMassTrans_ + ( + IOobject + ( + "primaryMassTrans", + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimMass, 0.0), + zeroGradientFvPatchScalarField::typeName + ), + cloudMassTrans_ + ( + IOobject + ( + "cloudMassTrans", + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimMass, 0.0), + zeroGradientFvPatchScalarField::typeName + ), + cloudDiameterTrans_ + ( + IOobject + ( + "cloudDiameterTrans", + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimLength, -1.0), + zeroGradientFvPatchScalarField::typeName + ), + + USp_ + ( + IOobject + ( + "USpf", + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + regionMesh(), + dimensionedVector + ( + "zero", dimMass*dimVelocity/dimArea/dimTime, vector::zero + ), + this->mappedPushedFieldPatchTypes() + ), + pSp_ + ( + IOobject + ( + "pSpf", + time_.timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimPressure, 0.0), + this->mappedPushedFieldPatchTypes() + ), + rhoSp_ + ( + IOobject + ( + "rhoSpf", + time_.timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimMass/dimTime/dimArea, 0.0), + this->mappedPushedFieldPatchTypes() + ), + + USpPrimary_ + ( + IOobject + ( + USp_.name(), // must have same name as USp_ to enable mapping + time().timeName(), + primaryMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + primaryMesh(), + dimensionedVector("zero", USp_.dimensions(), vector::zero) + ), + pSpPrimary_ + ( + IOobject + ( + pSp_.name(), // must have same name as pSp_ to enable mapping + time().timeName(), + primaryMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + primaryMesh(), + dimensionedScalar("zero", pSp_.dimensions(), 0.0) + ), + rhoSpPrimary_ + ( + IOobject + ( + rhoSp_.name(), // must have same name as rhoSp_ to enable mapping + time().timeName(), + primaryMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + primaryMesh(), + dimensionedScalar("zero", rhoSp_.dimensions(), 0.0) + ), + + UPrimary_ + ( + IOobject + ( + "U", // must have same name as U to enable mapping + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + regionMesh(), + dimensionedVector("zero", dimVelocity, vector::zero), + this->mappedFieldAndInternalPatchTypes() + ), + pPrimary_ + ( + IOobject + ( + "p", // must have same name as p to enable mapping + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimPressure, 0.0), + this->mappedFieldAndInternalPatchTypes() + ), + rhoPrimary_ + ( + IOobject + ( + "rho", // must have same name as rho to enable mapping + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimDensity, 0.0), + this->mappedFieldAndInternalPatchTypes() + ), + muPrimary_ + ( + IOobject + ( + "mu", // must have same name as mu to enable mapping + time().timeName(), + regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimPressure*dimTime, 0.0), + this->mappedFieldAndInternalPatchTypes() + ), + + availableMass_(regionMesh().nCells(), 0.0), + + injection_(*this, coeffs_), + + addedMassTotal_(0.0) +{ + if (readFields) + { + transferPrimaryRegionThermoFields(); + + correctThermoFields(); + + deltaRho_ == delta_*rho_; + phi_ = fvc::interpolate(deltaRho_*U_) & regionMesh().Sf(); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +kinematicSingleLayer::~kinematicSingleLayer() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void kinematicSingleLayer::addSources +( + const label patchI, + const label faceI, + const scalar massSource, + const vector& momentumSource, + const scalar pressureSource, + const scalar energySource +) +{ + if (debug) + { + Info<< "\nSurface film: " << type() << ": adding to film source:" << nl + << " mass = " << massSource << nl + << " momentum = " << momentumSource << nl + << " pressure = " << pressureSource << endl; + } + + rhoSpPrimary_.boundaryField()[patchI][faceI] -= massSource; + USpPrimary_.boundaryField()[patchI][faceI] -= momentumSource; + pSpPrimary_.boundaryField()[patchI][faceI] -= pressureSource; + + addedMassTotal_ += massSource; +} + + +void kinematicSingleLayer::preEvolveRegion() +{ + if (debug) + { + Info<< "kinematicSingleLayer::preEvolveRegion()" << endl; + } + + transferPrimaryRegionThermoFields(); + + correctThermoFields(); + + transferPrimaryRegionSourceFields(); + + // Reset transfer fields +// availableMass_ = mass(); + availableMass_ = netMass(); + cloudMassTrans_ == dimensionedScalar("zero", dimMass, 0.0); + cloudDiameterTrans_ == dimensionedScalar("zero", dimLength, -1.0); +} + + +void kinematicSingleLayer::evolveRegion() +{ + if (debug) + { + Info<< "kinematicSingleLayer::evolveRegion()" << endl; + } + + updateSubmodels(); + + // Solve continuity for deltaRho_ + solveContinuity(); + + // Implicit pressure source coefficient - constant + tmp tpp(this->pp()); + + for (int oCorr=0; oCorr tpu(this->pu()); + + // Solve for momentum for U_ + tmp UEqn = solveMomentum(tpu(), tpp()); + + // Film thickness correction loop + for (int corr=1; corr<=nCorr_; corr++) + { + // Solve thickness for delta_ + solveThickness(tpu(), tpp(), UEqn()); + } + } + + // Update deltaRho_ with new delta_ + deltaRho_ == delta_*rho_; + + // Update film wall and surface velocities + updateSurfaceVelocities(); + + // Reset source terms for next time integration + resetPrimaryRegionSourceTerms(); +} + + +scalar kinematicSingleLayer::CourantNumber() const +{ + scalar CoNum = 0.0; + + if (regionMesh().nInternalFaces() > 0) + { + const scalar deltaT = time_.deltaTValue(); + + const surfaceScalarField SfUfbyDelta + ( + regionMesh().surfaceInterpolation::deltaCoeffs()*mag(phi_) + ); + const surfaceScalarField rhoDelta(fvc::interpolate(rho_*delta_)); + const surfaceScalarField& magSf = regionMesh().magSf(); + + forAll(rhoDelta, i) + { + if (rhoDelta[i] > ROOTVSMALL) + { + CoNum = max(CoNum, SfUfbyDelta[i]/rhoDelta[i]/magSf[i]*deltaT); + } + } + } + + reduce(CoNum, maxOp()); + + Info<< "Film max Courant number: " << CoNum << endl; + + return CoNum; +} + + +const volVectorField& kinematicSingleLayer::U() const +{ + return U_; +} + + +const volVectorField& kinematicSingleLayer::Us() const +{ + return Us_; +} + + +const volVectorField& kinematicSingleLayer::Uw() const +{ + return Uw_; +} + + +const surfaceScalarField& kinematicSingleLayer::phi() const +{ + return phi_; +} + + +const volScalarField& kinematicSingleLayer::rho() const +{ + return rho_; +} + + +const volScalarField& kinematicSingleLayer::T() const +{ + FatalErrorIn + ( + "const volScalarField& kinematicSingleLayer::T() const" + ) << "T field not available for " << type() << abort(FatalError); + + return volScalarField::null(); +} + + +const volScalarField& kinematicSingleLayer::Ts() const +{ + FatalErrorIn + ( + "const volScalarField& kinematicSingleLayer::Ts() const" + ) << "Ts field not available for " << type() << abort(FatalError); + + return volScalarField::null(); +} + + +const volScalarField& kinematicSingleLayer::Tw() const +{ + FatalErrorIn + ( + "const volScalarField& kinematicSingleLayer::Tw() const" + ) << "Tw field not available for " << type() << abort(FatalError); + + return volScalarField::null(); +} + + +const volScalarField& kinematicSingleLayer::Cp() const +{ + FatalErrorIn + ( + "const volScalarField& kinematicSingleLayer::Cp() const" + ) << "Cp field not available for " << type() << abort(FatalError); + + return volScalarField::null(); +} + + +const volScalarField& kinematicSingleLayer::kappa() const +{ + FatalErrorIn + ( + "const volScalarField& kinematicSingleLayer::kappa() const" + ) << "kappa field not available for " << type() << abort(FatalError); + + return volScalarField::null(); +} + + +tmp kinematicSingleLayer::primaryMassTrans() const +{ + return tmp + ( + new volScalarField + ( + IOobject + ( + "kinematicSingleLayer::primaryMassTrans", + time().timeName(), + primaryMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + primaryMesh(), + dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) + ) + ); +} + + +const volScalarField& kinematicSingleLayer::cloudMassTrans() const +{ + return cloudMassTrans_; +} + + +const volScalarField& kinematicSingleLayer::cloudDiameterTrans() const +{ + return cloudDiameterTrans_; +} + + +void kinematicSingleLayer::info() const +{ + Info<< "\nSurface film: " << type() << endl; + + Info<< indent << "added mass = " + << returnReduce(addedMassTotal_, sumOp()) << nl + << indent << "current mass = " + << gSum((deltaRho_*magSf())()) << 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(Info); +} + + +tmp > kinematicSingleLayer::Srho() const +{ + return tmp > + ( + new DimensionedField + ( + IOobject + ( + "kinematicSingleLayer::Srho", + time().timeName(), + primaryMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + primaryMesh(), + dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) + ) + ); +} + + +tmp > kinematicSingleLayer::Srho +( + const label i +) const +{ + return tmp > + ( + new DimensionedField + ( + IOobject + ( + "kinematicSingleLayer::Srho(" + Foam::name(i) + ")", + time().timeName(), + primaryMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + primaryMesh(), + dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) + ) + ); +} + + +tmp > kinematicSingleLayer::Sh() const +{ + return tmp > + ( + new DimensionedField + ( + IOobject + ( + "kinematicSingleLayer::Sh", + time().timeName(), + primaryMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + primaryMesh(), + dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0) + ) + ); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H index 361593ed0d..f59bc649e9 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H @@ -1,523 +1,523 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::kinematicSingleLayer - -Description - Kinematic form of single-cell layer surface film model - -SourceFiles - kinematicSingleLayer.C - -\*---------------------------------------------------------------------------*/ - -#ifndef kinematicSingleLayer_H -#define kinematicSingleLayer_H - -#include "surfaceFilmModel.H" -#include "fvMesh.H" -#include "volFields.H" -#include "surfaceFields.H" -#include "fvMatrices.H" - -#include "injectionModelList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace regionModels -{ -namespace surfaceFilmModels -{ - -/*---------------------------------------------------------------------------*\ - Class kinematicSingleLayer Declaration -\*---------------------------------------------------------------------------*/ - -class kinematicSingleLayer -: - public surfaceFilmModel -{ -private: - - // Private member functions - - //- Disallow default bitwise copy construct - kinematicSingleLayer(const kinematicSingleLayer&); - - //- Disallow default bitwise assignment - void operator=(const kinematicSingleLayer&); - - -protected: - - // Protected data - - // Solution parameters - - //- Momentum predictor - Switch momentumPredictor_; - - //- Number of outer correctors - label nOuterCorr_; - - //- Number of PISO-like correctors - label nCorr_; - - //- Number of non-orthogonal correctors - label nNonOrthCorr_; - - //- Cumulative continuity error - scalar cumulativeContErr_; - - - // Model parameters - - //- Skin frition coefficient for film/primary region interface - scalar Cf_; - - - // Thermo properties - - // Fields - - //- Density / [kg/m3] - volScalarField rho_; - - //- Dynamic viscosity / [Pa.s] - volScalarField mu_; - - //- Surface tension / [m/s2] - volScalarField sigma_; - - - // Fields - - //- Film thickness / [m] - volScalarField delta_; - - //- Velocity - mean / [m/s] - volVectorField U_; - - //- Velocity - surface / [m/s] - volVectorField Us_; - - //- Velocity - wall / [m/s] - volVectorField Uw_; - - //- Film thickness*density (helper field) / [kg/m2] - volScalarField deltaRho_; - - //- Mass flux (includes film thickness) / [kg.m/s] - surfaceScalarField phi_; - - - // Transfer fields - - //- Film mass available for transfer to the primary region - volScalarField primaryMassTrans_; - - //- Film mass available for transfer to cloud - volScalarField cloudMassTrans_; - - //- Parcel diameters originating from film to cloud - volScalarField cloudDiameterTrans_; - - - // Source term fields - - // Film region - registered to the film region mesh - // Note: need boundary value mapped from primary region, and then - // pushed into the patch internal field - - //- Momementum / [kg/m/s2] - volVectorField USp_; - - //- Pressure / [Pa] - volScalarField pSp_; - - //- Mass / [kg/m2/s] - volScalarField rhoSp_; - - - // Primary region - registered to the primary region mesh - // Internal use only - not read-in - - //- Momementum / [kg/m/s2] - volVectorField USpPrimary_; - - //- Pressure / [Pa] - volScalarField pSpPrimary_; - - //- Mass / [kg/m2/s] - volScalarField rhoSpPrimary_; - - - // Fields mapped from primary region - registered to the film region - // Note: need both boundary AND patch internal fields to be mapped - - //- Velocity / [m/s] - volVectorField UPrimary_; - - //- Pressure / [Pa] - volScalarField pPrimary_; - - //- Density / [kg/m3] - volScalarField rhoPrimary_; - - //- Viscosity / [Pa.s] - volScalarField muPrimary_; - - - // Sub-models - - //- Available mass for transfer via sub-models - scalarField availableMass_; - - //- Cloud injection - injectionModelList injection_; - - - // Checks - - //- Cumulative mass added via sources [kg] - scalar addedMassTotal_; - - - // Protected member functions - - //- Read control parameters from dictionary - virtual bool read(); - - //- Correct the thermo fields - virtual void correctThermoFields(); - - //- Reset source term fields - virtual void resetPrimaryRegionSourceTerms(); - - //- Transfer thermo fields from the primary region to the film region - virtual void transferPrimaryRegionThermoFields(); - - //- Transfer source fields from the primary region to the film region - virtual void transferPrimaryRegionSourceFields(); - - // Explicit pressure source contribution - virtual tmp pu(); - - // Implicit pressure source coefficient - virtual tmp pp(); - - //- Update the film sub-models - virtual void updateSubmodels(); - - //- Continuity check - virtual void continuityCheck(); - - //- Update film surface velocities - virtual void updateSurfaceVelocities(); - - //- Return the stress term for the momentum equation - virtual tmp tau(volVectorField& dU) const; - - //- Constrain a film region master/slave boundaries of a field to a - // given value - template - void constrainFilmField - ( - Type& field, - const typename Type::cmptType& value - ); - - - // Equations - - //- Solve continuity equation - virtual void solveContinuity(); - - //- Solve for film velocity - virtual tmp solveMomentum - ( - const volScalarField& pu, - const volScalarField& pp - ); - - //- Solve coupled velocity-thickness equations - virtual void solveThickness - ( - const volScalarField& pu, - const volScalarField& pp, - const fvVectorMatrix& UEqn - ); - - -public: - - //- Runtime type information - TypeName("kinematicSingleLayer"); - - - // Constructors - - //- Construct from components - kinematicSingleLayer - ( - const word& modelType, - const fvMesh& mesh, - const dimensionedVector& g, - const bool readFields = true - ); - - - //- Destructor - virtual ~kinematicSingleLayer(); - - - // Member Functions - - // Solution parameters - - //- Courant number evaluation - virtual scalar CourantNumber() const; - - //- Return the momentum predictor - inline const Switch& momentumPredictor() const; - - //- Return the number of outer correctors - inline label nOuterCorr() const; - - //- Return the number of PISO correctors - inline label nCorr() const; - - //- Return the number of non-orthogonal correctors - inline label nNonOrthCorr() const; - - - // Model parameters - - //- Return the skin friction coefficient - inline scalar Cf() const; - - - // Thermo properties - - //- Return const access to the dynamic viscosity / [Pa.s] - inline const volScalarField& mu() const; - - //- Return const access to the surface tension / [m/s2] - inline const volScalarField& sigma() const; - - - // Fields - - //- Return const access to the film thickness / [m] - inline const volScalarField& delta() const; - - //- Return the film velocity [m/s] - virtual const volVectorField& U() const; - - //- Return the film surface velocity [m/s] - virtual const volVectorField& Us() const; - - //- Return the film wall velocity [m/s] - virtual const volVectorField& Uw() const; - - //- Return the film flux [kg.m/s] - virtual const surfaceScalarField& phi() const; - - //- Return the film density [kg/m3] - virtual const volScalarField& rho() const; - - //- Return the film mean temperature [K] - virtual const volScalarField& T() const; - - //- Return the film surface temperature [K] - virtual const volScalarField& Ts() const; - - //- Return the film wall temperature [K] - virtual const volScalarField& Tw() const; - - //- Return the film specific heat capacity [J/kg/K] - virtual const volScalarField& Cp() const; - - //- Return the film thermal conductivity [W/m/K] - virtual const volScalarField& kappa() const; - - - // Transfer fields - to the primary region - - //- Return mass transfer source - Eulerian phase only - virtual tmp primaryMassTrans() const; - - //- Return the film mass available for transfer to cloud - virtual const volScalarField& cloudMassTrans() const; - - //- Return the parcel diameters originating from film to cloud - virtual const volScalarField& cloudDiameterTrans() const; - - - // External helper functions - - //- External hook to add sources to the film - virtual void addSources - ( - const label patchI, // patchI on primary region - const label faceI, // faceI of patchI - const scalar massSource, // [kg] - const vector& momentumSource, // [kg.m/s] (tang'l momentum) - const scalar pressureSource, // [kg.m/s] (normal momentum) - const scalar energySource = 0 // [J] - ); - - - // Source fields (read/write access) - - // Primary region - - //- Momementum / [kg/m/s2] - inline volVectorField& USpPrimary(); - - //- Pressure / [Pa] - inline volScalarField& pSpPrimary(); - - //- Mass / [kg/m2/s] - inline volScalarField& rhoSpPrimary(); - - - // Film region - - //- Momentum / [kg/m/s2] - inline volVectorField& USp(); - - //- Pressure / [Pa] - inline volScalarField& pSp(); - - //- Mass / [kg/m2/s] - inline volScalarField& rhoSp(); - - //- Momentum / [kg/m/s2] - inline const volVectorField& USp() const; - - //- Pressure / [Pa] - inline const volScalarField& pSp() const; - - //- Mass / [kg/m2/s] - inline const volScalarField& rhoSp() const; - - - // Fields mapped from primary region - - //- Velocity / [m/s] - inline const volVectorField& UPrimary() const; - - //- Pressure / [Pa] - inline const volScalarField& pPrimary() const; - - //- Density / [kg/m3] - inline const volScalarField& rhoPrimary() const; - - //- Viscosity / [Pa.s] - inline const volScalarField& muPrimary() const; - - - // Sub-models - - //- Injection - inline injectionModelList& injection(); - - - // Helper functions - - //- 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 gravity normal-to-patch component contribution - inline tmp gNorm() const; - - //- Return the gravity normal-to-patch component contribution - // Clipped so that only non-zero if g & nHat_ < 0 - inline tmp gNormClipped() const; - - //- Return the gravity tangential component contributions - inline tmp gTan() const; - - - // Evolution - - //- Pre-evolve film hook - virtual void preEvolveRegion(); - - //- Evolve the film equations - virtual void evolveRegion(); - - - // 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 - virtual void info() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace surfaceFilmModels -} // End namespace regionModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "kinematicSingleLayerTemplates.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "kinematicSingleLayerI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::kinematicSingleLayer + +Description + Kinematic form of single-cell layer surface film model + +SourceFiles + kinematicSingleLayer.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kinematicSingleLayer_H +#define kinematicSingleLayer_H + +#include "surfaceFilmModel.H" +#include "fvMesh.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "fvMatrices.H" + +#include "injectionModelList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class kinematicSingleLayer Declaration +\*---------------------------------------------------------------------------*/ + +class kinematicSingleLayer +: + public surfaceFilmModel +{ +private: + + // Private member functions + + //- Disallow default bitwise copy construct + kinematicSingleLayer(const kinematicSingleLayer&); + + //- Disallow default bitwise assignment + void operator=(const kinematicSingleLayer&); + + +protected: + + // Protected data + + // Solution parameters + + //- Momentum predictor + Switch momentumPredictor_; + + //- Number of outer correctors + label nOuterCorr_; + + //- Number of PISO-like correctors + label nCorr_; + + //- Number of non-orthogonal correctors + label nNonOrthCorr_; + + //- Cumulative continuity error + scalar cumulativeContErr_; + + + // Model parameters + + //- Skin frition coefficient for film/primary region interface + scalar Cf_; + + + // Thermo properties + + // Fields + + //- Density / [kg/m3] + volScalarField rho_; + + //- Dynamic viscosity / [Pa.s] + volScalarField mu_; + + //- Surface tension / [m/s2] + volScalarField sigma_; + + + // Fields + + //- Film thickness / [m] + volScalarField delta_; + + //- Velocity - mean / [m/s] + volVectorField U_; + + //- Velocity - surface / [m/s] + volVectorField Us_; + + //- Velocity - wall / [m/s] + volVectorField Uw_; + + //- Film thickness*density (helper field) / [kg/m2] + volScalarField deltaRho_; + + //- Mass flux (includes film thickness) / [kg.m/s] + surfaceScalarField phi_; + + + // Transfer fields + + //- Film mass available for transfer to the primary region + volScalarField primaryMassTrans_; + + //- Film mass available for transfer to cloud + volScalarField cloudMassTrans_; + + //- Parcel diameters originating from film to cloud + volScalarField cloudDiameterTrans_; + + + // Source term fields + + // Film region - registered to the film region mesh + // Note: need boundary value mapped from primary region, and then + // pushed into the patch internal field + + //- Momementum / [kg/m/s2] + volVectorField USp_; + + //- Pressure / [Pa] + volScalarField pSp_; + + //- Mass / [kg/m2/s] + volScalarField rhoSp_; + + + // Primary region - registered to the primary region mesh + // Internal use only - not read-in + + //- Momementum / [kg/m/s2] + volVectorField USpPrimary_; + + //- Pressure / [Pa] + volScalarField pSpPrimary_; + + //- Mass / [kg/m2/s] + volScalarField rhoSpPrimary_; + + + // Fields mapped from primary region - registered to the film region + // Note: need both boundary AND patch internal fields to be mapped + + //- Velocity / [m/s] + volVectorField UPrimary_; + + //- Pressure / [Pa] + volScalarField pPrimary_; + + //- Density / [kg/m3] + volScalarField rhoPrimary_; + + //- Viscosity / [Pa.s] + volScalarField muPrimary_; + + + // Sub-models + + //- Available mass for transfer via sub-models + scalarField availableMass_; + + //- Cloud injection + injectionModelList injection_; + + + // Checks + + //- Cumulative mass added via sources [kg] + scalar addedMassTotal_; + + + // Protected member functions + + //- Read control parameters from dictionary + virtual bool read(); + + //- Correct the thermo fields + virtual void correctThermoFields(); + + //- Reset source term fields + virtual void resetPrimaryRegionSourceTerms(); + + //- Transfer thermo fields from the primary region to the film region + virtual void transferPrimaryRegionThermoFields(); + + //- Transfer source fields from the primary region to the film region + virtual void transferPrimaryRegionSourceFields(); + + // Explicit pressure source contribution + virtual tmp pu(); + + // Implicit pressure source coefficient + virtual tmp pp(); + + //- Update the film sub-models + virtual void updateSubmodels(); + + //- Continuity check + virtual void continuityCheck(); + + //- Update film surface velocities + virtual void updateSurfaceVelocities(); + + //- Return the stress term for the momentum equation + virtual tmp tau(volVectorField& dU) const; + + //- Constrain a film region master/slave boundaries of a field to a + // given value + template + void constrainFilmField + ( + Type& field, + const typename Type::cmptType& value + ); + + + // Equations + + //- Solve continuity equation + virtual void solveContinuity(); + + //- Solve for film velocity + virtual tmp solveMomentum + ( + const volScalarField& pu, + const volScalarField& pp + ); + + //- Solve coupled velocity-thickness equations + virtual void solveThickness + ( + const volScalarField& pu, + const volScalarField& pp, + const fvVectorMatrix& UEqn + ); + + +public: + + //- Runtime type information + TypeName("kinematicSingleLayer"); + + + // Constructors + + //- Construct from components + kinematicSingleLayer + ( + const word& modelType, + const fvMesh& mesh, + const dimensionedVector& g, + const bool readFields = true + ); + + + //- Destructor + virtual ~kinematicSingleLayer(); + + + // Member Functions + + // Solution parameters + + //- Courant number evaluation + virtual scalar CourantNumber() const; + + //- Return the momentum predictor + inline const Switch& momentumPredictor() const; + + //- Return the number of outer correctors + inline label nOuterCorr() const; + + //- Return the number of PISO correctors + inline label nCorr() const; + + //- Return the number of non-orthogonal correctors + inline label nNonOrthCorr() const; + + + // Model parameters + + //- Return the skin friction coefficient + inline scalar Cf() const; + + + // Thermo properties + + //- Return const access to the dynamic viscosity / [Pa.s] + inline const volScalarField& mu() const; + + //- Return const access to the surface tension / [m/s2] + inline const volScalarField& sigma() const; + + + // Fields + + //- Return const access to the film thickness / [m] + inline const volScalarField& delta() const; + + //- Return the film velocity [m/s] + virtual const volVectorField& U() const; + + //- Return the film surface velocity [m/s] + virtual const volVectorField& Us() const; + + //- Return the film wall velocity [m/s] + virtual const volVectorField& Uw() const; + + //- Return the film flux [kg.m/s] + virtual const surfaceScalarField& phi() const; + + //- Return the film density [kg/m3] + virtual const volScalarField& rho() const; + + //- Return the film mean temperature [K] + virtual const volScalarField& T() const; + + //- Return the film surface temperature [K] + virtual const volScalarField& Ts() const; + + //- Return the film wall temperature [K] + virtual const volScalarField& Tw() const; + + //- Return the film specific heat capacity [J/kg/K] + virtual const volScalarField& Cp() const; + + //- Return the film thermal conductivity [W/m/K] + virtual const volScalarField& kappa() const; + + + // Transfer fields - to the primary region + + //- Return mass transfer source - Eulerian phase only + virtual tmp primaryMassTrans() const; + + //- Return the film mass available for transfer to cloud + virtual const volScalarField& cloudMassTrans() const; + + //- Return the parcel diameters originating from film to cloud + virtual const volScalarField& cloudDiameterTrans() const; + + + // External helper functions + + //- External hook to add sources to the film + virtual void addSources + ( + const label patchI, // patchI on primary region + const label faceI, // faceI of patchI + const scalar massSource, // [kg] + const vector& momentumSource, // [kg.m/s] (tang'l momentum) + const scalar pressureSource, // [kg.m/s] (normal momentum) + const scalar energySource = 0 // [J] + ); + + + // Source fields (read/write access) + + // Primary region + + //- Momementum / [kg/m/s2] + inline volVectorField& USpPrimary(); + + //- Pressure / [Pa] + inline volScalarField& pSpPrimary(); + + //- Mass / [kg/m2/s] + inline volScalarField& rhoSpPrimary(); + + + // Film region + + //- Momentum / [kg/m/s2] + inline volVectorField& USp(); + + //- Pressure / [Pa] + inline volScalarField& pSp(); + + //- Mass / [kg/m2/s] + inline volScalarField& rhoSp(); + + //- Momentum / [kg/m/s2] + inline const volVectorField& USp() const; + + //- Pressure / [Pa] + inline const volScalarField& pSp() const; + + //- Mass / [kg/m2/s] + inline const volScalarField& rhoSp() const; + + + // Fields mapped from primary region + + //- Velocity / [m/s] + inline const volVectorField& UPrimary() const; + + //- Pressure / [Pa] + inline const volScalarField& pPrimary() const; + + //- Density / [kg/m3] + inline const volScalarField& rhoPrimary() const; + + //- Viscosity / [Pa.s] + inline const volScalarField& muPrimary() const; + + + // Sub-models + + //- Injection + inline injectionModelList& injection(); + + + // Helper functions + + //- 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 gravity normal-to-patch component contribution + inline tmp gNorm() const; + + //- Return the gravity normal-to-patch component contribution + // Clipped so that only non-zero if g & nHat_ < 0 + inline tmp gNormClipped() const; + + //- Return the gravity tangential component contributions + inline tmp gTan() const; + + + // Evolution + + //- Pre-evolve film hook + virtual void preEvolveRegion(); + + //- Evolve the film equations + virtual void evolveRegion(); + + + // 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 + virtual void info() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "kinematicSingleLayerTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "kinematicSingleLayerI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.H index 02e7f7ccdd..8ac0c10619 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.H +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.H @@ -107,7 +107,7 @@ protected: tmp calcInvR1(const volVectorField& U) const; //- Calculate the cosine of the angle between gravity vector and - // cell out flow direction + // cell out flow direction tmp calcCosAngle(const surfaceScalarField& phi) const; diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C index 97365896cc..5ab27c47bf 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C @@ -91,7 +91,7 @@ void phaseChangeModel::correct ); latestMassPC_ = sum(dMass.internalField()); - totalMassPC_ += latestMassPC_; + totalMassPC_ += latestMassPC_; availableMass -= dMass; dMass.correctBoundaryConditions(); diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0.org/0/U b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0.org/0/U index 5583d72825..0b165d2610 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0.org/0/U +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0.org/0/U @@ -17,7 +17,7 @@ FoamFile dimensions [0 1 -1 0 0 0 0]; -internalField uniform (0 0 0); +internalField uniform (0 0 0); boundaryField { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0.org/U b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0.org/U index 5583d72825..0b165d2610 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0.org/U +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0.org/U @@ -17,7 +17,7 @@ FoamFile dimensions [0 1 -1 0 0 0 0]; -internalField uniform (0 0 0); +internalField uniform (0 0 0); boundaryField { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0/0/U b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0/0/U index 5583d72825..0b165d2610 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0/0/U +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0/0/U @@ -17,7 +17,7 @@ FoamFile dimensions [0 1 -1 0 0 0 0]; -internalField uniform (0 0 0); +internalField uniform (0 0 0); boundaryField { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0/U b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0/U index 5583d72825..0b165d2610 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0/U +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/0/U @@ -17,7 +17,7 @@ FoamFile dimensions [0 1 -1 0 0 0 0]; -internalField uniform (0 0 0); +internalField uniform (0 0 0); boundaryField { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allclean b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allclean index 49a23b95b8..50d71cadc3 100755 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allclean +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allclean @@ -11,4 +11,3 @@ cp -rf 0.org 0 rm -f *.obj #rm -rf VTK - diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun index 03135280bf..f01aae71c9 100755 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun @@ -8,4 +8,3 @@ cd ${0%/*} || exit 1 # run from this directory application=`getApplication` runApplication $application - diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun.pre b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun.pre index a283228a85..6904214c8d 100755 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun.pre +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun.pre @@ -7,4 +7,3 @@ runApplication setSet -batch wallFilmRegion.setSet mv log.setSet log.wallFilmRegion.setSet runApplication extrudeToRegionMesh -overwrite - diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/foam.inp b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/foam.inp index cf67d1ec7c..fff06b38e5 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/foam.inp +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/foam.inp @@ -8,4 +8,3 @@ species reactions {} - diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/polyMesh.save/boundary b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/polyMesh.save/boundary index 52b636ac61..9df5ae8082 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/polyMesh.save/boundary +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/polyMesh.save/boundary @@ -31,7 +31,7 @@ FoamFile sampleMode nearestPatchFace; sampleRegion wallFilmRegion; samplePatch region0_to_wallFilmRegion_wallFilmFaces; - offsets + offsets 200 ( (-4.33680869e-19 -4.33680869e-19 -0) diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/polyMesh.save/faceZones b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/polyMesh.save/faceZones index bd1f20da56..5c8c2e4677 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/polyMesh.save/faceZones +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/polyMesh.save/faceZones @@ -20,7 +20,7 @@ FoamFile wallFilmFaces { type faceZone; -faceLabels List