-
Notifications
You must be signed in to change notification settings - Fork 12
/
cfl.f90
55 lines (47 loc) · 1.53 KB
/
cfl.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
!===================================================
! Subroutine for computing the local and global CFL
! number, according to Lele 1992.
!===================================================
subroutine cfl_compute(uxmax,uymax,uzmax)
use param
use var
implicit none
real(mytype),intent(in) :: uxmax,uymax,uzmax
real(mytype) :: cfl_x_adv,cfl_x_diff,cfl_y_adv,cfl_y_diff,cfl_z_adv,cfl_z_diff
real(mytype) :: cfl_conv_lim, cfl_diff_lim
real(mytype) :: sigma_conv(4), sigma_diff(4)
real(mytype) :: visc
! Set the constants (this is true for periodic boundaries)
sigma_conv=[0.0, sqrt(3.0), 2.85,1.]
sigma_diff=[2.0, 2.5, 2.9,1.]
if(jles==1) then
visc=rxxnu*xnu
else
visc=xnu
endif
! This is considering 1D peridic boundaries
! Do x-direction
cfl_x_adv=abs(uxmax)*dt/dx
cfl_x_diff=visc*dt/dx**2.0
! Do y-direction
cfl_y_adv=abs(uymax)*dt/dy
cfl_y_diff=visc*dt/dy**2.0
! Do z-direction
cfl_z_adv=abs(uzmax)*dt/dz
cfl_z_diff=visc*dt/dz**2.0
! So far we will focus on uniform grids
if(nrank==0) then
write(*,*) ' '
write(*,1002) cfl_x_adv, cfl_x_diff
1002 format('CFL x-direction (Adv and Diff) =',F9.4,',',F9.4)
write(*,1003) cfl_y_adv, cfl_y_diff
1003 format('CFL y-direction (Adv and Diff) =',F9.4,',',F9.4)
write(*,1004) cfl_z_adv, cfl_z_diff
1004 format('CFL z-direction (Adv and Diff) =',F9.4,',',F9.4)
cfl_conv_lim=sigma_conv(nscheme)/sqrt(3.0)
cfl_diff_lim=sigma_diff(nscheme)/6.0
write(*,1005) cfl_conv_lim, cfl_diff_lim
write(*,*) ' '
1005 format('CFL limits (Adv and Diff) : ',F9.4,',',F9.4)
endif
end subroutine