From c309145085faaa7f84deb0554323aa0f43d16fe2 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Fri, 11 Jul 2014 15:47:06 +0200 Subject: [PATCH] newton method: make the tolerance easily settable at run time The reason for this is to be able to modify the tolerance according to grid size: The NewtonTolerance parameter has been renamed to NewtonRawTolerance and for the porous media models is divided by the square root of the volume of the smallst finite volume in the grid to get the final tolerance for the Newton method. This is necessary because very large grids need to achive a higher volumetric accuracy in the residual than very small ones... --- examples/co2injection_flash_ecfv.cpp | 2 +- examples/co2injection_flash_ni_ecfv.cpp | 2 +- examples/co2injection_flash_ni_vcfv.cpp | 2 +- examples/co2injection_flash_vcfv.cpp | 2 +- examples/problems/infiltrationproblem.hh | 3 --- examples/problems/stokesnitestproblem.hh | 4 ++-- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/examples/co2injection_flash_ecfv.cpp b/examples/co2injection_flash_ecfv.cpp index e2a2624b0..2f0564657 100644 --- a/examples/co2injection_flash_ecfv.cpp +++ b/examples/co2injection_flash_ecfv.cpp @@ -51,7 +51,7 @@ SET_TYPE_PROP( #if HAVE_QUAD SET_TYPE_PROP(Co2InjectionFlashEcfvProblem, Scalar, quad); #else -SET_SCALAR_PROP(Co2InjectionFlashEcfvProblem, NewtonTolerance, 1e-5); +SET_SCALAR_PROP(Co2InjectionFlashEcfvProblem, NewtonRawTolerance, 1e-5); #endif } // namespace Properties } // namespace Opm diff --git a/examples/co2injection_flash_ni_ecfv.cpp b/examples/co2injection_flash_ni_ecfv.cpp index 2655fd04e..972a2bdf2 100644 --- a/examples/co2injection_flash_ni_ecfv.cpp +++ b/examples/co2injection_flash_ni_ecfv.cpp @@ -50,7 +50,7 @@ SET_TYPE_PROP( #if HAVE_QUAD SET_TYPE_PROP(Co2InjectionFlashNiEcfvProblem, Scalar, quad); #else -SET_SCALAR_PROP(Co2InjectionFlashNiEcfvProblem, NewtonTolerance, 1e-5); +SET_SCALAR_PROP(Co2InjectionFlashNiEcfvProblem, NewtonRawTolerance, 1e-5); #endif } } diff --git a/examples/co2injection_flash_ni_vcfv.cpp b/examples/co2injection_flash_ni_vcfv.cpp index 4cc676bbc..ed9b720a5 100644 --- a/examples/co2injection_flash_ni_vcfv.cpp +++ b/examples/co2injection_flash_ni_vcfv.cpp @@ -50,7 +50,7 @@ SET_TYPE_PROP( #if HAVE_QUAD SET_TYPE_PROP(Co2InjectionFlashNiVcfvProblem, Scalar, quad); #else -SET_SCALAR_PROP(Co2InjectionFlashNiVcfvProblem, NewtonTolerance, 1e-5); +SET_SCALAR_PROP(Co2InjectionFlashNiVcfvProblem, NewtonRawTolerance, 1e-5); #endif } } diff --git a/examples/co2injection_flash_vcfv.cpp b/examples/co2injection_flash_vcfv.cpp index 47c73f63a..a39f4996d 100644 --- a/examples/co2injection_flash_vcfv.cpp +++ b/examples/co2injection_flash_vcfv.cpp @@ -51,7 +51,7 @@ SET_TYPE_PROP( #if HAVE_QUAD SET_TYPE_PROP(Co2InjectionFlashVcfvProblem, Scalar, quad); #else -SET_SCALAR_PROP(Co2InjectionFlashVcfvProblem, NewtonTolerance, 1e-5); +SET_SCALAR_PROP(Co2InjectionFlashVcfvProblem, NewtonRawTolerance, 1e-5); #endif } // namespace Properties } // namespace Opm diff --git a/examples/problems/infiltrationproblem.hh b/examples/problems/infiltrationproblem.hh index 7e7e11b64..7231f2268 100644 --- a/examples/problems/infiltrationproblem.hh +++ b/examples/problems/infiltrationproblem.hh @@ -68,9 +68,6 @@ SET_BOOL_PROP(InfiltrationBaseProblem, EnableGravity, true); // Write newton convergence? SET_BOOL_PROP(InfiltrationBaseProblem, NewtonWriteConvergence, false); -// Maximum tolerated error in the Newton method -SET_SCALAR_PROP(InfiltrationBaseProblem, NewtonTolerance, 1e-8); - // -1 backward differences, 0: central differences, +1: forward differences SET_INT_PROP(InfiltrationBaseProblem, NumericDifferenceMethod, 1); diff --git a/examples/problems/stokesnitestproblem.hh b/examples/problems/stokesnitestproblem.hh index a9588842d..d9006e746 100644 --- a/examples/problems/stokesnitestproblem.hh +++ b/examples/problems/stokesnitestproblem.hh @@ -70,8 +70,8 @@ SET_SCALAR_PROP(StokesNiTestProblem, EndTime, 3.0); // Default initial time step size [s] SET_SCALAR_PROP(StokesNiTestProblem, InitialTimeStepSize, 0.1); -// Default tolerance of the Newton-Raphson method -SET_SCALAR_PROP(StokesNiTestProblem, NewtonTolerance, 1e-4); +// Increase the default raw tolerance of the Newton-Raphson method to 10^-4 +SET_SCALAR_PROP(StokesNiTestProblem, NewtonRawTolerance, 1e-4); // Default grid file to load SET_STRING_PROP(StokesNiTestProblem, GridFile, "data/test_stokes2cni.dgf");