CorrectPhi: Separated correctUphiBCs to simplify and generalise the use of CorrectPhi

This commit is contained in:
Henry Weller
2021-03-01 17:11:05 +00:00
parent 6eb19d1b4a
commit be86c8ec0f
28 changed files with 140 additions and 155 deletions

View File

@ -131,14 +131,7 @@ int main(int argc, char *argv[])
if (correctPhi)
{
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & rhoUf();
#include "correctPhi.H"
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);
}
if (checkMeshCourantNo)

View File

@ -1,12 +1,19 @@
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & rhoUf();
correctUphiBCs(rho, U, phi, true);
CorrectPhi
(
U,
phi,
p,
rho,
psi,
dimensionedScalar("rAUf", dimTime, 1),
divrhoU(),
pimple,
true
pimple
);
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);

View File

@ -124,14 +124,7 @@ int main(int argc, char *argv[])
if (correctPhi)
{
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & rhoUf();
#include "correctPhi.H"
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);
}
if (checkMeshCourantNo)

View File

@ -128,14 +128,7 @@ int main(int argc, char *argv[])
if (correctPhi)
{
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & rhoUf();
#include "correctPhi.H"
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);
}
if (checkMeshCourantNo)

View File

@ -1,12 +1,19 @@
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & rhoUf();
correctUphiBCs(rho, U, phi, true);
CorrectPhi
(
U,
phi,
p_rgh,
rho,
psi,
dimensionedScalar("rAUf", dimTime, 1),
divrhoU(),
pimple,
true
pimple
);
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);

View File

@ -1,12 +1,20 @@
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & Uf();
correctUphiBCs(U, phi, true);
CorrectPhi
(
U,
phi,
U,
p,
dimensionedScalar("rAUf", dimTime, 1),
geometricZeroField(),
pimple,
true
pimple
);
#include "continuityErrs.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);

View File

@ -99,14 +99,7 @@ int main(int argc, char *argv[])
if (correctPhi)
{
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & Uf();
#include "correctPhi.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
}
if (checkMeshCourantNo)

View File

@ -1,12 +1,19 @@
// Calculate absolute flux from the mapped surface velocity
phic = mesh.Sf() & Ucf();
correctUphiBCs(Uc, phic, true);
CorrectPhi
(
Uc,
phic,
Uc,
p,
dimensionedScalar("rAUf", dimTime, 1),
geometricZeroField(),
pimple,
true
pimple
);
#include "continuityErrs.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phic, Uc);

View File

@ -119,13 +119,7 @@ int main(int argc, char *argv[])
{
if (correctPhi)
{
// Calculate absolute flux from the mapped surface velocity
phic = mesh.Sf() & Ucf();
#include "correctPhic.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phic, Uc);
}
if (checkMeshCourantNo)

View File

@ -126,14 +126,7 @@ int main(int argc, char *argv[])
if (correctPhi)
{
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & rhoUf();
#include "../../compressible/rhoPimpleFoam/correctPhi.H"
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);
}
if (checkMeshCourantNo)

View File

@ -125,14 +125,7 @@ int main(int argc, char *argv[])
if (correctPhi)
{
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & rhoUf();
#include "../../compressible/rhoPimpleFoam/correctPhi.H"
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);
}
if (checkMeshCourantNo)

View File

@ -122,14 +122,7 @@ int main(int argc, char *argv[])
if (correctPhi)
{
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & rhoUf();
#include "../../compressible/rhoPimpleFoam/correctPhi.H"
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);
}
if (checkMeshCourantNo)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -80,13 +80,7 @@ int main(int argc, char *argv[])
if (mesh.changing() && correctPhi)
{
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & Uf();
#include "correctPhi.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
}
}

View File

@ -1,3 +1,6 @@
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & Uf();
correctUphiBCs(U, phi, true);
{
@ -36,3 +39,6 @@ correctUphiBCs(U, phi, true);
}
}
}
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);

View File

@ -2,15 +2,16 @@
// from the mapped surface velocity
phi = mesh.Sf() & Uf();
correctUphiBCs(U, phi, true);
CorrectPhi
(
U,
phi,
U,
p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
divU(),
pimple,
true
pimple
);
#include "continuityErrs.H"

View File

@ -2,30 +2,30 @@
// from the mapped surface velocity
phi = mesh.Sf() & Uf();
correctUphiBCs(U, phi, true);
if (divU.valid())
{
CorrectPhi
(
U,
phi,
U,
p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
divU(),
pimple,
true
pimple
);
}
else
{
CorrectPhi
(
U,
phi,
U,
p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(),
pimple,
true
pimple
);
}

View File

@ -20,28 +20,30 @@ if
dimensionedScalar(dimTime/dimDensity, 1)
);
correctUphiBCs(U, phi, true);
CorrectPhi
(
U,
phi,
U,
p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(),
pimple,
false
pimple
);
}
else
{
correctUphiBCs(U, phi, true);
CorrectPhi
(
U,
phi,
U,
p_rgh,
dimensionedScalar(dimTime/rho.dimensions(), 1),
geometricZeroField(),
pimple,
false
pimple
);
}
}

View File

@ -1,12 +1,20 @@
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & Uf();
correctUphiBCs(U, phi, true);
CorrectPhi
(
U,
phi,
U,
p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(),
pimple,
true
pimple
);
#include "continuityErrs.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);

View File

@ -16,30 +16,32 @@ if (correctPhi)
dimensionedScalar(dimTime/dimDensity, 1)
);
correctUphiBCs(U, phi, true);
CorrectPhi
(
U,
phi,
U,
p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(),
pimple,
false
pimple
);
#include "continuityErrs.H"
}
else
{
correctUphiBCs(U, phi, true);
CorrectPhi
(
U,
phi,
U,
p_rgh,
dimensionedScalar(dimTime/rho.dimensions(), 1),
geometricZeroField(),
pimple,
false
pimple
);
#include "continuityErrs.H"

View File

@ -106,15 +106,8 @@ int main(int argc, char *argv[])
if (correctPhi)
{
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & Uf();
#include "correctPhi.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
mixture.correct();
}

View File

@ -1,12 +1,20 @@
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & Uf();
correctUphiBCs(U, phi, true);
CorrectPhi
(
U,
phi,
U,
p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(),
pimple,
true
pimple
);
#include "continuityErrs.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);

View File

@ -16,30 +16,32 @@ if (correctPhi)
dimensionedScalar(dimTime/dimDensity, 1)
);
correctUphiBCs(U, phi, true);
CorrectPhi
(
U,
phi,
U,
p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(),
pimple,
false
pimple
);
#include "continuityErrs.H"
}
else
{
correctUphiBCs(U, phi, true);
CorrectPhi
(
U,
phi,
U,
p_rgh,
dimensionedScalar(dimTime/rho.dimensions(), 1),
geometricZeroField(),
pimple,
false
pimple
);
#include "continuityErrs.H"

View File

@ -100,14 +100,7 @@ int main(int argc, char *argv[])
if (correctPhi)
{
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & Uf();
#include "correctPhi.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
}
mixture.correct();

View File

@ -1,12 +1,20 @@
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & Uf();
correctUphiBCs(U, phi, true);
CorrectPhi
(
U,
phi,
U,
p_gh,
surfaceScalarField("rAUf", fvc::interpolate(rAU)),
geometricZeroField(),
pimple,
true
pimple
);
#include "continuityErrs.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);

View File

@ -0,0 +1,14 @@
if (!runTime.restart() &&correctPhi)
{
correctUphiBCs(U, phi, true);
CorrectPhi
(
phi,
U,
p_gh,
surfaceScalarField("rAUf", fvc::interpolate(rAU)),
geometricZeroField(),
pimple
);
}

View File

@ -73,10 +73,7 @@ int main(int argc, char *argv[])
dimensionedScalar(dimTime, 1.0)
);
if (correctPhi)
{
#include "correctPhi.H"
}
#include "initCorrectPhi.H"
#include "createUfIfPresent.H"
@ -115,14 +112,7 @@ int main(int argc, char *argv[])
if (correctPhi)
{
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & Uf();
#include "correctPhi.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
}
if (checkMeshCourantNo)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,20 +41,17 @@ License
template<class RAUfType, class DivUType>
void Foam::CorrectPhi
(
volVectorField& U,
surfaceScalarField& phi,
const volVectorField& U,
const volScalarField& p,
const RAUfType& rAUf,
const DivUType& divU,
nonOrthogonalSolutionControl& pcorrControl,
const bool evaluateUBCs
nonOrthogonalSolutionControl& pcorrControl
)
{
const fvMesh& mesh = U.mesh();
const fvMesh& mesh = phi.mesh();
const Time& runTime = mesh.time();
correctUphiBCs(U, phi, evaluateUBCs);
// Initialize BCs list for pcorr to zero-gradient
wordList pcorrTypes
(
@ -117,22 +114,18 @@ void Foam::CorrectPhi
template<class RAUfType, class DivRhoUType>
void Foam::CorrectPhi
(
volVectorField& U,
surfaceScalarField& phi,
const volScalarField& p,
const volScalarField& rho,
const volScalarField& psi,
const RAUfType& rAUf,
const DivRhoUType& divRhoU,
nonOrthogonalSolutionControl& pcorrControl,
const bool evaluateUBCs
nonOrthogonalSolutionControl& pcorrControl
)
{
const fvMesh& mesh = U.mesh();
const fvMesh& mesh = phi.mesh();
const Time& runTime = mesh.time();
correctUphiBCs(rho, U, phi, evaluateUBCs);
// Initialize BCs list for pcorr to zero-gradient
wordList pcorrTypes
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -72,27 +72,24 @@ namespace Foam
template<class RAUfType, class DivUType>
void CorrectPhi
(
volVectorField& U,
surfaceScalarField& phi,
const volVectorField& U,
const volScalarField& p,
const RAUfType& rAUf,
const DivUType& divU,
nonOrthogonalSolutionControl& pcorrControl,
const bool evaluateUBCs
nonOrthogonalSolutionControl& pcorrControl
);
template<class RAUfType, class DivRhoUType>
void CorrectPhi
(
volVectorField& U,
surfaceScalarField& phi,
const volScalarField& p,
const volScalarField& rho,
const volScalarField& psi,
const RAUfType& rAUf,
const DivRhoUType& divRhoU,
nonOrthogonalSolutionControl& pcorrControl,
const bool evaluateUBCs
nonOrthogonalSolutionControl& pcorrControl
);
}