Update for topo changes support

This commit is contained in:
Hrvoje Jasak 2014-12-16 22:37:18 +00:00
parent 00e8dce8da
commit 6af575dbe1
3 changed files with 83 additions and 70 deletions

View file

@ -6,6 +6,7 @@
); );
basicPsiThermo& thermo = pThermo(); basicPsiThermo& thermo = pThermo();
volScalarField& T = const_cast<volScalarField&>(thermo.T());
volScalarField& p = thermo.p(); volScalarField& p = thermo.p();
volScalarField& e = thermo.e(); volScalarField& e = thermo.e();
const volScalarField& psi = thermo.psi(); const volScalarField& psi = thermo.psi();

View file

@ -0,0 +1,69 @@
{
U = UEqn.H()/UEqn.A();
# include "limitU.H"
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)*
(
(fvc::interpolate(U) & mesh.Sf())
- fvc::meshPhi(rho, U)
)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
// Store pressure for under-relaxation
p.storePrevIter();
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rho/UEqn.A(), p)
);
if
(
// oCorr == nOuterCorr - 1
corr == nCorr - 1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve
(
mesh.solutionDict().solver(p.name() + "Final")
);
}
else
{
pEqn.solve(mesh.solutionDict().solver(p.name()));
}
if (nonOrth == nNonOrthCorr)
{
phi = pEqn.flux();
}
// Bound the pressure
if (min(p) < pMin || max(p) > pMax)
{
p.max(pMin);
p.min(pMax);
p.correctBoundaryConditions();
}
// Relax the pressure
p.relax();
}
# include "compressibleContinuityErrs.H"
U -= fvc::grad(p)/UEqn.A();
U.correctBoundaryConditions();
# include "limitU.H"
}

View file

@ -77,10 +77,19 @@ int main(int argc, char *argv[])
} }
// Mesh motion update // Mesh motion update
// if (correctPhi && meshChanged) if (meshChanged)
// { {
T.correctBoundaryConditions();
p.correctBoundaryConditions();
e.correctBoundaryConditions();
thermo.correct();
rho = thermo.rho();
if (correctPhi)
{
// # include "correctPhi.H" // # include "correctPhi.H"
// } }
}
if (meshChanged) if (meshChanged)
{ {
@ -103,73 +112,7 @@ int main(int argc, char *argv[])
// --- PISO loop // --- PISO loop
for (int corr = 0; corr < nCorr; corr++) for (int corr = 0; corr < nCorr; corr++)
{ {
U = UEqn.H()/UEqn.A(); # include "pEqn.H"
# include "limitU.H"
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)*
(
(fvc::interpolate(U) & mesh.Sf())
- fvc::meshPhi(rho, U)
)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
// Store pressure for under-relaxation
p.storePrevIter();
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rho/UEqn.A(), p)
);
if
(
// oCorr == nOuterCorr - 1
corr == nCorr - 1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve
(
mesh.solutionDict().solver(p.name() + "Final")
);
}
else
{
pEqn.solve(mesh.solutionDict().solver(p.name()));
}
if (nonOrth == nNonOrthCorr)
{
phi = pEqn.flux();
}
// Bound the pressure
if (min(p) < pMin || max(p) > pMax)
{
p.max(pMin);
p.min(pMax);
p.correctBoundaryConditions();
}
// Relax the pressure
p.relax();
}
# include "compressibleContinuityErrs.H"
U -= fvc::grad(p)/UEqn.A();
U.correctBoundaryConditions();
# include "limitU.H"
} }
// Recalculate density // Recalculate density