174#include <gsl/gsl_fft_complex.h>
175#include <gsl/gsl_math.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>
196#include <netcdf_par.h>
208#include "thrustsort.h"
224#include "SZ3c/sz3c.h"
228#include "cmultiscale.h"
232#include "chem_Parameters.h"
233#include "chem_Global.h"
234#include "chem_Sparse.h"
241#define codes_handle void*
250#define AVO 6.02214076e23
260#define EPS (MH2O / MA)
285#define KB 1.3806504e-23
310#define RA (1e3 * RI / MA)
330#define OMEGA_EARTH 7.2921e-5
335#define DOBSON_UNIT 2.1415e-5
339#ifndef M_AIR_MOLECULE
340#define M_AIR_MOLECULE 4.8096e-26
345#define CHEM_REF_TEMP 298.15
349#ifndef H2O2_SO2_RATE_REF
350#define H2O2_SO2_RATE_REF 9.1e7
354#ifndef H2O2_SO2_RATE_TEMP
355#define H2O2_SO2_RATE_TEMP 29700.
360#define SO2_HENRY_REF 1.3e-2
364#ifndef SO2_HENRY_TEMP
365#define SO2_HENRY_TEMP 2900.
369#ifndef H2O2_HENRY_REF
370#define H2O2_HENRY_REF 8.3e2
374#ifndef H2O2_HENRY_TEMP
375#define H2O2_HENRY_TEMP 7600.
380#define SO2_CORR_A 3.12541941e-06
385#define SO2_CORR_B -5.72532259e-01
389#ifndef O1D_RATE_CCL4_A
390#define O1D_RATE_CCL4_A 3.30e-10
394#ifndef O1D_RATE_CCL4_B
395#define O1D_RATE_CCL4_B 0.
399#ifndef O1D_RATE_CFC11_A
400#define O1D_RATE_CFC11_A 2.30e-10
404#ifndef O1D_RATE_CFC11_B
405#define O1D_RATE_CFC11_B 0.
409#ifndef O1D_RATE_CFC12_A
410#define O1D_RATE_CFC12_A 1.40e-10
414#ifndef O1D_RATE_CFC12_B
415#define O1D_RATE_CFC12_B -25.
419#ifndef O1D_RATE_N2O_A
420#define O1D_RATE_N2O_A 1.19e-10
424#ifndef O1D_RATE_N2O_B
425#define O1D_RATE_N2O_B -20.
429#ifndef SO2_DISS_K1_REF
430#define SO2_DISS_K1_REF 1.23e-2
434#ifndef SO2_DISS_K1_TEMP
435#define SO2_DISS_K1_TEMP 2.01e3
439#ifndef SO2_DISS_K2_REF
440#define SO2_DISS_K2_REF 6e-8
444#ifndef SO2_DISS_K2_TEMP
445#define SO2_DISS_K2_TEMP 1.12e3
449#ifndef WET_DEPO_T_LIQUID
450#define WET_DEPO_T_LIQUID T0
454#ifndef WET_DEPO_T_ICE
455#define WET_DEPO_T_ICE 238.15
459#ifndef WET_DEPO_T_LIQUID_BC
460#define WET_DEPO_T_LIQUID_BC 270.
464#ifndef RADIO_HALF_LIFE_RN222
465#define RADIO_HALF_LIFE_RN222 (3.8235 * 86400.0)
469#ifndef RADIO_HALF_LIFE_PB210
470#define RADIO_HALF_LIFE_PB210 (22.3 * 365.25 * 86400.0)
474#ifndef RADIO_HALF_LIFE_BE7
475#define RADIO_HALF_LIFE_BE7 (53.22 * 86400.0)
479#ifndef RADIO_HALF_LIFE_CS137
480#define RADIO_HALF_LIFE_CS137 (30.05 * 365.25 * 86400.0)
484#ifndef RADIO_HALF_LIFE_I131
485#define RADIO_HALF_LIFE_I131 (8.02 * 86400.0)
489#ifndef RADIO_HALF_LIFE_XE133
490#define RADIO_HALF_LIFE_XE133 (5.2474 * 86400.0)
494#ifndef RADIO_DRY_VDEP_PB210
495#define RADIO_DRY_VDEP_PB210 0.002
499#ifndef RADIO_DRY_VDEP_BE7
500#define RADIO_DRY_VDEP_BE7 0.001
504#ifndef RADIO_DRY_VDEP_CS137
505#define RADIO_DRY_VDEP_CS137 0.002
509#ifndef RADIO_DRY_VDEP_I131
510#define RADIO_DRY_VDEP_I131 0.0005
514#ifndef RADIO_WET_COEFF_PB210
515#define RADIO_WET_COEFF_PB210 1e-4
519#ifndef RADIO_WET_COEFF_BE7
520#define RADIO_WET_COEFF_BE7 5e-5
524#ifndef RADIO_WET_COEFF_CS137
525#define RADIO_WET_COEFF_CS137 1e-4
529#ifndef RADIO_WET_COEFF_I131
530#define RADIO_WET_COEFF_I131 5e-5
629#define DD_EX_GLOB (EX * 16)
634#define DD_EY_GLOB (EY * 16)
661#define ALLOC(ptr, type, n) \
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!");
667#define ALLOC(ptr, type, n) \
668 if((ptr=calloc((size_t)(n), sizeof(type)))==NULL) \
669 ERRMSG("Out of memory!");
690#define ARRAY_2D(ix, iy, ny) \
709#define ARRAY_3D(ix, iy, ny, iz, nz) \
710 (((ix)*(ny) + (iy)) * (nz) + (iz))
734#define ARRHENIUS(a, b, t) \
735 ((a) * exp( -(b) / (t)))
756#define CLAMP(v, lo, hi) \
757 (((v) < (lo)) ? (lo) : (((v) > (hi)) ? (hi) : (v)))
771#define COMPRESS_SPEED(nbytes, dt) \
772 ((dt) > 0 ? ((double)(nbytes)) / ((dt) * 1024. * 1024.) : NAN)
783#define COMPRESS_RATIO(raw_size, stored_size) \
784 ((double) (raw_size) / (double) (stored_size))
795#define COMPRESS_BPV(n, stored_size) \
796 ((8.0 * (double) (stored_size)) / (double) (n))
819#define DEG2DX(dlon, lat) \
820 (RE * DEG2RAD(dlon) * cos(DEG2RAD(lat)))
840#define DEG2DY(dlat) \
857#define DEG2RAD(deg) \
858 ((deg) * (M_PI / 180.0))
882#define DP2DZ(dp, p) \
904#define DX2DEG(dx, lat) \
905 (((lat) < -89.999 || (lat) > 89.999) ? 0 \
906 : (dx) * 180. / (M_PI * RE * cos(DEG2RAD(lat))))
923 ((dy) * 180. / (M_PI * RE))
941#define DZ2DP(dz, p) \
966#define DX2COORD(met, dx, lat) (((met)->coord_type == 0)? DX2DEG((dx) / 1000.0, (lat)) : ((dx) ))
989#define DY2COORD(met, dy) (((met)->coord_type == 0)? DY2DEG((dy) / 1000.0) : ((dy) ))
1020#define DIST2(a, b) \
1021 ((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])+(a[2]-b[2])*(a[2]-b[2]))
1037 (a[0]*b[0]+a[1]*b[1]+a[2]*b[2])
1051 int ecc_result=(cmd); \
1053 ERRMSG("ECCODES error: %s", codes_get_error_message(ecc_result)); \
1069#define ECC_READ_2D(variable, target, scaling_factor, found_flag) { \
1070 if(strcmp(short_name, variable) == 0) { \
1071 if ((found_flag) == 0) \
1072 LOG(2, "Read 2-D variable: %s (GRIB)", variable); \
1073 for (int ix = 0; ix < met->nx; ix++) \
1074 for (int iy = 0; iy < met->ny; iy++) \
1075 target[ix][iy] = (float)(values[iy * met->nx + ix] * scaling_factor); \
1094#define ECC_READ_3D(variable, level, target, scaling_factor, found_flag) { \
1095 if(strcmp(short_name, variable) == 0) { \
1096 if ((found_flag) == 0) \
1097 LOG(2, "Read 3-D variable: %s (GRIB)", variable); \
1098 for (int ix = 0; ix < met->nx; ix++) \
1099 for (int iy = 0; iy < met->ny; iy++) \
1100 target[ix][iy][level] = (float) (values[iy * met->nx + ix] * scaling_factor); \
1122 ((x) - (int) ((x) / (y)) * (y))
1139#define FREAD(ptr, type, size, in) { \
1140 if(fread(ptr, sizeof(type), size, in)!=size) \
1141 ERRMSG("Error while reading!"); \
1159#define FWRITE(ptr, type, size, out) { \
1160 if(fwrite(ptr, sizeof(type), size, out)!=size) \
1161 ERRMSG("Error while writing!"); \
1174#define INTPOL_INIT \
1175 double cw[4] = {0.0, 0.0, 0.0, 0.0}; int ci[3] = {0, 0, 0};
1188#define INTPOL_2D(var, init) \
1189 intpol_met_time_2d(met0, met0->var, met1, met1->var, \
1190 atm->time[ip], atm->lon[ip], atm->lat[ip], \
1191 &var, ci, cw, init);
1205#define INTPOL_3D(var, init) \
1206 intpol_met_time_3d(met0, met0->var, met1, met1->var, \
1207 atm->time[ip], atm->p[ip], \
1208 atm->lon[ip], atm->lat[ip], \
1209 &var, ci, cw, init);
1224#define INTPOL_SPACE_ALL(p, lon, lat) { \
1225 intpol_met_space_3d(met, met->z, p, lon, lat, &z, ci, cw, 1); \
1226 intpol_met_space_3d(met, met->t, p, lon, lat, &t, ci, cw, 0); \
1227 intpol_met_space_3d(met, met->u, p, lon, lat, &u, ci, cw, 0); \
1228 intpol_met_space_3d(met, met->v, p, lon, lat, &v, ci, cw, 0); \
1229 intpol_met_space_3d(met, met->w, p, lon, lat, &w, ci, cw, 0); \
1230 intpol_met_space_3d(met, met->pv, p, lon, lat, &pv, ci, cw, 0); \
1231 intpol_met_space_3d(met, met->h2o, p, lon, lat, &h2o, ci, cw, 0); \
1232 intpol_met_space_3d(met, met->o3, p, lon, lat, &o3, ci, cw, 0); \
1233 intpol_met_space_3d(met, met->lwc, p, lon, lat, &lwc, ci, cw, 0); \
1234 intpol_met_space_3d(met, met->rwc, p, lon, lat, &rwc, ci, cw, 0); \
1235 intpol_met_space_3d(met, met->iwc, p, lon, lat, &iwc, ci, cw, 0); \
1236 intpol_met_space_3d(met, met->swc, p, lon, lat, &swc, ci, cw, 0); \
1237 intpol_met_space_3d(met, met->cc, p, lon, lat, &cc, ci, cw, 0); \
1238 intpol_met_space_2d(met, met->ps, lon, lat, &ps, ci, cw, 0); \
1239 intpol_met_space_2d(met, met->ts, lon, lat, &ts, ci, cw, 0); \
1240 intpol_met_space_2d(met, met->zs, lon, lat, &zs, ci, cw, 0); \
1241 intpol_met_space_2d(met, met->us, lon, lat, &us, ci, cw, 0); \
1242 intpol_met_space_2d(met, met->vs, lon, lat, &vs, ci, cw, 0); \
1243 intpol_met_space_2d(met, met->ess, ess, lat, &ess, ci, cw, 0); \
1244 intpol_met_space_2d(met, met->nss, nss, lat, &nss, ci, cw, 0); \
1245 intpol_met_space_2d(met, met->shf, shf, lat, &shf, ci, cw, 0); \
1246 intpol_met_space_2d(met, met->lsm, lon, lat, &lsm, ci, cw, 0); \
1247 intpol_met_space_2d(met, met->sst, lon, lat, &sst, ci, cw, 0); \
1248 intpol_met_space_2d(met, met->pbl, lon, lat, &pbl, ci, cw, 0); \
1249 intpol_met_space_2d(met, met->pt, lon, lat, &pt, ci, cw, 0); \
1250 intpol_met_space_2d(met, met->tt, lon, lat, &tt, ci, cw, 0); \
1251 intpol_met_space_2d(met, met->zt, lon, lat, &zt, ci, cw, 0); \
1252 intpol_met_space_2d(met, met->h2ot, lon, lat, &h2ot, ci, cw, 0); \
1253 intpol_met_space_2d(met, met->pct, lon, lat, &pct, ci, cw, 0); \
1254 intpol_met_space_2d(met, met->pcb, lon, lat, &pcb, ci, cw, 0); \
1255 intpol_met_space_2d(met, met->cl, lon, lat, &cl, ci, cw, 0); \
1256 intpol_met_space_2d(met, met->plcl, lon, lat, &plcl, ci, cw, 0); \
1257 intpol_met_space_2d(met, met->plfc, lon, lat, &plfc, ci, cw, 0); \
1258 intpol_met_space_2d(met, met->pel, lon, lat, &pel, ci, cw, 0); \
1259 intpol_met_space_2d(met, met->cape, lon, lat, &cape, ci, cw, 0); \
1260 intpol_met_space_2d(met, met->cin, lon, lat, &cin, ci, cw, 0); \
1261 intpol_met_space_2d(met, met->o3c, lon, lat, &o3c, ci, cw, 0); \
1278#define INTPOL_TIME_ALL(time, p, lon, lat) { \
1279 intpol_met_time_3d(met0, met0->z, met1, met1->z, time, p, lon, lat, &z, ci, cw, 1); \
1280 intpol_met_time_3d(met0, met0->t, met1, met1->t, time, p, lon, lat, &t, ci, cw, 0); \
1281 intpol_met_time_3d(met0, met0->u, met1, met1->u, time, p, lon, lat, &u, ci, cw, 0); \
1282 intpol_met_time_3d(met0, met0->v, met1, met1->v, time, p, lon, lat, &v, ci, cw, 0); \
1283 intpol_met_time_3d(met0, met0->w, met1, met1->w, time, p, lon, lat, &w, ci, cw, 0); \
1284 intpol_met_time_3d(met0, met0->pv, met1, met1->pv, time, p, lon, lat, &pv, ci, cw, 0); \
1285 intpol_met_time_3d(met0, met0->h2o, met1, met1->h2o, time, p, lon, lat, &h2o, ci, cw, 0); \
1286 intpol_met_time_3d(met0, met0->o3, met1, met1->o3, time, p, lon, lat, &o3, ci, cw, 0); \
1287 intpol_met_time_3d(met0, met0->lwc, met1, met1->lwc, time, p, lon, lat, &lwc, ci, cw, 0); \
1288 intpol_met_time_3d(met0, met0->rwc, met1, met1->rwc, time, p, lon, lat, &rwc, ci, cw, 0); \
1289 intpol_met_time_3d(met0, met0->iwc, met1, met1->iwc, time, p, lon, lat, &iwc, ci, cw, 0); \
1290 intpol_met_time_3d(met0, met0->swc, met1, met1->swc, time, p, lon, lat, &swc, ci, cw, 0); \
1291 intpol_met_time_3d(met0, met0->cc, met1, met1->cc, time, p, lon, lat, &cc, ci, cw, 0); \
1292 intpol_met_time_2d(met0, met0->ps, met1, met1->ps, time, lon, lat, &ps, ci, cw, 0); \
1293 intpol_met_time_2d(met0, met0->ts, met1, met1->ts, time, lon, lat, &ts, ci, cw, 0); \
1294 intpol_met_time_2d(met0, met0->zs, met1, met1->zs, time, lon, lat, &zs, ci, cw, 0); \
1295 intpol_met_time_2d(met0, met0->us, met1, met1->us, time, lon, lat, &us, ci, cw, 0); \
1296 intpol_met_time_2d(met0, met0->vs, met1, met1->vs, time, lon, lat, &vs, ci, cw, 0); \
1297 intpol_met_time_2d(met0, met0->ess, met1, met1->ess, time, lon, lat, &ess, ci, cw, 0); \
1298 intpol_met_time_2d(met0, met0->nss, met1, met1->nss, time, lon, lat, &nss, ci, cw, 0); \
1299 intpol_met_time_2d(met0, met0->shf, met1, met1->shf, time, lon, lat, &shf, ci, cw, 0); \
1300 intpol_met_time_2d(met0, met0->lsm, met1, met1->lsm, time, lon, lat, &lsm, ci, cw, 0); \
1301 intpol_met_time_2d(met0, met0->sst, met1, met1->sst, time, lon, lat, &sst, ci, cw, 0); \
1302 intpol_met_time_2d(met0, met0->pbl, met1, met1->pbl, time, lon, lat, &pbl, ci, cw, 0); \
1303 intpol_met_time_2d(met0, met0->pt, met1, met1->pt, time, lon, lat, &pt, ci, cw, 0); \
1304 intpol_met_time_2d(met0, met0->tt, met1, met1->tt, time, lon, lat, &tt, ci, cw, 0); \
1305 intpol_met_time_2d(met0, met0->zt, met1, met1->zt, time, lon, lat, &zt, ci, cw, 0); \
1306 intpol_met_time_2d(met0, met0->h2ot, met1, met1->h2ot, time, lon, lat, &h2ot, ci, cw, 0); \
1307 intpol_met_time_2d(met0, met0->pct, met1, met1->pct, time, lon, lat, &pct, ci, cw, 0); \
1308 intpol_met_time_2d(met0, met0->pcb, met1, met1->pcb, time, lon, lat, &pcb, ci, cw, 0); \
1309 intpol_met_time_2d(met0, met0->cl, met1, met1->cl, time, lon, lat, &cl, ci, cw, 0); \
1310 intpol_met_time_2d(met0, met0->plcl, met1, met1->plcl, time, lon, lat, &plcl, ci, cw, 0); \
1311 intpol_met_time_2d(met0, met0->plfc, met1, met1->plfc, time, lon, lat, &plfc, ci, cw, 0); \
1312 intpol_met_time_2d(met0, met0->pel, met1, met1->pel, time, lon, lat, &pel, ci, cw, 0); \
1313 intpol_met_time_2d(met0, met0->cape, met1, met1->cape, time, lon, lat, &cape, ci, cw, 0); \
1314 intpol_met_time_2d(met0, met0->cin, met1, met1->cin, time, lon, lat, &cin, ci, cw, 0); \
1315 intpol_met_time_2d(met0, met0->o3c, met1, met1->o3c, time, lon, lat, &o3c, ci, cw, 0); \
1332#define LAPSE(p1, t1, p2, t2) \
1333 (1e3 * G0 / RA * ((t2) - (t1)) / ((t2) + (t1)) \
1334 * ((p2) + (p1)) / ((p2) - (p1)))
1351#define LIN(x0, y0, x1, y1, x) \
1352 ((y0)+((y1)-(y0))/((x1)-(x0))*((x)-(x0)))
1394 "# $1 = time [s]\n" \
1395 "# $2 = altitude [km]\n" \
1396 "# $3 = longitude [deg]\n" \
1397 "# $4 = latitude [deg]\n" \
1398 "# $5 = pressure [hPa]\n" \
1399 "# $6 = temperature [K]\n" \
1400 "# $7 = zonal wind [m/s]\n" \
1401 "# $8 = meridional wind [m/s]\n" \
1402 "# $9 = vertical velocity [hPa/s]\n" \
1403 "# $10 = H2O volume mixing ratio [ppv]\n"); \
1405 "# $11 = O3 volume mixing ratio [ppv]\n" \
1406 "# $12 = geopotential height [km]\n" \
1407 "# $13 = potential vorticity [PVU]\n" \
1408 "# $14 = surface pressure [hPa]\n" \
1409 "# $15 = surface temperature [K]\n" \
1410 "# $16 = surface geopotential height [km]\n" \
1411 "# $17 = surface zonal wind [m/s]\n" \
1412 "# $18 = surface meridional wind [m/s]\n" \
1413 "# $19 = eastward turbulent surface stress [N/m^2]\n" \
1414 "# $20 = northward turbulent surface stress [N/m^2]\n"); \
1416 "# $21 = surface sensible heat flux [W/m^2]\n" \
1417 "# $22 = land-sea mask [1]\n" \
1418 "# $23 = sea surface temperature [K]\n" \
1419 "# $24 = tropopause pressure [hPa]\n" \
1420 "# $25 = tropopause geopotential height [km]\n" \
1421 "# $26 = tropopause temperature [K]\n" \
1422 "# $27 = tropopause water vapor [ppv]\n" \
1423 "# $28 = cloud liquid water content [kg/kg]\n" \
1424 "# $29 = cloud rain water content [kg/kg]\n" \
1425 "# $30 = cloud ice water content [kg/kg]\n"); \
1427 "# $31 = cloud snow water content [kg/kg]\n" \
1428 "# $32 = cloud cover [1]\n" \
1429 "# $33 = total column cloud water [kg/m^2]\n" \
1430 "# $34 = cloud top pressure [hPa]\n" \
1431 "# $35 = cloud bottom pressure [hPa]\n" \
1432 "# $36 = pressure at lifted condensation level (LCL) [hPa]\n" \
1433 "# $37 = pressure at level of free convection (LFC) [hPa]\n" \
1434 "# $38 = pressure at equilibrium level (EL) [hPa]\n" \
1435 "# $39 = convective available potential energy (CAPE) [J/kg]\n" \
1436 "# $40 = convective inhibition (CIN) [J/kg]\n"); \
1438 "# $41 = relative humidity over water [%%]\n" \
1439 "# $42 = relative humidity over ice [%%]\n" \
1440 "# $43 = dew point temperature [K]\n" \
1441 "# $44 = frost point temperature [K]\n" \
1442 "# $45 = NAT temperature [K]\n" \
1443 "# $46 = HNO3 volume mixing ratio [ppv]\n" \
1444 "# $47 = OH volume mixing ratio [ppv]\n" \
1445 "# $48 = H2O2 volume mixing ratio [ppv]\n" \
1446 "# $49 = HO2 volume mixing ratio [ppv]\n" \
1447 "# $50 = O(1D) volume mixing ratio [ppv]\n"); \
1449 "# $51 = boundary layer pressure [hPa]\n" \
1450 "# $52 = total column ozone [DU]\n" \
1451 "# $53 = number of data points\n" \
1452 "# $54 = number of tropopause data points\n" \
1453 "# $55 = number of CAPE data points\n");
1494#define MOLEC_DENS(p,t) \
1495 (AVO * 1e-6 * ((p) * 100) / (RI * (t)))
1509 int nc_result=(cmd); \
1510 if(nc_result!=NC_NOERR) \
1511 ERRMSG("%s", nc_strerror(nc_result)); \
1537#define NC_DEF_VAR(varname, type, ndims, dims, long_name, units, level, quant) { \
1538 NC(nc_def_var(ncid, varname, type, ndims, dims, &varid)); \
1539 NC(nc_put_att_text(ncid, varid, "long_name", strnlen(long_name, LEN), long_name)); \
1540 NC(nc_put_att_text(ncid, varid, "units", strnlen(units, LEN), units)); \
1542 NC(nc_def_var_quantize(ncid, varid, NC_QUANTIZE_GRANULARBR, quant)); \
1543 if((level) != 0) { \
1544 NC(nc_def_var_deflate(ncid, varid, 1, 1, level)); \
1567#define NC_GET_DOUBLE(varname, ptr, force) { \
1569 NC(nc_inq_varid(ncid, varname, &varid)); \
1570 NC(nc_get_var_double(ncid, varid, ptr)); \
1572 if(nc_inq_varid(ncid, varname, &varid) == NC_NOERR) { \
1573 NC(nc_get_var_double(ncid, varid, ptr)); \
1575 WARN("netCDF variable %s is missing!", varname); \
1597#define NC_INQ_DIM(dimname, ptr, min, max, check) { \
1598 int dimid; size_t naux; \
1599 NC(nc_inq_dimid(ncid, dimname, &dimid)); \
1600 NC(nc_inq_dimlen(ncid, dimid, &naux)); \
1603 if ((*ptr) < (min) || (*ptr) > (max)) \
1604 ERRMSG("Dimension %s is out of range!", dimname); \
1621#define NC_PUT_DOUBLE(varname, ptr, hyperslab) { \
1622 NC(nc_inq_varid(ncid, varname, &varid)); \
1624 NC(nc_put_vara_double(ncid, varid, start, count, ptr)); \
1626 NC(nc_put_var_double(ncid, varid, ptr)); \
1645#define NC_PUT_FLOAT(varname, ptr, hyperslab) { \
1646 NC(nc_inq_varid(ncid, varname, &varid)); \
1648 NC(nc_put_vara_float(ncid, varid, start, count, ptr)); \
1650 NC(nc_put_var_float(ncid, varid, ptr)); \
1668#define NC_PUT_INT(varname, ptr, hyperslab) { \
1669 NC(nc_inq_varid(ncid, varname, &varid)); \
1671 NC(nc_put_vara_int(ncid, varid, start, count, ptr)); \
1673 NC(nc_put_var_int(ncid, varid, ptr)); \
1690#define NC_PUT_ATT(varname, attname, text) { \
1691 NC(nc_inq_varid(ncid, varname, &varid)); \
1692 NC(nc_put_att_text(ncid, varid, attname, strnlen(text, LEN), text)); \
1707#define NC_PUT_ATT_GLOBAL(attname, text) \
1708 NC(nc_put_att_text(ncid, NC_GLOBAL, attname, strnlen(text, LEN), text));
1727#define NN(x0, y0, x1, y1, x) \
1728 (fabs((x) - (x0)) <= fabs((x) - (x1)) ? (y0) : (y1))
1746#define PARTICLE_LOOP(ip0, ip1, check_dt, ...) \
1747 const int ip0_const = ip0; \
1748 const int ip1_const = ip1; \
1749 _Pragma(__VA_ARGS__) \
1750 _Pragma("acc parallel loop independent gang vector") \
1751 for (int ip = ip0_const; ip < ip1_const; ip++) \
1752 if (!check_dt || cache->dt[ip] != 0)
1754#define PARTICLE_LOOP(ip0, ip1, check_dt, ...) \
1755 const int ip0_const = ip0; \
1756 const int ip1_const = ip1; \
1757 _Pragma("omp parallel for default(shared)") \
1758 for (int ip = ip0_const; ip < ip1_const; ip++) \
1759 if (!check_dt || cache->dt[ip] != 0)
1785 (P0 * exp(-(z) / H0))
1809 (6.112 * exp(17.62 * ((t) - T0) / (243.12 + (t) - T0)))
1833 (6.112 * exp(22.46 * ((t) - T0) / (272.62 + (t) - T0)))
1860 ((p) * MAX((h2o), 0.1e-6) / (1. + (1. - EPS) * MAX((h2o), 0.1e-6)))
1876#define RAD2DEG(rad) \
1877 ((rad) * (180.0 / M_PI))
1906#define RH(p, t, h2o) \
1907 (PW(p, h2o) / PSAT(t) * 100.)
1936#define RHICE(p, t, h2o) \
1937 (PW(p, h2o) / PSICE(t) * 100.)
1962 (100. * (p) / (RA * (t)))
1980#define SET_ATM(qnt, val) \
1981 if (ctl->qnt >= 0) \
1982 atm->q[ctl->qnt][ip] = val;
2003#define SET_QNT(qnt, name, longname, unit) \
2004 if (strcasecmp(ctl->qnt_name[iq], name) == 0) { \
2006 sprintf(ctl->qnt_longname[iq], longname); \
2007 sprintf(ctl->qnt_unit[iq], unit); \
2025 (EPS * MAX((h2o), 0.1e-6))
2051#define SWAP(x, y, type) \
2052 do {type tmp = x; x = y; y = tmp;} while(0);
2075#define TDEW(p, h2o) \
2076 (T0 + 243.12 * log(PW((p), (h2o)) / 6.112) \
2077 / (17.62 - log(PW((p), (h2o)) / 6.112)))
2100#define TICE(p, h2o) \
2101 (T0 + 272.62 * log(PW((p), (h2o)) / 6.112) \
2102 / (22.46 - log(PW((p), (h2o)) / 6.112)))
2124#define THETA(p, t) \
2125 ((t) * pow(1000. / (p), KAPPA))
2153#define THETAVIRT(p, t, h2o) \
2154 (TVIRT(THETA((p), (t)), MAX((h2o), 0.1e-6)))
2174#define TOK(line, tok, format, var) { \
2175 if(((tok)=strtok((line), " \t"))) { \
2176 if(sscanf(tok, format, &(var))!=1) continue; \
2177 } else ERRMSG("Error while reading!"); \
2199#define TVIRT(t, h2o) \
2200 ((t) * (1. + (1. - EPS) * MAX((h2o), 0.1e-6)))
2216 for (iusage = 1; iusage < argc; iusage++) \
2217 if (!strcmp(argv[iusage], "-h") \
2218 || !strcmp(argv[iusage], "--help")) { \
2220 return EXIT_SUCCESS; \
2244 (H0 * log(P0 / (p)))
2274#define ZDIFF(lnp0, t0, h2o0, lnp1, t1, h2o1) \
2275 (RI / MA / G0 * 0.5 * (TVIRT((t0), (h2o0)) + TVIRT((t1), (h2o1))) \
2276 * ((lnp0) - (lnp1)))
2293#define ZETA(ps, p, t) \
2294 (((p) / (ps) <= 0.3 ? 1. : \
2295 sin(M_PI / 2. * (1. - (p) / (ps)) / (1. - 0.3))) \
2336#define LOG(level, ...) { \
2339 if(level <= LOGLEV) { \
2340 printf(__VA_ARGS__); \
2373#define WARN(...) { \
2374 printf("\nWarning (%s, %s, l%d): ", __FILE__, __func__, __LINE__); \
2375 LOG(0, __VA_ARGS__); \
2406#define ERRMSG(...) { \
2407 printf("\nError (%s, %s, l%d): ", __FILE__, __func__, __LINE__); \
2408 LOG(0, __VA_ARGS__); \
2409 exit(EXIT_FAILURE); \
2441#define PRINT(format, var) \
2442 printf("Print (%s, %s, l%d): %s= "format"\n", \
2443 __FILE__, __func__, __LINE__, #var, var);
2465#define PRINT_TIMERS \
2466 timer("END", "END", 1);
2480#define SELECT_TIMER(id, group) \
2481 timer(id, group, 0);
3150 char clim_ccl4_timeseries[
LEN];
3153 char clim_ccl3f_timeseries[
LEN];
3156 char clim_ccl2f2_timeseries[
LEN];
3159 char clim_n2o_timeseries[
LEN];
3162 char clim_sf6_timeseries[
LEN];
3255 double wet_depo_pre[2];
3270 double wet_depo_ic_h[2];
3273 double wet_depo_bc_h[2];
3794 double tropo_time[12];
3797 double tropo_lat[73];
3800 double tropo[12][73];
4044 size_t subdomain_start[4];
4047 size_t subdomain_count[4];
4050 size_t halo_bnd_start[4];
4053 size_t halo_bnd_count[4];
4068 MPI_Datatype MPI_Particle;
4071 double sort_key[
NP];
4344 const char *varname,
4349 const double t_comp,
4350 const double t_decomp,
4352 const size_t nbytes,
4381 const char *varname,
4383 const float *org_all,
4384 const float *cmp_all,
4389 const double t_comp,
4390 const double t_decomp,
4391 const size_t nbytes);
4413 const char *varname,
4415 const int decompress,
4525ZSTD_CCtx *compress_zstd_create_cctx(
4527 const int nworkers);
4542 const char *varname);
4566 const char *varname,
4568 const int decompress,
4602 const char *varname,
4604 const int decompress,
4647 const char *varname,
4649 const int decompress,
4675 const char *varname,
4677 const int decompress,
4704 const char *varname,
4706 const int decompress,
5431 const char *metbase,
5432 const double dt_met,
5500 const int met_tropo,
5617 float height0[
EX][
EY][
EP],
5618 float array0[
EX][
EY][
EP],
5620 float height1[
EX][
EY][
EP],
5621 float array1[
EX][
EY][
EP],
5623 const double height,
5712 float array[
EX][
EY],
5755 float array0[
EX][
EY][
EP],
5757 float array1[
EX][
EY][
EP],
5803 float array0[
EX][
EY],
5805 float array1[
EX][
EY],
5853 float array0[
EX][
EY],
5855 float array1[
EX][
EY],
5856 const double lons[
EX],
5857 const double lats[
EY],
5930 const double kz[
EP],
5931 const double kw[
EP],
6108 float profiles[
EX][
EY][
EP],
6110 const int lon_ap_ind,
6111 const int lat_ap_ind,
6112 const double alt_ap,
6801 const int use_ensemble);
7403 const char *filename,
7472 const char *filename,
7508 const char *filename,
7576 const char *filename,
7621 const char *filename,
7661 const char *dirname,
7838 const char *filename,
7873 const char *filename,
7902 const char *filename,
7936 const char *filename,
7969 const char *filename,
7990 const char *varname,
8018 const char *filename,
8048 const char *filename,
8049 const char *varname,
8080 const char *filename,
8117 const char *filename,
8150 const char *varname);
8194 const char *varname,
8195 const float bound_min,
8196 const float bound_max);
8366 const char *filename,
8416 const int num_messages,
8451 const int num_messages,
8487 const char *varname);
8545 const char *filename,
8585 const char *filename,
8698 const char *varname,
8699 const char *varname2,
8700 const char *varname3,
8701 const char *varname4,
8702 const char *varname5,
8703 const char *varname6,
8742 const char *varname,
8743 const char *varname2,
8744 const char *varname3,
8745 const char *varname4,
9022 const char *filename,
9059 const char *filename,
9094 const char *filename,
9136 const char *filename,
9139 const char *varname,
9141 const char *defvalue,
9271 const double remain,
9337 const char *filename,
9339 const int with_seconds);
9388 const char *filename,
9417 const char *filename,
9445 const char *filename,
9474 const char *dirname,
9503 const char *filename,
9536 const char *filename,
9582 const char *filename,
9615 const char *filename,
9633 const char *filename,
9650 const char *filename,
9656 const double *area);
9670 const char *filename,
9676 const double *area);
9717 const char *filename,
9770 const char *filename,
9775 const double *vmr_impl,
9827 const char *filename,
9832 const double *vmr_impl,
9871 const char *filename,
9906 const char *varname);
9952 const char *varname,
9984 const char *filename,
10012 const char *varname,
10042 const char *varname,
10078 const char *filename,
10117 const char *filename,
10151 const char *filename,
10185 const char *filename,
10195#pragma acc routine (clim_oh)
10196#pragma acc routine (clim_photo)
10197#pragma acc routine (clim_tropo)
10198#pragma acc routine (clim_ts)
10199#pragma acc routine (clim_zm)
10200#pragma acc routine (cos_sza)
10201#pragma acc routine (dd_calc_subdomain_from_coords)
10202#pragma acc routine (dd_normalize_lon_lat)
10203#pragma acc routine (intpol_check_lon_lat)
10204#pragma acc routine (intpol_met_4d_zeta)
10205#pragma acc routine (intpol_met_space_3d)
10206#pragma acc routine (intpol_met_space_2d)
10207#pragma acc routine (intpol_met_time_3d)
10208#pragma acc routine (intpol_met_time_2d)
10209#pragma acc routine (kernel_weight)
10210#pragma acc routine (lapse_rate)
10211#pragma acc routine (locate_irr)
10212#pragma acc routine (locate_irr_float)
10213#pragma acc routine (locate_reg)
10214#pragma acc routine (locate_vert)
10215#pragma acc routine (nat_temperature)
10216#pragma acc routine (pbl_weight)
10217#pragma acc routine (sedi)
10218#pragma acc routine (stddev)
10219#pragma acc routine (tropo_weight)
void read_met_geopot(const ctl_t *ctl, met_t *met)
Calculates geopotential heights from meteorological data.
void dd_init(const ctl_t *ctl, dd_t *dd, atm_t *atm)
Initialize the domain decomposition infrastructure.
#define LEN
Maximum length of ASCII data lines.
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.
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.
void day2doy(const int year, const int mon, const int day, int *doy)
Get day of year from date.
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.
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.
int read_met_nc_2d(const int ncid, const char *varname, const char *varname2, const char *varname3, const char *varname4, const char *varname5, const char *varname6, 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.
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.
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.
void read_met_sample(const ctl_t *ctl, met_t *met)
Downsamples meteorological data based on specified parameters.
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.
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.
void module_timesteps(const ctl_t *ctl, cache_t *cache, met_t *met0, atm_t *atm, const double t)
Calculate time steps for air parcels based on specified conditions.
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.
void read_clim_photo(const char *filename, clim_photo_t *photo)
Reads photolysis rates from a NetCDF file and populates the given photolysis structure.
void read_met_cloud(met_t *met)
Calculates cloud-related variables for each grid point.
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.
double sedi(const double p, const double T, const double rp, const double rhop)
Calculates the sedimentation velocity of a particle in air.
double cos_sza(const double sec, const double lon, const double lat)
Calculates the cosine of the solar zenith angle.
#define METVAR
Number of 3-D meteorological variables.
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.
int read_met_nc_3d(const int ncid, const char *varname, const char *varname2, const char *varname3, const char *varname4, 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.
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.
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.
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.
void read_met_detrend(const ctl_t *ctl, met_t *met)
Detrends meteorological data.
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...
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.
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.
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.
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.
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.
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.
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.
void read_met_monotonize(const ctl_t *ctl, met_t *met)
Makes zeta and pressure profiles monotone.
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.
#define DD_EY_GLOB
Maximum number of latitudes of global meteo data.
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.
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.
void read_met_periodic(met_t *met)
Applies periodic boundary conditions to meteorological data along longitudinal axis.
int compress_metvar_index(const char *varname)
Maps a meteorological variable name to its internal MPTRAC variable index.
void module_timesteps_init(ctl_t *ctl, const atm_t *atm)
Initialize start time and time interval for time-stepping.
void write_ens(const char *filename, const ctl_t *ctl, const atm_t *atm, const double t)
Writes ensemble data to a file.
void module_mixing(const ctl_t *ctl, const clim_t *clim, atm_t *atm, const double t)
Update atmospheric properties through interparcel mixing.
double clim_zm(const clim_zm_t *zm, const double t, const double lat, const double p)
Interpolates monthly mean zonal mean climatological variables.
#define EY
Maximum number of latitudes for meteo data.
void module_mixing_help(const ctl_t *ctl, const clim_t *clim, atm_t *atm, const int *ixs, const int *iys, const int *izs, const int qnt_idx, const int use_ensemble)
Perform subgrid-scale interparcel mixing of a given quantity.
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.
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.
double clim_tropo(const clim_t *clim, const double t, const double lat)
Calculates the tropopause pressure based on climatological data.
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.
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.
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.
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.
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.
void level_definitions(ctl_t *ctl)
Defines pressure levels for meteorological data.
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.
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.
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.
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.
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.
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.
#define codes_handle
Placeholder when ECCODES is not available.
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.
void fft_help(double *fcReal, double *fcImag, const int n)
Computes the Fast Fourier Transform (FFT) of a complex sequence.
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.
int compress_read_lossy_scale(FILE *in, const size_t nz, double **off, double **scl)
Read optional lossyscaling metadata for a 3-D field.
double nat_temperature(const double p, const double h2o, const double hno3)
Calculates the nitric acid trihydrate (NAT) temperature.
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.
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.
#define NQ
Maximum number of quantities per data point.
void dd_assign_subdomains(const ctl_t *ctl, const dd_t *dd, atm_t *atm, const int init)
Assign or update particle subdomain ownership.
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.
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.
#define EX
Maximum number of longitudes for meteo data.
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.
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.
void timer(const char *name, const char *group, const int output)
Measures and reports elapsed time for named and grouped timers.
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.
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.
void module_sort(const ctl_t *ctl, const met_t *met0, atm_t *atm)
Sort particles according to box index.
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.
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].
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.
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.
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.
void dd_normalize_lon_lat(const dd_t *dd, double *lon, double *lat)
Normalize geographic coordinates to the global grid convention.
#define CT
Maximum number of time steps for climatological data.
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.
void module_radio_decay(const ctl_t *ctl, const cache_t *cache, atm_t *atm)
Apply radioactive decay to atmospheric tracer species.
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 dd_sort(const ctl_t *ctl, const met_t *met0, atm_t *atm, dd_t *dd, int *npart)
Sort local atmospheric particles and determine export counts for domain decomposition.
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.
void module_sort_help(double *a, const int *p, const int np)
Reorder an array based on a given permutation.
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.
float stddev(const float *data, const int n)
Calculates the standard deviation of a set of data.
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).
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.
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.
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.
void mptrac_read_clim(const ctl_t *ctl, clim_t *clim)
Reads various climatological data and populates the given climatology structure.
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...
void write_met_nc(const char *filename, const ctl_t *ctl, met_t *met)
Writes meteorological data to a NetCDF file.
void module_rng_init(const int ntask)
Initialize random number generators for parallel tasks.
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.
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.
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.
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...
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.
#define CTS
Maximum number of data points of climatological time series.
void read_met_ozone(met_t *met)
Calculates the total column ozone from meteorological ozone data.
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.
void broadcast_large_data(void *data, size_t N)
Broadcasts large data across all processes in an MPI communicator.
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.
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.
void clim_tropo_init(clim_t *clim)
Initializes the tropopause data in the climatology structure.
void module_rng(const ctl_t *ctl, double *rs, const size_t n, const int method)
Generate random numbers using various methods and distributions.
void write_station(const char *filename, const ctl_t *ctl, atm_t *atm, const double t)
Writes station data to a specified file.
void cart2geo(const double *x, double *z, double *lon, double *lat)
Converts Cartesian coordinates to geographic coordinates.
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.
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.
#define NP
Maximum number of atmospheric data points.
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.
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).
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.
void module_position(const cache_t *cache, met_t *met0, met_t *met1, atm_t *atm)
Update the positions and pressure levels of atmospheric particles.
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.
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.
void read_met_pv(met_t *met)
Calculates potential vorticity (PV) from meteorological data.
#define DD_EX_GLOB
Maximum number of longitudes of global meteo data.
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.
#define CY
Maximum number of latitudes for climatological data.
void module_diff_meso(const ctl_t *ctl, cache_t *cache, met_t *met0, met_t *met1, atm_t *atm)
Simulate mesoscale diffusion for atmospheric particles.
void dd_sort_help(double *a, dd_t *dd, const int np)
Apply the sorting permutation to a particle data array.
double clim_ts(const clim_ts_t *ts, const double t)
Interpolates a time series of climatological variables.
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.
int read_met_bin(const char *filename, const ctl_t *ctl, met_t *met)
Reads meteorological data from a binary file.
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.
void get_met_replace(char *orig, const char *search, const char *repl)
Replaces occurrences of a substring in a string with another substring.
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.
int read_atm_clams(const char *filename, const ctl_t *ctl, atm_t *atm)
Reads atmospheric data from a CLAMS NetCDF file.
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.
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.
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.
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.
#define EP
Maximum number of pressure levels for meteo data.
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.
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.
void read_met_polar_winds(met_t *met)
Applies a fix for polar winds in meteorological data.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
void write_met_bin(const char *filename, const ctl_t *ctl, met_t *met)
Writes meteorological data in binary format to a specified file.
void write_atm_bin(const char *filename, const ctl_t *ctl, const atm_t *atm)
Writes air parcel data to a binary file.
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.
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.
#define CSZA
Maximum number of solar zenith angles for climatological data.
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.
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.
double lapse_rate(const double t, const double h2o)
Calculates the moist adiabatic lapse rate in Kelvin per kilometer.
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.
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.
void write_atm_nc(const char *filename, const ctl_t *ctl, const atm_t *atm)
Writes air parcel data to a NetCDF file.
int np
Number of air parcels.
int iso_n
Isosurface balloon number of data points.
Climatological data in the form of photolysis rates.
int nsza
Number of solar zenith angles.
int np
Number of pressure levels.
int no3c
Number of total ozone columns.
clim_ts_t ccl2f2
CFC-12 time series.
clim_photo_t photo
Photolysis rates.
clim_zm_t ho2
HO2 zonal means.
clim_zm_t hno3
HNO3 zonal means.
int tropo_ntime
Number of tropopause timesteps.
clim_ts_t sf6
SF6 time series.
clim_ts_t ccl4
CFC-10 time series.
clim_ts_t ccl3f
CFC-11 time series.
clim_zm_t o1d
O(1D) zonal means.
clim_zm_t h2o2
H2O2 zonal means.
int tropo_nlat
Number of tropopause latitudes.
clim_zm_t oh
OH zonal means.
clim_ts_t n2o
N2O time series.
Climatological data in the form of time series.
int ntime
Number of timesteps.
Climatological data in the form of zonal means.
int np
Number of pressure levels.
int ntime
Number of timesteps.
int nlat
Number of latitudes.
double met_utm_ref_lon
Reference longitude [deg] for UTM grid.
double grid_z0
Lower altitude of gridded data [km].
int qnt_o3
Quantity array index for ozone volume mixing ratio.
double csi_lat1
Upper latitude of gridded CSI data [deg].
int qnt_Coh
Quantity array index for OH volume mixing ratio (chemistry code).
double wet_depo_ic_a
Coefficient A for wet deposition in cloud (exponential form).
int qnt_target_subdomain
Quantity array index for destination subdomain in domain decomposition.
int met_nc_scale
Check netCDF scaling factors (0=no, 1=yes).
int qnt_pel
Quantity array index for pressure at equilibrium level (EL).
int csi_nz
Number of altitudes of gridded CSI data.
double molmass
Molar mass [g/mol].
int qnt_p
Quantity array index for pressure.
int qnt_Cccl2f2
Quantity array index for CFC-12 volume mixing ratio (chemistry code).
int dd_halos_size
Domain decomposition size of halos given in grid-points.
int mixing_nx
Number of longitudes of mixing grid.
int met_zstd_nworkers
ZSTD number of worker threads (0=single-threaded, default=4).
double chemgrid_z1
Upper altitude of chemistry grid [km].
int qnt_m
Quantity array index for mass.
int qnt_aoa
Quantity array index for age of air.
int qnt_rhop
Quantity array index for particle density.
int qnt_swc
Quantity array index for cloud snow water content.
double csi_obsmin
Minimum observation index to trigger detection.
int qnt_pcb
Quantity array index for cloud bottom pressure.
double bound_dzs
Boundary conditions surface layer depth [km].
double csi_lon1
Upper longitude of gridded CSI data [deg].
int qnt_u
Quantity array index for zonal wind.
double stat_lon
Longitude of station [deg].
double mixing_trop
Interparcel exchange parameter for mixing in the troposphere.
double sort_dt
Time step for sorting of particle data [s].
double mixing_z1
Upper altitude of mixing grid [km].
double stat_r
Search radius around station [km].
double wet_depo_bc_a
Coefficient A for wet deposition below cloud (exponential form).
int met_zstd_level
ZSTD compression level (from -5 to 22, default=-3).
double met_utm_ref_lat
Reference latitude [deg] for UTM grid.
int csi_ny
Number of latitudes of gridded CSI data.
int vtk_sphere
Spherical projection for VTK data (0=no, 1=yes).
double chemgrid_z0
Lower altitude of chemistry grid [km].
double met_pbl_min
Minimum depth of planetary boundary layer [km].
int qnt_iwc
Quantity array index for cloud ice water content.
double chemgrid_lat0
Lower latitude of chemistry grid [deg].
double conv_cape
CAPE threshold for convection module [J/kg].
int qnt_Co1d
Quantity array index for O(1D) volume mixing ratio (chemistry code).
int qnt_pw
Quantity array index for partial water vapor pressure.
double grid_z1
Upper altitude of gridded data [km].
int direction
Direction flag (1=forward calculation, -1=backward calculation).
int qnt_Cccl4
Quantity array index for CFC-10 volume mixing ratio (chemistry code).
int met_dp
Stride for pressure levels.
double met_dt_out
Time step for sampling of meteo data along trajectories [s].
int qnt_h2o2
Quantity array index for H2O2 volume mixing ratio (climatology).
int qnt_vh
Quantity array index for horizontal wind.
int csi_nx
Number of longitudes of gridded CSI data.
double csi_lat0
Lower latitude of gridded CSI data [deg].
double turb_dz_trop
Vertical turbulent diffusion coefficient (troposphere) [m^2/s].
int met_pbl
Planetary boundary layer data (0=file, 1=z2p, 2=Richardson, 3=theta).
int qnt_lwc
Quantity array index for cloud liquid water content.
double turb_mesoz
Vertical scaling factor for mesoscale wind fluctuations.
int grid_nc_level
zlib compression level of netCDF grid data files (0=off).
int grid_nx
Number of longitudes of gridded data.
int atm_type
Type of atmospheric data files (0=ASCII, 1=binary, 2=netCDF, 3=CLaMS_traj, 4=CLaMS_pos).
double bound_mass
Boundary conditions mass per particle [kg].
double grid_lat0
Lower latitude of gridded data [deg].
int qnt_ts
Quantity array index for surface temperature.
int qnt_loss_rate
Quantity array index for total loss rate.
int qnt_plfc
Quantity array index for pressure at level of free convection (LCF).
int qnt_Acs137
Quantity array index for radioactive activity of Cs-137.
double grid_lon0
Lower longitude of gridded data [deg].
int qnt_o1d
Quantity array index for O(1D) volume mixing ratio (climatology).
int met_tropo_spline
Tropopause interpolation method (0=linear, 1=spline).
int qnt_tvirt
Quantity array index for virtual temperature.
double dt_met
Time step of meteo data [s].
double chemgrid_lat1
Upper latitude of chemistry grid [deg].
int met_geopot_sy
Latitudinal smoothing of geopotential heights.
double turb_dx_strat
Horizontal turbulent diffusion coefficient (stratosphere) [m^2/s].
int qnt_vmr
Quantity array index for volume mixing ratio.
int qnt_lsm
Quantity array index for land-sea mask.
int qnt_theta
Quantity array index for potential temperature.
double bound_lat1
Boundary conditions maximum longitude [deg].
double stat_t1
Stop time for station output [s].
double turb_dx_trop
Horizontal turbulent diffusion coefficient (troposphere) [m^2/s].
int grid_type
Type of grid data files (0=ASCII, 1=netCDF).
double csi_lon0
Lower longitude of gridded CSI data [deg].
int qnt_pbl
Quantity array index for boundary layer pressure.
int grid_stddev
Include standard deviations in grid output (0=no, 1=yes).
int qnt_psice
Quantity array index for saturation pressure over ice.
double chemgrid_lon0
Lower longitude of chemistry grid [deg].
int bound_pbl
Boundary conditions planetary boundary layer (0=no, 1=yes).
int qnt_mloss_wet
Quantity array index for total mass loss due to wet deposition.
int radio_decay
RADIO_DECAY switch for airborne and deposited activity (0=off, 1=on, default: 0).
int met_geopot_sx
Longitudinal smoothing of geopotential heights.
int met_sy
Smoothing for latitudes.
int qnt_ps
Quantity array index for surface pressure.
int rng_type
Random number generator (0=GSL, 1=Squares, 2=cuRAND).
int met_pck_zstd
Apply an additional ZSTD compression step to PCK payloads (0=off, 1=on).
int isosurf
Isosurface parameter (0=none, 1=pressure, 2=density, 3=theta, 4=balloon).
double bound_p1
Boundary conditions top pressure [hPa].
int qnt_zs
Quantity array index for surface geopotential height.
int prof_nz
Number of altitudes of gridded profile data.
double csi_dt_out
Time step for CSI output [s].
int met_cape
Convective available potential energy data (0=file, 1=calculate).
double csi_modmin
Minimum column density to trigger detection [kg/m^2].
int met_sx
Smoothing for longitudes.
double chemgrid_lon1
Upper longitude of chemistry grid [deg].
double depo_dt_out
DEPO_DT_OUT time interval for radioactive deposition output [s] (default: 86400).
double turb_mesox
Horizontal scaling factor for mesoscale wind fluctuations.
double prof_z0
Lower altitude of gridded profile data [km].
int qnt_w
Quantity array index for vertical velocity.
double bound_vmr
Boundary conditions volume mixing ratio [ppv].
double met_tropo_pv
Dynamical tropopause potential vorticity threshold [PVU].
int prof_nx
Number of longitudes of gridded profile data.
int qnt_stat
Quantity array index for station flag.
double dd_sort_dt
Sorting time interval for the compactification.
int met_tropo
Tropopause definition (0=none, 1=clim, 2=cold point, 3=WMO_1st, 4=WMO_2nd, 5=dynamical).
int qnt_rp
Quantity array index for particle radius.
int met_mpi_share
Use MPI to share meteo (0=no, 1=yes).
double mixing_strat
Interparcel exchange parameter for mixing in the stratosphere.
int qnt_vz
Quantity array index for vertical velocity.
int qnt_ho2
Quantity array index for HO2 volume mixing ratio (climatology).
double csi_z1
Upper altitude of gridded CSI data [km].
double stat_t0
Start time for station output [s].
double oh_chem_beta
Beta parameter for diurnal variablity of OH.
int dd
Domain decomposition (0=no, 1=yes, with 2x2 if not specified).
int qnt_eta
Quantity array index for eta vertical coordinate.
double wet_depo_so2_ph
pH value used to calculate effective Henry constant of SO2.
double mixing_z0
Lower altitude of mixing grid [km].
int qnt_mloss_decay
Quantity array index for total mass loss due to exponential decay.
int atm_type_out
Type of atmospheric data files for output (-1=same as ATM_TYPE, 0=ASCII, 1=binary,...
int met_cms_nd0x
cmultiscale number of cells of coarsest grid in x-direction.
int met_nlev
Number of meteo data model levels.
double dt_kpp
Time step for KPP chemistry [s].
double dry_depo_dp
Dry deposition surface layer [hPa].
int qnt_shf
Quantity array index for surface sensible heat flux.
int qnt_vs
Quantity array index for surface meridional wind.
int qnt_Cco
Quantity array index for CO volume mixing ratio (chemistry code).
double vtk_dt_out
Time step for VTK data output [s].
double t_stop
Stop time of simulation [s].
double conv_dt
Time interval for convection module [s].
int qnt_hno3
Quantity array index for HNO3 volume mixing ratio (climatology).
int met_clams
Read MPTRAC or CLaMS meteo data (0=MPTRAC, 1=CLaMS).
int qnt_h2ot
Quantity array index for tropopause water vapor volume mixing ratio.
int qnt_rh
Quantity array index for relative humidity over water.
int met_gp2z
Convert surface geopotential to geopotential height (0=no, 1=yes).
double bound_lat0
Boundary conditions minimum longitude [deg].
double met_pbl_max
Maximum depth of planetary boundary layer [km].
int met_dx
Stride for longitudes.
int mixing_ny
Number of latitudes of mixing grid.
int met_convention
Meteo data layout (0=[lev, lat, lon], 1=[lon, lat, lev]).
int qnt_zeta_d
Quantity array index for diagnosed zeta vertical coordinate.
int tracer_chem
Switch for first order tracer chemistry module (0=off, 1=on).
double dt_mod
Time step of simulation [s].
int diffusion
Diffusion switch (0=off, 1=on).
int qnt_tnat
Quantity array index for T_NAT.
int qnt_eta_dot
Quantity array index for velocity of eta vertical coordinate.
int qnt_tice
Quantity array index for T_ice.
int turb_pbl_scheme
PBL turbulence scheme (0=none, 1=closure).
int qnt_zg
Quantity array index for geopotential height.
double vtk_offset
Vertical offset for VTK data [km].
int qnt_v
Quantity array index for meridional wind.
int qnt_mloss_dry
Quantity array index for total mass loss due to dry deposition.
double bound_vmr_trend
Boundary conditions volume mixing ratio trend [ppv/s].
int met_cache
Preload meteo data into disk cache (0=no, 1=yes).
int qnt_oh
Quantity array index for OH volume mixing ratio (climatology).
int qnt_Ch
Quantity array index for H volume mixing ratio (chemistry code).
int met_press_level_def
Use predefined pressure levels or not.
int oh_chem_reaction
Reaction type for OH chemistry (0=none, 2=bimolecular, 3=termolecular).
int qnt_h2o
Quantity array index for water vapor volume mixing ratio.
int prof_ny
Number of latitudes of gridded profile data.
int qnt_rhice
Quantity array index for relative humidity over ice.
int qnt_rho
Quantity array index for density of air.
double sample_dz
Layer depth for sample output [km].
double tdec_strat
Life time of particles in the stratosphere [s].
int obs_type
Type of observation data files (0=ASCII, 1=netCDF).
int qnt_us
Quantity array index for surface zonal wind.
double grid_lon1
Upper longitude of gridded data [deg].
int qnt_Cn2o
Quantity array index for N2O volume mixing ratio (chemistry code).
int qnt_Cccl3f
Quantity array index for CFC-11 volume mixing ratio (chemistry code).
int depo_type
DEPO_TYPE of deposition files (0=ASCII, 1=netCDF, default: 0).
double mixing_lat0
Lower latitude of mixing grid [deg].
int nens
Number of ensembles.
int qnt_pt
Quantity array index for tropopause pressure.
int qnt_cl
Quantity array index for total column cloud water.
int advect
Advection scheme (1=Euler, 2=midpoint, 4=Runge-Kutta).
double prof_z1
Upper altitude of gridded profile data [km].
int qnt_t
Quantity array index for temperature.
int atm_filter
Time filter for atmospheric data output (0=none, 1=missval, 2=remove).
int kpp_chem
Switch for KPP chemistry module (0=off, 1=on).
int qnt_zeta
Quantity array index for zeta vertical coordinate.
double conv_pbl_trans
Depth of PBL transition layer (fraction of PBL pressure thickness).
int met_lz4_accel
LZ4 acceleration factor (>=1, default=8).
int qnt_Ai131
Quantity array index for radioactive activity of I-131.
int met_vert_coord
Vertical coordinate of input meteo data (0=plev, 1=mlev_p_file, 2=mlev_ab_file, 3=mlev_ab_full,...
double csi_z0
Lower altitude of gridded CSI data [km].
int qnt_lapse
Quantity array index for lapse rate.
int qnt_Apb210
Quantity array index for radioactive activity of Pb-210.
double stat_lat
Latitude of station [deg].
int qnt_Cho2
Quantity array index for HO2 volume mixing ratio (chemistry code).
int grid_ny
Number of latitudes of gridded data.
int qnt_Csf6
Quantity array index for SF6 volume mixing ratio (chemistry code).
int qnt_Ch2o
Quantity array index for H2O volume mixing ratio (chemistry code).
double met_detrend
FWHM of horizontal Gaussian used for detrending [km].
int conv_mix_pbl
Vertical mixing in the PBL (0=off, 1=on).
double bound_dps
Boundary conditions surface layer depth [hPa].
int chemgrid_nz
Number of altitudes of chemistry grid.
int qnt_cape
Quantity array index for convective available potential energy (CAPE).
int qnt_zeta_dot
Quantity array index for velocity of zeta vertical coordinate.
double bound_mass_trend
Boundary conditions mass per particle trend [kg/s].
int met_cms_nd0y
cmultiscale number of cells of coarsest grid in y-direction.
int mixing_nz
Number of altitudes of mixing grid.
int qnt_o3c
Quantity array index for total column ozone.
double bound_p0
Boundary conditions bottom pressure [hPa].
double mixing_lon0
Lower longitude of mixing grid [deg].
int qnt_Co3
Quantity array index for O3 volume mixing ratio (chemistry code).
int qnt_tsts
Quantity array index for T_STS.
int grid_nz
Number of altitudes of gridded data.
int qnt_nss
Quantity array index for northward turbulent surface stress.
double ens_dt_out
Time step for ensemble output [s].
int atm_stride
Particle index stride for atmospheric data files.
int met_relhum
Try to read relative humidity (0=no, 1=yes).
double mixing_lat1
Upper latitude of mixing grid [deg].
double atm_dt_out
Time step for atmospheric data output [s].
double prof_lat1
Upper latitude of gridded profile data [deg].
int qnt_current_subdomain
Quantity array index for current subdomain in domain decomposition.
int met_cms_batch
cmultiscale batch size.
double psc_h2o
H2O volume mixing ratio for PSC analysis.
int met_sp
Smoothing for pressure levels.
double prof_lon0
Lower longitude of gridded profile data [deg].
int qnt_Axe133
Quantity array index for radioactive activity of Xe-133.
int chemgrid_nx
Number of longitudes of chemistry grid.
int qnt_pct
Quantity array index for cloud top pressure.
int qnt_mloss_kpp
Quantity array index for total mass loss due to KPP chemistry.
int qnt_psat
Quantity array index for saturation pressure over water.
double prof_lat0
Lower latitude of gridded profile data [deg].
int qnt_cin
Quantity array index for convective inhibition (CIN).
double turb_pbl_trans
Depth of turbulent PBL transition layer (fraction of PBL pressure thickness).
double psc_hno3
HNO3 volume mixing ratio for PSC analysis.
double prof_lon1
Upper longitude of gridded profile data [deg].
int met_nc_quant
Number of digits for quantization of netCDF meteo files (0=off).
int h2o2_chem_reaction
Reaction type for H2O2 chemistry (0=none, 1=SO2).
int qnt_Co3p
Quantity array index for O(3P) volume mixing ratio (chemistry code).
double wet_depo_bc_ret_ratio
Coefficients for wet deposition below cloud: retention ratio.
int chemgrid_ny
Number of latitudes of chemistry grid.
int qnt_Abe7
Quantity array index for radioactive activity of Be-7.
int met_cms_zstd
cmultiscale ZSTD compression (0=off, 1=on).
int met_cms_maxlev
cmultiscale maximum refinement level.
int grid_sparse
Sparse output in grid data files (0=no, 1=yes).
double dry_depo_vdep
Dry deposition velocity [m/s].
int qnt_tt
Quantity array index for tropopause temperature.
int met_np
Number of target pressure levels.
int qnt_ens
Quantity array index for ensemble IDs.
int met_nc_level
zlib compression level of netCDF meteo files (0=off).
double mixing_dt
Time interval for mixing [s].
int qnt_Arn222
Quantity array index for radioactive activity of Rn-222.
int qnt_mloss_h2o2
Quantity array index for total mass loss due to H2O2 chemistry.
double vtk_scale
Vertical scaling factor for VTK data.
double turb_dx_pbl
Horizontal turbulent diffusion coefficient (PBL) [m^2/s].
double conv_cin
CIN threshold for convection module [J/kg].
int qnt_pv
Quantity array index for potential vorticity.
int advect_vert_coord
Vertical velocity of air parcels (0=omega_on_plev, 1=zetadot_on_mlev, 2=omega_on_mlev,...
int qnt_mloss_oh
Quantity array index for total mass loss due to OH chemistry.
int qnt_Ch2o2
Quantity array index for H2O2 volume mixing ratio (chemistry code).
int qnt_sst
Quantity array index for sea surface temperature.
double mixing_lon1
Upper longitude of mixing grid [deg].
int atm_nc_level
zlib compression level of netCDF atmospheric data files (0=off).
double wet_depo_ic_ret_ratio
Coefficients for wet deposition in cloud: retention ratio.
int qnt_sh
Quantity array index for specific humidity.
int met_coord_type
Type of coordinates for meteo data (-1=detect, 0=lat/lon [deg], 1=UTM [m]).
int qnt_ess
Quantity array index for eastward turbulent surface stress.
double wet_depo_ic_b
Coefficient B for wet deposition in cloud (exponential form).
double wet_depo_bc_b
Coefficient B for wet deposition below cloud (exponential form).
int met_dy
Stride for latitudes.
int qnt_Cx
Quantity array index for trace species x volume mixing ratio (chemistry code).
double turb_dz_strat
Vertical turbulent diffusion coefficient (stratosphere) [m^2/s].
double bound_zetas
Boundary conditions surface layer zeta [K].
int radio_depo
RADIO_DEPO switch for radionuclide deposition (0=off, 1=on, default: 0).
int dd_subdomains_zonal
Domain decomposition zonal subdomain number.
int qnt_idx
Quantity array index for air parcel IDs.
double met_tropo_theta
Dynamical tropopause potential temperature threshold [K].
int qnt_rwc
Quantity array index for cloud rain water content.
double t_start
Start time of simulation [s].
int nq
Number of quantities.
double tdec_trop
Life time of particles in the troposphere [s].
double sample_dx
Horizontal radius for sample output [km].
int vtk_stride
Particle index stride for VTK data.
double turb_dz_pbl
Vertical turbulent diffusion coefficient (PBL) [m^2/s].
double grid_lat1
Upper latitude of gridded data [deg].
int dd_subdomains_meridional
Domain decomposition meridional subdomain number.
int qnt_zt
Quantity array index for tropopause geopotential height.
int met_type
Type of meteo data files (0=netCDF, 1=binary, 2=pck, 3=ZFP, 4=ZSTD, 5=cms, 6=grib,...
int qnt_cc
Quantity array index for cloud cover.
int qnt_plcl
Quantity array index for pressure at lifted condensation level (LCL).
double grid_dt_out
Time step for gridded data output [s].
int qnt_tdew
Quantity array index for dew point temperature.
Domain decomposition data structure.
int halo_offset_end
Offset of the periodic halo block at the end of the local x-array.
int nx_glob
Number of global longitudes.
int halo_offset_start
Offset of the periodic halo block at the beginning of the local x-array.
int ny_glob
Number of global latitudes.
Ground inventories of deposited radionuclides.
int nx
Number of longitudes.
int ny
Number of latitudes.
int np
Number of pressure levels.
int npl
Number of model levels.
double lat
Latitude [deg].
double lon
Longitude [deg].