From 237326e29f4f29d44840ea780c1fa9dcccf493ef Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 20 Apr 2011 12:54:35 +0100 Subject: [PATCH 01/12] ENH: Further updating of cloud coupling terms from commit fd09412 --- .../ReactingMultiphaseParcel.C | 14 +++++++++----- .../Templates/ReactingParcel/ReactingParcel.C | 5 +++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index 5972bd73ae..664fac9781 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -367,7 +367,7 @@ void Foam::ReactingMultiphaseParcel::calc d0, U0, rho0, - 0.5*(mass0 + mass1), + mass0, Su, dUTrans, Spu @@ -384,16 +384,18 @@ void Foam::ReactingMultiphaseParcel::calc { scalar dm = np0*dMassGas[i]; label gid = composition.localToGlobalCarrierId(GAS, i); - scalar hs = composition.carrier().Hs(gid, 0.5*(T0 + T1)); + scalar hs = composition.carrier().Hs(gid, T0); td.cloud().rhoTrans(gid)[cellI] += dm; + td.cloud().UTrans()[cellI] += dm*U0; td.cloud().hsTrans()[cellI] += dm*hs; } forAll(YLiquid_, i) { scalar dm = np0*dMassLiquid[i]; label gid = composition.localToGlobalCarrierId(LIQ, i); - scalar hs = composition.carrier().Hs(gid, 0.5*(T0 + T1)); + scalar hs = composition.carrier().Hs(gid, T0); td.cloud().rhoTrans(gid)[cellI] += dm; + td.cloud().UTrans()[cellI] += dm*U0; td.cloud().hsTrans()[cellI] += dm*hs; } /* @@ -402,16 +404,18 @@ void Foam::ReactingMultiphaseParcel::calc { scalar dm = np0*dMassSolid[i]; label gid = composition.localToGlobalCarrierId(SLD, i); - scalar hs = composition.carrier().Hs(gid, 0.5*(T0 + T1)); + scalar hs = composition.carrier().Hs(gid, T0); td.cloud().rhoTrans(gid)[cellI] += dm; + td.cloud().UTrans()[cellI] += dm*U0; td.cloud().hsTrans()[cellI] += dm*hs; } */ forAll(dMassSRCarrier, i) { scalar dm = np0*dMassSRCarrier[i]; - scalar hs = composition.carrier().Hs(i, 0.5*(T0 + T1)); + scalar hs = composition.carrier().Hs(i, T0); td.cloud().rhoTrans(i)[cellI] += dm; + td.cloud().UTrans()[cellI] += dm*U0; td.cloud().hsTrans()[cellI] += dm*hs; } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index c330254867..7133014464 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -389,7 +389,7 @@ void Foam::ReactingParcel::calc d0, U0, rho0, - 0.5*(mass0 + mass1), + mass0, Su, dUTrans, Spu @@ -405,9 +405,10 @@ void Foam::ReactingParcel::calc { scalar dm = np0*dMass[i]; label gid = composition.localToGlobalCarrierId(0, i); - scalar hs = composition.carrier().Hs(gid, 0.5*(T0 + T1)); + scalar hs = composition.carrier().Hs(gid, T0); td.cloud().rhoTrans(gid)[cellI] += dm; + td.cloud().UTrans()[cellI] += dm*U0; td.cloud().hsTrans()[cellI] += dm*hs; } From 335da20074348d7c0181b23dc2dc9d68f0cce4af Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 20 Apr 2011 12:59:08 +0100 Subject: [PATCH 02/12] ENH: changed absTol->tolerance for consistency with solvers --- .../general/solutionControl/pimpleControl/pimpleControl.C | 2 +- .../general/solutionControl/simpleControl/simpleControl.C | 4 ++-- .../general/solutionControl/solutionControl/solutionControl.C | 2 +- .../rhoPimpleFoam/ras/angledDuct/system/fvSolution | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C index cd5d46c824..3402992f46 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C @@ -137,7 +137,7 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh) { Info<< " field " << residualControl_[i].name << token::TAB << ": relTol " << residualControl_[i].relTol - << ", absTol " << residualControl_[i].absTol + << ", tolerance " << residualControl_[i].absTol << nl; } Info<< endl; diff --git a/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C b/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C index b0cb59e927..e6104de03d 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C @@ -68,7 +68,7 @@ bool Foam::simpleControl::criteriaSatisfied() { Info<< algorithmName_ << " solution statistics:" << endl; - Info<< " " << variableName << ": abs tol = " << residual + Info<< " " << variableName << ": tolerance = " << residual << " (" << residualControl_[fieldI].absTol << ")" << endl; } @@ -96,7 +96,7 @@ Foam::simpleControl::simpleControl(fvMesh& mesh) forAll(residualControl_, i) { Info<< " field " << residualControl_[i].name << token::TAB - << " absTol " << residualControl_[i].absTol + << " tolerance " << residualControl_[i].absTol << nl; } Info<< endl; diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C index 55fa22435b..e68c6a2d4d 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C @@ -68,7 +68,7 @@ void Foam::solutionControl::read(const bool absTolOnly) if (iter().isDict()) { const dictionary& fieldDict(iter().dict()); - fd.absTol = readScalar(fieldDict.lookup("absTol")); + fd.absTol = readScalar(fieldDict.lookup("tolerance")); fd.relTol = readScalar(fieldDict.lookup("relTol")); fd.initialResidual = 0.0; } diff --git a/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/system/fvSolution b/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/system/fvSolution index 5fdb36dac6..e39ae484a2 100644 --- a/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/system/fvSolution +++ b/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/system/fvSolution @@ -63,7 +63,7 @@ PIMPLE "(U|k|epsilon)" { relTol 0; - absTol 0.0001; + tolerance 0.0001; } } } From 119f1fdc625fd72cdacebb9dccff906a7363dabb Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 20 Apr 2011 18:30:45 +0100 Subject: [PATCH 03/12] dynSmagorinsky renamed homogeneousDynSmagorinsky to avoid the continuing confusion about this model --- .../incompressible/LES/Make/files | 3 +- .../dynMixedSmagorinsky/dynMixedSmagorinsky.C | 143 ----------------- .../dynMixedSmagorinsky/dynMixedSmagorinsky.H | 150 ------------------ .../homogeneousDynSmagorinsky.C} | 18 +-- .../homogeneousDynSmagorinsky.H} | 27 ++-- 5 files changed, 25 insertions(+), 316 deletions(-) delete mode 100644 src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.C delete mode 100644 src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.H rename src/turbulenceModels/incompressible/LES/{dynSmagorinsky/dynSmagorinsky.C => homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C} (86%) rename src/turbulenceModels/incompressible/LES/{dynSmagorinsky/dynSmagorinsky.H => homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H} (84%) diff --git a/src/turbulenceModels/incompressible/LES/Make/files b/src/turbulenceModels/incompressible/LES/Make/files index 70c95e3b59..02a58fff0b 100644 --- a/src/turbulenceModels/incompressible/LES/Make/files +++ b/src/turbulenceModels/incompressible/LES/Make/files @@ -15,7 +15,7 @@ oneEqEddy/oneEqEddy.C dynOneEqEddy/dynOneEqEddy.C locDynOneEqEddy/locDynOneEqEddy.C Smagorinsky/Smagorinsky.C -dynSmagorinsky/dynSmagorinsky.C +homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C LRRDiffStress/LRRDiffStress.C DeardorffDiffStress/DeardorffDiffStress.C spectEddyVisc/spectEddyVisc.C @@ -23,7 +23,6 @@ dynLagrangian/dynLagrangian.C scaleSimilarity/scaleSimilarity.C mixedSmagorinsky/mixedSmagorinsky.C -dynMixedSmagorinsky/dynMixedSmagorinsky.C /*Smagorinsky2/Smagorinsky2.C*/ diff --git a/src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.C b/src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.C deleted file mode 100644 index 02ef17b44f..0000000000 --- a/src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.C +++ /dev/null @@ -1,143 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 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 3 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, see . - -\*---------------------------------------------------------------------------*/ - -#include "dynMixedSmagorinsky.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace LESModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(dynMixedSmagorinsky, 0); -addToRunTimeSelectionTable(LESModel, dynMixedSmagorinsky, dictionary); - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -dynMixedSmagorinsky::dynMixedSmagorinsky -( - const volVectorField& U, - const surfaceScalarField& phi, - transportModel& transport, - const word& turbulenceModelName, - const word& modelName -) -: - LESModel(modelName, U, phi, transport, turbulenceModelName), - scaleSimilarity(U, phi, transport), - dynSmagorinsky(U, phi, transport) -{ - printCoeffs(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -tmp dynMixedSmagorinsky::k() const -{ - return - ( - scaleSimilarity::k() - + dynSmagorinsky::k() - ); -} - - -tmp dynMixedSmagorinsky::epsilon() const -{ - return - ( - scaleSimilarity::epsilon() - + dynSmagorinsky::epsilon() - ); -} - - -tmp dynMixedSmagorinsky::B() const -{ - return - ( - scaleSimilarity::B() - + dynSmagorinsky::B() - ); -} - - -tmp dynMixedSmagorinsky::devBeff() const -{ - return - ( - scaleSimilarity::devBeff() - + dynSmagorinsky::devBeff() - ); -} - - -tmp dynMixedSmagorinsky::divDevBeff(volVectorField& U) const -{ - return - ( - scaleSimilarity::divDevBeff(U) - + dynSmagorinsky::divDevBeff(U) - ); -} - - -void dynMixedSmagorinsky::correct(const tmp& gradU) -{ - scaleSimilarity::correct(gradU); - dynSmagorinsky::correct(gradU()); -} - - -bool dynMixedSmagorinsky::read() -{ - if (LESModel::read()) - { - scaleSimilarity::read(); - dynSmagorinsky::read(); - - return true; - } - else - { - return false; - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace LESModels -} // namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.H b/src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.H deleted file mode 100644 index 8083ef6660..0000000000 --- a/src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.H +++ /dev/null @@ -1,150 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-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 3 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, see . - -Class - Foam::incompressible::LESModels::dynMixedSmagorinsky - -Description - The Mixed Isochoric Smagorinsky Model for incompressible flows. - - The mixed model is a linear combination of an eddy viscosity model - with a scale similarity model. - \verbatim - B = (L + C) + R = (F(v*v) - F(v)*F(v)) + R - \endverbatim - - The algebraic eddy viscosity SGS model is founded on the assumption - that local equilibrium prevails, hence - \verbatim - R = 2/3*rho*k*I - 2*nuEff*dev(D) - where - k = cI*delta^2*||D||^2 - nuEff = ck*sqrt(k)*delta + nu - \endverbatim - - The Leonard and cross contributions are incorporated - by adding, - \verbatim - + div(((filter(U*U) - filter(U)*filter(U)) - - 0.333*I*tr(filter(U*U) - filter(U)*filter(U)))) - + div((filter(U*epsilon) - filter(U)*filter(epsilon))) - \endverbatim - to the rhs. of the equations. This version implements filtering to - evaluate the coefficients in the model. - -SourceFiles - dynMixedSmagorinsky.C - -\*---------------------------------------------------------------------------*/ - -#ifndef dynMixedSmagorinsky_H -#define dynMixedSmagorinsky_H - -#include "dynSmagorinsky.H" -#include "scaleSimilarity.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace LESModels -{ - -/*---------------------------------------------------------------------------*\ - Class dynMixedSmagorinsky Declaration -\*---------------------------------------------------------------------------*/ - -class dynMixedSmagorinsky -: - public scaleSimilarity, - public dynSmagorinsky -{ - // Private Member Functions - - // Disallow default bitwise copy construct and assignment - dynMixedSmagorinsky(const dynMixedSmagorinsky&); - dynMixedSmagorinsky& operator=(const dynMixedSmagorinsky&); - -public: - - //- Runtime type information - TypeName("dynMixedSmagorinsky"); - - // Constructors - - //- Constructors from components - dynMixedSmagorinsky - ( - const volVectorField& U, - const surfaceScalarField& phi, - transportModel& transport, - const word& turbulenceModelName = turbulenceModel::typeName, - const word& modelName = typeName - ); - - - //- Destructor - ~dynMixedSmagorinsky() - {} - - - // Member Functions - - //- Return SGS kinetic energy - tmp k() const; - - //- Return sub-grid disipation rate - tmp epsilon() const; - - //- Return the sub-grid stress tensor. - tmp B() const; - - //- Return the effective sub-grid turbulence stress tensor - // including the laminar stress - tmp devBeff() const; - - //- Returns div(B). - // This is the additional term due to the filtering of the NSE. - tmp divDevBeff(volVectorField& U) const; - - //- Correct Eddy-Viscosity and related properties - void correct(const tmp& gradU); - - //- Read LESProperties dictionary - bool read(); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace LESModels -} // End namespace incompressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.C b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C similarity index 86% rename from src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.C rename to src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C index e43781200f..a6d6d19280 100644 --- a/src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.C +++ b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "dynSmagorinsky.H" +#include "homogeneousDynSmagorinsky.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -37,19 +37,19 @@ namespace LESModels // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(dynSmagorinsky, 0); -addToRunTimeSelectionTable(LESModel, dynSmagorinsky, dictionary); +defineTypeNameAndDebug(homogeneousDynSmagorinsky, 0); +addToRunTimeSelectionTable(LESModel, homogeneousDynSmagorinsky, dictionary); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void dynSmagorinsky::updateSubGridScaleFields(const volSymmTensorField& D) +void homogeneousDynSmagorinsky::updateSubGridScaleFields(const volSymmTensorField& D) { nuSgs_ = cD(D)*sqr(delta())*sqrt(magSqr(D)); nuSgs_.correctBoundaryConditions(); } -dimensionedScalar dynSmagorinsky::cD(const volSymmTensorField& D) const +dimensionedScalar homogeneousDynSmagorinsky::cD(const volSymmTensorField& D) const { const volSymmTensorField MM ( @@ -72,7 +72,7 @@ dimensionedScalar dynSmagorinsky::cD(const volSymmTensorField& D) const } -dimensionedScalar dynSmagorinsky::cI(const volSymmTensorField& D) const +dimensionedScalar homogeneousDynSmagorinsky::cI(const volSymmTensorField& D) const { const volScalarField mm ( @@ -97,7 +97,7 @@ dimensionedScalar dynSmagorinsky::cI(const volSymmTensorField& D) const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -dynSmagorinsky::dynSmagorinsky +homogeneousDynSmagorinsky::homogeneousDynSmagorinsky ( const volVectorField& U, const surfaceScalarField& phi, @@ -135,7 +135,7 @@ dynSmagorinsky::dynSmagorinsky // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void dynSmagorinsky::correct(const tmp& gradU) +void homogeneousDynSmagorinsky::correct(const tmp& gradU) { LESModel::correct(gradU); @@ -148,7 +148,7 @@ void dynSmagorinsky::correct(const tmp& gradU) } -bool dynSmagorinsky::read() +bool homogeneousDynSmagorinsky::read() { if (GenEddyVisc::read()) { diff --git a/src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.H b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H similarity index 84% rename from src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.H rename to src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H index 8415cfefee..2ce757e6c3 100644 --- a/src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.H +++ b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H @@ -22,10 +22,10 @@ License along with OpenFOAM. If not, see . Class - Foam::incompressible::LESModels::dynSmagorinsky + Foam::incompressible::LESModels::homogeneousDynSmagorinsky Description - The Isochoric dynamic Smagorinsky Model for incompressible flows. + The Isochoric homogeneous dynamic Smagorinsky Model for incompressible flows. Algebraic eddy viscosity SGS model founded on the assumption that local equilibrium prevails. @@ -55,15 +55,18 @@ Description m = delta^2*(4*||F(D)||^2 - F(||D||^2)) L = dev(F(U*U) - F(U)*F(U)) M = delta^2*(F(||D||*dev(D)) - 4*||F(D)||*F(dev(D))) + + The averaging <...> is over the whole domain, i.e. homogeneous turbulence + is assumed \endverbatim SourceFiles - dynSmagorinsky.C + homogeneousDynSmagorinsky.C \*---------------------------------------------------------------------------*/ -#ifndef dynSmagorinsky_H -#define dynSmagorinsky_H +#ifndef homogeneousDynSmagorinsky_H +#define homogeneousDynSmagorinsky_H #include "Smagorinsky.H" #include "LESfilter.H" @@ -78,10 +81,10 @@ namespace LESModels { /*---------------------------------------------------------------------------*\ - Class dynSmagorinsky Declaration + Class homogeneousDynSmagorinsky Declaration \*---------------------------------------------------------------------------*/ -class dynSmagorinsky +class homogeneousDynSmagorinsky : public GenEddyVisc { @@ -103,19 +106,19 @@ class dynSmagorinsky dimensionedScalar cI(const volSymmTensorField& D) const; // Disallow default bitwise copy construct and assignment - dynSmagorinsky(const dynSmagorinsky&); - dynSmagorinsky& operator=(const dynSmagorinsky&); + homogeneousDynSmagorinsky(const homogeneousDynSmagorinsky&); + homogeneousDynSmagorinsky& operator=(const homogeneousDynSmagorinsky&); public: //- Runtime type information - TypeName("dynSmagorinsky"); + TypeName("homogeneousDynSmagorinsky"); // Constructors //- Construct from components - dynSmagorinsky + homogeneousDynSmagorinsky ( const volVectorField& U, const surfaceScalarField& phi, @@ -126,7 +129,7 @@ public: //- Destructor - virtual ~dynSmagorinsky() + virtual ~homogeneousDynSmagorinsky() {} From 53cb06171b08985d9419dbce72af9ca5e2906ce6 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 20 Apr 2011 18:31:49 +0100 Subject: [PATCH 04/12] Updated header --- .../LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C index a6d6d19280..322df227dd 100644 --- a/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C +++ b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License From 38189883de0d240a043b633486aae53baaca0db3 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 20 Apr 2011 18:33:39 +0100 Subject: [PATCH 05/12] Corrected line lengths --- .../homogeneousDynSmagorinsky.C | 15 ++++++++++++--- .../homogeneousDynSmagorinsky.H | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C index 322df227dd..e62de890f9 100644 --- a/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C +++ b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C @@ -42,14 +42,20 @@ addToRunTimeSelectionTable(LESModel, homogeneousDynSmagorinsky, dictionary); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void homogeneousDynSmagorinsky::updateSubGridScaleFields(const volSymmTensorField& D) +void homogeneousDynSmagorinsky::updateSubGridScaleFields +( + const volSymmTensorField& D +) { nuSgs_ = cD(D)*sqr(delta())*sqrt(magSqr(D)); nuSgs_.correctBoundaryConditions(); } -dimensionedScalar homogeneousDynSmagorinsky::cD(const volSymmTensorField& D) const +dimensionedScalar homogeneousDynSmagorinsky::cD +( + const volSymmTensorField& D +) const { const volSymmTensorField MM ( @@ -72,7 +78,10 @@ dimensionedScalar homogeneousDynSmagorinsky::cD(const volSymmTensorField& D) con } -dimensionedScalar homogeneousDynSmagorinsky::cI(const volSymmTensorField& D) const +dimensionedScalar homogeneousDynSmagorinsky::cI +( + const volSymmTensorField& D +) const { const volScalarField mm ( diff --git a/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H index 2ce757e6c3..2a25f48fe0 100644 --- a/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H +++ b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H @@ -25,7 +25,8 @@ Class Foam::incompressible::LESModels::homogeneousDynSmagorinsky Description - The Isochoric homogeneous dynamic Smagorinsky Model for incompressible flows. + The Isochoric homogeneous dynamic Smagorinsky Model for + incompressible flows. Algebraic eddy viscosity SGS model founded on the assumption that local equilibrium prevails. From a038c90f218f7429588b8489002df8c39c1dd0ae Mon Sep 17 00:00:00 2001 From: sergio Date: Thu, 21 Apr 2011 10:00:53 +0100 Subject: [PATCH 06/12] Tutorial Updates --- .../flamePropagationWithObstacles/0/Aw | 1 + .../PDRFoam/flamePropagationWithObstacles/0/B | 1 + .../flamePropagationWithObstacles/0/CR | 1 + .../flamePropagationWithObstacles/0/CT | 1 + .../flamePropagationWithObstacles/0/Lobs | 1 + .../flamePropagationWithObstacles/0/Nv | 1 + .../PDRFoam/flamePropagationWithObstacles/0/T | 1 + .../flamePropagationWithObstacles/0/Tu | 1 + .../flamePropagationWithObstacles/0/Xi | 1 + .../PDRFoam/flamePropagationWithObstacles/0/b | 1 + .../flamePropagationWithObstacles/0/betav | 1 + .../flamePropagationWithObstacles/README | 3 --- .../system/changeDictionaryDict | 19 +++++++++++++++---- .../system/fvSolution | 1 + .../pitzDaily/constant/combustionProperties | 4 ++-- .../XiFoam/les/pitzDaily/system/controlDict | 4 ++-- .../XiFoam/les/pitzDaily3D/system/fvSolution | 2 +- .../aachenBomb/constant/chemistryProperties | 2 +- .../aachenBomb/constant/combustionProperties | 2 +- .../aachenBomb/constant/polyMesh/boundary | 2 +- .../dieselFoam/aachenBomb/system/fvSolution | 1 + .../engineFoam/kivaTest/system/fvSolution | 4 ++-- .../les/smallPoolFire3D/system/controlDict | 2 +- .../ras/counterFlowFlame2D/system/controlDict | 4 ++-- .../ras/counterFlowFlame2D/system/fvSolution | 2 ++ .../hotRoom/system/fvSolution | 4 ++-- .../constant/polyMesh/boundary | 18 +++++++++--------- .../iglooWithFridges/system/fvSolution | 4 ++-- 28 files changed, 56 insertions(+), 33 deletions(-) diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Aw b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Aw index 6e623345fc..eaa7e3bf3a 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Aw +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Aw @@ -8063,6 +8063,7 @@ boundaryField blockedFaces { type zeroGradient; + value uniform 0; } baffleWall { diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/B b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/B index 00b545c496..428d563a25 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/B +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/B @@ -8063,6 +8063,7 @@ boundaryField blockedFaces { type zeroGradient; + value uniform ( 0 0 0 0 0 0 ); } baffleWall { diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/CR b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/CR index 37b3633fa3..284e7d9d17 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/CR +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/CR @@ -8063,6 +8063,7 @@ boundaryField blockedFaces { type zeroGradient; + value uniform ( 0 0 0 0 0 0 ); } baffleWall { diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/CT b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/CT index 3349ea01c1..6a6a805392 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/CT +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/CT @@ -8063,6 +8063,7 @@ boundaryField blockedFaces { type zeroGradient; + value uniform ( 0 0 0 0 0 0 ); } baffleWall { diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Lobs b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Lobs index 4ddf9c2b17..90660ce7c9 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Lobs +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Lobs @@ -8063,6 +8063,7 @@ boundaryField blockedFaces { type zeroGradient; + value uniform 0; } baffleWall { diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Nv b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Nv index a75358670c..dd48b6238b 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Nv +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Nv @@ -8063,6 +8063,7 @@ boundaryField blockedFaces { type zeroGradient; + value uniform 0; } baffleWall { diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/T b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/T index 71e583e06f..dd62e0b3ab 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/T +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/T @@ -34,6 +34,7 @@ boundaryField blockedFaces { type zeroGradient; + value uniform 300; } baffleWall { diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Tu b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Tu index d1b66ff729..b81e353980 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Tu +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Tu @@ -34,6 +34,7 @@ boundaryField blockedFaces { type zeroGradient; + value uniform 300; } baffleWall { diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Xi b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Xi index 0352e02d77..ed084b111c 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Xi +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/Xi @@ -34,6 +34,7 @@ boundaryField blockedFaces { type zeroGradient; + value uniform 1; } baffleWall { diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/b b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/b index 4f9939d012..9a23448202 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/b +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/b @@ -34,6 +34,7 @@ boundaryField blockedFaces { type zeroGradient; + value uniform 1; } baffleWall { diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/betav b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/betav index 61726ff235..a4c40e406f 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/betav +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/0/betav @@ -8063,6 +8063,7 @@ boundaryField blockedFaces { type zeroGradient; + value uniform 0; } baffleWall { diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/README b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/README index 13d0f4a923..8e71fd3b1f 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/README +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/README @@ -1,8 +1,5 @@ PDR test case -The folder 0.org contains the initial fields for the original -blockMesh. - Step to introduce the PDR fields: 1) Create zero-size patches for wall or/and coupled baffles in diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/changeDictionaryDict b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/changeDictionaryDict index f045525370..97d5a0abf5 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/changeDictionaryDict +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/changeDictionaryDict @@ -36,7 +36,6 @@ dictionaryReplacement { type cyclic; } - } } @@ -109,8 +108,8 @@ dictionaryReplacement } baffleWall { - type compressible::kqRWallFunction; - value uniform 1.5; + type compressible::kqRWallFunction; + value uniform 1.5; } baffleCyclic_half0 { @@ -153,6 +152,7 @@ dictionaryReplacement blockedFaces { type zeroGradient; + value uniform 1; } baffleWall { @@ -177,6 +177,7 @@ dictionaryReplacement blockedFaces { type zeroGradient; + value uniform 300; } baffleWall { @@ -201,6 +202,7 @@ dictionaryReplacement blockedFaces { type zeroGradient; + value uniform 300; } baffleWall { @@ -225,6 +227,7 @@ dictionaryReplacement blockedFaces { type zeroGradient; + value uniform 1; } baffleWall { @@ -273,8 +276,9 @@ dictionaryReplacement blockedFaces { type zeroGradient; + value uniform 0.0; } - baffleWall + baffleWall { type zeroGradient; value uniform 0.0; @@ -296,6 +300,7 @@ dictionaryReplacement blockedFaces { type zeroGradient; + value uniform (0 0 0 0 0 0); } baffleWall { @@ -319,6 +324,7 @@ dictionaryReplacement blockedFaces { type zeroGradient; + value uniform 0; } baffleWall { @@ -342,6 +348,7 @@ dictionaryReplacement blockedFaces { type zeroGradient; + value uniform (0 0 0 0 0 0); } baffleWall { @@ -365,6 +372,7 @@ dictionaryReplacement blockedFaces { type zeroGradient; + value uniform (0 0 0 0 0 0); } baffleWall { @@ -388,6 +396,7 @@ dictionaryReplacement blockedFaces { type zeroGradient; + value uniform 0; } baffleWall { @@ -411,6 +420,7 @@ dictionaryReplacement blockedFaces { type zeroGradient; + value uniform (0 0 0 0 0 0); } baffleWall { @@ -434,6 +444,7 @@ dictionaryReplacement blockedFaces { type zeroGradient; + value uniform 0; } baffleWall { diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/fvSolution b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/fvSolution index b981b69820..fc52462ffd 100755 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/fvSolution +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/fvSolution @@ -67,6 +67,7 @@ solvers PIMPLE { nCorrectors 2; + nOuterCorrectors 1; nNonOrthogonalCorrectors 0; momentumPredictor true; } diff --git a/tutorials/combustion/XiFoam/les/pitzDaily/constant/combustionProperties b/tutorials/combustion/XiFoam/les/pitzDaily/constant/combustionProperties index aabb890b5a..9445b6bedd 100644 --- a/tutorials/combustion/XiFoam/les/pitzDaily/constant/combustionProperties +++ b/tutorials/combustion/XiFoam/les/pitzDaily/constant/combustionProperties @@ -76,8 +76,8 @@ ignitionSites location (0.005 -0.02 0); diameter 0.003; start 0; - duration 0.05; - strength 20; + duration 0.1; + strength 100; } ); diff --git a/tutorials/combustion/XiFoam/les/pitzDaily/system/controlDict b/tutorials/combustion/XiFoam/les/pitzDaily/system/controlDict index 689e8a8cc9..816fc5b7e0 100644 --- a/tutorials/combustion/XiFoam/les/pitzDaily/system/controlDict +++ b/tutorials/combustion/XiFoam/les/pitzDaily/system/controlDict @@ -23,13 +23,13 @@ startTime 0; stopAt endTime; -endTime 0.5; +endTime 3.0;//0.5; deltaT 5e-06; writeControl adjustableRunTime; -writeInterval 0.01; +writeInterval 0.1; purgeWrite 0; diff --git a/tutorials/combustion/XiFoam/les/pitzDaily3D/system/fvSolution b/tutorials/combustion/XiFoam/les/pitzDaily3D/system/fvSolution index fb3f2564df..3e76ec8fa4 100644 --- a/tutorials/combustion/XiFoam/les/pitzDaily3D/system/fvSolution +++ b/tutorials/combustion/XiFoam/les/pitzDaily3D/system/fvSolution @@ -36,7 +36,7 @@ solvers { solver PBiCG; preconditioner DILU; - tolerance 1e-05; + tolerance 1e-06; relTol 0.1; } diff --git a/tutorials/combustion/dieselFoam/aachenBomb/constant/chemistryProperties b/tutorials/combustion/dieselFoam/aachenBomb/constant/chemistryProperties index 4c5b3b3dbd..49f4d3ee44 100644 --- a/tutorials/combustion/dieselFoam/aachenBomb/constant/chemistryProperties +++ b/tutorials/combustion/dieselFoam/aachenBomb/constant/chemistryProperties @@ -17,7 +17,7 @@ FoamFile psiChemistryModel ODEChemistryModel; -chemistry off; +chemistry on; chemistrySolver ode; diff --git a/tutorials/combustion/dieselFoam/aachenBomb/constant/combustionProperties b/tutorials/combustion/dieselFoam/aachenBomb/constant/combustionProperties index e3976eaaa5..8d6965f6b7 100644 --- a/tutorials/combustion/dieselFoam/aachenBomb/constant/combustionProperties +++ b/tutorials/combustion/dieselFoam/aachenBomb/constant/combustionProperties @@ -19,7 +19,7 @@ Cmix Cmix [ 0 0 0 0 0 0 0 ] 1; ignitionProperties1 { - ignite off; + ignite on; ignitionPoint ignitionPoint [ 0 1 0 0 0 0 0 ] ( 0.2 0 0.02 ); timing timing [ 0 0 1 0 0 0 0 ] 0; duration duration [ 0 0 1 0 0 0 0 ] 1; diff --git a/tutorials/combustion/dieselFoam/aachenBomb/constant/polyMesh/boundary b/tutorials/combustion/dieselFoam/aachenBomb/constant/polyMesh/boundary index 8983d3af9f..278bfcb94f 100644 --- a/tutorials/combustion/dieselFoam/aachenBomb/constant/polyMesh/boundary +++ b/tutorials/combustion/dieselFoam/aachenBomb/constant/polyMesh/boundary @@ -8,7 +8,7 @@ FoamFile { version 2.0; - format ascii; + format binary; class polyBoundaryMesh; location "constant/polyMesh"; object boundary; diff --git a/tutorials/combustion/dieselFoam/aachenBomb/system/fvSolution b/tutorials/combustion/dieselFoam/aachenBomb/system/fvSolution index e4df9498a8..51d80e52d0 100644 --- a/tutorials/combustion/dieselFoam/aachenBomb/system/fvSolution +++ b/tutorials/combustion/dieselFoam/aachenBomb/system/fvSolution @@ -70,6 +70,7 @@ solvers PIMPLE { + nOuterCorrectors 1; nCorrectors 2; nNonOrthogonalCorrectors 0; } diff --git a/tutorials/combustion/engineFoam/kivaTest/system/fvSolution b/tutorials/combustion/engineFoam/kivaTest/system/fvSolution index bf662ae7b7..004e00a839 100644 --- a/tutorials/combustion/engineFoam/kivaTest/system/fvSolution +++ b/tutorials/combustion/engineFoam/kivaTest/system/fvSolution @@ -47,14 +47,14 @@ solvers relTol 0; } - "(U|ft|h|k|epsilon)" + "(U|Xi|hu|ft|b|h|k|epsilon)" { solver PBiCG; preconditioner DILU; tolerance 1e-05; relTol 0.1; } - "(U|ft|h|k|epsilon)Final" + "(U|ft|Xi|hu|b|h|k|epsilon)Final" { $U; tolerance 1e-05; diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire3D/system/controlDict b/tutorials/combustion/fireFoam/les/smallPoolFire3D/system/controlDict index 8118c6f745..96939c68fa 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire3D/system/controlDict +++ b/tutorials/combustion/fireFoam/les/smallPoolFire3D/system/controlDict @@ -22,7 +22,7 @@ startTime 0.0; stopAt endTime; -endTime 6.0; +endTime 2.75; deltaT 0.001; diff --git a/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/system/controlDict b/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/system/controlDict index 2ba3dc6fc5..aa913fa58c 100644 --- a/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/system/controlDict +++ b/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/system/controlDict @@ -23,13 +23,13 @@ startTime 0; stopAt endTime; -endTime 1.0; +endTime 0.3; deltaT 1e-6; writeControl adjustableRunTime; -writeInterval 0.1; +writeInterval 0.05; purgeWrite 0; diff --git a/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/system/fvSolution b/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/system/fvSolution index f2c453ff5c..1e92e8b95f 100755 --- a/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/system/fvSolution +++ b/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/system/fvSolution @@ -71,6 +71,8 @@ solvers PIMPLE { + momentumPredictor no; + nOuterCorrectors 1; nCorrectors 2; nNonOrthogonalCorrectors 0; } diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSolution b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSolution index 023c282374..3521fbaaa3 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSolution +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSolution @@ -44,7 +44,7 @@ SIMPLE { p_rgh 1e-2; U 1e-4; - T 1e-3; + T 1e-2; // possibly check turbulence fields "(k|epsilon|omega)" 1e-3; @@ -54,7 +54,7 @@ SIMPLE relaxationFactors { p_rgh 0.7; - U 0.2; + U 0.3; T 0.5; "(k|epsilon|R)" 0.7; } diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/constant/polyMesh/boundary b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/constant/polyMesh/boundary index 2876f3adad..458b5aec2d 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/constant/polyMesh/boundary +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/constant/polyMesh/boundary @@ -21,55 +21,55 @@ FoamFile { type empty; nFaces 0; - startFace 60336; + startFace 61295; } minX { type empty; nFaces 0; - startFace 60336; + startFace 61295; } maxX { type empty; nFaces 0; - startFace 60336; + startFace 61295; } minY { type empty; nFaces 0; - startFace 60336; + startFace 61295; } ground { type wall; nFaces 590; - startFace 60336; + startFace 61295; } maxZ { type empty; nFaces 0; - startFace 60926; + startFace 61885; } igloo_region0 { type wall; nFaces 2260; - startFace 60926; + startFace 61885; } twoFridgeFreezers_seal_0 { type wall; nFaces 1344; - startFace 63186; + startFace 64145; } twoFridgeFreezers_herring_1 { type wall; nFaces 1116; - startFace 64530; + startFace 65489; } ) diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSolution b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSolution index ade18ff264..9235795a4a 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSolution +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSolution @@ -29,14 +29,14 @@ solvers { solver PBiCG; preconditioner DILU; - tolerance 1e-05; + tolerance 1e-07; relTol 0.1; } } SIMPLE { - nNonOrthogonalCorrectors 0; + nNonOrthogonalCorrectors 2; pRefCell 0; pRefValue 0; From a39476be8e32d1062dcd5c7451b2f5f8dcc7239b Mon Sep 17 00:00:00 2001 From: graham Date: Thu, 21 Apr 2011 10:10:19 +0100 Subject: [PATCH 07/12] COMP: CGAL 3.8. --- etc/settings.csh | 2 +- etc/settings.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/settings.csh b/etc/settings.csh index c8807695b5..5b4c41df82 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -340,7 +340,7 @@ endif # ~~~~~~~~~~~~~~ set boost_version=boost_1_45_0 -set cgal_version=CGAL-3.7 +set cgal_version=CGAL-3.8 setenv BOOST_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version setenv CGAL_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version diff --git a/etc/settings.sh b/etc/settings.sh index 650861fa10..84c6fd0bc1 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -358,7 +358,7 @@ fi # ~~~~~~~~~~~~~~ boost_version=boost_1_45_0 -cgal_version=CGAL-3.7 +cgal_version=CGAL-3.8 export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version From f6830c206de9cd1ea91d108f443db0002044c1c0 Mon Sep 17 00:00:00 2001 From: graham Date: Thu, 21 Apr 2011 10:29:22 +0100 Subject: [PATCH 08/12] 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