anisotropic.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) 2022-2023 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::solidThermophysicalTransportModels::anisotropic
26 
27 Description
28  Solid thermophysical transport model for anisotropic thermal conductivity
29 
30  The anisotropic thermal conductivity field is evaluated from the solid
31  material anisotropic kappa specified in the physicalProperties dictionary
32  transformed into the global coordinate system using default
33  coordinate system and optionally additional coordinate systems specified
34  per-zone in the thermophysicalProperties dictionary.
35 
36  If the coordinate transformed kappa does not align exactly with the boundary
37  because the patch face orientations do not conform to the coordinate system
38  exactly it may be beneficial for convergence and accuracy to enforce
39  alignment at the boundary by setting the optional \c boundaryAligned to
40  true.
41 
42 Usage
43  Example of the anisotropic thermal conductivity specification in
44  thermophysicalProperties with two zone-based coordinate systems in
45  addition to the default:
46 
47  \verbatim
48  model anisotropic;
49 
50  // Force aligned handling of kappa irrespective
51  // of the calculated patch alignment factors.
52  boundaryAligned true;
53 
54  // Default coordinate system
55  coordinateSystem
56  {
57  type cartesian;
58  origin (0 0 0);
59  coordinateRotation
60  {
61  type cylindrical;
62  e3 (1 0 0);
63  }
64  }
65 
66  // Optional zone coordinate systems
67  zones
68  {
69  coil1
70  {
71  type cartesian;
72  origin (0.1 0.2 0.7);
73  coordinateRotation
74  {
75  type cylindrical;
76  e3 (0.5 0.866 0);
77  }
78  }
79 
80  coil2
81  {
82  type cartesian;
83  origin (0.4 0.5 1);
84  coordinateRotation
85  {
86  type cylindrical;
87  e3 (0.866 0.5 0);
88  }
89  }
90  }
91  \endverbatim
92 
93 SourceFiles
94  anisotropic.C
95 
96 \*---------------------------------------------------------------------------*/
97 
98 #ifndef anisotropic_H
99 #define anisotropic_H
100 
102 #include "coordinateSystem.H"
103 #include "PtrDictionary.H"
104 #include "MeshObjects.H"
105 
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 
108 namespace Foam
109 {
110 namespace solidThermophysicalTransportModels
111 {
112 
113 /*---------------------------------------------------------------------------*\
114  Class anisotropic Declaration
115 \*---------------------------------------------------------------------------*/
116 
117 template<class SolidThermophysicalTransportModel>
118 class anisotropic
119 :
120  public SolidThermophysicalTransportModel,
121  public TopoChangeableMeshObject<fvMesh>
122 {
123  // Private member data
124 
125  coordinateSystem coordinateSystem_;
126 
127  //- Optional zone coordinate systems
128  PtrDictionary<coordinateSystem> zoneCoordinateSystems_;
129 
130  //- Switch to override boundary alignment checks
131  // and force aligned handling of kappa irrespective
132  // of the calculated patch alignment factors
133  Switch boundaryAligned_;
134 
135  // List of patch faces adjacent to coordinate zones
136  mutable labelListListList zonesPatchFaces_;
137 
138  //- Alignment of Kappa for each patch
139  // true is closely aligned, zero otherwise
140  boolList aligned_;
141 
142  //- Find all the patch faces adjacent to zones
143  void setZonesPatchFaces() const;
144 
145  //- Thermal conductivity [W/m/K]
146  tmp<volSymmTensorField> Kappa() const;
147 
148  //- Thermal conductivity for patch [W/m/K]
149  tmp<symmTensorField> Kappa(const label patchi) const;
150 
151 
152 public:
153 
154  typedef typename SolidThermophysicalTransportModel::alphaField
155  alphaField;
156 
157  //- Runtime type information
158  TypeName("anisotropic");
159 
160 
161  // Constructors
162 
163  //- Construct from solid thermophysical properties
165  (
166  const alphaField& alpha,
167  const solidThermo& thermo
168  );
169 
170 
171  //- Destructor
172  virtual ~anisotropic()
173  {}
174 
175 
176  // Member Functions
177 
178  //- Read thermophysicalTransport dictionary
179  virtual bool read();
180 
181  //- Thermal conductivity [W/m/K]
182  virtual tmp<volScalarField> kappa() const;
183 
184  //- Thermal conductivity for patch [W/m/K]
185  virtual tmp<scalarField> kappa(const label patchi) const;
186 
187  //- Return the heat flux [W/m^2]
188  virtual tmp<surfaceScalarField> q() const;
189 
190  //- Return the patch heat flux correction [W/m^2]
191  // For patch-aligned thermal conductivity qCorr is null
192  virtual tmp<scalarField> qCorr(const label patchi) const;
193 
194  //- Return the source term for the energy equation
195  virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
196 
197  //- Correct the anisotropic viscosity
198  virtual void predict();
199 
200 
201  // Mesh changes
202 
203  //- Update for mesh motion
204  virtual bool movePoints();
205 
206  //- Update topology using the given map
207  virtual void topoChange(const polyTopoChangeMap& map);
208 
209  //- Update from another mesh using the given map
210  virtual void mapMesh(const polyMeshMap& map);
211 
212  //- Redistribute or update using the given distribution map
213  virtual void distribute(const polyDistributionMap& map);
214 };
215 
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 } // End namespace solidThermophysicalTransportModels
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #ifdef NoRepository
225  #include "anisotropic.C"
226 #endif
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #endif
231 
232 // ************************************************************************* //
Generic GeometricField class.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
Base class for other coordinate system specifications.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Base-class for solid thermodynamic properties.
Definition: solidThermo.H:59
Solid thermophysical transport model for anisotropic thermal conductivity.
Definition: anisotropic.H:121
virtual bool movePoints()
Update for mesh motion.
Definition: anisotropic.C:467
SolidThermophysicalTransportModel::alphaField alphaField
Definition: anisotropic.H:154
virtual tmp< scalarField > qCorr(const label patchi) const
Return the patch heat flux correction [W/m^2].
Definition: anisotropic.C:400
virtual void predict()
Correct the anisotropic viscosity.
Definition: anisotropic.C:452
virtual void mapMesh(const polyMeshMap &map)
Update from another mesh using the given map.
Definition: anisotropic.C:488
virtual void distribute(const polyDistributionMap &map)
Redistribute or update using the given distribution map.
Definition: anisotropic.C:500
virtual tmp< volScalarField > kappa() const
Thermal conductivity [W/m/K].
Definition: anisotropic.C:360
virtual tmp< surfaceScalarField > q() const
Return the heat flux [W/m^2].
Definition: anisotropic.C:383
anisotropic(const alphaField &alpha, const solidThermo &thermo)
Construct from solid thermophysical properties.
Definition: anisotropic.C:101
virtual void topoChange(const polyTopoChangeMap &map)
Update topology using the given map.
Definition: anisotropic.C:476
virtual bool read()
Read thermophysicalTransport dictionary.
Definition: anisotropic.C:213
virtual tmp< fvScalarMatrix > divq(volScalarField &he) const
Return the source term for the energy equation.
Definition: anisotropic.C:428
TypeName("anisotropic")
Runtime type information.
A class for managing temporary objects.
Definition: tmp.H:55
label patchi
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
thermo he()
fluidMulticomponentThermo & thermo
Definition: createFields.H:31