Maxwell.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::laminarModels::Maxwell
26 
27 Description
28  Generalised Maxwell model for viscoelasticity using the upper-convected time
29  derivative of the stress tensor with support for multiple modes.
30 
31  See http://en.wikipedia.org/wiki/Upper-convected_Maxwell_model
32  http://en.wikipedia.org/wiki/Generalised_Maxwell_model
33 
34  The model includes an additional viscosity (nu) from the viscosity
35  model from which it is instantiated, which makes it equivalent to
36  the Oldroyd-B model for the case of an incompressible viscosity
37  model (where nu is non-zero).
38  See https://en.wikipedia.org/wiki/Oldroyd-B_model
39 
40  Reference:
41  \verbatim
42  Wiechert, E. (1889). Ueber elastische Nachwirkung.
43  (Doctoral dissertation, Hartungsche buchdr.).
44 
45  Wiechert, E. (1893).
46  Gesetze der elastischen Nachwirkung für constante Temperatur.
47  Annalen der Physik, 286(11), 546-570.
48 
49  Amoreira, L. J., & Oliveira, P. J. (2010).
50  Comparison of different formulations for the numerical calculation
51  of unsteady incompressible viscoelastic fluid flow.
52  Adv. Appl. Math. Mech, 4, 483-502.
53  \endverbatim
54 
55 SourceFiles
56  Maxwell.C
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef Maxwell_H
61 #define Maxwell_H
62 
63 #include "laminarModel.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 namespace laminarModels
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class Maxwell Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 template<class BasicMomentumTransportModel>
77 class Maxwell
78 :
79  public laminarModel<BasicMomentumTransportModel>
80 {
81 
82 protected:
83 
84  // Protected data
85 
86  // Model coefficients
87 
89 
90  label nModes_;
91 
93 
95 
96 
97  // Fields
98 
99  //- Single or mode sum viscoelastic stress
101 
102  //- Mode viscoelastic stresses
104 
105 
106  // Protected Member Functions
107 
109  (
110  const word& name,
111  const dimensionSet& dims
112  ) const;
113 
114  //- Return the non-Newtonian viscosity
115  tmp<volScalarField> nu0() const
116  {
117  return this->nu() + nuM_;
118  }
119 
121  (
122  const label modei,
124  ) const;
125 
126 
127 public:
128 
129  typedef typename BasicMomentumTransportModel::alphaField alphaField;
130  typedef typename BasicMomentumTransportModel::rhoField rhoField;
131 
132 
133  //- Runtime type information
134  TypeName("Maxwell");
135 
136 
137  // Constructors
138 
139  //- Construct from components
140  Maxwell
141  (
142  const alphaField& alpha,
143  const rhoField& rho,
144  const volVectorField& U,
145  const surfaceScalarField& alphaRhoPhi,
146  const surfaceScalarField& phi,
147  const viscosity& viscosity,
148  const word& type = typeName
149  );
150 
151 
152  //- Destructor
153  virtual ~Maxwell()
154  {}
155 
156 
157  // Member Functions
158 
159  //- Read model coefficients if they have changed
160  virtual bool read();
161 
162  //- Return the effective viscosity, i.e. the laminar viscosity
163  virtual tmp<volScalarField> nuEff() const;
164 
165  //- Return the effective viscosity on patch
166  virtual tmp<scalarField> nuEff(const label patchi) const;
167 
168  //- Return the stress tensor [m^2/s^2]
169  virtual tmp<volSymmTensorField> sigma() const;
170 
171  //- Return the effective stress tensor
172  virtual tmp<volSymmTensorField> devTau() const;
173 
174  //- Return the source term for the momentum equation
176 
177  //- Return the source term for the momentum equation
179  (
180  const volScalarField& rho,
182  ) const;
183 
184  //- The Maxwell stress is not predicted
185  virtual void predict()
186  {}
187 
188  //- Correct the Maxwell stress
189  virtual void correct();
190 };
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace laminarModels
196 } // End namespace Foam
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #ifdef NoRepository
201  #include "Maxwell.C"
202 #endif
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
Generic GeometricField class.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
Dimension set for the base types.
Definition: dimensionSet.H:122
Templated abstract base class for laminar transport models.
Definition: laminarModel.H:52
BasicMomentumTransportModel::alphaField alphaField
Definition: laminarModel.H:76
BasicMomentumTransportModel::rhoField rhoField
Definition: laminarModel.H:77
Generalised Maxwell model for viscoelasticity using the upper-convected time derivative of the stress...
Definition: Maxwell.H:79
BasicMomentumTransportModel::alphaField alphaField
Definition: Maxwell.H:128
volSymmTensorField sigma_
Single or mode sum viscoelastic stress.
Definition: Maxwell.H:99
virtual tmp< fvSymmTensorMatrix > sigmaSource(const label modei, volSymmTensorField &sigma) const
Definition: Maxwell.C:93
virtual tmp< volSymmTensorField > sigma() const
Return the stress tensor [m^2/s^2].
Definition: Maxwell.C:269
TypeName("Maxwell")
Runtime type information.
virtual void correct()
Correct the Maxwell stress.
Definition: Maxwell.C:329
PtrList< dimensionedScalar > lambdas_
Definition: Maxwell.H:93
virtual void predict()
The Maxwell stress is not predicted.
Definition: Maxwell.H:184
virtual tmp< volScalarField > nuEff() const
Return the effective viscosity, i.e. the laminar viscosity.
Definition: Maxwell.C:248
virtual tmp< fvVectorMatrix > divDevTau(volVectorField &U) const
Return the source term for the momentum equation.
Definition: Maxwell.C:290
PtrList< dictionary > modeCoefficients_
Definition: Maxwell.H:87
PtrList< volSymmTensorField > sigmas_
Mode viscoelastic stresses.
Definition: Maxwell.H:102
Maxwell(const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const viscosity &viscosity, const word &type=typeName)
Construct from components.
Definition: Maxwell.C:106
PtrList< dimensionedScalar > readModeCoefficients(const word &name, const dimensionSet &dims) const
Definition: Maxwell.C:43
virtual ~Maxwell()
Destructor.
Definition: Maxwell.H:152
virtual tmp< volSymmTensorField > devTau() const
Return the effective stress tensor.
Definition: Maxwell.C:276
dimensionedScalar nuM_
Definition: Maxwell.H:91
tmp< volScalarField > nu0() const
Return the non-Newtonian viscosity.
Definition: Maxwell.H:114
virtual bool read()
Read model coefficients if they have changed.
Definition: Maxwell.C:225
BasicMomentumTransportModel::rhoField rhoField
Definition: Maxwell.H:129
A class for managing temporary objects.
Definition: tmp.H:55
Abstract base class for all fluid physical properties.
Definition: viscosity.H:50
A class for handling words, derived from string.
Definition: word.H:62
label patchi
U
Definition: pEqn.H:72
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488