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("maxFullyDispersedAlpha", *iter)
61  );
62 
63  maxFullyDispersedAlpha_.insert
64  (
65  *iter,
67  (
68  nameFull,
69  dimless,
70  dict.lookup(nameFull)
71  )
72  );
73 
74  const word namePart
75  (
76  IOobject::groupName("maxPartlyDispersedAlpha", *iter)
77  );
78 
79  maxPartlyDispersedAlpha_.insert
80  (
81  *iter,
83  (
84  namePart,
85  dimless,
86  dict.lookup(namePart)
87  )
88  );
89 
90  if
91  (
92  maxFullyDispersedAlpha_[*iter]
93  > maxPartlyDispersedAlpha_[*iter]
94  )
95  {
97  << "The supplied fully dispersed volume fraction for "
98  << *iter
99  << " is greater than the partly dispersed value."
100  << endl << exit(FatalError);
101  }
102  }
103 }
104 
105 
106 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
107 
109 {}
110 
111 
112 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
113 
115 (
116  const phaseModel& phase1,
117  const phaseModel& phase2
118 ) const
119 {
120  const dimensionedScalar
121  maxFullAlpha(maxFullyDispersedAlpha_[phase1.name()]);
122  const dimensionedScalar
123  maxPartAlpha(maxPartlyDispersedAlpha_[phase1.name()]);
124 
125  return
126  min
127  (
128  max
129  (
130  (phase1 - maxFullAlpha)
131  /(maxPartAlpha - maxFullAlpha + SMALL),
132  scalar(0.0)
133  ),
134  scalar(1.0)
135  );
136 }
137 
138 
140 (
141  const phaseModel& phase1,
142  const phaseModel& phase2
143 ) const
144 {
145  const dimensionedScalar
146  maxFullAlpha(maxFullyDispersedAlpha_[phase2.name()]);
147  const dimensionedScalar
148  maxPartAlpha(maxPartlyDispersedAlpha_[phase2.name()]);
149 
150  return
151  min
152  (
153  max
154  (
155  (maxPartAlpha - phase2)
156  /(maxPartAlpha - maxFullAlpha + SMALL),
157  scalar(0.0)
158  ),
159  scalar(1.0)
160  );
161 }
162 
163 
164 // ************************************************************************* //
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
Macros for easy insertion into run-time selection tables.
virtual tmp< volScalarField > f1(const phaseModel &phase1, const phaseModel &phase2) const
Factor for primary phase.
static word groupName(Name name, const word &group)
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:29
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
virtual tmp< volScalarField > f2(const phaseModel &phase1, const phaseModel &phase2) const
Factor for secondary phase.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
List< word > wordList
A List of words.
Definition: fileName.H:54
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class for managing temporary objects.
Definition: PtrList.H:54
linear(const dictionary &dict, const wordList &phaseNames)
Construct from a dictionary and two phases.
Namespace for OpenFOAM.