Skip to content

Commit 7ec1e2f

Browse files
author
Henry Weller
committed
twoPhaseSolver::alphaPredictor: Ensure the Crank-Nicolson blended alpha1 has the same BCs as alpha1
so that compressive interpolations schemes such as PLIC and MPLIC can handle the BCs appropriately.
1 parent 6202193 commit 7ec1e2f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

applications/modules/twoPhaseSolver/alphaPredictor.C

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void Foam::solvers::twoPhaseSolver::alphaSolve
142142
}
143143

144144
// Set the time blending factor, 1 for Euler
145-
scalar cnCoeff = 1.0/(1.0 + ocCoeff);
145+
const scalar cnCoeff = 1.0/(1.0 + ocCoeff);
146146

147147
tmp<surfaceScalarField> phiCN(phi);
148148

@@ -232,13 +232,23 @@ void Foam::solvers::twoPhaseSolver::alphaSolve
232232

233233
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
234234
{
235+
tmp<volScalarField> talpha1CN(alpha1);
236+
237+
if (ocCoeff > 0)
238+
{
239+
// Preserve the BCs of alpha1 in alpha1CN for interpolation
240+
talpha1CN = alpha1.clone();
241+
talpha1CN.ref() ==
242+
(cnCoeff*alpha1 + (1.0 - cnCoeff)*alpha1.oldTime())();
243+
}
244+
235245
// Split operator
236246
tmp<surfaceScalarField> talphaPhi1Un
237247
(
238248
alphaPhi
239249
(
240250
phiCN(),
241-
(cnCoeff*alpha1 + (1.0 - cnCoeff)*alpha1.oldTime())(),
251+
talpha1CN(),
242252
alphaControls
243253
)
244254
);

0 commit comments

Comments
 (0)