Reverting ddtPhiCorr back to standard (not good for moving meshes)

This commit is contained in:
henry
2008-05-27 17:13:35 +01:00
parent f3f1186fbd
commit 3f20e26231
3 changed files with 16 additions and 95 deletions

View File

@ -56,6 +56,7 @@ int main(int argc, char *argv[])
{ {
# include "readControls.H" # include "readControls.H"
# include "CourantNo.H" # include "CourantNo.H"
# include "setDeltaT.H" # include "setDeltaT.H"
runTime++; runTime++;
@ -63,10 +64,7 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
// Make the fluxes absolute // Make the fluxes absolute
if (mesh.changing()) fvc::makeAbsolute(phi, U);
{
phi = fvc::interpolate(U) & mesh.Sf();
}
mesh.update(); mesh.update();
@ -75,14 +73,8 @@ int main(int argc, char *argv[])
# include "correctPhi.H" # include "correctPhi.H"
} }
// Keep the absolute fluxes for use in ddtPhiCorr
surfaceScalarField phiAbs0("phiAbs0", phi);
// Make the fluxes relative to the mesh motion // Make the fluxes relative to the mesh motion
if (mesh.changing()) fvc::makeRelative(phi, U);
{
fvc::makeRelative(phi, U);
}
if (mesh.changing() && checkMeshCourantNo) if (mesh.changing() && checkMeshCourantNo)
{ {
@ -106,49 +98,14 @@ int main(int argc, char *argv[])
if (ddtPhiCorr) if (ddtPhiCorr)
{ {
if (mesh.changing()) phi += fvc::ddtPhiCorr(rAU, U, phi);
{
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);
}
} }
if (p.needReference()) if (p.needReference())
{ {
if (mesh.changing()) fvc::makeRelative(phi, U);
{ adjustPhi(phi, U, p);
fvc::makeRelative(phi, U); fvc::makeAbsolute(phi, U);
adjustPhi(phi, U, p);
fvc::makeAbsolute(phi, U);
}
else
{
adjustPhi(phi, U, p);
}
} }
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@ -183,11 +140,11 @@ int main(int argc, char *argv[])
p.relax(); p.relax();
} }
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
// Make the fluxes relative to the mesh motion // Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U); fvc::makeRelative(phi, U);
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
} }
} }

View File

@ -74,10 +74,7 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
// Make the fluxes absolute // Make the fluxes absolute
if (mesh.changing()) fvc::makeAbsolute(phi, U);
{
phi = fvc::interpolate(U) & mesh.Sf();
}
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
@ -103,10 +100,7 @@ int main(int argc, char *argv[])
surfaceScalarField phiAbs0("phiAbs0", phi); surfaceScalarField phiAbs0("phiAbs0", phi);
// Make the fluxes relative to the mesh motion // Make the fluxes relative to the mesh motion
if (mesh.changing()) fvc::makeRelative(phi, U);
{
fvc::makeRelative(phi, U);
}
if (mesh.changing() && checkMeshCourantNo) if (mesh.changing() && checkMeshCourantNo)
{ {

View File

@ -7,30 +7,7 @@
if (ddtPhiCorr) if (ddtPhiCorr)
{ {
//phiU += fvc::ddtPhiCorr(rAU, rho, U, phiAbs0); 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())
);
} }
phi = phiU + phi = phiU +
@ -41,16 +18,9 @@
if (pd.needReference()) if (pd.needReference())
{ {
if (mesh.changing()) fvc::makeRelative(phi, U);
{ adjustPhi(phi, U, pd);
fvc::makeRelative(phi, U); fvc::makeAbsolute(phi, U);
adjustPhi(phi, U, pd);
fvc::makeAbsolute(phi, U);
}
else
{
adjustPhi(phi, U, pd);
}
} }
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)