From 2e26d47362c9efa819f9221befb54498a5b677d7 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Tue, 31 Jul 2012 14:14:42 -0300 Subject: [PATCH] Add two arrays of conserved variables to the block structure. In these two arrays we store temporary states during the Runge-Kutta integration. The new pointer %u in the block structure points to the current array of the conservative variables. --- src/blocks.F90 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/blocks.F90 b/src/blocks.F90 index b0e148a..2b3e4a6 100644 --- a/src/blocks.F90 +++ b/src/blocks.F90 @@ -134,10 +134,14 @@ module blocks ! type(block_meta), pointer :: meta - ! an allocatable array to store all conserved + ! a pointer to the array conserved variables + ! + real, dimension(:,:,:,:) , pointer :: u + + ! an allocatable arrays to store all conserved ! variables ! - real, dimension(:,:,:,:) , allocatable :: u + real, dimension(:,:,:,:) , allocatable :: u0, u1 ! an allocatable array to store all primitive ! variables @@ -1040,12 +1044,17 @@ module blocks ! allocate space for conserved variables ! - allocate(pdata%u(nvars,nx,ny,nz)) + allocate(pdata%u0(nvars,nx,ny,nz)) + allocate(pdata%u1(nvars,nx,ny,nz)) ! allocate space for primitive variables ! allocate(pdata%q(nvars,nx,ny,nz)) +! initiate the array pointer +! + pdata%u => pdata%u0 + ! allocate space for the numerical fluxes ! if (nflux .gt. 0) allocate(pdata%f(ndims,nflux,nx,ny,nz)) @@ -1097,7 +1106,8 @@ module blocks ! deallocate conservative variables ! - if (allocated(pdata%u)) deallocate(pdata%u) + if (allocated(pdata%u0)) deallocate(pdata%u0) + if (allocated(pdata%u1)) deallocate(pdata%u1) ! deallocate primitive variables ! @@ -1109,6 +1119,7 @@ module blocks ! nullify pointers ! + nullify(pdata%u) nullify(pdata%next) nullify(pdata%prev) nullify(pdata%meta)