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-2026 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  // Private Member Functions
82 
83  //- Return the source term for the momentum equation
84  template<class RhoFieldType>
85  tmp<fvVectorMatrix> DivDevTau
86  (
87  const RhoFieldType& rho,
89  ) const;
90 
91 
92 protected:
93 
94  // Protected data
95 
96  // Model coefficients
97 
98  //- Mode coefficients dictionary
100 
101  //- Number of modes
102  label nModes_;
103 
104  //- Mode non-Newtonian viscosities
106 
107  //- Mode time-scales
109 
110  //- Sum of mode non-Newtonian viscosities
112 
113 
114  // Fields
115 
116  //- Single or mode sum viscoelastic stress
118 
119  //- Mode viscoelastic stresses
121 
122 
123  // Protected Member Functions
124 
125  //- Read a coefficient for all modes and return as a list
127  (
128  const word& name,
129  const dimensionSet& dims
130  ) const;
131 
132  //- Read a coefficient for all modes and return as a list
134  (
135  const word& type,
136  const word& name,
137  const dimensionSet& dims
138  ) const;
139 
140  //- Return the sum of the given list of mode viscosities
142 
143  //- Return the effective viscosity
144  tmp<volScalarField> nu0() const
145  {
146  return this->nu() + nuMSum_;
147  }
148 
150  (
151  const label modei,
153  ) const;
154 
155 
156 public:
157 
158  typedef typename BasicMomentumTransportModel::alphaField alphaField;
159  typedef typename BasicMomentumTransportModel::rhoField rhoField;
160 
161 
162  //- Runtime type information
163  TypeName("Maxwell");
164 
165 
166  // Constructors
167 
168  //- Construct from components
169  Maxwell
170  (
171  const alphaField& alpha,
172  const rhoField& rho,
173  const volVectorField& U,
174  const surfaceScalarField& alphaRhoPhi,
175  const surfaceScalarField& phi,
176  const viscosity& viscosity,
177  const word& type = typeName
178  );
179 
180 
181  //- Destructor
182  virtual ~Maxwell()
183  {}
184 
185 
186  // Member Functions
187 
188  //- Read model coefficients if they have changed
189  virtual bool read();
190 
191  //- Return the effective viscosity, i.e. the laminar viscosity
192  virtual tmp<volScalarField> nuEff() const;
193 
194  //- Return the effective viscosity on patch
195  virtual tmp<scalarField> nuEff(const label patchi) const;
196 
197  //- Return the effective surface stress
198  virtual tmp<surfaceVectorField> devTau() const;
199 
200  //- Return the source term for the momentum equation
202 
203  //- Return the source term for the momentum equation
205  (
206  const volScalarField& rho,
208  ) const;
209 
210  //- The Maxwell stress is not predicted
211  virtual void predict()
212  {}
213 
214  //- Correct the Maxwell stress
215  virtual void correct();
216 };
217 
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 } // End namespace laminarModels
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #ifdef NoRepository
227  #include "Maxwell.C"
228 #endif
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #endif
233 
234 // ************************************************************************* //
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
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Dimension set for the base types.
Definition: dimensionSet.H:125
Templated abstract base class for laminar transport models.
Definition: laminarModel.H:52
BasicMomentumTransportModel::alphaField alphaField
Definition: laminarModel.H:70
BasicMomentumTransportModel::rhoField rhoField
Definition: laminarModel.H:71
Generalised Maxwell model for viscoelasticity using the upper-convected time derivative of the stress...
Definition: Maxwell.H:79
BasicMomentumTransportModel::alphaField alphaField
Definition: Maxwell.H:157
volSymmTensorField sigma_
Single or mode sum viscoelastic stress.
Definition: Maxwell.H:116
dictionary modeCoefficients_
Mode coefficients dictionary.
Definition: Maxwell.H:98
PtrList< dimensionedScalar > nuM_
Mode non-Newtonian viscosities.
Definition: Maxwell.H:104
virtual tmp< fvSymmTensorMatrix > sigmaSource(const label modei, volSymmTensorField &sigma) const
Definition: Maxwell.C:128
TypeName("Maxwell")
Runtime type information.
virtual void correct()
Correct the Maxwell stress.
Definition: Maxwell.C:362
label nModes_
Number of modes.
Definition: Maxwell.H:101
PtrList< dimensionedScalar > lambdas_
Mode time-scales.
Definition: Maxwell.H:107
dimensionedScalar nuMSum_
Sum of mode non-Newtonian viscosities.
Definition: Maxwell.H:110
virtual void predict()
The Maxwell stress is not predicted.
Definition: Maxwell.H:210
virtual tmp< volScalarField > nuEff() const
Return the effective viscosity, i.e. the laminar viscosity.
Definition: Maxwell.C:272
virtual tmp< fvVectorMatrix > divDevTau(volVectorField &U) const
Return the source term for the momentum equation.
Definition: Maxwell.C:341
virtual tmp< surfaceVectorField > devTau() const
Return the effective surface stress.
Definition: Maxwell.C:293
PtrList< volSymmTensorField > sigmas_
Mode viscoelastic stresses.
Definition: Maxwell.H:119
dimensionedScalar sumNuM(const PtrList< dimensionedScalar > &nuM) const
Return the sum of the given list of mode viscosities.
Definition: Maxwell.C:108
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:141
PtrList< dimensionedScalar > readModeCoefficients(const word &name, const dimensionSet &dims) const
Read a coefficient for all modes and return as a list.
Definition: Maxwell.C:43
virtual ~Maxwell()
Destructor.
Definition: Maxwell.H:181
tmp< volScalarField > nu0() const
Return the effective viscosity.
Definition: Maxwell.H:143
virtual bool read()
Read model coefficients if they have changed.
Definition: Maxwell.C:249
BasicMomentumTransportModel::rhoField rhoField
Definition: Maxwell.H:158
A class for managing temporary objects.
Definition: tmp.H:55
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
Abstract base class for all fluid physical properties.
Definition: viscosity.H:50
A class for handling words, derived from string.
Definition: word.H:63
label patchi
U
Definition: pEqn.H:72
rho
Definition: pEqn.H:1
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m^2/K^4].
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 LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488