Skip to content

Commit e9f7d19

Browse files
author
Damian Rouson
committed
Make co_heat test numerically stable & stricter
Due to an overly fine grid and an explicit time step, the co_heat test was previously unstable. Furthermore, due to a lax test, previously reported results were false positives. This commit increases the grid spacing, thereby improving stability and adds additional checks on the result. My best guess on why this issue is just cropping up is that GCC 8 must be much slower on arithmetic involving IEEE NaN values so the test now fails for all attempted values of the ctest --timeout argument.
1 parent bdff1d1 commit e9f7d19

File tree

1 file changed

+7
-2
lines changed
  • src/tests/integration/pde_solvers/coarrayHeatSimplified

1 file changed

+7
-2
lines changed

src/tests/integration/pde_solvers/coarrayHeatSimplified/main.f90

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@
2626
!
2727

2828
program main
29+
use IEEE_arithmetic, only : IEEE_is_NaN
2930
use global_field_module, only : global_field
3031
implicit none
3132
type(global_field) :: T,laplacian_T,T_half
3233
real, parameter :: alpha=1.,dt=0.0001,final_time=1.,tolerance=1.E-3
3334
real :: time=0.
34-
call T%global_field_(internal_values=0.,boundary_values=[1.,0.],domain=[0.,1.],num_global_points=16384)
35+
call T%global_field_(internal_values=0.,boundary_values=[1.,0.],domain=[0.,1.],num_global_points=32)
3536
call T_half%global_field_()
3637
do while(time<final_time)
3738
T_half = T + (.laplacian.T)*(alpha*dt/2.)
@@ -40,6 +41,10 @@ program main
4041
end do
4142
call laplacian_T%global_field_()
4243
laplacian_T = .laplacian.T
43-
if (any(laplacian_T%state()>tolerance)) error stop "Test failed."
44+
block
45+
real, allocatable :: residual(:)
46+
residual = laplacian_T%state()
47+
if ( any(residual>tolerance) .or. any(IEEE_is_NaN(residual)) .or. any(residual<0) ) error stop "Test failed."
48+
end block
4449
if (this_image()==1) print *,"Test passed."
4550
end program

0 commit comments

Comments
 (0)