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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2014-2018 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "linear.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace blendingMethods
36 {
37  defineTypeNameAndDebug(linear, 0);
38 
40  (
41  blendingMethod,
42  linear,
43  dictionary
44  );
45 }
46 }
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
51 (
52  const dictionary& dict,
53  const wordList& phaseNames
54 )
55 :
57 {
58  for (const word& phaseName : phaseNames)
59  {
60  minFullyContinuousAlpha_.insert
61  (
62  phaseName,
64  (
65  IOobject::groupName("minFullyContinuousAlpha", phaseName),
66  dimless,
67  dict
68  )
69  );
70 
71  minPartlyContinuousAlpha_.insert
72  (
73  phaseName,
75  (
76  IOobject::groupName("minPartlyContinuousAlpha", phaseName),
77  dimless,
78  dict
79  )
80  );
81 
82  if
83  (
84  minFullyContinuousAlpha_[phaseName]
85  < minPartlyContinuousAlpha_[phaseName]
86  )
87  {
89  << "The supplied fully continuous volume fraction for "
90  << phaseName
91  << " is less than the partly continuous value."
92  << endl << exit(FatalError);
93  }
94  }
95 }
96 
97 
98 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
99 
101 (
102  const phaseModel& phase1,
103  const phaseModel& phase2
104 ) const
105 {
106  const dimensionedScalar
107  minFullAlpha(minFullyContinuousAlpha_[phase2.name()]);
108  const dimensionedScalar
109  minPartAlpha(minPartlyContinuousAlpha_[phase2.name()]);
110 
111  return
112  min
113  (
114  max
115  (
116  (phase2 - minPartAlpha)
117  /(minFullAlpha - minPartAlpha + SMALL),
118  scalar(0)
119  ),
120  scalar(1)
121  );
122 }
123 
124 
126 (
127  const phaseModel& phase1,
128  const phaseModel& phase2
129 ) const
130 {
131  const dimensionedScalar
132  minFullAlpha(minFullyContinuousAlpha_[phase1.name()]);
133  const dimensionedScalar
134  minPartAlpha(minPartlyContinuousAlpha_[phase1.name()]);
135 
136  return
137  min
138  (
139  max
140  (
141  (phase1 - minPartAlpha)
142  /(minFullAlpha - minPartAlpha + SMALL),
143  scalar(0)
144  ),
145  scalar(1)
146  );
147 }
148 
149 
150 // ************************************************************************* //
Foam::phaseModel
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:54
Foam::blendingMethods::addToRunTimeSelectionTable
addToRunTimeSelectionTable(blendingMethod, hyperbolic, dictionary)
Foam::blendingMethods::defineTypeNameAndDebug
defineTypeNameAndDebug(hyperbolic, 0)
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::blendingMethods::linear::f2
virtual tmp< volScalarField > f2(const phaseModel &phase1, const phaseModel &phase2) const
Factor for secondary phase.
Definition: linear.C:126
phase2
phaseModel & phase2
Definition: setRegionFluidFields.H:6
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::blendingMethods::linear::f1
virtual tmp< volScalarField > f1(const phaseModel &phase1, const phaseModel &phase2) const
Factor for primary phase.
Definition: linear.C:101
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:42
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::blendingMethod
Definition: blendingMethod.H:52
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::List< word >
Foam::blendingMethods::linear::linear
linear(const dictionary &dict, const wordList &phaseNames)
Construct from a dictionary and two phases.
Definition: linear.C:51
linear.H
phase1
phaseModel & phase1
Definition: setRegionFluidFields.H:5
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189