aboutsummaryrefslogtreecommitdiff
path: root/src/SymmetryCondition.F77
blob: 20e7aa572212be9d96cecdb9c182133fb0b4c45b (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "cctk.h"

/*@@
   @routine    SymmetryCondition
   @date       Mon Mar 15 15:51:57 1999
   @author     Gerd Lanfermann
   @desc 
               Routine performs the symmetry boundary operations.
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 
@@*/


      subroutine SymmetryCondition(nxyz,var,nghostzones,sym,doSym)

      implicit none

      integer i,j,k
      INTEGER nxyz(3)
      CCTK_REAL    var(nxyz(1),nxyz(2),nxyz(3))
      INTEGER nghostzones
      INTEGER sym(6)
      INTEGER doSym(6)
      
      INTEGER sw
      
c      Apply symmetry if 
c       * the grid chunk has a physical boundary (bbox)
c       * its size in a direction is bigger than one (sh)
c       * we actually want a symmetry (sx.ne.ESYM_UNSET)

      if (doSym(2) .eq. 1 .or. doSym(4) .eq. 1 .or. doSym(6) .eq. 1) then
	call CCTKi_NotYetImplemented("Right hand side boundary conditions")
      end if

      if (doSym(1) .eq. 1) then

         do sw=1, nghostzones
            do j=1,nxyz(2)
               do k=1,nxyz(3)
                  var(sw,j,k) = sym(1)*var(nghostzones+sw,j,k)
               end do
            end do
         end do

      end if

      if (doSym(3) .eq. 1) then

         do sw=1, nghostzones
            do i=1,nxyz(1)
               do k=1,nxyz(3)
                  var(i,sw,k) = sym(3)*var(i,nghostzones+sw,k) 
               end do
            end do
         end do

      end if

      if (doSym(5).eq.1) then

         do sw=1, nghostzones
            do i=1,nxyz(1)
               do j=1,nxyz(2)
                  var(i,j,sw) = sym(5)*var(i,j,nghostzones+sw)
               end do
            end do
         end do

      end if

      return
      end