OneResistanceHeatTransferPhaseSystem.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) 2020-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 \*---------------------------------------------------------------------------*/
25 
27 #include "heatTransferModel.H"
28 #include "fvmSup.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class BasePhaseSystem>
35 (
36  const fvMesh& mesh
37 )
38 :
39  HeatTransferPhaseSystem<BasePhaseSystem>(mesh)
40 {
41  this->generateInterfacialModels(heatTransferModels_);
42 }
43 
44 
45 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
46 
47 template<class BasePhaseSystem>
50 {}
51 
52 
53 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
54 
55 template<class BasePhaseSystem>
58 heatTransfer() const
59 {
61  (
63  );
64 
65  phaseSystem::heatTransferTable& eqns = eqnsPtr();
66 
67  forAll(this->phaseModels_, phasei)
68  {
69  const phaseModel& phase = this->phaseModels_[phasei];
70 
71  eqns.insert
72  (
73  phase.name(),
74  new fvScalarMatrix(phase.thermo().he(), dimEnergy/dimTime)
75  );
76  }
77 
78  // Heat transfer across the interface
80  (
82  heatTransferModels_,
83  heatTransferModelIter
84  )
85  {
86  const phaseInterface interface(*this, heatTransferModelIter.key());
87 
88  const volScalarField K(heatTransferModelIter()->K());
89 
90  forAllConstIter(phaseInterface, interface, iter)
91  {
92  const phaseModel& phase = iter();
93  const phaseModel& otherPhase = iter.otherPhase();
94 
95  const volScalarField& he = phase.thermo().he();
96  const volScalarField Cpv(phase.thermo().Cpv());
97 
98  const volScalarField phaseK
99  (
100  iter.otherPhase()
101  /max(iter.otherPhase(), iter.otherPhase().residualAlpha())
102  *K
103  );
104 
105  *eqns[phase.name()] +=
106  phaseK*(otherPhase.thermo().T() - phase.thermo().T() + he/Cpv)
107  - fvm::Sp(phaseK/Cpv, he);
108  }
109  }
110 
111  return eqnsPtr;
112 }
113 
114 
115 template<class BasePhaseSystem>
117 {
119  {
120  bool readOK = true;
121 
122  // Models ...
123 
124  return readOK;
125  }
126  else
127  {
128  return false;
129  }
130 }
131 
132 
133 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:477
Generic GeometricField class.
A HashTable specialisation for hashing pointers.
Definition: HashPtrTable.H:67
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
Definition: HashTableI.H:80
virtual autoPtr< phaseSystem::heatTransferTable > heatTransfer() const
Return the heat transfer matrices.
heatTransferModelTable heatTransferModels_
Heat transfer models.
OneResistanceHeatTransferPhaseSystem(const fvMesh &)
Construct from fvMesh.
virtual bool read()
Read base phaseProperties dictionary.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
virtual volScalarField & he()=0
Enthalpy/Internal energy [J/kg].
virtual const volScalarField & T() const =0
Temperature [K].
virtual const volScalarField & Cpv() const =0
Heat capacity at constant pressure/volume [J/kg/K].
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Class to represent an interface between phases. Derivations can further specify the configuration of ...
virtual const rhoThermo & thermo() const =0
Return the thermophysical model.
const word & name() const
Return the name of this phase.
Definition: phaseModel.C:109
Calculate the matrix for implicit and explicit sources.
K
Definition: pEqn.H:75
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const VolField< Type > &)
const dimensionSet dimEnergy
const dimensionSet dimTime
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
thermo he()