diff options
-rwxr-xr-x | Examples/Tests/Langmuir/analysis_langmuir2d.py | 9 | ||||
-rw-r--r-- | Regression/WarpX-tests.ini | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/Examples/Tests/Langmuir/analysis_langmuir2d.py b/Examples/Tests/Langmuir/analysis_langmuir2d.py index 87e3e5b33..1ffe39e69 100755 --- a/Examples/Tests/Langmuir/analysis_langmuir2d.py +++ b/Examples/Tests/Langmuir/analysis_langmuir2d.py @@ -34,9 +34,9 @@ it = int(fn[-5:]) # Machine precision of the simulation if ds.index._dtype == "float32": - dfloat = 1.e-4 # single: ok, just a somewhat larger than 1.e-6 + dfloat = 0.7e-4 # single: ok, just somewhat larger than 1.e-6 (6 digits) else: - dfloat = 1.e-14 # double: ok, just a little larger than 1.e-15 + dfloat = 2.0e-14 # double: ok, just a little larger than 1.e-15 (15 digits) # Check the Jx field, which oscillates at wp j_predicted = -n0*e*c*ux*np.cos( wp*t*(it-0.5)/it ) # j at half-timestep @@ -55,8 +55,11 @@ Ex = data['Ex'].to_ndarray() print( "relative error: np.max( np.abs( ( Ex[:32,:,0] - E_predicted ) / E_predicted ) ) = %s" \ %np.max( np.abs( ( Ex[:32,:,0] - E_predicted ) / E_predicted ) ) ) assert np.allclose( Ex[:32,:,0], E_predicted, rtol=0.1 ) +# predicted values should be zero here, but floating-point noise from E_predicted areas will sneak in print( "absolute error: np.max( np.abs( Ex[32:,:,0] ) ) = %s" %np.max( np.abs( Ex[32:,:,0] ) ) ) -assert np.allclose( Ex[32:,:,0], 0, atol=np.abs(E_predicted)*dfloat ) +float_noise_zero = np.max( np.abs( E_predicted * dfloat ) ) +print( "float_noise_zero = %s" % float_noise_zero ) +assert np.allclose( Ex[32:,:,0], 0., atol=float_noise_zero ) # Save an image to be displayed on the website t_plot = np.linspace(0.0, t, 200) diff --git a/Regression/WarpX-tests.ini b/Regression/WarpX-tests.ini index 532348a72..efc5b52a6 100644 --- a/Regression/WarpX-tests.ini +++ b/Regression/WarpX-tests.ini @@ -356,7 +356,7 @@ particleTypes = electrons positrons analysisRoutine = Examples/Tests/Langmuir/analysis_langmuir_multi.py analysisOutputImage = langmuir_multi_analysis.png -[Langmuir_multi_single] +[Langmuir_multi_single_precision] buildDir = . inputFile = Examples/Tests/Langmuir/inputs_3d_multi_rt dim = 3 |