mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ODESolvers: Updated tolerance handling to use absolute and relative
This commit is contained in:
@ -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)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,8 @@ EulerImplicitCoeffs
|
|||||||
odeCoeffs
|
odeCoeffs
|
||||||
{
|
{
|
||||||
solver KRR4;
|
solver KRR4;
|
||||||
eps 0.05;
|
absTol 1e-12;
|
||||||
|
relTol 0.01;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -34,7 +34,8 @@ EulerImplicitCoeffs
|
|||||||
odeCoeffs
|
odeCoeffs
|
||||||
{
|
{
|
||||||
solver SIBS;
|
solver SIBS;
|
||||||
eps 0.01;
|
absTol 1e-12;
|
||||||
|
relTol 1e-4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,8 @@ initialChemicalTimeStep 1e-10;
|
|||||||
odeCoeffs
|
odeCoeffs
|
||||||
{
|
{
|
||||||
solver SIBS;
|
solver SIBS;
|
||||||
eps 0.001;
|
absTol 1e-12;
|
||||||
|
relTol 1e-2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,8 @@ initialChemicalTimeStep 1e-10;
|
|||||||
odeCoeffs
|
odeCoeffs
|
||||||
{
|
{
|
||||||
solver SIBS;
|
solver SIBS;
|
||||||
eps 1e-03;
|
absTol 1e-12;
|
||||||
|
relTol 1e-3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,8 @@ initialChemicalTimeStep 1e-10;
|
|||||||
odeCoeffs
|
odeCoeffs
|
||||||
{
|
{
|
||||||
solver SIBS;
|
solver SIBS;
|
||||||
eps 1e-04;
|
absTol 1e-14;
|
||||||
|
relTol 1e-4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,8 @@ initialChemicalTimeStep 1e-07;
|
|||||||
odeCoeffs
|
odeCoeffs
|
||||||
{
|
{
|
||||||
solver SIBS;
|
solver SIBS;
|
||||||
eps 0.05;
|
absTol 1e-12;
|
||||||
|
relTol 0.01;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,8 @@ EulerImplicitCoeffs
|
|||||||
odeCoeffs
|
odeCoeffs
|
||||||
{
|
{
|
||||||
solver KRR4;
|
solver KRR4;
|
||||||
eps 0.05;
|
absTol 1e-12;
|
||||||
|
relTol 0.01;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user