!!***************************************************************************** !! !! module: evolution - handling the time evolution of the block structure !! !! Copyright (C) 2008 Grzegorz Kowal !! !!***************************************************************************** !! !! This file is part of Godunov-AMR. !! !! Godunov-AMR is free software; you can redistribute it and/or modify !! it under the terms of the GNU General Public License as published by !! the Free Software Foundation; either version 3 of the License, or !! (at your option) any later version. !! !! Godunov-AMR is distributed in the hope that it will be useful, !! but WITHOUT ANY WARRANTY; without even the implied warranty of !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the !! GNU General Public License for more details. !! !! You should have received a copy of the GNU General Public License !! along with this program. If not, see . !! !!***************************************************************************** !! ! module evolution implicit none integer, save :: n real , save :: t, dt, dtn contains ! !=============================================================================== ! ! evolve: subroutine sweeps over all leaf blocks and performs one step time ! evolution for each according to the selected integration scheme ! !=============================================================================== ! subroutine evolve use blocks, only : block, plist implicit none ! local variables ! type(block), pointer :: pblock ! !------------------------------------------------------------------------------- ! ! iterate over all blocks and perform one step of time evolution ! pblock => plist do while (associated(pblock)) ! check if this block is a leaf ! #ifdef RK2 if (pblock%leaf .eq. 'T') & call evolve_rk2(pblock) #endif /* RK2 */ ! assign pointer to the next block ! pblock => pblock%next end do ! TODO: boundary conditions ! TODO: new time step ! !------------------------------------------------------------------------------- ! end subroutine evolve #ifdef RK2 ! !=============================================================================== ! ! evolve_rk2: subroutine evolves the current block using RK2 integration ! !=============================================================================== ! subroutine evolve_rk2(pblock) use blocks, only : block, nvars use config, only : igrids, jgrids, kgrids use mesh , only : adxi, adyi, adzi use scheme, only : update implicit none ! input arguments ! type(block), pointer, intent(inout) :: pblock ! local variables ! integer :: q, i, j, k real :: dxi, dyi, dzi ! local arrays ! real, dimension(nvars,igrids,jgrids,kgrids) :: u1, du ! !------------------------------------------------------------------------------- ! ! prepare dxi, dyi, and dzi ! dxi = adxi(pblock%level) dyi = adyi(pblock%level) dzi = adzi(pblock%level) ! 1st step of integration ! call update(pblock%u, du, dxi, dyi, dzi) ! update solution ! do k = 1, kgrids do j = 1, jgrids do i = 1, igrids do q = 1, nvars u1(q,i,j,k) = pblock%u(q,i,j,k) + dt*du(q,i,j,k) end do end do end do end do ! 2nd step of integration ! call update(u1, du, dxi, dyi, dzi) ! update solution ! do k = 1, kgrids do j = 1, jgrids do i = 1, igrids do q = 1, nvars pblock%u(q,i,j,k) = 0.5 * (pblock%u(q,i,j,k) + u1(q,i,j,k) & + dt*du(q,i,j,k)) end do end do end do end do !------------------------------------------------------------------------------- ! end subroutine evolve_rk2 #endif /* RK2 */ !=============================================================================== ! end module