From a7d5aa2e89a8f2495390973758e7da9a13ebb0c0 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 20 Jun 2016 11:36:24 +0100 Subject: [PATCH] Viscoelastic model update: linear Maxwell and upper convected Maxvell. Jovani Favero and Miguel Nobrega --- src/transportModels/viscoelastic/Make/files | 3 +- .../UpperConvectedMaxwell.C => UCM/UCM.C} | 24 ++-- .../viscoelastic/viscoelasticLaws/UCM/UCM.H | 130 ++++++++++++++++++ .../linearMaxwell/linearMaxwell.C | 105 ++++++++++++++ .../linearMaxwell.H} | 24 ++-- 5 files changed, 257 insertions(+), 29 deletions(-) rename src/transportModels/viscoelastic/viscoelasticLaws/{UpperConvectedMaxwell/UpperConvectedMaxwell.C => UCM/UCM.C} (81%) create mode 100644 src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.H create mode 100644 src/transportModels/viscoelastic/viscoelasticLaws/linearMaxwell/linearMaxwell.C rename src/transportModels/viscoelastic/viscoelasticLaws/{UpperConvectedMaxwell/UpperConvectedMaxwell.H => linearMaxwell/linearMaxwell.H} (85%) diff --git a/src/transportModels/viscoelastic/Make/files b/src/transportModels/viscoelastic/Make/files index ec0d90fad..918e301e6 100644 --- a/src/transportModels/viscoelastic/Make/files +++ b/src/transportModels/viscoelastic/Make/files @@ -6,7 +6,8 @@ viscoelasticLaws/viscoelasticLaw/newViscoelasticLaw.C viscoelasticLaws/LPTT/LPTT.C viscoelasticLaws/EPTT/EPTT.C viscoelasticLaws/Oldroyd-B/Oldroyd_B.C -viscoelasticLaws/UpperConvectedMaxwell/UpperConvectedMaxwell.C +viscoelasticLaws/linearMaxwell/linearMaxwell.C +viscoelasticLaws/UCM/UCM.C viscoelasticLaws/Giesekus/Giesekus.C viscoelasticLaws/FENE-CR/FENE_CR.C viscoelasticLaws/FENE-P/FENE_P.C diff --git a/src/transportModels/viscoelastic/viscoelasticLaws/UpperConvectedMaxwell/UpperConvectedMaxwell.C b/src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.C similarity index 81% rename from src/transportModels/viscoelastic/viscoelasticLaws/UpperConvectedMaxwell/UpperConvectedMaxwell.C rename to src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.C index 971f43005..192e78567 100644 --- a/src/transportModels/viscoelastic/viscoelasticLaws/UpperConvectedMaxwell/UpperConvectedMaxwell.C +++ b/src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.C @@ -23,26 +23,21 @@ License \*---------------------------------------------------------------------------*/ -#include "UpperConvectedMaxwell.H" +#include "UCM.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(UpperConvectedMaxwell, 0); - addToRunTimeSelectionTable - ( - viscoelasticLaw, - UpperConvectedMaxwell, - dictionary - ); + defineTypeNameAndDebug(UCM, 0); + addToRunTimeSelectionTable(viscoelasticLaw, UCM, dictionary); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::UpperConvectedMaxwell::UpperConvectedMaxwell +Foam::UCM::UCM ( const word& name, const volVectorField& U, @@ -64,7 +59,6 @@ Foam::UpperConvectedMaxwell::UpperConvectedMaxwell U.mesh() ), rho_(dict.lookup("rho")), - etaS_(dict.lookup("etaS")), etaP_(dict.lookup("etaP")), lambda_(dict.lookup("lambda")) {} @@ -72,8 +66,7 @@ Foam::UpperConvectedMaxwell::UpperConvectedMaxwell // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::tmp -Foam::UpperConvectedMaxwell::divTau(volVectorField& U) const +Foam::tmp Foam::UCM::divTau(volVectorField& U) const { dimensionedScalar etaPEff = etaP_; @@ -81,16 +74,15 @@ Foam::UpperConvectedMaxwell::divTau(volVectorField& U) const ( fvc::div(tau_/rho_, "div(tau)") - fvc::laplacian(etaPEff/rho_, U, "laplacian(etaPEff,U)") - + fvm::laplacian( (etaPEff + etaS_)/rho_, U, "laplacian(etaPEff+etaS,U)") + + fvm::laplacian( (etaPEff)/rho_, U, "laplacian(etaPEff+etaS,U)") ); } -void Foam::UpperConvectedMaxwell::correct() +void Foam::UCM::correct() { // Velocity gradient tensor - const tmp tL = fvc::grad(U()); - const volTensorField& L = tL(); + volTensorField L = fvc::grad(U()); // Convected derivate term volTensorField C = tau_ & L; diff --git a/src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.H b/src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.H new file mode 100644 index 000000000..d69a1104f --- /dev/null +++ b/src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.H @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 3.2 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend 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. + + foam-extend 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 foam-extend. If not, see . + +Class + UCM + +Description + UCM non linear viscoelastic fluid model (BIRD et al., 1987). + +Author + Jovani L. Favero. All rights reserved + +SourceFiles + UCM.C + +\*---------------------------------------------------------------------------*/ + +#ifndef UCM_H +#define UCM_H + +#include "viscoelasticLaw.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class UCM Declaration +\*---------------------------------------------------------------------------*/ + +class UCM +: + public viscoelasticLaw +{ + // Private data + + //- Transported viscoelastic stress + volSymmTensorField tau_; + + + // Model constants + + //- Density + dimensionedScalar rho_; + + //- Zero shear rate polymer viscosity + dimensionedScalar etaP_; + + //- Relaxation time + dimensionedScalar lambda_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + UCM(const UCM&); + + //- Disallow default bitwise assignment + void operator=(const UCM&); + + +public: + + //- Runtime type information + TypeName("UCM"); + + // Constructors + + //- Construct from components + UCM + ( + const word& name, + const volVectorField& U, + const surfaceScalarField& phi, + const dictionary& dict + ); + + + // Destructor + + virtual ~UCM() + {} + + + // Member Functions + + //- Return the viscoelastic stress tensor + virtual tmp tau() const + { + return tau_; + } + + //- Return the coupling term for the momentum equation + virtual tmp divTau(volVectorField& U) const; + + //- Correct the viscoelastic stress + virtual void correct(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/transportModels/viscoelastic/viscoelasticLaws/linearMaxwell/linearMaxwell.C b/src/transportModels/viscoelastic/viscoelasticLaws/linearMaxwell/linearMaxwell.C new file mode 100644 index 000000000..7f9f42c80 --- /dev/null +++ b/src/transportModels/viscoelastic/viscoelasticLaws/linearMaxwell/linearMaxwell.C @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 3.2 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend 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. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "linearMaxwell.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(linearMaxwell, 0); + addToRunTimeSelectionTable(viscoelasticLaw, linearMaxwell, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::linearMaxwell::linearMaxwell +( + const word& name, + const volVectorField& U, + const surfaceScalarField& phi, + const dictionary& dict +) +: + viscoelasticLaw(name, U, phi), + tau_ + ( + IOobject + ( + "tau" + name, + U.time().timeName(), + U.mesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + U.mesh() + ), + rho_(dict.lookup("rho")), + etaS_(dict.lookup("etaS")), + etaP_(dict.lookup("etaP")), + lambda_(dict.lookup("lambda")) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::linearMaxwell::divTau(volVectorField& U) const +{ + dimensionedScalar etaPEff = etaP_; + + return + ( + fvc::div(tau_/rho_, "div(tau)") + - fvc::laplacian(etaPEff/rho_, U, "laplacian(etaPEff,U)") + + fvm::laplacian( (etaPEff + etaS_)/rho_, U, "laplacian(etaPEff+etaS,U)") + ); +} + + +void Foam::linearMaxwell::correct() +{ + // Velocity gradient tensor + volTensorField L = fvc::grad(U()); + + // Twice the rate of deformation tensor + volSymmTensorField twoD = twoSymm(L); + + // Stress transport equation + fvSymmTensorMatrix tauEqn + ( + fvm::ddt(tau_) + == + etaP_/lambda_*twoD + - fvm::Sp( 1/lambda_, tau_) + ); + + tauEqn.relax(); + tauEqn.solve(); +} + + +// ************************************************************************* // diff --git a/src/transportModels/viscoelastic/viscoelasticLaws/UpperConvectedMaxwell/UpperConvectedMaxwell.H b/src/transportModels/viscoelastic/viscoelasticLaws/linearMaxwell/linearMaxwell.H similarity index 85% rename from src/transportModels/viscoelastic/viscoelasticLaws/UpperConvectedMaxwell/UpperConvectedMaxwell.H rename to src/transportModels/viscoelastic/viscoelasticLaws/linearMaxwell/linearMaxwell.H index 4bcaa4a19..8d593bff1 100644 --- a/src/transportModels/viscoelastic/viscoelasticLaws/UpperConvectedMaxwell/UpperConvectedMaxwell.H +++ b/src/transportModels/viscoelastic/viscoelasticLaws/linearMaxwell/linearMaxwell.H @@ -22,21 +22,21 @@ License along with foam-extend. If not, see . Class - UpperConvectedMaxwell + linearMaxwell Description - UpperConvectedMaxwell linear viscoelastic fluid model (UpperConvectedMaxwell, J.C., 1867). + Maxwell linear viscoelastic fluid model (linearMaxwell, J.C., 1867). Author Jovani L. Favero. All rights reserved SourceFiles - UpperConvectedMaxwell.C + linearMaxwell.C \*---------------------------------------------------------------------------*/ -#ifndef UpperConvectedMaxwell_H -#define UpperConvectedMaxwell_H +#ifndef linearMaxwell_H +#define linearMaxwell_H #include "viscoelasticLaw.H" @@ -46,10 +46,10 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class UpperConvectedMaxwell Declaration + Class linearMaxwell Declaration \*---------------------------------------------------------------------------*/ -class UpperConvectedMaxwell +class linearMaxwell : public viscoelasticLaw { @@ -77,21 +77,21 @@ class UpperConvectedMaxwell // Private Member Functions //- Disallow default bitwise copy construct - UpperConvectedMaxwell(const UpperConvectedMaxwell&); + linearMaxwell(const linearMaxwell&); //- Disallow default bitwise assignment - void operator=(const UpperConvectedMaxwell&); + void operator=(const linearMaxwell&); public: //- Runtime type information - TypeName("UpperConvectedMaxwell"); + TypeName("linearMaxwell"); // Constructors //- Construct from components - UpperConvectedMaxwell + linearMaxwell ( const word& name, const volVectorField& U, @@ -102,7 +102,7 @@ public: // Destructor - virtual ~UpperConvectedMaxwell() + virtual ~linearMaxwell() {}