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-2015 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
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
33namespace Foam
34{
35namespace 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:
56 blendingMethod(dict)
57{
58 for (const word& phaseName : phaseNames)
59 {
60 maxFullyDispersedAlpha_.insert
61 (
62 phaseName,
63 dimensionedScalar
64 (
65 IOobject::groupName("maxFullyDispersedAlpha", phaseName),
66 dimless,
67 dict
68 )
69 );
70
71 maxPartlyDispersedAlpha_.insert
72 (
73 phaseName,
74 dimensionedScalar
75 (
76 IOobject::groupName("maxPartlyDispersedAlpha", phaseName),
77 dimless,
78 dict
79 )
80 );
81
82 if
83 (
84 maxFullyDispersedAlpha_[phaseName]
85 > maxPartlyDispersedAlpha_[phaseName]
86 )
87 {
89 << "The supplied fully dispersed volume fraction for "
90 << phaseName
91 << " is greater than the partly dispersed 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{
107 maxFullAlpha(maxFullyDispersedAlpha_[phase1.name()]);
109 maxPartAlpha(maxPartlyDispersedAlpha_[phase1.name()]);
110
111 return
112 min
113 (
114 max
115 (
116 (phase1 - maxFullAlpha)
117 /(maxPartAlpha - maxFullAlpha + SMALL),
118 scalar(0)
119 ),
120 scalar(1)
121 );
122}
123
124
126(
127 const phaseModel& phase1,
128 const phaseModel& phase2
129) const
130{
132 maxFullAlpha(maxFullyDispersedAlpha_[phase2.name()]);
134 maxPartAlpha(maxPartlyDispersedAlpha_[phase2.name()]);
135
136 return
137 min
138 (
139 max
140 (
141 (maxPartAlpha - phase2)
142 /(maxPartAlpha - maxFullAlpha + SMALL),
143 scalar(0)
144 ),
145 scalar(1)
146 );
147}
148
149
150// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
phaseModel & phase1
phaseModel & phase2
virtual tmp< volScalarField > f1(const phaseModel &phase1, const phaseModel &phase2) const
Factor for primary phase.
Definition: linear.C:101
tmp< volScalarField > f2() const
Definition: LienCubicKE.C:60
Central-differencing interpolation scheme class.
Definition: linear.H:58
const word & name() const
Definition: phaseModel.H:144
A class for managing temporary objects.
Definition: tmp.H:65
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Namespace for OpenFOAM.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
dictionary dict