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-------------------------------------------------------------------------------
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{
38
40 (
42 linear,
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{
107 minFullAlpha(minFullyContinuousAlpha_[phase2.name()]);
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{
132 minFullAlpha(minFullyContinuousAlpha_[phase1.name()]);
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// ************************************************************************* //
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
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
virtual tmp< volScalarField > f1(const phaseModel &phase1, const phaseModel &phase2) const
Factor for primary phase.
Definition: linear.C:101
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
tmp< volScalarField > f2() const
Definition: LienCubicKE.C:60
Central-differencing interpolation scheme class.
Definition: linear.H:58
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:61
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
#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.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
const dimensionSet dimless
Dimensionless.
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
error FatalError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
dictionary dict