diff --git a/applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C b/applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C index d76d8c9ce484e2ba907036a09dadfe46d80940ac..814e755326fe84ddd10355e73bb2a123bb400294 100644 --- a/applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C +++ b/applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C @@ -56,6 +56,7 @@ int main(int argc, char *argv[]) { # include "readControls.H" # include "CourantNo.H" + # include "setDeltaT.H" runTime++; @@ -63,10 +64,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // Make the fluxes absolute - if (mesh.changing()) - { - phi = fvc::interpolate(U) & mesh.Sf(); - } + fvc::makeAbsolute(phi, U); mesh.update(); @@ -75,14 +73,8 @@ int main(int argc, char *argv[]) # include "correctPhi.H" } - // Keep the absolute fluxes for use in ddtPhiCorr - surfaceScalarField phiAbs0("phiAbs0", phi); - // Make the fluxes relative to the mesh motion - if (mesh.changing()) - { - fvc::makeRelative(phi, U); - } + fvc::makeRelative(phi, U); if (mesh.changing() && checkMeshCourantNo) { @@ -106,49 +98,14 @@ int main(int argc, char *argv[]) if (ddtPhiCorr) { - if (mesh.changing()) - { - dimensionedScalar rDeltaT = 1.0/mesh.time().deltaT(); - - volScalarField V0byV - ( - IOobject - ( - "V0byV", - mesh.time().timeName(), - mesh - ), - mesh, - dimensionedScalar("V0byV", dimless, 1), - zeroGradientFvPatchScalarField::typeName - ); - V0byV.dimensionedInternalField() = mesh.V0()/mesh.V(); - V0byV.correctBoundaryConditions(); - - phi += rDeltaT* - ( - fvc::interpolate(rAU*V0byV)*phiAbs0 - - (fvc::interpolate(rAU*V0byV*U.oldTime()) & mesh.Sf()) - ); - } - else - { - phi += fvc::ddtPhiCorr(rAU, U, phiAbs0); - } + phi += fvc::ddtPhiCorr(rAU, U, phi); } if (p.needReference()) { - if (mesh.changing()) - { - fvc::makeRelative(phi, U); - adjustPhi(phi, U, p); - fvc::makeAbsolute(phi, U); - } - else - { - adjustPhi(phi, U, p); - } + fvc::makeRelative(phi, U); + adjustPhi(phi, U, p); + fvc::makeAbsolute(phi, U); } for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) @@ -183,11 +140,11 @@ int main(int argc, char *argv[]) p.relax(); } - U -= rAU*fvc::grad(p); - U.correctBoundaryConditions(); - // Make the fluxes relative to the mesh motion fvc::makeRelative(phi, U); + + U -= rAU*fvc::grad(p); + U.correctBoundaryConditions(); } } diff --git a/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C index f0631fdd9949147ddb35b3ff0ec0b59dfe1b4b25..9d6b9c4cd9e986d412e1340fdb6e1bb85c21965f 100644 --- a/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C @@ -74,10 +74,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // Make the fluxes absolute - if (mesh.changing()) - { - phi = fvc::interpolate(U) & mesh.Sf(); - } + fvc::makeAbsolute(phi, U); scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); @@ -103,10 +100,7 @@ int main(int argc, char *argv[]) surfaceScalarField phiAbs0("phiAbs0", phi); // Make the fluxes relative to the mesh motion - if (mesh.changing()) - { - fvc::makeRelative(phi, U); - } + fvc::makeRelative(phi, U); if (mesh.changing() && checkMeshCourantNo) { diff --git a/applications/solvers/multiphase/interDyMFoam/pEqn.H b/applications/solvers/multiphase/interDyMFoam/pEqn.H index 74c301af6ebc650fcb57e23d529aa846230352c7..0fdba99cd696f12bfec9b17340dab5f75388b893 100644 --- a/applications/solvers/multiphase/interDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/interDyMFoam/pEqn.H @@ -7,30 +7,7 @@ if (ddtPhiCorr) { - //phiU += fvc::ddtPhiCorr(rAU, rho, U, phiAbs0); - - dimensionedScalar rDeltaT = 1.0/mesh.time().deltaT(); - - volScalarField V0byV - ( - IOobject - ( - "V0byV", - mesh.time().timeName(), - mesh - ), - mesh, - dimensionedScalar("V0byV", dimless, 1), - zeroGradientFvPatchScalarField::typeName - ); - V0byV.dimensionedInternalField() = mesh.V0()/mesh.V(); - V0byV.correctBoundaryConditions(); - - phiU += rDeltaT* - ( - fvc::interpolate(rAU*rho.oldTime()*V0byV)*phiAbs0 - - (fvc::interpolate(rAU*rho.oldTime()*V0byV*U.oldTime()) & mesh.Sf()) - ); + phiU += fvc::ddtPhiCorr(rAU, rho, U, phiAbs0); } phi = phiU + @@ -41,16 +18,9 @@ if (pd.needReference()) { - if (mesh.changing()) - { - fvc::makeRelative(phi, U); - adjustPhi(phi, U, pd); - fvc::makeAbsolute(phi, U); - } - else - { - adjustPhi(phi, U, pd); - } + fvc::makeRelative(phi, U); + adjustPhi(phi, U, pd); + fvc::makeAbsolute(phi, U); } for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)