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-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::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 thermophysicalTransport 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  thermophysicalTransport 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 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 
158  //- Runtime type information
159  TypeName("anisotropic");
160 
161 
162  // Constructors
163 
164  //- Construct from solid thermophysical properties
166  (
167  const alphaField& alpha,
168  const solidThermo& thermo,
169  const word& type = typeName
170  );
171 
172 
173  //- Destructor
174  virtual ~anisotropic()
175  {}
176 
177 
178  // Member Functions
179 
180  //- Read thermophysicalTransport dictionary
181  virtual bool read();
182 
183  //- Thermal conductivity [W/m/K]
184  virtual tmp<volScalarField> kappa() const;
185 
186  //- Thermal conductivity for patch [W/m/K]
187  virtual tmp<scalarField> kappa(const label patchi) const;
188 
189  //- Return the heat flux [W/m^2]
190  virtual tmp<surfaceScalarField> q() const;
191 
192  //- Return the patch heat flux [W/m^2]
193  virtual tmp<scalarField> q(const label patchi) const;
194 
195  //- Return the patch heat flux correction [W/m^2]
196  // For patch-aligned thermal conductivity qCorr is null
197  virtual tmp<scalarField> qCorr(const label patchi) const;
198 
199  //- Return the source term for the energy equation
200  virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
201 
202  //- Correct the anisotropic viscosity
203  virtual void predict();
204 
205 
206  // Mesh changes
207 
208  //- Update for mesh motion
209  virtual bool movePoints();
210 
211  //- Update topology using the given map
212  virtual void topoChange(const polyTopoChangeMap& map);
213 
214  //- Update from another mesh using the given map
215  virtual void mapMesh(const polyMeshMap& map);
216 
217  //- Redistribute or update using the given distribution map
218  virtual void distribute(const polyDistributionMap& map);
219 };
220 
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 } // End namespace solidThermophysicalTransportModels
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #ifdef NoRepository
230  #include "anisotropic.C"
231 #endif
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
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:479
anisotropic(const alphaField &alpha, const solidThermo &thermo, const word &type=typeName)
Construct from solid thermophysical properties.
Definition: anisotropic.C:101
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:412
virtual void predict()
Correct the anisotropic viscosity.
Definition: anisotropic.C:464
virtual void mapMesh(const polyMeshMap &map)
Update from another mesh using the given map.
Definition: anisotropic.C:500
virtual void distribute(const polyDistributionMap &map)
Redistribute or update using the given distribution map.
Definition: anisotropic.C:512
virtual tmp< volScalarField > kappa() const
Thermal conductivity [W/m/K].
Definition: anisotropic.C:362
virtual tmp< surfaceScalarField > q() const
Return the heat flux [W/m^2].
Definition: anisotropic.C:385
virtual void topoChange(const polyTopoChangeMap &map)
Update topology using the given map.
Definition: anisotropic.C:488
virtual bool read()
Read thermophysicalTransport dictionary.
Definition: anisotropic.C:215
virtual tmp< fvScalarMatrix > divq(volScalarField &he) const
Return the source term for the energy equation.
Definition: anisotropic.C:440
TypeName("anisotropic")
Runtime type information.
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...
A class for handling words, derived from string.
Definition: word.H:63
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
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
fluidMulticomponentThermo & thermo
Definition: createFields.H:15