ODESolvers: Updated tolerance handling to use absolute and relative

This commit is contained in:
Henry
2013-11-03 16:04:05 +00:00
parent b1c955337f
commit 17ae13c9c1
9 changed files with 25 additions and 10 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -40,7 +40,7 @@ Foam::ODESolver::ODESolver(const ODESystem& ode, const dictionary& dict)
: :
n_(ode.nEqns()), n_(ode.nEqns()),
absTol_(n_, dict.lookupOrDefault<scalar>("absTol", SMALL)), absTol_(n_, dict.lookupOrDefault<scalar>("absTol", SMALL)),
relTol_(n_, dict.lookupOrDefault<scalar>("relTol", 1e-6)), relTol_(n_, dict.lookupOrDefault<scalar>("relTol", 1e-4)),
maxSteps_(10000) maxSteps_(10000)
{} {}

View File

@ -86,7 +86,15 @@ void Foam::adaptiveSolver::solve
y = yTemp_; y = yTemp_;
// If the error is small increase the step-size // If the error is small increase the step-size
dxTry = min(max(safeScale_*pow(err, -alphaInc_), minScale_), maxScale_)*dx; if (err > pow(maxScale_/safeScale_, -1.0/alphaInc_))
{
dxTry =
min(max(safeScale_*pow(err, -alphaInc_), minScale_), maxScale_)*dx;
}
else
{
dxTry = safeScale_*maxScale_*dx;
}
} }

View File

@ -34,7 +34,8 @@ EulerImplicitCoeffs
odeCoeffs odeCoeffs
{ {
solver KRR4; solver KRR4;
eps 0.05; absTol 1e-12;
relTol 0.01;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -34,7 +34,8 @@ EulerImplicitCoeffs
odeCoeffs odeCoeffs
{ {
solver SIBS; solver SIBS;
eps 0.01; absTol 1e-12;
relTol 1e-4;
} }

View File

@ -28,7 +28,8 @@ initialChemicalTimeStep 1e-10;
odeCoeffs odeCoeffs
{ {
solver SIBS; solver SIBS;
eps 0.001; absTol 1e-12;
relTol 1e-2;
} }

View File

@ -28,7 +28,8 @@ initialChemicalTimeStep 1e-10;
odeCoeffs odeCoeffs
{ {
solver SIBS; solver SIBS;
eps 1e-03; absTol 1e-12;
relTol 1e-3;
} }

View File

@ -28,7 +28,8 @@ initialChemicalTimeStep 1e-10;
odeCoeffs odeCoeffs
{ {
solver SIBS; solver SIBS;
eps 1e-04; absTol 1e-14;
relTol 1e-4;
} }

View File

@ -28,7 +28,8 @@ initialChemicalTimeStep 1e-07;
odeCoeffs odeCoeffs
{ {
solver SIBS; solver SIBS;
eps 0.05; absTol 1e-12;
relTol 0.01;
} }

View File

@ -34,7 +34,8 @@ EulerImplicitCoeffs
odeCoeffs odeCoeffs
{ {
solver KRR4; solver KRR4;
eps 0.05; absTol 1e-12;
relTol 0.01;
} }
// ************************************************************************* // // ************************************************************************* //