linear.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) 2016-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 
26 #include "linear.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace wallBoilingModels
34 {
35 namespace partitioningModels
36 {
39  (
41  linear,
43  );
44 }
45 }
46 }
47 
48 
49 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
50 
51 template<class ScalarFieldType>
53 Foam::wallBoilingModels::partitioningModels::linear::calculate
54 (
55  const ScalarFieldType& alphaLiquid
56 ) const
57 {
58  return
59  min
60  (
61  max
62  (
63  (alphaLiquid - alphaLiquid0_)/(alphaLiquid1_ - alphaLiquid0_),
64  scalar(0)
65  ),
66  scalar(1)
67  );
68 }
69 
70 
71 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
72 
74 (
75  const dictionary& dict
76 )
77 :
79  alphaLiquid0_(dict.lookup<scalar>("alphaLiquid0")),
80  alphaLiquid1_(dict.lookup<scalar>("alphaLiquid1"))
81 {}
82 
83 
85 (
86  const linear& model
87 )
88 :
89  partitioningModel(model),
90  alphaLiquid0_(model.alphaLiquid0_),
91  alphaLiquid1_(model.alphaLiquid1_)
92 {}
93 
94 
95 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
96 
98 {}
99 
100 
101 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
102 
105 (
106  const scalarField& alphaLiquid
107 ) const
108 {
109  return calculate(alphaLiquid);
110 }
111 
112 
115 (
116  const volScalarField& alphaLiquid
117 ) const
118 {
119  return calculate(alphaLiquid);
120 }
121 
122 
124 (
125  Ostream& os
126 ) const
127 {
129  writeEntry(os, "alphaLiquid0", alphaLiquid0_);
130  writeEntry(os, "alphaLiquid1", alphaLiquid1_);
131 }
132 
133 
134 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A class for managing temporary objects.
Definition: tmp.H:55
Base class for wall heat flux partitioning models.
virtual void write(Ostream &os) const
Write to stream.
Linear wall heat flux partitioning model.
Definition: linear.H:68
virtual tmp< scalarField > wetFraction(const scalarField &alphaLiquid) const
Return the wet fraction.
Definition: linear.C:105
virtual void write(Ostream &os) const
Write to stream.
Definition: linear.C:124
linear(const dictionary &dict)
Construct from a dictionary.
Definition: linear.C:74
label calculate(const fvMesh &mesh, const labelHashSet &patchIDs, const scalar minFaceFraction, GeometricField< scalar, PatchField, GeoMesh > &distance)
Calculate distance data from patches.
addToRunTimeSelectionTable(partitioningModel, cosine, dictionary)
Namespace for OpenFOAM.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
dictionary dict