fvCorrectPhi: Wrapper for CorrectPhi to simplify solvers
This commit is contained in:
@ -3,12 +3,12 @@ phic = mesh.Sf() & Ucf();
|
|||||||
|
|
||||||
correctUphiBCs(Uc, phic, true);
|
correctUphiBCs(Uc, phic, true);
|
||||||
|
|
||||||
CorrectPhi
|
fv::correctPhi
|
||||||
(
|
(
|
||||||
phic,
|
phic,
|
||||||
Uc,
|
Uc,
|
||||||
p,
|
p,
|
||||||
dimensionedScalar("rAUf", dimTime, 1),
|
autoPtr<volScalarField>(),
|
||||||
autoPtr<volScalarField>(),
|
autoPtr<volScalarField>(),
|
||||||
pressureReference,
|
pressureReference,
|
||||||
pimple
|
pimple
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -80,7 +80,7 @@ namespace Foam
|
|||||||
#include "phaseIncompressibleMomentumTransportModel.H"
|
#include "phaseIncompressibleMomentumTransportModel.H"
|
||||||
#include "pimpleControl.H"
|
#include "pimpleControl.H"
|
||||||
#include "pressureReference.H"
|
#include "pressureReference.H"
|
||||||
#include "CorrectPhi.H"
|
#include "fvCorrectPhi.H"
|
||||||
#include "fvModels.H"
|
#include "fvModels.H"
|
||||||
#include "fvConstraints.H"
|
#include "fvConstraints.H"
|
||||||
#include "parcelClouds.H"
|
#include "parcelClouds.H"
|
||||||
|
|||||||
@ -50,6 +50,28 @@ void Foam::solvers::VoFSolver::continuityErrors()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::solvers::VoFSolver::setrAU(const fvVectorMatrix& UEqn)
|
||||||
|
{
|
||||||
|
if (rAU.valid())
|
||||||
|
{
|
||||||
|
rAU() = 1.0/UEqn.A();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rAU = (1.0/UEqn.A()).ptr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::solvers::VoFSolver::clearrAU()
|
||||||
|
{
|
||||||
|
if (!(correctPhi || mesh.topoChanging()))
|
||||||
|
{
|
||||||
|
rAU.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::solvers::VoFSolver::correctCoNum()
|
void Foam::solvers::VoFSolver::correctCoNum()
|
||||||
{
|
{
|
||||||
fluidSolver::correctCoNum(phi);
|
fluidSolver::correctCoNum(phi);
|
||||||
|
|||||||
@ -125,7 +125,9 @@ protected:
|
|||||||
|
|
||||||
// Cached temporary fields
|
// Cached temporary fields
|
||||||
|
|
||||||
tmp<volScalarField> rAU;
|
//- Inverse momentum equation diagonal
|
||||||
|
// Used to correct phi following mesh changes
|
||||||
|
autoPtr<volScalarField> rAU;
|
||||||
|
|
||||||
//- Pointer to the surface momentum field
|
//- Pointer to the surface momentum field
|
||||||
// used to recreate the flux after mesh-change
|
// used to recreate the flux after mesh-change
|
||||||
@ -157,6 +159,12 @@ protected:
|
|||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Set or update the cached rAU
|
||||||
|
void setrAU(const fvVectorMatrix& UEqn);
|
||||||
|
|
||||||
|
//- Clear the cached rAU is no longer needed
|
||||||
|
void clearrAU();
|
||||||
|
|
||||||
//- Correct the cached Courant numbers
|
//- Correct the cached Courant numbers
|
||||||
virtual void correctCoNum() = 0;
|
virtual void correctCoNum() = 0;
|
||||||
|
|
||||||
|
|||||||
@ -24,8 +24,9 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "VoFSolver.H"
|
#include "VoFSolver.H"
|
||||||
#include "CorrectPhi.H"
|
#include "fvCorrectPhi.H"
|
||||||
#include "geometricZeroField.H"
|
#include "fvcMeshPhi.H"
|
||||||
|
#include "fvcDiv.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -67,12 +68,12 @@ void Foam::solvers::VoFSolver::moveMesh()
|
|||||||
|
|
||||||
if (incompressible())
|
if (incompressible())
|
||||||
{
|
{
|
||||||
CorrectPhi
|
fv::correctPhi
|
||||||
(
|
(
|
||||||
phi,
|
phi,
|
||||||
U,
|
U,
|
||||||
p_rgh,
|
p_rgh,
|
||||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
rAU,
|
||||||
divU,
|
divU,
|
||||||
pressureReference(),
|
pressureReference(),
|
||||||
pimple
|
pimple
|
||||||
@ -80,12 +81,12 @@ void Foam::solvers::VoFSolver::moveMesh()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CorrectPhi
|
fv::correctPhi
|
||||||
(
|
(
|
||||||
phi,
|
phi,
|
||||||
p_rgh,
|
p_rgh,
|
||||||
psiByRho(),
|
psiByRho(),
|
||||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
rAU,
|
||||||
divU(),
|
divU(),
|
||||||
pimple
|
pimple
|
||||||
);
|
);
|
||||||
|
|||||||
@ -44,15 +44,7 @@ void Foam::solvers::compressibleMultiphaseVoF::pressureCorrector()
|
|||||||
volVectorField& U = U_;
|
volVectorField& U = U_;
|
||||||
|
|
||||||
fvVectorMatrix& UEqn = tUEqn.ref();
|
fvVectorMatrix& UEqn = tUEqn.ref();
|
||||||
|
setrAU(UEqn);
|
||||||
if (rAU.valid())
|
|
||||||
{
|
|
||||||
rAU.ref() = 1.0/UEqn.A();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rAU = 1.0/UEqn.A();
|
|
||||||
}
|
|
||||||
|
|
||||||
const surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU()));
|
const surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU()));
|
||||||
|
|
||||||
@ -173,6 +165,7 @@ void Foam::solvers::compressibleMultiphaseVoF::pressureCorrector()
|
|||||||
|
|
||||||
K = 0.5*magSqr(U);
|
K = 0.5*magSqr(U);
|
||||||
|
|
||||||
|
clearrAU();
|
||||||
tUEqn.clear();
|
tUEqn.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -49,15 +49,7 @@ void Foam::solvers::compressibleVoF::pressureCorrector()
|
|||||||
const volScalarField& psi2 = mixture.thermo2().psi();
|
const volScalarField& psi2 = mixture.thermo2().psi();
|
||||||
|
|
||||||
fvVectorMatrix& UEqn = tUEqn.ref();
|
fvVectorMatrix& UEqn = tUEqn.ref();
|
||||||
|
setrAU(UEqn);
|
||||||
if (rAU.valid())
|
|
||||||
{
|
|
||||||
rAU.ref() = 1.0/UEqn.A();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rAU = 1.0/UEqn.A();
|
|
||||||
}
|
|
||||||
|
|
||||||
const surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU()));
|
const surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU()));
|
||||||
|
|
||||||
@ -233,6 +225,7 @@ void Foam::solvers::compressibleVoF::pressureCorrector()
|
|||||||
|
|
||||||
K = 0.5*magSqr(U);
|
K = 0.5*magSqr(U);
|
||||||
|
|
||||||
|
clearrAU();
|
||||||
tUEqn.clear();
|
tUEqn.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,8 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "incompressibleFluid.H"
|
#include "incompressibleFluid.H"
|
||||||
#include "CorrectPhi.H"
|
#include "fvCorrectPhi.H"
|
||||||
|
#include "fvcMeshPhi.H"
|
||||||
#include "geometricZeroField.H"
|
#include "geometricZeroField.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
@ -48,12 +49,12 @@ void Foam::solvers::incompressibleFluid::moveMesh()
|
|||||||
|
|
||||||
correctUphiBCs(U, phi, true);
|
correctUphiBCs(U, phi, true);
|
||||||
|
|
||||||
CorrectPhi
|
fv::correctPhi
|
||||||
(
|
(
|
||||||
phi,
|
phi,
|
||||||
U,
|
U,
|
||||||
p,
|
p,
|
||||||
dimensionedScalar("rAUf", dimTime, 1),
|
autoPtr<volScalarField>(),
|
||||||
autoPtr<volScalarField>(),
|
autoPtr<volScalarField>(),
|
||||||
pressureReference,
|
pressureReference,
|
||||||
pimple
|
pimple
|
||||||
|
|||||||
@ -24,7 +24,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "incompressibleMultiphaseVoF.H"
|
#include "incompressibleMultiphaseVoF.H"
|
||||||
#include "CorrectPhi.H"
|
#include "fvCorrectPhi.H"
|
||||||
#include "geometricZeroField.H"
|
#include "geometricZeroField.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
@ -123,32 +123,16 @@ Foam::solvers::incompressibleMultiphaseVoF::incompressibleMultiphaseVoF
|
|||||||
{
|
{
|
||||||
correctUphiBCs(U_, phi, true);
|
correctUphiBCs(U_, phi, true);
|
||||||
|
|
||||||
if (correctPhi)
|
fv::correctPhi
|
||||||
{
|
(
|
||||||
CorrectPhi
|
phi,
|
||||||
(
|
U,
|
||||||
phi,
|
p_rgh,
|
||||||
U,
|
rAU,
|
||||||
p_rgh,
|
autoPtr<volScalarField>(),
|
||||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
pressureReference(),
|
||||||
autoPtr<volScalarField>(),
|
pimple
|
||||||
pressureReference(),
|
);
|
||||||
pimple
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CorrectPhi
|
|
||||||
(
|
|
||||||
phi,
|
|
||||||
U,
|
|
||||||
p_rgh,
|
|
||||||
dimensionedScalar(dimTime/rho.dimensions(), 1),
|
|
||||||
autoPtr<volScalarField>(),
|
|
||||||
pressureReference(),
|
|
||||||
pimple
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,17 +43,9 @@ void Foam::solvers::incompressibleMultiphaseVoF::pressureCorrector()
|
|||||||
volVectorField& U = U_;
|
volVectorField& U = U_;
|
||||||
|
|
||||||
fvVectorMatrix& UEqn = tUEqn.ref();
|
fvVectorMatrix& UEqn = tUEqn.ref();
|
||||||
|
setrAU(UEqn);
|
||||||
|
|
||||||
if (rAU.valid())
|
const surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU()));
|
||||||
{
|
|
||||||
rAU.ref() = 1.0/UEqn.A();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rAU = 1.0/UEqn.A();
|
|
||||||
}
|
|
||||||
|
|
||||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU()));
|
|
||||||
|
|
||||||
while (pimple.correct())
|
while (pimple.correct())
|
||||||
{
|
{
|
||||||
@ -154,11 +146,7 @@ void Foam::solvers::incompressibleMultiphaseVoF::pressureCorrector()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!correctPhi)
|
clearrAU();
|
||||||
{
|
|
||||||
rAU.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
tUEqn.clear();
|
tUEqn.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ License
|
|||||||
|
|
||||||
#include "incompressibleVoF.H"
|
#include "incompressibleVoF.H"
|
||||||
#include "localEulerDdtScheme.H"
|
#include "localEulerDdtScheme.H"
|
||||||
#include "CorrectPhi.H"
|
#include "fvCorrectPhi.H"
|
||||||
#include "geometricZeroField.H"
|
#include "geometricZeroField.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
@ -108,32 +108,16 @@ Foam::solvers::incompressibleVoF::incompressibleVoF(fvMesh& mesh)
|
|||||||
{
|
{
|
||||||
correctUphiBCs(U_, phi, true);
|
correctUphiBCs(U_, phi, true);
|
||||||
|
|
||||||
if (correctPhi)
|
fv::correctPhi
|
||||||
{
|
(
|
||||||
CorrectPhi
|
phi,
|
||||||
(
|
U,
|
||||||
phi,
|
p_rgh,
|
||||||
U,
|
rAU,
|
||||||
p_rgh,
|
autoPtr<volScalarField>(),
|
||||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
pressureReference(),
|
||||||
autoPtr<volScalarField>(),
|
pimple
|
||||||
pressureReference(),
|
);
|
||||||
pimple
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CorrectPhi
|
|
||||||
(
|
|
||||||
phi,
|
|
||||||
U,
|
|
||||||
p_rgh,
|
|
||||||
dimensionedScalar(dimTime/rho.dimensions(), 1),
|
|
||||||
autoPtr<volScalarField>(),
|
|
||||||
pressureReference(),
|
|
||||||
pimple
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,17 +43,9 @@ void Foam::solvers::incompressibleVoF::pressureCorrector()
|
|||||||
volVectorField& U = U_;
|
volVectorField& U = U_;
|
||||||
|
|
||||||
fvVectorMatrix& UEqn = tUEqn.ref();
|
fvVectorMatrix& UEqn = tUEqn.ref();
|
||||||
|
setrAU(UEqn);
|
||||||
|
|
||||||
if (rAU.valid())
|
const surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU()));
|
||||||
{
|
|
||||||
rAU.ref() = 1.0/UEqn.A();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rAU = 1.0/UEqn.A();
|
|
||||||
}
|
|
||||||
|
|
||||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU()));
|
|
||||||
|
|
||||||
while (pimple.correct())
|
while (pimple.correct())
|
||||||
{
|
{
|
||||||
@ -154,11 +146,7 @@ void Foam::solvers::incompressibleVoF::pressureCorrector()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!correctPhi)
|
clearrAU();
|
||||||
{
|
|
||||||
rAU.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
tUEqn.clear();
|
tUEqn.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,8 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "isothermalFluid.H"
|
#include "isothermalFluid.H"
|
||||||
#include "CorrectPhi.H"
|
#include "fvCorrectPhi.H"
|
||||||
|
#include "fvcMeshPhi.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -57,12 +58,12 @@ void Foam::solvers::isothermalFluid::moveMesh()
|
|||||||
|
|
||||||
correctUphiBCs(rho, U, phi, true);
|
correctUphiBCs(rho, U, phi, true);
|
||||||
|
|
||||||
CorrectPhi
|
fv::correctPhi
|
||||||
(
|
(
|
||||||
phi,
|
phi,
|
||||||
buoyancy.valid() ? p_rgh : p,
|
buoyancy.valid() ? p_rgh : p,
|
||||||
thermo.psi(),
|
thermo.psi(),
|
||||||
dimensionedScalar("rAUf", dimTime, 1),
|
autoPtr<volScalarField>(),
|
||||||
divrhoU(),
|
divrhoU(),
|
||||||
pimple
|
pimple
|
||||||
);
|
);
|
||||||
|
|||||||
@ -31,7 +31,7 @@ License
|
|||||||
#include "fvcDiv.H"
|
#include "fvcDiv.H"
|
||||||
#include "fvcGrad.H"
|
#include "fvcGrad.H"
|
||||||
#include "fvcSnGrad.H"
|
#include "fvcSnGrad.H"
|
||||||
#include "CorrectPhi.H"
|
#include "fvCorrectPhi.H"
|
||||||
#include "fvcMeshPhi.H"
|
#include "fvcMeshPhi.H"
|
||||||
#include "correctContactAngle.H"
|
#include "correctContactAngle.H"
|
||||||
#include "dragModel.H"
|
#include "dragModel.H"
|
||||||
@ -778,12 +778,12 @@ void Foam::phaseSystem::correctPhi
|
|||||||
|
|
||||||
if (incompressible())
|
if (incompressible())
|
||||||
{
|
{
|
||||||
CorrectPhi
|
fv::correctPhi
|
||||||
(
|
(
|
||||||
phi_,
|
phi_,
|
||||||
movingPhases()[0].U(),
|
movingPhases()[0].U(),
|
||||||
p_rgh,
|
p_rgh,
|
||||||
dimensionedScalar(dimTime/dimDensity, 1),
|
autoPtr<volScalarField>(),
|
||||||
divU,
|
divU,
|
||||||
pressureReference,
|
pressureReference,
|
||||||
pimple
|
pimple
|
||||||
@ -809,12 +809,12 @@ void Foam::phaseSystem::correctPhi
|
|||||||
psi += alpha*phase.thermo().psi()/phase.thermo().rho();
|
psi += alpha*phase.thermo().psi()/phase.thermo().rho();
|
||||||
}
|
}
|
||||||
|
|
||||||
CorrectPhi
|
fv::correctPhi
|
||||||
(
|
(
|
||||||
phi_,
|
phi_,
|
||||||
p_rgh,
|
p_rgh,
|
||||||
psi,
|
psi,
|
||||||
dimensionedScalar(dimTime/dimDensity, 1),
|
autoPtr<volScalarField>(),
|
||||||
divU(),
|
divU(),
|
||||||
pimple
|
pimple
|
||||||
);
|
);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -36,7 +36,7 @@ Description
|
|||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "cavitatingTwoPhaseMixture.H"
|
#include "cavitatingTwoPhaseMixture.H"
|
||||||
#include "incompressibleMomentumTransportModels.H"
|
#include "incompressibleMomentumTransportModels.H"
|
||||||
#include "CorrectPhi.H"
|
#include "fvCorrectPhi.H"
|
||||||
#include "pimpleControl.H"
|
#include "pimpleControl.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -452,7 +452,8 @@ $(general)/findRefCell/findRefCell.C
|
|||||||
$(general)/constrainHbyA/constrainHbyA.C
|
$(general)/constrainHbyA/constrainHbyA.C
|
||||||
$(general)/adjustPhi/adjustPhi.C
|
$(general)/adjustPhi/adjustPhi.C
|
||||||
$(general)/bound/bound.C
|
$(general)/bound/bound.C
|
||||||
$(general)/CorrectPhi/correctUphiBCs.C
|
$(general)/correctPhi/fvCorrectPhi.C
|
||||||
|
$(general)/correctPhi/correctUphiBCs.C
|
||||||
$(general)/pressureReference/pressureReference.C
|
$(general)/pressureReference/pressureReference.C
|
||||||
$(general)/levelSet/levelSet.C
|
$(general)/levelSet/levelSet.C
|
||||||
$(general)/surfaceToVolVelocity/surfaceToVolVelocity.C
|
$(general)/surfaceToVolVelocity/surfaceToVolVelocity.C
|
||||||
|
|||||||
@ -26,7 +26,6 @@ License
|
|||||||
#include "CorrectPhi.H"
|
#include "CorrectPhi.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "fvScalarMatrix.H"
|
|
||||||
#include "fvmDdt.H"
|
#include "fvmDdt.H"
|
||||||
#include "fvmLaplacian.H"
|
#include "fvmLaplacian.H"
|
||||||
#include "fvcDiv.H"
|
#include "fvcDiv.H"
|
||||||
@ -40,12 +39,12 @@ License
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class RAUfType>
|
template<class RAUfType>
|
||||||
void Foam::CorrectPhi
|
void Foam::fv::CorrectPhi
|
||||||
(
|
(
|
||||||
surfaceScalarField& phi,
|
surfaceScalarField& phi,
|
||||||
const volVectorField& U,
|
const volVectorField& U,
|
||||||
const volScalarField& p,
|
const volScalarField& p,
|
||||||
const RAUfType& rAUf,
|
const RAUfType& rAU,
|
||||||
const autoPtr<volScalarField>& divU,
|
const autoPtr<volScalarField>& divU,
|
||||||
const pressureReference& pressureReference,
|
const pressureReference& pressureReference,
|
||||||
nonOrthogonalSolutionControl& pcorrControl
|
nonOrthogonalSolutionControl& pcorrControl
|
||||||
@ -98,7 +97,7 @@ void Foam::CorrectPhi
|
|||||||
// matches the divU provided (from previous iteration, time-step...)
|
// matches the divU provided (from previous iteration, time-step...)
|
||||||
fvScalarMatrix pcorrEqn
|
fvScalarMatrix pcorrEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rAUf, pcorr)
|
fvm::laplacian(rAU, pcorr)
|
||||||
==
|
==
|
||||||
(
|
(
|
||||||
divU.valid()
|
divU.valid()
|
||||||
@ -120,12 +119,12 @@ void Foam::CorrectPhi
|
|||||||
|
|
||||||
|
|
||||||
template<class RAUfType>
|
template<class RAUfType>
|
||||||
void Foam::CorrectPhi
|
void Foam::fv::CorrectPhi
|
||||||
(
|
(
|
||||||
surfaceScalarField& phi,
|
surfaceScalarField& phi,
|
||||||
const volScalarField& p,
|
const volScalarField& p,
|
||||||
const volScalarField& psi,
|
const volScalarField& psi,
|
||||||
const RAUfType& rAUf,
|
const RAUfType& rAU,
|
||||||
const volScalarField& divRhoU,
|
const volScalarField& divRhoU,
|
||||||
nonOrthogonalSolutionControl& pcorrControl
|
nonOrthogonalSolutionControl& pcorrControl
|
||||||
)
|
)
|
||||||
@ -172,7 +171,7 @@ void Foam::CorrectPhi
|
|||||||
(
|
(
|
||||||
fvm::ddt(psi, pcorr)
|
fvm::ddt(psi, pcorr)
|
||||||
+ fvc::div(phi)
|
+ fvc::div(phi)
|
||||||
- fvm::laplacian(rAUf, pcorr)
|
- fvm::laplacian(rAU, pcorr)
|
||||||
==
|
==
|
||||||
divRhoU
|
divRhoU
|
||||||
);
|
);
|
||||||
91
src/finiteVolume/cfdTools/general/correctPhi/CorrectPhi.H
Normal file
91
src/finiteVolume/cfdTools/general/correctPhi/CorrectPhi.H
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2015-2023 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/>.
|
||||||
|
|
||||||
|
Function
|
||||||
|
Foam::fv::CorrectPhi
|
||||||
|
|
||||||
|
Description
|
||||||
|
Flux correction functions to ensure continuity.
|
||||||
|
|
||||||
|
Required during start-up, restart, mesh-motion etc. when non-conservative
|
||||||
|
fluxes may adversely affect the prediction-part of the solution algorithm
|
||||||
|
(the part before the first pressure solution which would ensure continuity).
|
||||||
|
This is particularly important for VoF and other multi-phase solver in
|
||||||
|
which non-conservative fluxes cause unboundedness of the phase-fraction.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
CorrectPhi.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef CorrectPhi_H
|
||||||
|
#define CorrectPhi_H
|
||||||
|
|
||||||
|
#include "volFieldsFwd.H"
|
||||||
|
#include "surfaceFieldsFwd.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
class pressureReference;
|
||||||
|
class nonOrthogonalSolutionControl;
|
||||||
|
|
||||||
|
namespace fv
|
||||||
|
{
|
||||||
|
template<class RAUfType>
|
||||||
|
void CorrectPhi
|
||||||
|
(
|
||||||
|
surfaceScalarField& phi,
|
||||||
|
const volVectorField& U,
|
||||||
|
const volScalarField& p,
|
||||||
|
const RAUfType& rAU,
|
||||||
|
const autoPtr<volScalarField>& divU,
|
||||||
|
const pressureReference& pressureReference,
|
||||||
|
nonOrthogonalSolutionControl& pcorrControl
|
||||||
|
);
|
||||||
|
|
||||||
|
template<class RAUfType>
|
||||||
|
void CorrectPhi
|
||||||
|
(
|
||||||
|
surfaceScalarField& phi,
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& psi,
|
||||||
|
const RAUfType& rAU,
|
||||||
|
const volScalarField& divRhoU,
|
||||||
|
nonOrthogonalSolutionControl& pcorrControl
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "CorrectPhi.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015-2023 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -23,7 +23,9 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "CorrectPhi.H"
|
#include "fvCorrectPhi.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
118
src/finiteVolume/cfdTools/general/correctPhi/fvCorrectPhi.C
Normal file
118
src/finiteVolume/cfdTools/general/correctPhi/fvCorrectPhi.C
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2023 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 "fvCorrectPhi.H"
|
||||||
|
#include "CorrectPhi.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fv::correctPhi
|
||||||
|
(
|
||||||
|
surfaceScalarField& phi,
|
||||||
|
const volVectorField& U,
|
||||||
|
const volScalarField& p,
|
||||||
|
const autoPtr<volScalarField>& rAU,
|
||||||
|
const autoPtr<volScalarField>& divU,
|
||||||
|
const pressureReference& pressureReference,
|
||||||
|
nonOrthogonalSolutionControl& pcorrControl
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (rAU.valid())
|
||||||
|
{
|
||||||
|
CorrectPhi
|
||||||
|
(
|
||||||
|
phi,
|
||||||
|
U,
|
||||||
|
p,
|
||||||
|
rAU(),
|
||||||
|
divU,
|
||||||
|
pressureReference,
|
||||||
|
pcorrControl
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CorrectPhi
|
||||||
|
(
|
||||||
|
phi,
|
||||||
|
U,
|
||||||
|
p,
|
||||||
|
dimensionedScalar
|
||||||
|
(
|
||||||
|
"rAU",
|
||||||
|
phi.dimensions()/p.dimensions()/dimLength,
|
||||||
|
1
|
||||||
|
),
|
||||||
|
divU,
|
||||||
|
pressureReference,
|
||||||
|
pcorrControl
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fv::correctPhi
|
||||||
|
(
|
||||||
|
surfaceScalarField& phi,
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& psi,
|
||||||
|
const autoPtr<volScalarField>& rAU,
|
||||||
|
const volScalarField& divRhoU,
|
||||||
|
nonOrthogonalSolutionControl& pcorrControl
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (rAU.valid())
|
||||||
|
{
|
||||||
|
CorrectPhi
|
||||||
|
(
|
||||||
|
phi,
|
||||||
|
p,
|
||||||
|
psi,
|
||||||
|
rAU(),
|
||||||
|
divRhoU,
|
||||||
|
pcorrControl
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CorrectPhi
|
||||||
|
(
|
||||||
|
phi,
|
||||||
|
p,
|
||||||
|
psi,
|
||||||
|
dimensionedScalar
|
||||||
|
(
|
||||||
|
"rAU",
|
||||||
|
phi.dimensions()/p.dimensions()/dimLength,
|
||||||
|
1
|
||||||
|
),
|
||||||
|
divRhoU,
|
||||||
|
pcorrControl
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -21,8 +21,8 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Function
|
||||||
Foam::CorrectPhi
|
Foam::fv::correctPhi
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Flux correction functions to ensure continuity.
|
Flux correction functions to ensure continuity.
|
||||||
@ -34,12 +34,13 @@ Description
|
|||||||
which non-conservative fluxes cause unboundedness of the phase-fraction.
|
which non-conservative fluxes cause unboundedness of the phase-fraction.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
CorrectPhi.C
|
fvCorrectPhi.C
|
||||||
|
correctUphiBCs.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef CorrectPhi_H
|
#ifndef fvCorrectPhi_H
|
||||||
#define CorrectPhi_H
|
#define fvCorrectPhi_H
|
||||||
|
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "surfaceFieldsFwd.H"
|
#include "surfaceFieldsFwd.H"
|
||||||
@ -70,35 +71,31 @@ namespace Foam
|
|||||||
const bool evaluateUBCs
|
const bool evaluateUBCs
|
||||||
);
|
);
|
||||||
|
|
||||||
template<class RAUfType>
|
namespace fv
|
||||||
void CorrectPhi
|
{
|
||||||
(
|
void correctPhi
|
||||||
surfaceScalarField& phi,
|
(
|
||||||
const volVectorField& U,
|
surfaceScalarField& phi,
|
||||||
const volScalarField& p,
|
const volVectorField& U,
|
||||||
const RAUfType& rAUf,
|
const volScalarField& p,
|
||||||
const autoPtr<volScalarField>& divU,
|
const autoPtr<volScalarField>& rAU,
|
||||||
const pressureReference& pressureReference,
|
const autoPtr<volScalarField>& divU,
|
||||||
nonOrthogonalSolutionControl& pcorrControl
|
const pressureReference& pressureReference,
|
||||||
);
|
nonOrthogonalSolutionControl& pcorrControl
|
||||||
|
);
|
||||||
|
|
||||||
template<class RAUfType>
|
void correctPhi
|
||||||
void CorrectPhi
|
(
|
||||||
(
|
surfaceScalarField& phi,
|
||||||
surfaceScalarField& phi,
|
const volScalarField& p,
|
||||||
const volScalarField& p,
|
const volScalarField& psi,
|
||||||
const volScalarField& psi,
|
const autoPtr<volScalarField>& rAU,
|
||||||
const RAUfType& rAUf,
|
const volScalarField& divRhoU,
|
||||||
const volScalarField& divRhoU,
|
nonOrthogonalSolutionControl& pcorrControl
|
||||||
nonOrthogonalSolutionControl& pcorrControl
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
#include "CorrectPhi.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ deltaT 0.001;
|
|||||||
|
|
||||||
writeControl adjustableRunTime;
|
writeControl adjustableRunTime;
|
||||||
|
|
||||||
writeInterval 0.02;
|
writeInterval 0.1;
|
||||||
|
|
||||||
purgeWrite 0;
|
purgeWrite 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user