diff --git a/sources/evolution.F90 b/sources/evolution.F90 index 94a0d30..852212a 100644 --- a/sources/evolution.F90 +++ b/sources/evolution.F90 @@ -4205,15 +4205,23 @@ module evolution integer, intent(in) :: nh, nl - integer :: l, n, p - real(kind=8) :: fnorm, err - type(block_data), pointer :: pdata + integer :: l, n, p + real(kind=8) :: err + + logical , save :: first = .true. + real(kind=8), save :: fnorm = 1.0d+00 + !------------------------------------------------------------------------------- ! + if (first) then + fnorm = 1.0d+00 / ncells**NDIMS + + first = .false. + end if + errors(:) = 0.0d+00 - fnorm = 1.0d+00 / (get_nleafs() * ncells**NDIMS) n = get_dblocks() @@ -4233,7 +4241,7 @@ module evolution abs(pdata%uu(p,nb:ne,nb:ne, : ,nl)))))**2) #endif /* NDIMS == 3 */ !$omp atomic update - errors(p) = errors(p) + err + errors(p) = errors(p) + fnorm * err end do end do !$omp end parallel do @@ -4242,7 +4250,7 @@ module evolution call reduce_sum(errors) #endif /* MPI */ - errors(:) = sqrt(fnorm * errors(:)) + errors(:) = sqrt(errors(:) / get_nleafs()) !------------------------------------------------------------------------------- ! diff --git a/sources/io.F90 b/sources/io.F90 index 5e9928f..7fd905c 100644 --- a/sources/io.F90 +++ b/sources/io.F90 @@ -2420,7 +2420,8 @@ module io 'compressed_size', csize) allocate(buffer(csize)) - open (newunit=io, file=file_path, access='stream', action='read') + open (newunit=io, file=file_path, access='stream', & + status='old', action='read') read (io) buffer close (io) @@ -2474,7 +2475,8 @@ module io end if else - open (newunit=io, file=file_path, access='stream', action='read') + open (newunit=io, file=file_path, access='stream', & + status='old', action='read') read (io) array close (io) end if @@ -2611,7 +2613,8 @@ module io filename = trim(array_file) // '.bin' // file_suffix filepath = trim(data_path) // trim(filename) - open (newunit=io, file=filepath, access='stream') + open (newunit=io, file=filepath, access='stream', & + action='write', status='replace') write (io) buffer(1:cbytes) close (io) @@ -2646,7 +2649,8 @@ module io filename = trim(array_file) // '.bin' filepath = trim(data_path) // trim(filename) - open (newunit=io, file=filepath, access='stream') + open (newunit=io, file=filepath, access='stream', & + action='write', status='replace') write (io) array close (io) @@ -5191,7 +5195,7 @@ module io write (fname, "('p',i6.6,'_',i5.5,'.xdmf')") isnap, nproc write (hname, "('p',i6.6,'_',i5.5,'.h5' )") isnap, nproc - open (unit = xdmf, file = fname, status = 'replace') + open (unit=xdmf, file=fname, status='replace') ! write the header ! @@ -5379,7 +5383,7 @@ module io ! write (fname, "('p',i6.6,'.xdmf')") isnap - open (unit = xdmf, file = fname, status = 'replace') + open (unit=xdmf, file=fname, status='replace') ! write the header ! diff --git a/sources/statistics.F90 b/sources/statistics.F90 index 722a38f..aa2b849 100644 --- a/sources/statistics.F90 +++ b/sources/statistics.F90 @@ -142,15 +142,15 @@ module statistics track_statistics = .false. end select + call get_parameter("statistics_interval", iintd) + iintd = max(1, iintd) + ! only master process writes the files to the disk ! if (master) then ! process parameters ! - call get_parameter("statistics_interval", iintd) - iintd = max(1, iintd) - stmp = "off" call get_parameter("statistics_append", stmp) select case(trim(stmp))