-
Notifications
You must be signed in to change notification settings - Fork 0
/
alphaEqns.H
210 lines (171 loc) · 6.39 KB
/
alphaEqns.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
{
word alphaScheme("div(phi,alpha)");
word alpharScheme("div(phirb,alpha)");
surfaceScalarField phir(phic*interface.nHatf());
surfaceScalarField rhof("rhof", fvc::interpolate(rho));
volScalarField alphalCoeff(1.0/max(rho1, rhoMin) - alpha1*(1.0/max(rho1, rhoMin) - 1.0/max(rho2,rhoMin)));
volScalarField limitedAlpha1(min(max(alpha1, scalar(0)), scalar(1)));
volScalarField mcCoeff(Cc*rho2/tInf);
volScalarField mvCoeff(Cv*rho2/(0.5*max(rho1,rhoMin)*sqr(UInf)*tInf));
dimensionedScalar mcCoeffMerkle(Cc/(0.5*sqr(UInf)*tInf));
volScalarField mvCoeffMerkle(Cv*rho1/(0.5*sqr(UInf)*tInf*max(rho2, rhoMin)));
volScalarField AbyV(mag(fvc::grad(limitedAlpha1)));
volScalarField Cm1(2.0*CvTan*Hfg*rho2/((2.0-CvTan)*pow(2.0*M_PI*R,0.5)));
if(cav_model==0) { // no phase-change
volScalarField vDotcAlpha(0.0*rho1);
volScalarField vDotcAlphal(0.0*rho1);
volScalarField vDotvAlphal(0.0*rho1);
} else if(cav_model == 2) { // Kunz
// pressure driven mass transfer term
forAll (p, celli) {
if (p[celli] > pSat1[celli])
{ // condensation
vDotcAlphal[celli] = alphalCoeff[celli]*mcCoeff[celli]*sqr(limitedAlpha1[celli])*max(p[celli] - pSat1[celli], p0.value())/max(p[celli] - pSat1[celli], 0.01*pSat.value()); //Kunz
}
else
{ // vaporization
vDotvAlphal[celli] = alphalCoeff[celli]*mvCoeff[celli]*min(p[celli] - pSat1[celli], p0.value()); //Kunz
}
}
// Kunz
} else if(cav_model == 3) { // Merkle
// pressure driven mass transfer term
forAll (p, celli) {
if (p[celli] > pSat1[celli])
{ // condensation
vDotcAlphal[celli] = alphalCoeff[celli]*mcCoeffMerkle.value()*max(p[celli] - pSat1[celli], p0.value()); //Merkle
}
else
{ // vaporization
vDotvAlphal[celli] = alphalCoeff[celli]*mvCoeffMerkle[celli]*min(p[celli] - pSat1[celli], p0.value()); //Merkle
}
}
//Merkle
} else if(cav_model == 4) { // Lee
// temperature driven mass transfer term
forAll (p, celli) {
if (T[celli] < TSat1[celli])
{ // condensation
vDotcAlphal[celli] = alphalCoeff[celli]*(-Rc.value())*rho2[celli]*min(T[celli]-TSat1[celli],T0.value())/TSat1[celli]; //Lee
}
else
{ // vaporization
vDotvAlphal[celli] = alphalCoeff[celli]*(-Rv.value())*rho1[celli]*max(T[celli]-TSat1[celli],T0.value())/TSat1[celli]; //Lee
}
}
//Lee
} else if(cav_model == 5) { // Tanasawa
// temperature driven mass transfer term
forAll (p, celli) {
if (T[celli] < TSat1[celli])
{ // condensation
vDotcAlphal[celli] = alphalCoeff[celli]*(-RcTan.value())*Cm1[celli]*min(T[celli] - TSat1[celli], T0.value())*AbyV[celli]/Foam::sqrt(Foam::pow(TSat1[celli], 3.0)); //Tanasawa
}
else
{ // vaporization
vDotvAlphal[celli] = alphalCoeff[celli]*(-RvTan.value())*Cm1[celli]*max(T[celli] - TSat1[celli], T0.value())*AbyV[celli]/Foam::sqrt(Foam::pow(TSat1[celli], 3.0)); //Tanasawa
}
}
}//Tanasawa
volScalarField vDotvmcAlphal(vDotvAlphal - vDotcAlphal);
tmp<surfaceScalarField> tphiAlpha;
if (MULESCorr)
{
fvScalarMatrix alpha1Eqn
(
fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alpha1)
+ fv::gaussConvectionScheme<scalar>
(
mesh,
phi,
upwind<scalar>(mesh, phi)
).fvmDiv(phi, alpha1)
- fvm::Sp(divU, alpha1)
==
vDotcAlphal
+ mdot/max(rho, 0.01*rho1)
);
alpha1Eqn.solve();
Info<< "Phase-1 volume fraction = "
<< alpha1.weightedAverage(mesh.Vsc()).value()
<< " Min(alpha1) = " << min(alpha1).value()
<< " Max(alpha1) = " << max(alpha1).value()
<< endl;
tphiAlpha = alpha1Eqn.flux();
}
volScalarField alpha10("alpha10", min(max(alpha1, scalar(0.001)),scalar(1)));
for (int gCorr=0; gCorr<nAlphaCorr; gCorr++)
{
volScalarField::DimensionedInternalField Sp
(
IOobject
(
"Sp",
runTime.timeName(),
mesh
),
dimensionedScalar("Sp", dgdt.dimensions(), 0.0) + vDotvAlphal - vDotcAlphal
);
volScalarField::DimensionedInternalField Su
(
IOobject
(
"Su",
runTime.timeName(),
mesh
),
// Divergence term is handled explicitly to be
// consistent with the explicit transport solution
divU*alpha1
+ vDotcAlphal
);
forAll(dgdt, celli)
{
if (dgdt[celli] > 0.0 && alpha1[celli] > 0.0)
{
Sp[celli] -= dgdt[celli]*alpha1[celli];
Su[celli] += dgdt[celli]*alpha1[celli];
}
else if (dgdt[celli] < 0.0 && alpha1[celli] < 1.0)
{
Sp[celli] += dgdt[celli]*(1.0 - alpha1[celli]);
}
}
surfaceScalarField phiAlpha1
(
fvc::flux
(
phi,
alpha1,
alphaScheme
)
+ fvc::flux
(
-fvc::flux(-phir, alpha2, alpharScheme),
alpha1,
alpharScheme
)
);
MULES::explicitSolve
(
geometricOneField(),
alpha1,
tphiAlpha, //phi,
phiAlpha1,
Sp,
Su,
1,
0
);
alpha1 = min(max(alpha1, scalar(0.0001)), scalar(1));
surfaceScalarField rho1f(fvc::interpolate(rho1));
surfaceScalarField rho2f(fvc::interpolate(rho2));
rhoPhi = phiAlpha1*(rho1f - rho2f) + phi*rho2f;
alpha2 = max(scalar(1) - alpha1, scalar(0.0001));
}
Info<< "Liquid phase volume fraction = "
<< alpha1.weightedAverage(mesh.V()).value()
<< " Min(alpha1) = " << min(alpha1).value()
<< " Min(alpha2) = " << min(alpha2).value()
<< endl;
}