28 | | Info%q(i,j,k,iBx) = half * (Info%aux(i,j,k,1) + Info%aux(i+1,j,k,1)) |
29 | | Info%q(i,j,k,iBy) = half * (Info%aux(i,j,k,1) + Info%aux(i,j+1,k,2)) |
30 | | Info%q(i,j,k,iBz) = half * (Info%aux(i,j,k,1) + Info%aux(i,j,k+1,3)) |
| 28 | dx = (/(merge(1d0,0d0,nDim >= i),i=1,3)/)*levels(Info%level)%dx |
| 29 | |
| 30 | DO i=1, Info%mX(1) |
| 31 | x = Info%xBounds(1,1)+(REAL(i)-.5d0)*dx(1) |
| 32 | DO j=1, Info%mX(2) |
| 33 | y = Info%xBounds(2,1)+(REAL(j)-.5d0)*dx(2) |
| 34 | DO k=1, Info%mX(3) |
| 35 | z = Info%xBounds(3,1)+(REAL(k)-.5d0)*dx(3) |
| 36 | Info%q(i,j,k,iBx)=Bx(x,y,z) |
| 37 | Info%q(i,j,k,iBy)=By(x,y,z) |
| 38 | Info%q(i,j,k,iBz)=Bz(x,y,z) |
| 39 | END DO |
| 40 | END DO |
| 41 | END DO |
| 42 | |
| 43 | IF (MaintainAuxArrays) THEN |
| 44 | IF (nDim >= 1) THEN |
| 45 | !Note the +1 in the i loop DO statement and the -1d0 in |
| 46 | !the x coordinate calculation instead of -.5d0 |
| 47 | DO i=1, Info%mX(1) |
| 48 | x = Info%xBounds(1,1)+(REAL(i)-1d0)*dx(1) |
| 49 | DO j=1, Info%mX(2)+1 |
| 50 | y = Info%xBounds(2,1)+(REAL(j)-.5d0)*dx(2) |
| 51 | DO k=1, Info%mX(3) |
| 52 | z = Info%xBounds(3,1)+(REAL(k)-.5d0)*dx(3) |
| 53 | Info%aux(i,j,k,1)=Bx(x,y,z) |
| 54 | END DO |
| 55 | END DO |
| 56 | END DO |
| 57 | |
| 58 | !Now we can update the cell centered value with the adjacent face average |
| 59 | Info%q(1:Info%mX(1),1:Info%mX(2),1:Info%mX(3),iBx)=.5d0 * (& |
| 60 | Info%aux(1:Info%mX(1),1:Info%mX(2),1:Info%mX(3),1) + & |
| 61 | Info%aux(2:Info%mX(1)+1,1:Info%mX(2),1:Info%mX(3),1) ) |
| 62 | |
| 63 | |
| 64 | IF (nDim >= 2) THEN |
| 65 | !Note the +1 in the j loop DO statement and the -1d0 in |
| 66 | !the y coordinate calculation instead of -.5d0 |
| 67 | DO i=1, Info%mX(1) |
| 68 | x = Info%xBounds(1,1)+(REAL(i)-.5d0)*dx(1) |
| 69 | DO j=1, Info%mX(2)+1 |
| 70 | y = Info%xBounds(2,1)+(REAL(j)-1d0)*dx(2) |
| 71 | DO k=1, Info%mX(3) |
| 72 | z = Info%xBounds(3,1)+(REAL(k)-.5d0)*dx(3) |
| 73 | Info%aux(i,j,k,2)=By(x,y,z) |
| 74 | END DO |
| 75 | END DO |
| 76 | END DO |
| 77 | |
| 78 | !Now we can update the cell centered value with the adjacent face average |
| 79 | Info%q(1:Info%mX(1),1:Info%mX(2),1:Info%mX(3),iBy)=.5d0 * (& |
| 80 | Info%aux(1:Info%mX(1),1:Info%mX(2),1:Info%mX(3),2) + & |
| 81 | Info%aux(1:Info%mX(1),2:Info%mX(2)+1,1:Info%mX(3),2) ) |
| 82 | |
| 83 | IF (nDim >= 3) THEN |
| 84 | !Note the +1 in the k loop DO statement and the -1d0 in |
| 85 | !the z coordinate calculation instead of -.5d0 |
| 86 | DO i=1, Info%mX(1) |
| 87 | x = Info%xBounds(1,1)+(REAL(i)-.5d0)*dx(1) |
| 88 | DO j=1, Info%mX(2) |
| 89 | y = Info%xBounds(2,1)+(REAL(j)-.5d0)*dx(2) |
| 90 | DO k=1, Info%mX(3)+1 |
| 91 | z = Info%xBounds(3,1)+(REAL(k)-1d0)*dx(3) |
| 92 | Info%aux(i,j,k,3)=Bz(x,y,z) |
| 93 | END DO |
| 94 | END DO |
| 95 | END DO |
| 96 | |
| 97 | !Now we can update the cell centered value with the adjacent face average |
| 98 | Info%q(1:Info%mX(1),1:Info%mX(2),1:Info%mX(3),iBz)=.5d0 * (& |
| 99 | Info%aux(1:Info%mX(1),1:Info%mX(2),1:Info%mX(3),3) + & |
| 100 | Info%aux(1:Info%mX(1),1:Info%mX(2),2:Info%mX(3)+1,3) ) |
| 101 | END IF |
| 102 | END IF |
| 103 | END IF |
| 104 | END IF |