Added rescue procedure on block solver divergence. Experimental

This commit is contained in:
Hrvoje Jasak 2017-02-06 11:47:00 +00:00
parent e98722db65
commit 6c01d9a6a8
2 changed files with 32 additions and 8 deletions

View file

@ -81,8 +81,30 @@ int main(int argc, char *argv[])
# include "couplingTerms.H"
// Solve the block matrix
maxResidual = cmptMax(UpEqn.solve().initialResidual());
residual = UpEqn.solve();
maxResidual = cmptMax(residual.initialResidual());
// Check for divergence
if (mag(residual.finalResidual() - residual.initialResidual()) > 1)
{
Info<< "DIVERGENCE: rescue step" << endl;
// Solving potential flow equation and correcting velocities
phi = (fvc::interpolate(U) & mesh.Sf());
solve
(
tpEqn
==
- fvc::div(U)
);
phi += tpEqn().flux() + tpresSource;
U = fvc::reconstruct(phi);
}
else
{
// Retrieve solution
UpEqn.retrieveSolution(0, U.internalField());
UpEqn.retrieveSolution(3, p.internalField());
@ -91,6 +113,7 @@ int main(int argc, char *argv[])
p.correctBoundaryConditions();
phi = (fvc::interpolate(U) & mesh.Sf()) + tpEqn().flux() + tpresSource;
}
// Make flux relative in rotating zones
mrfZones.relativeFlux(phi);

View file

@ -1,4 +1,5 @@
// initialize values for convergence checks
// initialize values for convergence checks
BlockSolverPerformance<vector4> residual;
scalar maxResidual = 0;
scalar convergenceCriterion = 0;