EVOLUTION: Slightly rewrite evolve_euler().

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2014-09-13 09:53:40 -03:00
parent b5d1896d30
commit 2c359fd5f2

View File

@ -432,6 +432,12 @@ module evolution
! Subroutine advances the solution by one time step using the 1st order
! Euler integration method.
!
! References:
!
! [1] Press, W. H, Teukolsky, S. A., Vetterling, W. T., Flannery, B. P.,
! "Numerical Recipes in Fortran",
! Cambridge University Press, Cambridge, 1992
!
!===============================================================================
!
subroutine evolve_euler()
@ -453,7 +459,7 @@ module evolution
! local pointers
!
type(block_data), pointer :: pblock
type(block_data), pointer :: pdata
! local arrays
!
@ -461,40 +467,44 @@ module evolution
!
!-------------------------------------------------------------------------------
!
! update fluxes for the first step of the RK2 integration
! update fluxes
!
call update_fluxes()
! update the solution using numerical fluxes stored in the data blocks
! assign pdata with the first block on the data block list
!
pblock => list_data
do while (associated(pblock))
pdata => list_data
! calculate variable increment for the current block
! iterate over all data blocks
!
call update_increment(pblock, du(:,:,:,:))
do while (associated(pdata))
! add source terms
! calculate the variable increment
!
call update_sources(pblock, du(:,:,:,:))
call update_increment(pdata, du(1:nv,1:im,1:jm,1:km))
! update the solution for the fluid variables
! add the source terms
!
pblock%u0(1:nv,:,:,:) = pblock%u0(1:nv,:,:,:) + dt * du(1:nv,:,:,:)
call update_sources(pdata, du(1:nv,1:im,1:jm,1:km))
! update the solution
!
pdata%u0(1:nv,1:im,1:jm,1:km) = pdata%u0(1:nv,1:im,1:jm,1:km) &
+ dt * du(1:nv,1:im,1:jm,1:km)
! update the conservative variable pointer
!
pblock%u => pblock%u0
pdata%u => pdata%u0
! update ψ by its source term
! update ψ with its source term
!
if (ibp > 0) pblock%u(ibp,:,:,:) = decay * pblock%u(ibp,:,:,:)
if (ibp > 0) pdata%u(ibp,:,:,:) = decay * pdata%u(ibp,:,:,:)
! assign pointer to the next block
! assign pdata to the next block
!
pblock => pblock%next
pdata => pdata%next
end do
end do ! over data blocks
! update primitive variables
!