From da92634ddb42c3ae2423269542f11756ff9dc309 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Wed, 11 May 2011 17:37:27 -0300 Subject: [PATCH] Use precomputed coordinates in init_blast(). --- src/problem.F90 | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/problem.F90 b/src/problem.F90 index 2c4f927..2492367 100644 --- a/src/problem.F90 +++ b/src/problem.F90 @@ -483,11 +483,12 @@ module problem ! !=============================================================================== ! - subroutine init_blast(pblock) + subroutine init_blast(pdata) use blocks , only : block_data - use config , only : in, jn, kn, im, jm, km, ng & - , gamma, dens, pres, ratio, rcut + use config , only : im, jm, km + use config , only : gamma, dens, pres, ratio, rcut + use coords , only : ax, ay, az use scheme , only : prim2cons use variables, only : nvr, nqt, idn, ivx, ivy, ivz #ifdef ADI @@ -502,13 +503,13 @@ 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 :: dx, dy, dz, r + real :: r ! local arrays ! @@ -519,24 +520,14 @@ module problem ! !------------------------------------------------------------------------------- ! -! 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.0d0 -#endif /* NDIMS == 3 */ - -! generate the coordinates -! - x(:) = ((/(i, i = 1, im)/) - ng - 0.5d0) * dx + pblock%meta%xmin - y(:) = ((/(j, j = 1, jm)/) - ng - 0.5d0) * dy + pblock%meta%ymin -#if NDIMS == 3 - z(:) = ((/(k, k = 1, km)/) - ng - 0.5d0) * dz + pblock%meta%zmin -#else /* NDIMS == 3 */ - z(1) = 0.0d0 + z(:) = 0.0d0 #endif /* NDIMS == 3 */ ! set the uniform variables @@ -587,7 +578,7 @@ module problem ! copy the conserved 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