Attachment 'kelv_helm1.f90'
Download 1 !=======================================================================
2 ! Kelvin Helmholtz instability
3 !=======================================================================
4
5 module config_module
6 real*8 :: fac=1.0,mix=5e-3
7 end module config_module
8
9 subroutine set_parameter
10 use main_module
11 use config_module
12 use diagnostics_module
13 use tke_module
14 implicit none
15 ny=1
16 nx=int(1.5*64*fac)
17 nz=int(40*fac)
18
19 dt_mom=0.04/fac
20 dt_tracer = dt_mom
21
22 enable_conserve_energy = .false.
23 coord_degree =.false.
24 enable_cyclic_x =.true.
25 enable_hydrostatic =.false.
26 eq_of_state_type = 1
27
28 congr_epsilon = 1d-12
29 congr_max_iterations = 5000
30 !enable_streamfunction = .true.
31
32 congr_epsilon_non_hydro= 1d-6
33 congr_max_itts_non_hydro = 5000
34
35 enable_tempsalt_sources = .true.
36 enable_momentum_sources = .true.
37
38 enable_explicit_vert_friction = .true.; kappaM_0 = mix/fac**2
39 enable_hor_friction = .true.; A_h = mix/fac**2
40 enable_superbee_advection =.true.
41 !kappaH_0 = mix/fac**2
42 !enable_hor_diffusion = .true.; K_h = mix/fac**2
43
44 runlen = 86400.0
45 enable_diag_ts_monitor = .true.; ts_monint =0.5!dt_mom
46 enable_diag_snapshots = .true.; snapint = 0.5!dt_mom
47
48 enable_diag_particles = .true.; particles_int = 0.5
49 end subroutine set_parameter
50
51
52 subroutine set_grid
53 use main_module
54 use config_module
55 implicit none
56 dxt(:)=0.25/fac
57 dyt(:)=0.25/fac
58 dzt(:)=0.25/fac
59 end subroutine set_grid
60
61 subroutine set_coriolis
62 !use main_module
63 !use config_module
64 !implicit none
65 !coriolis_t = 2*omega*sin( 30./180.*pi)
66 !coriolis_h = 2*omega*cos( 30./180.*pi)
67 end subroutine set_coriolis
68
69
70 real*8 function t_star(k)
71 use main_module
72 implicit none
73 integer :: k
74 t_star=9.85-6.5*tanh( (zt(k)-zt(nz/2) ) /zt(1)*100 )
75 end function t_star
76
77
78 real*8 function u_star(k)
79 use main_module
80 implicit none
81 integer :: k
82 u_star=0.6+0.5*tanh( (zt(k)-zt(nz/2))/zt(1)*100)
83 end function u_star
84
85
86
87 subroutine set_initial_conditions
88 use main_module
89 implicit none
90 integer :: i,j,k
91 real*8 :: fxa,t_star,u_star
92 do k=1,nz
93 do j=js_pe-onx,je_pe+onx
94 do i=is_pe-onx,ie_pe+onx
95 fxa=1e-3*zt(1)*sin(xt(i)/(20*dxt(is_pe))*pi)
96 temp(i,j,k,:)=( fxa+t_star(k) )*maskT(i,j,k)
97 u(i,j,k,:) = u_star(k)*maskU(i,j,k)
98 enddo
99 enddo
100 enddo
101 end subroutine set_initial_conditions
102
103
104
105
106 subroutine set_forcing
107 use main_module
108 implicit none
109 integer :: i,k
110 real*8 :: T_rest,t_star,u_star
111 T_rest=1./(15.*dt_mom)
112 do k=1,nz
113 do i=2,nx/8
114 if (i>=is_pe .and. i<=ie_pe) then
115 temp_source(i,:,k)=maskT(i,:,k)*T_rest*(t_star(k)-temp(i,:,k,tau))
116 u_source(i,:,k) = maskU(i,:,k)*T_rest*(u_star(k)-u(i,:,k,tau))
117 endif
118 enddo
119 enddo
120 end subroutine set_forcing
121
122
123
124 subroutine set_topography
125 use main_module
126 implicit none
127 kbot =1
128 end subroutine set_topography
129
130
131 subroutine set_diagnostics
132 end subroutine set_diagnostics
133
134
135 subroutine set_particles
136 use main_module
137 use particles_module
138 implicit none
139 integer :: n
140 real :: fxa,xs,xe,zs,ze
141
142 call allocate_particles(2000)
143 xs=0;xe=nx*dxt(is_pe);
144 zs=zt(1);ze=zt(nz)
145 do n=1,nptraj
146 call random_number(fxa)
147 pxyz(1,n) = xs+fxa*(xe-xs)
148 pxyz(2,n) = yt(1)
149 call random_number(fxa)
150 pxyz(3,n) = zs+fxa*(ze-zs)
151 enddo
152
153 !call allocate_particles(2)
154 !pxyz(:,1) = (/10.d0 , yt(js_pe), -8.d0/)
155 !pxyz(:,2) = (/14.d0 , yt(js_pe), -8.d0/)
156
157 end subroutine set_particles
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.