Use precomputed coordinates in init_multi_current_sheet().

This commit is contained in:
Grzegorz Kowal 2011-05-12 08:47:01 -03:00
parent da92634ddb
commit 50c3b4f3bf

View File

@ -1020,15 +1020,16 @@ module problem
! !
!=============================================================================== !===============================================================================
! !
subroutine init_multi_current_sheet(pblock) subroutine init_multi_current_sheet(pdata)
use blocks , only : block_data use blocks , only : block_data
use config , only : in, jn, kn, im, jm, km, ng & use config , only : im, jm, km
, xmin, xmax, dens, pres, bamp, vper, ydel use config , only : xmin, xmax, dens, pres, bamp, vper, ydel
#ifdef ISO #ifdef ISO
use config , only : csnd2 use config , only : csnd2
#endif /* ISO */ #endif /* ISO */
use constants, only : dpi use constants, only : dpi
use coords , only : ax, ay, az
use mpitools , only : ncpu use mpitools , only : ncpu
use random , only : randomn use random , only : randomn
use scheme , only : prim2cons use scheme , only : prim2cons
@ -1046,13 +1047,12 @@ module problem
! input arguments ! input arguments
! !
type(block_data), pointer, intent(inout) :: pblock type(block_data), pointer, intent(inout) :: pdata
! local variables ! local variables
! !
integer(kind=4), dimension(3) :: dm
integer :: i, j, k integer :: i, j, k
real :: xlen, dx, dy, dz, yi, yt real :: xlen, yi, yt
#ifdef MHD #ifdef MHD
real :: ptot, pmag real :: ptot, pmag
#endif /* MHD */ #endif /* MHD */
@ -1076,24 +1076,14 @@ module problem
ptot = 0.5d0 * bamp * bamp ptot = 0.5d0 * bamp * bamp
#endif /* MHD */ #endif /* MHD */
! calculate the cell sizes ! obtain block coordinates
! !
dx = (pblock%meta%xmax - pblock%meta%xmin) / in x(:) = pdata%meta%xmin + ax(pdata%meta%level,:)
dy = (pblock%meta%ymax - pblock%meta%ymin) / jn y(:) = pdata%meta%ymin + ay(pdata%meta%level,:)
#if NDIMS == 3 #if NDIMS == 3
dz = (pblock%meta%zmax - pblock%meta%zmin) / kn z(:) = pdata%meta%zmin + az(pdata%meta%level,:)
#else /* NDIMS == 3 */ #else /* NDIMS == 3 */
dz = 1.0 z(:) = 0.0d0
#endif /* NDIMS == 3 */
! generate the coordinates
!
x(:) = ((/(i, i = 1, im)/) - ng - 0.5) * dx + pblock%meta%xmin
y(:) = ((/(j, j = 1, jm)/) - ng - 0.5) * dy + pblock%meta%ymin
#if NDIMS == 3
z(:) = ((/(k, k = 1, km)/) - ng - 0.5) * dz + pblock%meta%zmin
#else /* NDIMS == 3 */
z(1) = 0.0
#endif /* NDIMS == 3 */ #endif /* NDIMS == 3 */
! set variables ! set variables
@ -1162,7 +1152,7 @@ module problem
! copy conservative variables to the current block ! copy conservative variables to the current block
! !
pblock%u(1:nqt,1:im,j,k) = u(1:nqt,1:im) pdata%u(1:nqt,1:im,j,k) = u(1:nqt,1:im)
end do end do
end do end do