Carlen |
March 22, 2017 19:15 |
How to update phi in Fractional Step Method
Hi Foamers,
I intend to realise a semi-implicit fractional step in OpenFOAM but got stuck at the final step where the flux phi is updated. Please see the code here:
Code:
// Create Poisson Matrix
fvScalarMatrix pEqn
(
fvm::laplacian(p)
);
pEqn.setReference(pRefCell, pRefValue);
// PressureCorrection.H
solve(pEqn==fvc::div(U)/runTime.deltaT());
phi -= pEqn.flux();// This is where I have problem.
U -= runTime.deltaT()*fvc::grad(p);
U.correctBoundaryConditions();
According to Jasak, if there is a plus sign before laplacian (p) then it should be:
Code:
phi -= pEqn.flux();
otherwise it should be
Code:
phi += pEqn.flux();
However, I cannot get very good mass conservation from both of them. Or there are other ways to update flux? PS: I am solving momentum equation implicitly using second order backward.
Thanks for your help,
Carlen
|