Consistency update: pimpleDyMFoam
This commit is contained in:
parent
c64509944e
commit
786aa16867
6 changed files with 46 additions and 58 deletions
|
@ -61,13 +61,12 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
# include "readControls.H"
|
||||
# include "checkTotalVolume.H"
|
||||
# include "CourantNo.H"
|
||||
# include "setDeltaT.H"
|
||||
|
||||
// Make the fluxes absolute
|
||||
fvc::makeAbsolute(phi, U);
|
||||
|
||||
# include "CourantNo.H"
|
||||
# include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
@ -136,7 +135,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
# include "continuityErrs.H"
|
||||
# include "movingMeshContinuityErrs.H"
|
||||
|
||||
// Consistently reconstruct velocity after pressure equation.
|
||||
// Note: flux is made relative inside the function
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Time derivative matrix
|
||||
fvVectorMatrix ddtUEqn(fvm::ddt(U));
|
||||
|
||||
// Convection-diffusion matrix
|
||||
fvVectorMatrix HUEqn
|
||||
(
|
||||
|
@ -5,22 +8,8 @@
|
|||
+ turbulence->divDevReff()
|
||||
);
|
||||
|
||||
// Time derivative matrix
|
||||
fvVectorMatrix ddtUEqn(fvm::ddt(U));
|
||||
|
||||
// Get under-relaxation factor
|
||||
scalar UUrf =
|
||||
mesh.solutionDict().equationRelaxationFactor(U.select(pimple.finalIter()));
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
// Solve momentum predictor
|
||||
solve
|
||||
(
|
||||
ddtUEqn
|
||||
+ relax(HUEqn, UUrf)
|
||||
==
|
||||
- fvc::grad(p),
|
||||
mesh.solutionDict().solver((U.select(pimple.finalIter())))
|
||||
);
|
||||
solve(relax(ddtUEqn + HUEqn) == -fvc::grad(p));
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
{
|
||||
fvScalarMatrix pcorrEqn
|
||||
(
|
||||
fvm::laplacian(1/aU, pcorr) == fvc::div(phi)
|
||||
fvm::laplacian(rAU, pcorr) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pcorrEqn.setReference(pRefCell, pRefValue);
|
||||
|
@ -55,6 +55,7 @@
|
|||
// Fluxes are corrected to absolute velocity and further corrected
|
||||
// later. HJ, 6/Feb/2009
|
||||
}
|
||||
|
||||
# include "continuityErrs.H"
|
||||
}
|
||||
|
||||
|
|
|
@ -42,18 +42,18 @@
|
|||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
Info<< "Reading field aU if present\n" << endl;
|
||||
volScalarField aU
|
||||
Info<< "Reading field rAU if present\n" << endl;
|
||||
volScalarField rAU
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"aU",
|
||||
"rAU",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
1/runTime.deltaT(),
|
||||
runTime.deltaT(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
|
|
@ -1,26 +1,32 @@
|
|||
{
|
||||
p.boundaryField().updateCoeffs();
|
||||
|
||||
// Prepare clean Ap without time derivative contribution and
|
||||
// without contribution from under-relaxation
|
||||
// HJ, 26/Oct/2015
|
||||
aU = HUEqn.A();
|
||||
// Prepare clean 1/a_p without time derivative and under-relaxation
|
||||
// contribution
|
||||
rAU = 1.0/HUEqn.A();
|
||||
|
||||
// Store velocity under-relaxation point before using U for the flux
|
||||
// precursor
|
||||
U.storePrevIter();
|
||||
// Calculate U from convection-diffusion matrix
|
||||
U = rAU*HUEqn.H();
|
||||
|
||||
U = HUEqn.H()/aU;
|
||||
phi = (fvc::interpolate(U) & mesh.Sf());
|
||||
// Consistently calculate flux
|
||||
pimple.calcTransientConsistentFlux(phi, U, rAU, ddtUEqn);
|
||||
|
||||
// Global flux balance
|
||||
adjustPhi(phi, U, p);
|
||||
|
||||
// Non-orthogonal pressure corrector loop
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(1/aU, p) == fvc::div(phi)
|
||||
fvm::laplacian
|
||||
(
|
||||
fvc::interpolate(rAU)/pimple.aCoeff(),
|
||||
p,
|
||||
"laplacian(rAU," + p.name() + ')'
|
||||
)
|
||||
==
|
||||
fvc::div(phi)
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
|
@ -35,24 +41,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Explicitly relax pressure for momentum corrector except for last corrector
|
||||
// Explicitly relax pressure for momentum corrector except for last
|
||||
// corrector
|
||||
if (!pimple.finalIter())
|
||||
{
|
||||
p.relax();
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
# include "movingMeshContinuityErrs.H"
|
||||
|
||||
U = UUrf*
|
||||
(
|
||||
1.0/(aU + ddtUEqn.A())*
|
||||
(
|
||||
U*aU - fvc::grad(p) + ddtUEqn.H()
|
||||
)
|
||||
)
|
||||
+ (1 - UUrf)*U.prevIter();
|
||||
U.correctBoundaryConditions();
|
||||
// Consistently reconstruct velocity after pressure equation. Note: flux is
|
||||
// made relative inside the function
|
||||
pimple.reconstructTransientVelocity(U, phi, ddtUEqn, rAU, p);
|
||||
}
|
||||
|
|
|
@ -25,15 +25,16 @@ Application
|
|||
pimpleDyMFoam.C
|
||||
|
||||
Description
|
||||
Transient solver for incompressible, flow of Newtonian fluids
|
||||
Transient solver for incompressible, turbulent flow of Newtonian fluids
|
||||
with dynamic mesh using the PIMPLE (merged PISO-SIMPLE) algorithm.
|
||||
|
||||
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
|
||||
|
||||
Consistent formulation without time-step and relaxation dependence by Jasak
|
||||
and Tukovic.
|
||||
|
||||
Author
|
||||
Hrvoje Jasak, Wikki Ltd. All rights reserved
|
||||
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -76,15 +77,10 @@ int main(int argc, char *argv[])
|
|||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
bool meshChanged = mesh.update();
|
||||
reduce(meshChanged, orOp<bool>());
|
||||
|
||||
# include "volContinuity.H"
|
||||
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
# include "meshCourantNo.H"
|
||||
}
|
||||
|
||||
// Mesh motion update
|
||||
if (correctPhi && meshChanged)
|
||||
{
|
||||
// Fluxes will be corrected to absolute velocity
|
||||
|
@ -92,14 +88,19 @@ int main(int argc, char *argv[])
|
|||
# include "correctPhi.H"
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
if (mesh.moving() && checkMeshCourantNo)
|
||||
{
|
||||
# include "meshCourantNo.H"
|
||||
}
|
||||
|
||||
if (meshChanged)
|
||||
{
|
||||
# include "CourantNo.H"
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
// --- PIMPLE loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
|
|
Reference in a new issue