isotropic.C
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 \*---------------------------------------------------------------------------*/
25 
26 #include "isotropic.H"
27 #include "fvmLaplacian.H"
28 #include "fvcLaplacian.H"
29 #include "fvcSnGrad.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 template<class SolidThermophysicalTransportModel>
37 (
38  const alphaField& alpha,
39  const solidThermo& thermo,
40  const word& type
41 )
42 :
43  SolidThermophysicalTransportModel(type, alpha, thermo)
44 {
45  if (!thermo.isotropic())
46  {
48  << "Cannot instantiate an isotropic transport model "
49  "with anisotropic solid properties"
50  << exit(FatalIOError);
51  }
52 }
53 
54 
55 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
56 
57 template<class SolidThermophysicalTransportModel>
60 {
61  return true;
62 }
63 
64 
65 template<class SolidThermophysicalTransportModel>
69 {
71  (
72  "q",
73  -fvc::interpolate(this->alpha()*this->kappa())
74  *fvc::snGrad(this->thermo().T())
75  );
76 }
77 
78 
79 template<class SolidThermophysicalTransportModel>
83 {
84  return
85  - (
86  this->alpha().boundaryField()[patchi]
87  *this->kappa(patchi)
88  *this->thermo().T().boundaryField()[patchi].snGrad()
89  );
90 }
91 
92 
93 template<class SolidThermophysicalTransportModel>
97 (
98  const label patchi
99 ) const
100 {
101  return tmp<scalarField>(nullptr);
102 }
103 
104 
105 template<class SolidThermophysicalTransportModel>
109 (
111 ) const
112 {
113  const solidThermo& thermo = this->thermo();
114 
115  // Return heat flux source as an implicit energy correction
116  // to the temperature gradient flux
117  return
118  -fvc::laplacian(this->alpha()*this->kappa(), thermo.T())
119  -fvm::laplacianCorrection(this->alpha()*this->kappa()/thermo.Cv(), e);
120 }
121 
122 
123 template<class SolidThermophysicalTransportModel>
126 {
127  SolidThermophysicalTransportModel::predict();
128 }
129 
130 
131 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
static tmp< GeometricField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Internal &, const PtrList< Patch > &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
virtual const volScalarField & Cv() const =0
Heat capacity at constant volume [J/kg/K].
virtual const volScalarField & T() const =0
Temperature [K].
Base-class for solid thermodynamic properties.
Definition: solidThermo.H:59
isotropic(const alphaField &alpha, const solidThermo &thermo, const word &type=typeName)
Construct from solid thermophysical properties.
Definition: isotropic.C:37
SolidThermophysicalTransportModel::alphaField alphaField
Definition: isotropic.H:63
virtual tmp< scalarField > qCorr(const label patchi) const
Return null patch heat flux correction [W/m^2].
Definition: isotropic.C:97
virtual void predict()
Correct the isotropic viscosity.
Definition: isotropic.C:125
virtual tmp< surfaceScalarField > q() const
Return the heat flux [W/m^2].
Definition: isotropic.C:68
virtual bool read()
Read thermophysicalTransport dictionary.
Definition: isotropic.C:59
virtual tmp< fvScalarMatrix > divq(volScalarField &he) const
Return the source term for the energy equation.
Definition: isotropic.C:109
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:346
Calculate the laplacian of the given field.
Calculate the snGrad of the given volField.
Calculate the matrix for the laplacian of the field.
label patchi
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
tmp< VolField< Type > > laplacian(const VolField< Type > &vf, const word &name)
Definition: fvcLaplacian.C:45
tmp< SurfaceField< Type > > snGrad(const VolField< Type > &vf, const word &name)
Definition: fvcSnGrad.C:45
tmp< fvMatrix< Type > > laplacianCorrection(const VolField< scalar > &gamma, const VolField< Type > &vf)
Definition: fvmLaplacian.C:340
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
const doubleScalar e
Definition: doubleScalar.H:106
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
IOerror FatalIOError
void T(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)
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