CorrectPhi: Separated correctUphiBCs to simplify and generalise the use of CorrectPhi
This commit is contained in:
@ -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)
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
if (!runTime.restart() &&correctPhi)
|
||||
{
|
||||
correctUphiBCs(U, phi, true);
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
phi,
|
||||
U,
|
||||
p_gh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU)),
|
||||
geometricZeroField(),
|
||||
pimple
|
||||
);
|
||||
}
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
(
|
||||
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user