Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,7 +35,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "pisoControl.H"
|
||||
#include "nonOrthogonalSolutionControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -76,7 +76,7 @@ int main(int argc, char *argv[])
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
pisoControl potentialFlow(mesh, "potentialFlow");
|
||||
nonOrthogonalSolutionControl potentialFlow(mesh, "potentialFlow");
|
||||
|
||||
#include "createFields.H"
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ volScalarField rAU(1.0/UEqn.A());
|
||||
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ volScalarField rAU(1.0/UEqn.A());
|
||||
volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1()));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -104,7 +104,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
// Store momentum to set rhoUf for introduced faces.
|
||||
autoPtr<volVectorField> rhoU;
|
||||
@ -139,7 +139,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (pimple.firstIter() && !pimple.simpleRho())
|
||||
if (pimple.firstPimpleIter() && !pimple.simpleRho())
|
||||
{
|
||||
#include "rhoEqn.H"
|
||||
}
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -9,5 +7,5 @@ CorrectPhi
|
||||
psi,
|
||||
dimensionedScalar("rAUf", dimTime, 1),
|
||||
divrhoU(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
@ -11,7 +11,7 @@ volScalarField rAU(1.0/UEqn.A());
|
||||
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ volScalarField rAU(1.0/UEqn.A());
|
||||
volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1()));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -105,7 +105,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
// Store momentum to set rhoUf for introduced faces.
|
||||
autoPtr<volVectorField> rhoU;
|
||||
@ -140,7 +140,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (pimple.firstIter() && !pimple.simpleRho())
|
||||
if (pimple.firstPimpleIter() && !pimple.simpleRho())
|
||||
{
|
||||
#include "rhoEqn.H"
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ if (!mesh.steady() && !pimple.simpleRho())
|
||||
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ else
|
||||
turbulence.correct();
|
||||
}
|
||||
|
||||
if (!mesh.steady() && pimples.finalIter())
|
||||
if (!mesh.steady() && pimples.finalPimpleIter())
|
||||
{
|
||||
rho = thermo.rho();
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ if (pimple.consistent())
|
||||
HbyA -= (rAUrel - rAtUrel())*fvc::grad(p);
|
||||
}
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUrelEqn.clear();
|
||||
}
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p,
|
||||
dimensionedScalar("rAUf", dimTime, 1),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -26,7 +26,7 @@ if (pimple.consistent())
|
||||
HbyA -= (rAU - rAtU())*fvc::grad(p);
|
||||
}
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -75,7 +75,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
mesh.update();
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
Uc,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p,
|
||||
dimensionedScalar("rAUf", dimTime, 1),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -7,7 +7,7 @@ volScalarField rAU(1.0/UEqn.A());
|
||||
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -104,7 +104,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
mesh.update();
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p,
|
||||
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
|
||||
divU,
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -20,8 +20,6 @@ if (correctPhi)
|
||||
}
|
||||
else
|
||||
{
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -29,7 +27,7 @@ else
|
||||
p_rgh,
|
||||
dimensionedScalar(dimTime/rho.dimensions(), 1),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -95,7 +95,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
mesh.update();
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
mesh.update();
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
divU,
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -22,8 +22,6 @@ if (correctPhi)
|
||||
}
|
||||
else
|
||||
{
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -31,7 +29,7 @@ else
|
||||
p_rgh,
|
||||
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -96,7 +96,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
mesh.update();
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p_rgh,
|
||||
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p_gh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU)),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -2,7 +2,7 @@ rAU = 1.0/UEqn.A();
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_gh));
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -99,7 +99,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
|
||||
@ -1233,7 +1233,7 @@ void Foam::diameterModels::populationBalanceModel::solve()
|
||||
bool solveOnFinalIterOnly =
|
||||
solutionControls.lookupOrDefault<bool>("solveOnFinalIterOnly", false);
|
||||
|
||||
if (!solveOnFinalIterOnly || pimple_.finalIter())
|
||||
if (!solveOnFinalIterOnly || pimple_.finalPimpleIter())
|
||||
{
|
||||
const label nCorr = this->nCorr();
|
||||
const scalar tolerance =
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -75,7 +75,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
mesh.update();
|
||||
}
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Description
|
||||
Solves a transport equation for a scalar field within one phase of a
|
||||
multiphase simulation.
|
||||
|
||||
The name of the scalar field is specified in this file. A field file of
|
||||
this name will also be required, typically in the 0 directory. Scheme and
|
||||
solver settings will also be needed. Alternatively, if there is another
|
||||
field which already has appropriate fvSchemes and fvSolution entries, these
|
||||
settings can be reused by naming the field as the schemesField.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#includeEtc "caseDicts/postProcessing/solvers/phaseScalarTransport/phaseScalarTransport.cfg"
|
||||
|
||||
field s.water;
|
||||
schemesField s.water;
|
||||
p p_rgh;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,12 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
type phaseScalarTransport;
|
||||
libs ("libsolverFunctionObjects.so");
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -14,8 +14,7 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
type scalarTransport;
|
||||
libs ("libsolverFunctionObjects.so");
|
||||
#includeEtc "caseDicts/postProcessing/solvers/scalarTransport/scalarTransport.cfg"
|
||||
|
||||
field s;
|
||||
schemesField s;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -37,7 +37,7 @@ namespace Foam
|
||||
|
||||
Foam::pimpleControl::pimpleControl(fvMesh& mesh, const word& algorithmName)
|
||||
:
|
||||
pimpleNoLoopControl(mesh, algorithmName),
|
||||
pimpleNoLoopControl(mesh, algorithmName, *this),
|
||||
pimpleLoop(static_cast<solutionControl&>(*this))
|
||||
{
|
||||
read();
|
||||
@ -91,17 +91,14 @@ bool Foam::pimpleControl::loop()
|
||||
|
||||
if (!pimpleLoop::loop(*this))
|
||||
{
|
||||
mesh().data::remove("finalIteration");
|
||||
updateFinal();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
storePrevIterFields();
|
||||
|
||||
if (finalIter())
|
||||
{
|
||||
mesh().data::add("finalIteration", true);
|
||||
}
|
||||
updateFinal();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,7 +27,7 @@ License
|
||||
|
||||
inline bool Foam::pimpleControl::turbCorr() const
|
||||
{
|
||||
return !turbOnFinalIterOnly() || finalIter();
|
||||
return !turbOnFinalIterOnly() || finalPimpleIter();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -67,15 +67,13 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence)
|
||||
{
|
||||
read();
|
||||
|
||||
++ corrPimple_;
|
||||
|
||||
// Handle quit conditions first
|
||||
{
|
||||
// If converged on the last iteration then end the correction loop
|
||||
if (converged_)
|
||||
{
|
||||
Info<< control_.algorithmName() << ": Converged in "
|
||||
<< corrPimple_ - 1 << " iterations" << endl;
|
||||
Info<< control_.algorithmName() << ": Converged in " << corrPimple_
|
||||
<< " iterations" << endl;
|
||||
|
||||
corrPimple_ = 0;
|
||||
converged_ = false;
|
||||
@ -84,7 +82,7 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence)
|
||||
}
|
||||
|
||||
// If all corrections have been completed then end the correction loop
|
||||
if (corrPimple_ > nCorrPimple_)
|
||||
if (corrPimple_ >= nCorrPimple_)
|
||||
{
|
||||
if (convergence.hasCorrResidualControls() && nCorrPimple_ > 1)
|
||||
{
|
||||
@ -100,6 +98,9 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence)
|
||||
}
|
||||
|
||||
// If we reached here, we are doing another loop
|
||||
++ corrPimple_;
|
||||
|
||||
// Set up the next loop
|
||||
{
|
||||
// If convergence has been reached then set the flag so that the loop
|
||||
// exits next time around
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -99,18 +99,15 @@ public:
|
||||
//- Maximum number of pimple correctors
|
||||
inline label nCorrPimple() const;
|
||||
|
||||
//- Flat to indicate any pimple iteration
|
||||
inline bool anyPimpleIter() const;
|
||||
|
||||
//- Flag to indicate the first pimple iteration
|
||||
inline bool firstPimpleIter() const;
|
||||
|
||||
//- Flag to indicate the last pimple iteration
|
||||
inline bool finalPimpleIter() const;
|
||||
|
||||
//- Flag to indicate the first iteration
|
||||
inline bool firstIter() const;
|
||||
|
||||
//- Flag to indicate the last iteration
|
||||
inline bool finalIter() const;
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,6 +31,12 @@ inline Foam::label Foam::pimpleLoop::nCorrPimple() const
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::pimpleLoop::anyPimpleIter() const
|
||||
{
|
||||
return corrPimple_ != 0;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::pimpleLoop::firstPimpleIter() const
|
||||
{
|
||||
return corrPimple_ == 1;
|
||||
@ -39,19 +45,7 @@ inline bool Foam::pimpleLoop::firstPimpleIter() const
|
||||
|
||||
inline bool Foam::pimpleLoop::finalPimpleIter() const
|
||||
{
|
||||
return corrPimple_ >= nCorrPimple_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::pimpleLoop::firstIter() const
|
||||
{
|
||||
return firstPimpleIter();
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::pimpleLoop::finalIter() const
|
||||
{
|
||||
return converged_ || finalPimpleIter();
|
||||
return converged_ || corrPimple_ >= nCorrPimple_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -84,7 +84,7 @@ Foam::pimpleMultiRegionControl::pimpleMultiRegionControl
|
||||
{
|
||||
pimpleControls_.append
|
||||
(
|
||||
new pimpleNoLoopControl(pimpleMeshes[i], algorithmName)
|
||||
new pimpleNoLoopControl(pimpleMeshes[i], algorithmName, *this)
|
||||
);
|
||||
|
||||
allSteady = allSteady && pimpleMeshes[i].steady();
|
||||
@ -95,7 +95,7 @@ Foam::pimpleMultiRegionControl::pimpleMultiRegionControl
|
||||
{
|
||||
solidControls_.append
|
||||
(
|
||||
new solidNoLoopControl(solidMeshes[i], algorithmName)
|
||||
new solidNoLoopControl(solidMeshes[i], algorithmName, *this)
|
||||
);
|
||||
|
||||
allSteady = allSteady && solidMeshes[i].steady();
|
||||
@ -278,11 +278,11 @@ bool Foam::pimpleMultiRegionControl::loop()
|
||||
{
|
||||
forAll(pimpleControls_, i)
|
||||
{
|
||||
pimpleControls_[i].mesh().data::remove("finalIteration");
|
||||
pimpleControls_[i].updateFinal();
|
||||
}
|
||||
forAll(solidControls_, i)
|
||||
{
|
||||
solidControls_[i].mesh().data::remove("finalIteration");
|
||||
solidControls_[i].updateFinal();
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -297,16 +297,13 @@ bool Foam::pimpleMultiRegionControl::loop()
|
||||
solidControls_[i].storePrevIterFields();
|
||||
}
|
||||
|
||||
if (finalIter())
|
||||
forAll(pimpleControls_, i)
|
||||
{
|
||||
forAll(pimpleControls_, i)
|
||||
{
|
||||
pimpleControls_[i].mesh().data::add("finalIteration", true);
|
||||
}
|
||||
forAll(solidControls_, i)
|
||||
{
|
||||
solidControls_[i].mesh().data::add("finalIteration", true);
|
||||
}
|
||||
pimpleControls_[i].updateFinal();
|
||||
}
|
||||
forAll(solidControls_, i)
|
||||
{
|
||||
solidControls_[i].updateFinal();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,7 +41,7 @@ Foam::pimpleMultiRegionControl::solid(const label i)
|
||||
|
||||
inline bool Foam::pimpleMultiRegionControl::pimpleTurbCorr(const label i) const
|
||||
{
|
||||
return !pimpleControls_[i].turbOnFinalIterOnly() || finalIter();
|
||||
return !pimpleControls_[i].turbOnFinalIterOnly() || finalPimpleIter();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,7 +38,8 @@ namespace Foam
|
||||
Foam::pimpleNoLoopControl::pimpleNoLoopControl
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const word& algorithmName
|
||||
const word& algorithmName,
|
||||
const pimpleLoop& loop
|
||||
)
|
||||
:
|
||||
pisoControl(mesh, algorithmName),
|
||||
@ -51,6 +52,7 @@ Foam::pimpleNoLoopControl::pimpleNoLoopControl
|
||||
static_cast<singleRegionSolutionControl&>(*this),
|
||||
"outerCorrector"
|
||||
),
|
||||
loop_(loop),
|
||||
simpleRho_(false),
|
||||
turbOnFinalIterOnly_(true)
|
||||
{
|
||||
@ -90,4 +92,12 @@ bool Foam::pimpleNoLoopControl::read()
|
||||
}
|
||||
|
||||
|
||||
bool Foam::pimpleNoLoopControl::isFinal() const
|
||||
{
|
||||
return
|
||||
(!anyPisoIter() && loop_.finalPimpleIter())
|
||||
|| pisoControl::isFinal();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
#ifndef pimpleNoLoopControl_H
|
||||
#define pimpleNoLoopControl_H
|
||||
|
||||
#include "pimpleLoop.H"
|
||||
#include "pisoControl.H"
|
||||
#include "singleRegionConvergenceControl.H"
|
||||
#include "singleRegionCorrectorConvergenceControl.H"
|
||||
@ -64,6 +65,9 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- The pimple loop
|
||||
const pimpleLoop& loop_;
|
||||
|
||||
//- Flag to indicate whether to update the density in SIMPLE mode rather
|
||||
// than PISO mode
|
||||
bool simpleRho_;
|
||||
@ -83,8 +87,14 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from a mesh and the name of the algorithm
|
||||
pimpleNoLoopControl(fvMesh& mesh, const word& algorithmName);
|
||||
//- Construct from a mesh, the name of the algorithm, and a reference
|
||||
// to the pimple loop
|
||||
pimpleNoLoopControl
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const word& algorithmName,
|
||||
const pimpleLoop& loop
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -100,6 +110,9 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Flag to indicate whether in final state
|
||||
virtual bool isFinal() const;
|
||||
|
||||
//- Flag to indicate whether to update the density in simple mode
|
||||
inline bool simpleRho() const;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,8 +38,8 @@ namespace Foam
|
||||
Foam::pisoControl::pisoControl(fvMesh& mesh, const word& algorithmName)
|
||||
:
|
||||
fluidSolutionControl(mesh, algorithmName),
|
||||
nCorrPISO_(-1),
|
||||
corrPISO_(0)
|
||||
nCorrPiso_(-1),
|
||||
corrPiso_(0)
|
||||
{
|
||||
read();
|
||||
}
|
||||
@ -62,57 +62,37 @@ bool Foam::pisoControl::read()
|
||||
|
||||
const dictionary& solutionDict = dict();
|
||||
|
||||
nCorrPISO_ = solutionDict.lookupOrDefault<label>("nCorrectors", 1);
|
||||
nCorrPiso_ = solutionDict.lookupOrDefault<label>("nCorrectors", 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::pisoControl::nonOrthSubLoop() const
|
||||
bool Foam::pisoControl::isFinal() const
|
||||
{
|
||||
return true;
|
||||
return
|
||||
(!anyNonOrthogonalIter() && finalPisoIter())
|
||||
|| (finalNonOrthogonalIter() && finalPisoIter())
|
||||
|| (finalNonOrthogonalIter() && !anyPisoIter());
|
||||
}
|
||||
|
||||
|
||||
bool Foam::pisoControl::correct()
|
||||
{
|
||||
static bool finalIteration = false;
|
||||
|
||||
read();
|
||||
|
||||
if (corrPISO_ == 0)
|
||||
if (finalPisoIter())
|
||||
{
|
||||
finalIteration =
|
||||
mesh().data::lookupOrDefault<bool>("finalIteration", false);
|
||||
corrPiso_ = 0;
|
||||
|
||||
if (finalIteration)
|
||||
{
|
||||
mesh().data::remove("finalIteration");
|
||||
}
|
||||
}
|
||||
|
||||
if (finalPISOIter())
|
||||
{
|
||||
corrPISO_ = 0;
|
||||
|
||||
if
|
||||
(
|
||||
!finalIteration
|
||||
&& mesh().data::lookupOrDefault<bool>("finalIteration", false)
|
||||
)
|
||||
{
|
||||
mesh().data::remove("finalIteration");
|
||||
}
|
||||
updateFinal();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
corrPISO_++;
|
||||
++ corrPiso_;
|
||||
|
||||
if (finalPISOIter())
|
||||
{
|
||||
mesh().data::add("finalIteration", true);
|
||||
}
|
||||
updateFinal();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::pisoControl
|
||||
|
||||
Description
|
||||
PISO control class. Provides time-loop and PISO-loop control methods. No
|
||||
Piso control class. Provides time-loop and piso-loop control methods. No
|
||||
convergence checking is done.
|
||||
|
||||
SourceFiles
|
||||
@ -58,11 +58,11 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Maximum number of PISO correctors
|
||||
label nCorrPISO_;
|
||||
//- Maximum number of piso correctors
|
||||
label nCorrPiso_;
|
||||
|
||||
//- Current PISO corrector
|
||||
label corrPISO_;
|
||||
//- Current piso corrector
|
||||
label corrPiso_;
|
||||
|
||||
|
||||
public:
|
||||
@ -93,26 +93,29 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Maximum number of PISO correctors
|
||||
inline label nCorrPISO() const;
|
||||
//- Maximum number of piso correctors
|
||||
inline label nCorrPiso() const;
|
||||
|
||||
//- Flag to indicate the first PISO iteration
|
||||
inline bool firstPISOIter() const;
|
||||
//- Flat to indicate any piso iteration
|
||||
inline bool anyPisoIter() const;
|
||||
|
||||
//- Flag to indicate the last PISO iteration
|
||||
inline bool finalPISOIter() const;
|
||||
//- Flag to indicate the first piso iteration
|
||||
inline bool firstPisoIter() const;
|
||||
|
||||
//- Flag to indicate the last inner iteration (last PISO and last
|
||||
//- Flag to indicate the last piso iteration
|
||||
inline bool finalPisoIter() const;
|
||||
|
||||
//- Flag to indicate the last inner iteration (last piso and last
|
||||
// non-orthogonal)
|
||||
inline bool finalInnerIter() const;
|
||||
|
||||
//- Return true as the non-orthogonality loop is subsidiary
|
||||
virtual bool nonOrthSubLoop() const;
|
||||
//- Flag to indicate whether in final state
|
||||
virtual bool isFinal() const;
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- PISO loop
|
||||
//- Piso loop
|
||||
bool correct();
|
||||
|
||||
//- Time run loop
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,27 +25,33 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::label Foam::pisoControl::nCorrPISO() const
|
||||
inline Foam::label Foam::pisoControl::nCorrPiso() const
|
||||
{
|
||||
return nCorrPISO_;
|
||||
return nCorrPiso_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::pisoControl::firstPISOIter() const
|
||||
inline bool Foam::pisoControl::anyPisoIter() const
|
||||
{
|
||||
return corrPISO_ == 1;
|
||||
return corrPiso_ != 0;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::pisoControl::finalPISOIter() const
|
||||
inline bool Foam::pisoControl::firstPisoIter() const
|
||||
{
|
||||
return corrPISO_ >= nCorrPISO_;
|
||||
return corrPiso_ == 1;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::pisoControl::finalPisoIter() const
|
||||
{
|
||||
return corrPiso_ >= nCorrPiso_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::pisoControl::finalInnerIter() const
|
||||
{
|
||||
return finalNonOrthogonalIter() && finalPISOIter();
|
||||
return finalNonOrthogonalIter() && finalPisoIter();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -62,12 +62,6 @@ bool Foam::simpleControl::read()
|
||||
}
|
||||
|
||||
|
||||
bool Foam::simpleControl::nonOrthSubLoop() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::simpleControl::run(Time& time)
|
||||
{
|
||||
read();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -92,12 +92,6 @@ public:
|
||||
virtual bool read();
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Return true as the non-orthogonality loop is subsidiary
|
||||
virtual bool nonOrthSubLoop() const;
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Time run loop
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,7 +38,8 @@ namespace Foam
|
||||
Foam::solidNoLoopControl::solidNoLoopControl
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const word& algorithmName
|
||||
const word& algorithmName,
|
||||
const pimpleLoop& loop
|
||||
)
|
||||
:
|
||||
nonOrthogonalSolutionControl(mesh, algorithmName),
|
||||
@ -50,7 +51,8 @@ Foam::solidNoLoopControl::solidNoLoopControl
|
||||
(
|
||||
static_cast<singleRegionSolutionControl&>(*this),
|
||||
"outerCorrector"
|
||||
)
|
||||
),
|
||||
loop_(loop)
|
||||
{
|
||||
read();
|
||||
}
|
||||
@ -73,4 +75,10 @@ bool Foam::solidNoLoopControl::read()
|
||||
}
|
||||
|
||||
|
||||
bool Foam::solidNoLoopControl::isFinal() const
|
||||
{
|
||||
return loop_.finalPimpleIter() && finalNonOrthogonalIter();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
#define solidNoLoopControl_H
|
||||
|
||||
#include "nonOrthogonalSolutionControl.H"
|
||||
#include "pimpleLoop.H"
|
||||
#include "singleRegionConvergenceControl.H"
|
||||
#include "singleRegionCorrectorConvergenceControl.H"
|
||||
|
||||
@ -56,6 +57,14 @@ class solidNoLoopControl
|
||||
public singleRegionConvergenceControl,
|
||||
public singleRegionCorrectorConvergenceControl
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- The pimple loop
|
||||
const pimpleLoop& loop_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static data members
|
||||
@ -66,8 +75,14 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from a mesh and the name of the algorithm
|
||||
solidNoLoopControl(fvMesh& mesh, const word& algorithmName);
|
||||
//- Construct from a mesh, the name of the algorithm, and a reference
|
||||
// to the pimple loop
|
||||
solidNoLoopControl
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const word& algorithmName,
|
||||
const pimpleLoop& loop
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -80,6 +95,11 @@ public:
|
||||
|
||||
//- Read controls
|
||||
virtual bool read();
|
||||
|
||||
// Access
|
||||
|
||||
//- Flag to indicate whether in final state
|
||||
virtual bool isFinal() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,8 +42,8 @@ Foam::nonOrthogonalSolutionControl::nonOrthogonalSolutionControl
|
||||
)
|
||||
:
|
||||
singleRegionSolutionControl(mesh, algorithmName),
|
||||
nNonOrthCorr_(-1),
|
||||
nonOrthCorr_(0)
|
||||
nCorrNonOrth_(-1),
|
||||
corrNonOrth_(0)
|
||||
{
|
||||
read();
|
||||
}
|
||||
@ -66,58 +66,29 @@ bool Foam::nonOrthogonalSolutionControl::read()
|
||||
|
||||
const dictionary& solutionDict = dict();
|
||||
|
||||
nNonOrthCorr_ =
|
||||
nCorrNonOrth_ =
|
||||
solutionDict.lookupOrDefault<label>("nNonOrthogonalCorrectors", 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::nonOrthogonalSolutionControl::nonOrthSubLoop() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::nonOrthogonalSolutionControl::correctNonOrthogonal()
|
||||
{
|
||||
static bool finalIteration = false;
|
||||
|
||||
read();
|
||||
|
||||
if (nonOrthCorr_ == 0)
|
||||
{
|
||||
finalIteration =
|
||||
mesh().data::lookupOrDefault<bool>("finalIteration", false);
|
||||
|
||||
if (finalIteration)
|
||||
{
|
||||
mesh().data::remove("finalIteration");
|
||||
}
|
||||
}
|
||||
|
||||
if (finalNonOrthogonalIter())
|
||||
{
|
||||
nonOrthCorr_ = 0;
|
||||
corrNonOrth_ = 0;
|
||||
|
||||
if
|
||||
(
|
||||
!finalIteration
|
||||
&& mesh().data::lookupOrDefault<bool>("finalIteration", false)
|
||||
)
|
||||
{
|
||||
mesh().data::remove("finalIteration");
|
||||
}
|
||||
updateFinal();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
nonOrthCorr_++;
|
||||
++ corrNonOrth_;
|
||||
|
||||
if (finalNonOrthogonalIter() && (finalIteration || !nonOrthSubLoop()))
|
||||
{
|
||||
mesh().data::add("finalIteration", true);
|
||||
}
|
||||
updateFinal();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,10 +57,10 @@ protected:
|
||||
// Protected data
|
||||
|
||||
//- Maximum number of non-orthogonal correctors
|
||||
label nNonOrthCorr_;
|
||||
label nCorrNonOrth_;
|
||||
|
||||
//- Current non-orthogonal corrector index
|
||||
label nonOrthCorr_;
|
||||
label corrNonOrth_;
|
||||
|
||||
|
||||
public:
|
||||
@ -92,7 +92,10 @@ public:
|
||||
// Access
|
||||
|
||||
//- Maximum number of non-orthogonal correctors
|
||||
inline label nNonOrthCorr() const;
|
||||
inline label nCorrNonOrth() const;
|
||||
|
||||
//- Flat to indicate any non-orthogonal iteration
|
||||
inline bool anyNonOrthogonalIter() const;
|
||||
|
||||
//- Flag to indicate the first non-orthogonal iteration
|
||||
inline bool firstNonOrthogonalIter() const;
|
||||
@ -103,10 +106,6 @@ public:
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Return true if the non-orthogonality loop is a subsidiary
|
||||
// i.e. a sub-loop of the PISO or PIMPLE algorithms
|
||||
virtual bool nonOrthSubLoop() const;
|
||||
|
||||
//- Non-orthogonal corrector loop
|
||||
bool correctNonOrthogonal();
|
||||
};
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,21 +25,27 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::label Foam::nonOrthogonalSolutionControl::nNonOrthCorr() const
|
||||
inline Foam::label Foam::nonOrthogonalSolutionControl::nCorrNonOrth() const
|
||||
{
|
||||
return nNonOrthCorr_;
|
||||
return nCorrNonOrth_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::nonOrthogonalSolutionControl::anyNonOrthogonalIter() const
|
||||
{
|
||||
return corrNonOrth_ != 0;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::nonOrthogonalSolutionControl::firstNonOrthogonalIter() const
|
||||
{
|
||||
return nonOrthCorr_ == 1;
|
||||
return corrNonOrth_ == 1;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::nonOrthogonalSolutionControl::finalNonOrthogonalIter() const
|
||||
{
|
||||
return nonOrthCorr_ > nNonOrthCorr_;
|
||||
return corrNonOrth_ > nCorrNonOrth_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -61,6 +61,23 @@ const Foam::dictionary& Foam::singleRegionSolutionControl::dict() const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::singleRegionSolutionControl::isFinal() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::singleRegionSolutionControl::updateFinal() const
|
||||
{
|
||||
mesh_.data::remove("finalIteration");
|
||||
|
||||
if (isFinal())
|
||||
{
|
||||
mesh_.data::add("finalIteration", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::singleRegionSolutionControl::storePrevIterFields()
|
||||
{
|
||||
storePrevIterTypeFields<scalar>();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -99,8 +99,15 @@ public:
|
||||
//- Return the solution dictionary
|
||||
virtual const dictionary& dict() const;
|
||||
|
||||
//- Flag to indicate whether in final state
|
||||
virtual bool isFinal() const;
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Update the mesh data for the final state
|
||||
void updateFinal() const;
|
||||
|
||||
//- Store previous iteration for fields
|
||||
void storePrevIterFields();
|
||||
};
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
scalarTransport/scalarTransport.C
|
||||
phaseScalarTransport/phaseScalarTransport.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libsolverFunctionObjects
|
||||
|
||||
@ -0,0 +1,496 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fixedValueFvPatchField.H"
|
||||
#include "fvcDdt.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "fvmDdt.H"
|
||||
#include "fvmDiv.H"
|
||||
#include "fvmLaplacian.H"
|
||||
#include "nonOrthogonalSolutionControl.H"
|
||||
#include "phaseScalarTransport.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "wallFvPatch.H"
|
||||
#include "zeroGradientFvPatchField.H"
|
||||
|
||||
#define PhiDimensionErrorInFunction(phi) \
|
||||
FatalErrorInFunction \
|
||||
<< "Incompatible dimensions for " << phi.name() << ": " \
|
||||
<< phi.dimensions() << nl \
|
||||
<< "Dimensions should be " << dimMass/dimTime << " or " \
|
||||
<< dimVolume/dimTime << exit(FatalError)
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(phaseScalarTransport, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
phaseScalarTransport,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::volScalarField& Foam::functionObjects::phaseScalarTransport::Phi()
|
||||
{
|
||||
if (!PhiPtr_.valid())
|
||||
{
|
||||
const surfaceScalarField& phi =
|
||||
mesh_.lookupObject<surfaceScalarField>(phiName_);
|
||||
const volScalarField& p =
|
||||
mesh_.lookupObject<volScalarField>(pName_);
|
||||
|
||||
wordList PhiPatchFieldTypes(mesh_.boundaryMesh().size());
|
||||
forAll(p.boundaryField(), patchi)
|
||||
{
|
||||
PhiPatchFieldTypes[patchi] =
|
||||
p.boundaryField()[patchi].fixesValue()
|
||||
? fixedValueFvPatchField<scalar>::typeName
|
||||
: zeroGradientFvPatchField<scalar>::typeName;
|
||||
}
|
||||
|
||||
PhiPtr_.set
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Phi" + s_.name(),
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(phi.dimensions()/dimLength, Zero),
|
||||
PhiPatchFieldTypes
|
||||
)
|
||||
);
|
||||
|
||||
mesh_.setFluxRequired(PhiPtr_->name());
|
||||
}
|
||||
|
||||
return PhiPtr_();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::functionObjects::phaseScalarTransport::alphaPhi()
|
||||
{
|
||||
// If alphaPhi exists then return it
|
||||
if (mesh_.foundObject<surfaceScalarField>(alphaPhiName_))
|
||||
{
|
||||
return mesh_.lookupObject<surfaceScalarField>(alphaPhiName_);
|
||||
}
|
||||
|
||||
// Otherwise generate it ...
|
||||
Info<< type() << ": " << surfaceScalarField::typeName << " "
|
||||
<< alphaPhiName_ << " was not found, so generating it" << endl;
|
||||
|
||||
const volScalarField& alpha =
|
||||
mesh_.lookupObject<volScalarField>(alphaName_);
|
||||
const surfaceScalarField& phi =
|
||||
mesh_.lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
// Make a crude guess of the phase flux using default interpolation
|
||||
tmp<surfaceScalarField> tAlphaPhi
|
||||
(
|
||||
new surfaceScalarField
|
||||
(
|
||||
alphaPhiName_,
|
||||
phi*fvc::interpolate(alpha)
|
||||
)
|
||||
);
|
||||
surfaceScalarField& alphaPhi = tAlphaPhi.ref();
|
||||
|
||||
// Get the potential field
|
||||
volScalarField& Phi(this->Phi());
|
||||
|
||||
// Construct the scheme names
|
||||
const word laplacianScheme = "laplacian(" + pName_ + ")";
|
||||
|
||||
// Debug writing. Write the material derivative of alpha, before and after
|
||||
// the solution of the potential and the correction of alphaPhi. Before
|
||||
// correction the field should be non-zero, and after it should be
|
||||
// comparable to the solution tolerance.
|
||||
auto writeDDt = [&](const label i)
|
||||
{
|
||||
const volScalarField DDtAlpha
|
||||
(
|
||||
"DDt("
|
||||
+ IOobject::groupName
|
||||
(
|
||||
IOobject::member(alpha.name()) + Foam::name(i),
|
||||
IOobject::group(alpha.name())
|
||||
)
|
||||
+ ")",
|
||||
fvc::ddt(alpha) + fvc::div(alphaPhi)
|
||||
);
|
||||
Info<< type() << ": Writing " << DDtAlpha.name() << endl;
|
||||
DDtAlpha.write();
|
||||
};
|
||||
if (debug && mesh_.time().writeTime())
|
||||
{
|
||||
writeDDt(0);
|
||||
}
|
||||
|
||||
// Lookup the non-orthogonal solution control
|
||||
nonOrthogonalSolutionControl& control =
|
||||
mesh_.lookupObjectRef<nonOrthogonalSolutionControl>
|
||||
(
|
||||
solutionControl::typeName
|
||||
);
|
||||
|
||||
// Solve for the potential and correct alphaPhi with the resulting flux
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
while (control.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix PhiEqn
|
||||
(
|
||||
fvm::laplacian(Phi, laplacianScheme)
|
||||
+ fvc::ddt(alpha)
|
||||
+ fvc::div(alphaPhi)
|
||||
);
|
||||
|
||||
PhiEqn.solve(pName_);
|
||||
|
||||
if (control.finalNonOrthogonalIter())
|
||||
{
|
||||
alphaPhi += PhiEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const volScalarField& rho =
|
||||
mesh_.lookupObject<volScalarField>(rhoName_);
|
||||
|
||||
while (control.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix PhiEqn
|
||||
(
|
||||
fvm::laplacian(Phi, laplacianScheme)
|
||||
+ fvc::ddt(rho, alpha)
|
||||
+ fvc::div(alphaPhi)
|
||||
);
|
||||
|
||||
PhiEqn.solve(pName_);
|
||||
|
||||
if (control.finalNonOrthogonalIter())
|
||||
{
|
||||
alphaPhi += PhiEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PhiDimensionErrorInFunction(phi);
|
||||
}
|
||||
|
||||
// Debug writing
|
||||
if (debug && mesh_.time().writeTime())
|
||||
{
|
||||
writeDDt(1);
|
||||
}
|
||||
|
||||
return tAlphaPhi;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::functionObjects::phaseScalarTransport::D
|
||||
(
|
||||
const surfaceScalarField& alphaPhi
|
||||
) const
|
||||
{
|
||||
if (constantD_)
|
||||
{
|
||||
return volScalarField::New
|
||||
(
|
||||
"D" + s_.name(),
|
||||
mesh_,
|
||||
dimensionedScalar(alphaPhi.dimensions()/dimLength, D_)
|
||||
);
|
||||
}
|
||||
|
||||
const word& nameNoPhase = turbulenceModel::propertiesName;
|
||||
const word namePhase = IOobject::groupName(nameNoPhase, phaseName_);
|
||||
|
||||
const word& name =
|
||||
mesh_.foundObject<turbulenceModel>(namePhase)
|
||||
? namePhase
|
||||
: mesh_.foundObject<turbulenceModel>(nameNoPhase)
|
||||
? nameNoPhase
|
||||
: word::null;
|
||||
|
||||
if (name == word::null)
|
||||
{
|
||||
return volScalarField::New
|
||||
(
|
||||
"D" + s_.name(),
|
||||
mesh_,
|
||||
dimensionedScalar(alphaPhi.dimensions()/dimLength, 0)
|
||||
);
|
||||
}
|
||||
|
||||
const turbulenceModel& turbulence =
|
||||
mesh_.lookupObject<turbulenceModel>(name);
|
||||
|
||||
if (alphaPhi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
return alphaD_*turbulence.nu() + alphaDt_*turbulence.nut();
|
||||
}
|
||||
else if (alphaPhi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
return alphaD_*turbulence.mu() + alphaDt_*turbulence.mut();
|
||||
}
|
||||
else
|
||||
{
|
||||
PhiDimensionErrorInFunction(alphaPhi);
|
||||
return tmp<volScalarField>(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::phaseScalarTransport::phaseScalarTransport
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
fieldName_(dict.lookup("field")),
|
||||
phaseName_(IOobject::group(fieldName_)),
|
||||
nCorr_(0),
|
||||
residualAlpha_(rootSmall),
|
||||
fvOptions_(mesh_),
|
||||
s_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName_,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_
|
||||
),
|
||||
alphaS_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alpha"
|
||||
+ word(toupper(fieldName_[0]))
|
||||
+ fieldName_(1, fieldName_.size() - 1),
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(s_.dimensions(), Zero)
|
||||
),
|
||||
PhiPtr_(nullptr)
|
||||
{
|
||||
if (phaseName_ == word::null)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Field \"" << fieldName_ << "\" does not have a phase extension "
|
||||
<< "in its name. If it is associated with \"phaseA\" then it "
|
||||
<< "should be named \"" << fieldName_ << ".phaseA\"."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::phaseScalarTransport::~phaseScalarTransport()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::phaseScalarTransport::read(const dictionary& dict)
|
||||
{
|
||||
fvMeshFunctionObject::read(dict);
|
||||
|
||||
alphaName_ =
|
||||
dict.lookupOrDefault<word>
|
||||
(
|
||||
"alpha",
|
||||
IOobject::groupName("alpha", phaseName_)
|
||||
);
|
||||
alphaPhiName_ =
|
||||
dict.lookupOrDefault<word>
|
||||
(
|
||||
"alphaPhi",
|
||||
IOobject::groupName("alphaPhi", phaseName_)
|
||||
);
|
||||
phiName_ = dict.lookupOrDefault<word>("phi", "phi");
|
||||
rhoName_ =
|
||||
dict.lookupOrDefault<word>
|
||||
(
|
||||
"rho",
|
||||
IOobject::groupName("rho", phaseName_)
|
||||
);
|
||||
pName_ = dict.lookupOrDefault<word>("p", "p");
|
||||
schemesField_ = dict.lookupOrDefault<word>("schemesField", fieldName_);
|
||||
|
||||
constantD_ = dict.readIfPresent("D", D_);
|
||||
alphaD_ = dict.lookupOrDefault<scalar>("alphaD", 1);
|
||||
alphaDt_ = dict.lookupOrDefault<scalar>("alphaDt", 1);
|
||||
|
||||
dict.readIfPresent("nCorr", nCorr_);
|
||||
dict.readIfPresent("residualAlpha", residualAlpha_);
|
||||
|
||||
if (dict.found("fvOptions"))
|
||||
{
|
||||
fvOptions_.reset(dict.subDict("fvOptions"));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::phaseScalarTransport::execute()
|
||||
{
|
||||
Info<< type() << ": Executing" << endl;
|
||||
|
||||
const volScalarField& alpha =
|
||||
mesh_.lookupObject<volScalarField>(alphaName_);
|
||||
|
||||
// Get the phase flux
|
||||
tmp<surfaceScalarField> tAlphaPhi(this->alphaPhi());
|
||||
const surfaceScalarField& alphaPhi = tAlphaPhi();
|
||||
|
||||
// Get the diffusivity
|
||||
const volScalarField D(this->D(alphaPhi));
|
||||
|
||||
// Construct the scheme names
|
||||
const word divScheme =
|
||||
"div(" + alphaPhi.name() + "," + schemesField_ + ")";
|
||||
const word laplacianScheme =
|
||||
"laplacian(" + D.name() + "," + schemesField_ + ")";
|
||||
|
||||
// Get the relaxation coefficient
|
||||
const scalar relaxCoeff =
|
||||
mesh_.relaxEquation(schemesField_)
|
||||
? mesh_.equationRelaxationFactor(schemesField_)
|
||||
: 0;
|
||||
|
||||
// Solve
|
||||
if (alphaPhi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
for (label i = 0; i <= nCorr_; ++ i)
|
||||
{
|
||||
fvScalarMatrix fieldEqn
|
||||
(
|
||||
fvm::ddt(alpha, s_)
|
||||
+ fvm::div(alphaPhi, s_, divScheme)
|
||||
- fvm::laplacian
|
||||
(
|
||||
fvc::interpolate(alpha)*fvc::interpolate(D),
|
||||
s_,
|
||||
laplacianScheme
|
||||
)
|
||||
==
|
||||
fvOptions_(alpha, s_)
|
||||
- fvm::ddt(residualAlpha_, s_)
|
||||
+ fvc::ddt(residualAlpha_, s_)
|
||||
);
|
||||
|
||||
fieldEqn.relax(relaxCoeff);
|
||||
fvOptions_.constrain(fieldEqn);
|
||||
fieldEqn.solve(schemesField_);
|
||||
}
|
||||
}
|
||||
else if (alphaPhi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const volScalarField& rho =
|
||||
mesh_.lookupObject<volScalarField>(rhoName_);
|
||||
|
||||
for (label i = 0; i <= nCorr_; ++ i)
|
||||
{
|
||||
fvScalarMatrix fieldEqn
|
||||
(
|
||||
fvm::ddt(alpha, rho, s_)
|
||||
+ fvm::div(alphaPhi, s_, divScheme)
|
||||
- fvm::laplacian
|
||||
(
|
||||
fvc::interpolate(alpha)*fvc::interpolate(D),
|
||||
s_,
|
||||
laplacianScheme
|
||||
)
|
||||
==
|
||||
fvOptions_(rho, s_)
|
||||
- fvm::ddt(residualAlpha_*rho, s_)
|
||||
+ fvc::ddt(residualAlpha_*rho, s_)
|
||||
);
|
||||
|
||||
fieldEqn.relax(relaxCoeff);
|
||||
fvOptions_.constrain(fieldEqn);
|
||||
fieldEqn.solve(schemesField_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PhiDimensionErrorInFunction(alphaPhi);
|
||||
}
|
||||
|
||||
// Update
|
||||
alphaS_ = alpha*s_;
|
||||
|
||||
Info<< endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::phaseScalarTransport::write()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,233 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjects::phaseScalarTransport
|
||||
|
||||
Description
|
||||
Evolves a passive scalar transport equation within one phase of a
|
||||
multiphase simulation. The scalar is considered to be a phase-intensive
|
||||
property; i.e., its value represents an amount per-unit of the phase. In
|
||||
addition to the scalar, the function also writes out the product of the
|
||||
volume fraction and the scalar, as this provides a phase-extensive field
|
||||
which is often more convenient to post-process.
|
||||
|
||||
Most entries are the same as for the \c scalarTransport function. Refer to
|
||||
its documentation for details. Entries specific to this function are
|
||||
detailed below. Note that the phase-name will be determined by stripping
|
||||
the extension from the supplied field name.
|
||||
|
||||
If \c alphaPhi is specified and found in the database then it will be used
|
||||
to transport the field. This is the likely mode of operation if this
|
||||
function is used with Euler-Euler solvers, in which \c alphaPhi -like
|
||||
fluxes are available. If \c alphaPhi is not found, then a pressure-like
|
||||
equation will be solved in order to construct it so that it exactly matches
|
||||
the time-derivative of the phase volume or mass. This is likely to be
|
||||
necessary in volume-of-fluid solvers where \c alphaPhi is not part of the
|
||||
solution procedure. The pressure field name will be required in this case.
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Req'd? | Default
|
||||
alpha | Name of the volume-fraction field | no \\
|
||||
| alpha.<phase-name>
|
||||
alphaPhi | Name of the phase-flux field | no \\
|
||||
| alphaPhi.<phase-name>
|
||||
p | Name of the pressure field | no | p
|
||||
residualAlpha | Small volume fraction used to stabilise the solution \\
|
||||
| no | rootSmall
|
||||
\endtable
|
||||
|
||||
Example specification for interFoam:
|
||||
\verbatim
|
||||
phaseScalarTransport1
|
||||
{
|
||||
type phaseScalarTransport;
|
||||
libs ("libsolverFunctionObjects.so");
|
||||
|
||||
field s.water;
|
||||
p p_rgh;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Example specification for reactingTwoPhaseEulerFoam:
|
||||
\verbatim
|
||||
phaseScalarTransport1
|
||||
{
|
||||
type phaseScalarTransport;
|
||||
libs ("libsolverFunctionObjects.so");
|
||||
|
||||
field s.water;
|
||||
alphaPhi alphaRhoPhi.water;
|
||||
rho thermo:rho.water;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
Foam::functionObjects::scalarTransport
|
||||
|
||||
SourceFiles
|
||||
phaseScalarTransport.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjects_phaseScalarTransport_H
|
||||
#define functionObjects_phaseScalarTransport_H
|
||||
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "volFields.H"
|
||||
#include "fvOptionList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class phaseScalarTransport Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class phaseScalarTransport
|
||||
:
|
||||
public fvMeshFunctionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of field to process
|
||||
const word fieldName_;
|
||||
|
||||
//- Name of the phase in which to solve
|
||||
const word phaseName_;
|
||||
|
||||
//- Name of phase volume-fraction field (optional)
|
||||
word alphaName_;
|
||||
|
||||
//- Name of the phase flux field (optional)
|
||||
word alphaPhiName_;
|
||||
|
||||
//- Name of the mixture flux field (optional)
|
||||
word phiName_;
|
||||
|
||||
//- Name of density field (optional)
|
||||
word rhoName_;
|
||||
|
||||
//- Name of the pressure field (optional)
|
||||
word pName_;
|
||||
|
||||
//- Diffusion coefficient (optional)
|
||||
scalar D_;
|
||||
|
||||
//- Flag to indicate whether a constant, uniform D_ is specified
|
||||
bool constantD_;
|
||||
|
||||
//- Laminar diffusion coefficient (optional)
|
||||
scalar alphaD_;
|
||||
|
||||
//- Turbulent diffusion coefficient (optional)
|
||||
scalar alphaDt_;
|
||||
|
||||
//- Number of corrector iterations (optional)
|
||||
label nCorr_;
|
||||
|
||||
//- Residual volume-fraction
|
||||
scalar residualAlpha_;
|
||||
|
||||
//- Name of field whose schemes are used (optional)
|
||||
word schemesField_;
|
||||
|
||||
//- Run-time selectable finite volume options, e.g. sources, constraints
|
||||
fv::optionList fvOptions_;
|
||||
|
||||
//- The field
|
||||
volScalarField s_;
|
||||
|
||||
//- The field multiplied by the phase fraction
|
||||
volScalarField alphaS_;
|
||||
|
||||
//- Potential field used to generate the phase flux
|
||||
autoPtr<volScalarField> PhiPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Return the potential field used to generate the phase flux.
|
||||
// Constructed on demand.
|
||||
volScalarField& Phi();
|
||||
|
||||
//- Return the phase flux. Tries to look it up, and generates it if the
|
||||
// lookup fails. The generation creates a crude guess for alphaPhi
|
||||
// then solves a Laplacian to correct the flux to match the time
|
||||
// derivative of alpha.
|
||||
tmp<surfaceScalarField> alphaPhi();
|
||||
|
||||
//- Return the diffusivity field
|
||||
tmp<volScalarField> D(const surfaceScalarField& alphaPhi) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("phaseScalarTransport");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from Time and dictionary
|
||||
phaseScalarTransport
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~phaseScalarTransport();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the settings from the given dictionary
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Solve for the evolution of the field
|
||||
virtual bool execute();
|
||||
|
||||
//- Do nothing. The field is registered and written automatically.
|
||||
virtual bool write();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user