diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/EEqns.H b/applications/solvers/multiphase/twoPhaseEulerFoam/EEqns.H index 1fe150e1..2a5f6c8b 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/EEqns.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/EEqns.H @@ -14,7 +14,6 @@ + fvc::ddt(alpha1, rho1, K1) + fvc::div(alphaRhoPhi1, K1) - contErr1*K1 - + ( he1.name() == thermo1.phasePropertyName("e") ? fvc::ddt(alpha1)*p + fvc::div(alphaPhi1, p) @@ -27,9 +26,12 @@ *fvc::interpolate(thermo1.alphaEff(phase1.turbulence().mut())), he1 ) + ); - == + he1Eqn.relax(); + he1Eqn -= + ( heatTransferCoeff*(thermo2.T() - thermo1.T()) + heatTransferCoeff*he1/Cpv1 - fvm::Sp(heatTransferCoeff/Cpv1, he1) @@ -43,7 +45,6 @@ + fvc::ddt(alpha2, rho2, K2) + fvc::div(alphaRhoPhi2, K2) - contErr2*K2 - + ( he2.name() == thermo2.phasePropertyName("e") ? fvc::ddt(alpha2)*p + fvc::div(alphaPhi2, p) @@ -56,23 +57,29 @@ *fvc::interpolate(thermo2.alphaEff(phase2.turbulence().mut())), he2 ) + ); - == + he2Eqn.relax(); + he2Eqn -= + ( heatTransferCoeff*(thermo1.T() - thermo2.T()) + heatTransferCoeff*he2/Cpv2 - fvm::Sp(heatTransferCoeff/Cpv2, he2) + fvOptions(alpha2, rho2, he2) ); - he1Eqn.relax(); fvOptions.constrain(he1Eqn); he1Eqn.solve(); - he2Eqn.relax(); fvOptions.constrain(he2Eqn); he2Eqn.solve(); thermo1.correct(); + Info<< "min " << thermo1.T().name() + << " " << min(thermo1.T()).value() << endl; + thermo2.correct(); + Info<< "min " << thermo2.T().name() + << " " << min(thermo2.T()).value() << endl; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/UEqns.H b/applications/solvers/multiphase/twoPhaseEulerFoam/UEqns.H index 45a52bc5..bfd5faf8 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/UEqns.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/UEqns.H @@ -16,13 +16,11 @@ volScalarField dragCoeff(fluid.dragCoeff()); { U1Eqn = ( - fvm::ddt(alpha1, rho1, U1) - + fvm::div(alphaRhoPhi1, U1) + fvm::ddt(alpha1, rho1, U1) + fvm::div(alphaRhoPhi1, U1) - fvm::Sp(contErr1, U1) + mrfZones(alpha1*rho1 + virtualMassCoeff, U1) + phase1.turbulence().divDevRhoReff(U1) == - - fvm::Sp(dragCoeff, U1) - liftForce - wallLubricationForce - turbulentDispersionForce @@ -36,20 +34,19 @@ volScalarField dragCoeff(fluid.dragCoeff()); + fvOptions(alpha1, rho1, U1) ); U1Eqn.relax(); + U1Eqn += fvm::Sp(dragCoeff, U1); fvOptions.constrain(U1Eqn); } { U2Eqn = ( - fvm::ddt(alpha2, rho2, U2) - + fvm::div(alphaRhoPhi2, U2) + fvm::ddt(alpha2, rho2, U2) + fvm::div(alphaRhoPhi2, U2) - fvm::Sp(contErr2, U2) + mrfZones(alpha2*rho2 + virtualMassCoeff, U2) + phase2.turbulence().divDevRhoReff(U2) == - - fvm::Sp(dragCoeff, U2) - + liftForce + liftForce + wallLubricationForce + turbulentDispersionForce - virtualMassCoeff @@ -62,6 +59,7 @@ volScalarField dragCoeff(fluid.dragCoeff()); + fvOptions(alpha2, rho2, U2) ); U2Eqn.relax(); + U2Eqn += fvm::Sp(dragCoeff, U2); fvOptions.constrain(U2Eqn); } } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/files b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/files index 81bccf25..ce1bdbc4 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 a728cb7f..25d20582 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 cd254865..7660bb97 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 82f00642..747214f9 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 00000000..b64547a1 --- /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 00000000..411add08 --- /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 9b047289..b2568dd7 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 c89f1233..1ec5df33 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 09e45c32..b220aab6 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 593516e4..b7a7edc3 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 04fd4729..8f77e213 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 f8a18f4f..dcc3595b 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 e6a5732b..a12f3a4e 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_; diff --git a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C index 1f91954e..dc797fdc 100644 --- a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C +++ b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C @@ -53,7 +53,8 @@ using namespace Foam; int main(int argc, char *argv[]) { -# include "addOverwriteOption.H" + #include "addOverwriteOption.H" + #include "addRegionOption.H" argList::validArgs.append("cellSet"); argList::addBoolOption ( @@ -62,10 +63,10 @@ int main(int argc, char *argv[]) " (default is to extend set)" ); -# include "setRootCase.H" -# include "createTime.H" + #include "setRootCase.H" + #include "createTime.H" runTime.functionObjects().off(); -# include "createMesh.H" + #include "createNamedMesh.H" const word oldInstance = mesh.pointsInstance(); word cellSetName(args.args()[1]); @@ -181,7 +182,7 @@ int main(int argc, char *argv[]) mesh.movePoints(map().preMotionPoints()); } - Pout<< "Refined from " << returnReduce(map().nOldCells(), sumOp