linear.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2014-2015 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 blendingMethods
34 {
35  defineTypeNameAndDebug(linear, 0);
36 
38  (
39  blendingMethod,
40  linear,
41  dictionary
42  );
43 }
44 }
45 
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 
49 (
50  const dictionary& dict,
51  const wordList& phaseNames
52 )
53 :
54  blendingMethod(dict)
55 {
56  forAllConstIter(wordList, phaseNames, iter)
57  {
58  const word nameFull
59  (
60  IOobject::groupName("minFullyContinuousAlpha", *iter)
61  );
62 
63  minFullyContinuousAlpha_.insert
64  (
65  *iter,
67  (
68  nameFull,
69  dimless,
70  dict.lookup(nameFull)
71  )
72  );
73 
74  const word namePart
75  (
76  IOobject::groupName("minPartlyContinuousAlpha", *iter)
77  );
78 
79  minPartlyContinuousAlpha_.insert
80  (
81  *iter,
83  (
84  namePart,
85  dimless,
86  dict.lookup(namePart)
87  )
88  );
89 
90  if
91  (
92  minFullyContinuousAlpha_[*iter]
93  < minPartlyContinuousAlpha_[*iter]
94  )
95  {
97  (
98  "Foam::blendingMethods::linear::linear"
99  "("
100  "const dictionary& dict,"
101  "const wordList& phaseNames"
102  ")"
103  ) << "The supplied fully continuous volume fraction for "
104  << *iter
105  << " is less than the partly continuous value."
106  << endl << exit(FatalError);
107  }
108  }
109 }
110 
111 
112 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
113 
115 {}
116 
117 
118 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
119 
121 (
122  const phaseModel& phase1,
123  const phaseModel& phase2
124 ) const
125 {
126  const dimensionedScalar
127  minFullAlpha(minFullyContinuousAlpha_[phase2.name()]);
128  const dimensionedScalar
129  minPartAlpha(minPartlyContinuousAlpha_[phase2.name()]);
130 
131  return
132  min
133  (
134  max
135  (
136  (phase2 - minPartAlpha)
137  /(minFullAlpha - minPartAlpha + SMALL),
138  scalar(0)
139  ),
140  scalar(1)
141  );
142 }
143 
144 
146 (
147  const phaseModel& phase1,
148  const phaseModel& phase2
149 ) const
150 {
151  const dimensionedScalar
152  minFullAlpha(minFullyContinuousAlpha_[phase1.name()]);
153  const dimensionedScalar
154  minPartAlpha(minPartlyContinuousAlpha_[phase1.name()]);
155 
156  return
157  min
158  (
159  max
160  (
161  (phase1 - minPartAlpha)
162  /(minFullAlpha - minPartAlpha + SMALL),
163  scalar(0)
164  ),
165  scalar(1)
166  );
167 }
168 
169 
170 // ************************************************************************* //
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
linear(const dictionary &dict, const wordList &phaseNames)
Construct from a dictionary and two phases.
Namespace for OpenFOAM.
static word groupName(Name name, const word &group)
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
virtual tmp< volScalarField > f1(const phaseModel &phase1, const phaseModel &phase2) const
Factor for primary phase.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
virtual tmp< volScalarField > f2(const phaseModel &phase1, const phaseModel &phase2) const
Factor for secondary phase.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Macros for easy insertion into run-time selection tables.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
List< word > wordList
A List of words.
Definition: fileName.H:54
error FatalError
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class for managing temporary objects.
Definition: PtrList.H:118
defineTypeNameAndDebug(combustionModel, 0)