MPTRAC
mptrac_fortran.f90
Go to the documentation of this file.
1! This file is part of MPTRAC.
2!
3! MPTRAC is free software: you can redistribute it and/or modify it
4! under the terms of the GNU General Public License as published by
5! the Free Software Foundation, either version 3 of the License, or
6! (at your option) any later version.
7!
8! MPTRAC is distributed in the hope that it will be useful,
9! but WITHOUT ANY WARRANTY; without even the implied warranty of
10! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11! GNU General Public License for more details.
12!
13! You should have received a copy of the GNU General Public License
14! along with MPTRAC. If not, see <http://www.gnu.org/licenses/>.
15!
16! Copyright (C) 2013-2024 Forschungszentrum Juelich GmbH
17
18! MPTRAC data sturctures
20
21 USE iso_c_binding
22 IMPLICIT NONE
23
24 !! Values must be identical to equivalent variables in mptrac.h!
25 !! The values for ex, ey, ep are suited for ERA5 data. However, they
26 !! exceed some size limit of NVHPC (2GB???), where the compiler fails
27 !! to build the fortran wrapper. GCC and ICX work fine.
28 INTEGER, PARAMETER :: ex = 1202
29 INTEGER, PARAMETER :: ey = 602
30 INTEGER, PARAMETER :: ep = 140
31 !! Alternative smaller values, good enough for ERA-interim.
32 ! INTEGER, PARAMETER :: ex = 481
33 ! INTEGER, PARAMETER :: ey = 241
34 ! INTEGER, PARAMETER :: ep = 60
35 INTEGER, PARAMETER :: npp = 10000000 !NP
36 INTEGER, PARAMETER :: nqq = 15 !NQ
37 INTEGER, PARAMETER :: length = 5000 !LEN
38 INTEGER, PARAMETER :: cyy = 250 !CY
39 INTEGER, PARAMETER :: co3 = 30
40 INTEGER, PARAMETER :: cp = 70
41 INTEGER, PARAMETER :: csza = 50
42 INTEGER, PARAMETER :: ct = 12
43 INTEGER, PARAMETER :: cts = 1000
44
45 !! The order of the variables in each struct matters!
46 TYPE, bind(c) :: atm_t
47 INTEGER(c_int) :: np
48 REAL(c_double), DIMENSION(npp) :: time
49 REAL(c_double), DIMENSION(npp) :: p
50 REAL(c_double), DIMENSION(npp) :: lon
51 REAL(c_double), DIMENSION(npp) :: lat
52 REAL(c_double), DIMENSION(npp,nqq) :: q
53 END TYPE atm_t
54
55 !! in 3D arrays first and third index swapped
56 TYPE, bind(c) :: clim_photo_t
57 INTEGER(c_int) :: np
58 INTEGER(c_int) :: nsza
59 INTEGER(c_int) :: no3c
60 REAL(c_double), DIMENSION(cp) :: p
61 REAL(c_double), DIMENSION(csza) :: sza
62 REAL(c_double), DIMENSION(co3) :: o3c
63 REAL(c_double), DIMENSION(co3,csza,cp) :: n2o
64 REAL(c_double), DIMENSION(co3,csza,cp) :: ccl4
65 REAL(c_double), DIMENSION(co3,csza,cp) :: ccl3f
66 REAL(c_double), DIMENSION(co3,csza,cp) :: ccl2f2
67 REAL(c_double), DIMENSION(co3,csza,cp) :: o2
68 REAL(c_double), DIMENSION(co3,csza,cp) :: o3_1
69 REAL(c_double), DIMENSION(co3,csza,cp) :: o3_2
70 REAL(c_double), DIMENSION(co3,csza,cp) :: h2o2
71 REAL(c_double), DIMENSION(co3,csza,cp) :: h2o
72 END TYPE clim_photo_t
73
74 TYPE, bind(c) :: clim_ts_t
75 INTEGER(c_int) :: ntime
76 REAL(c_double), DIMENSION(cts) :: time
77 REAL(c_double), DIMENSION(cts) :: vmr
78 END TYPE clim_ts_t
79
80 TYPE, bind(c) :: clim_zm_t
81 INTEGER(c_int) :: ntime
82 INTEGER(c_int) :: nlat
83 INTEGER(c_int) :: np
84 REAL(c_double), DIMENSION(ct) :: time
85 REAL(c_double), DIMENSION(cyy) :: lat
86 REAL(c_double), DIMENSION(cp) :: p
87 REAL(c_double), DIMENSION(cyy,cp,ct) :: vmr
88 END TYPE clim_zm_t
89
90 TYPE, bind(c) :: clim_t
91 INTEGER(c_int) :: tropo_ntime
92 INTEGER(c_int) :: tropo_nlat
93 REAL(c_double), DIMENSION(12) :: tropo_time
94 REAL(c_double), DIMENSION(73) :: tropo_lat
95 REAL(c_double), DIMENSION(73,12) :: tropo
96 TYPE(clim_photo_t) :: photo
97 TYPE(clim_zm_t) :: hno3
98 TYPE(clim_zm_t) :: oh
99 TYPE(clim_zm_t) :: h2o2
100 TYPE(clim_zm_t) :: ho2
101 TYPE(clim_zm_t) :: o1d
102 TYPE(clim_ts_t) :: ccl4
103 TYPE(clim_ts_t) :: ccl3f
104 TYPE(clim_ts_t) :: ccl2f2
105 TYPE(clim_ts_t) :: n2o
106 TYPE(clim_ts_t) :: sf6
107 END TYPE clim_t
108
109 TYPE, bind(c) :: ctl_t
110 INTEGER(c_int) :: advect_cpl_zeta_and_press_modules
111 INTEGER(c_int) :: met_press_level_def
112 INTEGER(c_int) :: advect_vert_coord
113 INTEGER(c_int) :: met_vert_coord
114 INTEGER(c_int) :: met_clams
115 INTEGER(c_int) :: nq
116 CHARACTER(c_char), DIMENSION(length,nqq) :: qnt_name
117 CHARACTER(c_char), DIMENSION(length,nqq) :: qnt_longname
118 CHARACTER(c_char), DIMENSION(length,nqq) :: qnt_unit
119 CHARACTER(c_char), DIMENSION(length,nqq) :: qnt_format
120 INTEGER(c_int) :: qnt_idx
121 INTEGER(c_int) :: qnt_ens
122 INTEGER(c_int) :: qnt_stat
123 INTEGER(c_int) :: qnt_m
124 INTEGER(c_int) :: qnt_vmr
125 INTEGER(c_int) :: qnt_rp
126 INTEGER(c_int) :: qnt_rhop
127 INTEGER(c_int) :: qnt_ps
128 INTEGER(c_int) :: qnt_ts
129 INTEGER(c_int) :: qnt_zs
130 INTEGER(c_int) :: qnt_us
131 INTEGER(c_int) :: qnt_vs
132 INTEGER(c_int) :: qnt_lsm
133 INTEGER(c_int) :: qnt_sst
134 INTEGER(c_int) :: qnt_pbl
135 INTEGER(c_int) :: qnt_pt
136 INTEGER(c_int) :: qnt_tt
137 INTEGER(c_int) :: qnt_zt
138 INTEGER(c_int) :: qnt_h2ot
139 INTEGER(c_int) :: qnt_zg
140 INTEGER(c_int) :: qnt_p
141 INTEGER(c_int) :: qnt_t
142 INTEGER(c_int) :: qnt_rho
143 INTEGER(c_int) :: qnt_u
144 INTEGER(c_int) :: qnt_v
145 INTEGER(c_int) :: qnt_w
146 INTEGER(c_int) :: qnt_h2o
147 INTEGER(c_int) :: qnt_o3
148 INTEGER(c_int) :: qnt_lwc
149 INTEGER(c_int) :: qnt_rwc
150 INTEGER(c_int) :: qnt_iwc
151 INTEGER(c_int) :: qnt_swc
152 INTEGER(c_int) :: qnt_cc
153 INTEGER(c_int) :: qnt_pct
154 INTEGER(c_int) :: qnt_pcb
155 INTEGER(c_int) :: qnt_cl
156 INTEGER(c_int) :: qnt_plcl
157 INTEGER(c_int) :: qnt_plfc
158 INTEGER(c_int) :: qnt_pel
159 INTEGER(c_int) :: qnt_cape
160 INTEGER(c_int) :: qnt_cin
161 INTEGER(c_int) :: qnt_o3c
162 INTEGER(c_int) :: qnt_hno3
163 INTEGER(c_int) :: qnt_oh
164 INTEGER(c_int) :: qnt_h2o2
165 INTEGER(c_int) :: qnt_ho2
166 INTEGER(c_int) :: qnt_o1d
167 INTEGER(c_int) :: qnt_mloss_oh
168 INTEGER(c_int) :: qnt_mloss_h2o2
169 INTEGER(c_int) :: qnt_mloss_kpp
170 INTEGER(c_int) :: qnt_mloss_wet
171 INTEGER(c_int) :: qnt_mloss_dry
172 INTEGER(c_int) :: qnt_mloss_decay
173 INTEGER(c_int) :: qnt_loss_rate
174 INTEGER(c_int) :: qnt_psat
175 INTEGER(c_int) :: qnt_psice
176 INTEGER(c_int) :: qnt_pw
177 INTEGER(c_int) :: qnt_sh
178 INTEGER(c_int) :: qnt_rh
179 INTEGER(c_int) :: qnt_rhice
180 INTEGER(c_int) :: qnt_theta
181 INTEGER(c_int) :: qnt_zeta
182 INTEGER(c_int) :: qnt_zeta_d
183 INTEGER(c_int) :: qnt_tvirt
184 INTEGER(c_int) :: qnt_lapse
185 INTEGER(c_int) :: qnt_vh
186 INTEGER(c_int) :: qnt_vz
187 INTEGER(c_int) :: qnt_pv
188 INTEGER(c_int) :: qnt_tdew
189 INTEGER(c_int) :: qnt_tice
190 INTEGER(c_int) :: qnt_tsts
191 INTEGER(c_int) :: qnt_tnat
192 INTEGER(c_int) :: qnt_cx
193 INTEGER(c_int) :: qnt_ch2o
194 INTEGER(c_int) :: qnt_co3
195 INTEGER(c_int) :: qnt_cco
196 INTEGER(c_int) :: qnt_coh
197 INTEGER(c_int) :: qnt_ch
198 INTEGER(c_int) :: qnt_cho2
199 INTEGER(c_int) :: qnt_ch2o2
200 INTEGER(c_int) :: qnt_co1d
201 INTEGER(c_int) :: qnt_co3p
202 INTEGER(c_int) :: qnt_cccl4
203 INTEGER(c_int) :: qnt_cccl3f
204 INTEGER(c_int) :: qnt_cccl2f2
205 INTEGER(c_int) :: qnt_cn2o
206 INTEGER(c_int) :: qnt_csf6
207 INTEGER(c_int) :: qnt_aoa
208 INTEGER(c_int) :: direction
209 REAL(c_double) :: t_start
210 REAL(c_double) :: t_stop
211 REAL(c_double) :: dt_mod
212 CHARACTER(c_char), DIMENSION(length) :: metbase
213 REAL(c_double) :: dt_met
214 INTEGER(c_int) :: met_convention
215 INTEGER(c_int) :: met_type
216 INTEGER(c_int) :: met_nc_scale
217 INTEGER(c_int) :: met_nc_level
218 INTEGER(c_int) :: met_nc_quant
219 INTEGER(c_int) :: met_zfp_prec
220 REAL(c_double) :: met_zfp_tol_t
221 REAL(c_double) :: met_zfp_tol_z
222 INTEGER(c_int) :: met_cms_batch
223 INTEGER(c_int) :: met_cms_heur
224 REAL(c_double) :: met_cms_eps_z
225 REAL(c_double) :: met_cms_eps_t
226 REAL(c_double) :: met_cms_eps_u
227 REAL(c_double) :: met_cms_eps_v
228 REAL(c_double) :: met_cms_eps_w
229 REAL(c_double) :: met_cms_eps_pv
230 REAL(c_double) :: met_cms_eps_h2o
231 REAL(c_double) :: met_cms_eps_o3
232 REAL(c_double) :: met_cms_eps_lwc
233 REAL(c_double) :: met_cms_eps_rwc
234 REAL(c_double) :: met_cms_eps_iwc
235 REAL(c_double) :: met_cms_eps_swc
236 REAL(c_double) :: met_cms_eps_cc
237 INTEGER(c_int) :: met_dx
238 INTEGER(c_int) :: met_dy
239 INTEGER(c_int) :: met_dp
240 INTEGER(c_int) :: met_sx
241 INTEGER(c_int) :: met_sy
242 INTEGER(c_int) :: met_sp
243 REAL(c_double) :: met_detrend
244 INTEGER(c_int) :: met_np
245 REAL(c_double), DIMENSION(ep) :: met_p
246 INTEGER(c_int) :: met_geopot_sx
247 INTEGER(c_int) :: met_geopot_sy
248 INTEGER(c_int) :: met_relhum
249 INTEGER(c_int) :: met_cape
250 INTEGER(c_int) :: met_pbl
251 INTEGER(c_int) :: met_pbl_min
252 INTEGER(c_int) :: met_pbl_max
253 INTEGER(c_int) :: met_tropo
254 REAL(c_double) :: met_tropo_pv
255 REAL(c_double) :: met_tropo_theta
256 INTEGER(c_int) :: met_tropo_spline
257 REAL(c_double) :: met_dt_out
258 INTEGER(c_int) :: met_cache
259 INTEGER(c_int) :: met_mpi_share
260 REAL(c_double) :: sort_dt
261 INTEGER(c_int) :: isosurf
262 CHARACTER(c_char), DIMENSION(length) :: balloon
263 INTEGER(c_int) :: advect
264 INTEGER(c_int) :: reflect
265 INTEGER(c_int) :: rng_type
266 REAL(c_double) :: turb_dx_trop
267 REAL(c_double) :: turb_dx_strat
268 REAL(c_double) :: turb_dz_trop
269 REAL(c_double) :: turb_dz_strat
270 REAL(c_double) :: turb_mesox
271 REAL(c_double) :: turb_mesoz
272 REAL(c_double) :: conv_cape
273 REAL(c_double) :: conv_cin
274 REAL(c_double) :: conv_dt
275 INTEGER(c_int) :: conv_mix_bot
276 INTEGER(c_int) :: conv_mix_top
277 REAL(c_double) :: bound_mass
278 REAL(c_double) :: bound_mass_trend
279 REAL(c_double) :: bound_vmr
280 REAL(c_double) :: bound_vmr_trend
281 REAL(c_double) :: bound_lat0
282 REAL(c_double) :: bound_lat1
283 REAL(c_double) :: bound_p0
284 REAL(c_double) :: bound_p1
285 REAL(c_double) :: bound_dps
286 REAL(c_double) :: bound_dzs
287 REAL(c_double) :: bound_zetas
288 INTEGER(c_int) :: bound_pbl
289 CHARACTER(c_char), DIMENSION(length) :: species
290 REAL(c_double) :: molmass
291 REAL(c_double) :: tdec_trop
292 REAL(c_double) :: tdec_strat
293 CHARACTER(c_char), DIMENSION(length) :: clim_photo
294 CHARACTER(c_char), DIMENSION(length) :: clim_hno3_filename
295 CHARACTER(c_char), DIMENSION(length) :: clim_oh_filename
296 CHARACTER(c_char), DIMENSION(length) :: clim_h2o2_filename
297 CHARACTER(c_char), DIMENSION(length) :: clim_ho2_filename
298 CHARACTER(c_char), DIMENSION(length) :: clim_o1d_filename
299 CHARACTER(c_char), DIMENSION(length) :: clim_o3_filename
300 CHARACTER(c_char), DIMENSION(length) :: clim_ccl4_timeseries
301 CHARACTER(c_char), DIMENSION(length) :: clim_ccl3f_timeseries
302 CHARACTER(c_char), DIMENSION(length) :: clim_ccl2f2_timeseries
303 CHARACTER(c_char), DIMENSION(length) :: clim_n2o_timeseries
304 CHARACTER(c_char), DIMENSION(length) :: clim_sf6_timeseries
305 REAL(c_double) :: mixing_dt
306 REAL(c_double) :: mixing_trop
307 REAL(c_double) :: mixing_strat
308 INTEGER(c_int) :: mixing_nz
309 REAL(c_double) :: mixing_z0
310 REAL(c_double) :: mixing_z1
311 INTEGER(c_int) :: mixing_nx
312 REAL(c_double) :: mixing_lon0
313 REAL(c_double) :: mixing_lon1
314 INTEGER(c_int) :: mixing_ny
315 REAL(c_double) :: mixing_lat0
316 REAL(c_double) :: mixing_lat1
317 INTEGER(c_int) :: chemgrid_nz
318 REAL(c_double) :: chemgrid_z0
319 REAL(c_double) :: chemgrid_z1
320 INTEGER(c_int) :: chemgrid_nx
321 REAL(c_double) :: chemgrid_lon0
322 REAL(c_double) :: chemgrid_lon1
323 INTEGER(c_int) :: chemgrid_ny
324 REAL(c_double) :: chemgrid_lat0
325 REAL(c_double) :: chemgrid_lat1
326 INTEGER(c_int) :: oh_chem_reaction
327 REAL(c_double), DIMENSION(4) :: oh_chem
328 REAL(c_double) :: oh_chem_beta
329 INTEGER(c_int) :: h2o2_chem_reaction
330 INTEGER(c_int) :: kpp_chem
331 REAL(c_double) :: dt_kpp
332 INTEGER(c_int) :: tracer_chem
333 REAL(c_double), DIMENSION(2) :: wet_depo_pre
334 REAL(c_double) :: wet_depo_bc_a
335 REAL(c_double) :: wet_depo_bc_b
336 REAL(c_double) :: wet_depo_ic_a
337 REAL(c_double) :: wet_depo_ic_b
338 REAL(c_double), DIMENSION(3) :: wet_depo_ic_h
339 REAL(c_double), DIMENSION(2) :: wet_depo_bc_h
340 REAL(c_double) :: wet_depo_ic_ret_ratio
341 REAL(c_double) :: wet_depo_bc_ret_ratio
342 REAL(c_double) :: dry_depo_dp
343 REAL(c_double) :: dry_depo_vdep
344 REAL(c_double) :: psc_h2o
345 REAL(c_double) :: psc_hno3
346 CHARACTER(c_char), DIMENSION(length) :: atm_basename
347 CHARACTER(c_char), DIMENSION(length) :: atm_gpfile
348 REAL(c_double) :: atm_dt_out
349 INTEGER(c_int) :: atm_filter
350 INTEGER(c_int) :: atm_stride
351 INTEGER(c_int) :: atm_type
352 INTEGER(c_int) :: atm_type_out
353 INTEGER(c_int) :: atm_nc_level
354 INTEGER(c_int), DIMENSION(nqq) :: atm_nc_quant
355 INTEGER(c_int) :: obs_type
356 CHARACTER(c_char), DIMENSION(length) :: csi_basename
357 CHARACTER(c_char), DIMENSION(length) :: csi_kernel
358 REAL(c_double) :: csi_dt_out
359 CHARACTER(c_char), DIMENSION(length) :: csi_obsfile
360 REAL(c_double) :: csi_obsmin
361 REAL(c_double) :: csi_modmin
362 INTEGER(c_int) :: csi_nz
363 REAL(c_double) :: csi_z0
364 REAL(c_double) :: csi_z1
365 INTEGER(c_int) :: csi_nx
366 REAL(c_double) :: csi_lon0
367 REAL(c_double) :: csi_lon1
368 INTEGER(c_int) :: csi_ny
369 REAL(c_double) :: csi_lat0
370 REAL(c_double) :: csi_lat1
371 CHARACTER(c_char), DIMENSION(length) :: ens_basename
372 REAL(c_double) :: ens_dt_out
373 CHARACTER(c_char), DIMENSION(length) :: grid_basename
374 CHARACTER(c_char), DIMENSION(length) :: grid_kernel
375 CHARACTER(c_char), DIMENSION(length) :: grid_gpfile
376 REAL(c_double) :: grid_dt_out
377 INTEGER(c_int) :: grid_sparse
378 INTEGER(c_int) :: grid_nc_level
379 INTEGER(c_int), DIMENSION(nqq) :: grid_nc_quant
380 INTEGER(c_int) :: grid_stddev
381 INTEGER(c_int) :: grid_nz
382 REAL(c_double) :: grid_z0
383 REAL(c_double) :: grid_z1
384 INTEGER(c_int) :: grid_nx
385 REAL(c_double) :: grid_lon0
386 REAL(c_double) :: grid_lon1
387 INTEGER(c_int) :: grid_ny
388 REAL(c_double) :: grid_lat0
389 REAL(c_double) :: grid_lat1
390 INTEGER(c_int) :: grid_type
391 CHARACTER(c_char), DIMENSION(length) :: prof_basename
392 CHARACTER(c_char), DIMENSION(length) :: prof_obsfile
393 INTEGER(c_int) :: prof_nz
394 REAL(c_double) :: prof_z0
395 REAL(c_double) :: prof_z1
396 INTEGER(c_int) :: prof_nx
397 REAL(c_double) :: prof_lon0
398 REAL(c_double) :: prof_lon1
399 INTEGER(c_int) :: prof_ny
400 REAL(c_double) :: prof_lat0
401 REAL(c_double) :: prof_lat1
402 CHARACTER(c_char), DIMENSION(length) :: sample_basename
403 CHARACTER(c_char), DIMENSION(length) :: sample_kernel
404 CHARACTER(c_char), DIMENSION(length) :: sample_obsfile
405 REAL(c_double) :: sample_dx
406 REAL(c_double) :: sample_dz
407 CHARACTER(c_char), DIMENSION(length) :: stat_basename
408 REAL(c_double) :: stat_lon
409 REAL(c_double) :: stat_lat
410 REAL(c_double) :: stat_r
411 REAL(c_double) :: stat_t0
412 REAL(c_double) :: stat_t1
413 CHARACTER(c_char), DIMENSION(length) :: vtk_basename
414 REAL(c_double) :: vtk_dt_out
415 INTEGER(c_int) :: vtk_stride
416 REAL(c_double) :: vtk_scale
417 REAL(c_double) :: vtk_offset
418 INTEGER(c_int) :: vtk_sphere
419 END TYPE ctl_t
420
421 TYPE, bind(c) :: met_t
422 REAL(c_double) :: time
423 INTEGER(c_int) :: nx
424 INTEGER(c_int) :: ny
425 INTEGER(c_int) :: np
426 INTEGER(c_int) :: npl
427 REAL(c_double), DIMENSION(ex) :: lon
428 REAL(c_double), DIMENSION(ey) :: lat
429 REAL(c_double), DIMENSION(ep) :: p
430 REAL(c_double), DIMENSION(ep) :: hybrid
431 REAL(c_float), DIMENSION(ey,ex) :: ps
432 REAL(c_float), DIMENSION(ey,ex) :: ts
433 REAL(c_float), DIMENSION(ey,ex) :: zs
434 REAL(c_float), DIMENSION(ey,ex) :: us
435 REAL(c_float), DIMENSION(ey,ex) :: vs
436 REAL(c_float), DIMENSION(ey,ex) :: lsm
437 REAL(c_float), DIMENSION(ey,ex) :: sst
438 REAL(c_float), DIMENSION(ey,ex) :: pbl
439 REAL(c_float), DIMENSION(ey,ex) :: pt
440 REAL(c_float), DIMENSION(ey,ex) :: tt
441 REAL(c_float), DIMENSION(ey,ex) :: zt
442 REAL(c_float), DIMENSION(ey,ex) :: h2ot
443 REAL(c_float), DIMENSION(ey,ex) :: pct
444 REAL(c_float), DIMENSION(ey,ex) :: pcb
445 REAL(c_float), DIMENSION(ey,ex) :: cl
446 REAL(c_float), DIMENSION(ey,ex) :: plcl
447 REAL(c_float), DIMENSION(ey,ex) :: plfc
448 REAL(c_float), DIMENSION(ey,ex) :: pel
449 REAL(c_float), DIMENSION(ey,ex) :: cape
450 REAL(c_float), DIMENSION(ey,ex) :: cin
451 REAL(c_float), DIMENSION(ey,ex) :: o3c
452 REAL(c_float), DIMENSION(ep,ey,ex) :: z
453 REAL(c_float), DIMENSION(ep,ey,ex) :: t
454 REAL(c_float), DIMENSION(ep,ey,ex) :: u
455 REAL(c_float), DIMENSION(ep,ey,ex) :: v
456 REAL(c_float), DIMENSION(ep,ey,ex) :: w
457 REAL(c_float), DIMENSION(ep,ey,ex) :: pv
458 REAL(c_float), DIMENSION(ep,ey,ex) :: h2o
459 REAL(c_float), DIMENSION(ep,ey,ex) :: o3
460 REAL(c_float), DIMENSION(ep,ey,ex) :: lwc
461 REAL(c_float), DIMENSION(ep,ey,ex) :: rwc
462 REAL(c_float), DIMENSION(ep,ey,ex) :: iwc
463 REAL(c_float), DIMENSION(ep,ey,ex) :: swc
464 REAL(c_float), DIMENSION(ep,ey,ex) :: cc
465 REAL(c_float), DIMENSION(ep,ey,ex) :: pl
466 REAL(c_float), DIMENSION(ep,ey,ex) :: ul
467 REAL(c_float), DIMENSION(ep,ey,ex) :: vl
468 REAL(c_float), DIMENSION(ep,ey,ex) :: wl
469 REAL(c_float), DIMENSION(ep,ey,ex) :: zetal
470 REAL(c_float), DIMENSION(ep,ey,ex) :: zeta_dotl
471 END TYPE met_t
472
473END MODULE mptrac_struct
474
475! MPTRAC functions
477 INTERFACE
478
479 SUBROUTINE mptrac_get_met(ctl, clim, t, met0, met1) &
480 bind(c,name='get_met')
481 USE iso_c_binding
482 USE mptrac_struct, ONLY : ctl_t, clim_t, met_t
483 IMPLICIT NONE
484 TYPE(ctl_t), INTENT(in), TARGET :: ctl
485 TYPE(clim_t), INTENT(in), TARGET :: clim
486 REAL(c_double), INTENT(in), VALUE :: t
487 TYPE(met_t), INTENT(inout), POINTER :: met0, met1
488 END SUBROUTINE mptrac_get_met
489
490 SUBROUTINE mptrac_module_advect(ctl, met0, met1, atm, dt) &
491 bind(c,name='module_advect')
492 USE iso_c_binding
493 USE mptrac_struct, ONLY : ctl_t, met_t, atm_t, npp
494 IMPLICIT NONE
495 TYPE(ctl_t), INTENT(in), TARGET :: ctl
496 TYPE(met_t), INTENT(in), TARGET :: met0, met1
497 TYPE(atm_t), INTENT(inout), TARGET :: atm
498 REAL(c_double), DIMENSION(npp) :: dt
499 END SUBROUTINE mptrac_module_advect
500
501 SUBROUTINE mptrac_module_timesteps(ctl, met0, atm, dt, t) &
502 bind(c,name='module_timesteps')
503 USE iso_c_binding
504 USE mptrac_struct, ONLY : ctl_t, met_t, atm_t, npp
505 TYPE(ctl_t), INTENT(in), TARGET :: ctl
506 TYPE(met_t), INTENT(in), TARGET :: met0
507 TYPE(atm_t), INTENT(in), TARGET :: atm
508 REAL(c_double), DIMENSION(npp) :: dt
509 REAL(c_double), INTENT(in), VALUE :: t
510 END SUBROUTINE mptrac_module_timesteps
511
512 SUBROUTINE mptrac_module_timesteps_init(ctl, atm) &
513 bind(c,name='module_timesteps_init')
514 USE iso_c_binding
515 USE mptrac_struct, ONLY : ctl_t, atm_t
516 TYPE(ctl_t), INTENT(in), TARGET :: ctl
517 TYPE(atm_t), INTENT(out), TARGET :: atm
518 END SUBROUTINE mptrac_module_timesteps_init
519
520 SUBROUTINE mptrac_read_atm(filename,ctl,atm) &
521 bind(c,name='read_atm')
522 USE iso_c_binding
523 USE mptrac_struct, ONLY : ctl_t, atm_t
524 IMPLICIT NONE
525 CHARACTER(c_char), INTENT(in) :: filename
526 TYPE(ctl_t), INTENT(in), TARGET :: ctl
527 TYPE(atm_t), INTENT(out), TARGET :: atm
528 END SUBROUTINE mptrac_read_atm
529
530 SUBROUTINE mptrac_read_clim(ctl,clim) &
531 bind(c,name='read_clim')
532 USE iso_c_binding
534 IMPLICIT NONE
535 TYPE(ctl_t), INTENT(in), TARGET :: ctl
536 TYPE(clim_t), INTENT(out), TARGET :: clim
537 END SUBROUTINE mptrac_read_clim
538
539 SUBROUTINE mptrac_read_ctl(filename,argc,argv,ctl) &
540 bind(c,name='read_ctl')
541 USE iso_c_binding
542 USE mptrac_struct, ONLY : ctl_t
543 IMPLICIT NONE
544 CHARACTER(c_char), INTENT(in) :: filename
545 INTEGER(c_int), VALUE :: argc
546 TYPE(c_ptr), DIMENSION(5) :: argv
547 TYPE(ctl_t), INTENT(out), TARGET :: ctl
548 END SUBROUTINE mptrac_read_ctl
549
550 SUBROUTINE mptrac_read_met(filename,ctl,clim,met,atm) &
551 bind(c,name='read_met')
552 USE iso_c_binding
553 USE mptrac_struct, ONLY : ctl_t, clim_t, met_t, atm_t
554 IMPLICIT NONE
555 CHARACTER(c_char), DIMENSION(*), INTENT(in) :: filename
556 TYPE(ctl_t), INTENT(in), TARGET :: ctl
557 TYPE(clim_t), INTENT(in), TARGET :: clim
558 TYPE(atm_t), INTENT(in), TARGET :: atm
559 TYPE(met_t), INTENT(out), TARGET :: met
560 END SUBROUTINE mptrac_read_met
561
562 SUBROUTINE mptrac_write_output(dirname, ctl, met0, met1, atm, t) &
563 bind(c,name='write_output')
564 USE iso_c_binding
565 USE mptrac_struct, ONLY : ctl_t, met_t, atm_t
566 CHARACTER(c_char), INTENT(in) :: dirname
567 TYPE(ctl_t), INTENT(in), TARGET :: ctl
568 TYPE(met_t), INTENT(in), TARGET :: met0, met1
569 TYPE(atm_t), INTENT(in), TARGET :: atm
570 REAL(c_double), INTENT(in), VALUE :: t
571 END SUBROUTINE mptrac_write_output
572
573 END INTERFACE
574END MODULE mptrac_func
double clim_photo(const double rate[CP][CSZA][CO3], const clim_photo_t *photo, const double p, const double sza, const double o3c)
Calculates the photolysis rate for a given set of atmospheric conditions.
Definition: mptrac.c:149
integer, parameter cyy
integer, parameter cp
integer, parameter cts
integer, parameter co3
integer, parameter nqq
integer, parameter ey
integer, parameter length
integer, parameter npp
integer, parameter csza
integer, parameter ct
integer, parameter ep
integer, parameter ex
Air parcel data.
Definition: mptrac.h:3120
Climatological data in the form of photolysis rates.
Definition: mptrac.h:3174
Climatological data.
Definition: mptrac.h:3282
Climatological data in the form of time series.
Definition: mptrac.h:3230
Climatological data in the form of zonal means.
Definition: mptrac.h:3250
Control parameters.
Definition: mptrac.h:2155
Meteo data structure.
Definition: mptrac.h:3341