aboutsummaryrefslogtreecommitdiff
path: root/CarpetExtra/WaveToyMoL/src/estimateerror.F77
blob: 33e5b602fa178f8d52b131a737f23b4b145bf113 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
c     $Header: /home/eschnett/C/carpet/Carpet/CarpetExtra/WaveToyMoL/src/estimateerror.F77,v 1.1 2004/04/07 17:08:21 schnetter Exp $

#include "cctk.h"
#include "cctk_Arguments.h"
#include "cctk_Functions.h"
#include "cctk_Parameters.h"

      subroutine WaveToyMoL_EstimateError (CCTK_ARGUMENTS)
      implicit none
      DECLARE_CCTK_ARGUMENTS
      DECLARE_CCTK_FUNCTIONS
      DECLARE_CCTK_PARAMETERS
      CCTK_INT bndwidth
      parameter (bndwidth = 1)
      integer imin(3), imax(3)
      CCTK_REAL dx(3)
      integer i, j, k
      integer d
      do d=1,3
         imin(d) = 1+bndwidth
         imax(d) = cctk_lsh(d)-bndwidth
      end do
      do d=1,3
         dx(d) = CCTK_DELTA_SPACE(3)
      end do
      do k=imin(3),imax(3)
         do j=imin(2),imax(2)
            do i=imin(1),imax(1)
               error(i,j,k) = max (
     $              abs(phi(i+1,j,k) - phi(i-1,j,k)),
     $              abs(phi(i,j+1,k) - phi(i,j-1,k)),
     $              abs(phi(i,j,k+1) - phi(i,j,k-1)))
            end do
         end do
      end do
      end

      subroutine WaveToyMoL_EstimateErrorBoundaries (CCTK_ARGUMENTS)
      implicit none
      DECLARE_CCTK_ARGUMENTS
      DECLARE_CCTK_FUNCTIONS
      DECLARE_CCTK_PARAMETERS
      CCTK_INT bndwidth
      parameter (bndwidth = 1)
      integer ierr
      ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, bndwidth, -1,
     $     "WaveToyMoL::scalarevolveerrorestimate", "scalar");
      if (ierr.ne.0) call CCTK_WARN (0, "internal error")
      end