From 50c3b4f3bf21665f233ece0b997513a0840c9a2f Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Thu, 12 May 2011 08:47:01 -0300 Subject: [PATCH] Use precomputed coordinates in init_multi_current_sheet(). --- src/problem.F90 | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/src/problem.F90 b/src/problem.F90 index 2492367..e787696 100644 --- a/src/problem.F90 +++ b/src/problem.F90 @@ -1020,15 +1020,16 @@ module problem ! !=============================================================================== ! - subroutine init_multi_current_sheet(pblock) + subroutine init_multi_current_sheet(pdata) use blocks , only : block_data - use config , only : in, jn, kn, im, jm, km, ng & - , xmin, xmax, dens, pres, bamp, vper, ydel + use config , only : im, jm, km + use config , only : xmin, xmax, dens, pres, bamp, vper, ydel #ifdef ISO use config , only : csnd2 #endif /* ISO */ use constants, only : dpi + use coords , only : ax, ay, az use mpitools , only : ncpu use random , only : randomn use scheme , only : prim2cons @@ -1046,13 +1047,12 @@ module problem ! input arguments ! - type(block_data), pointer, intent(inout) :: pblock + type(block_data), pointer, intent(inout) :: pdata ! local variables ! - integer(kind=4), dimension(3) :: dm integer :: i, j, k - real :: xlen, dx, dy, dz, yi, yt + real :: xlen, yi, yt #ifdef MHD real :: ptot, pmag #endif /* MHD */ @@ -1076,24 +1076,14 @@ module problem ptot = 0.5d0 * bamp * bamp #endif /* MHD */ -! calculate the cell sizes +! obtain block coordinates ! - dx = (pblock%meta%xmax - pblock%meta%xmin) / in - dy = (pblock%meta%ymax - pblock%meta%ymin) / jn + x(:) = pdata%meta%xmin + ax(pdata%meta%level,:) + y(:) = pdata%meta%ymin + ay(pdata%meta%level,:) #if NDIMS == 3 - dz = (pblock%meta%zmax - pblock%meta%zmin) / kn + z(:) = pdata%meta%zmin + az(pdata%meta%level,:) #else /* NDIMS == 3 */ - dz = 1.0 -#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 + z(:) = 0.0d0 #endif /* NDIMS == 3 */ ! set variables @@ -1162,7 +1152,7 @@ module problem ! 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