diff --git a/sources/evolution.F90 b/sources/evolution.F90 index 5527123..2a5024c 100644 --- a/sources/evolution.F90 +++ b/sources/evolution.F90 @@ -1194,11 +1194,7 @@ module evolution real(kind=8) :: dx_min, fnorm, h0, h1 real(kind=8), dimension(3) :: d -#if NDIMS == 3 - real(kind=8), dimension(nf,nc,nc,nc) :: sc, df -#else /* NDIMS == 3 */ - real(kind=8), dimension(nf,nc,nc, 1) :: sc, df -#endif /* NDIMS == 3 */ + real(kind=8), dimension(:,:,:,:), allocatable :: sc, df real(kind=8), parameter :: eps = tiny(cmax) @@ -1246,6 +1242,20 @@ module evolution ! if (error_control) then +#if NDIMS == 3 + allocate(sc(nf,nc,nc,nc),df(nf,nc,nc,nc), stat=status) +#else /* NDIMS == 3 */ + allocate(sc(nf,nc,nc, 1),df(nf,nc,nc, 1), stat=status) +#endif /* NDIMS == 3 */ +#ifdef MPI + call reduce_maximum(status) +#endif /* MPI */ + if (status > 0) then + write(error_unit,"('[',a,']: ',a)") trim(loc), & + "Cannot allocate memory for the time step estimation!" + go to 100 + end if + fnorm = 1.0d+00 / (get_nleafs() * nc**NDIMS) d(:) = 0.0d+00 @@ -1363,6 +1373,11 @@ module evolution end if + if (allocated(sc)) deallocate(sc) + if (allocated(df)) deallocate(df) + + 100 continue + end if #ifdef PROFILE