OpenFOAM: API Guide
v2112
The open source CFD toolbox
alphaEqnSubCycle.H
Go to the documentation of this file.
1
if
(
pimple
.nCorrPIMPLE() > 1)
2
{
3
// If nOuterCorrectors > 1 then for all but the first loop the advection
4
// of alpha is done using an average, 0.5*phi+0.5*phiNew where phi is
5
// the flux at the beginning of the time step and phiNew is the flux
6
// estimate at the end of the time step from the previous outer
7
// iteration. Similarly we use 0.5*U + 0.5*UNew in later iterations.
8
if
(
pimple
.firstIter())
9
{
10
// To recalculate the alpha1 update in subsequent iterations, we
11
// must store its current value before overwriting with the new
12
// value
13
alpha1
.storePrevIter();
14
// Storing initial phi and U for use in later outer iterations.
15
phi
.storePrevIter();
16
U
.storePrevIter();
17
}
18
else
19
{
20
// Resetting alpha1 to value before advection in first PIMPLE
21
// iteration.
22
alpha1
=
alpha1
.prevIter();
23
24
// Temporarily setting U and phi with which to advect interface.
25
U
= 0.5*
U
.prevIter() + 0.5*
U
;
26
phi
= 0.5*
phi
.prevIter() + 0.5*
phi
;
27
}
28
}
29
30
if
(
nAlphaSubCycles
> 1)
31
{
32
dimensionedScalar
totalDeltaT =
runTime
.deltaT();
33
surfaceScalarField
rhoPhiSum
34
(
35
IOobject
36
(
37
"rhoPhiSum"
,
38
runTime
.timeName(),
39
mesh
40
),
41
mesh
,
42
dimensionedScalar
(
rhoPhi
.dimensions(),
Zero
)
43
);
44
45
for
46
(
47
subCycle<volScalarField> alphaSubCycle(
alpha1
,
nAlphaSubCycles
);
48
!(++alphaSubCycle).
end
();
49
)
50
{
51
#include "
alphaEqn.H
"
52
rhoPhiSum += (
runTime
.deltaT()/totalDeltaT)*
rhoPhi
;
53
}
54
55
rhoPhi
= rhoPhiSum;
56
}
57
else
58
{
59
#include "
alphaEqn.H
"
60
}
61
62
if
(!
pimple
.firstIter())
63
{
64
// Resetting U and phi to value at latest iteration.
65
U
= 2.0*
U
-
U
.prevIter();
66
phi
= 2.0*
phi
-
phi
.prevIter();
67
}
68
69
rho
==
alpha1
*
rho1
+
alpha2
*
rho2
;
runTime
engineTime & runTime
Definition:
createEngineTime.H:13
rhoPhi
rhoPhi
Definition:
rhoEqn.H:10
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition:
zero.H:131
alpha2
const volScalarField & alpha2
Definition:
setRegionFluidFields.H:9
alpha1
const volScalarField & alpha1
Definition:
setRegionFluidFields.H:8
nAlphaSubCycles
label nAlphaSubCycles(alphaControls.get< label >("nAlphaSubCycles"))
rho
rho
Definition:
alphaEqnSubCycle.H:70
pimple
pimpleControl & pimple
Definition:
setRegionFluidFields.H:56
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition:
dimensionedScalarFwd.H:42
phi
surfaceScalarField & phi
Definition:
setRegionFluidFields.H:8
rho2
volScalarField & rho2
Definition:
setRegionFluidFields.H:30
rho1
volScalarField & rho1
Definition:
setRegionFluidFields.H:27
mesh
dynamicFvMesh & mesh
Definition:
createDynamicFvMesh.H:6
stdFoam::end
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Definition:
stdFoam.H:121
U
U
Definition:
pEqn.H:72
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition:
surfaceFieldsFwd.H:54
alphaEqn.H
applications
solvers
multiphase
interIsoFoam
alphaEqnSubCycle.H
Generated by
1.8.17
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.