16 logical :: saveltraj = .false.
19 real(kind_real) :: ptop
20 integer :: isc,iec,jsc,jec
21 integer :: isd,ied,jsd,jed
22 integer :: npx, npy, npz
26 integer :: do_phy_trb = 1
27 integer :: do_phy_mst = 1
28 real(kind_real),
allocatable,
dimension(:) :: ak, bk
29 logical :: hydrostatic
35 real(kind_real),
allocatable,
dimension(:,:,:) :: u, v, t, delp
36 real(kind_real),
allocatable,
dimension(:,:,:) :: qv, ql, qi, o3
37 real(kind_real),
allocatable,
dimension(:,:,:) :: w, delz
38 real(kind_real),
allocatable,
dimension(:,:,:) :: ua, va, cfcn
43 real(kind_real),
allocatable,
dimension(:,:,:) :: u, v, t, delp
44 real(kind_real),
allocatable,
dimension(:,:,:) :: qv, ql, qi, o3
45 real(kind_real),
allocatable,
dimension(:,:,:) :: w, delz
46 real(kind_real),
allocatable,
dimension(:,:,:) :: ua, va, cfcn
47 real(kind_real),
allocatable,
dimension(:,:,:) :: qls, qcn
48 real(kind_real),
allocatable,
dimension(:,:) :: phis, ps
49 real(kind_real),
allocatable,
dimension(:,:) :: frocean, frland
50 real(kind_real),
allocatable,
dimension(:,:) :: varflt, ustar, bstar
51 real(kind_real),
allocatable,
dimension(:,:) :: zpbl, cm, ct, cq
52 real(kind_real),
allocatable,
dimension(:,:) :: kcbl, ts, khl, khu
74 subroutine allocate_pert(pert,isc,iec,jsc,jec,npz,hydrostatic)
78 logical,
intent(in ) :: hydrostatic
79 integer,
intent(in ) :: isc, iec, jsc, jec, npz
81 allocate(pert%u (isc:iec, jsc:jec, npz))
82 allocate(pert%v (isc:iec, jsc:jec, npz))
83 allocate(pert%ua (isc:iec, jsc:jec, npz))
84 allocate(pert%va (isc:iec, jsc:jec, npz))
85 allocate(pert%t (isc:iec, jsc:jec, npz))
86 allocate(pert%delp (isc:iec, jsc:jec, npz))
87 allocate(pert%qv (isc:iec, jsc:jec, npz))
88 allocate(pert%ql (isc:iec, jsc:jec, npz))
89 allocate(pert%qi (isc:iec, jsc:jec, npz))
90 allocate(pert%o3 (isc:iec, jsc:jec, npz))
92 allocate(pert%cfcn (isc:iec, jsc:jec, npz))
94 if (.not. hydrostatic)
then 95 allocate(pert%w (isc:iec, jsc:jec, npz))
96 allocate(pert%delz (isc:iec, jsc:jec, npz))
108 if(
allocated(pert%u) )
deallocate(pert%u)
109 if(
allocated(pert%v) )
deallocate(pert%v)
110 if(
allocated(pert%ua) )
deallocate(pert%ua)
111 if(
allocated(pert%va) )
deallocate(pert%va)
112 if(
allocated(pert%t) )
deallocate(pert%t)
113 if(
allocated(pert%delp))
deallocate(pert%delp)
114 if(
allocated(pert%qv) )
deallocate(pert%qv)
115 if(
allocated(pert%ql) )
deallocate(pert%ql)
116 if(
allocated(pert%qi) )
deallocate(pert%qi)
117 if(
allocated(pert%o3) )
deallocate(pert%o3)
118 if(
allocated(pert%cfcn))
deallocate(pert%cfcn)
119 if(
allocated(pert%w) )
deallocate(pert%w)
120 if(
allocated(pert%delz))
deallocate(pert%delz)
126 subroutine allocate_traj(traj,isc,iec,jsc,jec,npz,hydrostatic,dpm)
130 logical,
intent(in ) :: hydrostatic
131 integer,
intent(in ) :: dpm
132 integer,
intent(in ) :: isc, iec, jsc, jec, npz
134 allocate(traj%u (isc:iec, jsc:jec, npz))
135 allocate(traj%v (isc:iec, jsc:jec, npz))
136 allocate(traj%ua (isc:iec, jsc:jec, npz))
137 allocate(traj%va (isc:iec, jsc:jec, npz))
138 allocate(traj%t (isc:iec, jsc:jec, npz))
139 allocate(traj%delp (isc:iec, jsc:jec, npz))
140 allocate(traj%qv (isc:iec, jsc:jec, npz))
141 allocate(traj%ql (isc:iec, jsc:jec, npz))
142 allocate(traj%qi (isc:iec, jsc:jec, npz))
143 allocate(traj%o3 (isc:iec, jsc:jec, npz))
145 if (.not. hydrostatic)
then 146 allocate(traj%w (isc:iec, jsc:jec, npz))
147 allocate(traj%delz (isc:iec, jsc:jec, npz))
151 allocate(traj%qls (isc:iec, jsc:jec, npz))
152 allocate(traj%qcn (isc:iec, jsc:jec, npz))
153 allocate(traj%cfcn (isc:iec, jsc:jec, npz))
156 allocate(traj%phis (isc:iec, jsc:jec))
157 allocate(traj%ps (isc:iec, jsc:jec))
158 allocate(traj%frocean(isc:iec, jsc:jec))
159 allocate(traj%frland (isc:iec, jsc:jec))
160 allocate(traj%varflt (isc:iec, jsc:jec))
161 allocate(traj%ustar (isc:iec, jsc:jec))
162 allocate(traj%bstar (isc:iec, jsc:jec))
163 allocate(traj%zpbl (isc:iec, jsc:jec))
164 allocate(traj%cm (isc:iec, jsc:jec))
165 allocate(traj%ct (isc:iec, jsc:jec))
166 allocate(traj%cq (isc:iec, jsc:jec))
167 allocate(traj%kcbl (isc:iec, jsc:jec))
168 allocate(traj%ts (isc:iec, jsc:jec))
169 allocate(traj%khl (isc:iec, jsc:jec))
170 allocate(traj%khu (isc:iec, jsc:jec))
181 if (
allocated(traj%u ))
deallocate(traj%u )
182 if (
allocated(traj%v ))
deallocate(traj%v )
183 if (
allocated(traj%ua ))
deallocate(traj%ua )
184 if (
allocated(traj%va ))
deallocate(traj%va )
185 if (
allocated(traj%t ))
deallocate(traj%t )
186 if (
allocated(traj%delp ))
deallocate(traj%delp )
187 if (
allocated(traj%qv ))
deallocate(traj%qv )
188 if (
allocated(traj%ql ))
deallocate(traj%ql )
189 if (
allocated(traj%qi ))
deallocate(traj%qi )
190 if (
allocated(traj%o3 ))
deallocate(traj%o3 )
191 if (
allocated(traj%w ))
deallocate(traj%w )
192 if (
allocated(traj%delz ))
deallocate(traj%delz )
193 if (
allocated(traj%qls ))
deallocate(traj%qls )
194 if (
allocated(traj%qcn ))
deallocate(traj%qcn )
195 if (
allocated(traj%cfcn ))
deallocate(traj%cfcn )
196 if (
allocated(traj%phis ))
deallocate(traj%phis )
197 if (
allocated(traj%ps ))
deallocate(traj%ps )
198 if (
allocated(traj%frocean))
deallocate(traj%frocean)
199 if (
allocated(traj%frland ))
deallocate(traj%frland )
200 if (
allocated(traj%varflt ))
deallocate(traj%varflt )
201 if (
allocated(traj%ustar ))
deallocate(traj%ustar )
202 if (
allocated(traj%bstar ))
deallocate(traj%bstar )
203 if (
allocated(traj%zpbl ))
deallocate(traj%zpbl )
204 if (
allocated(traj%cm ))
deallocate(traj%cm )
205 if (
allocated(traj%ct ))
deallocate(traj%ct )
206 if (
allocated(traj%cq ))
deallocate(traj%cq )
207 if (
allocated(traj%kcbl ))
deallocate(traj%kcbl )
208 if (
allocated(traj%ts ))
deallocate(traj%ts )
209 if (
allocated(traj%khl ))
deallocate(traj%khl )
210 if (
allocated(traj%khu ))
deallocate(traj%khu )
216 subroutine copy_traj( traj_in, traj_out, hydrostatic, dpm )
221 logical,
intent(in) :: hydrostatic
222 integer,
intent(in) :: dpm
224 traj_out%u = traj_in%u
225 traj_out%v = traj_in%v
226 traj_out%ua = traj_in%ua
227 traj_out%va = traj_in%va
228 traj_out%t = traj_in%t
229 traj_out%delp = traj_in%delp
230 traj_out%qv = traj_in%qv
231 traj_out%ql = traj_in%ql
232 traj_out%qi = traj_in%qi
233 traj_out%o3 = traj_in%o3
235 if (.not. hydrostatic)
then 236 traj_out%w = traj_in%w
237 traj_out%delz = traj_in%delz
241 traj_out%qls = traj_in%qls
242 traj_out%qcn = traj_in%qcn
243 traj_out%cfcn = traj_in%cfcn
246 traj_out%phis = traj_in%phis
247 traj_out%ps = traj_in%ps
248 traj_out%frocean = traj_in%frocean
249 traj_out%frland = traj_in%frland
250 traj_out%varflt = traj_in%varflt
251 traj_out%ustar = traj_in%ustar
252 traj_out%bstar = traj_in%bstar
253 traj_out%zpbl = traj_in%zpbl
254 traj_out%cm = traj_in%cm
255 traj_out%ct = traj_in%ct
256 traj_out%cq = traj_in%cq
257 traj_out%kcbl = traj_in%kcbl
258 traj_out%ts = traj_in%ts
259 traj_out%khl = traj_in%khl
260 traj_out%khu = traj_in%khu
271 real(4),
intent(in) :: temp
272 real(4),
intent(out) :: icefrct
275 real(4),
parameter :: t_ice_all = 233.16_4, t_ice_max = 273.16_4
276 integer,
parameter :: icefrpwr = 4
279 if ( temp <= t_ice_all )
then 281 else if ( (temp > t_ice_all) .and. (temp <= t_ice_max) )
then 282 icefrct = 1.00_4 - ( temp - t_ice_all ) / ( t_ice_max - t_ice_all )
285 icefrct =
min(icefrct,1.00_4)
286 icefrct =
max(icefrct,0.00_4)
288 icefrct = icefrct**icefrpwr
299 real(8),
intent(in) :: temp
300 real(8),
intent(out) :: icefrct
303 real(8),
parameter :: t_ice_all = 233.16_8, t_ice_max = 273.16_8
304 integer,
parameter :: icefrpwr = 4
307 if ( temp <= t_ice_all )
then 309 else if ( (temp > t_ice_all) .and. (temp <= t_ice_max) )
then 310 icefrct = 1.00_8 - ( temp - t_ice_all ) / ( t_ice_max - t_ice_all )
313 icefrct =
min(icefrct,1.00_8)
314 icefrct =
max(icefrct,0.00_8)
316 icefrct = icefrct**icefrpwr
324 integer,
intent(in) :: im,jm,lm
325 real(4),
intent(in) :: ptop
326 real(4),
intent(in) :: delp(1:im,1:jm,1:lm)
327 real(4),
intent(out) :: pe (1:im,1:jm,0:lm)
328 real(4),
intent(out) :: p (1:im,1:jm,1:lm)
329 real(4),
intent(out) :: pk (1:im,1:jm,1:lm)
331 real(4) :: lpe(1:im,1:jm,0:lm)
332 real(4) :: pek(1:im,1:jm,0:lm)
339 pe(:,:,l) = pe(:,:,l-1) + delp(:,:,l)
343 p(:,:,1:lm) = 0.5_4 * (pe(:,:,1:lm) + pe(:,:,0:lm-1))
352 pk(:,:,1:lm) = (pek(:,:,1:lm)-pek(:,:,0:lm-1))/(
kappa*(lpe(:,:,1:lm)-lpe(:,:,0:lm-1)))
360 integer,
intent(in) :: im,jm,lm
361 real(8),
intent(in) :: ptop
362 real(8),
intent(in) :: delp(1:im,1:jm,1:lm)
363 real(8),
intent(out) :: pe (1:im,1:jm,0:lm)
364 real(8),
intent(out) :: p (1:im,1:jm,1:lm)
365 real(8),
intent(out) :: pk (1:im,1:jm,1:lm)
367 real(8) :: lpe(1:im,1:jm,0:lm)
368 real(8) :: pek(1:im,1:jm,0:lm)
375 pe(:,:,l) = pe(:,:,l-1) + delp(:,:,l)
379 p(:,:,1:lm) = 0.5_8 * (pe(:,:,1:lm) + pe(:,:,0:lm-1))
388 pk(:,:,1:lm) = (pek(:,:,1:lm)-pek(:,:,0:lm-1))/(
kappa*(lpe(:,:,1:lm)-lpe(:,:,0:lm-1)))
Compute ice fraction from temperature.
subroutine icefraction_r4(temp, icefrct)
subroutine, public allocate_traj(traj, isc, iec, jsc, jec, npz, hydrostatic, dpm)
Compute pressures from delp.
subroutine icefraction_r8(temp, icefrct)
Fortran derived type to hold the linearized model increment.
subroutine, public deallocate_traj(traj)
subroutine compute_pressures_r8(im, jm, lm, ptop, delp, pe, p, pk)
subroutine, public deallocate_pert(pert)
subroutine compute_pressures_r4(im, jm, lm, ptop, delp, pe, p, pk)
subroutine, public copy_traj(traj_in, traj_out, hydrostatic, dpm)
Fortran derived type to hold the linearized model trajectory.
Fortran derived type to hold the linearized model configuration.
real(kind=kind_real), parameter, public kappa
subroutine, public allocate_pert(pert, isc, iec, jsc, jec, npz, hydrostatic)
Constants for the FV3 model.