viscousDissipation.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017-2020 OpenCFD Ltd
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fv::viscousDissipation
28 
29 Group
30  grpFvOptionsSources
31 
32 Description
33  Applies a viscous dissipation energy source to the energy equation.
34 
35  Sources applied to either of the below, if exist:
36  \verbatim
37  e | Internal energy [m2/s2]
38  h | Enthalphy [m2/s2]
39  field | User-specified field
40  \endverbatim
41 
42  Required fields:
43  \verbatim
44  U | Velocity [m/s]
45  rho | Fluid density (for compressible flows) [kg/m3]
46  \endverbatim
47 
48 Usage
49  Minimal example by using \c constant/fvOptions:
50  \verbatim
51  viscousDissipation1
52  {
53  // Mandatory entries (unmodifiable)
54  type viscousDissipation;
55 
56  // Optional entries (unmodifiable)
57  fields (<fieldName>);
58  U <UName>;
59  rho <rhoName>;
60 
61  // Conditional optional entries (unmodifiable)
62 
63  // when rho=rhoInf
64  rhoInf 1000;
65 
66  // Mandatory/Optional (inherited) entries
67  ...
68  }
69  \endverbatim
70 
71  where the entries mean:
72  \table
73  Property | Description | Type | Reqd | Dflt
74  type | Type name: viscousDissipation | word | yes | -
75  fields | Name of operand (energy) field | word | no | -
76  U | Name of operand velocity field | word | no | U
77  rho | Name of operand density field | word | no | none
78  rhoInf | Value of fluid density | scalar | cndtnl | 0
79  \endtable
80 
81  The inherited entries are elaborated in:
82  - \link fvOption.H \endlink
83 
84 Note
85  - The entry \c fields accepts only a single field name.
86  - The sources are applied onto the entire computational domain.
87  - \c rho=rhoInf sets a zero-density for single phase flows.
88  - Not applicable to multiphase flows.
89 
90 SourceFiles
91  viscousDissipation.C
92 
93 \*---------------------------------------------------------------------------*/
94 
95 #ifndef viscousDissipation_H
96 #define viscousDissipation_H
97 
98 #include "fvOption.H"
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 namespace Foam
104 {
105 namespace fv
106 {
107 
108 /*---------------------------------------------------------------------------*\
109  Class viscousDissipation Declaration
110 \*---------------------------------------------------------------------------*/
111 
112 class viscousDissipation
113 :
114  public fv::option
115 {
116  // Private Data
117 
118  //- Name of velocity field
119  word UName_;
120 
121  //- Name of the rho field for incompressible solvers
122  word rhoName_;
123 
124  //- Density for single phase flows
125  dimensionedScalar rho_;
126 
127 
128  // Private Member Functions
129 
130  //- Return the viscosity field
131  tmp<volSymmTensorField> devRhoReff() const;
132 
133  //- Return rho field
134  tmp<volScalarField> rho() const;
135 
136 
137 public:
138 
139  //- Runtime type information
140  TypeName("viscousDissipation");
141 
142 
143  // Constructors
144 
145  //- Construct from explicit source name and mesh
147  (
148  const word& sourceName,
149  const word& modelType,
150  const dictionary& dict,
151  const fvMesh& mesh
152  );
153 
154  //- No copy construct
155  viscousDissipation(const viscousDissipation&) = delete;
156 
157  //- No copy assignment
158  void operator=(const viscousDissipation&) = delete;
159 
160 
161  //- Destructor
162  virtual ~viscousDissipation() = default;
163 
164 
165  // Member Functions
166 
167  //- Add explicit contribution to compressible energy equation
168  virtual void addSup
169  (
170  const volScalarField& rho,
171  fvMatrix<scalar>& eqn,
172  const label fieldi
173  );
174 
175 
176  //- Read source dictionary - no-op
177  virtual bool read(const dictionary& dict)
178  {
179  return true;
180  }
181 };
182 
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 } // End namespace fv
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #endif
192 
193 // ************************************************************************* //
Foam::fv::viscousDissipation::~viscousDissipation
virtual ~viscousDissipation()=default
Destructor.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fv::viscousDissipation::read
virtual bool read(const dictionary &dict)
Read source dictionary - no-op.
Definition: viscousDissipation.H:212
rho
rho
Definition: readInitialConditions.H:88
Foam::fv::viscousDissipation::TypeName
TypeName("viscousDissipation")
Runtime type information.
Foam::fv::viscousDissipation::viscousDissipation
viscousDissipation(const word &sourceName, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
Definition: viscousDissipation.C:85
Foam::fv::option
Base abstract class for handling finite volume options (i.e. fvOption).
Definition: fvOption.H:126
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::fv::viscousDissipation::operator=
void operator=(const viscousDissipation &)=delete
No copy assignment.
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::dimensioned< scalar >
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fv
labelList fv(nPoints)
uniformDimensionedFields.H
Foam::fv::option::mesh
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
fvOption.H
Foam::fv::viscousDissipation::addSup
virtual void addSup(const volScalarField &rho, fvMatrix< scalar > &eqn, const label fieldi)
Add explicit contribution to compressible energy equation.
Definition: viscousDissipation.C:169
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::fv::viscousDissipation
Applies a viscous dissipation energy source to the energy equation.
Definition: viscousDissipation.H:147
Foam::GeometricField< scalar, fvPatchField, volMesh >