CorrectPhi: Change the divU argument to autoPtr<volScalarField>
If divU is valid the velocity divergence is included in the pcorr equation. This simplifies the logic in multiphase moveMesh functions supporting incompressible (with or without mass sources) and compressible fluids.
This commit is contained in:
@ -9,7 +9,7 @@ CorrectPhi
|
||||
Uc,
|
||||
p,
|
||||
dimensionedScalar("rAUf", dimTime, 1),
|
||||
geometricZeroField(),
|
||||
autoPtr<volScalarField>(),
|
||||
pressureReference,
|
||||
pimple
|
||||
);
|
||||
|
||||
@ -67,32 +67,16 @@ void Foam::solvers::VoFSolver::moveMesh()
|
||||
|
||||
if (incompressible())
|
||||
{
|
||||
if (divU.valid())
|
||||
{
|
||||
CorrectPhi
|
||||
(
|
||||
phi,
|
||||
U,
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
divU(),
|
||||
pressureReference(),
|
||||
pimple
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
CorrectPhi
|
||||
(
|
||||
phi,
|
||||
U,
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
geometricZeroField(),
|
||||
pressureReference(),
|
||||
pimple
|
||||
);
|
||||
}
|
||||
CorrectPhi
|
||||
(
|
||||
phi,
|
||||
U,
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
divU,
|
||||
pressureReference(),
|
||||
pimple
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -54,7 +54,7 @@ void Foam::solvers::incompressibleFluid::moveMesh()
|
||||
U,
|
||||
p,
|
||||
dimensionedScalar("rAUf", dimTime, 1),
|
||||
geometricZeroField(),
|
||||
autoPtr<volScalarField>(),
|
||||
pressureReference,
|
||||
pimple
|
||||
);
|
||||
|
||||
@ -128,7 +128,7 @@ Foam::solvers::incompressibleMultiphaseVoF::incompressibleMultiphaseVoF
|
||||
U,
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
geometricZeroField(),
|
||||
autoPtr<volScalarField>(),
|
||||
pressureReference(),
|
||||
pimple
|
||||
);
|
||||
@ -143,7 +143,7 @@ Foam::solvers::incompressibleMultiphaseVoF::incompressibleMultiphaseVoF
|
||||
U,
|
||||
p_rgh,
|
||||
dimensionedScalar(dimTime/rho.dimensions(), 1),
|
||||
geometricZeroField(),
|
||||
autoPtr<volScalarField>(),
|
||||
pressureReference(),
|
||||
pimple
|
||||
);
|
||||
|
||||
@ -113,7 +113,7 @@ Foam::solvers::incompressibleVoF::incompressibleVoF(fvMesh& mesh)
|
||||
U,
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
geometricZeroField(),
|
||||
autoPtr<volScalarField>(),
|
||||
pressureReference(),
|
||||
pimple
|
||||
);
|
||||
@ -128,7 +128,7 @@ Foam::solvers::incompressibleVoF::incompressibleVoF(fvMesh& mesh)
|
||||
U,
|
||||
p_rgh,
|
||||
dimensionedScalar(dimTime/rho.dimensions(), 1),
|
||||
geometricZeroField(),
|
||||
autoPtr<volScalarField>(),
|
||||
pressureReference(),
|
||||
pimple
|
||||
);
|
||||
|
||||
@ -153,7 +153,7 @@ protected:
|
||||
//- Stored divU from the previous mesh so that it can be
|
||||
// mapped and used in correctPhi to ensure the corrected phi
|
||||
// has the same divergence
|
||||
tmp<volScalarField> divU;
|
||||
autoPtr<volScalarField> divU;
|
||||
|
||||
//- Read controls
|
||||
void readControls();
|
||||
|
||||
@ -519,10 +519,10 @@ Foam::MovingPhaseModel<BasePhaseModel>::K() const
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
const Foam::autoPtr<Foam::volScalarField>&
|
||||
Foam::MovingPhaseModel<BasePhaseModel>::divU() const
|
||||
{
|
||||
return divU_.valid() ? tmp<volScalarField>(divU_()) : tmp<volScalarField>();
|
||||
return divU_;
|
||||
}
|
||||
|
||||
|
||||
@ -531,13 +531,13 @@ void Foam::MovingPhaseModel<BasePhaseModel>::divU(tmp<volScalarField> divU)
|
||||
{
|
||||
if (!divU_.valid())
|
||||
{
|
||||
divU_ = divU;
|
||||
divU_.ref().rename(IOobject::groupName("divU", this->name()));
|
||||
divU_.ref().checkIn();
|
||||
divU_ = divU.ptr();
|
||||
divU_().rename(IOobject::groupName("divU", this->name()));
|
||||
divU_().checkIn();
|
||||
}
|
||||
else
|
||||
{
|
||||
divU_.ref() = divU;
|
||||
divU_() = divU;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ protected:
|
||||
mutable tmp<surfaceScalarField> DUDtf_;
|
||||
|
||||
//- Dilatation rate
|
||||
tmp<volScalarField> divU_;
|
||||
autoPtr<volScalarField> divU_;
|
||||
|
||||
//- Turbulence model
|
||||
autoPtr<phaseCompressible::momentumTransportModel> momentumTransport_;
|
||||
@ -253,7 +253,7 @@ public:
|
||||
// Compressibility (variable density)
|
||||
|
||||
//- Return the phase dilatation rate (d(alpha)/dt + div(alpha*phi))
|
||||
virtual tmp<volScalarField> divU() const;
|
||||
virtual const autoPtr<volScalarField>& divU() const;
|
||||
|
||||
//- Set the phase dilatation rate (d(alpha)/dt + div(alpha*phi))
|
||||
virtual void divU(tmp<volScalarField> divU);
|
||||
|
||||
@ -259,10 +259,11 @@ Foam::StationaryPhaseModel<BasePhaseModel>::K() const
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
const Foam::autoPtr<Foam::volScalarField>&
|
||||
Foam::StationaryPhaseModel<BasePhaseModel>::divU() const
|
||||
{
|
||||
return tmp<volScalarField>();
|
||||
static autoPtr<volScalarField> divU_;
|
||||
return divU_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -136,7 +136,7 @@ public:
|
||||
// Compressibility (variable density)
|
||||
|
||||
//- Return the phase dilatation rate (d(alpha)/dt + div(alpha*phi))
|
||||
virtual tmp<volScalarField> divU() const;
|
||||
virtual const autoPtr<volScalarField>& divU() const;
|
||||
|
||||
//- Set the phase dilatation rate (d(alpha)/dt + div(alpha*phi))
|
||||
virtual void divU(tmp<volScalarField> divU);
|
||||
|
||||
@ -246,7 +246,7 @@ public:
|
||||
virtual bool isochoric() const = 0;
|
||||
|
||||
//- Return the phase dilatation rate (d(alpha)/dt + div(alpha*phi))
|
||||
virtual tmp<volScalarField> divU() const = 0;
|
||||
virtual const autoPtr<volScalarField>& divU() const = 0;
|
||||
|
||||
//- Set the phase dilatation rate (d(alpha)/dt + div(alpha*phi))
|
||||
virtual void divU(tmp<volScalarField> divU) = 0;
|
||||
|
||||
@ -728,7 +728,7 @@ void Foam::phaseSystem::correctBoundaryFlux()
|
||||
void Foam::phaseSystem::correctPhi
|
||||
(
|
||||
const volScalarField& p_rgh,
|
||||
const tmp<volScalarField>& divU,
|
||||
const autoPtr<volScalarField>& divU,
|
||||
const pressureReference& pressureReference,
|
||||
nonOrthogonalSolutionControl& pimple
|
||||
)
|
||||
@ -778,32 +778,16 @@ void Foam::phaseSystem::correctPhi
|
||||
|
||||
if (incompressible())
|
||||
{
|
||||
if (divU.valid())
|
||||
{
|
||||
CorrectPhi
|
||||
(
|
||||
phi_,
|
||||
movingPhases()[0].U(),
|
||||
p_rgh,
|
||||
dimensionedScalar(dimTime/dimDensity, 1),
|
||||
divU(),
|
||||
pressureReference,
|
||||
pimple
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
CorrectPhi
|
||||
(
|
||||
phi_,
|
||||
movingPhases()[0].U(),
|
||||
p_rgh,
|
||||
dimensionedScalar(dimTime/dimDensity, 1),
|
||||
geometricZeroField(),
|
||||
pressureReference,
|
||||
pimple
|
||||
);
|
||||
}
|
||||
CorrectPhi
|
||||
(
|
||||
phi_,
|
||||
movingPhases()[0].U(),
|
||||
p_rgh,
|
||||
dimensionedScalar(dimTime/dimDensity, 1),
|
||||
divU,
|
||||
pressureReference,
|
||||
pimple
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -656,7 +656,7 @@ public:
|
||||
void correctPhi
|
||||
(
|
||||
const volScalarField& p_rgh,
|
||||
const tmp<volScalarField>& divU,
|
||||
const autoPtr<volScalarField>& divU,
|
||||
const pressureReference& pressureReference,
|
||||
nonOrthogonalSolutionControl& pimple
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user