scalarTransport.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 | Copyright (C) 2012-2016 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::scalarTransport
26 
27 Group
28  grpUtilitiesFunctionObjects
29 
30 Description
31  This function object evolves a passive scalar transport equation. The
32  field in ininitially zero, to which sources are added. The field name
33  is assigned the name of the function object. Boundary conditions are
34  automatically applied, based on the velocity boundary conditions.
35 
36  - the field can be zeroed on start-up using the resetOnStartUp flag
37  - to employ the same numerical schemes as the flow velocity, use the
38  autoSchemes flag
39  - the diffusivity can be set manually using the DT entry, or retrieved
40  from the turbulence model (if applicable)
41 
42 SourceFiles
43  scalarTransport.C
44  IOscalarTransport.H
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef scalarTransport_H
49 #define scalarTransport_H
50 
51 #include "volFields.H"
52 #include "surfaceFieldsFwd.H"
53 #include "pointFieldFwd.H"
54 #include "fvMatricesFwd.H"
55 #include "fvOptionList.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 
62 // Forward declaration of classes
63 class objectRegistry;
64 class dictionary;
65 class mapPolyMesh;
66 
67 /*---------------------------------------------------------------------------*\
68  Class scalarTransport Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 class scalarTransport
72 {
73  // Private data
74 
75  //- Name of this set of scalarTransport objects
76  word name_;
77 
78  //- Reference to the mesh database
79  const fvMesh& mesh_;
80 
81  //- Name of flux field (optional)
82  word phiName_;
83 
84  //- Name of velocity field (optional)
85  word UName_;
86 
87  //- Name of density field (optional)
88  word rhoName_;
89 
90  //- Diffusion coefficient (optional)
91  scalar DT_;
92 
93  //- Flag to indicate whether user DT_ is used
94  bool userDT_;
95 
96  //- Flag to reset scalar field on start-up
97  bool resetOnStartUp_;
98 
99  //- Number of corrector iterations (optional)
100  label nCorr_;
101 
102  //- Flag to employ schemes for velocity for scalar transport
103  bool autoSchemes_;
104 
105  //- Run-time selectable finite volume options, e.g. sources, constraints
106  fv::optionList fvOptions_;
107 
108  //- The scalar field
109  volScalarField T_;
110 
111 
112  // Private Member Functions
113 
114  //- Return the boundary types for the scalar field
115  wordList boundaryTypes() const;
116 
117  //- Return the diffusivity field
118  tmp<volScalarField> DT(const surfaceScalarField& phi) const;
119 
120  //- Disallow default bitwise copy construct
122 
123  //- Disallow default bitwise assignment
124  void operator=(const scalarTransport&);
125 
126 
127 public:
128 
129  //- Runtime type information
130  TypeName("scalarTransport");
131 
132 
133  // Constructors
134 
135  //- Construct for given objectRegistry and dictionary.
136  // Allow the possibility to load fields from files
138  (
139  const word& name,
140  const objectRegistry&,
141  const dictionary&,
142  const bool loadFromFiles = false
143  );
144 
145 
146  //- Destructor
147  virtual ~scalarTransport();
148 
149 
150  // Member Functions
151 
152  //- Return name of the set of scalarTransport
153  virtual const word& name() const
154  {
155  return name_;
156  }
157 
158  //- Read the scalarTransport data
159  virtual void read(const dictionary&);
160 
161  //- Execute, currently does nothing
162  virtual void execute();
163 
164  //- Execute at the final time-loop, currently does nothing
165  virtual void end();
166 
167  //- Called when time was set at the end of the Time::operator++
168  virtual void timeSet();
169 
170  //- Calculate the scalarTransport and write
171  virtual void write();
172 
173  //- Update for changes of mesh
174  virtual void updateMesh(const mapPolyMesh&)
175  {}
176 
177  //- Update for changes of mesh
178  virtual void movePoints(const polyMesh&)
179  {}
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual ~scalarTransport()
Destructor.
TypeName("scalarTransport")
Runtime type information.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
A class for handling words, derived from string.
Definition: word.H:59
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
virtual void execute()
Execute, currently does nothing.
virtual void write()
Calculate the scalarTransport and write.
This function object evolves a passive scalar transport equation. The field in ininitially zero...
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
Namespace for OpenFOAM.
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
virtual const word & name() const
Return name of the set of scalarTransport.
virtual void end()
Execute at the final time-loop, currently does nothing.
Forward declarations of fvMatrix specializations.
surfaceScalarField & phi
List of finite volume options.
Definition: fvOptionList.H:63
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Registry of regIOobjects.
virtual void read(const dictionary &)
Read the scalarTransport data.
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
A class for managing temporary objects.
Definition: PtrList.H:118