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 3.30e-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.30e-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.40e-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) { \
1053 int ecc_result=(cmd); \
1054 if(ecc_result!=0) \
1055 ERRMSG("ECCODES error: %s", codes_get_error_message(ecc_result)); \
1056 }
1057
1071#define ECC_READ_2D(variable, target, scaling_factor, found_flag) { \
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 }
1081
1096#define ECC_READ_3D(variable, level, target, scaling_factor, found_flag) { \
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 }
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
1148#define FREAD(ptr, type, size, in) { \
1149 if(fread(ptr, sizeof(type), size, in)!=size) \
1150 ERRMSG("Error while reading!"); \
1151 }
1152
1168#define FWRITE(ptr, type, size, out) { \
1169 if(fwrite(ptr, sizeof(type), size, out)!=size) \
1170 ERRMSG("Error while writing!"); \
1171 }
1172
1183#define INTPOL_INIT \
1184 double cw[4] = {0.0, 0.0, 0.0, 0.0}; int ci[3] = {0, 0, 0};
1185
1197#define INTPOL_2D(var, init) \
1198 intpol_met_time_2d(met0, met0->var, met1, met1->var, \
1199 atm->time[ip], atm->lon[ip], atm->lat[ip], \
1200 &var, ci, cw, init);
1201
1214#define INTPOL_3D(var, init) \
1215 intpol_met_time_3d(met0, met0->var, met1, met1->var, \
1216 atm->time[ip], atm->p[ip], \
1217 atm->lon[ip], atm->lat[ip], \
1218 &var, ci, cw, init);
1219
1233#define INTPOL_SPACE_ALL(p, lon, lat) { \
1234 intpol_met_space_3d(met, met->z, p, lon, lat, &z, ci, cw, 1); \
1235 intpol_met_space_3d(met, met->t, p, lon, lat, &t, ci, cw, 0); \
1236 intpol_met_space_3d(met, met->u, p, lon, lat, &u, ci, cw, 0); \
1237 intpol_met_space_3d(met, met->v, p, lon, lat, &v, ci, cw, 0); \
1238 intpol_met_space_3d(met, met->w, p, lon, lat, &w, ci, cw, 0); \
1239 intpol_met_space_3d(met, met->pv, p, lon, lat, &pv, ci, cw, 0); \
1240 intpol_met_space_3d(met, met->h2o, p, lon, lat, &h2o, ci, cw, 0); \
1241 intpol_met_space_3d(met, met->o3, p, lon, lat, &o3, ci, cw, 0); \
1242 intpol_met_space_3d(met, met->lwc, p, lon, lat, &lwc, ci, cw, 0); \
1243 intpol_met_space_3d(met, met->rwc, p, lon, lat, &rwc, ci, cw, 0); \
1244 intpol_met_space_3d(met, met->iwc, p, lon, lat, &iwc, ci, cw, 0); \
1245 intpol_met_space_3d(met, met->swc, p, lon, lat, &swc, ci, cw, 0); \
1246 intpol_met_space_3d(met, met->cc, p, lon, lat, &cc, ci, cw, 0); \
1247 intpol_met_space_2d(met, met->ps, lon, lat, &ps, ci, cw, 0); \
1248 intpol_met_space_2d(met, met->ts, lon, lat, &ts, ci, cw, 0); \
1249 intpol_met_space_2d(met, met->zs, lon, lat, &zs, ci, cw, 0); \
1250 intpol_met_space_2d(met, met->us, lon, lat, &us, ci, cw, 0); \
1251 intpol_met_space_2d(met, met->vs, lon, lat, &vs, ci, cw, 0); \
1252 intpol_met_space_2d(met, met->ess, ess, lat, &ess, ci, cw, 0); \
1253 intpol_met_space_2d(met, met->nss, nss, lat, &nss, ci, cw, 0); \
1254 intpol_met_space_2d(met, met->shf, shf, lat, &shf, ci, cw, 0); \
1255 intpol_met_space_2d(met, met->lsm, lon, lat, &lsm, ci, cw, 0); \
1256 intpol_met_space_2d(met, met->sst, lon, lat, &sst, ci, cw, 0); \
1257 intpol_met_space_2d(met, met->pbl, lon, lat, &pbl, ci, cw, 0); \
1258 intpol_met_space_2d(met, met->pt, lon, lat, &pt, ci, cw, 0); \
1259 intpol_met_space_2d(met, met->tt, lon, lat, &tt, ci, cw, 0); \
1260 intpol_met_space_2d(met, met->zt, lon, lat, &zt, ci, cw, 0); \
1261 intpol_met_space_2d(met, met->h2ot, lon, lat, &h2ot, ci, cw, 0); \
1262 intpol_met_space_2d(met, met->pct, lon, lat, &pct, ci, cw, 0); \
1263 intpol_met_space_2d(met, met->pcb, lon, lat, &pcb, ci, cw, 0); \
1264 intpol_met_space_2d(met, met->cl, lon, lat, &cl, ci, cw, 0); \
1265 intpol_met_space_2d(met, met->plcl, lon, lat, &plcl, ci, cw, 0); \
1266 intpol_met_space_2d(met, met->plfc, lon, lat, &plfc, ci, cw, 0); \
1267 intpol_met_space_2d(met, met->pel, lon, lat, &pel, ci, cw, 0); \
1268 intpol_met_space_2d(met, met->cape, lon, lat, &cape, ci, cw, 0); \
1269 intpol_met_space_2d(met, met->cin, lon, lat, &cin, ci, cw, 0); \
1270 intpol_met_space_2d(met, met->o3c, lon, lat, &o3c, ci, cw, 0); \
1271 }
1272
1287#define INTPOL_TIME_ALL(time, p, lon, lat) { \
1288 intpol_met_time_3d(met0, met0->z, met1, met1->z, time, p, lon, lat, &z, ci, cw, 1); \
1289 intpol_met_time_3d(met0, met0->t, met1, met1->t, time, p, lon, lat, &t, ci, cw, 0); \
1290 intpol_met_time_3d(met0, met0->u, met1, met1->u, time, p, lon, lat, &u, ci, cw, 0); \
1291 intpol_met_time_3d(met0, met0->v, met1, met1->v, time, p, lon, lat, &v, ci, cw, 0); \
1292 intpol_met_time_3d(met0, met0->w, met1, met1->w, time, p, lon, lat, &w, ci, cw, 0); \
1293 intpol_met_time_3d(met0, met0->pv, met1, met1->pv, time, p, lon, lat, &pv, ci, cw, 0); \
1294 intpol_met_time_3d(met0, met0->h2o, met1, met1->h2o, time, p, lon, lat, &h2o, ci, cw, 0); \
1295 intpol_met_time_3d(met0, met0->o3, met1, met1->o3, time, p, lon, lat, &o3, ci, cw, 0); \
1296 intpol_met_time_3d(met0, met0->lwc, met1, met1->lwc, time, p, lon, lat, &lwc, ci, cw, 0); \
1297 intpol_met_time_3d(met0, met0->rwc, met1, met1->rwc, time, p, lon, lat, &rwc, ci, cw, 0); \
1298 intpol_met_time_3d(met0, met0->iwc, met1, met1->iwc, time, p, lon, lat, &iwc, ci, cw, 0); \
1299 intpol_met_time_3d(met0, met0->swc, met1, met1->swc, time, p, lon, lat, &swc, ci, cw, 0); \
1300 intpol_met_time_3d(met0, met0->cc, met1, met1->cc, time, p, lon, lat, &cc, ci, cw, 0); \
1301 intpol_met_time_2d(met0, met0->ps, met1, met1->ps, time, lon, lat, &ps, ci, cw, 0); \
1302 intpol_met_time_2d(met0, met0->ts, met1, met1->ts, time, lon, lat, &ts, ci, cw, 0); \
1303 intpol_met_time_2d(met0, met0->zs, met1, met1->zs, time, lon, lat, &zs, ci, cw, 0); \
1304 intpol_met_time_2d(met0, met0->us, met1, met1->us, time, lon, lat, &us, ci, cw, 0); \
1305 intpol_met_time_2d(met0, met0->vs, met1, met1->vs, time, lon, lat, &vs, ci, cw, 0); \
1306 intpol_met_time_2d(met0, met0->ess, met1, met1->ess, time, lon, lat, &ess, ci, cw, 0); \
1307 intpol_met_time_2d(met0, met0->nss, met1, met1->nss, time, lon, lat, &nss, ci, cw, 0); \
1308 intpol_met_time_2d(met0, met0->shf, met1, met1->shf, time, lon, lat, &shf, ci, cw, 0); \
1309 intpol_met_time_2d(met0, met0->lsm, met1, met1->lsm, time, lon, lat, &lsm, ci, cw, 0); \
1310 intpol_met_time_2d(met0, met0->sst, met1, met1->sst, time, lon, lat, &sst, ci, cw, 0); \
1311 intpol_met_time_2d(met0, met0->pbl, met1, met1->pbl, time, lon, lat, &pbl, ci, cw, 0); \
1312 intpol_met_time_2d(met0, met0->pt, met1, met1->pt, time, lon, lat, &pt, ci, cw, 0); \
1313 intpol_met_time_2d(met0, met0->tt, met1, met1->tt, time, lon, lat, &tt, ci, cw, 0); \
1314 intpol_met_time_2d(met0, met0->zt, met1, met1->zt, time, lon, lat, &zt, ci, cw, 0); \
1315 intpol_met_time_2d(met0, met0->h2ot, met1, met1->h2ot, time, lon, lat, &h2ot, ci, cw, 0); \
1316 intpol_met_time_2d(met0, met0->pct, met1, met1->pct, time, lon, lat, &pct, ci, cw, 0); \
1317 intpol_met_time_2d(met0, met0->pcb, met1, met1->pcb, time, lon, lat, &pcb, ci, cw, 0); \
1318 intpol_met_time_2d(met0, met0->cl, met1, met1->cl, time, lon, lat, &cl, ci, cw, 0); \
1319 intpol_met_time_2d(met0, met0->plcl, met1, met1->plcl, time, lon, lat, &plcl, ci, cw, 0); \
1320 intpol_met_time_2d(met0, met0->plfc, met1, met1->plfc, time, lon, lat, &plfc, ci, cw, 0); \
1321 intpol_met_time_2d(met0, met0->pel, met1, met1->pel, time, lon, lat, &pel, ci, cw, 0); \
1322 intpol_met_time_2d(met0, met0->cape, met1, met1->cape, time, lon, lat, &cape, ci, cw, 0); \
1323 intpol_met_time_2d(met0, met0->cin, met1, met1->cin, time, lon, lat, &cin, ci, cw, 0); \
1324 intpol_met_time_2d(met0, met0->o3c, met1, met1->o3c, time, lon, lat, &o3c, ci, cw, 0); \
1325 }
1326
1341#define LAPSE(p1, t1, p2, t2) \
1342 (1e3 * G0 / RA * ((t2) - (t1)) / ((t2) + (t1)) \
1343 * ((p2) + (p1)) / ((p2) - (p1)))
1344
1360#define LIN(x0, y0, x1, y1, x) \
1361 ((y0)+((y1)-(y0))/((x1)-(x0))*((x)-(x0)))
1362
1387#define MAX(a,b) \
1388 (((a)>(b))?(a):(b))
1389
1401#define MET_HEADER \
1402 fprintf(out, \
1403 "# $1 = time [s]\n" \
1404 "# $2 = altitude [km]\n" \
1405 "# $3 = longitude [deg]\n" \
1406 "# $4 = latitude [deg]\n" \
1407 "# $5 = pressure [hPa]\n" \
1408 "# $6 = temperature [K]\n" \
1409 "# $7 = zonal wind [m/s]\n" \
1410 "# $8 = meridional wind [m/s]\n" \
1411 "# $9 = vertical velocity [hPa/s]\n" \
1412 "# $10 = H2O volume mixing ratio [ppv]\n"); \
1413 fprintf(out, \
1414 "# $11 = O3 volume mixing ratio [ppv]\n" \
1415 "# $12 = geopotential height [km]\n" \
1416 "# $13 = potential vorticity [PVU]\n" \
1417 "# $14 = surface pressure [hPa]\n" \
1418 "# $15 = surface temperature [K]\n" \
1419 "# $16 = surface geopotential height [km]\n" \
1420 "# $17 = surface zonal wind [m/s]\n" \
1421 "# $18 = surface meridional wind [m/s]\n" \
1422 "# $19 = eastward turbulent surface stress [N/m^2]\n" \
1423 "# $20 = northward turbulent surface stress [N/m^2]\n"); \
1424 fprintf(out, \
1425 "# $21 = surface sensible heat flux [W/m^2]\n" \
1426 "# $22 = land-sea mask [1]\n" \
1427 "# $23 = sea surface temperature [K]\n" \
1428 "# $24 = tropopause pressure [hPa]\n" \
1429 "# $25 = tropopause geopotential height [km]\n" \
1430 "# $26 = tropopause temperature [K]\n" \
1431 "# $27 = tropopause water vapor [ppv]\n" \
1432 "# $28 = cloud liquid water content [kg/kg]\n" \
1433 "# $29 = cloud rain water content [kg/kg]\n" \
1434 "# $30 = cloud ice water content [kg/kg]\n"); \
1435 fprintf(out, \
1436 "# $31 = cloud snow water content [kg/kg]\n" \
1437 "# $32 = cloud cover [1]\n" \
1438 "# $33 = total column cloud water [kg/m^2]\n" \
1439 "# $34 = cloud top pressure [hPa]\n" \
1440 "# $35 = cloud bottom pressure [hPa]\n" \
1441 "# $36 = pressure at lifted condensation level (LCL) [hPa]\n" \
1442 "# $37 = pressure at level of free convection (LFC) [hPa]\n" \
1443 "# $38 = pressure at equilibrium level (EL) [hPa]\n" \
1444 "# $39 = convective available potential energy (CAPE) [J/kg]\n" \
1445 "# $40 = convective inhibition (CIN) [J/kg]\n"); \
1446 fprintf(out, \
1447 "# $41 = relative humidity over water [%%]\n" \
1448 "# $42 = relative humidity over ice [%%]\n" \
1449 "# $43 = dew point temperature [K]\n" \
1450 "# $44 = frost point temperature [K]\n" \
1451 "# $45 = NAT temperature [K]\n" \
1452 "# $46 = HNO3 volume mixing ratio [ppv]\n" \
1453 "# $47 = OH volume mixing ratio [ppv]\n" \
1454 "# $48 = H2O2 volume mixing ratio [ppv]\n" \
1455 "# $49 = HO2 volume mixing ratio [ppv]\n" \
1456 "# $50 = O(1D) volume mixing ratio [ppv]\n"); \
1457 fprintf(out, \
1458 "# $51 = boundary layer pressure [hPa]\n" \
1459 "# $52 = total column ozone [DU]\n" \
1460 "# $53 = number of data points\n" \
1461 "# $54 = number of tropopause data points\n" \
1462 "# $55 = number of CAPE data points\n");
1463
1488#define MIN(a,b) \
1489 (((a)<(b))?(a):(b))
1490
1503#define MOLEC_DENS(p,t) \
1504 (AVO * 1e-6 * ((p) * 100) / (RI * (t)))
1505
1517#define NC(cmd) { \
1518 int nc_result=(cmd); \
1519 if(nc_result!=NC_NOERR) \
1520 ERRMSG("%s", nc_strerror(nc_result)); \
1521 }
1522
1546#define NC_DEF_VAR(varname, type, ndims, dims, long_name, units, level, quant) { \
1547 NC(nc_def_var(ncid, varname, type, ndims, dims, &varid)); \
1548 NC(nc_put_att_text(ncid, varid, "long_name", strnlen(long_name, LEN), long_name)); \
1549 NC(nc_put_att_text(ncid, varid, "units", strnlen(units, LEN), units)); \
1550 NC_DEF_VAR_QUANTIZE(quant); \
1551 if((level) != 0) { \
1552 NC(nc_def_var_deflate(ncid, varid, 1, 1, level)); \
1553 /* unsigned int ulevel = (unsigned int)level; */ \
1554 /* NC(nc_def_var_filter(ncid, varid, 32015, 1, (unsigned int[]){ulevel})); */ \
1555 } \
1556 }
1557
1558#ifdef NC_QUANTIZE_GRANULARBR
1559#define NC_DEF_VAR_QUANTIZE(quant) do { \
1560 if((quant) > 0) \
1561 NC(nc_def_var_quantize(ncid, varid, NC_QUANTIZE_GRANULARBR, quant)); \
1562 } while(0)
1563#else
1564#define NC_DEF_VAR_QUANTIZE(quant) do { \
1565 if((quant) > 0) \
1566 ERRMSG("NetCDF quantization is not supported by this NetCDF version"); \
1567 } while(0)
1568#endif
1569
1587#define NC_GET_DOUBLE(varname, ptr, force) { \
1588 if(force) { \
1589 NC(nc_inq_varid(ncid, varname, &varid)); \
1590 NC(nc_get_var_double(ncid, varid, ptr)); \
1591 } else { \
1592 if(nc_inq_varid(ncid, varname, &varid) == NC_NOERR) { \
1593 NC(nc_get_var_double(ncid, varid, ptr)); \
1594 } else \
1595 WARN("netCDF variable %s is missing!", varname); \
1596 } \
1597 }
1598
1617#define NC_INQ_DIM(dimname, ptr, min, max, check) { \
1618 int dimid; size_t naux; \
1619 NC(nc_inq_dimid(ncid, dimname, &dimid)); \
1620 NC(nc_inq_dimlen(ncid, dimid, &naux)); \
1621 *ptr = (int)naux; \
1622 if (check) \
1623 if ((*ptr) < (min) || (*ptr) > (max)) \
1624 ERRMSG("Dimension %s is out of range!", dimname); \
1625 }
1626
1641#define NC_PUT_DOUBLE(varname, ptr, hyperslab) { \
1642 NC(nc_inq_varid(ncid, varname, &varid)); \
1643 if(hyperslab) { \
1644 NC(nc_put_vara_double(ncid, varid, start, count, ptr)); \
1645 } else { \
1646 NC(nc_put_var_double(ncid, varid, ptr)); \
1647 } \
1648 }
1649
1665#define NC_PUT_FLOAT(varname, ptr, hyperslab) { \
1666 NC(nc_inq_varid(ncid, varname, &varid)); \
1667 if(hyperslab) { \
1668 NC(nc_put_vara_float(ncid, varid, start, count, ptr)); \
1669 } else { \
1670 NC(nc_put_var_float(ncid, varid, ptr)); \
1671 } \
1672 }
1673
1688#define NC_PUT_INT(varname, ptr, hyperslab) { \
1689 NC(nc_inq_varid(ncid, varname, &varid)); \
1690 if(hyperslab) { \
1691 NC(nc_put_vara_int(ncid, varid, start, count, ptr)); \
1692 } else { \
1693 NC(nc_put_var_int(ncid, varid, ptr)); \
1694 } \
1695 }
1696
1710#define NC_PUT_ATT(varname, attname, text) { \
1711 NC(nc_inq_varid(ncid, varname, &varid)); \
1712 NC(nc_put_att_text(ncid, varid, attname, strnlen(text, LEN), text)); \
1713 }
1714
1727#define NC_PUT_ATT_GLOBAL(attname, text) \
1728 NC(nc_put_att_text(ncid, NC_GLOBAL, attname, strnlen(text, LEN), text));
1729
1747#define NN(x0, y0, x1, y1, x) \
1748 (fabs((x) - (x0)) <= fabs((x) - (x1)) ? (y0) : (y1))
1749
1765#ifdef _OPENACC
1766#define PARTICLE_LOOP(ip0, ip1, check_dt, ...) \
1767 const int ip0_const = ip0; \
1768 const int ip1_const = ip1; \
1769 _Pragma(__VA_ARGS__) \
1770 _Pragma("acc parallel loop independent gang vector") \
1771 for (int ip = ip0_const; ip < ip1_const; ip++) \
1772 if (!check_dt || cache->dt[ip] != 0)
1773#else
1774#define PARTICLE_LOOP(ip0, ip1, check_dt, ...) \
1775 const int ip0_const = ip0; \
1776 const int ip1_const = ip1; \
1777 _Pragma("omp parallel for default(shared)") \
1778 for (int ip = ip0_const; ip < ip1_const; ip++) \
1779 if (!check_dt || cache->dt[ip] != 0)
1780#endif
1781
1804#define P(z) \
1805 (P0 * exp(-(z) / H0))
1806
1828#define PSAT(t) \
1829 (6.112 * exp(17.62 * ((t) - T0) / (243.12 + (t) - T0)))
1830
1852#define PSICE(t) \
1853 (6.112 * exp(22.46 * ((t) - T0) / (272.62 + (t) - T0)))
1854
1879#define PW(p, h2o) \
1880 ((p) * MAX((h2o), 0.1e-6) / (1. + (1. - EPS) * MAX((h2o), 0.1e-6)))
1881
1896#define RAD2DEG(rad) \
1897 ((rad) * (180.0 / M_PI))
1898
1926#define RH(p, t, h2o) \
1927 (PW(p, h2o) / PSAT(t) * 100.)
1928
1956#define RHICE(p, t, h2o) \
1957 (PW(p, h2o) / PSICE(t) * 100.)
1958
1981#define RHO(p, t) \
1982 (100. * (p) / (RA * (t)))
1983
2000#define SET_ATM(qnt, val) \
2001 if (ctl->qnt >= 0) \
2002 atm->q[ctl->qnt][ip] = val;
2003
2023#define SET_QNT(qnt, name, longname, unit) \
2024 if (strcasecmp(ctl->qnt_name[iq], name) == 0) { \
2025 ctl->qnt = iq; \
2026 sprintf(ctl->qnt_longname[iq], longname); \
2027 sprintf(ctl->qnt_unit[iq], unit); \
2028 } else
2029
2044#define SH(h2o) \
2045 (EPS * MAX((h2o), 0.1e-6))
2046
2057#define SQR(x) \
2058 ((x)*(x))
2059
2071#define SWAP(x, y, type) \
2072 do {type tmp = x; x = y; y = tmp;} while(0);
2073
2095#define TDEW(p, h2o) \
2096 (T0 + 243.12 * log(PW((p), (h2o)) / 6.112) \
2097 / (17.62 - log(PW((p), (h2o)) / 6.112)))
2098
2120#define TICE(p, h2o) \
2121 (T0 + 272.62 * log(PW((p), (h2o)) / 6.112) \
2122 / (22.46 - log(PW((p), (h2o)) / 6.112)))
2123
2144#define THETA(p, t) \
2145 ((t) * pow(1000. / (p), KAPPA))
2146
2173#define THETAVIRT(p, t, h2o) \
2174 (TVIRT(THETA((p), (t)), MAX((h2o), 0.1e-6)))
2175
2194#define TOK(line, tok, format, var) { \
2195 if(((tok)=strtok((line), " \t"))) { \
2196 if(sscanf(tok, format, &(var))!=1) continue; \
2197 } else ERRMSG("Error while reading!"); \
2198 }
2199
2219#define TVIRT(t, h2o) \
2220 ((t) * (1. + (1. - EPS) * MAX((h2o), 0.1e-6)))
2221
2233#define USAGE \
2234 do { \
2235 int iusage; \
2236 for (iusage = 1; iusage < argc; iusage++) \
2237 if (!strcmp(argv[iusage], "-h") \
2238 || !strcmp(argv[iusage], "--help")) { \
2239 usage(); \
2240 return EXIT_SUCCESS; \
2241 } \
2242 } while (0)
2243
2263#define Z(p) \
2264 (H0 * log(P0 / (p)))
2265
2294#define ZDIFF(lnp0, t0, h2o0, lnp1, t1, h2o1) \
2295 (RI / MA / G0 * 0.5 * (TVIRT((t0), (h2o0)) + TVIRT((t1), (h2o1))) \
2296 * ((lnp0) - (lnp1)))
2297
2313#define ZETA(ps, p, t) \
2314 (((p) / (ps) <= 0.3 ? 1. : \
2315 sin(M_PI / 2. * (1. - (p) / (ps)) / (1. - 0.3))) \
2316 * THETA((p), (t)))
2317
2318/* ------------------------------------------------------------
2319 Log messages...
2320 ------------------------------------------------------------ */
2321
2323#ifndef LOGLEV
2324#define LOGLEV 2
2325#endif
2326
2356#define LOG(level, ...) { \
2357 if(level >= 2) \
2358 printf(" "); \
2359 if(level <= LOGLEV) { \
2360 printf(__VA_ARGS__); \
2361 printf("\n"); \
2362 } \
2363 }
2364
2393#define WARN(...) { \
2394 printf("\nWarning (%s, %s, l%d): ", __FILE__, __func__, __LINE__); \
2395 LOG(0, __VA_ARGS__); \
2396 }
2397
2426#define ERRMSG(...) { \
2427 printf("\nError (%s, %s, l%d): ", __FILE__, __func__, __LINE__); \
2428 LOG(0, __VA_ARGS__); \
2429 exit(EXIT_FAILURE); \
2430 }
2431
2461#define PRINT(format, var) \
2462 printf("Print (%s, %s, l%d): %s= "format"\n", \
2463 __FILE__, __func__, __LINE__, #var, var);
2464
2465/* ------------------------------------------------------------
2466 Timers...
2467 ------------------------------------------------------------ */
2468
2470#define NTIMER 100
2471
2485#define PRINT_TIMERS \
2486 timer("END", "END", 1);
2487
2500#define SELECT_TIMER(id, group) \
2501 timer(id, group, 0);
2502
2503/* ------------------------------------------------------------
2504 Structs...
2505 ------------------------------------------------------------ */
2506
2514typedef struct {
2515
2516 /* ------------------------------------------------------------
2517 Quantity parameters...
2518 ------------------------------------------------------------ */
2519
2521 int nq;
2522
2524 char qnt_name[NQ][LEN];
2525
2527 char qnt_longname[NQ][LEN];
2528
2530 char qnt_unit[NQ][LEN];
2531
2533 char qnt_format[NQ][LEN];
2534
2537
2540
2543
2546
2549
2552
2555
2558
2561
2564
2567
2570
2573
2576
2579
2582
2585
2588
2591
2594
2597
2600
2603
2606
2609
2612
2615
2618
2621
2624
2627
2630
2633
2636
2639
2642
2645
2648
2651
2654
2657
2660
2663
2666
2669
2672
2675
2678
2681
2684
2687
2690
2693
2696
2699
2702
2705
2708
2711
2714
2717
2720
2723
2726
2729
2732
2735
2738
2741
2744
2747
2750
2753
2756
2759
2762
2765
2768
2771
2774
2777
2780
2783
2786
2789
2792
2795
2798
2801
2804
2807
2810
2813
2816
2819
2822
2825
2828
2831
2834
2837
2840
2843
2846
2849
2851 double t_start;
2852
2854 double t_stop;
2855
2857 double dt_mod;
2858
2859 /* ------------------------------------------------------------
2860 Meteo data parameters...
2861 ------------------------------------------------------------ */
2862
2864 char metbase[LEN];
2865
2867 double dt_met;
2868
2871
2874
2877
2880
2884
2887
2891
2894
2897
2900
2903
2906
2909
2912
2915
2918
2920 int met_zfp_prec[METVAR];
2921
2923 double met_zfp_tol[METVAR];
2924
2926 int met_sz3_prec[METVAR];
2927
2929 double met_sz3_tol[METVAR];
2930
2932 int met_lossy_scale[METVAR];
2933
2935 char met_comp_logfile[LEN];
2936
2939
2942
2945
2948
2951
2953 double met_cms_eps[METVAR];
2954
2957
2960
2963
2966
2969
2972
2975
2978
2980 double met_p[EP];
2981
2984
2987
2989 double met_lev_hyam[EP];
2990
2992 double met_lev_hybm[EP];
2993
2996
2999
3002
3005
3008
3011
3014
3018
3021
3024
3027
3030
3033
3036
3037 /* ------------------------------------------------------------
3038 Geophysical module parameters...
3039 ------------------------------------------------------------ */
3040
3042 double sort_dt;
3043
3047
3049 char balloon[LEN];
3050
3053
3057
3060
3063
3066
3069
3072
3075
3078
3081
3084
3087
3090
3093
3096
3099
3102
3104 double conv_cin;
3105
3107 double conv_dt;
3108
3111
3114
3117
3120
3123
3126
3128 double bound_p0;
3129
3131 double bound_p1;
3132
3135
3138
3141
3144
3146 char species[LEN];
3147
3149 double molmass;
3150
3153
3156
3159
3161 char clim_hno3_filename[LEN];
3162
3164 char clim_oh_filename[LEN];
3165
3167 char clim_h2o2_filename[LEN];
3168
3170 char clim_ho2_filename[LEN];
3171
3173 char clim_o1d_filename[LEN];
3174
3176 char clim_o3_filename[LEN];
3177
3179 char clim_ccl4_timeseries[LEN];
3180
3182 char clim_ccl3f_timeseries[LEN];
3183
3185 char clim_ccl2f2_timeseries[LEN];
3186
3188 char clim_n2o_timeseries[LEN];
3189
3191 char clim_sf6_timeseries[LEN];
3192
3195
3198
3201
3204
3207
3210
3213
3216
3219
3222
3225
3228
3231
3234
3237
3240
3243
3246
3249
3252
3255
3258
3260 double oh_chem[4];
3261
3264
3267
3270
3272 double dt_kpp;
3273
3276
3279
3282
3284 double wet_depo_pre[2];
3285
3288
3291
3294
3297
3299 double wet_depo_ic_h[2];
3300
3302 double wet_depo_bc_h[2];
3303
3306
3309
3312
3315
3318
3320 double psc_h2o;
3321
3323 double psc_hno3;
3324
3325 /* ------------------------------------------------------------
3326 Output parameters...
3327 ------------------------------------------------------------ */
3328
3330 char depo_basename[LEN];
3331
3334
3337
3339 char atm_basename[LEN];
3340
3342 char atm_gpfile[LEN];
3343
3346
3349
3352
3356
3361
3364
3366 int atm_nc_quant[NQ];
3367
3370
3372 char budget_basename[LEN];
3373
3376
3378 char csi_basename[LEN];
3379
3381 char csi_kernel[LEN];
3382
3385
3387 char csi_obsfile[LEN];
3388
3391
3394
3397
3399 double csi_z0;
3400
3402 double csi_z1;
3403
3406
3408 double csi_lon0;
3409
3411 double csi_lon1;
3412
3415
3417 double csi_lat0;
3418
3420 double csi_lat1;
3421
3423 int nens;
3424
3426 char ens_basename[LEN];
3427
3430
3432 char grid_basename[LEN];
3433
3435 char grid_kernel[LEN];
3436
3438 char grid_gpfile[LEN];
3439
3442
3445
3448
3450 int grid_nc_quant[NQ];
3451
3454
3457
3459 double grid_z0;
3460
3462 double grid_z1;
3463
3466
3469
3472
3475
3478
3481
3484
3486 char prof_basename[LEN];
3487
3489 char prof_obsfile[LEN];
3490
3493
3495 double prof_z0;
3496
3498 double prof_z1;
3499
3502
3505
3508
3511
3514
3517
3519 char sample_basename[LEN];
3520
3522 char sample_kernel[LEN];
3523
3525 char sample_obsfile[LEN];
3526
3529
3532
3534 char stat_basename[LEN];
3535
3537 double stat_lon;
3538
3540 double stat_lat;
3541
3543 double stat_r;
3544
3546 double stat_t0;
3547
3549 double stat_t1;
3550
3552 char vtk_basename[LEN];
3553
3556
3559
3562
3565
3568
3569 /* ------------------------------------------------------------
3570 Domain decomposition...
3571 ------------------------------------------------------------ */
3572
3577 int dd;
3578
3582
3586
3590
3593
3596
3601
3602} ctl_t;
3603
3612typedef struct {
3613
3615 int np;
3616
3618 double time[NP];
3619
3621 double p[NP];
3622
3624 double lon[NP];
3625
3627 double lat[NP];
3628
3630 double q[NQ][NP];
3631
3632} atm_t;
3633
3642typedef struct {
3643
3645 double time;
3646
3648 double p;
3649
3651 double lon;
3652
3654 double lat;
3655
3657 double dt;
3658
3660 double q[NQ];
3661
3663 float uvwp[3];
3664
3665} particle_t;
3666
3667
3673typedef struct {
3674
3676 double iso_ps[NP];
3677
3679 double iso_ts[NP];
3680
3683
3685 float uvwp[NP][3];
3686
3688 double rs[3 * NP + 1];
3689
3691 double dt[NP];
3692
3693} cache_t;
3694
3706typedef struct {
3707
3709 double Apb210[EX * EY];
3710
3712 double Abe7[EX * EY];
3713
3715 double Acs137[EX * EY];
3716
3718 double Ai131[EX * EY];
3719
3720} depo_t;
3721
3729typedef struct {
3730
3732 int np;
3733
3735 int nsza;
3736
3738 int no3c;
3739
3741 double p[CP];
3742
3744 double sza[CSZA];
3745
3747 double o3c[CO3];
3748
3750 double n2o[CP][CSZA][CO3];
3751
3753 double ccl4[CP][CSZA][CO3];
3754
3756 double ccl3f[CP][CSZA][CO3];
3757
3759 double ccl2f2[CP][CSZA][CO3];
3760
3762 double o2[CP][CSZA][CO3];
3763
3765 double o3_1[CP][CSZA][CO3];
3766
3768 double o3_2[CP][CSZA][CO3];
3769
3771 double h2o2[CP][CSZA][CO3];
3772
3774 double h2o[CP][CSZA][CO3];
3775
3776} clim_photo_t;
3777
3785typedef struct {
3786
3789
3791 double time[CTS];
3792
3794 double vmr[CTS];
3795
3796} clim_ts_t;
3797
3805typedef struct {
3806
3809
3811 int nlat;
3812
3814 int np;
3815
3817 double time[CT];
3818
3820 double lat[CY];
3821
3823 double p[CP];
3824
3826 double vmr[CT][CP][CY];
3827
3828} clim_zm_t;
3829
3837typedef struct {
3838
3841
3844
3846 double tropo_time[12];
3847
3849 double tropo_lat[73];
3850
3852 double tropo[12][73];
3853
3856
3859
3862
3865
3868
3871
3874
3877
3880
3883
3886
3887} clim_t;
3888
3896typedef struct {
3897
3899 double time;
3900
3901 /* Grid type: 0=lat/lon [deg], 1=UTM [m]. */
3903
3905 int nx;
3906
3908 int ny;
3909
3911 int np;
3912
3914 int npl;
3915
3917 double lon[EX];
3918
3920 double lat[EY];
3921
3923 double p[EP];
3924
3926 double hybrid[EP];
3927
3929 double hyam[EP];
3930
3932 double hybm[EP];
3933
3935 double eta[EP];
3936
3938 float ps[EX][EY];
3939
3941 float ts[EX][EY];
3942
3944 float zs[EX][EY];
3945
3947 float us[EX][EY];
3948
3950 float vs[EX][EY];
3951
3953 float ess[EX][EY];
3954
3956 float nss[EX][EY];
3957
3959 float shf[EX][EY];
3960
3962 float lsm[EX][EY];
3963
3965 float sst[EX][EY];
3966
3968 float pbl[EX][EY];
3969
3971 float pt[EX][EY];
3972
3974 float tt[EX][EY];
3975
3977 float zt[EX][EY];
3978
3980 float h2ot[EX][EY];
3981
3983 float pct[EX][EY];
3984
3986 float pcb[EX][EY];
3987
3989 float cl[EX][EY];
3990
3992 float plcl[EX][EY];
3993
3995 float plfc[EX][EY];
3996
3998 float pel[EX][EY];
3999
4001 float cape[EX][EY];
4002
4004 float cin[EX][EY];
4005
4007 float o3c[EX][EY];
4008
4010 float z[EX][EY][EP];
4011
4013 float t[EX][EY][EP];
4014
4016 float u[EX][EY][EP];
4017
4019 float v[EX][EY][EP];
4020
4022 float w[EX][EY][EP];
4023
4025 float pv[EX][EY][EP];
4026
4028 float h2o[EX][EY][EP];
4029
4031 float o3[EX][EY][EP];
4032
4034 float lwc[EX][EY][EP];
4035
4037 float rwc[EX][EY][EP];
4038
4040 float iwc[EX][EY][EP];
4041
4043 float swc[EX][EY][EP];
4044
4046 float cc[EX][EY][EP];
4047
4049 float pl[EX][EY][EP];
4050
4052 float ul[EX][EY][EP];
4053
4055 float vl[EX][EY][EP];
4056
4058 float wl[EX][EY][EP];
4059
4061 float zetal[EX][EY][EP];
4062
4064 float zeta_dotl[EX][EY][EP];
4065
4066} met_t;
4067
4073typedef struct {
4074
4075 /* ------------------------------------------------------------
4076 Global grid...
4077 ------------------------------------------------------------ */
4078
4081
4084
4086 double lon_glob[DD_EX_GLOB];
4087
4089 double lat_glob[DD_EY_GLOB];
4090
4091 /* ------------------------------------------------------------
4092 Subdomains...
4093 ------------------------------------------------------------ */
4094
4096 size_t subdomain_start[4];
4097
4099 size_t subdomain_count[4];
4100
4102 size_t halo_bnd_start[4];
4103
4105 size_t halo_bnd_count[4];
4106
4109
4112
4113 /* ------------------------------------------------------------
4114 Helpers...
4115 ------------------------------------------------------------ */
4116
4117#ifdef DD
4118
4120 MPI_Datatype MPI_Particle;
4121
4123 double sort_key[NP];
4124
4126 int perm[NP];
4127
4129 double tmp[NP];
4130
4131#endif
4132
4133} dd_t;
4134
4135/* ------------------------------------------------------------
4136 Functions...
4137 ------------------------------------------------------------ */
4138
4161 void *data,
4162 size_t N);
4163
4178void cart2geo(
4179 const double *x,
4180 double *z,
4181 double *lon,
4182 double *lat);
4183
4206double clim_oh(
4207 const ctl_t * ctl,
4208 const clim_t * clim,
4209 const double t,
4210 const double lon,
4211 const double lat,
4212 const double p);
4213
4233 const ctl_t * ctl,
4234 clim_t * clim);
4235
4265double clim_photo(
4266 const double rate[CP][CSZA][CO3],
4267 const clim_photo_t * photo,
4268 const double p,
4269 const double sza,
4270 const double o3c);
4271
4297double clim_tropo(
4298 const clim_t * clim,
4299 const double t,
4300 const double lat);
4301
4320void clim_tropo_init(
4321 clim_t * clim);
4322
4339double clim_ts(
4340 const clim_ts_t * ts,
4341 const double t);
4342
4364double clim_zm(
4365 const clim_zm_t * zm,
4366 const double t,
4367 const double lat,
4368 const double p);
4369
4394 FILE * out,
4395 const char *codec,
4396 const char *varname,
4397 const size_t lev,
4398 const double plev,
4399 const double ratio,
4400 const double bpv,
4401 const double t_comp,
4402 const double t_decomp,
4403 const size_t n,
4404 const size_t nbytes,
4405 const float *org,
4406 const float *cmp);
4407
4431 FILE * out,
4432 const char *codec,
4433 const char *varname,
4434 const met_t * met,
4435 const float *org_all,
4436 const float *cmp_all,
4437 const size_t nxy,
4438 const size_t nz,
4439 const double ratio,
4440 const double bpv,
4441 const double t_comp,
4442 const double t_decomp,
4443 const size_t nbytes);
4444
4463 const ctl_t * ctl,
4464 const met_t * met,
4465 const char *varname,
4466 float *array,
4467 const int decompress,
4468 FILE * level_log,
4469 FILE * inout);
4470
4487 float *array,
4488 const size_t nxy,
4489 const size_t nz,
4490 double *off,
4491 double *scl);
4492
4509 float *array,
4510 const size_t nxy,
4511 const size_t nz,
4512 const double *off,
4513 const double *scl);
4514
4532 FILE * in,
4533 const size_t nz,
4534 double **off,
4535 double **scl);
4536
4556 FILE * out,
4557 const int enabled,
4558 float *array,
4559 const size_t nxy,
4560 const size_t nz,
4561 double **off,
4562 double **scl);
4563
4564#ifdef ZSTD
4577ZSTD_CCtx *compress_zstd_create_cctx(
4578 const int level,
4579 const int nworkers);
4580#endif
4581
4594 const char *varname);
4595
4615void compress_pck(
4616 const ctl_t * ctl,
4617 const met_t * met,
4618 const char *varname,
4619 float *array,
4620 const int decompress,
4621 FILE * level_log,
4622 FILE * inout);
4623
4652 const ctl_t * ctl,
4653 const met_t * met,
4654 const char *varname,
4655 float *array,
4656 const int decompress,
4657 FILE * level_log,
4658 FILE * inout);
4659
4697 const ctl_t * ctl,
4698 const met_t * met,
4699 const char *varname,
4700 float *array,
4701 const int decompress,
4702 FILE * level_log,
4703 FILE * inout);
4704
4725 const ctl_t * ctl,
4726 const met_t * met,
4727 const char *varname,
4728 float *array,
4729 const int decompress,
4730 FILE * level_log,
4731 FILE * inout);
4732
4754 const ctl_t * ctl,
4755 const met_t * met,
4756 const char *varname,
4757 float *array,
4758 const int decompress,
4759 FILE * level_log,
4760 FILE * inout);
4761
4786double cos_sza(
4787 const double sec,
4788 const double lon,
4789 const double lat);
4790
4813void day2doy(
4814 const int year,
4815 const int mon,
4816 const int day,
4817 int *doy);
4818
4872 const ctl_t * ctl,
4873 const dd_t * dd,
4874 atm_t * atm,
4875 const int init);
4876
4928void dd_atm2particles(
4929 const ctl_t * ctl,
4930 cache_t * cache,
4931 atm_t * atm,
4932 particle_t * particles,
4933 const int npart);
4934
4973void dd_pack_compact(
4974 const ctl_t * ctl,
4975 cache_t * cache,
4976 atm_t * atm,
4977 dd_t * dd,
4978 particle_t * particles,
4979 const int nkeep,
4980 const int npart);
4981
5011 const ctl_t * ctl,
5012 const dd_t * dd,
5013 const double lon,
5014 const double lat);
5015
5072 const ctl_t * ctl,
5073 const dd_t * dd,
5074 particle_t ** particles,
5075 int *npart,
5076 int *capacity);
5077
5116void dd_init(
5117 const ctl_t * ctl,
5118 dd_t * dd,
5119 atm_t * atm);
5120
5155 const dd_t * dd,
5156 double *lon,
5157 double *lat);
5158
5203void dd_particles2atm(
5204 const ctl_t * ctl,
5205 cache_t * cache,
5206 const particle_t * particles,
5207 const int npart,
5208 atm_t * atm);
5209
5210
5258void dd_push(
5259 const ctl_t * ctl,
5260 atm_t * atm,
5261 cache_t * cache,
5262 int *npart);
5263
5293 const ctl_t * ctl,
5294 const atm_t * atm,
5295 dd_t * dd,
5296 int *nkeep,
5297 int *npart);
5298
5299
5345 dd_t * dd,
5346 const ctl_t * ctl,
5347 met_t * met,
5348 const int ncid);
5349
5411void dd_sort(
5412 const ctl_t * ctl,
5413 const met_t * met0,
5414 cache_t * cache,
5415 atm_t * atm,
5416 dd_t * dd,
5417 int *npart);
5418
5440void doy2day(
5441 const int year,
5442 const int doy,
5443 int *mon,
5444 int *day);
5445
5472void fft_help(
5473 double *fcReal,
5474 double *fcImag,
5475 const int n);
5476
5503void geo2cart(
5504 const double z,
5505 const double lon,
5506 const double lat,
5507 double *x);
5508
5533void get_met_filename(
5534 const ctl_t * ctl,
5535 const double t,
5536 const int direct,
5537 const char *metbase,
5538 const double dt_met,
5539 char *filename);
5540
5564void get_met_replace(
5565 char *orig,
5566 const char *search,
5567 const char *repl);
5568
5605void get_tropo(
5606 const int met_tropo,
5607 ctl_t * ctl,
5608 const clim_t * clim,
5609 met_t * met,
5610 const double *lons,
5611 const int nx,
5612 const double *lats,
5613 const int ny,
5614 double *pt,
5615 double *zt,
5616 double *tt,
5617 double *qt,
5618 double *o3t,
5619 double *ps,
5620 double *zs);
5621
5643 const double *lons,
5644 const int nlon,
5645 const double *lats,
5646 const int nlat,
5647 const double lon,
5648 const double lat,
5649 double *lon2,
5650 double *lat2);
5651
5671 const double *lons,
5672 const int nlon,
5673 const double *lats,
5674 const int nlat,
5675 const double lon,
5676 const double lat,
5677 double *lon2,
5678 double *lat2);
5679
5726 const met_t * met0,
5727 float height0[EX][EY][EP],
5728 float array0[EX][EY][EP],
5729 const met_t * met1,
5730 float height1[EX][EY][EP],
5731 float array1[EX][EY][EP],
5732 const double ts,
5733 const double height,
5734 const double lon,
5735 const double lat,
5736 double *var,
5737 int *ci,
5738 double *cw,
5739 const int init);
5740
5779 const met_t * met,
5780 float array[EX][EY][EP],
5781 const double p,
5782 const double lon,
5783 const double lat,
5784 double *var,
5785 int *ci,
5786 double *cw,
5787 const int init);
5788
5824 const met_t * met,
5825 float array[EX][EY],
5826 const double lon,
5827 const double lat,
5828 double *var,
5829 int *ci,
5830 double *cw,
5831 const int init);
5832
5870 const met_t * met0,
5871 float array0[EX][EY][EP],
5872 const met_t * met1,
5873 float array1[EX][EY][EP],
5874 const double ts,
5875 const double p,
5876 const double lon,
5877 const double lat,
5878 double *var,
5879 int *ci,
5880 double *cw,
5881 const int init);
5882
5922 const met_t * met0,
5923 float array0[EX][EY],
5924 const met_t * met1,
5925 float array1[EX][EY],
5926 const double ts,
5927 const double lon,
5928 const double lat,
5929 double *var,
5930 int *ci,
5931 double *cw,
5932 const int init);
5933
5971void intpol_tropo_3d(
5972 const double time0,
5973 float array0[EX][EY],
5974 const double time1,
5975 float array1[EX][EY],
5976 const double lons[EX],
5977 const double lats[EY],
5978 const int nlon,
5979 const int nlat,
5980 const double time,
5981 const double lon,
5982 const double lat,
5983 const int method,
5984 double *var,
5985 double *sigma);
5986
6013void jsec2time(
6014 const double jsec,
6015 int *year,
6016 int *mon,
6017 int *day,
6018 int *hour,
6019 int *min,
6020 int *sec,
6021 double *remain);
6022
6049double kernel_weight(
6050 const double kz[EP],
6051 const double kw[EP],
6052 const int nk,
6053 const double p);
6054
6093double lapse_rate(
6094 const double t,
6095 const double h2o);
6096
6124 ctl_t * ctl);
6125
6145int locate_irr(
6146 const double *xx,
6147 const int n,
6148 const double x);
6149
6176 const float *xx,
6177 const int n,
6178 const double x,
6179 const int ig);
6180
6201int locate_reg(
6202 const double *xx,
6203 const int n,
6204 const double x);
6205
6227void locate_vert(
6228 float profiles[EX][EY][EP],
6229 const int np,
6230 const int lon_ap_ind,
6231 const int lat_ap_ind,
6232 const double alt_ap,
6233 int *ind);
6234
6260void module_advect(
6261 const ctl_t * ctl,
6262 const cache_t * cache,
6263 met_t * met0,
6264 met_t * met1,
6265 atm_t * atm);
6266
6291 const ctl_t * ctl,
6292 const cache_t * cache,
6293 met_t * met0,
6294 met_t * met1,
6295 atm_t * atm);
6296
6334 const ctl_t * ctl,
6335 const cache_t * cache,
6336 const clim_t * clim,
6337 met_t * met0,
6338 met_t * met1,
6339 atm_t * atm);
6340
6382void module_chem_grid(
6383 const ctl_t * ctl,
6384 met_t * met0,
6385 met_t * met1,
6386 atm_t * atm,
6387 const double t);
6388
6416void module_chem_init(
6417 const ctl_t * ctl,
6418 const cache_t * cache,
6419 const clim_t * clim,
6420 met_t * met0,
6421 met_t * met1,
6422 atm_t * atm);
6423
6443 const ctl_t * ctl,
6444 cache_t * cache,
6445 met_t * met0,
6446 met_t * met1,
6447 atm_t * atm);
6448
6493void module_dd(
6494 double t,
6495 const ctl_t * ctl,
6496 cache_t * cache,
6497 dd_t * dd,
6498 atm_t * atm,
6499 met_t ** met);
6500
6527void module_decay(
6528 const ctl_t * ctl,
6529 const cache_t * cache,
6530 const clim_t * clim,
6531 atm_t * atm);
6532
6569void module_diff_meso(
6570 const ctl_t * ctl,
6571 cache_t * cache,
6572 const met_t * met0,
6573 const met_t * met1,
6574 atm_t * atm);
6575
6609void module_diff_pbl(
6610 const ctl_t * ctl,
6611 cache_t * cache,
6612 met_t * met0,
6613 met_t * met1,
6614 atm_t * atm);
6615
6670void module_diff_turb(
6671 const ctl_t * ctl,
6672 cache_t * cache,
6673 const clim_t * clim,
6674 met_t * met0,
6675 met_t * met1,
6676 atm_t * atm);
6677
6697void module_dry_depo(
6698 const ctl_t * ctl,
6699 const cache_t * cache,
6700 met_t * met0,
6701 met_t * met1,
6702 atm_t * atm);
6703
6736void module_h2o2_chem(
6737 const ctl_t * ctl,
6738 const cache_t * cache,
6739 const clim_t * clim,
6740 met_t * met0,
6741 met_t * met1,
6742 atm_t * atm);
6743
6764 const ctl_t * ctl,
6765 cache_t * cache,
6766 met_t * met0,
6767 met_t * met1,
6768 atm_t * atm);
6769
6787void module_isosurf(
6788 const ctl_t * ctl,
6789 const cache_t * cache,
6790 met_t * met0,
6791 met_t * met1,
6792 atm_t * atm);
6793
6826 ctl_t * ctl,
6827 cache_t * cache,
6828 clim_t * clim,
6829 met_t * met0,
6830 met_t * met1,
6831 atm_t * atm);
6832
6851void module_meteo(
6852 const ctl_t * ctl,
6853 const cache_t * cache,
6854 const clim_t * clim,
6855 met_t * met0,
6856 met_t * met1,
6857 atm_t * atm);
6858
6879void module_mixing(
6880 const ctl_t * ctl,
6881 const cache_t * cache,
6882 const clim_t * clim,
6883 atm_t * atm,
6884 const double t);
6885
6918 const ctl_t * ctl,
6919 atm_t * atm,
6920 const int *ixs,
6921 const int *iys,
6922 const int *izs,
6923 const double *mixparam,
6924 const int qnt_idx,
6925 const int use_ensemble);
6926
6959void module_oh_chem(
6960 const ctl_t * ctl,
6961 const cache_t * cache,
6962 const clim_t * clim,
6963 met_t * met0,
6964 met_t * met1,
6965 atm_t * atm);
6966
6991void module_position(
6992 const cache_t * cache,
6993 met_t * met0,
6994 met_t * met1,
6995 atm_t * atm,
6996 const int reflect);
6997
7019void module_rng_init(
7020 const int ntask);
7021
7047void module_rng(
7048 const ctl_t * ctl,
7049 double *rs,
7050 const size_t n,
7051 const int method);
7052
7088 const ctl_t * ctl,
7089 const cache_t * cache,
7090 atm_t * atm);
7091
7113 const ctl_t * ctl,
7114 const cache_t * cache,
7115 met_t * met0,
7116 met_t * met1,
7117 atm_t * atm,
7118 depo_t * depo);
7119
7142void module_sedi(
7143 const ctl_t * ctl,
7144 const cache_t * cache,
7145 met_t * met0,
7146 met_t * met1,
7147 atm_t * atm);
7148
7169void sort_array(
7170 double *array,
7171 const int *perm,
7172 double *tmp,
7173 const int np);
7174
7193void sort_uvwp(
7194 cache_t * cache,
7195 const int *perm,
7196 double *tmp,
7197 const int np);
7198
7231void module_sort(
7232 const ctl_t * ctl,
7233 const met_t * met0,
7234 cache_t * cache,
7235 atm_t * atm);
7236
7260void module_timesteps(
7261 const ctl_t * ctl,
7262 cache_t * cache,
7263 const met_t * met0,
7264 atm_t * atm,
7265 const double t);
7266
7288 ctl_t * ctl,
7289 const atm_t * atm);
7290
7324 const ctl_t * ctl,
7325 const cache_t * cache,
7326 const clim_t * clim,
7327 met_t * met0,
7328 met_t * met1,
7329 atm_t * atm);
7330
7360void module_wet_depo(
7361 const ctl_t * ctl,
7362 const cache_t * cache,
7363 met_t * met0,
7364 met_t * met1,
7365 atm_t * atm);
7366
7401void mptrac_alloc(
7402 ctl_t ** ctl,
7403 cache_t ** cache,
7404 clim_t ** clim,
7405 met_t ** met0,
7406 met_t ** met1,
7407 atm_t ** atm,
7408 depo_t ** depo,
7409 dd_t ** dd);
7410
7441void mptrac_free(
7442 ctl_t * ctl,
7443 cache_t * cache,
7444 clim_t * clim,
7445 met_t * met0,
7446 met_t * met1,
7447 atm_t * atm,
7448 depo_t * depo,
7449 dd_t * dd);
7450
7486void mptrac_get_met(
7487 ctl_t * ctl,
7488 clim_t * clim,
7489 const double t,
7490 met_t ** met0,
7491 met_t ** met1,
7492 dd_t * dd);
7493
7514void mptrac_init(
7515 ctl_t * ctl,
7516 cache_t * cache,
7517 clim_t * clim,
7518 atm_t * atm,
7519 depo_t * depo,
7520 const int ntask);
7521
7557int mptrac_read_atm(
7558 const char *filename,
7559 const ctl_t * ctl,
7560 atm_t * atm);
7561
7593void mptrac_read_clim(
7594 const ctl_t * ctl,
7595 clim_t * clim);
7596
7626void mptrac_read_ctl(
7627 const char *filename,
7628 int argc,
7629 char *argv[],
7630 ctl_t * ctl);
7631
7662int mptrac_read_met(
7663 const char *filename,
7664 const ctl_t * ctl,
7665 const clim_t * clim,
7666 met_t * met,
7667 dd_t * dd);
7668
7691 ctl_t * ctl,
7692 cache_t * cache,
7693 clim_t * clim,
7694 met_t ** met0,
7695 met_t ** met1,
7696 atm_t * atm,
7697 depo_t * depo,
7698 double t,
7699 dd_t * dd);
7700
7730void mptrac_write_atm(
7731 const char *filename,
7732 const ctl_t * ctl,
7733 const atm_t * atm,
7734 const double t);
7735
7775void mptrac_write_met(
7776 const char *filename,
7777 const ctl_t * ctl,
7778 met_t * met);
7779
7816 const char *dirname,
7817 const ctl_t * ctl,
7818 met_t * met0,
7819 met_t * met1,
7820 atm_t * atm,
7821 depo_t * depo,
7822 const double t);
7823
7855 const ctl_t * ctl,
7856 const cache_t * cache,
7857 const clim_t * clim,
7858 met_t ** met0,
7859 met_t ** met1,
7860 const atm_t * atm);
7861
7892 const ctl_t * ctl,
7893 const cache_t * cache,
7894 const clim_t * clim,
7895 met_t ** met0,
7896 met_t ** met1,
7897 const atm_t * atm);
7898
7926double nat_temperature(
7927 const double p,
7928 const double h2o,
7929 const double hno3);
7930
7953double pbl_weight(
7954 const ctl_t * ctl,
7955 const atm_t * atm,
7956 const int ip,
7957 const double pbl,
7958 const double ps);
7959
7992int read_atm_asc(
7993 const char *filename,
7994 const ctl_t * ctl,
7995 atm_t * atm);
7996
8027int read_atm_bin(
8028 const char *filename,
8029 const ctl_t * ctl,
8030 atm_t * atm);
8031
8056int read_atm_clams(
8057 const char *filename,
8058 const ctl_t * ctl,
8059 atm_t * atm);
8060
8090int read_atm_nc(
8091 const char *filename,
8092 const ctl_t * ctl,
8093 atm_t * atm);
8094
8123void read_clim_photo(
8124 const char *filename,
8125 clim_photo_t * photo);
8126
8144 const int ncid,
8145 const char *varname,
8146 const clim_photo_t * photo,
8147 double var[CP][CSZA][CO3]);
8148
8172int read_clim_ts(
8173 const char *filename,
8174 clim_ts_t * ts);
8175
8202void read_clim_zm(
8203 const char *filename,
8204 const char *varname,
8205 clim_zm_t * zm);
8206
8234void read_kernel(
8235 const char *filename,
8236 double kz[EP],
8237 double kw[EP],
8238 int *nk);
8239
8271int read_met_bin(
8272 const char *filename,
8273 const ctl_t * ctl,
8274 met_t * met);
8275
8301void read_met_bin_2d(
8302 FILE * in,
8303 const met_t * met,
8304 float var[EX][EY],
8305 const char *varname);
8306
8344void read_met_bin_3d(
8345 FILE * in,
8346 const ctl_t * ctl,
8347 const met_t * met,
8348 float var[EX][EY][EP],
8349 const char *varname,
8350 const float bound_min,
8351 const float bound_max);
8352
8380void read_met_cape(
8381 const ctl_t * ctl,
8382 const clim_t * clim,
8383 met_t * met);
8384
8407void read_met_cloud(
8408 met_t * met);
8409
8435void read_met_detrend(
8436 const ctl_t * ctl,
8437 met_t * met);
8438
8462 met_t * met);
8463
8490void read_met_geopot(
8491 const ctl_t * ctl,
8492 met_t * met);
8493
8521 const char *filename,
8522 const ctl_t * ctl,
8523 met_t * met);
8524
8546 codes_handle ** handles,
8547 int count_handles,
8548 met_t * met);
8549
8570 codes_handle ** handles,
8571 const int num_messages,
8572 const ctl_t * ctl,
8573 met_t * met);
8574
8605 codes_handle ** handles,
8606 const int num_messages,
8607 const ctl_t * ctl,
8608 met_t * met);
8609
8638void read_met_ml2pl(
8639 const ctl_t * ctl,
8640 const met_t * met,
8641 float var[EX][EY][EP],
8642 const char *varname);
8643
8666 const ctl_t * ctl,
8667 met_t * met);
8668
8699int read_met_nc(
8700 const char *filename,
8701 const ctl_t * ctl,
8702 met_t * met,
8703 dd_t * dd);
8704
8739void read_met_nc_grid(
8740 const char *filename,
8741 const int ncid,
8742 const ctl_t * ctl,
8743 met_t * met,
8744 dd_t * dd);
8745
8778 const int ncid,
8779 const ctl_t * ctl,
8780 met_t * met,
8781 dd_t * dd);
8782
8814 const int ncid,
8815 const ctl_t * ctl,
8816 met_t * met,
8817 dd_t * dd);
8818
8847int read_met_nc_2d(
8848 const int ncid,
8849 const char *const varnames[],
8850 const size_t nvarnames,
8851 const ctl_t * ctl,
8852 const met_t * met,
8853 dd_t * dd,
8854 float dest[EX][EY],
8855 const float scl,
8856 const int init);
8857
8885int read_met_nc_3d(
8886 const int ncid,
8887 const char *const varnames[],
8888 const size_t nvarnames,
8889 const ctl_t * ctl,
8890 const met_t * met,
8891 dd_t * dd,
8892 float dest[EX][EY][EP],
8893 const float scl);
8894
8940void read_met_pbl(
8941 const ctl_t * ctl,
8942 met_t * met);
8943
8976 met_t * met);
8977
9008 met_t * met);
9009
9040void read_met_pv(
9041 met_t * met);
9042
9065void read_met_ozone(
9066 met_t * met);
9067
9096void read_met_sample(
9097 const ctl_t * ctl,
9098 met_t * met);
9099
9128void read_met_tropo(
9129 const ctl_t * ctl,
9130 const clim_t * clim,
9131 met_t * met);
9132
9164void read_obs(
9165 const char *filename,
9166 const ctl_t * ctl,
9167 double *rt,
9168 double *rz,
9169 double *rlon,
9170 double *rlat,
9171 double *robs,
9172 int *nobs);
9173
9201void read_obs_asc(
9202 const char *filename,
9203 double *rt,
9204 double *rz,
9205 double *rlon,
9206 double *rlat,
9207 double *robs,
9208 int *nobs);
9209
9236void read_obs_nc(
9237 const char *filename,
9238 double *rt,
9239 double *rz,
9240 double *rlon,
9241 double *rlat,
9242 double *robs,
9243 int *nobs);
9244
9278double scan_ctl(
9279 const char *filename,
9280 int argc,
9281 char *argv[],
9282 const char *varname,
9283 const int arridx,
9284 const char *defvalue,
9285 char *value);
9286
9314double sedi(
9315 const double p,
9316 const double T,
9317 const double rp,
9318 const double rhop);
9319
9349void spline(
9350 const double *x,
9351 const double *y,
9352 const int n,
9353 const double *x2,
9354 double *y2,
9355 const int n2,
9356 const int method);
9357
9380float stddev(
9381 const float *data,
9382 const int n);
9383
9408void time2jsec(
9409 const int year,
9410 const int mon,
9411 const int day,
9412 const int hour,
9413 const int min,
9414 const int sec,
9415 const double remain,
9416 double *jsec);
9417
9446void timer(
9447 const char *name,
9448 const char *group,
9449 const int output);
9450
9480double time_from_filename(
9481 const char *filename,
9482 const int offset,
9483 const int with_seconds);
9484
9503double tropo_weight(
9504 const ctl_t * ctl,
9505 const clim_t * clim,
9506 const atm_t * atm,
9507 const int ip);
9508
9531void write_atm_asc(
9532 const char *filename,
9533 const ctl_t * ctl,
9534 const atm_t * atm,
9535 const double t);
9536
9560void write_atm_bin(
9561 const char *filename,
9562 const ctl_t * ctl,
9563 const atm_t * atm);
9564
9588void write_atm_clams(
9589 const char *filename,
9590 const ctl_t * ctl,
9591 const atm_t * atm);
9592
9618 const char *dirname,
9619 const ctl_t * ctl,
9620 const atm_t * atm,
9621 const double t);
9622
9646void write_atm_nc(
9647 const char *filename,
9648 const ctl_t * ctl,
9649 const atm_t * atm);
9650
9667void write_budget(
9668 const char *filename,
9669 const ctl_t * ctl,
9670 const atm_t * atm,
9671 const double t);
9672
9701void write_csi(
9702 const char *filename,
9703 const ctl_t * ctl,
9704 const atm_t * atm,
9705 const double t);
9706
9748 const char *filename,
9749 const ctl_t * ctl,
9750 const atm_t * atm,
9751 const double t);
9752
9780void write_ens(
9781 const char *filename,
9782 const ctl_t * ctl,
9783 const atm_t * atm,
9784 const double t);
9785
9798void write_depo(
9799 const char *filename,
9800 const ctl_t * ctl,
9801 const depo_t * depo,
9802 const double t);
9803
9815void write_depo_asc(
9816 const char *filename,
9817 const ctl_t * ctl,
9818 const double *data,
9819 const double t,
9820 const double *lon,
9821 const double *lat,
9822 const double *area);
9823
9835void write_depo_nc(
9836 const char *filename,
9837 const ctl_t * ctl,
9838 const double *data,
9839 const double t,
9840 const double *lon,
9841 const double *lat,
9842 const double *area);
9843
9882void write_grid(
9883 const char *filename,
9884 const ctl_t * ctl,
9885 met_t * met0,
9886 met_t * met1,
9887 const atm_t * atm,
9888 const double t);
9889
9935void write_grid_asc(
9936 const char *filename,
9937 const ctl_t * ctl,
9938 const double *cd,
9939 double *mean[NQ],
9940 double *sigma[NQ],
9941 const double *vmr_impl,
9942 const double t,
9943 const double *z,
9944 const double *lon,
9945 const double *lat,
9946 const double *area,
9947 const double dz,
9948 const int *np);
9949
9992void write_grid_nc(
9993 const char *filename,
9994 const ctl_t * ctl,
9995 const double *cd,
9996 double *mean[NQ],
9997 double *sigma[NQ],
9998 const double *vmr_impl,
9999 const double t,
10000 const double *z,
10001 const double *lon,
10002 const double *lat,
10003 const double *area,
10004 const double dz,
10005 const int *np);
10006
10036void write_met_bin(
10037 const char *filename,
10038 const ctl_t * ctl,
10039 met_t * met);
10040
10068void write_met_bin_2d(
10069 FILE * out,
10070 met_t * met,
10071 float var[EX][EY],
10072 const char *varname);
10073
10113void write_met_bin_3d(
10114 FILE * out,
10115 const ctl_t * ctl,
10116 met_t * met,
10117 float var[EX][EY][EP],
10118 const char *varname,
10119 const int metvar,
10120 FILE * level_log);
10121
10149void write_met_nc(
10150 const char *filename,
10151 const ctl_t * ctl,
10152 met_t * met);
10153
10176void write_met_nc_2d(
10177 const int ncid,
10178 const char *varname,
10179 met_t * met,
10180 float var[EX][EY],
10181 const float scl);
10182
10206void write_met_nc_3d(
10207 const int ncid,
10208 const char *varname,
10209 met_t * met,
10210 float var[EX][EY][EP],
10211 const float scl);
10212
10243void write_prof(
10244 const char *filename,
10245 const ctl_t * ctl,
10246 met_t * met0,
10247 met_t * met1,
10248 const atm_t * atm,
10249 const double t);
10250
10282void write_sample(
10283 const char *filename,
10284 const ctl_t * ctl,
10285 met_t * met0,
10286 met_t * met1,
10287 const atm_t * atm,
10288 const double t);
10289
10316void write_station(
10317 const char *filename,
10318 const ctl_t * ctl,
10319 atm_t * atm,
10320 const double t);
10321
10350void write_vtk(
10351 const char *filename,
10352 const ctl_t * ctl,
10353 const atm_t * atm,
10354 const double t);
10355
10356/* ------------------------------------------------------------
10357 OpenACC routines...
10358 ------------------------------------------------------------ */
10359
10360#ifdef _OPENACC
10361#pragma acc routine (clim_oh)
10362#pragma acc routine (clim_photo)
10363#pragma acc routine (clim_tropo)
10364#pragma acc routine (clim_ts)
10365#pragma acc routine (clim_zm)
10366#pragma acc routine (cos_sza)
10367#pragma acc routine (dd_calc_subdomain_from_coords)
10368#pragma acc routine (dd_normalize_lon_lat)
10369#pragma acc routine (intpol_check_lon_lat)
10370#pragma acc routine (intpol_met_4d_zeta)
10371#pragma acc routine (intpol_met_space_3d)
10372#pragma acc routine (intpol_met_space_2d)
10373#pragma acc routine (intpol_met_time_3d)
10374#pragma acc routine (intpol_met_time_2d)
10375#pragma acc routine (kernel_weight)
10376#pragma acc routine (lapse_rate)
10377#pragma acc routine (locate_irr)
10378#pragma acc routine (locate_irr_float)
10379#pragma acc routine (locate_reg)
10380#pragma acc routine (locate_vert)
10381#pragma acc routine (nat_temperature)
10382#pragma acc routine (pbl_weight)
10383#pragma acc routine (sedi)
10384#pragma acc routine (stddev)
10385#pragma acc routine (tropo_weight)
10386#endif
10387
10388#endif /* LIBTRAC_H */
void read_met_geopot(const ctl_t *ctl, met_t *met)
Calculates geopotential heights from meteorological data.
Definition mptrac.c:10102
void dd_init(const ctl_t *ctl, dd_t *dd, atm_t *atm)
Initialize the domain decomposition infrastructure.
Definition mptrac.c:2337
#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:14567
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:8693
void day2doy(const int year, const int mon, const int day, int *doy)
Get day of year from date.
Definition mptrac.c:1900
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:10062
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:13876
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:15614
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:12282
void read_met_sample(const ctl_t *ctl, met_t *met)
Downsamples meteorological data based on specified parameters.
Definition mptrac.c:12881
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:10981
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:13228
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:3904
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:5376
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:9166
void read_met_cloud(met_t *met)
Calculates cloud-related variables for each grid point.
Definition mptrac.c:9898
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:4541
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:13401
double cos_sza(const double sec, const double lon, const double lat)
Calculates the cosine of the solar zenith angle.
Definition mptrac.c:1859
#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:3354
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:767
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:9133
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:12472
void read_met_detrend(const ctl_t *ctl, met_t *met)
Detrends meteorological data.
Definition mptrac.c:9955
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:13054
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:13272
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:14638
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:4363
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:3865
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:3884
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:10574
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:988
void read_met_monotonize(const ctl_t *ctl, met_t *met)
Makes zeta and pressure profiles monotone.
Definition mptrac.c:12135
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:2167
#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:9285
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:3088
void read_met_periodic(met_t *met)
Applies periodic boundary conditions to meteorological data along longitudinal axis.
Definition mptrac.c:12609
int compress_metvar_index(const char *varname)
Maps a meteorological variable name to its internal MPTRAC variable index.
Definition mptrac.c:971
void module_timesteps_init(ctl_t *ctl, const atm_t *atm)
Initialize start time and time interval for time-stepping.
Definition mptrac.c:6374
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:14467
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:416
#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:9257
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:12093
double clim_tropo(const clim_t *clim, const double t, const double lat)
Calculates the tropopause pressure based on climatological data.
Definition mptrac.c:215
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:13300
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:9639
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:3801
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:5200
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:6712
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:2657
void level_definitions(ctl_t *ctl)
Defines pressure levels for meteorological data.
Definition mptrac.c:3648
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:3114
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:5502
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:14946
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:8581
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:8806
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:13505
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:3418
#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:2925
void fft_help(double *fcReal, double *fcImag, const int n)
Computes the Fast Fourier Transform (FFT) of a complex sequence.
Definition mptrac.c:2868
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:6483
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:876
double nat_temperature(const double p, const double h2o, const double hno3)
Calculates the nitric acid trihydrate (NAT) temperature.
Definition mptrac.c:8926
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:13437
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:2051
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:1927
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:158
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:9339
#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:6220
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:12220
void timer(const char *name, const char *group, const int output)
Measures and reports elapsed time for named and grouped timers.
Definition mptrac.c:13536
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:13672
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:3291
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:5602
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:4407
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:813
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:9438
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:4087
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:13329
void dd_normalize_lon_lat(const dd_t *dd, double *lon, double *lat)
Normalize geographic coordinates to the global grid convention.
Definition mptrac.c:2417
#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:4060
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:5789
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:5848
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:6790
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:2450
float stddev(const float *data, const int n)
Calculates the standard deviation of a set of data.
Definition mptrac.c:13484
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:3480
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:9668
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:3831
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:15675
void mptrac_read_clim(const ctl_t *ctl, clim_t *clim)
Reads various climatological data and populates the given climatology structure.
Definition mptrac.c:7029
void module_chem_grid(const ctl_t *ctl, 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:4183
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:4580
void write_met_nc(const char *filename, const ctl_t *ctl, met_t *met)
Writes meteorological data to a NetCDF file.
Definition mptrac.c:15432
void module_rng_init(const int ntask)
Initialize random number generators for parallel tasks.
Definition mptrac.c:6078
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:6924
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:6954
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:8637
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:15339
#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:12852
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:2772
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:6622
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:2499
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:911
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:10417
void clim_tropo_init(clim_t *clim)
Initializes the tropopause data in the climatology structure.
Definition mptrac.c:243
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:6112
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:16075
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:13604
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:2000
#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:6248
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:2200
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:2838
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:11319
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:3447
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:15310
void read_met_pv(met_t *met)
Calculates potential vorticity (PV) from meteorological data.
Definition mptrac.c:12732
#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:9014
#define CY
Maximum number of latitudes for climatological data.
Definition mptrac.h:599
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:14086
double clim_ts(const clim_ts_t *ts, const double t)
Interpolates a time series of climatological variables.
Definition mptrac.c:398
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:3571
int read_met_bin(const char *filename, const ctl_t *ctl, met_t *met)
Reads meteorological data from a binary file.
Definition mptrac.c:9479
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:13820
void sort_uvwp(cache_t *cache, const int *perm, double *tmp, const int np)
Reorder particle-specific wind perturbations.
Definition mptrac.c:2537
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:2994
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:4902
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:9070
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:14678
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:6325
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:8269
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:8426
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:16181
#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:6405
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:7089
void read_met_polar_winds(met_t *met)
Applies a fix for polar winds in meteorological data.
Definition mptrac.c:12670
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)
Perform chemical reactions involving H2O2 within cloud particles.
Definition mptrac.c:5115
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:15050
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:8950
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:4657
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:15644
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:5270
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:5705
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:2907
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:10230
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:3018
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:3604
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:4482
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:668
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:856
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:8972
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:3061
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:15910
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:14744
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:5052
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:15180
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:13770
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:9778
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:8757
#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:13646
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:2579
double lapse_rate(const double t, const double h2o)
Calculates the moist adiabatic lapse rate in Kelvin per kilometer.
Definition mptrac.c:3630
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:5906
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:14180
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:14037
Air parcel data.
Definition mptrac.h:3612
int np
Number of air parcels.
Definition mptrac.h:3615
Cache data structure.
Definition mptrac.h:3673
int iso_n
Isosurface balloon number of data points.
Definition mptrac.h:3682
Climatological data in the form of photolysis rates.
Definition mptrac.h:3729
int nsza
Number of solar zenith angles.
Definition mptrac.h:3735
int np
Number of pressure levels.
Definition mptrac.h:3732
int no3c
Number of total ozone columns.
Definition mptrac.h:3738
Climatological data.
Definition mptrac.h:3837
clim_ts_t ccl2f2
CFC-12 time series.
Definition mptrac.h:3879
clim_photo_t photo
Photolysis rates.
Definition mptrac.h:3855
clim_zm_t ho2
HO2 zonal means.
Definition mptrac.h:3867
clim_zm_t hno3
HNO3 zonal means.
Definition mptrac.h:3858
int tropo_ntime
Number of tropopause timesteps.
Definition mptrac.h:3840
clim_ts_t sf6
SF6 time series.
Definition mptrac.h:3885
clim_ts_t ccl4
CFC-10 time series.
Definition mptrac.h:3873
clim_ts_t ccl3f
CFC-11 time series.
Definition mptrac.h:3876
clim_zm_t o1d
O(1D) zonal means.
Definition mptrac.h:3870
clim_zm_t h2o2
H2O2 zonal means.
Definition mptrac.h:3864
int tropo_nlat
Number of tropopause latitudes.
Definition mptrac.h:3843
clim_zm_t oh
OH zonal means.
Definition mptrac.h:3861
clim_ts_t n2o
N2O time series.
Definition mptrac.h:3882
Climatological data in the form of time series.
Definition mptrac.h:3785
int ntime
Number of timesteps.
Definition mptrac.h:3788
Climatological data in the form of zonal means.
Definition mptrac.h:3805
int np
Number of pressure levels.
Definition mptrac.h:3814
int ntime
Number of timesteps.
Definition mptrac.h:3808
int nlat
Number of latitudes.
Definition mptrac.h:3811
Control parameters.
Definition mptrac.h:2514
double met_utm_ref_lon
Reference longitude [deg] for UTM grid.
Definition mptrac.h:2879
double grid_z0
Lower altitude of gridded data [km].
Definition mptrac.h:3459
int qnt_o3
Quantity array index for ozone volume mixing ratio.
Definition mptrac.h:2626
double csi_lat1
Upper latitude of gridded CSI data [deg].
Definition mptrac.h:3420
int qnt_Coh
Quantity array index for OH volume mixing ratio (chemistry code).
Definition mptrac.h:2788
double wet_depo_ic_a
Coefficient A for wet deposition in cloud (exponential form).
Definition mptrac.h:3293
int qnt_eta_d
Quantity array index for diagnosed eta vertical coordinate.
Definition mptrac.h:2743
int qnt_target_subdomain
Quantity array index for destination subdomain in domain decomposition.
Definition mptrac.h:2845
int met_nc_scale
Check netCDF scaling factors (0=no, 1=yes).
Definition mptrac.h:2896
int qnt_pel
Quantity array index for pressure at equilibrium level (EL).
Definition mptrac.h:2659
int csi_nz
Number of altitudes of gridded CSI data.
Definition mptrac.h:3396
double molmass
Molar mass [g/mol].
Definition mptrac.h:3149
int qnt_p
Quantity array index for pressure.
Definition mptrac.h:2605
int qnt_Cccl2f2
Quantity array index for CFC-12 volume mixing ratio (chemistry code).
Definition mptrac.h:2812
int dd_halos_size
Domain decomposition halo size in grid points.
Definition mptrac.h:3589
int mixing_nx
Number of longitudes of mixing grid.
Definition mptrac.h:3212
int met_zstd_nworkers
ZSTD number of worker threads (0=single-threaded, default=4).
Definition mptrac.h:2911
double chemgrid_z1
Upper altitude of chemistry grid [km].
Definition mptrac.h:3236
int qnt_m
Quantity array index for mass.
Definition mptrac.h:2545
int qnt_aoa
Quantity array index for age of air.
Definition mptrac.h:2821
int qnt_rhop
Quantity array index for particle density.
Definition mptrac.h:2554
int qnt_swc
Quantity array index for cloud snow water content.
Definition mptrac.h:2638
double csi_obsmin
Minimum observation index to trigger detection.
Definition mptrac.h:3390
int qnt_pcb
Quantity array index for cloud bottom pressure.
Definition mptrac.h:2647
double bound_dzs
Boundary conditions surface layer depth [km].
Definition mptrac.h:3137
double csi_lon1
Upper longitude of gridded CSI data [deg].
Definition mptrac.h:3411
int qnt_u
Quantity array index for zonal wind.
Definition mptrac.h:2614
double stat_lon
Longitude of station [deg].
Definition mptrac.h:3537
double sort_dt
Time step for sorting of particle data [s].
Definition mptrac.h:3042
double mixing_z1
Upper altitude of mixing grid [km].
Definition mptrac.h:3209
double stat_r
Search radius around station [km].
Definition mptrac.h:3543
double wet_depo_bc_a
Coefficient A for wet deposition below cloud (exponential form).
Definition mptrac.h:3287
int met_zstd_level
ZSTD compression level (from -5 to 22, default=-3).
Definition mptrac.h:2908
double met_utm_ref_lat
Reference latitude [deg] for UTM grid.
Definition mptrac.h:2876
int csi_ny
Number of latitudes of gridded CSI data.
Definition mptrac.h:3414
int vtk_sphere
Spherical projection for VTK data (0=no, 1=yes).
Definition mptrac.h:3567
double chemgrid_z0
Lower altitude of chemistry grid [km].
Definition mptrac.h:3233
double met_pbl_min
Minimum depth of planetary boundary layer [km].
Definition mptrac.h:3010
int qnt_iwc
Quantity array index for cloud ice water content.
Definition mptrac.h:2635
double chemgrid_lat0
Lower latitude of chemistry grid [deg].
Definition mptrac.h:3251
double conv_cape
CAPE threshold for convection module [J/kg].
Definition mptrac.h:3101
int qnt_Co1d
Quantity array index for O(1D) volume mixing ratio (chemistry code).
Definition mptrac.h:2800
int qnt_pw
Quantity array index for partial water vapor pressure.
Definition mptrac.h:2713
double grid_z1
Upper altitude of gridded data [km].
Definition mptrac.h:3462
int direction
Direction flag (1=forward calculation, -1=backward calculation).
Definition mptrac.h:2848
int qnt_Cccl4
Quantity array index for CFC-10 volume mixing ratio (chemistry code).
Definition mptrac.h:2806
int met_dp
Stride for pressure levels.
Definition mptrac.h:2962
double met_dt_out
Time step for sampling of meteo data along trajectories [s].
Definition mptrac.h:3029
int qnt_h2o2
Quantity array index for H2O2 volume mixing ratio (climatology).
Definition mptrac.h:2677
int qnt_vh
Quantity array index for horizontal wind.
Definition mptrac.h:2755
int csi_nx
Number of longitudes of gridded CSI data.
Definition mptrac.h:3405
double csi_lat0
Lower latitude of gridded CSI data [deg].
Definition mptrac.h:3417
double turb_dz_trop
Vertical turbulent diffusion coefficient (troposphere) [m^2/s].
Definition mptrac.h:3080
int met_pbl
Planetary boundary layer data (0=file, 1=z2p, 2=Richardson, 3=theta).
Definition mptrac.h:3007
int qnt_lwc
Quantity array index for cloud liquid water content.
Definition mptrac.h:2629
double turb_mesoz
Vertical scaling factor for mesoscale wind fluctuations.
Definition mptrac.h:3089
int grid_nc_level
zlib compression level of netCDF grid data files (0=off).
Definition mptrac.h:3447
int grid_nx
Number of longitudes of gridded data.
Definition mptrac.h:3465
int atm_type
Type of atmospheric data files (0=ASCII, 1=binary, 2=netCDF, 3=CLaMS_traj, 4=CLaMS_pos).
Definition mptrac.h:3355
double bound_mass
Boundary conditions mass per particle [kg].
Definition mptrac.h:3110
double grid_lat0
Lower latitude of gridded data [deg].
Definition mptrac.h:3477
int qnt_ts
Quantity array index for surface temperature.
Definition mptrac.h:2560
int qnt_loss_rate
Quantity array index for total loss rate.
Definition mptrac.h:2704
int qnt_plfc
Quantity array index for pressure at level of free convection (LCF).
Definition mptrac.h:2656
int qnt_Acs137
Quantity array index for radioactive activity of Cs-137.
Definition mptrac.h:2833
double grid_lon0
Lower longitude of gridded data [deg].
Definition mptrac.h:3468
int qnt_o1d
Quantity array index for O(1D) volume mixing ratio (climatology).
Definition mptrac.h:2683
int met_tropo_spline
Tropopause interpolation method (0=linear, 1=spline).
Definition mptrac.h:3026
int qnt_tvirt
Quantity array index for virtual temperature.
Definition mptrac.h:2749
double dt_met
Time step of meteo data [s].
Definition mptrac.h:2867
double chemgrid_lat1
Upper latitude of chemistry grid [deg].
Definition mptrac.h:3254
int met_geopot_sy
Latitudinal smoothing of geopotential heights.
Definition mptrac.h:2998
double turb_dx_strat
Horizontal turbulent diffusion coefficient (stratosphere) [m^2/s].
Definition mptrac.h:3074
int qnt_vmr
Quantity array index for volume mixing ratio.
Definition mptrac.h:2548
int qnt_lsm
Quantity array index for land-sea mask.
Definition mptrac.h:2581
int qnt_theta
Quantity array index for potential temperature.
Definition mptrac.h:2725
double bound_lat1
Boundary conditions maximum longitude [deg].
Definition mptrac.h:3125
double stat_t1
Stop time for station output [s].
Definition mptrac.h:3549
double turb_dx_trop
Horizontal turbulent diffusion coefficient (troposphere) [m^2/s].
Definition mptrac.h:3071
int grid_type
Type of grid data files (0=ASCII, 1=netCDF).
Definition mptrac.h:3483
double csi_lon0
Lower longitude of gridded CSI data [deg].
Definition mptrac.h:3408
int qnt_pbl
Quantity array index for boundary layer pressure.
Definition mptrac.h:2587
int grid_stddev
Include standard deviations in grid output (0=no, 1=yes).
Definition mptrac.h:3453
int met_nc_read_mode
NetCDF DD input (0=local hyperslabs, 1=global 2-D slices via MPI).
Definition mptrac.h:2899
int qnt_psice
Quantity array index for saturation pressure over ice.
Definition mptrac.h:2710
double chemgrid_lon0
Lower longitude of chemistry grid [deg].
Definition mptrac.h:3242
int bound_pbl
Boundary conditions planetary boundary layer (0=no, 1=yes).
Definition mptrac.h:3143
int qnt_mloss_wet
Quantity array index for total mass loss due to wet deposition.
Definition mptrac.h:2695
int radio_decay
RADIO_DECAY switch for airborne and deposited activity (0=off, 1=on, default: 0).
Definition mptrac.h:3278
int met_geopot_sx
Longitudinal smoothing of geopotential heights.
Definition mptrac.h:2995
int met_sy
Smoothing for latitudes.
Definition mptrac.h:2968
int qnt_ps
Quantity array index for surface pressure.
Definition mptrac.h:2557
int rng_type
Random number generator (0=GSL, 1=Squares, 2=cuRAND).
Definition mptrac.h:3059
int met_pck_zstd
Apply an additional ZSTD compression step to PCK payloads (0=off, 1=on).
Definition mptrac.h:2917
int isosurf
Isosurface parameter (0=none, 1=pressure, 2=density, 3=theta, 4=balloon).
Definition mptrac.h:3046
double bound_p1
Boundary conditions top pressure [hPa].
Definition mptrac.h:3131
int qnt_zs
Quantity array index for surface geopotential height.
Definition mptrac.h:2563
int prof_nz
Number of altitudes of gridded profile data.
Definition mptrac.h:3492
double csi_dt_out
Time step for CSI output [s].
Definition mptrac.h:3384
int met_cape
Convective available potential energy data (0=file, 1=calculate).
Definition mptrac.h:3004
double csi_modmin
Minimum column density to trigger detection [kg/m^2].
Definition mptrac.h:3393
int met_sx
Smoothing for longitudes.
Definition mptrac.h:2965
double chemgrid_lon1
Upper longitude of chemistry grid [deg].
Definition mptrac.h:3245
double depo_dt_out
DEPO_DT_OUT time interval for radioactive deposition output [s] (default: 86400).
Definition mptrac.h:3333
double turb_mesox
Horizontal scaling factor for mesoscale wind fluctuations.
Definition mptrac.h:3086
double prof_z0
Lower altitude of gridded profile data [km].
Definition mptrac.h:3495
int qnt_w
Quantity array index for vertical velocity.
Definition mptrac.h:2620
double bound_vmr
Boundary conditions volume mixing ratio [ppv].
Definition mptrac.h:3116
double met_tropo_pv
Dynamical tropopause potential vorticity threshold [PVU].
Definition mptrac.h:3020
int prof_nx
Number of longitudes of gridded profile data.
Definition mptrac.h:3501
int qnt_stat
Quantity array index for station flag.
Definition mptrac.h:2542
int dd_supported
Whether the executable implements the domain decomposition.
Definition mptrac.h:3600
double dd_sort_dt
Sorting time interval for the compactification (DD_EXCHANGE_MODE=0).
Definition mptrac.h:3592
int met_tropo
Tropopause definition (0=none, 1=clim, 2=cold point, 3=WMO_1st, 4=WMO_2nd, 5=dynamical).
Definition mptrac.h:3017
int qnt_rp
Quantity array index for particle radius.
Definition mptrac.h:2551
int met_mpi_share
Use MPI to share meteo (0=no, 1=yes).
Definition mptrac.h:3035
int qnt_vz
Quantity array index for vertical velocity.
Definition mptrac.h:2758
int qnt_ho2
Quantity array index for HO2 volume mixing ratio (climatology).
Definition mptrac.h:2680
double csi_z1
Upper altitude of gridded CSI data [km].
Definition mptrac.h:3402
double stat_t0
Start time for station output [s].
Definition mptrac.h:3546
double oh_chem_beta
Beta parameter for diurnal variability of OH.
Definition mptrac.h:3263
int dd
Domain decomposition (0=no, 1=yes).
Definition mptrac.h:3577
int qnt_eta
Quantity array index for eta vertical coordinate.
Definition mptrac.h:2740
double wet_depo_so2_ph
pH value used to calculate effective Henry constant of SO2.
Definition mptrac.h:3305
double mixing_z0
Lower altitude of mixing grid [km].
Definition mptrac.h:3206
int qnt_mloss_decay
Quantity array index for total mass loss due to exponential decay.
Definition mptrac.h:2701
int atm_type_out
Type of atmospheric data files for output (-1=same as ATM_TYPE, 0=ASCII, 1=binary,...
Definition mptrac.h:3360
int met_cms_nd0x
cmultiscale number of cells of coarsest grid in x-direction.
Definition mptrac.h:2944
int met_nlev
Number of meteo data model levels.
Definition mptrac.h:2986
double dt_kpp
Time step for KPP chemistry [s].
Definition mptrac.h:3272
double dry_depo_dp
Dry deposition surface layer [hPa].
Definition mptrac.h:3314
int qnt_shf
Quantity array index for surface sensible heat flux.
Definition mptrac.h:2578
int qnt_vs
Quantity array index for surface meridional wind.
Definition mptrac.h:2569
int qnt_Cco
Quantity array index for CO volume mixing ratio (chemistry code).
Definition mptrac.h:2785
double vtk_dt_out
Time step for VTK data output [s].
Definition mptrac.h:3555
double t_stop
Stop time of simulation [s].
Definition mptrac.h:2854
double conv_dt
Time interval for convection module [s].
Definition mptrac.h:3107
int qnt_hno3
Quantity array index for HNO3 volume mixing ratio (climatology).
Definition mptrac.h:2671
int met_clams
Read MPTRAC or CLaMS meteo data (0=MPTRAC, 1=CLaMS).
Definition mptrac.h:2893
int qnt_h2ot
Quantity array index for tropopause water vapor volume mixing ratio.
Definition mptrac.h:2599
int qnt_rh
Quantity array index for relative humidity over water.
Definition mptrac.h:2719
int met_gp2z
Convert surface geopotential to geopotential height (0=no, 1=yes).
Definition mptrac.h:2886
double bound_lat0
Boundary conditions minimum longitude [deg].
Definition mptrac.h:3122
double met_pbl_max
Maximum depth of planetary boundary layer [km].
Definition mptrac.h:3013
int met_dx
Stride for longitudes.
Definition mptrac.h:2956
int mixing_ny
Number of latitudes of mixing grid.
Definition mptrac.h:3221
int met_convention
Meteo data layout (0=[lev, lat, lon], 1=[lon, lat, lev]).
Definition mptrac.h:2870
int qnt_zeta_d
Quantity array index for diagnosed zeta vertical coordinate.
Definition mptrac.h:2734
int tracer_chem
Switch for first order tracer chemistry module (0=off, 1=on).
Definition mptrac.h:3275
double dt_mod
Time step of simulation [s].
Definition mptrac.h:2857
int diffusion
Diffusion switch (0=off, 1=on).
Definition mptrac.h:3062
int qnt_tnat
Quantity array index for T_NAT.
Definition mptrac.h:2773
int qnt_eta_dot
Quantity array index for velocity of eta vertical coordinate.
Definition mptrac.h:2746
int qnt_tice
Quantity array index for T_ice.
Definition mptrac.h:2767
int turb_pbl_scheme
PBL turbulence scheme (0=none, 1=closure).
Definition mptrac.h:3065
double budget_dt_out
Time step for mass budget output [s].
Definition mptrac.h:3375
int qnt_zg
Quantity array index for geopotential height.
Definition mptrac.h:2602
double vtk_offset
Vertical offset for VTK data [km].
Definition mptrac.h:3564
int qnt_v
Quantity array index for meridional wind.
Definition mptrac.h:2617
int qnt_mloss_dry
Quantity array index for total mass loss due to dry deposition.
Definition mptrac.h:2698
double bound_vmr_trend
Boundary conditions volume mixing ratio trend [ppv/s].
Definition mptrac.h:3119
int met_cache
Preload meteo data into disk cache (0=no, 1=yes).
Definition mptrac.h:3032
int qnt_oh
Quantity array index for OH volume mixing ratio (climatology).
Definition mptrac.h:2674
int qnt_Ch
Quantity array index for H volume mixing ratio (chemistry code).
Definition mptrac.h:2791
int met_press_level_def
Use predefined pressure levels or not.
Definition mptrac.h:2983
int oh_chem_reaction
Reaction type for OH chemistry (0=none, 2=bimolecular, 3=termolecular).
Definition mptrac.h:3257
int qnt_h2o
Quantity array index for water vapor volume mixing ratio.
Definition mptrac.h:2623
int prof_ny
Number of latitudes of gridded profile data.
Definition mptrac.h:3510
int qnt_rhice
Quantity array index for relative humidity over ice.
Definition mptrac.h:2722
int qnt_rho
Quantity array index for density of air.
Definition mptrac.h:2611
double sample_dz
Layer depth for sample output [km].
Definition mptrac.h:3531
double tdec_strat
Life time of particles in the stratosphere [s].
Definition mptrac.h:3155
int obs_type
Type of observation data files (0=ASCII, 1=netCDF).
Definition mptrac.h:3369
int qnt_us
Quantity array index for surface zonal wind.
Definition mptrac.h:2566
double grid_lon1
Upper longitude of gridded data [deg].
Definition mptrac.h:3471
int qnt_Cn2o
Quantity array index for N2O volume mixing ratio (chemistry code).
Definition mptrac.h:2815
int qnt_Cccl3f
Quantity array index for CFC-11 volume mixing ratio (chemistry code).
Definition mptrac.h:2809
int depo_type
DEPO_TYPE of deposition files (0=ASCII, 1=netCDF, default: 0).
Definition mptrac.h:3336
double mixing_lat0
Lower latitude of mixing grid [deg].
Definition mptrac.h:3224
int nens
Number of ensembles.
Definition mptrac.h:3423
int qnt_pt
Quantity array index for tropopause pressure.
Definition mptrac.h:2590
int qnt_cl
Quantity array index for total column cloud water.
Definition mptrac.h:2650
int advect
Advection scheme (1=Euler, 2=midpoint).
Definition mptrac.h:3052
double prof_z1
Upper altitude of gridded profile data [km].
Definition mptrac.h:3498
int qnt_t
Quantity array index for temperature.
Definition mptrac.h:2608
int atm_filter
Time filter for atmospheric data output (0=none, 1=missval, 2=remove).
Definition mptrac.h:3348
int kpp_chem
Switch for KPP chemistry module (0=off, 1=on).
Definition mptrac.h:3269
int qnt_zeta
Quantity array index for zeta vertical coordinate.
Definition mptrac.h:2731
double conv_pbl_trans
Depth of PBL transition layer (fraction of PBL pressure thickness).
Definition mptrac.h:3098
int met_lz4_accel
LZ4 acceleration factor (>=1, default=8).
Definition mptrac.h:2914
int qnt_Ai131
Quantity array index for radioactive activity of I-131.
Definition mptrac.h:2836
double mixing_tau_trop
E-folding time for interparcel mixing in the troposphere [s].
Definition mptrac.h:3197
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:2883
double csi_z0
Lower altitude of gridded CSI data [km].
Definition mptrac.h:3399
int qnt_lapse
Quantity array index for lapse rate.
Definition mptrac.h:2752
int qnt_Apb210
Quantity array index for radioactive activity of Pb-210.
Definition mptrac.h:2827
double stat_lat
Latitude of station [deg].
Definition mptrac.h:3540
int qnt_Cho2
Quantity array index for HO2 volume mixing ratio (chemistry code).
Definition mptrac.h:2794
int grid_ny
Number of latitudes of gridded data.
Definition mptrac.h:3474
int qnt_Csf6
Quantity array index for SF6 volume mixing ratio (chemistry code).
Definition mptrac.h:2818
int qnt_Ch2o
Quantity array index for H2O volume mixing ratio (chemistry code).
Definition mptrac.h:2779
double met_detrend
FWHM of horizontal Gaussian used for detrending [km].
Definition mptrac.h:2974
int conv_mix_pbl
Vertical mixing in the PBL (0=off, 1=on).
Definition mptrac.h:3095
double bound_dps
Boundary conditions surface layer depth [hPa].
Definition mptrac.h:3134
int chemgrid_nz
Number of altitudes of chemistry grid.
Definition mptrac.h:3230
int qnt_cape
Quantity array index for convective available potential energy (CAPE).
Definition mptrac.h:2662
int qnt_zeta_dot
Quantity array index for velocity of zeta vertical coordinate.
Definition mptrac.h:2737
double bound_mass_trend
Boundary conditions mass per particle trend [kg/s].
Definition mptrac.h:3113
int met_cms_nd0y
cmultiscale number of cells of coarsest grid in y-direction.
Definition mptrac.h:2947
int mixing_nz
Number of altitudes of mixing grid.
Definition mptrac.h:3203
int qnt_o3c
Quantity array index for total column ozone.
Definition mptrac.h:2668
double bound_p0
Boundary conditions bottom pressure [hPa].
Definition mptrac.h:3128
double mixing_lon0
Lower longitude of mixing grid [deg].
Definition mptrac.h:3215
int qnt_Co3
Quantity array index for O3 volume mixing ratio (chemistry code).
Definition mptrac.h:2782
int qnt_tsts
Quantity array index for T_STS.
Definition mptrac.h:2770
int grid_nz
Number of altitudes of gridded data.
Definition mptrac.h:3456
int qnt_nss
Quantity array index for northward turbulent surface stress.
Definition mptrac.h:2575
double ens_dt_out
Time step for ensemble output [s].
Definition mptrac.h:3429
int atm_stride
Particle index stride for atmospheric data files.
Definition mptrac.h:3351
int met_relhum
Try to read relative humidity (0=no, 1=yes).
Definition mptrac.h:3001
double mixing_lat1
Upper latitude of mixing grid [deg].
Definition mptrac.h:3227
double atm_dt_out
Time step for atmospheric data output [s].
Definition mptrac.h:3345
double prof_lat1
Upper latitude of gridded profile data [deg].
Definition mptrac.h:3516
int qnt_current_subdomain
Quantity array index for current subdomain in domain decomposition.
Definition mptrac.h:2842
int met_cms_batch
cmultiscale batch size.
Definition mptrac.h:2938
double psc_h2o
H2O volume mixing ratio for PSC analysis.
Definition mptrac.h:3320
int met_sp
Smoothing for pressure levels.
Definition mptrac.h:2971
double prof_lon0
Lower longitude of gridded profile data [deg].
Definition mptrac.h:3504
int qnt_Axe133
Quantity array index for radioactive activity of Xe-133.
Definition mptrac.h:2839
int chemgrid_nx
Number of longitudes of chemistry grid.
Definition mptrac.h:3239
int qnt_pct
Quantity array index for cloud top pressure.
Definition mptrac.h:2644
int qnt_mloss_kpp
Quantity array index for total mass loss due to KPP chemistry.
Definition mptrac.h:2692
int qnt_psat
Quantity array index for saturation pressure over water.
Definition mptrac.h:2707
double prof_lat0
Lower latitude of gridded profile data [deg].
Definition mptrac.h:3513
int qnt_cin
Quantity array index for convective inhibition (CIN).
Definition mptrac.h:2665
double turb_pbl_trans
Depth of turbulent PBL transition layer (fraction of PBL pressure thickness).
Definition mptrac.h:3092
double psc_hno3
HNO3 volume mixing ratio for PSC analysis.
Definition mptrac.h:3323
double prof_lon1
Upper longitude of gridded profile data [deg].
Definition mptrac.h:3507
int met_nc_quant
Number of digits for quantization of netCDF meteo files (0=off).
Definition mptrac.h:2905
int h2o2_chem_reaction
Reaction type for H2O2 chemistry (0=none, 1=SO2).
Definition mptrac.h:3266
int qnt_Co3p
Quantity array index for O(3P) volume mixing ratio (chemistry code).
Definition mptrac.h:2803
double wet_depo_bc_ret_ratio
Coefficients for wet deposition below cloud: retention ratio.
Definition mptrac.h:3311
int chemgrid_ny
Number of latitudes of chemistry grid.
Definition mptrac.h:3248
int qnt_Abe7
Quantity array index for radioactive activity of Be-7.
Definition mptrac.h:2830
int met_cms_zstd
cmultiscale ZSTD compression (0=off, 1=on).
Definition mptrac.h:2941
int met_cms_maxlev
cmultiscale maximum refinement level.
Definition mptrac.h:2950
int grid_sparse
Sparse output in grid data files (0=no, 1=yes).
Definition mptrac.h:3444
double dry_depo_vdep
Dry deposition velocity [m/s].
Definition mptrac.h:3317
int qnt_tt
Quantity array index for tropopause temperature.
Definition mptrac.h:2593
int met_np
Number of target pressure levels.
Definition mptrac.h:2977
int qnt_ens
Quantity array index for ensemble IDs.
Definition mptrac.h:2539
int met_nc_level
zlib compression level of netCDF meteo files (0=off).
Definition mptrac.h:2902
double mixing_dt
Time interval for mixing [s].
Definition mptrac.h:3194
double mixing_tau_strat
E-folding time for interparcel mixing in the stratosphere [s].
Definition mptrac.h:3200
int qnt_Arn222
Quantity array index for radioactive activity of Rn-222.
Definition mptrac.h:2824
int qnt_mloss_h2o2
Quantity array index for total mass loss due to H2O2 chemistry.
Definition mptrac.h:2689
double vtk_scale
Vertical scaling factor for VTK data.
Definition mptrac.h:3561
double turb_dx_pbl
Horizontal turbulent diffusion coefficient (PBL) [m^2/s].
Definition mptrac.h:3068
int dd_exchange_mode
Particle exchange: 0=sort/push (default), 1=direct pack/compact.
Definition mptrac.h:3595
double conv_cin
CIN threshold for convection module [J/kg].
Definition mptrac.h:3104
int qnt_pv
Quantity array index for potential vorticity.
Definition mptrac.h:2761
int advect_vert_coord
Vertical velocity of air parcels (0=omega_on_plev, 1=zetadot_on_mlev, 2=omega_on_mlev,...
Definition mptrac.h:3056
int qnt_mloss_oh
Quantity array index for total mass loss due to OH chemistry.
Definition mptrac.h:2686
int qnt_Ch2o2
Quantity array index for H2O2 volume mixing ratio (chemistry code).
Definition mptrac.h:2797
int qnt_sst
Quantity array index for sea surface temperature.
Definition mptrac.h:2584
double mixing_lon1
Upper longitude of mixing grid [deg].
Definition mptrac.h:3218
int atm_nc_level
zlib compression level of netCDF atmospheric data files (0=off).
Definition mptrac.h:3363
double wet_depo_ic_ret_ratio
Coefficients for wet deposition in cloud: retention ratio.
Definition mptrac.h:3308
int qnt_sh
Quantity array index for specific humidity.
Definition mptrac.h:2716
int met_coord_type
Type of coordinates for meteo data (-1=detect, 0=lat/lon [deg], 1=UTM [m]).
Definition mptrac.h:2873
int qnt_ess
Quantity array index for eastward turbulent surface stress.
Definition mptrac.h:2572
double wet_depo_ic_b
Coefficient B for wet deposition in cloud (exponential form).
Definition mptrac.h:3296
double wet_depo_bc_b
Coefficient B for wet deposition below cloud (exponential form).
Definition mptrac.h:3290
int met_dy
Stride for latitudes.
Definition mptrac.h:2959
int qnt_Cx
Quantity array index for trace species x volume mixing ratio (chemistry code).
Definition mptrac.h:2776
double turb_dz_strat
Vertical turbulent diffusion coefficient (stratosphere) [m^2/s].
Definition mptrac.h:3083
double bound_zetas
Boundary conditions surface layer zeta [K].
Definition mptrac.h:3140
int radio_depo
RADIO_DEPO switch for radionuclide deposition (0=off, 1=on, default: 0).
Definition mptrac.h:3281
int dd_subdomains_zonal
Domain decomposition zonal subdomain number (defaults to 2 if domain decomposition is used,...
Definition mptrac.h:3581
int qnt_idx
Quantity array index for air parcel IDs.
Definition mptrac.h:2536
double met_tropo_theta
Dynamical tropopause potential temperature threshold [K].
Definition mptrac.h:3023
int qnt_rwc
Quantity array index for cloud rain water content.
Definition mptrac.h:2632
double t_start
Start time of simulation [s].
Definition mptrac.h:2851
int nq
Number of quantities.
Definition mptrac.h:2521
double tdec_trop
Life time of particles in the troposphere [s].
Definition mptrac.h:3152
double sample_dx
Horizontal radius for sample output [km].
Definition mptrac.h:3528
int vtk_stride
Particle index stride for VTK data.
Definition mptrac.h:3558
double turb_dz_pbl
Vertical turbulent diffusion coefficient (PBL) [m^2/s].
Definition mptrac.h:3077
double grid_lat1
Upper latitude of gridded data [deg].
Definition mptrac.h:3480
int dd_subdomains_meridional
Domain decomposition meridional subdomain number (defaults to 2 if domain decomposition is used,...
Definition mptrac.h:3585
int qnt_zt
Quantity array index for tropopause geopotential height.
Definition mptrac.h:2596
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:2890
int qnt_iso_var
Quantity array index for isosurface reference (units depend on ISOSURF).
Definition mptrac.h:2728
int qnt_cc
Quantity array index for cloud cover.
Definition mptrac.h:2641
int qnt_plcl
Quantity array index for pressure at lifted condensation level (LCL).
Definition mptrac.h:2653
double grid_dt_out
Time step for gridded data output [s].
Definition mptrac.h:3441
int qnt_tdew
Quantity array index for dew point temperature.
Definition mptrac.h:2764
Domain decomposition data structure.
Definition mptrac.h:4073
int halo_offset_end
Offset of the periodic halo block at the end of the local x-array.
Definition mptrac.h:4111
int nx_glob
Number of global longitudes.
Definition mptrac.h:4080
int halo_offset_start
Offset of the periodic halo block at the beginning of the local x-array.
Definition mptrac.h:4108
MPI_Datatype MPI_Particle
MPI datatype for particle exchange.
Definition mptrac.h:4120
int ny_glob
Number of global latitudes.
Definition mptrac.h:4083
Ground inventories of deposited radionuclides.
Definition mptrac.h:3706
Meteo data structure.
Definition mptrac.h:3896
int coord_type
Definition mptrac.h:3902
int nx
Number of longitudes.
Definition mptrac.h:3905
int ny
Number of latitudes.
Definition mptrac.h:3908
int np
Number of pressure levels.
Definition mptrac.h:3911
int npl
Number of model levels.
Definition mptrac.h:3914
double time
Time [s].
Definition mptrac.h:3899
Particle data.
Definition mptrac.h:3642
double p
Pressure [hPa].
Definition mptrac.h:3648
double lat
Latitude [deg].
Definition mptrac.h:3654
double time
Time [s].
Definition mptrac.h:3645
double lon
Longitude [deg].
Definition mptrac.h:3651
double dt
Individual time step [s].
Definition mptrac.h:3657