-
Notifications
You must be signed in to change notification settings - Fork 1
/
grid_timestep.f90
38 lines (30 loc) · 1.06 KB
/
grid_timestep.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
subroutine grid_timestep(nx,ny,dx,dy,kappa,gamma,cfl_factor,&
rho,tau,etot,mom_x,mom_y,dt_cfl,omega_grid,x,y)
implicit none
include 'variables.h'
double precision :: rho(nx,ny),tau(nx,ny),etot(nx,ny)
double precision :: mom_x(nx,ny),mom_y(nx,ny),phi(nx,ny),x(nx,ny),y(nx,ny)
double precision :: sr_x(nx,ny),sr_y(nx,ny)
double precision :: dt_cfl,dt_x(nx,ny),dt_y(nx,ny)
! double precision :: x(nx,ny),y(nx,ny)
double precision :: omega_grid
dt_cfl = 100d0
! print*,'calling spectral_radius'
call spectral_radius(nx,ny,rho,mom_x,mom_y,etot&
,gamma,tau,sr_x,sr_y,omega_grid,x,y)
! what is the # of ghost zones? j=2,ny-1 means 1 ghost zone here?
do j=2,ny-1
do i=2,nx-1
dt_x(i,j) = cfl_factor*dx/sr_x(i,j)
dt_y(i,j) = cfl_factor*dy/sr_y(i,j)
if (dt_x(i,j) .lt. dt_cfl) then
dt_cfl = dt_x(i,j)
end if
if (dt_y(i,j) .lt. dt_cfl) then
dt_cfl = dt_y(i,j)
end if
! write(42,*) i,j,dt_x(i,j),dt_y(i,j)
end do
end do
! call exit(0)
end subroutine grid_timestep