diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/files b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/files index 81bccf253c..ce1bdbc45b 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/files +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/files @@ -56,4 +56,6 @@ aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.C aspectRatioModels/VakhrushevEfremov/VakhrushevEfremov.C aspectRatioModels/Wellek/Wellek.C +wallDependentModel/wallDependentModel.C + LIB = $(FOAM_LIBBIN)/libcompressibleEulerianInterfacialModels diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/options b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/options index a728cb7f7c..25d20582ba 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/options +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/transportModels/incompressible/transportModel \ diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.C index cd2548655e..7660bb972c 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.C @@ -53,7 +53,7 @@ Foam::aspectRatioModels::TomiyamaAspectRatio::TomiyamaAspectRatio ) : VakhrushevEfremov(dict, pair), - yWall_(pair.phase1().mesh().lookupObject("yWall")) + wallDependentModel(pair.phase1().mesh()) {} @@ -72,7 +72,7 @@ Foam::aspectRatioModels::TomiyamaAspectRatio::E() const VakhrushevEfremov::E() *max ( - scalar(1) - 0.35*yWall_/pair_.dispersed().d(), + scalar(1) - 0.35*yWall()/pair_.dispersed().d(), scalar(0.65) ); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.H b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.H index 82f00642d4..747214f919 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.H @@ -45,6 +45,7 @@ SourceFiles #define TomiyamaAspectRatio_H #include "VakhrushevEfremov.H" +#include "wallDependentModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -59,16 +60,9 @@ namespace aspectRatioModels class TomiyamaAspectRatio : - public VakhrushevEfremov + public VakhrushevEfremov, + public wallDependentModel { -private: - - // Private data - - //- Wall distance - const volScalarField& yWall_; - - public: //- Runtime type information diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallDependentModel/wallDependentModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallDependentModel/wallDependentModel.C new file mode 100644 index 0000000000..b64547a1f0 --- /dev/null +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallDependentModel/wallDependentModel.C @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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 "wallDependentModel.H" +#include "wallDist.H" +#include "wallDistReflection.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallDependentModel::wallDependentModel(const fvMesh& mesh) +: + mesh_(mesh) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallDependentModel::~wallDependentModel() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +const Foam::volScalarField& Foam::wallDependentModel::yWall() const +{ + if (!mesh_.foundObject("yWall")) + { + wallDist w(mesh_); + + volScalarField* yPtr + ( + new volScalarField + ( + IOobject + ( + "yWall", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + true + ), + w.y() + ) + ); + + yPtr->checkIn(); + } + + return mesh_.lookupObject("yWall"); +} + + +const Foam::volVectorField& Foam::wallDependentModel::nWall() const +{ + if (!mesh_.foundObject("nWall")) + { + wallDistReflection w(mesh_); + + if (!mesh_.foundObject("yWall")) + { + volScalarField* yPtr + ( + new volScalarField + ( + IOobject + ( + "yWall", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + true + ), + w.y() + ) + ); + + yPtr->checkIn(); + } + + volVectorField* nPtr + ( + new volVectorField + ( + IOobject + ( + "nWall", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + true + ), + w.n() + ) + ); + + nPtr->checkIn(); + } + + return mesh_.lookupObject("nWall"); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallDependentModel/wallDependentModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallDependentModel/wallDependentModel.H new file mode 100644 index 0000000000..411add0897 --- /dev/null +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallDependentModel/wallDependentModel.H @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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::wallDependentModel + +Description + A class which provides on-demand creation and caching of wall distance and + wall normal fields for use by multiple models. + +SourceFiles + wallDependentModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef wallDependentModel_H +#define wallDependentModel_H + +#include "fvMesh.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class wallDependentModel Declaration +\*---------------------------------------------------------------------------*/ + +class wallDependentModel +{ + // Private data + + //- Reference to the mesh + const fvMesh& mesh_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + wallDependentModel(const wallDependentModel&); + + //- Disallow default bitwise assignment + void operator=(const wallDependentModel&); + + +public: + + // Constructors + + //- Construct from a mesh + wallDependentModel(const fvMesh& mesh); + + + //- Destructor + virtual ~wallDependentModel(); + + // Member Functions + + // Return the wall distance, creating and storing it if necessary + const volScalarField& yWall() const; + + // Return the wall normal, creating and storing it if necessary + const volVectorField& nWall() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/Antal/Antal.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/Antal/Antal.C index 9b047289d1..b2568dd738 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/Antal/Antal.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/Antal/Antal.C @@ -70,19 +70,19 @@ Foam::wallLubricationModels::Antal::~Antal() Foam::tmp Foam::wallLubricationModels::Antal::F() const { volVectorField Ur(pair_.Ur()); - volVectorField nWall(- fvc::grad(yWall_)); - nWall /= mag(nWall) + SMALL; + + const volVectorField& n(nWall()); return max ( dimensionedScalar("zero", dimless/dimLength, 0), - Cw1_/pair_.dispersed().d() + Cw2_/yWall_ + Cw1_/pair_.dispersed().d() + Cw2_/yWall() ) *pair_.dispersed() *pair_.continuous().rho() - *magSqr(Ur - (Ur & nWall)*nWall) - *nWall; + *magSqr(Ur - (Ur & n)*n) + *n; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/Frank/Frank.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/Frank/Frank.C index c89f1233de..1ec5df339f 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/Frank/Frank.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/Frank/Frank.C @@ -71,11 +71,12 @@ Foam::wallLubricationModels::Frank::~Frank() Foam::tmp Foam::wallLubricationModels::Frank::F() const { volVectorField Ur(pair_.Ur()); - volVectorField nWall(- fvc::grad(yWall_)); - nWall /= mag(nWall) + SMALL; + + const volVectorField& n(nWall()); + const volScalarField& y(yWall()); volScalarField Eo(pair_.Eo()); - volScalarField yTilde(yWall_/(Cwc_*pair_.dispersed().d())); + volScalarField yTilde(y/(Cwc_*pair_.dispersed().d())); return ( @@ -86,12 +87,12 @@ Foam::tmp Foam::wallLubricationModels::Frank::F() const *max ( dimensionedScalar("zero", dimless/dimLength, 0.0), - (1.0 - yTilde)/(Cwd_*yWall_*pow(yTilde, p_ - 1.0)) + (1.0 - yTilde)/(Cwd_*y*pow(yTilde, p_ - 1.0)) ) *pair_.dispersed() *pair_.continuous().rho() - *magSqr(Ur - (Ur & nWall)*nWall) - *nWall; + *magSqr(Ur - (Ur & n)*n) + *n; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/TomiyamaWallLubrication/TomiyamaWallLubrication.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/TomiyamaWallLubrication/TomiyamaWallLubrication.C index 09e45c32f3..b220aab694 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/TomiyamaWallLubrication/TomiyamaWallLubrication.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/TomiyamaWallLubrication/TomiyamaWallLubrication.C @@ -70,8 +70,9 @@ Foam::tmp Foam::wallLubricationModels::TomiyamaWallLubrication::F() const { volVectorField Ur(pair_.Ur()); - volVectorField nWall(- fvc::grad(yWall_)); - nWall /= mag(nWall) + SMALL; + + const volVectorField& n(nWall()); + const volScalarField& y(yWall()); volScalarField Eo(pair_.Eo()); @@ -84,13 +85,13 @@ Foam::wallLubricationModels::TomiyamaWallLubrication::F() const *0.5 *pair_.dispersed().d() *( - 1/sqr(yWall_) - - 1/sqr(D_ - yWall_) + 1/sqr(y) + - 1/sqr(D_ - y) ) *pair_.dispersed() *pair_.continuous().rho() - *magSqr(Ur - (Ur & nWall)*nWall) - *nWall; + *magSqr(Ur - (Ur & n)*n) + *n; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.C index 593516e4ff..b7a7edc385 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.C @@ -45,8 +45,8 @@ Foam::wallLubricationModel::wallLubricationModel const phasePair& pair ) : - pair_(pair), - yWall_(pair.phase1().mesh().lookupObject("yWall")) + wallDependentModel(pair.phase1().mesh()), + pair_(pair) {} diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.H index 04fd472976..8f77e21352 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.H @@ -37,6 +37,7 @@ SourceFiles // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "wallDependentModel.H" #include "volFields.H" #include "dictionary.H" #include "runTimeSelectionTables.H" @@ -51,6 +52,8 @@ class phasePair; \*---------------------------------------------------------------------------*/ class wallLubricationModel +: + public wallDependentModel { protected: @@ -59,9 +62,6 @@ protected: //- Phase pair const phasePair& pair_; - //- Wall distance - const volScalarField& yWall_; - public: diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C index f8a18f4f4a..dcc3595b7a 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C @@ -32,7 +32,6 @@ License #include "liftModel.H" #include "wallLubricationModel.H" #include "turbulentDispersionModel.H" -#include "wallDist.H" #include "fvMatrix.H" #include "surfaceInterpolate.H" #include "MULES.H" @@ -110,17 +109,6 @@ Foam::twoPhaseSystem::twoPhaseSystem ), mesh, dimensionedScalar("dgdt", dimless/dimTime, 0) - ), - - yWall_ - ( - IOobject - ( - "yWall", - mesh.time().timeName(), - mesh - ), - wallDist(mesh).y() ) { phase2_.volScalarField::operator=(scalar(1) - phase1_); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.H index e6a5732bb9..a12f3a4e16 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.H @@ -83,9 +83,6 @@ private: //- Dilatation term volScalarField dgdt_; - //- Wall distance - volScalarField yWall_; - //- Unordered phase pair autoPtr pair_;