From da5ffe588dcb9b6dda2d5aa449be506ca354e18a Mon Sep 17 00:00:00 2001 From: sergio Date: Fri, 21 Feb 2014 12:24:04 +0000 Subject: [PATCH 01/11] STY: changed Copyright dates --- .../specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C index 68b3d0ec..d3ed9805 100644 --- a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C +++ b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2014 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License From 34cad8dec5eea9b950cd311ae984a3b909fb0274 Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 5 Mar 2014 10:07:41 +0000 Subject: [PATCH 02/11] STY: Taking out namespace FOAM and 'private' entry word in the .H file. --- .../PengRobinsonGas/PengRobinsonGas.C | 86 +------------- .../PengRobinsonGas/PengRobinsonGas.H | 7 +- .../PengRobinsonGas/PengRobinsonGasI.H | 112 +++++++++++++++--- 3 files changed, 100 insertions(+), 105 deletions(-) diff --git a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C index d3ed9805..b39f0c9d 100644 --- a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C +++ b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C @@ -30,15 +30,10 @@ Description #include "PengRobinsonGas.H" #include "IOstreams.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -PengRobinsonGas::PengRobinsonGas(Istream& is) +Foam::PengRobinsonGas::PengRobinsonGas(Istream& is) : Specie(is), Tc_(readScalar(is)), @@ -62,83 +57,10 @@ Foam::PengRobinsonGas::PengRobinsonGas {} -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -template -PengRobinsonGas operator+ -( - const PengRobinsonGas& pg1, - const PengRobinsonGas& pg2 -) -{ - scalar nMoles = pg1.nMoles() + pg2.nMoles(); - scalar molr1 = pg1.nMoles()/nMoles; - scalar molr2 = pg2.nMoles()/nMoles; - - return PengRobinsonGas - ( - static_cast(pg1) - + static_cast(pg2), - molr1*pg1.Tc_ + molr2*pg2.Tc_, - molr1*pg1.Pc_ + molr2*pg2.Pc_, - molr1*pg1.omega_ + molr2*pg2.omega_ - ); -} - - -template -PengRobinsonGas operator- -( - const PengRobinsonGas& pg1, - const PengRobinsonGas& pg2 -) -{ - scalar nMoles = pg1.nMoles() + pg2.nMoles(); - scalar molr1 = pg1.nMoles()/nMoles; - scalar molr2 = pg2.nMoles()/nMoles; - - return PengRobinsonGas - ( - static_cast(pg1) - - static_cast(pg2), - molr1*pg1.Tc_ - molr2*pg2.Tc_, - molr1*pg1.Pc_ - molr2*pg2.Pc_, - molr1*pg1.omega_ - molr2*pg2.omega_ - ); -} - - -template -PengRobinsonGas operator* -( - const scalar s, - const PengRobinsonGas& pg -) -{ - return PengRobinsonGas - ( - s*static_cast(pg), - pg.Tc_, - pg.Pc_, - pg.omega_ - ); -} - - -template -PengRobinsonGas operator== -( - const PengRobinsonGas& pg1, - const PengRobinsonGas& pg2 -) -{ - return pg2 - pg1; -} - // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template -Ostream& operator<< +Foam::Ostream& Foam::operator<< ( Ostream& os, const PengRobinsonGas& pg @@ -157,8 +79,4 @@ Ostream& operator<< } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.H b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.H index 926b308b..fd141117 100644 --- a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.H +++ b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.H @@ -93,10 +93,9 @@ class PengRobinsonGas : public Specie { -private: // Private data - //- Critical Temperature [K] + //- Critical Temperature [K] scalar Tc_; //- Critical Pressure [Pa] @@ -221,10 +220,6 @@ public: }; -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "PengRobinsonGasI.H" diff --git a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H index 55ac419c..861f2e09 100644 --- a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H +++ b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H @@ -27,13 +27,10 @@ License #include "PengRobinsonGas.H" #include "mathematicalConstants.H" -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template -inline PengRobinsonGas::PengRobinsonGas +inline Foam::PengRobinsonGas::PengRobinsonGas ( const Specie& sp, const scalar& Tc, @@ -51,7 +48,7 @@ inline PengRobinsonGas::PengRobinsonGas // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -inline PengRobinsonGas::PengRobinsonGas +inline Foam::PengRobinsonGas::PengRobinsonGas ( const word& name, const PengRobinsonGas& pg @@ -65,7 +62,8 @@ inline PengRobinsonGas::PengRobinsonGas template -inline autoPtr > PengRobinsonGas::clone() const +inline Foam::autoPtr > +Foam::PengRobinsonGas::clone() const { return autoPtr > ( @@ -75,7 +73,8 @@ inline autoPtr > PengRobinsonGas::clone() const template -inline autoPtr > PengRobinsonGas::New +inline Foam::autoPtr > +Foam::PengRobinsonGas::New ( Istream& is ) @@ -100,7 +99,11 @@ Foam::PengRobinsonGas::New // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -inline scalar PengRobinsonGas::rho(scalar p, scalar T) const +inline Foam::scalar Foam::PengRobinsonGas::rho +( + scalar p, + scalar T +) const { scalar z = Z(p, T); return p/(z*this->R()*T); @@ -108,7 +111,11 @@ inline scalar PengRobinsonGas::rho(scalar p, scalar T) const template -inline scalar PengRobinsonGas::psi(scalar p, scalar T) const +inline Foam::scalar Foam::PengRobinsonGas::psi +( + scalar p, + scalar T +) const { scalar z = Z(p, T); return 1.0/(z*this->R()*T); @@ -116,7 +123,11 @@ inline scalar PengRobinsonGas::psi(scalar p, scalar T) const template -inline scalar PengRobinsonGas::Z(scalar p, scalar T) const +inline Foam::scalar Foam::PengRobinsonGas::Z +( + scalar p, + scalar T +) const { scalar a = 0.45724*sqr(this->R())*sqr(Tc_)/Pc_; scalar b = 0.07780*this->R()*Tc_/Pc_; @@ -191,7 +202,7 @@ inline Foam::scalar Foam::PengRobinsonGas::cpMcv // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template -inline void PengRobinsonGas::operator+= +inline void Foam::PengRobinsonGas::operator+= ( const PengRobinsonGas& pg ) @@ -208,7 +219,7 @@ inline void PengRobinsonGas::operator+= } template -inline void PengRobinsonGas::operator-= +inline void Foam::PengRobinsonGas::operator-= ( const PengRobinsonGas& pg ) @@ -226,14 +237,85 @@ inline void PengRobinsonGas::operator-= } template -inline void PengRobinsonGas::operator*=(const scalar s) +inline void Foam::PengRobinsonGas::operator*=(const scalar s) { Specie::operator*=(s); } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + + +template +Foam::PengRobinsonGas Foam::operator+ +( + const PengRobinsonGas& pg1, + const PengRobinsonGas& pg2 +) +{ + scalar nMoles = pg1.nMoles() + pg2.nMoles(); + scalar molr1 = pg1.nMoles()/nMoles; + scalar molr2 = pg2.nMoles()/nMoles; + + return PengRobinsonGas + ( + static_cast(pg1) + + static_cast(pg2), + molr1*pg1.Tc_ + molr2*pg2.Tc_, + molr1*pg1.Pc_ + molr2*pg2.Pc_, + molr1*pg1.omega_ + molr2*pg2.omega_ + ); +} + + +template +Foam::PengRobinsonGas Foam::operator- +( + const PengRobinsonGas& pg1, + const PengRobinsonGas& pg2 +) +{ + scalar nMoles = pg1.nMoles() + pg2.nMoles(); + scalar molr1 = pg1.nMoles()/nMoles; + scalar molr2 = pg2.nMoles()/nMoles; + + return PengRobinsonGas + ( + static_cast(pg1) + - static_cast(pg2), + molr1*pg1.Tc_ - molr2*pg2.Tc_, + molr1*pg1.Pc_ - molr2*pg2.Pc_, + molr1*pg1.omega_ - molr2*pg2.omega_ + ); +} + + +template +Foam::PengRobinsonGas Foam::operator* +( + const scalar s, + const PengRobinsonGas& pg +) +{ + return PengRobinsonGas + ( + s*static_cast(pg), + pg.Tc_, + pg.Pc_, + pg.omega_ + ); +} + + +template +Foam::PengRobinsonGas Foam::operator== +( + const PengRobinsonGas& pg1, + const PengRobinsonGas& pg2 +) +{ + return pg2 - pg1; +} -} // End namespace Foam // ************************************************************************* // From 1579d0e30c91597de4cb4d2978c3a66af9459345 Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 5 Mar 2014 10:14:44 +0000 Subject: [PATCH 03/11] STY: changing header of C file --- .../PengRobinsonGas/PengRobinsonGas.C | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C index b39f0c9d..4704bb39 100644 --- a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C +++ b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C @@ -2,16 +2,16 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation \\/ 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 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 @@ -19,11 +19,7 @@ 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 - -Description - Perfect gas equation of state. + along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ From 770793ff9d2094eb49ad064ac8bfad9fdbeb5679 Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 5 Mar 2014 10:32:27 +0000 Subject: [PATCH 04/11] STY: More modifications to the style --- .../equationOfState/PengRobinsonGas/PengRobinsonGas.C | 10 ++++++++++ .../equationOfState/PengRobinsonGas/PengRobinsonGas.H | 4 ++++ .../equationOfState/PengRobinsonGas/PengRobinsonGasI.H | 2 ++ 3 files changed, 16 insertions(+) diff --git a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C index 4704bb39..e2b99d08 100644 --- a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C +++ b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C @@ -53,6 +53,16 @@ Foam::PengRobinsonGas::PengRobinsonGas {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +template +void Foam::PengRobinsonGas::write(Ostream& os) const +{ + Specie::write(os); +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.H b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.H index fd141117..7d1df112 100644 --- a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.H +++ b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.H @@ -220,6 +220,10 @@ public: }; +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "PengRobinsonGasI.H" diff --git a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H index 861f2e09..aae0b92f 100644 --- a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H +++ b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H @@ -218,6 +218,7 @@ inline void Foam::PengRobinsonGas::operator+= omega_ = molr1*omega_ + molr2*pg.omega_; } + template inline void Foam::PengRobinsonGas::operator-= ( @@ -236,6 +237,7 @@ inline void Foam::PengRobinsonGas::operator-= omega_ = molr1*omega_ - molr2*pg.omega_; } + template inline void Foam::PengRobinsonGas::operator*=(const scalar s) { From c70c74aa39f7f15028c5f1226c6174ae47f8725f Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 5 Mar 2014 16:04:10 +0000 Subject: [PATCH 05/11] driftFluxFoam: Rationalisation of the handling of Udm and tauDm --- .../solvers/multiphase/driftFluxFoam/UEqn.H | 2 +- .../driftFluxFoam/alphaEqnSubCycle.H | 2 +- .../multiphase/driftFluxFoam/createFields.H | 4 +- .../multiphase/driftFluxFoam/driftFluxFoam.C | 2 +- .../relativeVelocityModels/general/general.C | 8 ++-- .../relativeVelocityModels/general/general.H | 4 +- .../relativeVelocityModel.C | 44 ++++++++----------- .../relativeVelocityModel.H | 18 +++----- .../relativeVelocityModels/simple/simple.C | 8 +--- .../relativeVelocityModels/simple/simple.H | 4 +- .../driftFluxFoam/ras/dahl/system/fvSchemes | 2 +- .../ras/mixerVessel2D/system/fvSchemes | 2 +- .../driftFluxFoam/ras/tank3D/system/fvSchemes | 2 +- 13 files changed, 42 insertions(+), 60 deletions(-) diff --git a/applications/solvers/multiphase/driftFluxFoam/UEqn.H b/applications/solvers/multiphase/driftFluxFoam/UEqn.H index 8933a082..f8cf3a9b 100644 --- a/applications/solvers/multiphase/driftFluxFoam/UEqn.H +++ b/applications/solvers/multiphase/driftFluxFoam/UEqn.H @@ -4,7 +4,7 @@ ( fvm::ddt(rho, U) + fvm::div(rhoPhi, U) - + fvc::div(uRelModel.tau(), "div(phiUkm,Ukm)") + + fvc::div(UdmModel.tauDm()) - fvm::laplacian(muEff, U) - fvc::div(muEff*dev2(T(fvc::grad(U)))) == diff --git a/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H index 218ef2d9..53da0f1f 100644 --- a/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H @@ -13,7 +13,7 @@ surfaceScalarField phir ( - mesh.Sf() & fvc::interpolate(uRelModel.Udm()) + mesh.Sf() & fvc::interpolate(UdmModel.Udm()) ); if (nAlphaSubCycles > 1) diff --git a/applications/solvers/multiphase/driftFluxFoam/createFields.H b/applications/solvers/multiphase/driftFluxFoam/createFields.H index 13a5cf81..36c54f8e 100644 --- a/applications/solvers/multiphase/driftFluxFoam/createFields.H +++ b/applications/solvers/multiphase/driftFluxFoam/createFields.H @@ -86,7 +86,7 @@ // Relative Velocity // ~~~~~~~~~~~~~~~~~ - autoPtr uRelModelPtr + autoPtr UdmModelPtr ( relativeVelocityModel::New ( @@ -95,7 +95,7 @@ ) ); - relativeVelocityModel& uRelModel(uRelModelPtr()); + relativeVelocityModel& UdmModel(UdmModelPtr()); // Turbulence diff --git a/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C b/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C index 72a86c6e..8912e0f3 100644 --- a/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C +++ b/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) { #include "alphaControls.H" - uRelModel.update(); + UdmModel.correct(); #include "alphaEqnSubCycle.H" diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C index f39aa747..4e8801f2 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C @@ -62,11 +62,11 @@ Foam::relativeVelocityModels::general::~general() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -Foam::tmp -Foam::relativeVelocityModels::general::Ur() const +void Foam::relativeVelocityModels::general::correct() { - return - V0_ + Udm_ = + (rhoC_/rho()) + *V0_ *( exp(-a_*max(alphaD_ - residualAlpha_, scalar(0))) - exp(-a1_*max(alphaD_ - residualAlpha_, scalar(0))) diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.H b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.H index 34f5247a..a3e6b7ec 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.H +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.H @@ -89,8 +89,8 @@ public: // Member Functions - //- Relative velocity - virtual tmp Ur() const; + //- Update the diffusion velocity + virtual void correct(); }; diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C index 5b0e51a2..7f785d32 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C @@ -85,23 +85,6 @@ Foam::relativeVelocityModel::relativeVelocityModel alphaC_.mesh(), dimensionedVector("Udm", dimVelocity, vector::zero), mixture.U().boundaryField().types() - ), - - tau_ - ( - IOobject - ( - "Udm", - alphaC_.time().timeName(), - alphaC_.mesh() - ), - alphaC_.mesh(), - dimensionedSymmTensor - ( - "Udm", - sqr(dimVelocity)*dimDensity, - symmTensor::zero - ) ) {} @@ -156,19 +139,28 @@ Foam::relativeVelocityModel::~relativeVelocityModel() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -void Foam::relativeVelocityModel::update() +tmp Foam::relativeVelocityModel::rho() const { - tmp URel(Ur()); + return alphaC_*rhoC_ + alphaD_*rhoD_; +} - tmp betaC(alphaC_*rhoC_); - tmp betaD(alphaD_*rhoD_); - tmp rhoM(betaC() + betaD()); - tmp Udm = URel()*betaC()/rhoM; - tmp Ucm = Udm() - URel; +tmp Foam::relativeVelocityModel::tauDm() const +{ + volScalarField betaC(alphaC_*rhoC_); + volScalarField betaD(alphaD_*rhoD_); - Udm_ = Udm(); - tau_ = betaD*sqr(Udm) + betaC*sqr(Ucm); + // Calculate the relative velocity of the continuous phase w.r.t the mean + volVectorField Ucm(betaD*Udm_/betaC); + + return tmp + ( + new volSymmTensorField + ( + "tauDm", + betaD*sqr(Udm_) + betaC*sqr(Ucm) + ) + ); } diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.H b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.H index 73277bc3..86c9a198 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.H +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.H @@ -81,10 +81,7 @@ protected: const dimensionedScalar& rhoD_; //- Dispersed diffusion velocity - volVectorField Udm_; - - //- Stress - volSymmTensorField tau_; + mutable volVectorField Udm_; public: @@ -127,8 +124,8 @@ public: // Member Functions - //- Calculate the relative velocity of the dispersed phase - virtual tmp Ur() const = 0; + //- Return the mixture mean density + tmp rho() const; //- Return the diffusion velocity of the dispersed phase const volVectorField& Udm() const @@ -137,13 +134,10 @@ public: } //- Return the stress tensor due to the phase transport - const volSymmTensorField& tau() const - { - return tau_; - } + tmp tauDm() const; - //- Update the stored diffusion velocity and stress - void update(); + //- Update the diffusion velocity + virtual void correct() = 0; }; diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.C b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.C index a8e99b25..a0d72b75 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.C +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.C @@ -61,13 +61,9 @@ Foam::relativeVelocityModels::simple::~simple() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -Foam::tmp -Foam::relativeVelocityModels::simple::Ur() const +void Foam::relativeVelocityModels::simple::correct() { - return - V0_ - *pow(scalar(10), -a_*max(alphaD_, scalar(0))) - /max(alphaC_, residualAlpha_); + Udm_ = (rhoC_/rho())*V0_*pow(scalar(10), -a_*max(alphaD_, scalar(0))); } diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.H b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.H index e94f854e..6ce106e7 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.H +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.H @@ -86,8 +86,8 @@ public: // Member Functions - //- Relative velocity - virtual tmp Ur() const; + //- Update the diffusion velocity + virtual void correct(); }; diff --git a/tutorials/multiphase/driftFluxFoam/ras/dahl/system/fvSchemes b/tutorials/multiphase/driftFluxFoam/ras/dahl/system/fvSchemes index 37cb7ec6..5ac73daf 100644 --- a/tutorials/multiphase/driftFluxFoam/ras/dahl/system/fvSchemes +++ b/tutorials/multiphase/driftFluxFoam/ras/dahl/system/fvSchemes @@ -30,7 +30,7 @@ divSchemes default none; div(rhoPhi,U) Gauss linearUpwind grad(U); - div(phiUkm,Ukm) Gauss linear; + div(tauDm) Gauss linear; "div\(phi,alpha.*\)" Gauss vanLeer; "div\(phirb,alpha.*\)" Gauss linear; div(rhoPhi,k) Gauss limitedLinear 1; diff --git a/tutorials/multiphase/driftFluxFoam/ras/mixerVessel2D/system/fvSchemes b/tutorials/multiphase/driftFluxFoam/ras/mixerVessel2D/system/fvSchemes index 37cb7ec6..5ac73daf 100644 --- a/tutorials/multiphase/driftFluxFoam/ras/mixerVessel2D/system/fvSchemes +++ b/tutorials/multiphase/driftFluxFoam/ras/mixerVessel2D/system/fvSchemes @@ -30,7 +30,7 @@ divSchemes default none; div(rhoPhi,U) Gauss linearUpwind grad(U); - div(phiUkm,Ukm) Gauss linear; + div(tauDm) Gauss linear; "div\(phi,alpha.*\)" Gauss vanLeer; "div\(phirb,alpha.*\)" Gauss linear; div(rhoPhi,k) Gauss limitedLinear 1; diff --git a/tutorials/multiphase/driftFluxFoam/ras/tank3D/system/fvSchemes b/tutorials/multiphase/driftFluxFoam/ras/tank3D/system/fvSchemes index 22611d4f..6942046c 100644 --- a/tutorials/multiphase/driftFluxFoam/ras/tank3D/system/fvSchemes +++ b/tutorials/multiphase/driftFluxFoam/ras/tank3D/system/fvSchemes @@ -30,7 +30,7 @@ divSchemes default none; div(rhoPhi,U) Gauss linearUpwind grad(U); - div(phiUkm,Ukm) Gauss linear; + div(tauDm) Gauss linear; "div\(phi,alpha.*\)" Gauss vanLeer; "div\(phirb,alpha.*\)" Gauss linear; div(rhoPhi,k) Gauss limitedLinear 1; From f6493af66386c56bbbd76668cbbdc382ffb7f8fc Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 6 Mar 2014 17:54:27 +0000 Subject: [PATCH 06/11] driftFluxFoam: Created special mixture viscosity framework for interacting phases Added Thomas' slurry model --- .../multiphase/driftFluxFoam/Allwclean | 2 +- .../solvers/multiphase/driftFluxFoam/Allwmake | 2 +- .../multiphase/driftFluxFoam/Make/files | 1 + .../multiphase/driftFluxFoam/Make/options | 2 + .../multiphase/driftFluxFoam/createFields.H | 6 +- .../multiphase/driftFluxFoam/driftFluxFoam.C | 3 +- ...incompressibleTwoPhaseInteractingMixture.C | 135 ++++++++++++++ ...incompressibleTwoPhaseInteractingMixture.H | 172 ++++++++++++++++++ .../multiphase/driftFluxFoam/kEpsilon.H | 2 +- .../BinghamPlastic/BinghamPlastic.C | 120 ++++++------ .../BinghamPlastic/BinghamPlastic.H | 21 +-- .../mixtureViscosityModels/Make/files | 7 + .../Make/options | 1 + .../mixtureViscosityModel.C | 65 +++++++ .../mixtureViscosityModel.H | 165 +++++++++++++++++ .../mixtureViscosityModelNew.C | 65 +++++++ .../plastic/plastic.C | 146 ++++----------- .../plastic/plastic.H | 54 +----- .../mixtureViscosityModels/slurry/slurry.C | 94 ++++++++++ .../mixtureViscosityModels/slurry/slurry.H | 121 ++++++++++++ .../relativeVelocityModels/Make/options | 2 + .../relativeVelocityModels/general/general.C | 16 +- .../relativeVelocityModels/general/general.H | 2 +- .../relativeVelocityModel.C | 54 ++---- .../relativeVelocityModel.H | 19 +- .../relativeVelocityModels/simple/simple.C | 10 +- .../relativeVelocityModels/simple/simple.H | 2 +- .../driftFluxFoam/viscosityModels/Make/files | 4 - .../ras/dahl/constant/transportProperties | 30 ++- .../constant/transportProperties | 30 ++- .../ras/tank3D/constant/transportProperties | 31 ++-- 31 files changed, 1038 insertions(+), 346 deletions(-) create mode 100644 applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C create mode 100644 applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.H rename applications/solvers/multiphase/driftFluxFoam/{viscosityModels => mixtureViscosityModels}/BinghamPlastic/BinghamPlastic.C (65%) rename applications/solvers/multiphase/driftFluxFoam/{viscosityModels => mixtureViscosityModels}/BinghamPlastic/BinghamPlastic.H (87%) create mode 100644 applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/Make/files rename applications/solvers/multiphase/driftFluxFoam/{viscosityModels => mixtureViscosityModels}/Make/options (85%) create mode 100644 applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/mixtureViscosityModel/mixtureViscosityModel.C create mode 100644 applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/mixtureViscosityModel/mixtureViscosityModel.H create mode 100644 applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/mixtureViscosityModel/mixtureViscosityModelNew.C rename applications/solvers/multiphase/driftFluxFoam/{viscosityModels => mixtureViscosityModels}/plastic/plastic.C (54%) rename applications/solvers/multiphase/driftFluxFoam/{viscosityModels => mixtureViscosityModels}/plastic/plastic.H (71%) create mode 100644 applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/slurry/slurry.C create mode 100644 applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/slurry/slurry.H delete mode 100644 applications/solvers/multiphase/driftFluxFoam/viscosityModels/Make/files diff --git a/applications/solvers/multiphase/driftFluxFoam/Allwclean b/applications/solvers/multiphase/driftFluxFoam/Allwclean index 3254f968..2af62458 100755 --- a/applications/solvers/multiphase/driftFluxFoam/Allwclean +++ b/applications/solvers/multiphase/driftFluxFoam/Allwclean @@ -2,7 +2,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x -wclean libso viscosityModels +wclean libso mixtureViscosityModels wclean libso relativeVelocityModels wclean diff --git a/applications/solvers/multiphase/driftFluxFoam/Allwmake b/applications/solvers/multiphase/driftFluxFoam/Allwmake index 6e719c51..764aef62 100755 --- a/applications/solvers/multiphase/driftFluxFoam/Allwmake +++ b/applications/solvers/multiphase/driftFluxFoam/Allwmake @@ -2,7 +2,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x -wmake libso viscosityModels +wmake libso mixtureViscosityModels wmake libso relativeVelocityModels wmake diff --git a/applications/solvers/multiphase/driftFluxFoam/Make/files b/applications/solvers/multiphase/driftFluxFoam/Make/files index adbf0798..2a55d1c5 100644 --- a/applications/solvers/multiphase/driftFluxFoam/Make/files +++ b/applications/solvers/multiphase/driftFluxFoam/Make/files @@ -1,3 +1,4 @@ +incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C driftFluxFoam.C EXE = $(FOAM_APPBIN)/driftFluxFoam diff --git a/applications/solvers/multiphase/driftFluxFoam/Make/options b/applications/solvers/multiphase/driftFluxFoam/Make/options index b97b1fd5..bce47402 100644 --- a/applications/solvers/multiphase/driftFluxFoam/Make/options +++ b/applications/solvers/multiphase/driftFluxFoam/Make/options @@ -1,4 +1,6 @@ EXE_INC = \ + -IincompressibleTwoPhaseInteractingMixture \ + -ImixtureViscosityModels/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ diff --git a/applications/solvers/multiphase/driftFluxFoam/createFields.H b/applications/solvers/multiphase/driftFluxFoam/createFields.H index 36c54f8e..3224f441 100644 --- a/applications/solvers/multiphase/driftFluxFoam/createFields.H +++ b/applications/solvers/multiphase/driftFluxFoam/createFields.H @@ -33,13 +33,13 @@ // ~~~~~~~~~ Info<< "Reading transportProperties\n" << endl; - incompressibleTwoPhaseMixture twoPhaseProperties(U, phi); + incompressibleTwoPhaseInteractingMixture twoPhaseProperties(U, phi); volScalarField& alpha1(twoPhaseProperties.alpha1()); volScalarField& alpha2(twoPhaseProperties.alpha2()); - const dimensionedScalar& rho1 = twoPhaseProperties.rho1(); - const dimensionedScalar& rho2 = twoPhaseProperties.rho2(); + const dimensionedScalar& rho1 = twoPhaseProperties.rhod(); + const dimensionedScalar& rho2 = twoPhaseProperties.rhoc(); IOdictionary transportProperties ( diff --git a/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C b/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C index 8912e0f3..da03517e 100644 --- a/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C +++ b/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C @@ -36,7 +36,7 @@ Description #include "fvCFD.H" #include "CMULES.H" #include "subCycle.H" -#include "incompressibleTwoPhaseMixture.H" +#include "incompressibleTwoPhaseInteractingMixture.H" #include "relativeVelocityModel.H" #include "nearWallDist.H" #include "wallFvPatch.H" @@ -87,6 +87,7 @@ int main(int argc, char *argv[]) #include "alphaEqnSubCycle.H" twoPhaseProperties.correct(); + Info<< average(twoPhaseProperties.mu()) << endl; #include "UEqn.H" diff --git a/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C b/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C new file mode 100644 index 00000000..d656f92b --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ 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 "incompressibleTwoPhaseInteractingMixture.H" +#include "addToRunTimeSelectionTable.H" +#include "surfaceFields.H" +#include "fvc.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(incompressibleTwoPhaseInteractingMixture, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::incompressibleTwoPhaseInteractingMixture:: +incompressibleTwoPhaseInteractingMixture +( + const volVectorField& U, + const surfaceScalarField& phi +) +: + IOdictionary + ( + IOobject + ( + "transportProperties", + U.time().constant(), + U.db(), + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) + ), + twoPhaseMixture(U.mesh(), *this), + + muModel_ + ( + mixtureViscosityModel::New + ( + "mu", + subDict(phase1Name_), + U, + phi + ) + ), + + nucModel_ + ( + viscosityModel::New + ( + "nuc", + subDict(phase2Name_), + U, + phi + ) + ), + + rhod_("rho", dimDensity, muModel_->viscosityProperties().lookup("rho")), + rhoc_("rho", dimDensity, nucModel_->viscosityProperties().lookup("rho")), + + U_(U), + phi_(phi), + + mu_ + ( + IOobject + ( + "mu", + U_.time().timeName(), + U_.db() + ), + U_.mesh(), + dimensionedScalar("mu", dimensionSet(1, -1, -1, 0, 0), 0), + calculatedFvPatchScalarField::typeName + ) +{ + correct(); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::incompressibleTwoPhaseInteractingMixture::read() +{ + if (regIOobject::read()) + { + if + ( + muModel_().read(subDict(phase1Name_)) + && nucModel_().read(subDict(phase2Name_)) + ) + { + muModel_->viscosityProperties().lookup("rho") >> rhod_; + nucModel_->viscosityProperties().lookup("rho") >> rhoc_; + + return true; + } + else + { + return false; + } + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.H b/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.H new file mode 100644 index 00000000..d167eaca --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.H @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ 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::incompressibleTwoPhaseInteractingMixture + +Description + A two-phase incompressible transportModel for interacting phases + requiring the direct evaluation of the mixture viscosity, + e.g. activated sludge or slurry. + +SourceFiles + incompressibleTwoPhaseInteractingMixture.C + +\*---------------------------------------------------------------------------*/ + +#ifndef incompressibleTwoPhaseInteractingMixture_H +#define incompressibleTwoPhaseInteractingMixture_H + +#include "incompressible/transportModel/transportModel.H" +#include "incompressible/viscosityModels/viscosityModel/viscosityModel.H" +#include "mixtureViscosityModel.H" +#include "twoPhaseMixture.H" +#include "IOdictionary.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class incompressibleTwoPhaseInteractingMixture Declaration +\*---------------------------------------------------------------------------*/ + +class incompressibleTwoPhaseInteractingMixture +: + public IOdictionary, + public transportModel, + public twoPhaseMixture +{ +protected: + + // Protected data + + autoPtr muModel_; + autoPtr nucModel_; + + dimensionedScalar rhod_; + dimensionedScalar rhoc_; + + const volVectorField& U_; + const surfaceScalarField& phi_; + + volScalarField mu_; + + +public: + + TypeName("incompressibleTwoPhaseInteractingMixture"); + + + // Constructors + + //- Construct from components + incompressibleTwoPhaseInteractingMixture + ( + const volVectorField& U, + const surfaceScalarField& phi + ); + + + //- Destructor + virtual ~incompressibleTwoPhaseInteractingMixture() + {} + + + // Member Functions + + //- Return const-access to the mixture viscosityModel + const mixtureViscosityModel& muModel() const + { + return muModel_(); + } + + //- Return const-access to the continuous-phase viscosityModel + const viscosityModel& nucModel() const + { + return nucModel_(); + } + + //- Return const-access to the dispersed-phase density + const dimensionedScalar& rhod() const + { + return rhod_; + } + + //- Return const-access to continuous-phase density + const dimensionedScalar& rhoc() const + { + return rhoc_; + }; + + //- Return const-access to the mixture velocity + const volVectorField& U() const + { + return U_; + } + + //- Return the dynamic mixture viscosity + tmp mu() const + { + return mu_; + } + + //- Return the mixture viscosity + virtual tmp nu() const + { + notImplemented("incompressibleTwoPhaseInteractingMixture::nu()"); + return volScalarField::null(); + } + + //- Return the mixture viscosity for patch + virtual tmp nu(const label patchi) const + { + notImplemented + ( + "incompressibleTwoPhaseInteractingMixture::nu(const label)" + ); + return scalarField::null(); + } + + //- Correct the laminar viscosity + virtual void correct() + { + mu_ = muModel_->mu(rhoc_*nucModel_->nu()); + } + + //- Read base transportProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/driftFluxFoam/kEpsilon.H b/applications/solvers/multiphase/driftFluxFoam/kEpsilon.H index 20d46617..92931154 100644 --- a/applications/solvers/multiphase/driftFluxFoam/kEpsilon.H +++ b/applications/solvers/multiphase/driftFluxFoam/kEpsilon.H @@ -21,7 +21,7 @@ if (turbulence) Cmu*k/sigmak*(g & fvc::grad(rho))/(epsilon + epsilonMin) ); - volScalarField muc(twoPhaseProperties.nuModel2().nu()*rho2); + volScalarField muc(twoPhaseProperties.nucModel().nu()*rho2); #include "wallFunctions.H" diff --git a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/BinghamPlastic/BinghamPlastic.C b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/BinghamPlastic/BinghamPlastic.C similarity index 65% rename from applications/solvers/multiphase/driftFluxFoam/viscosityModels/BinghamPlastic/BinghamPlastic.C rename to applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/BinghamPlastic/BinghamPlastic.C index f75355f8..bf9aa605 100644 --- a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/BinghamPlastic/BinghamPlastic.C +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/BinghamPlastic/BinghamPlastic.C @@ -25,20 +25,19 @@ License #include "BinghamPlastic.H" #include "addToRunTimeSelectionTable.H" -#include "surfaceFields.H" -#include "fvc.H" +#include "fvcGrad.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -namespace viscosityModels +namespace mixtureViscosityModels { defineTypeNameAndDebug(BinghamPlastic, 0); addToRunTimeSelectionTable ( - viscosityModel, + mixtureViscosityModel, BinghamPlastic, dictionary ); @@ -46,56 +45,9 @@ namespace viscosityModels } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -Foam::tmp -Foam::viscosityModels::BinghamPlastic::correctionNu -( - const dimensionedScalar& rhoc, - const dimensionedScalar& rhop, - const volScalarField& nuc -) const -{ - volScalarField - tauy - ( - yieldStressCoeff_ - *( - pow - ( - scalar(10), - yieldStressExponent_ - *(max(alpha_, scalar(0)) + yieldStressOffset_) - ) - - pow - ( - scalar(10), - yieldStressExponent_*yieldStressOffset_ - ) - ) - ); - - volScalarField - nup - ( - plastic::correctionNu(rhoc, rhop, nuc) - ); - - dimensionedScalar tauySmall("tauySmall", tauy.dimensions(), SMALL); - - return - tauy - /( - mag(fvc::grad(U_)) - + 1.0e-4*(tauy + tauySmall)/(nup + (rhoc/rhop)*nuc) - ) - + nup; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::viscosityModels::BinghamPlastic::BinghamPlastic +Foam::mixtureViscosityModels::BinghamPlastic::BinghamPlastic ( const word& name, const dictionary& viscosityProperties, @@ -104,16 +56,72 @@ Foam::viscosityModels::BinghamPlastic::BinghamPlastic ) : plastic(name, viscosityProperties, U, phi, typeName), - yieldStressCoeff_(plasticCoeffs_.lookup("yieldStressCoeff")), - yieldStressExponent_(plasticCoeffs_.lookup("yieldStressExponent")), - yieldStressOffset_(plasticCoeffs_.lookup("yieldStressOffset")), + yieldStressCoeff_ + ( + "BinghamCoeff", + dimensionSet(1, -1, -2, 0, 0), + plasticCoeffs_.lookup("BinghamCoeff") + ), + yieldStressExponent_ + ( + "BinghamExponent", + dimless, + plasticCoeffs_.lookup("BinghamExponent") + ), + yieldStressOffset_ + ( + "BinghamOffset", + dimless, + plasticCoeffs_.lookup("BinghamOffset") + ), U_(U) {} // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -bool Foam::viscosityModels::BinghamPlastic::read +Foam::tmp +Foam::mixtureViscosityModels::BinghamPlastic::mu +( + const volScalarField& muc +) const +{ + volScalarField tauy + ( + yieldStressCoeff_ + *( + pow + ( + scalar(10), + yieldStressExponent_ + *(max(alpha_, scalar(0)) + yieldStressOffset_) + ) + - pow + ( + scalar(10), + yieldStressExponent_*yieldStressOffset_ + ) + ) + ); + + volScalarField mup(plastic::mu(muc)); + + dimensionedScalar tauySmall("tauySmall", tauy.dimensions(), SMALL); + + return min + ( + tauy + /( + mag(fvc::grad(U_)) + + 1.0e-4*(tauy + tauySmall)/mup + ) + + mup, + muMax_ + ); +} + + +bool Foam::mixtureViscosityModels::BinghamPlastic::read ( const dictionary& viscosityProperties ) diff --git a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/BinghamPlastic/BinghamPlastic.H b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/BinghamPlastic/BinghamPlastic.H similarity index 87% rename from applications/solvers/multiphase/driftFluxFoam/viscosityModels/BinghamPlastic/BinghamPlastic.H rename to applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/BinghamPlastic/BinghamPlastic.H index 829f42b7..c63bb42d 100644 --- a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/BinghamPlastic/BinghamPlastic.H +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/BinghamPlastic/BinghamPlastic.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::viscosityModels::BinghamPlastic + Foam::mixtureViscosityModels::BinghamPlastic Description Viscosity correction model for Bingham plastics. @@ -41,7 +41,7 @@ SourceFiles namespace Foam { -namespace viscosityModels +namespace mixtureViscosityModels { /*---------------------------------------------------------------------------*\ @@ -69,17 +69,6 @@ protected: const volVectorField& U_; - // Protected Member Functions - - //- Calculate and return the laminar viscosity correction - virtual tmp correctionNu - ( - const dimensionedScalar& rhoc, - const dimensionedScalar& rhop, - const volScalarField& nuc - ) const; - - public: //- Runtime type information @@ -105,6 +94,10 @@ public: // Member Functions + //- Return the mixture viscosity + // given the viscosity of the continuous phase + tmp mu(const volScalarField& muc) const; + //- Read transportProperties dictionary bool read(const dictionary& viscosityProperties); }; @@ -112,7 +105,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace viscosityModels +} // End namespace mixtureViscosityModels } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/Make/files b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/Make/files new file mode 100644 index 00000000..05d9a0ef --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/Make/files @@ -0,0 +1,7 @@ +mixtureViscosityModel/mixtureViscosityModel.C +mixtureViscosityModel/mixtureViscosityModelNew.C +plastic/plastic.C +BinghamPlastic/BinghamPlastic.C +slurry/slurry.C + +LIB = $(FOAM_LIBBIN)/libdriftFluxTransportModels diff --git a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/Make/options b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/Make/options similarity index 85% rename from applications/solvers/multiphase/driftFluxFoam/viscosityModels/Make/options rename to applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/Make/options index 6c72f3a6..415029e0 100644 --- a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/Make/options +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -I../incompressibleTwoPhaseInteractingMixture \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ diff --git a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/mixtureViscosityModel/mixtureViscosityModel.C b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/mixtureViscosityModel/mixtureViscosityModel.C new file mode 100644 index 00000000..33126f13 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/mixtureViscosityModel/mixtureViscosityModel.C @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ 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 "mixtureViscosityModel.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(mixtureViscosityModel, 0); + defineRunTimeSelectionTable(mixtureViscosityModel, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::mixtureViscosityModel::mixtureViscosityModel +( + const word& name, + const dictionary& viscosityProperties, + const volVectorField& U, + const surfaceScalarField& phi +) +: + name_(name), + viscosityProperties_(viscosityProperties), + U_(U), + phi_(phi) +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::mixtureViscosityModel::read(const dictionary& viscosityProperties) +{ + viscosityProperties_ = viscosityProperties; + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/mixtureViscosityModel/mixtureViscosityModel.H b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/mixtureViscosityModel/mixtureViscosityModel.H new file mode 100644 index 00000000..9b7db43f --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/mixtureViscosityModel/mixtureViscosityModel.H @@ -0,0 +1,165 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ 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 . + +Namespace + Foam::mixtureViscosityModels + +Description + A namespace for incompressible mixtureViscosityModel implementations. + +Class + Foam::mixtureViscosityModel + +Description + An abstract base class for incompressible mixtureViscosityModels. + + The strain rate is defined by: + + mag(symm(grad(U))) + + +SourceFiles + mixtureViscosityModel.C + mixtureViscosityModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef mixtureViscosityModel_H +#define mixtureViscosityModel_H + +#include "dictionary.H" +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "dimensionedScalar.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class mixtureViscosityModel Declaration +\*---------------------------------------------------------------------------*/ + +class mixtureViscosityModel +{ + +protected: + + // Protected data + + word name_; + dictionary viscosityProperties_; + + const volVectorField& U_; + const surfaceScalarField& phi_; + + + // Private Member Functions + + //- Disallow copy construct + mixtureViscosityModel(const mixtureViscosityModel&); + + //- Disallow default bitwise assignment + void operator=(const mixtureViscosityModel&); + + +public: + + //- Runtime type information + TypeName("mixtureViscosityModel"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + mixtureViscosityModel, + dictionary, + ( + const word& name, + const dictionary& viscosityProperties, + const volVectorField& U, + const surfaceScalarField& phi + ), + (name, viscosityProperties, U, phi) + ); + + + // Selectors + + //- Return a reference to the selected viscosity model + static autoPtr New + ( + const word& name, + const dictionary& viscosityProperties, + const volVectorField& U, + const surfaceScalarField& phi + ); + + + // Constructors + + //- Construct from components + mixtureViscosityModel + ( + const word& name, + const dictionary& viscosityProperties, + const volVectorField& U, + const surfaceScalarField& phi + ); + + + //- Destructor + virtual ~mixtureViscosityModel() + {} + + + // Member Functions + + //- Return the phase transport properties dictionary + const dictionary& viscosityProperties() const + { + return viscosityProperties_; + } + + //- Return the mixture viscosity + // given the viscosity of the continuous phase + virtual tmp mu(const volScalarField& muc) const = 0; + + //- Read transportProperties dictionary + virtual bool read(const dictionary& viscosityProperties) = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/mixtureViscosityModel/mixtureViscosityModelNew.C b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/mixtureViscosityModel/mixtureViscosityModelNew.C new file mode 100644 index 00000000..ecd9c256 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/mixtureViscosityModel/mixtureViscosityModelNew.C @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ 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 "mixtureViscosityModel.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::mixtureViscosityModel::New +( + const word& name, + const dictionary& viscosityProperties, + const volVectorField& U, + const surfaceScalarField& phi +) +{ + const word modelType(viscosityProperties.lookup("transportModel")); + + Info<< "Selecting incompressible transport model " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "mixtureViscosityModel::New(const volVectorField&, " + "const surfaceScalarField&)" + ) << "Unknown mixtureViscosityModel type " + << modelType << nl << nl + << "Valid mixtureViscosityModels are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr + (cstrIter()(name, viscosityProperties, U, phi)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/plastic/plastic.C b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C similarity index 54% rename from applications/solvers/multiphase/driftFluxFoam/viscosityModels/plastic/plastic.C rename to applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C index 12b89e4c..5eb7e0f9 100644 --- a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/plastic/plastic.C +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C @@ -25,20 +25,18 @@ License #include "plastic.H" #include "addToRunTimeSelectionTable.H" -#include "surfaceFields.H" -#include "incompressibleTwoPhaseMixture.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -namespace viscosityModels +namespace mixtureViscosityModels { defineTypeNameAndDebug(plastic, 0); addToRunTimeSelectionTable ( - viscosityModel, + mixtureViscosityModel, plastic, dictionary ); @@ -46,90 +44,9 @@ namespace viscosityModels } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -Foam::tmp -Foam::viscosityModels::plastic::calcNu() const -{ - const incompressibleTwoPhaseMixture& twoPhaseProperties = - alpha_.mesh().lookupObject - ( - "transportProperties" - ); - - bool isThisIsPhase1(&twoPhaseProperties.nuModel1() == this); - - dimensionedScalar - rhoc - ( - isThisIsPhase1 - ? twoPhaseProperties.rho2() - : twoPhaseProperties.rho1() - ); - - dimensionedScalar - rhop - ( - isThisIsPhase1 - ? twoPhaseProperties.rho1() - : twoPhaseProperties.rho2() - ); - - volScalarField - nuc - ( - ( - isThisIsPhase1 - ? twoPhaseProperties.nuModel2() - : twoPhaseProperties.nuModel1() - ).nu() - ); - - volScalarField - nup - ( - correctionNu(rhoc, rhop, nuc) - ); - - return - max - ( - nuMin_, - min - ( - nuMax_, - ( - nup + (rhoc/rhop)*nuc*alpha_ - ) - ) - ) - /max(alpha_, SMALL); -} - - -Foam::tmp -Foam::viscosityModels::plastic::correctionNu -( - const dimensionedScalar& rhoc, - const dimensionedScalar& rhop, - const volScalarField& nuc -) const -{ - return - plasticViscosityCoeff_ - *( - pow - ( - scalar(10), - plasticViscosityExponent_*alpha_ - ) - scalar(1) - ); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::viscosityModels::plastic::plastic +Foam::mixtureViscosityModels::plastic::plastic ( const word& name, const dictionary& viscosityProperties, @@ -138,18 +55,26 @@ Foam::viscosityModels::plastic::plastic const word modelName ) : - viscosityModel(name, viscosityProperties, U, phi), + mixtureViscosityModel(name, viscosityProperties, U, phi), plasticCoeffs_(viscosityProperties.subDict(modelName + "Coeffs")), plasticViscosityCoeff_ ( - plasticCoeffs_.lookup("plasticViscosityCoeff") + "coeff", + dimensionSet(1, -1, -1, 0, 0), + plasticCoeffs_.lookup("coeff") ), plasticViscosityExponent_ ( - plasticCoeffs_.lookup("plasticViscosityExponent") + "exponent", + dimless, + plasticCoeffs_.lookup("exponent") + ), + muMax_ + ( + "muMax", + dimensionSet(1, -1, -1, 0, 0), + plasticCoeffs_.lookup("muMax") ), - nuMin_(plasticCoeffs_.lookup("nuMin")), - nuMax_(plasticCoeffs_.lookup("nuMax")), alpha_ ( U.mesh().lookupObject @@ -160,38 +85,43 @@ Foam::viscosityModels::plastic::plastic viscosityProperties.dictName() ) ) - ), - nu_ - ( - IOobject - ( - name, - U_.time().timeName(), - U_.db(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - U_.mesh(), - dimensionedScalar("nu", dimViscosity, 0) ) {} // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -bool Foam::viscosityModels::plastic::read +Foam::tmp +Foam::mixtureViscosityModels::plastic::mu(const volScalarField& muc) const +{ + return min + ( + muc + + plasticViscosityCoeff_ + *( + pow + ( + scalar(10), + plasticViscosityExponent_*alpha_ + ) - scalar(1) + ), + muMax_ + ); +} + + +bool Foam::mixtureViscosityModels::plastic::read ( const dictionary& viscosityProperties ) { - viscosityModel::read(viscosityProperties); + mixtureViscosityModel::read(viscosityProperties); plasticCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs"); plasticCoeffs_.lookup("k") >> plasticViscosityCoeff_; plasticCoeffs_.lookup("n") >> plasticViscosityExponent_; - plasticCoeffs_.lookup("nuMin") >> nuMin_; - plasticCoeffs_.lookup("nuMax") >> nuMax_; + plasticCoeffs_.lookup("muMax") >> muMax_; return true; } diff --git a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/plastic/plastic.H b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.H similarity index 71% rename from applications/solvers/multiphase/driftFluxFoam/viscosityModels/plastic/plastic.H rename to applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.H index 3ac9ae29..6d1f1891 100644 --- a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/plastic/plastic.H +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::viscosityModels::plastic + Foam::mixtureViscosityModels::plastic Description Viscosity correction model for a generic power-law plastic. @@ -35,7 +35,7 @@ SourceFiles #ifndef plastic_H #define plastic_H -#include "viscosityModel.H" +#include "mixtureViscosityModel.H" #include "dimensionedScalar.H" #include "volFields.H" @@ -44,9 +44,9 @@ SourceFiles namespace Foam { -class incompressibleTwoPhaseMixture; +class incompressibleTwoPhaseInteractingMixture; -namespace viscosityModels +namespace mixtureViscosityModels { /*---------------------------------------------------------------------------*\ @@ -55,7 +55,7 @@ namespace viscosityModels class plastic : - public viscosityModel + public mixtureViscosityModel { protected: @@ -70,32 +70,12 @@ protected: //- Plastic viscosity exponent dimensionedScalar plasticViscosityExponent_; - //- Minimum viscosity - dimensionedScalar nuMin_; - //- Maximum viscosity - dimensionedScalar nuMax_; + dimensionedScalar muMax_; //- Plastic phase fraction const volScalarField& alpha_; - //- Viscosity - volScalarField nu_; - - - // Protected Member Functions - - //- Calculate and return the laminar viscosity - virtual tmp calcNu() const; - - //- Calculate and return the laminar viscosity correction - virtual tmp correctionNu - ( - const dimensionedScalar& rhoc, - const dimensionedScalar& rhop, - const volScalarField& nuc - ) const; - public: @@ -123,23 +103,9 @@ public: // Member Functions - //- Return the laminar viscosity - tmp nu() const - { - return nu_; - } - - //- Return the laminar viscosity for patch - tmp nu(const label patchi) const - { - return nu_.boundaryField()[patchi]; - } - - //- Correct the laminar viscosity - void correct() - { - nu_ = calcNu(); - } + //- Return the mixture viscosity + // given the viscosity of the continuous phase + tmp mu(const volScalarField& muc) const; //- Read transportProperties dictionary bool read(const dictionary& viscosityProperties); @@ -148,7 +114,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace viscosityModels +} // End namespace mixtureViscosityModels } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/slurry/slurry.C b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/slurry/slurry.C new file mode 100644 index 00000000..0e954d77 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/slurry/slurry.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ 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 "slurry.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace mixtureViscosityModels +{ + defineTypeNameAndDebug(slurry, 0); + + addToRunTimeSelectionTable + ( + mixtureViscosityModel, + slurry, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::mixtureViscosityModels::slurry::slurry +( + const word& name, + const dictionary& viscosityProperties, + const volVectorField& U, + const surfaceScalarField& phi, + const word modelName +) +: + mixtureViscosityModel(name, viscosityProperties, U, phi), + alpha_ + ( + U.mesh().lookupObject + ( + IOobject::groupName + ( + viscosityProperties.lookupOrDefault("alpha", "alpha"), + viscosityProperties.dictName() + ) + ) + ) +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp +Foam::mixtureViscosityModels::slurry::mu(const volScalarField& muc) const +{ + return + ( + muc*(1.0 + 2.5*alpha_ + 10.05*sqr(alpha_) + 0.00273*exp(16.6*alpha_)) + ); +} + + +bool Foam::mixtureViscosityModels::slurry::read +( + const dictionary& viscosityProperties +) +{ + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/slurry/slurry.H b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/slurry/slurry.H new file mode 100644 index 00000000..7cfd03b9 --- /dev/null +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/slurry/slurry.H @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ 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::mixtureViscosityModels::slurry + +Description + Thomas' viscosity correction for slurry. + + References: + \verbatim + "Transport characteristics of suspension: + VIII. A note on the viscosity of Newtonian suspensions + of uniform spherical particles". + D.G. Thomas, + J. Colloid Sci. 20 (3), 1965, p267. + \endverbatim + +SourceFiles + slurry.C + +\*---------------------------------------------------------------------------*/ + +#ifndef slurry_H +#define slurry_H + +#include "mixtureViscosityModel.H" +#include "dimensionedScalar.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class incompressibleTwoPhaseInteractingMixture; + +namespace mixtureViscosityModels +{ + +/*---------------------------------------------------------------------------*\ + Class slurry Declaration +\*---------------------------------------------------------------------------*/ + +class slurry +: + public mixtureViscosityModel +{ +protected: + + // Protected data + + //- Slurry phase fraction + const volScalarField& alpha_; + + +public: + + //- Runtime type information + TypeName("slurry"); + + + // Constructors + + //- Construct from components + slurry + ( + const word& name, + const dictionary& viscosityProperties, + const volVectorField& U, + const surfaceScalarField& phi, + const word modelName=typeName + ); + + + //- Destructor + ~slurry() + {} + + + // Member Functions + + //- Return the mixture viscosity + // given the viscosity of the continuous phase + tmp mu(const volScalarField& muc) const; + + //- Read transportProperties dictionary + bool read(const dictionary& viscosityProperties); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace mixtureViscosityModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/Make/options b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/Make/options index badd30f2..fe354554 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/Make/options +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/Make/options @@ -1,4 +1,6 @@ EXE_INC = \ + -I../incompressibleTwoPhaseInteractingMixture \ + -I../mixtureViscosityModels/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C index 4e8801f2..c260bf85 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C @@ -43,13 +43,13 @@ namespace relativeVelocityModels Foam::relativeVelocityModels::general::general ( const dictionary& dict, - const incompressibleTwoPhaseMixture& mixture + const incompressibleTwoPhaseInteractingMixture& mixture ) : relativeVelocityModel(dict, mixture), - a_(dict.lookup("a")), - a1_(dict.lookup("a1")), - V0_(dict.lookup("V0")), + a_("a", dimless, dict.lookup("a")), + a1_("a1", dimless, dict.lookup("a1")), + V0_("V0", dimVelocity, dict.lookup("V0")), residualAlpha_(dict.lookup("residualAlpha")) {} @@ -65,13 +65,13 @@ Foam::relativeVelocityModels::general::~general() void Foam::relativeVelocityModels::general::correct() { Udm_ = - (rhoC_/rho()) + (rhoc_/rho()) *V0_ *( - exp(-a_*max(alphaD_ - residualAlpha_, scalar(0))) - - exp(-a1_*max(alphaD_ - residualAlpha_, scalar(0))) + exp(-a_*max(alphad_ - residualAlpha_, scalar(0))) + - exp(-a1_*max(alphad_ - residualAlpha_, scalar(0))) ) - /max(alphaC_, residualAlpha_); + /max(alphac_, residualAlpha_); } diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.H b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.H index a3e6b7ec..b3621c32 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.H +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.H @@ -79,7 +79,7 @@ public: general ( const dictionary& dict, - const incompressibleTwoPhaseMixture& mixture + const incompressibleTwoPhaseInteractingMixture& mixture ); diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C index 7f785d32..ce184db4 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C @@ -39,50 +39,24 @@ namespace Foam Foam::relativeVelocityModel::relativeVelocityModel ( const dictionary& dict, - const incompressibleTwoPhaseMixture& mixture + const incompressibleTwoPhaseInteractingMixture& mixture ) : mixture_(mixture), - - continuousPhaseName_(dict.lookup("continuousPhase")), - - alphaC_ - ( - mixture.phase1Name() == continuousPhaseName_ - ? mixture.alpha1() - : mixture.alpha2() - ), - - alphaD_ - ( - mixture.phase1Name() == continuousPhaseName_ - ? mixture.alpha2() - : mixture.alpha1() - ), - - rhoC_ - ( - mixture.phase1Name() == continuousPhaseName_ - ? mixture.rho1() - : mixture.rho2() - ), - - rhoD_ - ( - mixture.phase1Name() == continuousPhaseName_ - ? mixture.rho2() - : mixture.rho1() - ), + alphac_(mixture.alpha2()), + alphad_(mixture.alpha1()), + rhoc_(mixture.rhoc()), + rhod_(mixture.rhod()), Udm_ ( IOobject ( "Udm", - alphaC_.time().timeName(), - alphaC_.mesh() + alphac_.time().timeName(), + alphac_.mesh() ), - alphaC_.mesh(), + alphac_.mesh(), dimensionedVector("Udm", dimVelocity, vector::zero), mixture.U().boundaryField().types() ) @@ -94,7 +68,7 @@ Foam::relativeVelocityModel::relativeVelocityModel Foam::autoPtr Foam::relativeVelocityModel::New ( const dictionary& dict, - const incompressibleTwoPhaseMixture& mixture + const incompressibleTwoPhaseInteractingMixture& mixture ) { word modelType(dict.lookup(typeName)); @@ -141,24 +115,24 @@ Foam::relativeVelocityModel::~relativeVelocityModel() tmp Foam::relativeVelocityModel::rho() const { - return alphaC_*rhoC_ + alphaD_*rhoD_; + return alphac_*rhoc_ + alphad_*rhod_; } tmp Foam::relativeVelocityModel::tauDm() const { - volScalarField betaC(alphaC_*rhoC_); - volScalarField betaD(alphaD_*rhoD_); + volScalarField betac(alphac_*rhoc_); + volScalarField betad(alphad_*rhod_); // Calculate the relative velocity of the continuous phase w.r.t the mean - volVectorField Ucm(betaD*Udm_/betaC); + volVectorField Ucm(betad*Udm_/betac); return tmp ( new volSymmTensorField ( "tauDm", - betaD*sqr(Udm_) + betaC*sqr(Ucm) + betad*sqr(Udm_) + betac*sqr(Ucm) ) ); } diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.H b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.H index 86c9a198..a87e5aba 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.H +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.H @@ -36,7 +36,7 @@ SourceFiles #include "fvCFD.H" #include "dictionary.H" -#include "incompressibleTwoPhaseMixture.H" +#include "incompressibleTwoPhaseInteractingMixture.H" #include "runTimeSelectionTables.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -63,22 +63,22 @@ protected: // Protected data //- Mixture properties - const incompressibleTwoPhaseMixture& mixture_; + const incompressibleTwoPhaseInteractingMixture& mixture_; //- Name of the continuous phase const word continuousPhaseName_; //- Continuous phase fraction - const volScalarField& alphaC_; + const volScalarField& alphac_; //- Dispersed phase fraction - const volScalarField& alphaD_; + const volScalarField& alphad_; //- Continuous density - const dimensionedScalar& rhoC_; + const dimensionedScalar& rhoc_; //- Dispersed density - const dimensionedScalar& rhoD_; + const dimensionedScalar& rhod_; //- Dispersed diffusion velocity mutable volVectorField Udm_; @@ -95,7 +95,8 @@ public: autoPtr, relativeVelocityModel, dictionary, - (const dictionary& dict, const incompressibleTwoPhaseMixture& mixture), + (const dictionary& dict, + const incompressibleTwoPhaseInteractingMixture& mixture), (dict, mixture) ); @@ -106,7 +107,7 @@ public: relativeVelocityModel ( const dictionary& dict, - const incompressibleTwoPhaseMixture& mixture + const incompressibleTwoPhaseInteractingMixture& mixture ); @@ -114,7 +115,7 @@ public: static autoPtr New ( const dictionary& dict, - const incompressibleTwoPhaseMixture& mixture + const incompressibleTwoPhaseInteractingMixture& mixture ); diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.C b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.C index a0d72b75..5051dcb7 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.C +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.C @@ -43,13 +43,13 @@ namespace relativeVelocityModels Foam::relativeVelocityModels::simple::simple ( const dictionary& dict, - const incompressibleTwoPhaseMixture& mixture + const incompressibleTwoPhaseInteractingMixture& mixture ) : relativeVelocityModel(dict, mixture), - a_(dict.lookup("a")), - V0_(dict.lookup("V0")), - residualAlpha_(dict.lookup("residualAlpha")) + a_("a", dimless, dict.lookup("a")), + V0_("V0", dimVelocity, dict.lookup("V0")), + residualAlpha_("residualAlpha", dimless, dict.lookup("residualAlpha")) {} @@ -63,7 +63,7 @@ Foam::relativeVelocityModels::simple::~simple() void Foam::relativeVelocityModels::simple::correct() { - Udm_ = (rhoC_/rho())*V0_*pow(scalar(10), -a_*max(alphaD_, scalar(0))); + Udm_ = (rhoc_/rho())*V0_*pow(scalar(10), -a_*max(alphad_, scalar(0))); } diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.H b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.H index 6ce106e7..82cec551 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.H +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/simple/simple.H @@ -76,7 +76,7 @@ public: simple ( const dictionary& dict, - const incompressibleTwoPhaseMixture& mixture + const incompressibleTwoPhaseInteractingMixture& mixture ); diff --git a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/Make/files b/applications/solvers/multiphase/driftFluxFoam/viscosityModels/Make/files deleted file mode 100644 index db148b46..00000000 --- a/applications/solvers/multiphase/driftFluxFoam/viscosityModels/Make/files +++ /dev/null @@ -1,4 +0,0 @@ -plastic/plastic.C -BinghamPlastic/BinghamPlastic.C - -LIB = $(FOAM_LIBBIN)/libdriftFluxTransportModels diff --git a/tutorials/multiphase/driftFluxFoam/ras/dahl/constant/transportProperties b/tutorials/multiphase/driftFluxFoam/ras/dahl/constant/transportProperties index a1a64a8d..a7c34899 100644 --- a/tutorials/multiphase/driftFluxFoam/ras/dahl/constant/transportProperties +++ b/tutorials/multiphase/driftFluxFoam/ras/dahl/constant/transportProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -phases (sludge water); +phases (sludge water); sludge { @@ -23,37 +23,35 @@ sludge "(plastic|BinghamPlastic)Coeffs" { - plasticViscosityCoeff plasticViscosityCoeff [ 0 2 -1 0 0 0 0 ] 1.1595e-07; - plasticViscosityExponent plasticViscosityExponent [ 0 0 0 0 0 0 0 ] 179.26; + coeff 0.00023143; + exponent 179.26; - yieldStressCoeff yieldStressCoeff [ 0 2 -2 0 0 0 0 ] 2.1137e-07; - yieldStressExponent yieldStressExponent [ 0 0 0 0 0 0 0 ] 1050.8; - yieldStressOffset yieldStressOffset [ 0 0 0 0 0 0 0 ] 0; + BinghamCoeff 0.00042189; + BinghamExponent 1050.8; + BinghamOffset 0; - nuMin nuMin [ 0 2 -1 0 0 0 0 ] 1e-10; - nuMax nuMax [ 0 2 -1 0 0 0 0 ] 5e-3; + muMax 10; } - rho rho [ 1 -3 0 0 0 0 0 ] 1996; + rho 1996; } water { transportModel Newtonian; - nu nu [ 0 2 -1 0 0 0 0 ] 1.7871e-06; - rho rho [ 1 -3 0 0 0 0 0 ] 996; + nu 1.7871e-06; + rho 996; } relativeVelocityModel simple; "(simple|general)Coeffs" { - continuousPhase water; - V0 V0 [ 0 1 -1 0 0 0 0 ] ( 0 -0.002198 0 ); - a a [ 0 0 0 0 0 0 0 ] 285.84; - a1 a1 [ 0 0 0 0 0 0 0 ] 0.1; - residualAlpha residualAlpha [ 0 0 0 0 0 0 0 ] 0; + V0 (0 -0.002198 0); + a 285.84; + a1 0.1; + residualAlpha 0; } diff --git a/tutorials/multiphase/driftFluxFoam/ras/mixerVessel2D/constant/transportProperties b/tutorials/multiphase/driftFluxFoam/ras/mixerVessel2D/constant/transportProperties index a1a64a8d..a7c34899 100644 --- a/tutorials/multiphase/driftFluxFoam/ras/mixerVessel2D/constant/transportProperties +++ b/tutorials/multiphase/driftFluxFoam/ras/mixerVessel2D/constant/transportProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -phases (sludge water); +phases (sludge water); sludge { @@ -23,37 +23,35 @@ sludge "(plastic|BinghamPlastic)Coeffs" { - plasticViscosityCoeff plasticViscosityCoeff [ 0 2 -1 0 0 0 0 ] 1.1595e-07; - plasticViscosityExponent plasticViscosityExponent [ 0 0 0 0 0 0 0 ] 179.26; + coeff 0.00023143; + exponent 179.26; - yieldStressCoeff yieldStressCoeff [ 0 2 -2 0 0 0 0 ] 2.1137e-07; - yieldStressExponent yieldStressExponent [ 0 0 0 0 0 0 0 ] 1050.8; - yieldStressOffset yieldStressOffset [ 0 0 0 0 0 0 0 ] 0; + BinghamCoeff 0.00042189; + BinghamExponent 1050.8; + BinghamOffset 0; - nuMin nuMin [ 0 2 -1 0 0 0 0 ] 1e-10; - nuMax nuMax [ 0 2 -1 0 0 0 0 ] 5e-3; + muMax 10; } - rho rho [ 1 -3 0 0 0 0 0 ] 1996; + rho 1996; } water { transportModel Newtonian; - nu nu [ 0 2 -1 0 0 0 0 ] 1.7871e-06; - rho rho [ 1 -3 0 0 0 0 0 ] 996; + nu 1.7871e-06; + rho 996; } relativeVelocityModel simple; "(simple|general)Coeffs" { - continuousPhase water; - V0 V0 [ 0 1 -1 0 0 0 0 ] ( 0 -0.002198 0 ); - a a [ 0 0 0 0 0 0 0 ] 285.84; - a1 a1 [ 0 0 0 0 0 0 0 ] 0.1; - residualAlpha residualAlpha [ 0 0 0 0 0 0 0 ] 0; + V0 (0 -0.002198 0); + a 285.84; + a1 0.1; + residualAlpha 0; } diff --git a/tutorials/multiphase/driftFluxFoam/ras/tank3D/constant/transportProperties b/tutorials/multiphase/driftFluxFoam/ras/tank3D/constant/transportProperties index 40b9765c..376318ce 100644 --- a/tutorials/multiphase/driftFluxFoam/ras/tank3D/constant/transportProperties +++ b/tutorials/multiphase/driftFluxFoam/ras/tank3D/constant/transportProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -phases (sludge water); +phases (sludge water); sludge { @@ -23,38 +23,35 @@ sludge "(plastic|BinghamPlastic)Coeffs" { - plasticViscosityCoeff plasticViscosityCoeff [ 0 2 -1 0 0 0 0 ] 2.2210e-07; - plasticViscosityExponent plasticViscosityExponent [ 0 0 0 0 0 0 0 ] 0.17926; + coeff 0.00023143; + exponent 0.17926; - yieldStressCoeff yieldStressCoeff [ 0 2 -2 0 0 0 0 ] 5.3233e-10; - yieldStressExponent yieldStressExponent [ 0 0 0 0 0 0 0 ] 95.25; - yieldStressOffset yieldStressOffset [ 0 0 0 0 0 0 0 ] 0; + BinghamCoeff 5.5469e-07; + BinghamExponent 95.25; + BinghamOffset 0; - nuMin nuMin [ 0 2 -1 0 0 0 0 ] 1e-10; - nuMax nuMax [ 0 2 -1 0 0 0 0 ] 5e-3; + muMax 10; } - rho rho [ 1 -3 0 0 0 0 0 ] 1042; + rho 1042; } water { transportModel Newtonian; - nu nu [ 0 2 -1 0 0 0 0 ] 1.78e-06; - rho rho [ 1 -3 0 0 0 0 0 ] 1000; + nu 1.78e-06; + rho 1000; } relativeVelocityModel simple; "(simple|general)Coeffs" { - continuousPhase water; - V0 V0 [ 0 1 -1 0 0 0 0 ] ( 0 -0.002198 0 ); - a a [ 0 0 0 0 0 0 0 ] 8.84; - a1 a1 [ 0 0 0 0 0 0 0 ] 0.1; - residualAlpha residualAlpha [ 0 0 0 0 0 0 0 ] 0; + V0 (0 -0.002198 0); + a 8.84; + a1 0.1; + residualAlpha 0; } - // ************************************************************************* // From 97056cd4664657296e7028756edc05cdb87b0e06 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 7 Mar 2014 23:32:00 +0000 Subject: [PATCH 07/11] twoPhaseEulerFoam: added optional alphaMax to phaseModel for MULES limiter Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1209 --- .../twoPhaseSystem/phaseModel/phaseModel.C | 3 ++- .../twoPhaseSystem/phaseModel/phaseModel.H | 12 +++++++++++- .../twoPhaseSystem/twoPhaseSystem.C | 6 +++--- .../RAS/fluidisedBed/constant/phaseProperties | 2 ++ .../laminar/fluidisedBed/constant/phaseProperties | 2 ++ 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C index da43a498..26f30f81 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,6 +63,7 @@ Foam::phaseModel::phaseModel ( phaseProperties.subDict(name_) ), + alphaMax_(phaseDict_.lookupOrDefault("alphaMax", 1.0)), thermo_(rhoThermo::New(fluid.mesh(), name_)), U_ ( diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H index 7ca42552..436ec137 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -71,6 +71,9 @@ class phaseModel dictionary phaseDict_; + //- Optional maximum phase-fraction (e.g. packing limit) + scalar alphaMax_; + //- Thermophysical properties autoPtr thermo_; @@ -123,6 +126,13 @@ public: //- Return the other phase in this two-phase system const phaseModel& otherPhase() const; + //- Optional maximum phase-fraction (e.g. packing limit) + // Defaults to 1 + scalar alphaMax() const + { + return alphaMax_; + } + //- Return the Sauter-mean diameter tmp d() const; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C index 98d09695..88f3cdbc 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C @@ -248,7 +248,7 @@ Foam::twoPhaseSystem::twoPhaseSystem pair2In1_ ) ); - + wallLubrication_.set ( new BlendedInterfacialModel @@ -264,7 +264,7 @@ Foam::twoPhaseSystem::twoPhaseSystem pair2In1_ ) ); - + turbulentDispersion_.set ( new BlendedInterfacialModel @@ -508,7 +508,7 @@ void Foam::twoPhaseSystem::solve() alphaPhic1, Sp, Su, - 1, + phase1_.alphaMax(), 0 ); diff --git a/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/constant/phaseProperties b/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/constant/phaseProperties index 624e2a2d..bca23e0f 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/constant/phaseProperties +++ b/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/constant/phaseProperties @@ -24,6 +24,8 @@ particles { d 3e-4; } + + alphaMax 0.62; } air diff --git a/tutorials/multiphase/twoPhaseEulerFoam/laminar/fluidisedBed/constant/phaseProperties b/tutorials/multiphase/twoPhaseEulerFoam/laminar/fluidisedBed/constant/phaseProperties index cf724865..6f7c9add 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/laminar/fluidisedBed/constant/phaseProperties +++ b/tutorials/multiphase/twoPhaseEulerFoam/laminar/fluidisedBed/constant/phaseProperties @@ -24,6 +24,8 @@ particles { d 3e-4; } + + alphaMax 0.62; } air From 8199b97e4a7ab5daa684abe27bdac2610cfb52a3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 11 Mar 2014 10:13:10 +0000 Subject: [PATCH 08/11] BUG: codeStream: do not reduce if timeStampMaster --- .../db/dictionary/functionEntries/codeStream/codeStream.C | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C index f855f79b..380f5dfd 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -286,7 +286,10 @@ Foam::functionEntries::codeStream::getFunction } bool haveLib = lib; - reduce(haveLib, andOp()); + if (!regIOobject::masterOnlyReading) + { + reduce(haveLib, andOp()); + } if (!haveLib) { From 46d53c222d79e29c791463b503134e1b00cf50dc Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 12 Mar 2014 12:27:19 +0000 Subject: [PATCH 09/11] Revert pressureInletOutletVelocity BCs due to convergence problems with the new version for runs at high Courant number --- ...ureInletOutletVelocityFvPatchVectorField.C | 122 ++++++------------ ...ureInletOutletVelocityFvPatchVectorField.H | 69 +++------- ...ureInletOutletVelocityFvPatchVectorField.C | 41 +++--- ...ureInletOutletVelocityFvPatchVectorField.H | 5 +- .../interDyMFoam/ras/DTCHull/0.org/U | 1 + 5 files changed, 76 insertions(+), 162 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C index fda087d8..63f97077 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,10 +25,10 @@ License #include "pressureInletOutletVelocityFvPatchVectorField.H" #include "addToRunTimeSelectionTable.H" -#include "fvPatchFieldMapper.H" #include "volFields.H" #include "surfaceFields.H" + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::pressureInletOutletVelocityFvPatchVectorField:: @@ -38,14 +38,12 @@ pressureInletOutletVelocityFvPatchVectorField const DimensionedField& iF ) : - mixedFvPatchVectorField(p, iF), - phiName_("phi"), - rhoName_("rho"), - applyTangentialVelocity_(false) + directionMixedFvPatchVectorField(p, iF), + phiName_("phi") { - refValue() = *this; + refValue() = vector::zero; refGrad() = vector::zero; - valueFraction() = 0.0; + valueFraction() = symmTensor::zero; } @@ -58,12 +56,10 @@ pressureInletOutletVelocityFvPatchVectorField const fvPatchFieldMapper& mapper ) : - mixedFvPatchVectorField(ptf, p, iF, mapper), - phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_), - applyTangentialVelocity_(ptf.applyTangentialVelocity_) + directionMixedFvPatchVectorField(ptf, p, iF, mapper), + phiName_(ptf.phiName_) { - if (applyTangentialVelocity_) + if (ptf.tangentialVelocity_.size()) { tangentialVelocity_ = mapper(ptf.tangentialVelocity_); } @@ -78,26 +74,25 @@ pressureInletOutletVelocityFvPatchVectorField const dictionary& dict ) : - mixedFvPatchVectorField(p, iF), - phiName_(dict.lookupOrDefault("phi", "phi")), - rhoName_(dict.lookupOrDefault("rho", "rho")), - applyTangentialVelocity_(false) + directionMixedFvPatchVectorField(p, iF), + phiName_(dict.lookupOrDefault("phi", "phi")) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); if (dict.found("tangentialVelocity")) { - applyTangentialVelocity_ = true; - setTangentialVelocity ( vectorField("tangentialVelocity", dict, p.size()) ); } + else + { + refValue() = vector::zero; + } - refValue() = *this; refGrad() = vector::zero; - valueFraction() = 0.0; + valueFraction() = symmTensor::zero; } @@ -107,11 +102,9 @@ pressureInletOutletVelocityFvPatchVectorField const pressureInletOutletVelocityFvPatchVectorField& pivpvf ) : - mixedFvPatchVectorField(pivpvf), + directionMixedFvPatchVectorField(pivpvf), phiName_(pivpvf.phiName_), - rhoName_(pivpvf.rhoName_), - tangentialVelocity_(pivpvf.tangentialVelocity_), - applyTangentialVelocity_(pivpvf.applyTangentialVelocity_) + tangentialVelocity_(pivpvf.tangentialVelocity_) {} @@ -122,11 +115,9 @@ pressureInletOutletVelocityFvPatchVectorField const DimensionedField& iF ) : - mixedFvPatchVectorField(pivpvf, iF), + directionMixedFvPatchVectorField(pivpvf, iF), phiName_(pivpvf.phiName_), - rhoName_(pivpvf.rhoName_), - tangentialVelocity_(pivpvf.tangentialVelocity_), - applyTangentialVelocity_(pivpvf.applyTangentialVelocity_) + tangentialVelocity_(pivpvf.tangentialVelocity_) {} @@ -135,10 +126,9 @@ pressureInletOutletVelocityFvPatchVectorField void Foam::pressureInletOutletVelocityFvPatchVectorField:: setTangentialVelocity(const vectorField& tangentialVelocity) { - applyTangentialVelocity_ = true; tangentialVelocity_ = tangentialVelocity; - vectorField n(patch().nf()); - tangentialVelocity_ -= n*(n & tangentialVelocity_); + const vectorField n(patch().nf()); + refValue() = tangentialVelocity_ - n*(n & tangentialVelocity_); } @@ -147,8 +137,8 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::autoMap const fvPatchFieldMapper& m ) { - mixedFvPatchVectorField::autoMap(m); - if (applyTangentialVelocity_) + directionMixedFvPatchVectorField::autoMap(m); + if (tangentialVelocity_.size()) { tangentialVelocity_.autoMap(m); } @@ -161,9 +151,9 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::rmap const labelList& addr ) { - mixedFvPatchVectorField::rmap(ptf, addr); + directionMixedFvPatchVectorField::rmap(ptf, addr); - if (applyTangentialVelocity_) + if (tangentialVelocity_.size()) { const pressureInletOutletVelocityFvPatchVectorField& tiptf = refCast(ptf); @@ -180,67 +170,25 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::updateCoeffs() return; } - const surfaceScalarField& phi = - db().lookupObject(phiName_); - const fvsPatchField& phip = - patch().patchField(phi); + patch().lookupPatchField(phiName_); - vectorField n(patch().nf()); - const Field& magSf = patch().magSf(); + valueFraction() = neg(phip)*(I - sqr(patch().nf())); - if (phi.dimensions() == dimVelocity*dimArea) - { - refValue() = n*phip/magSf; - } - else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) - { - const fvPatchField& rhop = - patch().lookupPatchField(rhoName_); - - refValue() = n*phip/(rhop*magSf); - } - else - { - FatalErrorIn - ( - "pressureInletOutletVelocityFvPatchVectorField::" - "updateCoeffs()" - ) << "dimensions of phi are not correct" << nl - << " on patch " << this->patch().name() - << " of field " << this->dimensionedInternalField().name() - << " in file " << this->dimensionedInternalField().objectPath() - << exit(FatalError); - } - - if (applyTangentialVelocity_) - { - // Adjust the tangential velocity to conserve kinetic energy - // of the entrained fluid - // scalarField magSqrUt(magSqr(tangentialVelocity_)); - // scalarField scale - // ( - // sqrt(max(magSqrUt - magSqr(refValue()), scalar(0))/magSqrUt) - // ); - // refValue() += scale*tangentialVelocity_; - refValue() += tangentialVelocity_; - } - - valueFraction() = 1.0 - pos(phip); - - mixedFvPatchVectorField::updateCoeffs(); + directionMixedFvPatchVectorField::updateCoeffs(); + directionMixedFvPatchVectorField::evaluate(); } void Foam::pressureInletOutletVelocityFvPatchVectorField::write ( Ostream& os -) const +) +const { fvPatchVectorField::write(os); writeEntryIfDifferent(os, "phi", "phi", phiName_); - writeEntryIfDifferent(os, "rho", "rho", rhoName_); - if (applyTangentialVelocity_) + if (tangentialVelocity_.size()) { tangentialVelocity_.writeEntry("tangentialVelocity", os); } @@ -255,7 +203,9 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::operator= const fvPatchField& pvf ) { - fvPatchField::operator=(pvf); + tmp normalValue = transform(valueFraction(), refValue()); + tmp transformGradValue = transform(I - valueFraction(), pvf); + fvPatchField::operator=(normalValue + transformGradValue); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H index 4f8c5464..1a6def9b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,21 +25,21 @@ Class Foam::pressureInletOutletVelocityFvPatchVectorField Group - grpInletBoundaryConditions grpOutletBoundaryConditions + grpInletletBoundaryConditions grpOutletBoundaryConditions Description This velocity inlet/outlet boundary condition is applied to pressure boundaries where the pressure is specified. A zero-gradient condition is applied for outflow (as defined by the flux); for inflow, the velocity is - obtained from the patch-face normal component of the internal-cell value and - the tangential patch velocity can be optionally specified. + obtained from the patch-face normal component of the internal-cell value. + + The tangential patch velocity can be optionally specified. \heading Patch usage \table Property | Description | Required | Default value phi | flux field name | no | phi - rho | density field name | no | rho tangentialVelocity | tangential velocity field | no | \endtable @@ -49,7 +49,6 @@ Description { type pressureInletOutletVelocity; phi phi; - rho rho; tangentialVelocity uniform (0 0 0); value uniform 0; } @@ -70,7 +69,7 @@ SourceFiles #define pressureInletOutletVelocityFvPatchVectorField_H #include "fvPatchFields.H" -#include "mixedFvPatchFields.H" +#include "directionMixedFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -78,29 +77,21 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class pressureInletOutletVelocityFvPatchVectorField Declaration + Class pressureInletOutletVelocityFvPatchVectorField Declaration \*---------------------------------------------------------------------------*/ class pressureInletOutletVelocityFvPatchVectorField : - public mixedFvPatchVectorField + public directionMixedFvPatchVectorField { // Private data //- Flux field name word phiName_; - //- Density field name - word rhoName_; - - -protected: - //- Optional tangential velocity component vectorField tangentialVelocity_; - bool applyTangentialVelocity_; - public: @@ -117,17 +108,6 @@ public: const DimensionedField& ); - //- Construct by mapping given - // pressureInletOutletVelocityFvPatchVectorField - // onto a new patch - pressureInletOutletVelocityFvPatchVectorField - ( - const pressureInletOutletVelocityFvPatchVectorField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - //- Construct from patch, internal field and dictionary pressureInletOutletVelocityFvPatchVectorField ( @@ -136,6 +116,16 @@ public: const dictionary& ); + //- Construct by mapping given + // pressureInletOutletVelocityFvPatchVectorField onto a new patch + pressureInletOutletVelocityFvPatchVectorField + ( + const pressureInletOutletVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + //- Construct as copy pressureInletOutletVelocityFvPatchVectorField ( @@ -147,10 +137,7 @@ public: { return tmp ( - new pressureInletOutletVelocityFvPatchVectorField - ( - *this - ) + new pressureInletOutletVelocityFvPatchVectorField(*this) ); } @@ -169,11 +156,7 @@ public: { return tmp ( - new pressureInletOutletVelocityFvPatchVectorField - ( - *this, - iF - ) + new pressureInletOutletVelocityFvPatchVectorField(*this, iF) ); } @@ -194,18 +177,6 @@ public: return phiName_; } - //- Return the name of rho - const word& rhoName() const - { - return rhoName_; - } - - //- Return reference to the name of rho to allow adjustment - word& rhoName() - { - return rhoName_; - } - //- Return the tangential velocity const vectorField& tangentialVelocity() const { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C index e9f2bbee..22b36b08 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,17 +33,17 @@ License void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: calcTangentialVelocity() { - applyTangentialVelocity_ = true; - const scalar t = this->db().time().timeOutputValue(); vector om = omega_->value(t); vector axisHat = om/mag(om); - tangentialVelocity_ = - (-om) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf())); + const vectorField tangentialVelocity + ( + (-om) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf())) + ); const vectorField n(patch().nf()); - tangentialVelocity_ -= n*(n & tangentialVelocity_); + refValue() = tangentialVelocity - n*(n & tangentialVelocity); } @@ -72,7 +72,9 @@ rotatingPressureInletOutletVelocityFvPatchVectorField : pressureInletOutletVelocityFvPatchVectorField(ptf, p, iF, mapper), omega_(ptf.omega_().clone().ptr()) -{} +{ + calcTangentialVelocity(); +} Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: @@ -85,7 +87,9 @@ rotatingPressureInletOutletVelocityFvPatchVectorField : pressureInletOutletVelocityFvPatchVectorField(p, iF, dict), omega_(DataEntry::New("omega", dict)) -{} +{ + calcTangentialVelocity(); +} Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: @@ -96,7 +100,9 @@ rotatingPressureInletOutletVelocityFvPatchVectorField : pressureInletOutletVelocityFvPatchVectorField(rppvf), omega_(rppvf.omega_().clone().ptr()) -{} +{ + calcTangentialVelocity(); +} Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: @@ -108,24 +114,13 @@ rotatingPressureInletOutletVelocityFvPatchVectorField : pressureInletOutletVelocityFvPatchVectorField(rppvf, iF), omega_(rppvf.omega_().clone().ptr()) -{} +{ + calcTangentialVelocity(); +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::updateCoeffs() -{ - if (updated()) - { - return; - } - - calcTangentialVelocity(); - - pressureInletOutletVelocityFvPatchVectorField::updateCoeffs(); -} - - void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::write ( Ostream& os diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H index b4b72976..2335f457 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -177,9 +177,6 @@ public: // Member functions - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - //- Write virtual void write(Ostream&) const; }; diff --git a/tutorials/multiphase/interDyMFoam/ras/DTCHull/0.org/U b/tutorials/multiphase/interDyMFoam/ras/DTCHull/0.org/U index 4105aa55..1e4f3e67 100644 --- a/tutorials/multiphase/interDyMFoam/ras/DTCHull/0.org/U +++ b/tutorials/multiphase/interDyMFoam/ras/DTCHull/0.org/U @@ -44,6 +44,7 @@ boundaryField atmosphere { type pressureInletOutletVelocity; + tangentialVelocity $internalField; value uniform (0 0 0); } From ae8469ef7e168df5be8525032ebafcc9d9f0b033 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 14 Mar 2014 08:25:45 +0000 Subject: [PATCH 10/11] Added makeRelative for MRF Resolves bug report http://www.openfoam.org/mantisbt/view.php?id=1221 --- .../solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/pEqn.H | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/pEqn.H index 78878dcf..af15b48a 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/pEqn.H @@ -17,6 +17,8 @@ if (simple.transonic()) *(fvc::interpolate(HbyA) & mesh.Sf()) ); + fvOptions.makeRelative(fvc::interpolate(psi), phid); + surfaceScalarField phic ( "phic", @@ -61,6 +63,8 @@ else fvc::interpolate(rho*HbyA) & mesh.Sf() ); + fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA); + closedVolume = adjustPhi(phiHbyA, U, p); phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf(); From ada39f00b1e98870730d720a4a8adca4dee3ca2a Mon Sep 17 00:00:00 2001 From: sergio Date: Fri, 14 Mar 2014 09:36:46 +0000 Subject: [PATCH 11/11] ENH: Adding virtual function to basicChemistryModel.H to calculate the consumption rate of specieI in reactionI. This is used by the diffusionMulticomponent combustion model to ignite the mixture --- .../basicChemistryModel/basicChemistryModel.H | 9 +- .../chemistryModel/chemistryModel.C | 84 ++++++++++++++++++- .../chemistryModel/chemistryModel.H | 7 ++ .../basicSolidChemistryModel.C | 25 +++++- .../basicSolidChemistryModel.H | 9 +- 5 files changed, 130 insertions(+), 4 deletions(-) diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H index 55b94ccd..89c28de4 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -146,6 +146,13 @@ public: const label i ) = 0; + //- Return reaction rate of the specieI in reactionI + virtual tmp > calculateRR + ( + const label reactionI, + const label specieI + ) const = 0; + // Chemistry solution diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModel.C index 60c25503..321c8235 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -626,6 +626,88 @@ Foam::label Foam::chemistryModel::nEqns() const } +template +Foam::tmp > +Foam::chemistryModel::calculateRR +( + const label reactionI, + const label specieI +) const +{ + scalar pf, cf, pr, cr; + label lRef, rRef; + + const volScalarField rho + ( + IOobject + ( + "rho", + this->time().timeName(), + this->mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + this->thermo().rho() + ); + + tmp > tRR + ( + new DimensionedField + ( + IOobject + ( + "RR", + this->mesh().time().timeName(), + this->mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + this->mesh(), + dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) + ) + ); + + DimensionedField& RR = tRR(); + + const scalarField& T = this->thermo().T(); + const scalarField& p = this->thermo().p(); + + forAll(rho, celli) + { + const scalar rhoi = rho[celli]; + const scalar Ti = T[celli]; + const scalar pi = p[celli]; + + scalarField c(nSpecie_, 0.0); + for (label i=0; i void Foam::chemistryModel::calculate() { diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModel.H index fc6dc79f..368090a2 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModel.H @@ -198,6 +198,13 @@ public: const label i ); + //- Return reaction rate of the specieI in reactionI + virtual tmp > calculateRR + ( + const label reactionI, + const label specieI + ) const; + //- Solve the reaction system for the given time step // and return the characteristic time virtual scalar solve(const scalar deltaT); diff --git a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.C b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.C index f94db594..123805ad 100644 --- a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.C +++ b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -84,4 +84,27 @@ Foam::basicSolidChemistryModel::RR(const label i) } +Foam::tmp > +Foam::basicSolidChemistryModel::calculateRR +( + const label reactionI, + const label specieI +) const +{ + notImplemented + ( + "Foam::DimensionedField&" + "basicSolidChemistryModel::calculateRR(const label)" + ); + + return dynamic_cast >&> + ( + const_cast& > + ( + DimensionedField::null() + ) + ); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.H b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.H index 50d6a2e9..44e10a31 100644 --- a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.H +++ b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -133,6 +133,13 @@ public: const label i ) const = 0; + //- Returns the reaction rate of the specieI in reactionI + virtual tmp > calculateRR + ( + const label reactionI, + const label specieI + ) const; + //- Return sensible enthalpy for gas i [J/Kg] virtual tmp gasHs (