-
Notifications
You must be signed in to change notification settings - Fork 11
/
MODULE_TIMESOLVER.f90
38 lines (33 loc) · 1.22 KB
/
MODULE_TIMESOLVER.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
MODULE MODULE_TIMESOLVER
use MODULE_PRECISION
use MODULE_CONSTANTS
use MODULE_QUADTREE
contains
!=================================================================================================
subroutine compute_dt_array(first, last, tree, dt)
implicit none
integer(ip), intent(in) :: first, last
type(quadtree), dimensioN(first:last), intent(in) :: tree
real(rp), intent(inout) :: dt
integer(ip) :: i
do i = first, last
call compute_dt_single(tree(i), dt)
end do
return
end subroutine compute_dt_array
!==================================================================================================
recursive subroutine compute_dt_single(tree, dt)
implicit none
type(quadtree), intent(in) :: tree
real(rp), intent(inout) :: dt
if (.not. tree%is_leaf) then
call compute_dt_single(tree%north_west, dt)
call compute_dt_single(tree%north_east, dt)
call compute_dt_single(tree%south_west, dt)
call compute_dt_single(tree%south_east, dt)
else
dt = min(dt, tree%data%dt)
end if
return
end subroutine compute_dt_single
END MODULE MODULE_TIMESOLVER