MPTRAC
Loading...
Searching...
No Matches
mptrac.h
Go to the documentation of this file.
1/*
2 This file is part of MPTRAC.
3
4 MPTRAC is free software: you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 MPTRAC is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with MPTRAC. If not, see <http://www.gnu.org/licenses/>.
16
17 Copyright (C) 2013-2026 Forschungszentrum Juelich GmbH
18*/
19
166#ifndef LIBTRAC_H
167#define LIBTRAC_H
168
169/* ------------------------------------------------------------
170 Includes...
171 ------------------------------------------------------------ */
172
173#include <ctype.h>
174#include <float.h>
175#include <gsl/gsl_fft_complex.h>
176#include <gsl/gsl_randist.h>
177#include <gsl/gsl_rng.h>
178#include <gsl/gsl_sort.h>
179#include <gsl/gsl_spline.h>
180#include <gsl/gsl_statistics.h>
181#include <math.h>
182#include <netcdf.h>
183#include <omp.h>
184#include <stdint.h>
185#include <stdio.h>
186#include <stdlib.h>
187#include <string.h>
188#include <time.h>
189#include <sys/time.h>
190
191#ifdef MPI
192#include "mpi.h"
193#endif
194
195#ifdef DD
196#include <netcdf_par.h>
197#endif
198
199#ifdef _OPENACC
200#include "openacc.h"
201#endif
202
203#ifdef CURAND
204#include "curand.h"
205#endif
206
207#ifdef THRUST
208#include "thrustsort.h"
209#endif
210
211#ifdef ZFP
212#include "zfp.h"
213#endif
214
215#ifdef ZSTD
216#include "zstd.h"
217#endif
218
219#ifdef LZ4
220#include "lz4.h"
221#endif
222
223#ifdef SZ3
224#include "SZ3c/sz3c.h"
225#endif
226
227#ifdef CMS
228#include "cmultiscale.h"
229#endif
230
231#ifdef KPP
232#include "chem_Parameters.h"
233#include "chem_Global.h"
234#include "chem_Sparse.h"
235#endif
236
237#ifdef ECCODES
238#include "eccodes.h"
239#else
241#define codes_handle void*
242#endif
243
244/* ------------------------------------------------------------
245 Constants...
246 ------------------------------------------------------------ */
247
249#ifndef AVO
250#define AVO 6.02214076e23
251#endif
252
254#ifndef CPD
255#define CPD 1003.5
256#endif
257
259#ifndef EPS
260#define EPS (MH2O / MA)
261#endif
262
264#ifndef G0
265#define G0 9.80665
266#endif
267
269#ifndef H0
270#define H0 7.0
271#endif
272
274#ifndef LV
275#define LV 2501000.
276#endif
277
279#ifndef KARMAN
280#define KARMAN 0.40
281#endif
282
284#ifndef KB
285#define KB 1.3806504e-23
286#endif
287
289#ifndef MA
290#define MA 28.9644
291#endif
292
294#ifndef MH2O
295#define MH2O 18.01528
296#endif
297
299#ifndef MO3
300#define MO3 48.00
301#endif
302
304#ifndef P0
305#define P0 1013.25
306#endif
307
309#ifndef RA
310#define RA (1e3 * RI / MA)
311#endif
312
314#ifndef RE
315#define RE 6367.421
316#endif
317
319#ifndef RI
320#define RI 8.3144598
321#endif
322
324#ifndef KAPPA
325#define KAPPA 0.286
326#endif
327
329#ifndef OMEGA_EARTH
330#define OMEGA_EARTH 7.2921e-5
331#endif
332
334#ifndef DOBSON_UNIT
335#define DOBSON_UNIT 2.1415e-5
336#endif
337
339#ifndef M_AIR_MOLECULE
340#define M_AIR_MOLECULE 4.8096e-26
341#endif
342
344#ifndef CHEM_REF_TEMP
345#define CHEM_REF_TEMP 298.15
346#endif
347
349#ifndef H2O2_SO2_RATE_REF
350#define H2O2_SO2_RATE_REF 9.1e7
351#endif
352
354#ifndef H2O2_SO2_RATE_TEMP
355#define H2O2_SO2_RATE_TEMP 29700.
356#endif
357
359#ifndef SO2_HENRY_REF
360#define SO2_HENRY_REF 1.3e-2
361#endif
362
364#ifndef SO2_HENRY_TEMP
365#define SO2_HENRY_TEMP 2900.
366#endif
367
369#ifndef H2O2_HENRY_REF
370#define H2O2_HENRY_REF 8.3e2
371#endif
372
374#ifndef H2O2_HENRY_TEMP
375#define H2O2_HENRY_TEMP 7600.
376#endif
377
379#ifndef SO2_CORR_A
380#define SO2_CORR_A 3.12541941e-06
381#endif
382
384#ifndef SO2_CORR_B
385#define SO2_CORR_B -5.72532259e-01
386#endif
387
389#ifndef O1D_RATE_CCL4_A
390#define O1D_RATE_CCL4_A 2.607e-10
391#endif
392
394#ifndef O1D_RATE_CCL4_B
395#define O1D_RATE_CCL4_B 0.
396#endif
397
399#ifndef O1D_RATE_CFC11_A
400#define O1D_RATE_CFC11_A 2.070e-10
401#endif
402
404#ifndef O1D_RATE_CFC11_B
405#define O1D_RATE_CFC11_B 0.
406#endif
407
409#ifndef O1D_RATE_CFC12_A
410#define O1D_RATE_CFC12_A 1.204e-10
411#endif
412
414#ifndef O1D_RATE_CFC12_B
415#define O1D_RATE_CFC12_B -25.
416#endif
417
419#ifndef O1D_RATE_N2O_A
420#define O1D_RATE_N2O_A 1.19e-10
421#endif
422
424#ifndef O1D_RATE_N2O_B
425#define O1D_RATE_N2O_B -20.
426#endif
427
429#ifndef SO2_DISS_K1_REF
430#define SO2_DISS_K1_REF 1.23e-2
431#endif
432
434#ifndef SO2_DISS_K1_TEMP
435#define SO2_DISS_K1_TEMP 2.01e3
436#endif
437
439#ifndef SO2_DISS_K2_REF
440#define SO2_DISS_K2_REF 6e-8
441#endif
442
444#ifndef SO2_DISS_K2_TEMP
445#define SO2_DISS_K2_TEMP 1.12e3
446#endif
447
449#ifndef WET_DEPO_T_LIQUID
450#define WET_DEPO_T_LIQUID T0
451#endif
452
454#ifndef WET_DEPO_T_ICE
455#define WET_DEPO_T_ICE 238.15
456#endif
457
459#ifndef WET_DEPO_T_LIQUID_BC
460#define WET_DEPO_T_LIQUID_BC 270.
461#endif
462
464#ifndef RADIO_HALF_LIFE_RN222
465#define RADIO_HALF_LIFE_RN222 (3.8235 * 86400.0)
466#endif
467
469#ifndef RADIO_HALF_LIFE_PB210
470#define RADIO_HALF_LIFE_PB210 (22.3 * 365.25 * 86400.0)
471#endif
472
474#ifndef RADIO_HALF_LIFE_BE7
475#define RADIO_HALF_LIFE_BE7 (53.22 * 86400.0)
476#endif
477
479#ifndef RADIO_HALF_LIFE_CS137
480#define RADIO_HALF_LIFE_CS137 (30.05 * 365.25 * 86400.0)
481#endif
482
484#ifndef RADIO_HALF_LIFE_I131
485#define RADIO_HALF_LIFE_I131 (8.02 * 86400.0)
486#endif
487
489#ifndef RADIO_HALF_LIFE_XE133
490#define RADIO_HALF_LIFE_XE133 (5.2474 * 86400.0)
491#endif
492
494#ifndef RADIO_DRY_VDEP_PB210
495#define RADIO_DRY_VDEP_PB210 0.002
496#endif
497
499#ifndef RADIO_DRY_VDEP_BE7
500#define RADIO_DRY_VDEP_BE7 0.001
501#endif
502
504#ifndef RADIO_DRY_VDEP_CS137
505#define RADIO_DRY_VDEP_CS137 0.002
506#endif
507
509#ifndef RADIO_DRY_VDEP_I131
510#define RADIO_DRY_VDEP_I131 0.0005
511#endif
512
514#ifndef RADIO_WET_COEFF_PB210
515#define RADIO_WET_COEFF_PB210 1e-4
516#endif
517
519#ifndef RADIO_WET_COEFF_BE7
520#define RADIO_WET_COEFF_BE7 5e-5
521#endif
522
524#ifndef RADIO_WET_COEFF_CS137
525#define RADIO_WET_COEFF_CS137 1e-4
526#endif
527
529#ifndef RADIO_WET_COEFF_I131
530#define RADIO_WET_COEFF_I131 5e-5
531#endif
532
534#ifndef T0
535#define T0 273.15
536#endif
537
538/* ------------------------------------------------------------
539 Dimensions...
540 ------------------------------------------------------------ */
541
543#ifndef EP
544#define EP 140
545#endif
546
548#ifndef EX
549#define EX 1444
550#endif
551
553#ifndef EY
554#define EY 724
555#endif
556
558#ifndef LEN
559#define LEN 5000
560#endif
561
563#ifndef METVAR
564#define METVAR 13
565#endif
566
568#ifndef NP
569#define NP 10000000
570#endif
571
573#ifndef NQ
574#define NQ 15
575#endif
576
578#ifndef NCSI
579#define NCSI 1000000
580#endif
581
583#ifndef NENS
584#define NENS 2000
585#endif
586
588#ifndef NOBS
589#define NOBS 10000000
590#endif
591
593#ifndef NTHREADS
594#define NTHREADS 512
595#endif
596
598#ifndef CY
599#define CY 250
600#endif
601
603#ifndef CO3
604#define CO3 30
605#endif
606
608#ifndef CP
609#define CP 70
610#endif
611
613#ifndef CSZA
614#define CSZA 50
615#endif
616
618#ifndef CT
619#define CT 12
620#endif
621
623#ifndef CTS
624#define CTS 1000
625#endif
626
628#ifndef DD_EX_GLOB
629#define DD_EX_GLOB (EX * 16)
630#endif
631
633#ifndef DD_EY_GLOB
634#define DD_EY_GLOB (EY * 16)
635#endif
636
637/* ------------------------------------------------------------
638 Macros...
639 ------------------------------------------------------------ */
640
660#ifdef _OPENACC
661#define ALLOC(ptr, type, n) do { \
662 if (acc_get_num_devices(acc_device_nvidia) <= 0) \
663 ERRMSG("Not running on a GPU device!"); \
664 if (((ptr) = calloc((size_t)(n), sizeof(type))) == NULL) \
665 ERRMSG("Out of memory!"); \
666 } while (0)
667#else
668#define ALLOC(ptr, type, n) do { \
669 if (((ptr) = calloc((size_t)(n), sizeof(type))) == NULL) \
670 ERRMSG("Out of memory!"); \
671 } while (0)
672#endif
673
692#define ARRAY_2D(ix, iy, ny) \
693 ((ix) * (ny) + (iy))
694
711#define ARRAY_3D(ix, iy, ny, iz, nz) \
712 (((ix)*(ny) + (iy)) * (nz) + (iz))
713
736#define ARRHENIUS(a, b, t) \
737 ((a) * exp( -(b) / (t)))
738
758#define CLAMP(v, lo, hi) \
759 (((v) < (lo)) ? (lo) : (((v) > (hi)) ? (hi) : (v)))
760
773#define COMPRESS_SPEED(nbytes, dt) \
774 ((dt) > 0 ? ((double)(nbytes)) / ((dt) * 1024. * 1024.) : NAN)
775
785#define COMPRESS_RATIO(raw_size, stored_size) \
786 ((double) (raw_size) / (double) (stored_size))
787
797#define COMPRESS_BPV(n, stored_size) \
798 ((8.0 * (double) (stored_size)) / (double) (n))
799
821#define DEG2DX(dlon, lat) \
822 (RE * DEG2RAD(dlon) * cos(DEG2RAD(lat)))
823
842#define DEG2DY(dlat) \
843 (RE * DEG2RAD(dlat))
844
859#define DEG2RAD(deg) \
860 ((deg) * (M_PI / 180.0))
861
884#define DP2DZ(dp, p) \
885 (- (dp) * H0 / (p))
886
906#define DX2DEG(dx, lat) \
907 (((lat) < -89.999 || (lat) > 89.999) ? 0 \
908 : (dx) * 180. / (M_PI * RE * cos(DEG2RAD(lat))))
909
924#define DY2DEG(dy) \
925 ((dy) * 180. / (M_PI * RE))
926
943#define DZ2DP(dz, p) \
944 (-(dz) * (p) / H0)
945
968#define DX2COORD(met, dx, lat) (((met)->coord_type == 0)? DX2DEG((dx) / 1000.0, (lat)) : ((dx) ))
969
991#define DY2COORD(met, dy) (((met)->coord_type == 0)? DY2DEG((dy) / 1000.0) : ((dy) ))
992
1006#define DIST(a, b) \
1007 sqrt(DIST2(a, b))
1008
1022#define DIST2(a, b) \
1023 ((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])+(a[2]-b[2])*(a[2]-b[2]))
1024
1038#define DOTP(a, b) \
1039 (a[0]*b[0]+a[1]*b[1]+a[2]*b[2])
1040
1052#define ECC(cmd) do { \
1053 int ecc_result=(cmd); \
1054 if(ecc_result!=0) \
1055 ERRMSG("ECCODES error: %s", codes_get_error_message(ecc_result)); \
1056 } while (0)
1057
1071#define ECC_READ_2D(variable, target, scaling_factor, found_flag) do { \
1072 if(strcmp(short_name, variable) == 0) { \
1073 if ((found_flag) == 0) \
1074 LOG(2, "Read 2-D variable: %s (GRIB)", variable); \
1075 for (int ix = 0; ix < met->nx; ix++) \
1076 for (int iy = 0; iy < met->ny; iy++) \
1077 target[ix][iy] = (float)(values[iy * met->nx + ix] * scaling_factor); \
1078 found_flag = 1; \
1079 } \
1080 } while (0)
1081
1096#define ECC_READ_3D(variable, level, target, scaling_factor, found_flag) do { \
1097 if(strcmp(short_name, variable) == 0) { \
1098 if ((found_flag) == 0) \
1099 LOG(2, "Read 3-D variable: %s (GRIB)", variable); \
1100 for (int ix = 0; ix < met->nx; ix++) \
1101 for (int iy = 0; iy < met->ny; iy++) \
1102 target[ix][iy][level] = (float) (values[iy * met->nx + ix] * scaling_factor); \
1103 found_flag += 1; \
1104 } \
1105 } while (0)
1106
1123#define FMOD(x, y) \
1124 ((x) - (int) ((x) / (y)) * (y))
1125
1126/* Arguments must be side-effect-free; each may be evaluated more than once. */
1127#define DT_ALIGNED(dt, dt_mod) \
1128 (isfinite(dt) && isfinite(dt_mod) && (dt_mod) > 0 && \
1129 (dt) >= (dt_mod) && (dt) / (dt_mod) <= 0x1p52 && \
1130 fabs((dt) / (dt_mod) - nearbyint((dt) / (dt_mod))) <= \
1131 fmin(8 * DBL_EPSILON * ((dt) / (dt_mod)), 1e-8))
1132
1150#define OBS_TIME_WINDOW(ctl, t, t0, t1) do { \
1151 (t0) = (t) - 0.5 * (ctl)->dt_mod; \
1152 (t1) = (t) + 0.5 * (ctl)->dt_mod; \
1153 const double remaining = (ctl)->direction * ((ctl)->t_stop - (t)); \
1154 if (remaining > 0 && remaining < (ctl)->dt_mod) { \
1155 const double boundary = 0.5 * ((t) + (ctl)->t_stop); \
1156 if ((ctl)->direction > 0) (t1) = boundary; \
1157 else (t0) = boundary; \
1158 } else if ((t) == (ctl)->t_stop) { \
1159 const double remainder = fmod(fabs((ctl)->t_stop - (ctl)->t_start), \
1160 (ctl)->dt_mod); \
1161 if (remainder > 0 && remainder < (ctl)->dt_mod) { \
1162 const double boundary = (t) - 0.5 * (ctl)->direction * remainder; \
1163 if ((ctl)->direction > 0) (t0) = boundary; \
1164 else (t1) = boundary; \
1165 } \
1166 } \
1167 } while (0)
1168
1184#define FREAD(ptr, type, size, in) do { \
1185 if(fread(ptr, sizeof(type), size, in)!=size) \
1186 ERRMSG("Error while reading!"); \
1187 } while (0)
1188
1204#define FWRITE(ptr, type, size, out) do { \
1205 if(fwrite(ptr, sizeof(type), size, out)!=size) \
1206 ERRMSG("Error while writing!"); \
1207 } while (0)
1208
1219#define INTPOL_INIT \
1220 double cw[4] = {0.0, 0.0, 0.0, 0.0}; int ci[3] = {0, 0, 0};
1221
1233#define INTPOL_2D(var, init) do { \
1234 intpol_met_time_2d(met0, met0->var, met1, met1->var, \
1235 atm->time[ip], atm->lon[ip], atm->lat[ip], \
1236 &var, ci, cw, init); \
1237 } while (0)
1238
1251#define INTPOL_3D(var, init) do { \
1252 intpol_met_time_3d(met0, met0->var, met1, met1->var, \
1253 atm->time[ip], atm->p[ip], \
1254 atm->lon[ip], atm->lat[ip], \
1255 &var, ci, cw, init); \
1256 } while (0)
1257
1271#define INTPOL_SPACE_ALL(p, lon, lat) do { \
1272 intpol_met_space_3d(met, met->z, p, lon, lat, &z, ci, cw, 1); \
1273 intpol_met_space_3d(met, met->t, p, lon, lat, &t, ci, cw, 0); \
1274 intpol_met_space_3d(met, met->u, p, lon, lat, &u, ci, cw, 0); \
1275 intpol_met_space_3d(met, met->v, p, lon, lat, &v, ci, cw, 0); \
1276 intpol_met_space_3d(met, met->w, p, lon, lat, &w, ci, cw, 0); \
1277 intpol_met_space_3d(met, met->pv, p, lon, lat, &pv, ci, cw, 0); \
1278 intpol_met_space_3d(met, met->h2o, p, lon, lat, &h2o, ci, cw, 0); \
1279 intpol_met_space_3d(met, met->o3, p, lon, lat, &o3, ci, cw, 0); \
1280 intpol_met_space_3d(met, met->lwc, p, lon, lat, &lwc, ci, cw, 0); \
1281 intpol_met_space_3d(met, met->rwc, p, lon, lat, &rwc, ci, cw, 0); \
1282 intpol_met_space_3d(met, met->iwc, p, lon, lat, &iwc, ci, cw, 0); \
1283 intpol_met_space_3d(met, met->swc, p, lon, lat, &swc, ci, cw, 0); \
1284 intpol_met_space_3d(met, met->cc, p, lon, lat, &cc, ci, cw, 0); \
1285 intpol_met_space_2d(met, met->ps, lon, lat, &ps, ci, cw, 0); \
1286 intpol_met_space_2d(met, met->ts, lon, lat, &ts, ci, cw, 0); \
1287 intpol_met_space_2d(met, met->zs, lon, lat, &zs, ci, cw, 0); \
1288 intpol_met_space_2d(met, met->us, lon, lat, &us, ci, cw, 0); \
1289 intpol_met_space_2d(met, met->vs, lon, lat, &vs, ci, cw, 0); \
1290 intpol_met_space_2d(met, met->ess, ess, lat, &ess, ci, cw, 0); \
1291 intpol_met_space_2d(met, met->nss, nss, lat, &nss, ci, cw, 0); \
1292 intpol_met_space_2d(met, met->shf, shf, lat, &shf, ci, cw, 0); \
1293 intpol_met_space_2d(met, met->lsm, lon, lat, &lsm, ci, cw, 0); \
1294 intpol_met_space_2d(met, met->sst, lon, lat, &sst, ci, cw, 0); \
1295 intpol_met_space_2d(met, met->pbl, lon, lat, &pbl, ci, cw, 0); \
1296 intpol_met_space_2d(met, met->pt, lon, lat, &pt, ci, cw, 0); \
1297 intpol_met_space_2d(met, met->tt, lon, lat, &tt, ci, cw, 0); \
1298 intpol_met_space_2d(met, met->zt, lon, lat, &zt, ci, cw, 0); \
1299 intpol_met_space_2d(met, met->h2ot, lon, lat, &h2ot, ci, cw, 0); \
1300 intpol_met_space_2d(met, met->pct, lon, lat, &pct, ci, cw, 0); \
1301 intpol_met_space_2d(met, met->pcb, lon, lat, &pcb, ci, cw, 0); \
1302 intpol_met_space_2d(met, met->cl, lon, lat, &cl, ci, cw, 0); \
1303 intpol_met_space_2d(met, met->plcl, lon, lat, &plcl, ci, cw, 0); \
1304 intpol_met_space_2d(met, met->plfc, lon, lat, &plfc, ci, cw, 0); \
1305 intpol_met_space_2d(met, met->pel, lon, lat, &pel, ci, cw, 0); \
1306 intpol_met_space_2d(met, met->cape, lon, lat, &cape, ci, cw, 0); \
1307 intpol_met_space_2d(met, met->cin, lon, lat, &cin, ci, cw, 0); \
1308 intpol_met_space_2d(met, met->o3c, lon, lat, &o3c, ci, cw, 0); \
1309 } while (0)
1310
1325#define INTPOL_TIME_ALL(time, p, lon, lat) do { \
1326 intpol_met_time_3d(met0, met0->z, met1, met1->z, time, p, lon, lat, &z, ci, cw, 1); \
1327 intpol_met_time_3d(met0, met0->t, met1, met1->t, time, p, lon, lat, &t, ci, cw, 0); \
1328 intpol_met_time_3d(met0, met0->u, met1, met1->u, time, p, lon, lat, &u, ci, cw, 0); \
1329 intpol_met_time_3d(met0, met0->v, met1, met1->v, time, p, lon, lat, &v, ci, cw, 0); \
1330 intpol_met_time_3d(met0, met0->w, met1, met1->w, time, p, lon, lat, &w, ci, cw, 0); \
1331 intpol_met_time_3d(met0, met0->pv, met1, met1->pv, time, p, lon, lat, &pv, ci, cw, 0); \
1332 intpol_met_time_3d(met0, met0->h2o, met1, met1->h2o, time, p, lon, lat, &h2o, ci, cw, 0); \
1333 intpol_met_time_3d(met0, met0->o3, met1, met1->o3, time, p, lon, lat, &o3, ci, cw, 0); \
1334 intpol_met_time_3d(met0, met0->lwc, met1, met1->lwc, time, p, lon, lat, &lwc, ci, cw, 0); \
1335 intpol_met_time_3d(met0, met0->rwc, met1, met1->rwc, time, p, lon, lat, &rwc, ci, cw, 0); \
1336 intpol_met_time_3d(met0, met0->iwc, met1, met1->iwc, time, p, lon, lat, &iwc, ci, cw, 0); \
1337 intpol_met_time_3d(met0, met0->swc, met1, met1->swc, time, p, lon, lat, &swc, ci, cw, 0); \
1338 intpol_met_time_3d(met0, met0->cc, met1, met1->cc, time, p, lon, lat, &cc, ci, cw, 0); \
1339 intpol_met_time_2d(met0, met0->ps, met1, met1->ps, time, lon, lat, &ps, ci, cw, 0); \
1340 intpol_met_time_2d(met0, met0->ts, met1, met1->ts, time, lon, lat, &ts, ci, cw, 0); \
1341 intpol_met_time_2d(met0, met0->zs, met1, met1->zs, time, lon, lat, &zs, ci, cw, 0); \
1342 intpol_met_time_2d(met0, met0->us, met1, met1->us, time, lon, lat, &us, ci, cw, 0); \
1343 intpol_met_time_2d(met0, met0->vs, met1, met1->vs, time, lon, lat, &vs, ci, cw, 0); \
1344 intpol_met_time_2d(met0, met0->ess, met1, met1->ess, time, lon, lat, &ess, ci, cw, 0); \
1345 intpol_met_time_2d(met0, met0->nss, met1, met1->nss, time, lon, lat, &nss, ci, cw, 0); \
1346 intpol_met_time_2d(met0, met0->shf, met1, met1->shf, time, lon, lat, &shf, ci, cw, 0); \
1347 intpol_met_time_2d(met0, met0->lsm, met1, met1->lsm, time, lon, lat, &lsm, ci, cw, 0); \
1348 intpol_met_time_2d(met0, met0->sst, met1, met1->sst, time, lon, lat, &sst, ci, cw, 0); \
1349 intpol_met_time_2d(met0, met0->pbl, met1, met1->pbl, time, lon, lat, &pbl, ci, cw, 0); \
1350 intpol_met_time_2d(met0, met0->pt, met1, met1->pt, time, lon, lat, &pt, ci, cw, 0); \
1351 intpol_met_time_2d(met0, met0->tt, met1, met1->tt, time, lon, lat, &tt, ci, cw, 0); \
1352 intpol_met_time_2d(met0, met0->zt, met1, met1->zt, time, lon, lat, &zt, ci, cw, 0); \
1353 intpol_met_time_2d(met0, met0->h2ot, met1, met1->h2ot, time, lon, lat, &h2ot, ci, cw, 0); \
1354 intpol_met_time_2d(met0, met0->pct, met1, met1->pct, time, lon, lat, &pct, ci, cw, 0); \
1355 intpol_met_time_2d(met0, met0->pcb, met1, met1->pcb, time, lon, lat, &pcb, ci, cw, 0); \
1356 intpol_met_time_2d(met0, met0->cl, met1, met1->cl, time, lon, lat, &cl, ci, cw, 0); \
1357 intpol_met_time_2d(met0, met0->plcl, met1, met1->plcl, time, lon, lat, &plcl, ci, cw, 0); \
1358 intpol_met_time_2d(met0, met0->plfc, met1, met1->plfc, time, lon, lat, &plfc, ci, cw, 0); \
1359 intpol_met_time_2d(met0, met0->pel, met1, met1->pel, time, lon, lat, &pel, ci, cw, 0); \
1360 intpol_met_time_2d(met0, met0->cape, met1, met1->cape, time, lon, lat, &cape, ci, cw, 0); \
1361 intpol_met_time_2d(met0, met0->cin, met1, met1->cin, time, lon, lat, &cin, ci, cw, 0); \
1362 intpol_met_time_2d(met0, met0->o3c, met1, met1->o3c, time, lon, lat, &o3c, ci, cw, 0); \
1363 } while (0)
1364
1379#define LAPSE(p1, t1, p2, t2) \
1380 (1e3 * G0 / RA * ((t2) - (t1)) / ((t2) + (t1)) \
1381 * ((p2) + (p1)) / ((p2) - (p1)))
1382
1398#define LIN(x0, y0, x1, y1, x) \
1399 ((y0)+((y1)-(y0))/((x1)-(x0))*((x)-(x0)))
1400
1425#define MAX(a,b) \
1426 (((a)>(b))?(a):(b))
1427
1439#define MET_HEADER do { \
1440 fprintf(out, \
1441 "# $1 = time [s]\n" \
1442 "# $2 = altitude [km]\n" \
1443 "# $3 = longitude [deg]\n" \
1444 "# $4 = latitude [deg]\n" \
1445 "# $5 = pressure [hPa]\n" \
1446 "# $6 = temperature [K]\n" \
1447 "# $7 = zonal wind [m/s]\n" \
1448 "# $8 = meridional wind [m/s]\n" \
1449 "# $9 = vertical velocity [hPa/s]\n" \
1450 "# $10 = H2O volume mixing ratio [ppv]\n"); \
1451 fprintf(out, \
1452 "# $11 = O3 volume mixing ratio [ppv]\n" \
1453 "# $12 = geopotential height [km]\n" \
1454 "# $13 = potential vorticity [PVU]\n" \
1455 "# $14 = surface pressure [hPa]\n" \
1456 "# $15 = surface temperature [K]\n" \
1457 "# $16 = surface geopotential height [km]\n" \
1458 "# $17 = surface zonal wind [m/s]\n" \
1459 "# $18 = surface meridional wind [m/s]\n" \
1460 "# $19 = eastward turbulent surface stress [N/m^2]\n" \
1461 "# $20 = northward turbulent surface stress [N/m^2]\n"); \
1462 fprintf(out, \
1463 "# $21 = surface sensible heat flux [W/m^2]\n" \
1464 "# $22 = land-sea mask [1]\n" \
1465 "# $23 = sea surface temperature [K]\n" \
1466 "# $24 = tropopause pressure [hPa]\n" \
1467 "# $25 = tropopause geopotential height [km]\n" \
1468 "# $26 = tropopause temperature [K]\n" \
1469 "# $27 = tropopause water vapor [ppv]\n" \
1470 "# $28 = cloud liquid water content [kg/kg]\n" \
1471 "# $29 = cloud rain water content [kg/kg]\n" \
1472 "# $30 = cloud ice water content [kg/kg]\n"); \
1473 fprintf(out, \
1474 "# $31 = cloud snow water content [kg/kg]\n" \
1475 "# $32 = cloud cover [1]\n" \
1476 "# $33 = total column cloud water [kg/m^2]\n" \
1477 "# $34 = cloud top pressure [hPa]\n" \
1478 "# $35 = cloud bottom pressure [hPa]\n" \
1479 "# $36 = pressure at lifted condensation level (LCL) [hPa]\n" \
1480 "# $37 = pressure at level of free convection (LFC) [hPa]\n" \
1481 "# $38 = pressure at equilibrium level (EL) [hPa]\n" \
1482 "# $39 = convective available potential energy (CAPE) [J/kg]\n" \
1483 "# $40 = convective inhibition (CIN) [J/kg]\n"); \
1484 fprintf(out, \
1485 "# $41 = relative humidity over water [%%]\n" \
1486 "# $42 = relative humidity over ice [%%]\n" \
1487 "# $43 = dew point temperature [K]\n" \
1488 "# $44 = frost point temperature [K]\n" \
1489 "# $45 = NAT temperature [K]\n" \
1490 "# $46 = HNO3 volume mixing ratio [ppv]\n" \
1491 "# $47 = OH volume mixing ratio [ppv]\n" \
1492 "# $48 = H2O2 volume mixing ratio [ppv]\n" \
1493 "# $49 = HO2 volume mixing ratio [ppv]\n" \
1494 "# $50 = O(1D) volume mixing ratio [ppv]\n"); \
1495 fprintf(out, \
1496 "# $51 = boundary layer pressure [hPa]\n" \
1497 "# $52 = total column ozone [DU]\n" \
1498 "# $53 = number of data points\n" \
1499 "# $54 = number of tropopause data points\n" \
1500 "# $55 = number of CAPE data points\n"); \
1501 } while (0)
1502
1527#define MIN(a,b) \
1528 (((a)<(b))?(a):(b))
1529
1541#define MOLEC_DENS(p,t) \
1542 (AVO * 1e-6 * ((p) * 100) / (RI * (t)))
1543
1555#define NC(cmd) do { \
1556 int nc_result=(cmd); \
1557 if(nc_result!=NC_NOERR) \
1558 ERRMSG("%s", nc_strerror(nc_result)); \
1559 } while (0)
1560
1584#define NC_DEF_VAR(varname, type, ndims, dims, long_name, units, level, quant) do { \
1585 NC(nc_def_var(ncid, varname, type, ndims, dims, &varid)); \
1586 NC(nc_put_att_text(ncid, varid, "long_name", strnlen(long_name, LEN), long_name)); \
1587 NC(nc_put_att_text(ncid, varid, "units", strnlen(units, LEN), units)); \
1588 NC_DEF_VAR_QUANTIZE(quant); \
1589 if((level) != 0) { \
1590 NC(nc_def_var_deflate(ncid, varid, 1, 1, level)); \
1591 /* unsigned int ulevel = (unsigned int)level; */ \
1592 /* NC(nc_def_var_filter(ncid, varid, 32015, 1, (unsigned int[]){ulevel})); */ \
1593 } \
1594 } while (0)
1595
1596#ifdef NC_QUANTIZE_GRANULARBR
1597#define NC_DEF_VAR_QUANTIZE(quant) do { \
1598 if((quant) > 0) \
1599 NC(nc_def_var_quantize(ncid, varid, NC_QUANTIZE_GRANULARBR, quant)); \
1600 } while(0)
1601#else
1602#define NC_DEF_VAR_QUANTIZE(quant) do { \
1603 if((quant) > 0) \
1604 ERRMSG("NetCDF quantization is not supported by this NetCDF version"); \
1605 } while(0)
1606#endif
1607
1625#define NC_GET_DOUBLE(varname, ptr, force) do { \
1626 if(force) { \
1627 NC(nc_inq_varid(ncid, varname, &varid)); \
1628 NC(nc_get_var_double(ncid, varid, ptr)); \
1629 } else { \
1630 if(nc_inq_varid(ncid, varname, &varid) == NC_NOERR) { \
1631 NC(nc_get_var_double(ncid, varid, ptr)); \
1632 } else \
1633 WARN("netCDF variable %s is missing!", varname); \
1634 } \
1635 } while (0)
1636
1655#define NC_INQ_DIM(dimname, ptr, min, max, check) do { \
1656 int dimid; size_t naux; \
1657 NC(nc_inq_dimid(ncid, dimname, &dimid)); \
1658 NC(nc_inq_dimlen(ncid, dimid, &naux)); \
1659 *ptr = (int)naux; \
1660 if (check) \
1661 if ((*ptr) < (min) || (*ptr) > (max)) \
1662 ERRMSG("Dimension %s is out of range!", dimname); \
1663 } while (0)
1664
1679#define NC_PUT_DOUBLE(varname, ptr, hyperslab) do { \
1680 NC(nc_inq_varid(ncid, varname, &varid)); \
1681 if(hyperslab) { \
1682 NC(nc_put_vara_double(ncid, varid, start, count, ptr)); \
1683 } else { \
1684 NC(nc_put_var_double(ncid, varid, ptr)); \
1685 } \
1686 } while (0)
1687
1703#define NC_PUT_FLOAT(varname, ptr, hyperslab) do { \
1704 NC(nc_inq_varid(ncid, varname, &varid)); \
1705 if(hyperslab) { \
1706 NC(nc_put_vara_float(ncid, varid, start, count, ptr)); \
1707 } else { \
1708 NC(nc_put_var_float(ncid, varid, ptr)); \
1709 } \
1710 } while (0)
1711
1726#define NC_PUT_INT(varname, ptr, hyperslab) do { \
1727 NC(nc_inq_varid(ncid, varname, &varid)); \
1728 if(hyperslab) { \
1729 NC(nc_put_vara_int(ncid, varid, start, count, ptr)); \
1730 } else { \
1731 NC(nc_put_var_int(ncid, varid, ptr)); \
1732 } \
1733 } while (0)
1734
1748#define NC_PUT_ATT(varname, attname, text) do { \
1749 NC(nc_inq_varid(ncid, varname, &varid)); \
1750 NC(nc_put_att_text(ncid, varid, attname, strnlen(text, LEN), text)); \
1751 } while (0)
1752
1765#define NC_PUT_ATT_GLOBAL(attname, text) do { \
1766 NC(nc_put_att_text(ncid, NC_GLOBAL, attname, strnlen(text, LEN), text)); \
1767 } while (0)
1768
1786#define NN(x0, y0, x1, y1, x) \
1787 (fabs((x) - (x0)) <= fabs((x) - (x1)) ? (y0) : (y1))
1788
1804#ifdef _OPENACC
1805#define PARTICLE_LOOP(ip0, ip1, check_dt, ...) \
1806 const int ip0_const = ip0; \
1807 const int ip1_const = ip1; \
1808 _Pragma(__VA_ARGS__) \
1809 _Pragma("acc parallel loop independent gang vector") \
1810 for (int ip = ip0_const; ip < ip1_const; ip++) \
1811 if (!check_dt || cache->dt[ip] != 0)
1812#else
1813#define PARTICLE_LOOP(ip0, ip1, check_dt, ...) \
1814 const int ip0_const = ip0; \
1815 const int ip1_const = ip1; \
1816 _Pragma("omp parallel for default(shared)") \
1817 for (int ip = ip0_const; ip < ip1_const; ip++) \
1818 if (!check_dt || cache->dt[ip] != 0)
1819#endif
1820
1843#define P(z) \
1844 (P0 * exp(-(z) / H0))
1845
1867#define PSAT(t) \
1868 (6.112 * exp(17.62 * ((t) - T0) / (243.12 + (t) - T0)))
1869
1891#define PSICE(t) \
1892 (6.112 * exp(22.46 * ((t) - T0) / (272.62 + (t) - T0)))
1893
1918#define PW(p, h2o) \
1919 ((p) * MAX((h2o), 0.1e-6) / (1. + (1. - EPS) * MAX((h2o), 0.1e-6)))
1920
1935#define RAD2DEG(rad) \
1936 ((rad) * (180.0 / M_PI))
1937
1965#define RH(p, t, h2o) \
1966 (PW(p, h2o) / PSAT(t) * 100.)
1967
1995#define RHICE(p, t, h2o) \
1996 (PW(p, h2o) / PSICE(t) * 100.)
1997
2020#define RHO(p, t) \
2021 (100. * (p) / (RA * (t)))
2022
2039#define SET_ATM(qnt, val) do { \
2040 if (ctl->qnt >= 0) \
2041 atm->q[ctl->qnt][ip] = val; \
2042 } while (0)
2043
2063#define SET_QNT(qnt, name, longname, unit) \
2064 if (strcasecmp(ctl->qnt_name[iq], name) == 0) { \
2065 ctl->qnt = iq; \
2066 sprintf(ctl->qnt_longname[iq], longname); \
2067 sprintf(ctl->qnt_unit[iq], unit); \
2068 } else
2069
2084#define SH(h2o) \
2085 (EPS * MAX((h2o), 0.1e-6))
2086
2097#define SQR(x) \
2098 ((x)*(x))
2099
2111#define SWAP(x, y, type) \
2112 do {type tmp = x; x = y; y = tmp;} while(0)
2113
2135#define TDEW(p, h2o) \
2136 (T0 + 243.12 * log(PW((p), (h2o)) / 6.112) \
2137 / (17.62 - log(PW((p), (h2o)) / 6.112)))
2138
2160#define TICE(p, h2o) \
2161 (T0 + 272.62 * log(PW((p), (h2o)) / 6.112) \
2162 / (22.46 - log(PW((p), (h2o)) / 6.112)))
2163
2184#define THETA(p, t) \
2185 ((t) * pow(1000. / (p), KAPPA))
2186
2213#define THETAVIRT(p, t, h2o) \
2214 (TVIRT(THETA((p), (t)), MAX((h2o), 0.1e-6)))
2215
2234#define TOK(line, tok, format, var) { \
2235 if(((tok)=strtok((line), " \t"))) { \
2236 if(sscanf(tok, format, &(var))!=1) continue; \
2237 } else ERRMSG("Error while reading!"); \
2238 }
2239
2259#define TVIRT(t, h2o) \
2260 ((t) * (1. + (1. - EPS) * MAX((h2o), 0.1e-6)))
2261
2273#define USAGE \
2274 do { \
2275 int iusage; \
2276 for (iusage = 1; iusage < argc; iusage++) \
2277 if (!strcmp(argv[iusage], "-h") \
2278 || !strcmp(argv[iusage], "--help")) { \
2279 usage(); \
2280 return EXIT_SUCCESS; \
2281 } \
2282 } while (0)
2283
2303#define Z(p) \
2304 (H0 * log(P0 / (p)))
2305
2334#define ZDIFF(lnp0, t0, h2o0, lnp1, t1, h2o1) \
2335 (RI / MA / G0 * 0.5 * (TVIRT((t0), (h2o0)) + TVIRT((t1), (h2o1))) \
2336 * ((lnp0) - (lnp1)))
2337
2353#define ZETA(ps, p, t) \
2354 (((p) / (ps) <= 0.3 ? 1. : \
2355 sin(M_PI / 2. * (1. - (p) / (ps)) / (1. - 0.3))) \
2356 * THETA((p), (t)))
2357
2358/* ------------------------------------------------------------
2359 Log messages...
2360 ------------------------------------------------------------ */
2361
2363#ifndef LOGLEV
2364#define LOGLEV 2
2365#endif
2366
2396#define LOG(level, ...) do { \
2397 if(level >= 2) \
2398 printf(" "); \
2399 if(level <= LOGLEV) { \
2400 printf(__VA_ARGS__); \
2401 printf("\n"); \
2402 } \
2403 } while (0)
2404
2433#define WARN(...) do { \
2434 printf("\nWarning (%s, %s, l%d): ", __FILE__, __func__, __LINE__); \
2435 LOG(0, __VA_ARGS__); \
2436 } while (0)
2437
2466#define ERRMSG(...) do { \
2467 printf("\nError (%s, %s, l%d): ", __FILE__, __func__, __LINE__); \
2468 LOG(0, __VA_ARGS__); \
2469 exit(EXIT_FAILURE); \
2470 } while (0)
2471
2501#define PRINT(format, var) do { \
2502 printf("Print (%s, %s, l%d): %s= "format"\n", \
2503 __FILE__, __func__, __LINE__, #var, var); \
2504 } while (0)
2505
2506/* ------------------------------------------------------------
2507 Timers...
2508 ------------------------------------------------------------ */
2509
2511#define NTIMER 100
2512
2526#define PRINT_TIMERS do { \
2527 timer("END", "END", 1); \
2528 } while (0)
2529
2542#define SELECT_TIMER(id, group) do { \
2543 timer(id, group, 0); \
2544 } while (0)
2545
2546/* ------------------------------------------------------------
2547 Structs...
2548 ------------------------------------------------------------ */
2549
2557typedef struct {
2558
2559 /* ------------------------------------------------------------
2560 Quantity parameters...
2561 ------------------------------------------------------------ */
2562
2564 int nq;
2565
2567 char qnt_name[NQ][LEN];
2568
2570 char qnt_longname[NQ][LEN];
2571
2573 char qnt_unit[NQ][LEN];
2574
2576 char qnt_format[NQ][LEN];
2577
2580
2583
2586
2589
2592
2595
2598
2601
2604
2607
2610
2613
2616
2619
2622
2625
2628
2631
2634
2637
2640
2643
2646
2649
2652
2655
2658
2661
2664
2667
2670
2673
2676
2679
2682
2685
2688
2691
2694
2697
2700
2703
2706
2709
2712
2715
2718
2721
2724
2727
2730
2733
2736
2739
2742
2745
2748
2751
2754
2757
2760
2763
2766
2769
2772
2775
2778
2781
2784
2787
2790
2793
2796
2799
2802
2805
2808
2811
2814
2817
2820
2823
2826
2829
2832
2835
2838
2841
2844
2847
2850
2853
2856
2859
2862
2866
2869
2872
2875
2878
2881
2884
2887
2890
2893
2895 double t_start;
2896
2898 double t_stop;
2899
2901 double dt_mod;
2902
2903 /* ------------------------------------------------------------
2904 Meteo data parameters...
2905 ------------------------------------------------------------ */
2906
2908 char metbase[LEN];
2909
2911 double dt_met;
2912
2915
2918
2921
2924
2928
2931
2935
2938
2941
2944
2947
2950
2953
2956
2959
2962
2964 int met_zfp_prec[METVAR];
2965
2967 double met_zfp_tol[METVAR];
2968
2970 int met_sz3_prec[METVAR];
2971
2973 double met_sz3_tol[METVAR];
2974
2976 int met_lossy_scale[METVAR];
2977
2979 char met_comp_logfile[LEN];
2980
2983
2986
2989
2992
2995
2997 double met_cms_eps[METVAR];
2998
3001
3004
3007
3010
3013
3016
3019
3022
3024 double met_p[EP];
3025
3028
3031
3033 double met_lev_hyam[EP];
3034
3036 double met_lev_hybm[EP];
3037
3040
3043
3046
3049
3052
3055
3058
3062
3065
3068
3071
3074
3077
3080
3081 /* ------------------------------------------------------------
3082 Geophysical module parameters...
3083 ------------------------------------------------------------ */
3084
3086 double sort_dt;
3087
3091
3093 char balloon[LEN];
3094
3097
3101
3104
3107
3110
3112 double dt_pbl;
3113
3116
3119
3122
3125
3128
3131
3134
3137
3140
3143
3146
3149
3151 double conv_cin;
3152
3154 double conv_dt;
3155
3158
3161
3164
3167
3170
3173
3175 double bound_p0;
3176
3178 double bound_p1;
3179
3182
3185
3188
3191
3193 char species[LEN];
3194
3196 double molmass;
3197
3200
3203
3206
3208 char clim_hno3_filename[LEN];
3209
3211 char clim_oh_filename[LEN];
3212
3214 char clim_h2o2_filename[LEN];
3215
3217 char clim_ho2_filename[LEN];
3218
3220 char clim_o1d_filename[LEN];
3221
3223 char clim_o3_filename[LEN];
3224
3226 char clim_ccl4_timeseries[LEN];
3227
3229 char clim_ccl3f_timeseries[LEN];
3230
3232 char clim_ccl2f2_timeseries[LEN];
3233
3235 char clim_n2o_timeseries[LEN];
3236
3238 char clim_sf6_timeseries[LEN];
3239
3242
3245
3248
3251
3254
3257
3260
3263
3266
3269
3272
3275
3278
3281
3284
3287
3290
3293
3296
3299
3302
3305
3307 double oh_chem[4];
3308
3311
3314
3317
3319 double dt_kpp;
3320
3323
3326
3329
3331 double wet_depo_pre[2];
3332
3335
3338
3341
3344
3346 double wet_depo_ic_h[2];
3347
3349 double wet_depo_bc_h[2];
3350
3353
3356
3359
3362
3365
3368
3370 double psc_h2o;
3371
3373 double psc_hno3;
3374
3375 /* ------------------------------------------------------------
3376 Output parameters...
3377 ------------------------------------------------------------ */
3378
3380 char depo_basename[LEN];
3381
3384
3387
3389 char atm_basename[LEN];
3390
3392 char atm_gpfile[LEN];
3393
3396
3399
3402
3406
3411
3414
3416 int atm_nc_quant[NQ];
3417
3420
3422 char budget_basename[LEN];
3423
3426
3428 char csi_basename[LEN];
3429
3431 char csi_kernel[LEN];
3432
3435
3437 char csi_obsfile[LEN];
3438
3441
3444
3447
3449 double csi_z0;
3450
3452 double csi_z1;
3453
3456
3458 double csi_lon0;
3459
3461 double csi_lon1;
3462
3465
3467 double csi_lat0;
3468
3470 double csi_lat1;
3471
3473 int nens;
3474
3476 char ens_basename[LEN];
3477
3480
3482 char grid_basename[LEN];
3483
3485 char grid_kernel[LEN];
3486
3488 char grid_gpfile[LEN];
3489
3492
3495
3498
3500 int grid_nc_quant[NQ];
3501
3504
3507
3509 double grid_z0;
3510
3512 double grid_z1;
3513
3516
3519
3522
3525
3528
3531
3534
3536 char prof_basename[LEN];
3537
3539 char prof_obsfile[LEN];
3540
3543
3545 double prof_z0;
3546
3548 double prof_z1;
3549
3552
3555
3558
3561
3564
3567
3569 char sample_basename[LEN];
3570
3572 char sample_kernel[LEN];
3573
3575 char sample_obsfile[LEN];
3576
3579
3582
3584 char stat_basename[LEN];
3585
3587 double stat_lon;
3588
3590 double stat_lat;
3591
3593 double stat_r;
3594
3596 double stat_t0;
3597
3599 double stat_t1;
3600
3602 char vtk_basename[LEN];
3603
3606
3609
3612
3615
3618
3619 /* ------------------------------------------------------------
3620 Domain decomposition...
3621 ------------------------------------------------------------ */
3622
3627 int dd;
3628
3632
3636
3640
3643
3646
3651
3652} ctl_t;
3653
3662typedef struct {
3663
3665 int np;
3666
3668 double time[NP];
3669
3671 double p[NP];
3672
3674 double lon[NP];
3675
3677 double lat[NP];
3678
3680 double q[NQ][NP];
3681
3682} atm_t;
3683
3692typedef struct {
3693
3695 double time;
3696
3698 double p;
3699
3701 double lon;
3702
3704 double lat;
3705
3707 double dt;
3708
3710 double q[NQ];
3711
3713 float uvwp[3];
3714
3715} particle_t;
3716
3717
3723typedef struct {
3724
3726 double iso_ps[NP];
3727
3729 double iso_ts[NP];
3730
3733
3735 float uvwp[NP][3];
3736
3738 double rs[3 * NP + 1];
3739
3741 double dt[NP];
3742
3743} cache_t;
3744
3756typedef struct {
3757
3759 double Apb210[EX * EY];
3760
3762 double Abe7[EX * EY];
3763
3765 double Acs137[EX * EY];
3766
3768 double Ai131[EX * EY];
3769
3770} depo_t;
3771
3779typedef struct {
3780
3782 int np;
3783
3785 int nsza;
3786
3788 int no3c;
3789
3791 double p[CP];
3792
3794 double sza[CSZA];
3795
3797 double o3c[CO3];
3798
3800 double n2o[CP][CSZA][CO3];
3801
3803 double ccl4[CP][CSZA][CO3];
3804
3806 double ccl3f[CP][CSZA][CO3];
3807
3809 double ccl2f2[CP][CSZA][CO3];
3810
3812 double o2[CP][CSZA][CO3];
3813
3815 double o3_1[CP][CSZA][CO3];
3816
3818 double o3_2[CP][CSZA][CO3];
3819
3821 double h2o2[CP][CSZA][CO3];
3822
3824 double h2o[CP][CSZA][CO3];
3825
3826} clim_photo_t;
3827
3835typedef struct {
3836
3839
3841 double time[CTS];
3842
3844 double vmr[CTS];
3845
3846} clim_ts_t;
3847
3855typedef struct {
3856
3859
3861 int nlat;
3862
3864 int np;
3865
3867 double time[CT];
3868
3870 double lat[CY];
3871
3873 double p[CP];
3874
3876 double vmr[CT][CP][CY];
3877
3878} clim_zm_t;
3879
3887typedef struct {
3888
3891
3894
3896 double tropo_time[12];
3897
3899 double tropo_lat[73];
3900
3902 double tropo[12][73];
3903
3906
3909
3912
3915
3918
3921
3924
3927
3930
3933
3936
3937} clim_t;
3938
3946typedef struct {
3947
3949 double time;
3950
3951 /* Grid type: 0=lat/lon [deg], 1=UTM [m]. */
3953
3955 int nx;
3956
3958 int ny;
3959
3961 int np;
3962
3964 int npl;
3965
3967 double lon[EX];
3968
3970 double lat[EY];
3971
3973 double p[EP];
3974
3976 double hybrid[EP];
3977
3979 double hyam[EP];
3980
3982 double hybm[EP];
3983
3985 double eta[EP];
3986
3988 float ps[EX][EY];
3989
3991 float ts[EX][EY];
3992
3994 float zs[EX][EY];
3995
3997 float us[EX][EY];
3998
4000 float vs[EX][EY];
4001
4003 float ess[EX][EY];
4004
4006 float nss[EX][EY];
4007
4009 float shf[EX][EY];
4010
4012 float lsm[EX][EY];
4013
4015 float sst[EX][EY];
4016
4018 float pbl[EX][EY];
4019
4021 float pt[EX][EY];
4022
4024 float tt[EX][EY];
4025
4027 float zt[EX][EY];
4028
4030 float h2ot[EX][EY];
4031
4033 float pct[EX][EY];
4034
4036 float pcb[EX][EY];
4037
4039 float cl[EX][EY];
4040
4042 float plcl[EX][EY];
4043
4045 float plfc[EX][EY];
4046
4048 float pel[EX][EY];
4049
4051 float cape[EX][EY];
4052
4054 float cin[EX][EY];
4055
4057 float o3c[EX][EY];
4058
4060 float z[EX][EY][EP];
4061
4063 float t[EX][EY][EP];
4064
4066 float u[EX][EY][EP];
4067
4069 float v[EX][EY][EP];
4070
4072 float w[EX][EY][EP];
4073
4075 float pv[EX][EY][EP];
4076
4078 float h2o[EX][EY][EP];
4079
4081 float o3[EX][EY][EP];
4082
4084 float lwc[EX][EY][EP];
4085
4087 float rwc[EX][EY][EP];
4088
4090 float iwc[EX][EY][EP];
4091
4093 float swc[EX][EY][EP];
4094
4096 float cc[EX][EY][EP];
4097
4099 float pl[EX][EY][EP];
4100
4102 float ul[EX][EY][EP];
4103
4105 float vl[EX][EY][EP];
4106
4108 float wl[EX][EY][EP];
4109
4111 float zetal[EX][EY][EP];
4112
4114 float zeta_dotl[EX][EY][EP];
4115
4116} met_t;
4117
4123typedef struct {
4124
4125 /* ------------------------------------------------------------
4126 Global grid...
4127 ------------------------------------------------------------ */
4128
4131
4134
4136 double lon_glob[DD_EX_GLOB];
4137
4139 double lat_glob[DD_EY_GLOB];
4140
4141 /* ------------------------------------------------------------
4142 Subdomains...
4143 ------------------------------------------------------------ */
4144
4146 size_t subdomain_start[4];
4147
4149 size_t subdomain_count[4];
4150
4152 size_t halo_bnd_start[4];
4153
4155 size_t halo_bnd_count[4];
4156
4159
4162
4163 /* ------------------------------------------------------------
4164 Helpers...
4165 ------------------------------------------------------------ */
4166
4167#ifdef DD
4168
4170 MPI_Datatype MPI_Particle;
4171
4173 double sort_key[NP];
4174
4176 int perm[NP];
4177
4179 double tmp[NP];
4180
4181#endif
4182
4183} dd_t;
4184
4185/* ------------------------------------------------------------
4186 Functions...
4187 ------------------------------------------------------------ */
4188
4211 void *data,
4212 size_t N);
4213
4228void cart2geo(
4229 const double *x,
4230 double *z,
4231 double *lon,
4232 double *lat);
4233
4256double clim_oh(
4257 const ctl_t * ctl,
4258 const clim_t * clim,
4259 const double t,
4260 const double lon,
4261 const double lat,
4262 const double p);
4263
4283 const ctl_t * ctl,
4284 clim_t * clim);
4285
4315double clim_photo(
4316 const double rate[CP][CSZA][CO3],
4317 const clim_photo_t * photo,
4318 const double p,
4319 const double sza,
4320 const double o3c);
4321
4347double clim_tropo(
4348 const clim_t * clim,
4349 const double t,
4350 const double lat);
4351
4370void clim_tropo_init(
4371 clim_t * clim);
4372
4389double clim_ts(
4390 const clim_ts_t * ts,
4391 const double t);
4392
4414double clim_zm(
4415 const clim_zm_t * zm,
4416 const double t,
4417 const double lat,
4418 const double p);
4419
4444 FILE * out,
4445 const char *codec,
4446 const char *varname,
4447 const size_t lev,
4448 const double plev,
4449 const double ratio,
4450 const double bpv,
4451 const double t_comp,
4452 const double t_decomp,
4453 const size_t n,
4454 const size_t nbytes,
4455 const float *org,
4456 const float *cmp);
4457
4481 FILE * out,
4482 const char *codec,
4483 const char *varname,
4484 const met_t * met,
4485 const float *org_all,
4486 const float *cmp_all,
4487 const size_t nxy,
4488 const size_t nz,
4489 const double ratio,
4490 const double bpv,
4491 const double t_comp,
4492 const double t_decomp,
4493 const size_t nbytes);
4494
4513 const ctl_t * ctl,
4514 const met_t * met,
4515 const char *varname,
4516 float *array,
4517 const int decompress,
4518 FILE * level_log,
4519 FILE * inout);
4520
4537 float *array,
4538 const size_t nxy,
4539 const size_t nz,
4540 double *off,
4541 double *scl);
4542
4559 float *array,
4560 const size_t nxy,
4561 const size_t nz,
4562 const double *off,
4563 const double *scl);
4564
4582 FILE * in,
4583 const size_t nz,
4584 double **off,
4585 double **scl);
4586
4606 FILE * out,
4607 const int enabled,
4608 float *array,
4609 const size_t nxy,
4610 const size_t nz,
4611 double **off,
4612 double **scl);
4613
4614#ifdef ZSTD
4627ZSTD_CCtx *compress_zstd_create_cctx(
4628 const int level,
4629 const int nworkers);
4630#endif
4631
4644 const char *varname);
4645
4665void compress_pck(
4666 const ctl_t * ctl,
4667 const met_t * met,
4668 const char *varname,
4669 float *array,
4670 const int decompress,
4671 FILE * level_log,
4672 FILE * inout);
4673
4702 const ctl_t * ctl,
4703 const met_t * met,
4704 const char *varname,
4705 float *array,
4706 const int decompress,
4707 FILE * level_log,
4708 FILE * inout);
4709
4747 const ctl_t * ctl,
4748 const met_t * met,
4749 const char *varname,
4750 float *array,
4751 const int decompress,
4752 FILE * level_log,
4753 FILE * inout);
4754
4775 const ctl_t * ctl,
4776 const met_t * met,
4777 const char *varname,
4778 float *array,
4779 const int decompress,
4780 FILE * level_log,
4781 FILE * inout);
4782
4804 const ctl_t * ctl,
4805 const met_t * met,
4806 const char *varname,
4807 float *array,
4808 const int decompress,
4809 FILE * level_log,
4810 FILE * inout);
4811
4836double cos_sza(
4837 const double sec,
4838 const double lon,
4839 const double lat);
4840
4863void day2doy(
4864 const int year,
4865 const int mon,
4866 const int day,
4867 int *doy);
4868
4922 const ctl_t * ctl,
4923 const dd_t * dd,
4924 atm_t * atm,
4925 const int init);
4926
4978void dd_atm2particles(
4979 const ctl_t * ctl,
4980 cache_t * cache,
4981 atm_t * atm,
4982 particle_t * particles,
4983 const int npart);
4984
5023void dd_pack_compact(
5024 const ctl_t * ctl,
5025 cache_t * cache,
5026 atm_t * atm,
5027 dd_t * dd,
5028 particle_t * particles,
5029 const int nkeep,
5030 const int npart);
5031
5061 const ctl_t * ctl,
5062 const dd_t * dd,
5063 const double lon,
5064 const double lat);
5065
5122 const ctl_t * ctl,
5123 const dd_t * dd,
5124 particle_t ** particles,
5125 int *npart,
5126 int *capacity);
5127
5166void dd_init(
5167 const ctl_t * ctl,
5168 dd_t * dd,
5169 atm_t * atm);
5170
5205 const dd_t * dd,
5206 double *lon,
5207 double *lat);
5208
5253void dd_particles2atm(
5254 const ctl_t * ctl,
5255 cache_t * cache,
5256 const particle_t * particles,
5257 const int npart,
5258 atm_t * atm);
5259
5260
5308void dd_push(
5309 const ctl_t * ctl,
5310 atm_t * atm,
5311 cache_t * cache,
5312 int *npart);
5313
5343 const ctl_t * ctl,
5344 const atm_t * atm,
5345 dd_t * dd,
5346 int *nkeep,
5347 int *npart);
5348
5349
5395 dd_t * dd,
5396 const ctl_t * ctl,
5397 met_t * met,
5398 const int ncid);
5399
5461void dd_sort(
5462 const ctl_t * ctl,
5463 const met_t * met0,
5464 cache_t * cache,
5465 atm_t * atm,
5466 dd_t * dd,
5467 int *npart);
5468
5490void doy2day(
5491 const int year,
5492 const int doy,
5493 int *mon,
5494 int *day);
5495
5522void fft_help(
5523 double *fcReal,
5524 double *fcImag,
5525 const int n);
5526
5553void geo2cart(
5554 const double z,
5555 const double lon,
5556 const double lat,
5557 double *x);
5558
5583void get_met_filename(
5584 const ctl_t * ctl,
5585 const double t,
5586 const int direct,
5587 const char *metbase,
5588 const double dt_met,
5589 char *filename);
5590
5614void get_met_replace(
5615 char *orig,
5616 const char *search,
5617 const char *repl);
5618
5655void get_tropo(
5656 const int met_tropo,
5657 ctl_t * ctl,
5658 const clim_t * clim,
5659 met_t * met,
5660 const double *lons,
5661 const int nx,
5662 const double *lats,
5663 const int ny,
5664 double *pt,
5665 double *zt,
5666 double *tt,
5667 double *qt,
5668 double *o3t,
5669 double *ps,
5670 double *zs);
5671
5693 const double *lons,
5694 const int nlon,
5695 const double *lats,
5696 const int nlat,
5697 const double lon,
5698 const double lat,
5699 double *lon2,
5700 double *lat2);
5701
5721 const double *lons,
5722 const int nlon,
5723 const double *lats,
5724 const int nlat,
5725 const double lon,
5726 const double lat,
5727 double *lon2,
5728 double *lat2);
5729
5776 const met_t * met0,
5777 float height0[EX][EY][EP],
5778 float array0[EX][EY][EP],
5779 const met_t * met1,
5780 float height1[EX][EY][EP],
5781 float array1[EX][EY][EP],
5782 const double ts,
5783 const double height,
5784 const double lon,
5785 const double lat,
5786 double *var,
5787 int *ci,
5788 double *cw,
5789 const int init);
5790
5829 const met_t * met,
5830 float array[EX][EY][EP],
5831 const double p,
5832 const double lon,
5833 const double lat,
5834 double *var,
5835 int *ci,
5836 double *cw,
5837 const int init);
5838
5874 const met_t * met,
5875 float array[EX][EY],
5876 const double lon,
5877 const double lat,
5878 double *var,
5879 int *ci,
5880 double *cw,
5881 const int init);
5882
5920 const met_t * met0,
5921 float array0[EX][EY][EP],
5922 const met_t * met1,
5923 float array1[EX][EY][EP],
5924 const double ts,
5925 const double p,
5926 const double lon,
5927 const double lat,
5928 double *var,
5929 int *ci,
5930 double *cw,
5931 const int init);
5932
5972 const met_t * met0,
5973 float array0[EX][EY],
5974 const met_t * met1,
5975 float array1[EX][EY],
5976 const double ts,
5977 const double lon,
5978 const double lat,
5979 double *var,
5980 int *ci,
5981 double *cw,
5982 const int init);
5983
6021void intpol_tropo_3d(
6022 const double time0,
6023 float array0[EX][EY],
6024 const double time1,
6025 float array1[EX][EY],
6026 const double lons[EX],
6027 const double lats[EY],
6028 const int nlon,
6029 const int nlat,
6030 const double time,
6031 const double lon,
6032 const double lat,
6033 const int method,
6034 double *var,
6035 double *sigma);
6036
6063void jsec2time(
6064 const double jsec,
6065 int *year,
6066 int *mon,
6067 int *day,
6068 int *hour,
6069 int *min,
6070 int *sec,
6071 double *remain);
6072
6099double kernel_weight(
6100 const double kz[EP],
6101 const double kw[EP],
6102 const int nk,
6103 const double p);
6104
6143double lapse_rate(
6144 const double t,
6145 const double h2o);
6146
6174 ctl_t * ctl);
6175
6195int locate_irr(
6196 const double *xx,
6197 const int n,
6198 const double x);
6199
6226 const float *xx,
6227 const int n,
6228 const double x,
6229 const int ig);
6230
6251int locate_reg(
6252 const double *xx,
6253 const int n,
6254 const double x);
6255
6277void locate_vert(
6278 float profiles[EX][EY][EP],
6279 const int np,
6280 const int lon_ap_ind,
6281 const int lat_ap_ind,
6282 const double alt_ap,
6283 int *ind);
6284
6310void module_advect(
6311 const ctl_t * ctl,
6312 const cache_t * cache,
6313 met_t * met0,
6314 met_t * met1,
6315 atm_t * atm);
6316
6341 const ctl_t * ctl,
6342 const cache_t * cache,
6343 met_t * met0,
6344 met_t * met1,
6345 atm_t * atm);
6346
6385 const ctl_t * ctl,
6386 const cache_t * cache,
6387 const clim_t * clim,
6388 met_t * met0,
6389 met_t * met1,
6390 atm_t * atm);
6391
6435void module_chem_grid(
6436 const ctl_t * ctl,
6437 const cache_t * cache,
6438 met_t * met0,
6439 met_t * met1,
6440 atm_t * atm,
6441 const double t);
6442
6470void module_chem_init(
6471 const ctl_t * ctl,
6472 const cache_t * cache,
6473 const clim_t * clim,
6474 met_t * met0,
6475 met_t * met1,
6476 atm_t * atm);
6477
6497 const ctl_t * ctl,
6498 cache_t * cache,
6499 met_t * met0,
6500 met_t * met1,
6501 atm_t * atm);
6502
6547void module_dd(
6548 double t,
6549 const ctl_t * ctl,
6550 cache_t * cache,
6551 dd_t * dd,
6552 atm_t * atm,
6553 met_t ** met);
6554
6581void module_decay(
6582 const ctl_t * ctl,
6583 const cache_t * cache,
6584 const clim_t * clim,
6585 atm_t * atm);
6586
6623void module_diff_meso(
6624 const ctl_t * ctl,
6625 cache_t * cache,
6626 const met_t * met0,
6627 const met_t * met1,
6628 atm_t * atm);
6629
6665void module_diff_pbl(
6666 const ctl_t * ctl,
6667 cache_t * cache,
6668 met_t * met0,
6669 met_t * met1,
6670 atm_t * atm);
6671
6726void module_diff_turb(
6727 const ctl_t * ctl,
6728 cache_t * cache,
6729 const clim_t * clim,
6730 met_t * met0,
6731 met_t * met1,
6732 atm_t * atm);
6733
6752void module_dry_depo(
6753 const ctl_t * ctl,
6754 const cache_t * cache,
6755 met_t * met0,
6756 met_t * met1,
6757 atm_t * atm);
6758
6789void module_h2o2_chem(
6790 const ctl_t * ctl,
6791 const cache_t * cache,
6792 const clim_t * clim,
6793 met_t * met0,
6794 met_t * met1,
6795 atm_t * atm);
6796
6817 const ctl_t * ctl,
6818 cache_t * cache,
6819 met_t * met0,
6820 met_t * met1,
6821 atm_t * atm);
6822
6840void module_isosurf(
6841 const ctl_t * ctl,
6842 const cache_t * cache,
6843 met_t * met0,
6844 met_t * met1,
6845 atm_t * atm);
6846
6875 ctl_t * ctl,
6876 cache_t * cache,
6877 clim_t * clim,
6878 met_t * met0,
6879 met_t * met1,
6880 atm_t * atm);
6881
6900void module_meteo(
6901 const ctl_t * ctl,
6902 const cache_t * cache,
6903 const clim_t * clim,
6904 met_t * met0,
6905 met_t * met1,
6906 atm_t * atm);
6907
6928void module_mixing(
6929 const ctl_t * ctl,
6930 const cache_t * cache,
6931 const clim_t * clim,
6932 atm_t * atm,
6933 const double t);
6934
6967 const ctl_t * ctl,
6968 atm_t * atm,
6969 const int *ixs,
6970 const int *iys,
6971 const int *izs,
6972 const double *mixparam,
6973 const int qnt_idx,
6974 const int use_ensemble);
6975
7011void module_oh_chem(
7012 const ctl_t * ctl,
7013 const cache_t * cache,
7014 const clim_t * clim,
7015 met_t * met0,
7016 met_t * met1,
7017 atm_t * atm);
7018
7043void module_position(
7044 const cache_t * cache,
7045 met_t * met0,
7046 met_t * met1,
7047 atm_t * atm,
7048 const int reflect);
7049
7071void module_rng_init(
7072 const int ntask);
7073
7099void module_rng(
7100 const ctl_t * ctl,
7101 double *rs,
7102 const size_t n,
7103 const int method);
7104
7141 const ctl_t * ctl,
7142 const cache_t * cache,
7143 atm_t * atm);
7144
7169 const ctl_t * ctl,
7170 const cache_t * cache,
7171 met_t * met0,
7172 met_t * met1,
7173 atm_t * atm,
7174 depo_t * depo);
7175
7198void module_sedi(
7199 const ctl_t * ctl,
7200 const cache_t * cache,
7201 met_t * met0,
7202 met_t * met1,
7203 atm_t * atm);
7204
7225void sort_array(
7226 double *array,
7227 const int *perm,
7228 double *tmp,
7229 const int np);
7230
7249void sort_uvwp(
7250 cache_t * cache,
7251 const int *perm,
7252 double *tmp,
7253 const int np);
7254
7287void module_sort(
7288 const ctl_t * ctl,
7289 const met_t * met0,
7290 cache_t * cache,
7291 atm_t * atm);
7292
7316void module_timesteps(
7317 const ctl_t * ctl,
7318 cache_t * cache,
7319 const met_t * met0,
7320 atm_t * atm,
7321 const double t);
7322
7344 ctl_t * ctl,
7345 const atm_t * atm);
7346
7380 const ctl_t * ctl,
7381 const cache_t * cache,
7382 const clim_t * clim,
7383 met_t * met0,
7384 met_t * met1,
7385 atm_t * atm);
7386
7422void module_wet_depo(
7423 const ctl_t * ctl,
7424 const cache_t * cache,
7425 met_t * met0,
7426 met_t * met1,
7427 atm_t * atm);
7428
7463void mptrac_alloc(
7464 ctl_t ** ctl,
7465 cache_t ** cache,
7466 clim_t ** clim,
7467 met_t ** met0,
7468 met_t ** met1,
7469 atm_t ** atm,
7470 depo_t ** depo,
7471 dd_t ** dd);
7472
7503void mptrac_free(
7504 ctl_t * ctl,
7505 cache_t * cache,
7506 clim_t * clim,
7507 met_t * met0,
7508 met_t * met1,
7509 atm_t * atm,
7510 depo_t * depo,
7511 dd_t * dd);
7512
7548void mptrac_get_met(
7549 ctl_t * ctl,
7550 clim_t * clim,
7551 const double t,
7552 met_t ** met0,
7553 met_t ** met1,
7554 dd_t * dd);
7555
7576void mptrac_init(
7577 ctl_t * ctl,
7578 cache_t * cache,
7579 clim_t * clim,
7580 atm_t * atm,
7581 depo_t * depo,
7582 const int ntask);
7583
7619int mptrac_read_atm(
7620 const char *filename,
7621 const ctl_t * ctl,
7622 atm_t * atm);
7623
7655void mptrac_read_clim(
7656 const ctl_t * ctl,
7657 clim_t * clim);
7658
7688void mptrac_read_ctl(
7689 const char *filename,
7690 int argc,
7691 char *argv[],
7692 ctl_t * ctl);
7693
7724int mptrac_read_met(
7725 const char *filename,
7726 const ctl_t * ctl,
7727 const clim_t * clim,
7728 met_t * met,
7729 dd_t * dd);
7730
7753 ctl_t * ctl,
7754 cache_t * cache,
7755 clim_t * clim,
7756 met_t ** met0,
7757 met_t ** met1,
7758 atm_t * atm,
7759 depo_t * depo,
7760 double t,
7761 dd_t * dd);
7762
7792void mptrac_write_atm(
7793 const char *filename,
7794 const ctl_t * ctl,
7795 const atm_t * atm,
7796 const double t);
7797
7837void mptrac_write_met(
7838 const char *filename,
7839 const ctl_t * ctl,
7840 met_t * met);
7841
7878 const char *dirname,
7879 const ctl_t * ctl,
7880 met_t * met0,
7881 met_t * met1,
7882 atm_t * atm,
7883 depo_t * depo,
7884 const double t);
7885
7917 const ctl_t * ctl,
7918 const cache_t * cache,
7919 const clim_t * clim,
7920 met_t ** met0,
7921 met_t ** met1,
7922 const atm_t * atm);
7923
7954 const ctl_t * ctl,
7955 const cache_t * cache,
7956 const clim_t * clim,
7957 met_t ** met0,
7958 met_t ** met1,
7959 const atm_t * atm);
7960
7988double nat_temperature(
7989 const double p,
7990 const double h2o,
7991 const double hno3);
7992
8015double pbl_weight(
8016 const ctl_t * ctl,
8017 const atm_t * atm,
8018 const int ip,
8019 const double pbl,
8020 const double ps);
8021
8054int read_atm_asc(
8055 const char *filename,
8056 const ctl_t * ctl,
8057 atm_t * atm);
8058
8089int read_atm_bin(
8090 const char *filename,
8091 const ctl_t * ctl,
8092 atm_t * atm);
8093
8118int read_atm_clams(
8119 const char *filename,
8120 const ctl_t * ctl,
8121 atm_t * atm);
8122
8152int read_atm_nc(
8153 const char *filename,
8154 const ctl_t * ctl,
8155 atm_t * atm);
8156
8185void read_clim_photo(
8186 const char *filename,
8187 clim_photo_t * photo);
8188
8206 const int ncid,
8207 const char *varname,
8208 const clim_photo_t * photo,
8209 double var[CP][CSZA][CO3]);
8210
8234int read_clim_ts(
8235 const char *filename,
8236 clim_ts_t * ts);
8237
8264void read_clim_zm(
8265 const char *filename,
8266 const char *varname,
8267 clim_zm_t * zm);
8268
8296void read_kernel(
8297 const char *filename,
8298 double kz[EP],
8299 double kw[EP],
8300 int *nk);
8301
8333int read_met_bin(
8334 const char *filename,
8335 const ctl_t * ctl,
8336 met_t * met);
8337
8363void read_met_bin_2d(
8364 FILE * in,
8365 const met_t * met,
8366 float var[EX][EY],
8367 const char *varname);
8368
8406void read_met_bin_3d(
8407 FILE * in,
8408 const ctl_t * ctl,
8409 const met_t * met,
8410 float var[EX][EY][EP],
8411 const char *varname,
8412 const float bound_min,
8413 const float bound_max);
8414
8442void read_met_cape(
8443 const ctl_t * ctl,
8444 const clim_t * clim,
8445 met_t * met);
8446
8469void read_met_cloud(
8470 met_t * met);
8471
8497void read_met_detrend(
8498 const ctl_t * ctl,
8499 met_t * met);
8500
8524 met_t * met);
8525
8552void read_met_geopot(
8553 const ctl_t * ctl,
8554 met_t * met);
8555
8583 const char *filename,
8584 const ctl_t * ctl,
8585 met_t * met);
8586
8608 codes_handle ** handles,
8609 int count_handles,
8610 met_t * met);
8611
8632 codes_handle ** handles,
8633 const int num_messages,
8634 const ctl_t * ctl,
8635 met_t * met);
8636
8667 codes_handle ** handles,
8668 const int num_messages,
8669 const ctl_t * ctl,
8670 met_t * met);
8671
8700void read_met_ml2pl(
8701 const ctl_t * ctl,
8702 const met_t * met,
8703 float var[EX][EY][EP],
8704 const char *varname);
8705
8728 const ctl_t * ctl,
8729 met_t * met);
8730
8761int read_met_nc(
8762 const char *filename,
8763 const ctl_t * ctl,
8764 met_t * met,
8765 dd_t * dd);
8766
8801void read_met_nc_grid(
8802 const char *filename,
8803 const int ncid,
8804 const ctl_t * ctl,
8805 met_t * met,
8806 dd_t * dd);
8807
8840 const int ncid,
8841 const ctl_t * ctl,
8842 met_t * met,
8843 dd_t * dd);
8844
8876 const int ncid,
8877 const ctl_t * ctl,
8878 met_t * met,
8879 dd_t * dd);
8880
8909int read_met_nc_2d(
8910 const int ncid,
8911 const char *const varnames[],
8912 const size_t nvarnames,
8913 const ctl_t * ctl,
8914 const met_t * met,
8915 dd_t * dd,
8916 float dest[EX][EY],
8917 const float scl,
8918 const int init);
8919
8947int read_met_nc_3d(
8948 const int ncid,
8949 const char *const varnames[],
8950 const size_t nvarnames,
8951 const ctl_t * ctl,
8952 const met_t * met,
8953 dd_t * dd,
8954 float dest[EX][EY][EP],
8955 const float scl);
8956
9002void read_met_pbl(
9003 const ctl_t * ctl,
9004 met_t * met);
9005
9038 met_t * met);
9039
9070 met_t * met);
9071
9102void read_met_pv(
9103 met_t * met);
9104
9127void read_met_ozone(
9128 met_t * met);
9129
9158void read_met_sample(
9159 const ctl_t * ctl,
9160 met_t * met);
9161
9190void read_met_tropo(
9191 const ctl_t * ctl,
9192 const clim_t * clim,
9193 met_t * met);
9194
9226void read_obs(
9227 const char *filename,
9228 const ctl_t * ctl,
9229 double *rt,
9230 double *rz,
9231 double *rlon,
9232 double *rlat,
9233 double *robs,
9234 int *nobs);
9235
9263void read_obs_asc(
9264 const char *filename,
9265 double *rt,
9266 double *rz,
9267 double *rlon,
9268 double *rlat,
9269 double *robs,
9270 int *nobs);
9271
9298void read_obs_nc(
9299 const char *filename,
9300 double *rt,
9301 double *rz,
9302 double *rlon,
9303 double *rlat,
9304 double *robs,
9305 int *nobs);
9306
9340double scan_ctl(
9341 const char *filename,
9342 int argc,
9343 char *argv[],
9344 const char *varname,
9345 const int arridx,
9346 const char *defvalue,
9347 char *value);
9348
9376double sedi(
9377 const double p,
9378 const double T,
9379 const double rp,
9380 const double rhop);
9381
9411void spline(
9412 const double *x,
9413 const double *y,
9414 const int n,
9415 const double *x2,
9416 double *y2,
9417 const int n2,
9418 const int method);
9419
9441 const double x,
9442 const double w,
9443 const double weight_old,
9444 double *mean,
9445 double *m2);
9446
9469float stddev(
9470 const float *data,
9471 const int n);
9472
9497void time2jsec(
9498 const int year,
9499 const int mon,
9500 const int day,
9501 const int hour,
9502 const int min,
9503 const int sec,
9504 const double remain,
9505 double *jsec);
9506
9535void timer(
9536 const char *name,
9537 const char *group,
9538 const int output);
9539
9569double time_from_filename(
9570 const char *filename,
9571 const int offset,
9572 const int with_seconds);
9573
9592double tropo_weight(
9593 const ctl_t * ctl,
9594 const clim_t * clim,
9595 const atm_t * atm,
9596 const int ip);
9597
9620void write_atm_asc(
9621 const char *filename,
9622 const ctl_t * ctl,
9623 const atm_t * atm,
9624 const double t);
9625
9649void write_atm_bin(
9650 const char *filename,
9651 const ctl_t * ctl,
9652 const atm_t * atm);
9653
9677void write_atm_clams(
9678 const char *filename,
9679 const ctl_t * ctl,
9680 const atm_t * atm);
9681
9707 const char *dirname,
9708 const ctl_t * ctl,
9709 const atm_t * atm,
9710 const double t);
9711
9735void write_atm_nc(
9736 const char *filename,
9737 const ctl_t * ctl,
9738 const atm_t * atm);
9739
9756void write_budget(
9757 const char *filename,
9758 const ctl_t * ctl,
9759 const atm_t * atm,
9760 const double t);
9761
9790void write_csi(
9791 const char *filename,
9792 const ctl_t * ctl,
9793 const atm_t * atm,
9794 const double t);
9795
9837 const char *filename,
9838 const ctl_t * ctl,
9839 const atm_t * atm,
9840 const double t);
9841
9869void write_ens(
9870 const char *filename,
9871 const ctl_t * ctl,
9872 const atm_t * atm,
9873 const double t);
9874
9887void write_depo(
9888 const char *filename,
9889 const ctl_t * ctl,
9890 const depo_t * depo,
9891 const double t);
9892
9904void write_depo_asc(
9905 const char *filename,
9906 const ctl_t * ctl,
9907 const double *data,
9908 const double t,
9909 const double *lon,
9910 const double *lat,
9911 const double *area);
9912
9924void write_depo_nc(
9925 const char *filename,
9926 const ctl_t * ctl,
9927 const double *data,
9928 const double t,
9929 const double *lon,
9930 const double *lat,
9931 const double *area);
9932
9972void write_grid(
9973 const char *filename,
9974 const ctl_t * ctl,
9975 met_t * met0,
9976 met_t * met1,
9977 const atm_t * atm,
9978 const double t);
9979
10025void write_grid_asc(
10026 const char *filename,
10027 const ctl_t * ctl,
10028 const double *cd,
10029 double *mean[NQ],
10030 double *sigma[NQ],
10031 const double *vmr_impl,
10032 const double t,
10033 const double *z,
10034 const double *lon,
10035 const double *lat,
10036 const double *area,
10037 const double dz,
10038 const int *np);
10039
10082void write_grid_nc(
10083 const char *filename,
10084 const ctl_t * ctl,
10085 const double *cd,
10086 double *mean[NQ],
10087 double *sigma[NQ],
10088 const double *vmr_impl,
10089 const double t,
10090 const double *z,
10091 const double *lon,
10092 const double *lat,
10093 const double *area,
10094 const double dz,
10095 const int *np);
10096
10126void write_met_bin(
10127 const char *filename,
10128 const ctl_t * ctl,
10129 met_t * met);
10130
10158void write_met_bin_2d(
10159 FILE * out,
10160 met_t * met,
10161 float var[EX][EY],
10162 const char *varname);
10163
10203void write_met_bin_3d(
10204 FILE * out,
10205 const ctl_t * ctl,
10206 met_t * met,
10207 float var[EX][EY][EP],
10208 const char *varname,
10209 const int metvar,
10210 FILE * level_log);
10211
10239void write_met_nc(
10240 const char *filename,
10241 const ctl_t * ctl,
10242 met_t * met);
10243
10266void write_met_nc_2d(
10267 const int ncid,
10268 const char *varname,
10269 met_t * met,
10270 float var[EX][EY],
10271 const float scl);
10272
10296void write_met_nc_3d(
10297 const int ncid,
10298 const char *varname,
10299 met_t * met,
10300 float var[EX][EY][EP],
10301 const float scl);
10302
10333void write_prof(
10334 const char *filename,
10335 const ctl_t * ctl,
10336 met_t * met0,
10337 met_t * met1,
10338 const atm_t * atm,
10339 const double t);
10340
10372void write_sample(
10373 const char *filename,
10374 const ctl_t * ctl,
10375 met_t * met0,
10376 met_t * met1,
10377 const atm_t * atm,
10378 const double t);
10379
10406void write_station(
10407 const char *filename,
10408 const ctl_t * ctl,
10409 atm_t * atm,
10410 const double t);
10411
10440void write_vtk(
10441 const char *filename,
10442 const ctl_t * ctl,
10443 const atm_t * atm,
10444 const double t);
10445
10446/* ------------------------------------------------------------
10447 OpenACC routines...
10448 ------------------------------------------------------------ */
10449
10450#ifdef _OPENACC
10451#pragma acc routine (clim_oh)
10452#pragma acc routine (clim_photo)
10453#pragma acc routine (clim_tropo)
10454#pragma acc routine (clim_ts)
10455#pragma acc routine (clim_zm)
10456#pragma acc routine (cos_sza)
10457#pragma acc routine (dd_calc_subdomain_from_coords)
10458#pragma acc routine (dd_normalize_lon_lat)
10459#pragma acc routine (intpol_check_lon_lat)
10460#pragma acc routine (intpol_met_4d_zeta)
10461#pragma acc routine (intpol_met_space_3d)
10462#pragma acc routine (intpol_met_space_2d)
10463#pragma acc routine (intpol_met_time_3d)
10464#pragma acc routine (intpol_met_time_2d)
10465#pragma acc routine (kernel_weight)
10466#pragma acc routine (lapse_rate)
10467#pragma acc routine (locate_irr)
10468#pragma acc routine (locate_irr_float)
10469#pragma acc routine (locate_reg)
10470#pragma acc routine (locate_vert)
10471#pragma acc routine (nat_temperature)
10472#pragma acc routine (pbl_weight)
10473#pragma acc routine (sedi)
10474#pragma acc routine (stddev)
10475#pragma acc routine (tropo_weight)
10476#endif
10477
10478#endif /* LIBTRAC_H */
void read_met_geopot(const ctl_t *ctl, met_t *met)
Calculates geopotential heights from meteorological data.
Definition mptrac.c:10432
void dd_init(const ctl_t *ctl, dd_t *dd, atm_t *atm)
Initialize the domain decomposition infrastructure.
Definition mptrac.c:2339
#define LEN
Maximum length of ASCII data lines.
Definition mptrac.h:559
void write_depo(const char *filename, const ctl_t *ctl, const depo_t *depo, const double t)
Convert cumulative ground inventories to Bq m^-2 and write them.
Definition mptrac.c:14946
void mptrac_write_atm(const char *filename, const ctl_t *ctl, const atm_t *atm, const double t)
Writes air parcel data to a file in various formats.
Definition mptrac.c:9008
void day2doy(const int year, const int mon, const int day, int *doy)
Get day of year from date.
Definition mptrac.c:1902
void read_met_grib_surface(codes_handle **handles, const int num_messages, const ctl_t *ctl, met_t *met)
Reads surface meteorological data from a grib file and stores it in the meteorological data structure...
void read_met_extrapolate(met_t *met)
Extrapolates meteorological data.
Definition mptrac.c:10392
void write_atm_clams_traj(const char *dirname, const ctl_t *ctl, const atm_t *atm, const double t)
Writes CLaMS trajectory data to a NetCDF file.
Definition mptrac.c:14234
void write_met_nc_2d(const int ncid, const char *varname, met_t *met, float var[EX][EY], const float scl)
Writes a 2D meteorological variable to a NetCDF file.
Definition mptrac.c:15999
void dd_read_met_nc_grid(dd_t *dd, const ctl_t *ctl, met_t *met, const int ncid)
Read meteorological grid information and construct the domain-decomposed grid with halo regions.
Definition mptrac.c:12613
void read_met_sample(const ctl_t *ctl, met_t *met)
Downsamples meteorological data based on specified parameters.
Definition mptrac.c:13212
int read_met_nc_2d(const int ncid, const char *const varnames[], const size_t nvarnames, const ctl_t *ctl, const met_t *met, dd_t *dd, float dest[EX][EY], const float scl, const int init)
Reads a 2-dimensional meteorological variable from a NetCDF file.
Definition mptrac.c:11312
void read_obs(const char *filename, const ctl_t *ctl, double *rt, double *rz, double *rlon, double *rlat, double *robs, int *nobs)
Reads observation data from a file and stores it in arrays.
Definition mptrac.c:13561
void module_advect(const ctl_t *ctl, const cache_t *cache, met_t *met0, met_t *met1, atm_t *atm)
Advances particle positions using different advection schemes.
Definition mptrac.c:3907
void module_meteo(const ctl_t *ctl, const cache_t *cache, const clim_t *clim, met_t *met0, met_t *met1, atm_t *atm)
Update atmospheric properties using meteorological data.
Definition mptrac.c:5478
void read_clim_photo(const char *filename, clim_photo_t *photo)
Reads photolysis rates from a NetCDF file and populates the given photolysis structure.
Definition mptrac.c:9490
void read_met_cloud(met_t *met)
Calculates cloud-related variables for each grid point.
Definition mptrac.c:10228
void module_decay(const ctl_t *ctl, const cache_t *cache, const clim_t *clim, atm_t *atm)
Simulate exponential decay processes for atmospheric particles.
Definition mptrac.c:4556
double sedi(const double p, const double T, const double rp, const double rhop)
Calculates the sedimentation velocity of a particle in air.
Definition mptrac.c:13734
double cos_sza(const double sec, const double lon, const double lat)
Calculates the cosine of the solar zenith angle.
Definition mptrac.c:1861
#define METVAR
Number of 3-D meteorological variables.
Definition mptrac.h:564
void intpol_met_space_2d(const met_t *met, float array[EX][EY], const double lon, const double lat, double *var, int *ci, double *cw, const int init)
Interpolates meteorological variables in 2D space.
Definition mptrac.c:3357
void compress_log_levels_3d(FILE *out, const char *codec, const char *varname, const met_t *met, const float *org_all, const float *cmp_all, const size_t nxy, const size_t nz, const double ratio, const double bpv, const double t_comp, const double t_decomp, const size_t nbytes)
Write per-level compression diagnostics for a full 3-D field.
Definition mptrac.c:769
int read_atm_nc(const char *filename, const ctl_t *ctl, atm_t *atm)
Reads air parcel data from a generic netCDF file and populates the given atmospheric structure.
Definition mptrac.c:9457
void write_csi_ens(const char *filename, const ctl_t *ctl, const atm_t *atm, const double t)
Writes ensemble-based Critical Success Index (CSI) and other verification statistics to an output fil...
void read_met_pbl(const ctl_t *ctl, met_t *met)
Computes the planetary boundary layer (PBL) pressure based on meteorological data.
Definition mptrac.c:12803
void read_met_detrend(const ctl_t *ctl, met_t *met)
Detrends meteorological data.
Definition mptrac.c:10285
void read_met_tropo(const ctl_t *ctl, const clim_t *clim, met_t *met)
Calculates the tropopause and related meteorological variables based on various methods and stores th...
Definition mptrac.c:13387
void read_obs_asc(const char *filename, double *rt, double *rz, double *rlon, double *rlat, double *robs, int *nobs)
Reads observation data from an ASCII file.
Definition mptrac.c:13605
void write_depo_asc(const char *filename, const ctl_t *ctl, const double *data, const double t, const double *lon, const double *lat, const double *area)
Write radioactive deposition densities as a gnuplot-compatible table.
Definition mptrac.c:15017
void module_chem_init(const ctl_t *ctl, const cache_t *cache, const clim_t *clim, met_t *met0, met_t *met1, atm_t *atm)
Initializes the chemistry modules by setting atmospheric composition.
Definition mptrac.c:4378
int locate_reg(const double *xx, const int n, const double x)
Locate the index of the interval containing a given value in a regular grid.
Definition mptrac.c:3868
void locate_vert(float profiles[EX][EY][EP], const int np, const int lon_ap_ind, const int lat_ap_ind, const double alt_ap, int *ind)
Locate the four vertical indizes of a box for a given height value.
Definition mptrac.c:3887
void compress_zfp(const ctl_t *ctl, const met_t *met, const char *varname, float *array, const int decompress, FILE *level_log, FILE *inout)
Compresses or decompresses a 3D array of floats using the ZFP library.
void read_met_nc_levels(const int ncid, const ctl_t *ctl, met_t *met, dd_t *dd)
Reads and processes meteorological level data from NetCDF files with domain decomposition.
Definition mptrac.c:10905
void compress_pck(const ctl_t *ctl, const met_t *met, const char *varname, float *array, const int decompress, FILE *level_log, FILE *inout)
Compresses or decompresses a 3‑D float array using the PCK format.
Definition mptrac.c:990
void read_met_monotonize(const ctl_t *ctl, met_t *met)
Makes zeta and pressure profiles monotone.
Definition mptrac.c:12466
int dd_calc_subdomain_from_coords(const ctl_t *ctl, const dd_t *dd, const double lon, const double lat)
Determine MPI subdomain from particle coordinates.
Definition mptrac.c:2169
#define DD_EY_GLOB
Maximum number of latitudes of global meteo data.
Definition mptrac.h:634
int read_clim_ts(const char *filename, clim_ts_t *ts)
Reads a climatological time series from a file and populates the given time series structure.
Definition mptrac.c:9609
void intpol_check_cartesian(const double *lons, const int nlon, const double *lats, const int nlat, const double lon, const double lat, double *lon2, double *lat2)
Clamps UTM coordinates to the valid bounds.
Definition mptrac.c:3090
void read_met_periodic(met_t *met)
Applies periodic boundary conditions to meteorological data along longitudinal axis.
Definition mptrac.c:12940
int compress_metvar_index(const char *varname)
Maps a meteorological variable name to its internal MPTRAC variable index.
Definition mptrac.c:973
void module_timesteps_init(ctl_t *ctl, const atm_t *atm)
Initialize start time and time interval for time-stepping.
Definition mptrac.c:6515
void stats_welford_update(const double x, const double w, const double weight_old, double *mean, double *m2)
Update a weighted mean and second central moment with one value.
Definition mptrac.c:13817
void write_ens(const char *filename, const ctl_t *ctl, const atm_t *atm, const double t)
Writes ensemble data to a file.
Definition mptrac.c:14841
double clim_zm(const clim_zm_t *zm, const double t, const double lat, const double p)
Interpolates monthly mean zonal mean climatological variables.
Definition mptrac.c:418
#define EY
Maximum number of latitudes for meteo data.
Definition mptrac.h:554
void read_clim_photo_help(const int ncid, const char *varname, const clim_photo_t *photo, double var[CP][CSZA][CO3])
Reads a 3D climatological photochemistry variable from a NetCDF file.
Definition mptrac.c:9581
void read_met_ml2pl(const ctl_t *ctl, const met_t *met, float var[EX][EY][EP], const char *varname)
Interpolates meteorological data to specified pressure levels.
Definition mptrac.c:12424
double clim_tropo(const clim_t *clim, const double t, const double lat)
Calculates the tropopause pressure based on climatological data.
Definition mptrac.c:217
void read_obs_nc(const char *filename, double *rt, double *rz, double *rlon, double *rlat, double *robs, int *nobs)
Reads observation data from a NetCDF file.
Definition mptrac.c:13633
void compress_sz3(const ctl_t *ctl, const met_t *met, const char *varname, float *array, const int decompress, FILE *level_log, FILE *inout)
Compresses or decompresses a 3-D float array using the SZ3 library.
void read_met_bin_2d(FILE *in, const met_t *met, float var[EX][EY], const char *varname)
Reads a 2-dimensional meteorological variable from a binary file and stores it in the provided array.
Definition mptrac.c:9969
int locate_irr(const double *xx, const int n, const double x)
Locate the index of the interval containing a given value in a sorted array.
Definition mptrac.c:3804
void module_isosurf_init(const ctl_t *ctl, cache_t *cache, met_t *met0, met_t *met1, atm_t *atm)
Initialize the isosurface module based on atmospheric data.
Definition mptrac.c:5297
void mptrac_free(ctl_t *ctl, cache_t *cache, clim_t *clim, met_t *met0, met_t *met1, atm_t *atm, depo_t *depo, dd_t *dd)
Frees memory resources allocated for MPTRAC.
Definition mptrac.c:6875
void dd_sort(const ctl_t *ctl, const met_t *met0, cache_t *cache, atm_t *atm, dd_t *dd, int *npart)
Sort local atmospheric particles and determine export counts for domain decomposition.
Definition mptrac.c:2659
void level_definitions(ctl_t *ctl)
Defines pressure levels for meteorological data.
Definition mptrac.c:3651
void intpol_met_4d_zeta(const met_t *met0, float height0[EX][EY][EP], float array0[EX][EY][EP], const met_t *met1, float height1[EX][EY][EP], float array1[EX][EY][EP], const double ts, const double height, const double lon, const double lat, double *var, int *ci, double *cw, const int init)
Interpolates meteorological variables to a given position and time.
Definition mptrac.c:3116
void module_mixing(const ctl_t *ctl, const cache_t *cache, const clim_t *clim, atm_t *atm, const double t)
Update atmospheric properties through interparcel mixing.
Definition mptrac.c:5608
void write_grid_asc(const char *filename, const ctl_t *ctl, const double *cd, double *mean[NQ], double *sigma[NQ], const double *vmr_impl, const double t, const double *z, const double *lon, const double *lat, const double *area, const double dz, const int *np)
Writes grid data to an ASCII file.
Definition mptrac.c:15330
void mptrac_update_device(const ctl_t *ctl, const cache_t *cache, const clim_t *clim, met_t **met0, met_t **met1, const atm_t *atm)
Updates device memory for specified data structures.
Definition mptrac.c:8896
void mptrac_write_output(const char *dirname, const ctl_t *ctl, met_t *met0, met_t *met1, atm_t *atm, depo_t *depo, const double t)
Writes various types of output data to files in a specified directory.
Definition mptrac.c:9121
void time2jsec(const int year, const int mon, const int day, const int hour, const int min, const int sec, const double remain, double *jsec)
Converts time components to seconds since January 1, 2000, 12:00:00 UTC.
Definition mptrac.c:13861
void intpol_met_time_3d(const met_t *met0, float array0[EX][EY][EP], const met_t *met1, float array1[EX][EY][EP], const double ts, const double p, const double lon, const double lat, double *var, int *ci, double *cw, const int init)
Interpolates meteorological data in 3D space and time.
Definition mptrac.c:3421
#define codes_handle
Placeholder when ECCODES is not available.
Definition mptrac.h:241
void compress_zstd(const ctl_t *ctl, const met_t *met, const char *varname, float *array, const int decompress, FILE *level_log, FILE *inout)
Compresses or decompresses a float array using ZSTD.
void get_met_filename(const ctl_t *ctl, const double t, const int direct, const char *metbase, const double dt_met, char *filename)
Generates a formatted filename for meteorological data files based on the input parameters.
Definition mptrac.c:2927
void fft_help(double *fcReal, double *fcImag, const int n)
Computes the Fast Fourier Transform (FFT) of a complex sequence.
Definition mptrac.c:2870
void module_wet_depo(const ctl_t *ctl, const cache_t *cache, met_t *met0, met_t *met1, atm_t *atm)
Perform wet deposition calculations for air parcels.
Definition mptrac.c:6638
int compress_read_lossy_scale(FILE *in, const size_t nz, double **off, double **scl)
Read optional lossyscaling metadata for a 3-D field.
Definition mptrac.c:878
double nat_temperature(const double p, const double h2o, const double hno3)
Calculates the nitric acid trihydrate (NAT) temperature.
Definition mptrac.c:9246
void spline(const double *x, const double *y, const int n, const double *x2, double *y2, const int n2, const int method)
Performs spline interpolation or linear interpolation.
Definition mptrac.c:13770
void dd_pack_compact(const ctl_t *ctl, cache_t *cache, atm_t *atm, dd_t *dd, particle_t *particles, const int nkeep, const int npart)
Pack outgoing particles and compact local arrays without sorting.
Definition mptrac.c:2053
void compress_cms(const ctl_t *ctl, const met_t *met, const char *varname, float *array, const int decompress, FILE *level_log, FILE *inout)
Compresses or decompresses a 3-D meteorological field using cmultiscale.
#define CP
Maximum number of pressure levels for climatological data.
Definition mptrac.h:609
#define NQ
Maximum number of quantities per data point.
Definition mptrac.h:574
void dd_assign_subdomains(const ctl_t *ctl, const dd_t *dd, atm_t *atm, const int init)
Assign or update particle subdomain ownership.
Definition mptrac.c:1929
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:160
void read_clim_zm(const char *filename, const char *varname, clim_zm_t *zm)
Reads zonally averaged climatological data from a netCDF file and populates the given structure.
Definition mptrac.c:9663
#define EX
Maximum number of longitudes for meteo data.
Definition mptrac.h:549
void module_sedi(const ctl_t *ctl, const cache_t *cache, met_t *met0, met_t *met1, atm_t *atm)
Simulate sedimentation of particles in the atmosphere.
Definition mptrac.c:6361
int read_met_nc(const char *filename, const ctl_t *ctl, met_t *met, dd_t *dd)
Reads meteorological data from a NetCDF file and processes it.
Definition mptrac.c:12551
void timer(const char *name, const char *group, const int output)
Measures and reports elapsed time for named and grouped timers.
Definition mptrac.c:13892
void write_atm_asc(const char *filename, const ctl_t *ctl, const atm_t *atm, const double t)
Writes air parcel data to an ASCII file or gnuplot.
Definition mptrac.c:14028
void intpol_met_space_3d(const met_t *met, float array[EX][EY][EP], const double p, const double lon, const double lat, double *var, int *ci, double *cw, const int init)
Interpolates meteorological variables in 3D space.
Definition mptrac.c:3294
void module_mixing_help(const ctl_t *ctl, atm_t *atm, const int *ixs, const int *iys, const int *izs, const double *mixparam, const int qnt_idx, const int use_ensemble)
Perform subgrid-scale interparcel mixing of a given quantity.
Definition mptrac.c:5708
void module_convection(const ctl_t *ctl, cache_t *cache, met_t *met0, met_t *met1, atm_t *atm)
Performs convective mixing of atmospheric particles.
Definition mptrac.c:4422
void compress_scale_to_unit(float *array, const size_t nxy, const size_t nz, double *off, double *scl)
Scales each vertical level of a 3-D field independently to the interval [0,1].
Definition mptrac.c:815
void read_kernel(const char *filename, double kz[EP], double kw[EP], int *nk)
Reads kernel function data from a file and populates the provided arrays.
Definition mptrac.c:9762
void module_bound_cond(const ctl_t *ctl, const cache_t *cache, const clim_t *clim, met_t *met0, met_t *met1, atm_t *atm)
Apply boundary conditions to particles based on meteorological and climatological data.
Definition mptrac.c:4090
double scan_ctl(const char *filename, int argc, char *argv[], const char *varname, const int arridx, const char *defvalue, char *value)
Scans a control file or command-line arguments for a specified variable.
Definition mptrac.c:13662
void dd_normalize_lon_lat(const dd_t *dd, double *lon, double *lat)
Normalize geographic coordinates to the global grid convention.
Definition mptrac.c:2419
#define CT
Maximum number of time steps for climatological data.
Definition mptrac.h:619
void module_advect_init(const ctl_t *ctl, const cache_t *cache, met_t *met0, met_t *met1, atm_t *atm)
Initializes the advection module by setting up pressure fields.
Definition mptrac.c:4063
void module_position(const cache_t *cache, met_t *met0, met_t *met1, atm_t *atm, const int reflect)
Update the positions and pressure levels of atmospheric particles.
Definition mptrac.c:5911
void module_radio_decay(const ctl_t *ctl, const cache_t *cache, atm_t *atm)
Apply radioactive decay to atmospheric tracer species.
Definition mptrac.c:5970
int read_met_grib(const char *filename, const ctl_t *ctl, met_t *met)
Reads meteorological data from a grib file and processes it.
void mptrac_get_met(ctl_t *ctl, clim_t *clim, const double t, met_t **met0, met_t **met1, dd_t *dd)
Retrieves meteorological data for the specified time.
Definition mptrac.c:6953
void dd_particles2atm(const ctl_t *ctl, cache_t *cache, const particle_t *particles, const int npart, atm_t *atm)
Copy received particles from the communication buffer into the atmospheric state.
Definition mptrac.c:2452
float stddev(const float *data, const int n)
Calculates the standard deviation of a set of data.
Definition mptrac.c:13840
void compress_lz4(const ctl_t *ctl, const met_t *met, const char *varname, float *array, const int decompress, FILE *level_log, FILE *inout)
Compresses or decompresses a float array using LZ4.
void intpol_tropo_3d(const double time0, float array0[EX][EY], const double time1, float array1[EX][EY], const double lons[EX], const double lats[EY], const int nlon, const int nlat, const double time, const double lon, const double lat, const int method, double *var, double *sigma)
Interpolates tropopause data in 3D (latitude, longitude, and time).
Definition mptrac.c:3483
void read_met_bin_3d(FILE *in, const ctl_t *ctl, const met_t *met, float var[EX][EY][EP], const char *varname, const float bound_min, const float bound_max)
Reads 3D meteorological data from a binary file, potentially using different compression methods.
Definition mptrac.c:9998
int locate_irr_float(const float *xx, const int n, const double x, const int ig)
Locate the index of the interval containing a given value in an irregularly spaced array.
Definition mptrac.c:3834
void write_prof(const char *filename, const ctl_t *ctl, met_t *met0, met_t *met1, const atm_t *atm, const double t)
Writes profile data to a specified file.
Definition mptrac.c:16060
void mptrac_read_clim(const ctl_t *ctl, clim_t *clim)
Reads various climatological data and populates the given climatology structure.
Definition mptrac.c:7192
void module_diff_meso(const ctl_t *ctl, cache_t *cache, const met_t *met0, const met_t *met1, atm_t *atm)
Simulate mesoscale diffusion for atmospheric particles.
Definition mptrac.c:4595
void write_met_nc(const char *filename, const ctl_t *ctl, met_t *met)
Writes meteorological data to a NetCDF file.
Definition mptrac.c:15817
void module_rng_init(const int ntask)
Initialize random number generators for parallel tasks.
Definition mptrac.c:6219
void mptrac_init(ctl_t *ctl, cache_t *cache, clim_t *clim, atm_t *atm, depo_t *depo, const int ntask)
Initializes the MPTRAC model and its associated components.
Definition mptrac.c:7087
int mptrac_read_atm(const char *filename, const ctl_t *ctl, atm_t *atm)
Reads air parcel data from a specified file into the given atmospheric structure.
Definition mptrac.c:7117
void mptrac_update_host(const ctl_t *ctl, const cache_t *cache, const clim_t *clim, met_t **met0, met_t **met1, const atm_t *atm)
Updates host memory for specified data structures.
Definition mptrac.c:8952
double clim_oh(const ctl_t *ctl, const clim_t *clim, const double t, const double lon, const double lat, const double p)
Calculates the hydroxyl radical (OH) concentration from climatology data, with an optional diurnal co...
Definition mptrac.c:91
void read_met_grib_levels(codes_handle **handles, const int num_messages, const ctl_t *ctl, met_t *met)
Reads meteorological variables at different vertical levels from a grib file.
void write_met_bin_3d(FILE *out, const ctl_t *ctl, met_t *met, float var[EX][EY][EP], const char *varname, const int metvar, FILE *level_log)
Writes a 3-dimensional meteorological variable to a binary file.
Definition mptrac.c:15724
#define CTS
Maximum number of data points of climatological time series.
Definition mptrac.h:624
void read_met_ozone(met_t *met)
Calculates the total column ozone from meteorological ozone data.
Definition mptrac.c:13183
void dd_count_outgoing(const ctl_t *ctl, const atm_t *atm, dd_t *dd, int *nkeep, int *npart)
Classify particles before direct packing and compaction.
Definition mptrac.c:2774
void mptrac_alloc(ctl_t **ctl, cache_t **cache, clim_t **clim, met_t **met0, met_t **met1, atm_t **atm, depo_t **depo, dd_t **dd)
Allocates and initializes memory resources for MPTRAC.
Definition mptrac.c:6785
void sort_array(double *array, const int *perm, double *tmp, const int np)
Reorder a double array according to particle source indices.
Definition mptrac.c:2501
void broadcast_large_data(void *data, size_t N)
Broadcasts large data across all processes in an MPI communicator.
Definition mptrac.c:47
void compress_write_lossy_scale(FILE *out, const int enabled, float *array, const size_t nxy, const size_t nz, double **off, double **scl)
Write optional lossyscaling metadata for a 3-D field.
Definition mptrac.c:913
void read_met_nc_surface(const int ncid, const ctl_t *ctl, met_t *met, dd_t *dd)
Reads and processes surface meteorological data from NetCDF files with domain decomposition.
Definition mptrac.c:10748
void clim_tropo_init(clim_t *clim)
Initializes the tropopause data in the climatology structure.
Definition mptrac.c:245
void module_rng(const ctl_t *ctl, double *rs, const size_t n, const int method)
Generate random numbers using various methods and distributions.
Definition mptrac.c:6253
void write_station(const char *filename, const ctl_t *ctl, atm_t *atm, const double t)
Writes station data to a specified file.
Definition mptrac.c:16456
void cart2geo(const double *x, double *z, double *lon, double *lat)
Converts Cartesian coordinates to geographic coordinates.
Definition mptrac.c:76
double time_from_filename(const char *filename, const int offset, const int with_seconds)
Extracts and converts a timestamp from a filename to Julian seconds.
Definition mptrac.c:13960
void dd_atm2particles(const ctl_t *ctl, cache_t *cache, atm_t *atm, particle_t *particles, const int npart)
Copy migratable atmospheric particles from the ATM state into a particle buffer.
Definition mptrac.c:2002
#define NP
Maximum number of atmospheric data points.
Definition mptrac.h:569
void module_sort(const ctl_t *ctl, const met_t *met0, cache_t *cache, atm_t *atm)
Sort particles according to box index.
Definition mptrac.c:6389
void dd_communicate_particles(const ctl_t *ctl, const dd_t *dd, particle_t **particles, int *npart, int *capacity)
Exchange particles between MPI ranks according to their destination rank.
Definition mptrac.c:2202
void doy2day(const int year, const int doy, int *mon, int *day)
Converts a given day of the year (DOY) to a date (month and day).
Definition mptrac.c:2840
int read_met_nc_3d(const int ncid, const char *const varnames[], const size_t nvarnames, const ctl_t *ctl, const met_t *met, dd_t *dd, float dest[EX][EY][EP], const float scl)
Reads a 3-dimensional meteorological variable from a NetCDF file.
Definition mptrac.c:11650
void intpol_met_time_2d(const met_t *met0, float array0[EX][EY], const met_t *met1, float array1[EX][EY], const double ts, const double lon, const double lat, double *var, int *ci, double *cw, const int init)
Interpolates meteorological data in 2D space and time.
Definition mptrac.c:3450
void clim_oh_diurnal_correction(const ctl_t *ctl, clim_t *clim)
Applies a diurnal correction to the hydroxyl radical (OH) concentration in climatology data.
Definition mptrac.c:126
void write_met_bin_2d(FILE *out, met_t *met, float var[EX][EY], const char *varname)
Writes a 2-dimensional meteorological variable to a binary file.
Definition mptrac.c:15695
void read_met_pv(met_t *met)
Calculates potential vorticity (PV) from meteorological data.
Definition mptrac.c:13063
#define DD_EX_GLOB
Maximum number of longitudes of global meteo data.
Definition mptrac.h:629
int read_atm_bin(const char *filename, const ctl_t *ctl, atm_t *atm)
Reads air parcel data from a binary file and populates the given atmospheric structure.
Definition mptrac.c:9336
#define CY
Maximum number of latitudes for climatological data.
Definition mptrac.h:599
void module_chem_grid(const ctl_t *ctl, const cache_t *cache, met_t *met0, met_t *met1, atm_t *atm, const double t)
Computes gridded chemical tracer concentrations (volume mixing ratio) from individual air parcel mass...
Definition mptrac.c:4186
void write_budget(const char *filename, const ctl_t *ctl, const atm_t *atm, const double t)
Writes a time series of the atmospheric tracer mass budget.
Definition mptrac.c:14451
double clim_ts(const clim_ts_t *ts, const double t)
Interpolates a time series of climatological variables.
Definition mptrac.c:400
void jsec2time(const double jsec, int *year, int *mon, int *day, int *hour, int *min, int *sec, double *remain)
Converts Julian seconds to calendar date and time components.
Definition mptrac.c:3574
int read_met_bin(const char *filename, const ctl_t *ctl, met_t *met)
Reads meteorological data from a binary file.
Definition mptrac.c:9809
void write_atm_clams(const char *filename, const ctl_t *ctl, const atm_t *atm)
Writes air parcel data to a NetCDF file in the CLaMS format.
Definition mptrac.c:14176
void sort_uvwp(cache_t *cache, const int *perm, double *tmp, const int np)
Reorder particle-specific wind perturbations.
Definition mptrac.c:2539
void get_met_replace(char *orig, const char *search, const char *repl)
Replaces occurrences of a substring in a string with another substring.
Definition mptrac.c:2996
void module_diff_turb(const ctl_t *ctl, cache_t *cache, const clim_t *clim, met_t *met0, met_t *met1, atm_t *atm)
Applies turbulent diffusion processes to atmospheric particles.
Definition mptrac.c:4955
int read_atm_clams(const char *filename, const ctl_t *ctl, atm_t *atm)
Reads atmospheric data from a CLAMS NetCDF file.
Definition mptrac.c:9394
void write_depo_nc(const char *filename, const ctl_t *ctl, const double *data, const double t, const double *lon, const double *lat, const double *area)
Write radioactive deposition densities as a CF-style netCDF file.
Definition mptrac.c:15057
void module_timesteps(const ctl_t *ctl, cache_t *cache, const met_t *met0, atm_t *atm, const double t)
Calculate time steps for air parcels based on specified conditions.
Definition mptrac.c:6466
int mptrac_read_met(const char *filename, const ctl_t *ctl, const clim_t *clim, met_t *met, dd_t *dd)
Reads meteorological data from a file, supporting multiple formats and MPI broadcasting.
Definition mptrac.c:8584
void mptrac_run_timestep(ctl_t *ctl, cache_t *cache, clim_t *clim, met_t **met0, met_t **met1, atm_t *atm, depo_t *depo, double t, dd_t *dd)
Executes a single timestep of the MPTRAC model simulation.
Definition mptrac.c:8741
void write_vtk(const char *filename, const ctl_t *ctl, const atm_t *atm, const double t)
Writes VTK (Visualization Toolkit) data to a specified file.
Definition mptrac.c:16562
#define EP
Maximum number of pressure levels for meteo data.
Definition mptrac.h:544
void module_tracer_chem(const ctl_t *ctl, const cache_t *cache, const clim_t *clim, met_t *met0, met_t *met1, atm_t *atm)
Simulate chemical reactions involving long-lived atmospheric tracers.
Definition mptrac.c:6546
void mptrac_read_ctl(const char *filename, int argc, char *argv[], ctl_t *ctl)
Reads control parameters from a configuration file and populates the given structure.
Definition mptrac.c:7266
void read_met_polar_winds(met_t *met)
Applies a fix for polar winds in meteorological data.
Definition mptrac.c:13001
void module_h2o2_chem(const ctl_t *ctl, const cache_t *cache, const clim_t *clim, met_t *met0, met_t *met1, atm_t *atm)
Apply aqueous H2O2 oxidation of SO2 in liquid cloud water.
Definition mptrac.c:5193
void write_grid_nc(const char *filename, const ctl_t *ctl, const double *cd, double *mean[NQ], double *sigma[NQ], const double *vmr_impl, const double t, const double *z, const double *lon, const double *lat, const double *area, const double dz, const int *np)
Writes grid data to a NetCDF file.
Definition mptrac.c:15434
double pbl_weight(const ctl_t *ctl, const atm_t *atm, const int ip, const double pbl, const double ps)
Computes a weighting factor based on planetary boundary layer pressure.
Definition mptrac.c:9270
void module_diff_pbl(const ctl_t *ctl, cache_t *cache, met_t *met0, met_t *met1, atm_t *atm)
Computes particle diffusion within the planetary boundary layer (PBL).
Definition mptrac.c:4672
void write_met_nc_3d(const int ncid, const char *varname, met_t *met, float var[EX][EY][EP], const float scl)
Writes a 3D meteorological variable to a NetCDF file.
Definition mptrac.c:16029
void module_isosurf(const ctl_t *ctl, const cache_t *cache, met_t *met0, met_t *met1, atm_t *atm)
Apply the isosurface module to adjust atmospheric properties.
Definition mptrac.c:5367
void module_kpp_chem(ctl_t *ctl, cache_t *cache, clim_t *clim, met_t *met0, met_t *met1, atm_t *atm)
KPP chemistry module.
#define CO3
Maximum number of total column ozone data for climatological data.
Definition mptrac.h:604
void module_oh_chem(const ctl_t *ctl, const cache_t *cache, const clim_t *clim, met_t *met0, met_t *met1, atm_t *atm)
Perform hydroxyl chemistry calculations for atmospheric particles.
Definition mptrac.c:5811
void read_met_grib_grid(codes_handle **handles, int count_handles, met_t *met)
Reads global meteorological information from a grib file.
void geo2cart(const double z, const double lon, const double lat, double *x)
Converts geographic coordinates (longitude, latitude, altitude) to Cartesian coordinates.
Definition mptrac.c:2909
void read_met_nc_grid(const char *filename, const int ncid, const ctl_t *ctl, met_t *met, dd_t *dd)
Reads meteorological grid data from NetCDF files with domain decomposition.
Definition mptrac.c:10561
void get_tropo(const int met_tropo, ctl_t *ctl, const clim_t *clim, met_t *met, const double *lons, const int nx, const double *lats, const int ny, double *pt, double *zt, double *tt, double *qt, double *o3t, double *ps, double *zs)
Calculate tropopause data.
Definition mptrac.c:3020
double kernel_weight(const double kz[EP], const double kw[EP], const int nk, const double p)
Calculates the kernel weight based on altitude and given kernel data.
Definition mptrac.c:3607
void module_dd(double t, const ctl_t *ctl, cache_t *cache, dd_t *dd, atm_t *atm, met_t **met)
Perform domain decomposition and exchange particles between MPI ranks.
Definition mptrac.c:4497
void compress_log_level(FILE *out, const char *codec, const char *varname, const size_t lev, const double plev, const double ratio, const double bpv, const double t_comp, const double t_decomp, const size_t n, const size_t nbytes, const float *org, const float *cmp)
Write one row of per-level compression diagnostics.
Definition mptrac.c:670
void compress_unscale_from_unit(float *array, const size_t nxy, const size_t nz, const double *off, const double *scl)
Restores a levelwise [0,1]-scaled 3-D field to physical units.
Definition mptrac.c:858
int read_atm_asc(const char *filename, const ctl_t *ctl, atm_t *atm)
Reads air parcel data from an ASCII file and populates the given atmospheric structure.
Definition mptrac.c:9292
void intpol_check_lon_lat(const double *lons, const int nlon, const double *lats, const int nlat, const double lon, const double lat, double *lon2, double *lat2)
Adjusts longitude and latitude to ensure they fall within valid bounds.
Definition mptrac.c:3063
void write_sample(const char *filename, const ctl_t *ctl, met_t *met0, met_t *met1, const atm_t *atm, const double t)
Writes sample data to a specified file.
Definition mptrac.c:16285
void write_grid(const char *filename, const ctl_t *ctl, met_t *met0, met_t *met1, const atm_t *atm, const double t)
Writes grid data to a file in ASCII or netCDF format.
Definition mptrac.c:15123
void module_dry_depo(const ctl_t *ctl, const cache_t *cache, met_t *met0, met_t *met1, atm_t *atm)
Simulate dry deposition of atmospheric particles.
Definition mptrac.c:5127
void write_met_bin(const char *filename, const ctl_t *ctl, met_t *met)
Writes meteorological data in binary format to a specified file.
Definition mptrac.c:15565
void write_atm_bin(const char *filename, const ctl_t *ctl, const atm_t *atm)
Writes air parcel data to a binary file.
Definition mptrac.c:14126
void read_met_cape(const ctl_t *ctl, const clim_t *clim, met_t *met)
Calculates Convective Available Potential Energy (CAPE) for each grid point.
Definition mptrac.c:10108
void mptrac_write_met(const char *filename, const ctl_t *ctl, met_t *met)
Writes meteorological data to a file, supporting multiple formats and compression options.
Definition mptrac.c:9072
#define CSZA
Maximum number of solar zenith angles for climatological data.
Definition mptrac.h:614
double tropo_weight(const ctl_t *ctl, const clim_t *clim, const atm_t *atm, const int ip)
Computes a weighting factor based on tropopause pressure.
Definition mptrac.c:14002
void dd_push(const ctl_t *ctl, atm_t *atm, cache_t *cache, int *npart)
Compact and stage non-local particles for domain decomposition transfer.
Definition mptrac.c:2581
double lapse_rate(const double t, const double h2o)
Calculates the moist adiabatic lapse rate in Kelvin per kilometer.
Definition mptrac.c:3633
void module_radio_depo(const ctl_t *ctl, const cache_t *cache, met_t *met0, met_t *met1, atm_t *atm, depo_t *depo)
Deposit supported radionuclides from air parcels onto the ground grid.
Definition mptrac.c:6028
void write_csi(const char *filename, const ctl_t *ctl, const atm_t *atm, const double t)
Writes Critical Success Index (CSI) data to a file.
Definition mptrac.c:14547
void write_atm_nc(const char *filename, const ctl_t *ctl, const atm_t *atm)
Writes air parcel data to a NetCDF file.
Definition mptrac.c:14402
Air parcel data.
Definition mptrac.h:3662
int np
Number of air parcels.
Definition mptrac.h:3665
Cache data structure.
Definition mptrac.h:3723
int iso_n
Isosurface balloon number of data points.
Definition mptrac.h:3732
Climatological data in the form of photolysis rates.
Definition mptrac.h:3779
int nsza
Number of solar zenith angles.
Definition mptrac.h:3785
int np
Number of pressure levels.
Definition mptrac.h:3782
int no3c
Number of total ozone columns.
Definition mptrac.h:3788
Climatological data.
Definition mptrac.h:3887
clim_ts_t ccl2f2
CFC-12 time series.
Definition mptrac.h:3929
clim_photo_t photo
Photolysis rates.
Definition mptrac.h:3905
clim_zm_t ho2
HO2 zonal means.
Definition mptrac.h:3917
clim_zm_t hno3
HNO3 zonal means.
Definition mptrac.h:3908
int tropo_ntime
Number of tropopause timesteps.
Definition mptrac.h:3890
clim_ts_t sf6
SF6 time series.
Definition mptrac.h:3935
clim_ts_t ccl4
CFC-10 time series.
Definition mptrac.h:3923
clim_ts_t ccl3f
CFC-11 time series.
Definition mptrac.h:3926
clim_zm_t o1d
O(1D) zonal means.
Definition mptrac.h:3920
clim_zm_t h2o2
H2O2 zonal means.
Definition mptrac.h:3914
int tropo_nlat
Number of tropopause latitudes.
Definition mptrac.h:3893
clim_zm_t oh
OH zonal means.
Definition mptrac.h:3911
clim_ts_t n2o
N2O time series.
Definition mptrac.h:3932
Climatological data in the form of time series.
Definition mptrac.h:3835
int ntime
Number of timesteps.
Definition mptrac.h:3838
Climatological data in the form of zonal means.
Definition mptrac.h:3855
int np
Number of pressure levels.
Definition mptrac.h:3864
int ntime
Number of timesteps.
Definition mptrac.h:3858
int nlat
Number of latitudes.
Definition mptrac.h:3861
Control parameters.
Definition mptrac.h:2557
double met_utm_ref_lon
Reference longitude [deg] for UTM grid.
Definition mptrac.h:2923
double grid_z0
Lower altitude of gridded data [km].
Definition mptrac.h:3509
int qnt_o3
Quantity array index for ozone volume mixing ratio.
Definition mptrac.h:2669
double csi_lat1
Upper latitude of gridded CSI data [deg].
Definition mptrac.h:3470
int qnt_Coh
Quantity array index for OH volume mixing ratio (chemistry code).
Definition mptrac.h:2831
double wet_depo_ic_a
Coefficient A for wet deposition in cloud (exponential form).
Definition mptrac.h:3340
int qnt_eta_d
Quantity array index for diagnosed eta vertical coordinate.
Definition mptrac.h:2786
int qnt_target_subdomain
Quantity array index for destination subdomain in domain decomposition.
Definition mptrac.h:2889
int met_nc_scale
Check netCDF scaling factors (0=no, 1=yes).
Definition mptrac.h:2940
int qnt_pel
Quantity array index for pressure at equilibrium level (EL).
Definition mptrac.h:2702
int csi_nz
Number of altitudes of gridded CSI data.
Definition mptrac.h:3446
double molmass
Molar mass [g/mol].
Definition mptrac.h:3196
int qnt_p
Quantity array index for pressure.
Definition mptrac.h:2648
double dry_depo_dz
Geometric dry-deposition layer thickness above the surface [m].
Definition mptrac.h:3364
int qnt_Cccl2f2
Quantity array index for CFC-12 volume mixing ratio (chemistry code).
Definition mptrac.h:2855
int dd_halos_size
Domain decomposition halo size in grid points.
Definition mptrac.h:3639
int mixing_nx
Number of longitudes of mixing grid.
Definition mptrac.h:3259
int met_zstd_nworkers
ZSTD number of worker threads (0=single-threaded, default=4).
Definition mptrac.h:2955
double chemgrid_z1
Upper altitude of chemistry grid [km].
Definition mptrac.h:3283
int qnt_m
Quantity array index for mass.
Definition mptrac.h:2588
int qnt_aoa
Quantity array index for the age-of-air reference timestamp [s since 2000-01-01 00:00 UTC].
Definition mptrac.h:2865
int qnt_rhop
Quantity array index for particle density.
Definition mptrac.h:2597
int qnt_swc
Quantity array index for cloud snow water content.
Definition mptrac.h:2681
double csi_obsmin
Minimum observation index to trigger detection.
Definition mptrac.h:3440
int qnt_pcb
Quantity array index for cloud bottom pressure.
Definition mptrac.h:2690
double bound_dzs
Boundary conditions surface layer depth [km].
Definition mptrac.h:3184
double csi_lon1
Upper longitude of gridded CSI data [deg].
Definition mptrac.h:3461
int qnt_u
Quantity array index for zonal wind.
Definition mptrac.h:2657
double stat_lon
Longitude of station [deg].
Definition mptrac.h:3587
double sort_dt
Time step for sorting of particle data [s].
Definition mptrac.h:3086
double mixing_z1
Upper altitude of mixing grid [km].
Definition mptrac.h:3256
double stat_r
Search radius around station [km].
Definition mptrac.h:3593
double wet_depo_bc_a
Coefficient A for wet deposition below cloud (exponential form).
Definition mptrac.h:3334
int met_zstd_level
ZSTD compression level (from -5 to 22, default=-3).
Definition mptrac.h:2952
double met_utm_ref_lat
Reference latitude [deg] for UTM grid.
Definition mptrac.h:2920
int csi_ny
Number of latitudes of gridded CSI data.
Definition mptrac.h:3464
int vtk_sphere
Spherical projection for VTK data (0=no, 1=yes).
Definition mptrac.h:3617
double chemgrid_z0
Lower altitude of chemistry grid [km].
Definition mptrac.h:3280
double met_pbl_min
Minimum depth of planetary boundary layer [km].
Definition mptrac.h:3054
int qnt_iwc
Quantity array index for cloud ice water content.
Definition mptrac.h:2678
double chemgrid_lat0
Lower latitude of chemistry grid [deg].
Definition mptrac.h:3298
double conv_cape
CAPE threshold for convection module [J/kg].
Definition mptrac.h:3148
int qnt_Co1d
Quantity array index for O(1D) volume mixing ratio (chemistry code).
Definition mptrac.h:2843
int qnt_pw
Quantity array index for partial water vapor pressure.
Definition mptrac.h:2756
double grid_z1
Upper altitude of gridded data [km].
Definition mptrac.h:3512
int direction
Direction flag (1=forward calculation, -1=backward calculation).
Definition mptrac.h:2892
int qnt_Cccl4
Quantity array index for CFC-10 volume mixing ratio (chemistry code).
Definition mptrac.h:2849
int met_dp
Stride for pressure levels.
Definition mptrac.h:3006
double met_dt_out
Time step for sampling of meteo data along trajectories [s].
Definition mptrac.h:3073
int qnt_h2o2
Quantity array index for H2O2 volume mixing ratio (climatology).
Definition mptrac.h:2720
int qnt_vh
Quantity array index for horizontal wind.
Definition mptrac.h:2798
int csi_nx
Number of longitudes of gridded CSI data.
Definition mptrac.h:3455
double csi_lat0
Lower latitude of gridded CSI data [deg].
Definition mptrac.h:3467
double turb_dz_trop
Vertical turbulent diffusion coefficient (troposphere) [m^2/s].
Definition mptrac.h:3127
int met_pbl
Planetary boundary layer data (0=file, 1=z2p, 2=Richardson, 3=theta).
Definition mptrac.h:3051
int qnt_lwc
Quantity array index for cloud liquid water content.
Definition mptrac.h:2672
double turb_mesoz
Vertical scaling factor for mesoscale wind fluctuations.
Definition mptrac.h:3136
int grid_nc_level
zlib compression level of netCDF grid data files (0=off).
Definition mptrac.h:3497
int grid_nx
Number of longitudes of gridded data.
Definition mptrac.h:3515
int atm_type
Type of atmospheric data files (0=ASCII, 1=binary, 2=netCDF, 3=CLaMS_traj, 4=CLaMS_pos).
Definition mptrac.h:3405
double bound_mass
Boundary conditions mass per particle [kg].
Definition mptrac.h:3157
double grid_lat0
Lower latitude of gridded data [deg].
Definition mptrac.h:3527
int qnt_ts
Quantity array index for surface temperature.
Definition mptrac.h:2603
int qnt_loss_rate
Quantity array index for total loss rate.
Definition mptrac.h:2747
int qnt_plfc
Quantity array index for pressure at level of free convection (LCF).
Definition mptrac.h:2699
int qnt_Acs137
Quantity array index for radioactive activity of Cs-137.
Definition mptrac.h:2877
double grid_lon0
Lower longitude of gridded data [deg].
Definition mptrac.h:3518
int qnt_o1d
Quantity array index for O(1D) volume mixing ratio (climatology).
Definition mptrac.h:2726
int met_tropo_spline
Tropopause interpolation method (0=linear, 1=spline).
Definition mptrac.h:3070
int qnt_tvirt
Quantity array index for virtual temperature.
Definition mptrac.h:2792
double dt_met
Time step of meteo data [s].
Definition mptrac.h:2911
double chemgrid_lat1
Upper latitude of chemistry grid [deg].
Definition mptrac.h:3301
int met_geopot_sy
Latitudinal smoothing of geopotential heights.
Definition mptrac.h:3042
double turb_dx_strat
Horizontal turbulent diffusion coefficient (stratosphere) [m^2/s].
Definition mptrac.h:3121
int qnt_vmr
Quantity array index for volume mixing ratio.
Definition mptrac.h:2591
int qnt_lsm
Quantity array index for land-sea mask.
Definition mptrac.h:2624
int qnt_theta
Quantity array index for potential temperature.
Definition mptrac.h:2768
double bound_lat1
Boundary conditions maximum longitude [deg].
Definition mptrac.h:3172
double stat_t1
Stop time for station output [s].
Definition mptrac.h:3599
double turb_dx_trop
Horizontal turbulent diffusion coefficient (troposphere) [m^2/s].
Definition mptrac.h:3118
int grid_type
Type of grid data files (0=ASCII, 1=netCDF).
Definition mptrac.h:3533
double csi_lon0
Lower longitude of gridded CSI data [deg].
Definition mptrac.h:3458
int qnt_pbl
Quantity array index for boundary layer pressure.
Definition mptrac.h:2630
int grid_stddev
Include standard deviations in grid output (0=no, 1=yes).
Definition mptrac.h:3503
int met_nc_read_mode
NetCDF DD input (0=local hyperslabs, 1=global 2-D slices via MPI).
Definition mptrac.h:2943
int qnt_psice
Quantity array index for saturation pressure over ice.
Definition mptrac.h:2753
double chemgrid_lon0
Lower longitude of chemistry grid [deg].
Definition mptrac.h:3289
int bound_pbl
Boundary conditions planetary boundary layer (0=no, 1=yes).
Definition mptrac.h:3190
double dt_pbl
Maximum internal Hanna-PBL timestep [s] (default: 2 s).
Definition mptrac.h:3112
int qnt_mloss_wet
Quantity array index for total mass loss due to wet deposition.
Definition mptrac.h:2738
int radio_decay
RADIO_DECAY switch for airborne and deposited activity (0=off, 1=on, default: 0).
Definition mptrac.h:3325
int met_geopot_sx
Longitudinal smoothing of geopotential heights.
Definition mptrac.h:3039
int met_sy
Smoothing for latitudes.
Definition mptrac.h:3012
int qnt_ps
Quantity array index for surface pressure.
Definition mptrac.h:2600
int rng_type
Random number generator (0=GSL, 1=Squares, 2=cuRAND).
Definition mptrac.h:3103
int met_pck_zstd
Apply an additional ZSTD compression step to PCK payloads (0=off, 1=on).
Definition mptrac.h:2961
int isosurf
Isosurface parameter (0=none, 1=pressure, 2=density, 3=theta, 4=balloon).
Definition mptrac.h:3090
double bound_p1
Boundary conditions top pressure [hPa].
Definition mptrac.h:3178
int qnt_zs
Quantity array index for surface geopotential height.
Definition mptrac.h:2606
int prof_nz
Number of altitudes of gridded profile data.
Definition mptrac.h:3542
double csi_dt_out
Time step for CSI output [s].
Definition mptrac.h:3434
int met_cape
Convective available potential energy data (0=file, 1=calculate).
Definition mptrac.h:3048
double csi_modmin
Minimum column density to trigger detection [kg/m^2].
Definition mptrac.h:3443
int met_sx
Smoothing for longitudes.
Definition mptrac.h:3009
double chemgrid_lon1
Upper longitude of chemistry grid [deg].
Definition mptrac.h:3292
double depo_dt_out
DEPO_DT_OUT time interval for radioactive deposition output [s] (default: 86400).
Definition mptrac.h:3383
double turb_mesox
Horizontal scaling factor for mesoscale wind fluctuations.
Definition mptrac.h:3133
double prof_z0
Lower altitude of gridded profile data [km].
Definition mptrac.h:3545
int qnt_w
Quantity array index for vertical velocity.
Definition mptrac.h:2663
double bound_vmr
Boundary conditions volume mixing ratio [ppv].
Definition mptrac.h:3163
double met_tropo_pv
Dynamical tropopause potential vorticity threshold [PVU].
Definition mptrac.h:3064
int prof_nx
Number of longitudes of gridded profile data.
Definition mptrac.h:3551
int qnt_stat
Quantity array index for station flag.
Definition mptrac.h:2585
int dd_supported
Whether the executable implements the domain decomposition.
Definition mptrac.h:3650
double dd_sort_dt
Sorting time interval for the compactification (DD_EXCHANGE_MODE=0).
Definition mptrac.h:3642
int met_tropo
Tropopause definition (0=none, 1=clim, 2=cold point, 3=WMO_1st, 4=WMO_2nd, 5=dynamical).
Definition mptrac.h:3061
int qnt_rp
Quantity array index for particle radius.
Definition mptrac.h:2594
int met_mpi_share
Use MPI to share meteo (0=no, 1=yes).
Definition mptrac.h:3079
int qnt_vz
Quantity array index for vertical velocity.
Definition mptrac.h:2801
int qnt_ho2
Quantity array index for HO2 volume mixing ratio (climatology).
Definition mptrac.h:2723
double csi_z1
Upper altitude of gridded CSI data [km].
Definition mptrac.h:3452
double stat_t0
Start time for station output [s].
Definition mptrac.h:3596
double oh_chem_beta
Beta parameter for diurnal variability of OH.
Definition mptrac.h:3310
int dd
Domain decomposition (0=no, 1=yes).
Definition mptrac.h:3627
int qnt_eta
Quantity array index for eta vertical coordinate.
Definition mptrac.h:2783
double wet_depo_so2_ph
pH value used to calculate effective Henry constant of SO2.
Definition mptrac.h:3352
double mixing_z0
Lower altitude of mixing grid [km].
Definition mptrac.h:3253
int qnt_mloss_decay
Quantity array index for total mass loss due to exponential decay.
Definition mptrac.h:2744
int atm_type_out
Type of atmospheric data files for output (-1=same as ATM_TYPE, 0=ASCII, 1=binary,...
Definition mptrac.h:3410
int met_cms_nd0x
cmultiscale number of cells of coarsest grid in x-direction.
Definition mptrac.h:2988
int met_nlev
Number of meteo data model levels.
Definition mptrac.h:3030
double dt_kpp
Time step for KPP chemistry [s].
Definition mptrac.h:3319
int qnt_shf
Quantity array index for surface sensible heat flux.
Definition mptrac.h:2621
int qnt_vs
Quantity array index for surface meridional wind.
Definition mptrac.h:2612
int qnt_Cco
Quantity array index for CO volume mixing ratio (chemistry code).
Definition mptrac.h:2828
double vtk_dt_out
Time step for VTK data output [s].
Definition mptrac.h:3605
double t_stop
Stop time of simulation [s].
Definition mptrac.h:2898
double conv_dt
Time interval for convection module [s].
Definition mptrac.h:3154
int qnt_hno3
Quantity array index for HNO3 volume mixing ratio (climatology).
Definition mptrac.h:2714
int met_clams
Read MPTRAC or CLaMS meteo data (0=MPTRAC, 1=CLaMS).
Definition mptrac.h:2937
int qnt_h2ot
Quantity array index for tropopause water vapor volume mixing ratio.
Definition mptrac.h:2642
int qnt_rh
Quantity array index for relative humidity over water.
Definition mptrac.h:2762
int met_gp2z
Convert surface geopotential to geopotential height (0=no, 1=yes).
Definition mptrac.h:2930
double bound_lat0
Boundary conditions minimum longitude [deg].
Definition mptrac.h:3169
double met_pbl_max
Maximum depth of planetary boundary layer [km].
Definition mptrac.h:3057
int met_dx
Stride for longitudes.
Definition mptrac.h:3000
int mixing_ny
Number of latitudes of mixing grid.
Definition mptrac.h:3268
int met_convention
Meteo data layout (0=[lev, lat, lon], 1=[lon, lat, lev]).
Definition mptrac.h:2914
int qnt_zeta_d
Quantity array index for diagnosed zeta vertical coordinate.
Definition mptrac.h:2777
int tracer_chem
Switch for first order tracer chemistry module (0=off, 1=on).
Definition mptrac.h:3322
double dt_mod
Time step of simulation [s].
Definition mptrac.h:2901
int diffusion
Diffusion switch (0=off, 1=on).
Definition mptrac.h:3106
int qnt_tnat
Quantity array index for T_NAT.
Definition mptrac.h:2816
int qnt_eta_dot
Quantity array index for velocity of eta vertical coordinate.
Definition mptrac.h:2789
int qnt_tice
Quantity array index for T_ice.
Definition mptrac.h:2810
int turb_pbl_scheme
PBL turbulence scheme (0=none, 1=closure).
Definition mptrac.h:3109
double budget_dt_out
Time step for mass budget output [s].
Definition mptrac.h:3425
int qnt_zg
Quantity array index for geopotential height.
Definition mptrac.h:2645
double vtk_offset
Vertical offset for VTK data [km].
Definition mptrac.h:3614
int qnt_v
Quantity array index for meridional wind.
Definition mptrac.h:2660
int qnt_mloss_dry
Quantity array index for total mass loss due to dry deposition.
Definition mptrac.h:2741
double bound_vmr_trend
Boundary conditions volume mixing ratio trend [ppv/s].
Definition mptrac.h:3166
int met_cache
Preload meteo data into disk cache (0=no, 1=yes).
Definition mptrac.h:3076
int qnt_oh
Quantity array index for OH volume mixing ratio (climatology).
Definition mptrac.h:2717
int qnt_Ch
Quantity array index for H volume mixing ratio (chemistry code).
Definition mptrac.h:2834
int met_press_level_def
Use predefined pressure levels or not.
Definition mptrac.h:3027
int oh_chem_reaction
OH reaction type (0=off, 1=constant, 2=bimolecular, 3=termolecular).
Definition mptrac.h:3304
int qnt_h2o
Quantity array index for water vapor volume mixing ratio.
Definition mptrac.h:2666
int prof_ny
Number of latitudes of gridded profile data.
Definition mptrac.h:3560
int qnt_rhice
Quantity array index for relative humidity over ice.
Definition mptrac.h:2765
int qnt_rho
Quantity array index for density of air.
Definition mptrac.h:2654
double sample_dz
Layer depth for sample output [km].
Definition mptrac.h:3581
double tdec_strat
Life time of particles in the stratosphere [s].
Definition mptrac.h:3202
int obs_type
Type of observation data files (0=ASCII, 1=netCDF).
Definition mptrac.h:3419
int qnt_us
Quantity array index for surface zonal wind.
Definition mptrac.h:2609
double grid_lon1
Upper longitude of gridded data [deg].
Definition mptrac.h:3521
int qnt_Cn2o
Quantity array index for N2O volume mixing ratio (chemistry code).
Definition mptrac.h:2858
int qnt_Cccl3f
Quantity array index for CFC-11 volume mixing ratio (chemistry code).
Definition mptrac.h:2852
int depo_type
DEPO_TYPE of deposition files (0=ASCII, 1=netCDF, default: 0).
Definition mptrac.h:3386
double mixing_lat0
Lower latitude of mixing grid [deg].
Definition mptrac.h:3271
int nens
Number of ensembles.
Definition mptrac.h:3473
int qnt_pt
Quantity array index for tropopause pressure.
Definition mptrac.h:2633
int qnt_cl
Quantity array index for total column cloud water.
Definition mptrac.h:2693
int advect
Advection scheme (1=Euler, 2=midpoint).
Definition mptrac.h:3096
double prof_z1
Upper altitude of gridded profile data [km].
Definition mptrac.h:3548
int qnt_t
Quantity array index for temperature.
Definition mptrac.h:2651
int atm_filter
Time filter for atmospheric data output (0=none, 1=missval, 2=remove).
Definition mptrac.h:3398
int kpp_chem
Switch for KPP chemistry module (0=off, 1=on).
Definition mptrac.h:3316
int qnt_zeta
Quantity array index for zeta vertical coordinate.
Definition mptrac.h:2774
double conv_pbl_trans
Depth of PBL transition layer (fraction of PBL pressure thickness).
Definition mptrac.h:3145
int met_lz4_accel
LZ4 acceleration factor (>=1, default=8).
Definition mptrac.h:2958
int qnt_Ai131
Quantity array index for radioactive activity of I-131.
Definition mptrac.h:2880
double mixing_tau_trop
E-folding time for interparcel mixing in the troposphere [s].
Definition mptrac.h:3244
int met_vert_coord
Vertical coordinate of input meteo data (0=plev, 1=mlev_p_file, 2=mlev_ab_file, 3=mlev_ab_full,...
Definition mptrac.h:2927
double csi_z0
Lower altitude of gridded CSI data [km].
Definition mptrac.h:3449
int qnt_lapse
Quantity array index for lapse rate.
Definition mptrac.h:2795
int qnt_Apb210
Quantity array index for radioactive activity of Pb-210.
Definition mptrac.h:2871
double stat_lat
Latitude of station [deg].
Definition mptrac.h:3590
int qnt_Cho2
Quantity array index for HO2 volume mixing ratio (chemistry code).
Definition mptrac.h:2837
int grid_ny
Number of latitudes of gridded data.
Definition mptrac.h:3524
int qnt_Csf6
Quantity array index for SF6 volume mixing ratio (chemistry code).
Definition mptrac.h:2861
int qnt_Ch2o
Quantity array index for H2O volume mixing ratio (chemistry code).
Definition mptrac.h:2822
double met_detrend
FWHM of horizontal Gaussian used for detrending [km].
Definition mptrac.h:3018
int conv_mix_pbl
Vertical mixing in the PBL (0=off, 1=on).
Definition mptrac.h:3142
double bound_dps
Boundary conditions surface layer depth [hPa].
Definition mptrac.h:3181
int chemgrid_nz
Number of altitudes of chemistry grid.
Definition mptrac.h:3277
int qnt_cape
Quantity array index for convective available potential energy (CAPE).
Definition mptrac.h:2705
int qnt_zeta_dot
Quantity array index for velocity of zeta vertical coordinate.
Definition mptrac.h:2780
double bound_mass_trend
Boundary conditions mass per particle trend [kg/s].
Definition mptrac.h:3160
int met_cms_nd0y
cmultiscale number of cells of coarsest grid in y-direction.
Definition mptrac.h:2991
int mixing_nz
Number of altitudes of mixing grid.
Definition mptrac.h:3250
int qnt_o3c
Quantity array index for total column ozone.
Definition mptrac.h:2711
double bound_p0
Boundary conditions bottom pressure [hPa].
Definition mptrac.h:3175
double mixing_lon0
Lower longitude of mixing grid [deg].
Definition mptrac.h:3262
int qnt_Co3
Quantity array index for O3 volume mixing ratio (chemistry code).
Definition mptrac.h:2825
int qnt_tsts
Quantity array index for T_STS.
Definition mptrac.h:2813
int grid_nz
Number of altitudes of gridded data.
Definition mptrac.h:3506
int qnt_nss
Quantity array index for northward turbulent surface stress.
Definition mptrac.h:2618
double ens_dt_out
Time step for ensemble output [s].
Definition mptrac.h:3479
int atm_stride
Particle index stride for atmospheric data files.
Definition mptrac.h:3401
int met_relhum
Try to read relative humidity (0=no, 1=yes).
Definition mptrac.h:3045
double mixing_lat1
Upper latitude of mixing grid [deg].
Definition mptrac.h:3274
double atm_dt_out
Time step for atmospheric data output [s].
Definition mptrac.h:3395
double prof_lat1
Upper latitude of gridded profile data [deg].
Definition mptrac.h:3566
int qnt_current_subdomain
Quantity array index for current subdomain in domain decomposition.
Definition mptrac.h:2886
int met_cms_batch
cmultiscale batch size.
Definition mptrac.h:2982
double psc_h2o
H2O volume mixing ratio for PSC analysis.
Definition mptrac.h:3370
int met_sp
Smoothing for pressure levels.
Definition mptrac.h:3015
double prof_lon0
Lower longitude of gridded profile data [deg].
Definition mptrac.h:3554
int qnt_Axe133
Quantity array index for radioactive activity of Xe-133.
Definition mptrac.h:2883
int chemgrid_nx
Number of longitudes of chemistry grid.
Definition mptrac.h:3286
int qnt_pct
Quantity array index for cloud top pressure.
Definition mptrac.h:2687
int qnt_mloss_kpp
Quantity array index for total mass loss due to KPP chemistry.
Definition mptrac.h:2735
int qnt_psat
Quantity array index for saturation pressure over water.
Definition mptrac.h:2750
double prof_lat0
Lower latitude of gridded profile data [deg].
Definition mptrac.h:3563
int qnt_cin
Quantity array index for convective inhibition (CIN).
Definition mptrac.h:2708
double turb_pbl_trans
Depth of turbulent PBL transition layer (fraction of PBL pressure thickness).
Definition mptrac.h:3139
double psc_hno3
HNO3 volume mixing ratio for PSC analysis.
Definition mptrac.h:3373
double prof_lon1
Upper longitude of gridded profile data [deg].
Definition mptrac.h:3557
int met_nc_quant
Number of digits for quantization of netCDF meteo files (0=off).
Definition mptrac.h:2949
int h2o2_chem_reaction
Reaction type for H2O2 chemistry (0=none, 1=SO2).
Definition mptrac.h:3313
int qnt_Co3p
Quantity array index for O(3P) volume mixing ratio (chemistry code).
Definition mptrac.h:2846
double wet_depo_bc_ret_ratio
Coefficients for wet deposition below cloud: retention ratio.
Definition mptrac.h:3358
int chemgrid_ny
Number of latitudes of chemistry grid.
Definition mptrac.h:3295
int qnt_Abe7
Quantity array index for radioactive activity of Be-7.
Definition mptrac.h:2874
int met_cms_zstd
cmultiscale ZSTD compression (0=off, 1=on).
Definition mptrac.h:2985
int met_cms_maxlev
cmultiscale maximum refinement level.
Definition mptrac.h:2994
int grid_sparse
Sparse output in grid data files (0=no, 1=yes).
Definition mptrac.h:3494
double dry_depo_vdep
Prescribed dry deposition velocity for mode 1 [m/s].
Definition mptrac.h:3367
int qnt_tt
Quantity array index for tropopause temperature.
Definition mptrac.h:2636
int met_np
Number of target pressure levels.
Definition mptrac.h:3021
int qnt_ens
Quantity array index for ensemble IDs.
Definition mptrac.h:2582
int met_nc_level
zlib compression level of netCDF meteo files (0=off).
Definition mptrac.h:2946
double mixing_dt
Time interval for mixing [s].
Definition mptrac.h:3241
double mixing_tau_strat
E-folding time for interparcel mixing in the stratosphere [s].
Definition mptrac.h:3247
int qnt_Arn222
Quantity array index for radioactive activity of Rn-222.
Definition mptrac.h:2868
int qnt_mloss_h2o2
Quantity array index for total mass loss due to H2O2 chemistry.
Definition mptrac.h:2732
double vtk_scale
Vertical scaling factor for VTK data.
Definition mptrac.h:3611
double turb_dx_pbl
Horizontal turbulent diffusion coefficient (PBL) [m^2/s].
Definition mptrac.h:3115
int dd_exchange_mode
Particle exchange: 0=sort/push (default), 1=direct pack/compact.
Definition mptrac.h:3645
double conv_cin
CIN threshold for convection module [J/kg].
Definition mptrac.h:3151
int qnt_pv
Quantity array index for potential vorticity.
Definition mptrac.h:2804
int advect_vert_coord
Vertical velocity of air parcels (0=omega_on_plev, 1=zetadot_on_mlev, 2=omega_on_mlev,...
Definition mptrac.h:3100
int qnt_mloss_oh
Quantity array index for total mass loss due to OH chemistry.
Definition mptrac.h:2729
int qnt_Ch2o2
Quantity array index for H2O2 volume mixing ratio (chemistry code).
Definition mptrac.h:2840
int qnt_sst
Quantity array index for sea surface temperature.
Definition mptrac.h:2627
double mixing_lon1
Upper longitude of mixing grid [deg].
Definition mptrac.h:3265
int atm_nc_level
zlib compression level of netCDF atmospheric data files (0=off).
Definition mptrac.h:3413
double wet_depo_ic_ret_ratio
Coefficients for wet deposition in cloud: retention ratio.
Definition mptrac.h:3355
int qnt_sh
Quantity array index for specific humidity.
Definition mptrac.h:2759
int met_coord_type
Type of coordinates for meteo data (-1=detect, 0=lat/lon [deg], 1=UTM [m]).
Definition mptrac.h:2917
int qnt_ess
Quantity array index for eastward turbulent surface stress.
Definition mptrac.h:2615
double wet_depo_ic_b
Coefficient B for wet deposition in cloud (exponential form).
Definition mptrac.h:3343
double wet_depo_bc_b
Coefficient B for wet deposition below cloud (exponential form).
Definition mptrac.h:3337
int met_dy
Stride for latitudes.
Definition mptrac.h:3003
int qnt_Cx
Quantity array index for trace species x volume mixing ratio (chemistry code).
Definition mptrac.h:2819
double turb_dz_strat
Vertical turbulent diffusion coefficient (stratosphere) [m^2/s].
Definition mptrac.h:3130
double bound_zetas
Boundary conditions surface layer zeta [K].
Definition mptrac.h:3187
int radio_depo
RADIO_DEPO switch for radionuclide deposition (0=off, 1=on, default: 0).
Definition mptrac.h:3328
int dd_subdomains_zonal
Domain decomposition zonal subdomain number (defaults to 2 if domain decomposition is used,...
Definition mptrac.h:3631
int dry_depo_mode
Dry deposition mode: 0=off, 1=prescribed velocity, 2=aerosol velocity.
Definition mptrac.h:3361
int qnt_idx
Quantity array index for air parcel IDs.
Definition mptrac.h:2579
double met_tropo_theta
Dynamical tropopause potential temperature threshold [K].
Definition mptrac.h:3067
int qnt_rwc
Quantity array index for cloud rain water content.
Definition mptrac.h:2675
double t_start
Start time of simulation [s].
Definition mptrac.h:2895
int nq
Number of quantities.
Definition mptrac.h:2564
double tdec_trop
Life time of particles in the troposphere [s].
Definition mptrac.h:3199
double sample_dx
Horizontal radius for sample output [km].
Definition mptrac.h:3578
int vtk_stride
Particle index stride for VTK data.
Definition mptrac.h:3608
double turb_dz_pbl
Vertical turbulent diffusion coefficient (PBL) [m^2/s].
Definition mptrac.h:3124
double grid_lat1
Upper latitude of gridded data [deg].
Definition mptrac.h:3530
int dd_subdomains_meridional
Domain decomposition meridional subdomain number (defaults to 2 if domain decomposition is used,...
Definition mptrac.h:3635
int qnt_zt
Quantity array index for tropopause geopotential height.
Definition mptrac.h:2639
int met_type
Type of meteo data files (0=netCDF, 1=binary, 2=pck, 3=ZFP, 4=ZSTD, 5=cms, 6=grib,...
Definition mptrac.h:2934
int qnt_iso_var
Quantity array index for isosurface reference (units depend on ISOSURF).
Definition mptrac.h:2771
int qnt_cc
Quantity array index for cloud cover.
Definition mptrac.h:2684
int qnt_plcl
Quantity array index for pressure at lifted condensation level (LCL).
Definition mptrac.h:2696
double grid_dt_out
Time step for gridded data output [s].
Definition mptrac.h:3491
int qnt_tdew
Quantity array index for dew point temperature.
Definition mptrac.h:2807
Domain decomposition data structure.
Definition mptrac.h:4123
int halo_offset_end
Offset of the periodic halo block at the end of the local x-array.
Definition mptrac.h:4161
int nx_glob
Number of global longitudes.
Definition mptrac.h:4130
int halo_offset_start
Offset of the periodic halo block at the beginning of the local x-array.
Definition mptrac.h:4158
MPI_Datatype MPI_Particle
MPI datatype for particle exchange.
Definition mptrac.h:4170
int ny_glob
Number of global latitudes.
Definition mptrac.h:4133
Ground inventories of deposited radionuclides.
Definition mptrac.h:3756
Meteo data structure.
Definition mptrac.h:3946
int coord_type
Definition mptrac.h:3952
int nx
Number of longitudes.
Definition mptrac.h:3955
int ny
Number of latitudes.
Definition mptrac.h:3958
int np
Number of pressure levels.
Definition mptrac.h:3961
int npl
Number of model levels.
Definition mptrac.h:3964
double time
Time [s].
Definition mptrac.h:3949
Particle data.
Definition mptrac.h:3692
double p
Pressure [hPa].
Definition mptrac.h:3698
double lat
Latitude [deg].
Definition mptrac.h:3704
double time
Time [s].
Definition mptrac.h:3695
double lon
Longitude [deg].
Definition mptrac.h:3701
double dt
Individual time step [s].
Definition mptrac.h:3707