MPTRAC
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-2025 Forschungszentrum Juelich GmbH
18*/
19
116#ifndef LIBTRAC_H
117#define LIBTRAC_H
118
119/* ------------------------------------------------------------
120 Includes...
121 ------------------------------------------------------------ */
122
123#include <ctype.h>
124#include <gsl/gsl_fft_complex.h>
125#include <gsl/gsl_math.h>
126#include <gsl/gsl_randist.h>
127#include <gsl/gsl_rng.h>
128#include <gsl/gsl_sort.h>
129#include <gsl/gsl_spline.h>
130#include <gsl/gsl_statistics.h>
131#include <math.h>
132#include <netcdf.h>
133#include <omp.h>
134#include <stdint.h>
135#include <stdio.h>
136#include <stdlib.h>
137#include <string.h>
138#include <time.h>
139#include <sys/time.h>
140
141#ifdef MPI
142#include "mpi.h"
143#else
145#define MPI_Datatype void*
146#endif
147
148#ifdef DD
149#include <netcdf_par.h>
150#endif
151
152#ifdef _OPENACC
153#include "openacc.h"
154#endif
155
156#ifdef CURAND
157#include "curand.h"
158#endif
159
160#ifdef THRUST
161#include "thrustsort.h"
162#endif
163
164#ifdef ZFP
165#include "zfp.h"
166#endif
167
168#ifdef ZSTD
169#include "zstd.h"
170#endif
171
172#ifdef SZ3
173#include "SZ3c/sz3c.h"
174#endif
175
176#ifdef CMS
177#include "cmultiscale.h"
178#endif
179
180#ifdef KPP
181#include "chem_Parameters.h"
182#include "chem_Global.h"
183#include "chem_Sparse.h"
184#endif
185
186#ifdef ECCODES
187#include "eccodes.h"
188#else
190#define codes_handle void*
191#endif
192
193/* ------------------------------------------------------------
194 Constants...
195 ------------------------------------------------------------ */
196
198#ifndef AVO
199#define AVO 6.02214076e23
200#endif
201
203#ifndef CPD
204#define CPD 1003.5
205#endif
206
208#ifndef EPS
209#define EPS (MH2O / MA)
210#endif
211
213#ifndef G0
214#define G0 9.80665
215#endif
216
218#ifndef H0
219#define H0 7.0
220#endif
221
223#ifndef LV
224#define LV 2501000.
225#endif
226
228#ifndef KARMAN
229#define KARMAN 0.40
230#endif
231
233#ifndef KB
234#define KB 1.3806504e-23
235#endif
236
238#ifndef MA
239#define MA 28.9644
240#endif
241
243#ifndef MH2O
244#define MH2O 18.01528
245#endif
246
248#ifndef MO3
249#define MO3 48.00
250#endif
251
253#ifndef P0
254#define P0 1013.25
255#endif
256
258#ifndef RA
259#define RA (1e3 * RI / MA)
260#endif
261
263#ifndef RE
264#define RE 6367.421
265#endif
266
268#ifndef RI
269#define RI 8.3144598
270#endif
271
273#ifndef T0
274#define T0 273.15
275#endif
276
277/* ------------------------------------------------------------
278 Dimensions...
279 ------------------------------------------------------------ */
280
282#ifndef EP
283#define EP 140
284#endif
285
287#ifndef EX
288#define EX 1444
289#endif
290
292#ifndef EY
293#define EY 724
294#endif
295
297#ifndef LEN
298#define LEN 5000
299#endif
300
302#ifndef METVAR
303#define METVAR 13
304#endif
305
307#ifndef NP
308#define NP 10000000
309#endif
310
312#ifndef NQ
313#define NQ 15
314#endif
315
317#ifndef NCSI
318#define NCSI 1000000
319#endif
320
322#ifndef NENS
323#define NENS 2000
324#endif
325
327#ifndef NOBS
328#define NOBS 10000000
329#endif
330
332#ifndef NTHREADS
333#define NTHREADS 512
334#endif
335
337#ifndef CY
338#define CY 250
339#endif
340
342#ifndef CO3
343#define CO3 30
344#endif
345
347#ifndef CP
348#define CP 70
349#endif
350
352#ifndef CSZA
353#define CSZA 50
354#endif
355
357#ifndef CT
358#define CT 12
359#endif
360
362#ifndef CTS
363#define CTS 1000
364#endif
365
367#ifndef DD_NPART
368#define DD_NPART 100000
369#endif
370
372#ifndef DD_NNMAX
373#define DD_NNMAX 26
374#endif
375
377#ifndef DD_NPOLE
378#define DD_NPOLE -2
379#endif
380
382#ifndef DD_SPOLE
383#define DD_SPOLE -3
384#endif
385
386/* ------------------------------------------------------------
387 Macros...
388 ------------------------------------------------------------ */
389
409#ifdef _OPENACC
410#define ALLOC(ptr, type, n) \
411 if(acc_get_num_devices(acc_device_nvidia) <= 0) \
412 ERRMSG("Not running on a GPU device!"); \
413 if((ptr=calloc((size_t)(n), sizeof(type)))==NULL) \
414 ERRMSG("Out of memory!");
415#else
416#define ALLOC(ptr, type, n) \
417 if((ptr=calloc((size_t)(n), sizeof(type)))==NULL) \
418 ERRMSG("Out of memory!");
419#endif
420
439#define ARRAY_2D(ix, iy, ny) \
440 ((ix) * (ny) + (iy))
441
458#define ARRAY_3D(ix, iy, ny, iz, nz) \
459 (((ix)*(ny) + (iy)) * (nz) + (iz))
460
483#define ARRHENIUS(a, b, t) \
484 ((a) * exp( -(b) / (t)))
485
505#define CLAMP(v, lo, hi) \
506 (((v) < (lo)) ? (lo) : (((v) > (hi)) ? (hi) : (v)))
507
529#define DEG2DX(dlon, lat) \
530 (RE * DEG2RAD(dlon) * cos(DEG2RAD(lat)))
531
550#define DEG2DY(dlat) \
551 (RE * DEG2RAD(dlat))
552
567#define DEG2RAD(deg) \
568 ((deg) * (M_PI / 180.0))
569
592#define DP2DZ(dp, p) \
593 (- (dp) * H0 / (p))
594
614#define DX2DEG(dx, lat) \
615 (((lat) < -89.999 || (lat) > 89.999) ? 0 \
616 : (dx) * 180. / (M_PI * RE * cos(DEG2RAD(lat))))
617
632#define DY2DEG(dy) \
633 ((dy) * 180. / (M_PI * RE))
634
651#define DZ2DP(dz, p) \
652 (-(dz) * (p) / H0)
653
667#define DIST(a, b) \
668 sqrt(DIST2(a, b))
669
683#define DIST2(a, b) \
684 ((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])+(a[2]-b[2])*(a[2]-b[2]))
685
699#define DOTP(a, b) \
700 (a[0]*b[0]+a[1]*b[1]+a[2]*b[2])
701
713#define ECC(cmd) { \
714 int ecc_result=(cmd); \
715 if(ecc_result!=0) \
716 ERRMSG("ECCODES error: %s", codes_get_error_message(ecc_result)); \
717 }
718
732#define ECC_READ_2D(variable, target, scaling_factor, found_flag) { \
733 if(strcmp(short_name, variable) == 0) { \
734 for (int ix = 0; ix < met->nx; ix++) \
735 for (int iy = 0; iy < met->ny; iy++) \
736 target[ix][iy] = (float)(values[iy * met->nx + ix] * scaling_factor); \
737 found_flag = 1; \
738 } \
739 }
740
755#define ECC_READ_3D(variable, level, target, scaling_factor, found_flag) { \
756 if(strcmp(short_name, variable) == 0) { \
757 for (int ix = 0; ix < met->nx; ix++) \
758 for (int iy = 0; iy < met->ny; iy++) \
759 target[ix][iy][level] = (float) (values[iy * met->nx + ix] * scaling_factor); \
760 found_flag += 1; \
761 } \
762 }
763
780#define FMOD(x, y) \
781 ((x) - (int) ((x) / (y)) * (y))
782
798#define FREAD(ptr, type, size, in) { \
799 if(fread(ptr, sizeof(type), size, in)!=size) \
800 ERRMSG("Error while reading!"); \
801 }
802
818#define FWRITE(ptr, type, size, out) { \
819 if(fwrite(ptr, sizeof(type), size, out)!=size) \
820 ERRMSG("Error while writing!"); \
821 }
822
833#define INTPOL_INIT \
834 double cw[4] = {0.0, 0.0, 0.0, 0.0}; int ci[3] = {0, 0, 0};
835
847#define INTPOL_2D(var, init) \
848 intpol_met_time_2d(met0, met0->var, met1, met1->var, \
849 atm->time[ip], atm->lon[ip], atm->lat[ip], \
850 &var, ci, cw, init);
851
864#define INTPOL_3D(var, init) \
865 intpol_met_time_3d(met0, met0->var, met1, met1->var, \
866 atm->time[ip], atm->p[ip], \
867 atm->lon[ip], atm->lat[ip], \
868 &var, ci, cw, init);
869
883#define INTPOL_SPACE_ALL(p, lon, lat) { \
884 intpol_met_space_3d(met, met->z, p, lon, lat, &z, ci, cw, 1); \
885 intpol_met_space_3d(met, met->t, p, lon, lat, &t, ci, cw, 0); \
886 intpol_met_space_3d(met, met->u, p, lon, lat, &u, ci, cw, 0); \
887 intpol_met_space_3d(met, met->v, p, lon, lat, &v, ci, cw, 0); \
888 intpol_met_space_3d(met, met->w, p, lon, lat, &w, ci, cw, 0); \
889 intpol_met_space_3d(met, met->pv, p, lon, lat, &pv, ci, cw, 0); \
890 intpol_met_space_3d(met, met->h2o, p, lon, lat, &h2o, ci, cw, 0); \
891 intpol_met_space_3d(met, met->o3, p, lon, lat, &o3, ci, cw, 0); \
892 intpol_met_space_3d(met, met->lwc, p, lon, lat, &lwc, ci, cw, 0); \
893 intpol_met_space_3d(met, met->rwc, p, lon, lat, &rwc, ci, cw, 0); \
894 intpol_met_space_3d(met, met->iwc, p, lon, lat, &iwc, ci, cw, 0); \
895 intpol_met_space_3d(met, met->swc, p, lon, lat, &swc, ci, cw, 0); \
896 intpol_met_space_3d(met, met->cc, p, lon, lat, &cc, ci, cw, 0); \
897 intpol_met_space_2d(met, met->ps, lon, lat, &ps, ci, cw, 0); \
898 intpol_met_space_2d(met, met->ts, lon, lat, &ts, ci, cw, 0); \
899 intpol_met_space_2d(met, met->zs, lon, lat, &zs, ci, cw, 0); \
900 intpol_met_space_2d(met, met->us, lon, lat, &us, ci, cw, 0); \
901 intpol_met_space_2d(met, met->vs, lon, lat, &vs, ci, cw, 0); \
902 intpol_met_space_2d(met, met->ess, ess, lat, &ess, ci, cw, 0); \
903 intpol_met_space_2d(met, met->nss, nss, lat, &nss, ci, cw, 0); \
904 intpol_met_space_2d(met, met->shf, shf, lat, &shf, ci, cw, 0); \
905 intpol_met_space_2d(met, met->lsm, lon, lat, &lsm, ci, cw, 0); \
906 intpol_met_space_2d(met, met->sst, lon, lat, &sst, ci, cw, 0); \
907 intpol_met_space_2d(met, met->pbl, lon, lat, &pbl, ci, cw, 0); \
908 intpol_met_space_2d(met, met->pt, lon, lat, &pt, ci, cw, 0); \
909 intpol_met_space_2d(met, met->tt, lon, lat, &tt, ci, cw, 0); \
910 intpol_met_space_2d(met, met->zt, lon, lat, &zt, ci, cw, 0); \
911 intpol_met_space_2d(met, met->h2ot, lon, lat, &h2ot, ci, cw, 0); \
912 intpol_met_space_2d(met, met->pct, lon, lat, &pct, ci, cw, 0); \
913 intpol_met_space_2d(met, met->pcb, lon, lat, &pcb, ci, cw, 0); \
914 intpol_met_space_2d(met, met->cl, lon, lat, &cl, ci, cw, 0); \
915 intpol_met_space_2d(met, met->plcl, lon, lat, &plcl, ci, cw, 0); \
916 intpol_met_space_2d(met, met->plfc, lon, lat, &plfc, ci, cw, 0); \
917 intpol_met_space_2d(met, met->pel, lon, lat, &pel, ci, cw, 0); \
918 intpol_met_space_2d(met, met->cape, lon, lat, &cape, ci, cw, 0); \
919 intpol_met_space_2d(met, met->cin, lon, lat, &cin, ci, cw, 0); \
920 intpol_met_space_2d(met, met->o3c, lon, lat, &o3c, ci, cw, 0); \
921 }
922
937#define INTPOL_TIME_ALL(time, p, lon, lat) { \
938 intpol_met_time_3d(met0, met0->z, met1, met1->z, time, p, lon, lat, &z, ci, cw, 1); \
939 intpol_met_time_3d(met0, met0->t, met1, met1->t, time, p, lon, lat, &t, ci, cw, 0); \
940 intpol_met_time_3d(met0, met0->u, met1, met1->u, time, p, lon, lat, &u, ci, cw, 0); \
941 intpol_met_time_3d(met0, met0->v, met1, met1->v, time, p, lon, lat, &v, ci, cw, 0); \
942 intpol_met_time_3d(met0, met0->w, met1, met1->w, time, p, lon, lat, &w, ci, cw, 0); \
943 intpol_met_time_3d(met0, met0->pv, met1, met1->pv, time, p, lon, lat, &pv, ci, cw, 0); \
944 intpol_met_time_3d(met0, met0->h2o, met1, met1->h2o, time, p, lon, lat, &h2o, ci, cw, 0); \
945 intpol_met_time_3d(met0, met0->o3, met1, met1->o3, time, p, lon, lat, &o3, ci, cw, 0); \
946 intpol_met_time_3d(met0, met0->lwc, met1, met1->lwc, time, p, lon, lat, &lwc, ci, cw, 0); \
947 intpol_met_time_3d(met0, met0->rwc, met1, met1->rwc, time, p, lon, lat, &rwc, ci, cw, 0); \
948 intpol_met_time_3d(met0, met0->iwc, met1, met1->iwc, time, p, lon, lat, &iwc, ci, cw, 0); \
949 intpol_met_time_3d(met0, met0->swc, met1, met1->swc, time, p, lon, lat, &swc, ci, cw, 0); \
950 intpol_met_time_3d(met0, met0->cc, met1, met1->cc, time, p, lon, lat, &cc, ci, cw, 0); \
951 intpol_met_time_2d(met0, met0->ps, met1, met1->ps, time, lon, lat, &ps, ci, cw, 0); \
952 intpol_met_time_2d(met0, met0->ts, met1, met1->ts, time, lon, lat, &ts, ci, cw, 0); \
953 intpol_met_time_2d(met0, met0->zs, met1, met1->zs, time, lon, lat, &zs, ci, cw, 0); \
954 intpol_met_time_2d(met0, met0->us, met1, met1->us, time, lon, lat, &us, ci, cw, 0); \
955 intpol_met_time_2d(met0, met0->vs, met1, met1->vs, time, lon, lat, &vs, ci, cw, 0); \
956 intpol_met_time_2d(met0, met0->ess, met1, met1->ess, time, lon, lat, &ess, ci, cw, 0); \
957 intpol_met_time_2d(met0, met0->nss, met1, met1->nss, time, lon, lat, &nss, ci, cw, 0); \
958 intpol_met_time_2d(met0, met0->shf, met1, met1->shf, time, lon, lat, &shf, ci, cw, 0); \
959 intpol_met_time_2d(met0, met0->lsm, met1, met1->lsm, time, lon, lat, &lsm, ci, cw, 0); \
960 intpol_met_time_2d(met0, met0->sst, met1, met1->sst, time, lon, lat, &sst, ci, cw, 0); \
961 intpol_met_time_2d(met0, met0->pbl, met1, met1->pbl, time, lon, lat, &pbl, ci, cw, 0); \
962 intpol_met_time_2d(met0, met0->pt, met1, met1->pt, time, lon, lat, &pt, ci, cw, 0); \
963 intpol_met_time_2d(met0, met0->tt, met1, met1->tt, time, lon, lat, &tt, ci, cw, 0); \
964 intpol_met_time_2d(met0, met0->zt, met1, met1->zt, time, lon, lat, &zt, ci, cw, 0); \
965 intpol_met_time_2d(met0, met0->h2ot, met1, met1->h2ot, time, lon, lat, &h2ot, ci, cw, 0); \
966 intpol_met_time_2d(met0, met0->pct, met1, met1->pct, time, lon, lat, &pct, ci, cw, 0); \
967 intpol_met_time_2d(met0, met0->pcb, met1, met1->pcb, time, lon, lat, &pcb, ci, cw, 0); \
968 intpol_met_time_2d(met0, met0->cl, met1, met1->cl, time, lon, lat, &cl, ci, cw, 0); \
969 intpol_met_time_2d(met0, met0->plcl, met1, met1->plcl, time, lon, lat, &plcl, ci, cw, 0); \
970 intpol_met_time_2d(met0, met0->plfc, met1, met1->plfc, time, lon, lat, &plfc, ci, cw, 0); \
971 intpol_met_time_2d(met0, met0->pel, met1, met1->pel, time, lon, lat, &pel, ci, cw, 0); \
972 intpol_met_time_2d(met0, met0->cape, met1, met1->cape, time, lon, lat, &cape, ci, cw, 0); \
973 intpol_met_time_2d(met0, met0->cin, met1, met1->cin, time, lon, lat, &cin, ci, cw, 0); \
974 intpol_met_time_2d(met0, met0->o3c, met1, met1->o3c, time, lon, lat, &o3c, ci, cw, 0); \
975 }
976
991#define LAPSE(p1, t1, p2, t2) \
992 (1e3 * G0 / RA * ((t2) - (t1)) / ((t2) + (t1)) \
993 * ((p2) + (p1)) / ((p2) - (p1)))
994
1010#define LIN(x0, y0, x1, y1, x) \
1011 ((y0)+((y1)-(y0))/((x1)-(x0))*((x)-(x0)))
1012
1037#define MAX(a,b) \
1038 (((a)>(b))?(a):(b))
1039
1051#define MET_HEADER \
1052 fprintf(out, \
1053 "# $1 = time [s]\n" \
1054 "# $2 = altitude [km]\n" \
1055 "# $3 = longitude [deg]\n" \
1056 "# $4 = latitude [deg]\n" \
1057 "# $5 = pressure [hPa]\n" \
1058 "# $6 = temperature [K]\n" \
1059 "# $7 = zonal wind [m/s]\n" \
1060 "# $8 = meridional wind [m/s]\n" \
1061 "# $9 = vertical velocity [hPa/s]\n" \
1062 "# $10 = H2O volume mixing ratio [ppv]\n"); \
1063 fprintf(out, \
1064 "# $11 = O3 volume mixing ratio [ppv]\n" \
1065 "# $12 = geopotential height [km]\n" \
1066 "# $13 = potential vorticity [PVU]\n" \
1067 "# $14 = surface pressure [hPa]\n" \
1068 "# $15 = surface temperature [K]\n" \
1069 "# $16 = surface geopotential height [km]\n" \
1070 "# $17 = surface zonal wind [m/s]\n" \
1071 "# $18 = surface meridional wind [m/s]\n" \
1072 "# $19 = eastward turbulent surface stress [N/m^2]\n" \
1073 "# $20 = northward turbulent surface stress [N/m^2]\n"); \
1074 fprintf(out, \
1075 "# $21 = surface sensible heat flux [W/m^2]\n" \
1076 "# $22 = land-sea mask [1]\n" \
1077 "# $23 = sea surface temperature [K]\n" \
1078 "# $24 = tropopause pressure [hPa]\n" \
1079 "# $25 = tropopause geopotential height [km]\n" \
1080 "# $26 = tropopause temperature [K]\n" \
1081 "# $27 = tropopause water vapor [ppv]\n" \
1082 "# $28 = cloud liquid water content [kg/kg]\n" \
1083 "# $29 = cloud rain water content [kg/kg]\n" \
1084 "# $30 = cloud ice water content [kg/kg]\n"); \
1085 fprintf(out, \
1086 "# $31 = cloud snow water content [kg/kg]\n" \
1087 "# $32 = cloud cover [1]\n" \
1088 "# $33 = total column cloud water [kg/m^2]\n" \
1089 "# $34 = cloud top pressure [hPa]\n" \
1090 "# $35 = cloud bottom pressure [hPa]\n" \
1091 "# $36 = pressure at lifted condensation level (LCL) [hPa]\n" \
1092 "# $37 = pressure at level of free convection (LFC) [hPa]\n" \
1093 "# $38 = pressure at equilibrium level (EL) [hPa]\n" \
1094 "# $39 = convective available potential energy (CAPE) [J/kg]\n" \
1095 "# $40 = convective inhibition (CIN) [J/kg]\n"); \
1096 fprintf(out, \
1097 "# $41 = relative humidity over water [%%]\n" \
1098 "# $42 = relative humidity over ice [%%]\n" \
1099 "# $43 = dew point temperature [K]\n" \
1100 "# $44 = frost point temperature [K]\n" \
1101 "# $45 = NAT temperature [K]\n" \
1102 "# $46 = HNO3 volume mixing ratio [ppv]\n" \
1103 "# $47 = OH volume mixing ratio [ppv]\n" \
1104 "# $48 = H2O2 volume mixing ratio [ppv]\n" \
1105 "# $49 = HO2 volume mixing ratio [ppv]\n" \
1106 "# $50 = O(1D) volume mixing ratio [ppv]\n"); \
1107 fprintf(out, \
1108 "# $51 = boundary layer pressure [hPa]\n" \
1109 "# $52 = total column ozone [DU]\n" \
1110 "# $53 = number of data points\n" \
1111 "# $54 = number of tropopause data points\n" \
1112 "# $55 = number of CAPE data points\n");
1113
1138#define MIN(a,b) \
1139 (((a)<(b))?(a):(b))
1140
1153#define MOLEC_DENS(p,t) \
1154 (AVO * 1e-6 * ((p) * 100) / (RI * (t)))
1155
1167#define NC(cmd) { \
1168 int nc_result=(cmd); \
1169 if(nc_result!=NC_NOERR) \
1170 ERRMSG("%s", nc_strerror(nc_result)); \
1171 }
1172
1196#define NC_DEF_VAR(varname, type, ndims, dims, long_name, units, level, quant) { \
1197 NC(nc_def_var(ncid, varname, type, ndims, dims, &varid)); \
1198 NC(nc_put_att_text(ncid, varid, "long_name", strnlen(long_name, LEN), long_name)); \
1199 NC(nc_put_att_text(ncid, varid, "units", strnlen(units, LEN), units)); \
1200 if((quant) > 0) \
1201 NC(nc_def_var_quantize(ncid, varid, NC_QUANTIZE_GRANULARBR, quant)); \
1202 if((level) != 0) { \
1203 NC(nc_def_var_deflate(ncid, varid, 1, 1, level)); \
1204 /* unsigned int ulevel = (unsigned int)level; */ \
1205 /* NC(nc_def_var_filter(ncid, varid, 32015, 1, (unsigned int[]){ulevel})); */ \
1206 } \
1207 }
1208
1226#define NC_GET_DOUBLE(varname, ptr, force) { \
1227 if(force) { \
1228 NC(nc_inq_varid(ncid, varname, &varid)); \
1229 NC(nc_get_var_double(ncid, varid, ptr)); \
1230 } else { \
1231 if(nc_inq_varid(ncid, varname, &varid) == NC_NOERR) { \
1232 NC(nc_get_var_double(ncid, varid, ptr)); \
1233 } else \
1234 WARN("netCDF variable %s is missing!", varname); \
1235 } \
1236 }
1237
1256#define NC_INQ_DIM(dimname, ptr, min, max, check) { \
1257 int dimid; size_t naux; \
1258 NC(nc_inq_dimid(ncid, dimname, &dimid)); \
1259 NC(nc_inq_dimlen(ncid, dimid, &naux)); \
1260 *ptr = (int)naux; \
1261 if (check) \
1262 if ((*ptr) < (min) || (*ptr) > (max)) \
1263 ERRMSG("Dimension %s is out of range!", dimname); \
1264 }
1265
1280#define NC_PUT_DOUBLE(varname, ptr, hyperslab) { \
1281 NC(nc_inq_varid(ncid, varname, &varid)); \
1282 if(hyperslab) { \
1283 NC(nc_put_vara_double(ncid, varid, start, count, ptr)); \
1284 } else { \
1285 NC(nc_put_var_double(ncid, varid, ptr)); \
1286 } \
1287 }
1288
1304#define NC_PUT_FLOAT(varname, ptr, hyperslab) { \
1305 NC(nc_inq_varid(ncid, varname, &varid)); \
1306 if(hyperslab) { \
1307 NC(nc_put_vara_float(ncid, varid, start, count, ptr)); \
1308 } else { \
1309 NC(nc_put_var_float(ncid, varid, ptr)); \
1310 } \
1311 }
1312
1327#define NC_PUT_INT(varname, ptr, hyperslab) { \
1328 NC(nc_inq_varid(ncid, varname, &varid)); \
1329 if(hyperslab) { \
1330 NC(nc_put_vara_int(ncid, varid, start, count, ptr)); \
1331 } else { \
1332 NC(nc_put_var_int(ncid, varid, ptr)); \
1333 } \
1334 }
1335
1349#define NC_PUT_ATT(varname, attname, text) { \
1350 NC(nc_inq_varid(ncid, varname, &varid)); \
1351 NC(nc_put_att_text(ncid, varid, attname, strnlen(text, LEN), text)); \
1352 }
1353
1366#define NC_PUT_ATT_GLOBAL(attname, text) \
1367 NC(nc_put_att_text(ncid, NC_GLOBAL, attname, strnlen(text, LEN), text));
1368
1386#define NN(x0, y0, x1, y1, x) \
1387 (fabs((x) - (x0)) <= fabs((x) - (x1)) ? (y0) : (y1))
1388
1404#ifdef _OPENACC
1405#define PARTICLE_LOOP(ip0, ip1, check_dt, ...) \
1406 const int ip0_const = ip0; \
1407 const int ip1_const = ip1; \
1408 _Pragma(__VA_ARGS__) \
1409 _Pragma("acc parallel loop independent gang vector") \
1410 for (int ip = ip0_const; ip < ip1_const; ip++) \
1411 if (!check_dt || cache->dt[ip] != 0)
1412#else
1413#define PARTICLE_LOOP(ip0, ip1, check_dt, ...) \
1414 const int ip0_const = ip0; \
1415 const int ip1_const = ip1; \
1416 _Pragma("omp parallel for default(shared)") \
1417 for (int ip = ip0_const; ip < ip1_const; ip++) \
1418 if (!check_dt || cache->dt[ip] != 0)
1419#endif
1420
1443#define P(z) \
1444 (P0 * exp(-(z) / H0))
1445
1467#define PSAT(t) \
1468 (6.112 * exp(17.62 * ((t) - T0) / (243.12 + (t) - T0)))
1469
1491#define PSICE(t) \
1492 (6.112 * exp(22.46 * ((t) - T0) / (272.62 + (t) - T0)))
1493
1518#define PW(p, h2o) \
1519 ((p) * MAX((h2o), 0.1e-6) / (1. + (1. - EPS) * MAX((h2o), 0.1e-6)))
1520
1535#define RAD2DEG(rad) \
1536 ((rad) * (180.0 / M_PI))
1537
1565#define RH(p, t, h2o) \
1566 (PW(p, h2o) / PSAT(t) * 100.)
1567
1595#define RHICE(p, t, h2o) \
1596 (PW(p, h2o) / PSICE(t) * 100.)
1597
1620#define RHO(p, t) \
1621 (100. * (p) / (RA * (t)))
1622
1639#define SET_ATM(qnt, val) \
1640 if (ctl->qnt >= 0) \
1641 atm->q[ctl->qnt][ip] = val;
1642
1662#define SET_QNT(qnt, name, longname, unit) \
1663 if (strcasecmp(ctl->qnt_name[iq], name) == 0) { \
1664 ctl->qnt = iq; \
1665 sprintf(ctl->qnt_longname[iq], longname); \
1666 sprintf(ctl->qnt_unit[iq], unit); \
1667 } else
1668
1683#define SH(h2o) \
1684 (EPS * MAX((h2o), 0.1e-6))
1685
1696#define SQR(x) \
1697 ((x)*(x))
1698
1710#define SWAP(x, y, type) \
1711 do {type tmp = x; x = y; y = tmp;} while(0);
1712
1734#define TDEW(p, h2o) \
1735 (T0 + 243.12 * log(PW((p), (h2o)) / 6.112) \
1736 / (17.62 - log(PW((p), (h2o)) / 6.112)))
1737
1759#define TICE(p, h2o) \
1760 (T0 + 272.62 * log(PW((p), (h2o)) / 6.112) \
1761 / (22.46 - log(PW((p), (h2o)) / 6.112)))
1762
1783#define THETA(p, t) \
1784 ((t) * pow(1000. / (p), 0.286))
1785
1812#define THETAVIRT(p, t, h2o) \
1813 (TVIRT(THETA((p), (t)), MAX((h2o), 0.1e-6)))
1814
1833#define TOK(line, tok, format, var) { \
1834 if(((tok)=strtok((line), " \t"))) { \
1835 if(sscanf(tok, format, &(var))!=1) continue; \
1836 } else ERRMSG("Error while reading!"); \
1837 }
1838
1858#define TVIRT(t, h2o) \
1859 ((t) * (1. + (1. - EPS) * MAX((h2o), 0.1e-6)))
1860
1880#define Z(p) \
1881 (H0 * log(P0 / (p)))
1882
1911#define ZDIFF(lnp0, t0, h2o0, lnp1, t1, h2o1) \
1912 (RI / MA / G0 * 0.5 * (TVIRT((t0), (h2o0)) + TVIRT((t1), (h2o1))) \
1913 * ((lnp0) - (lnp1)))
1914
1930#define ZETA(ps, p, t) \
1931 (((p) / (ps) <= 0.3 ? 1. : \
1932 sin(M_PI / 2. * (1. - (p) / (ps)) / (1. - 0.3))) \
1933 * THETA((p), (t)))
1934
1935/* ------------------------------------------------------------
1936 Log messages...
1937 ------------------------------------------------------------ */
1938
1940#ifndef LOGLEV
1941#define LOGLEV 2
1942#endif
1943
1973#define LOG(level, ...) { \
1974 if(level >= 2) \
1975 printf(" "); \
1976 if(level <= LOGLEV) { \
1977 printf(__VA_ARGS__); \
1978 printf("\n"); \
1979 } \
1980 }
1981
2010#define WARN(...) { \
2011 printf("\nWarning (%s, %s, l%d): ", __FILE__, __func__, __LINE__); \
2012 LOG(0, __VA_ARGS__); \
2013 }
2014
2043#define ERRMSG(...) { \
2044 printf("\nError (%s, %s, l%d): ", __FILE__, __func__, __LINE__); \
2045 LOG(0, __VA_ARGS__); \
2046 exit(EXIT_FAILURE); \
2047 }
2048
2078#define PRINT(format, var) \
2079 printf("Print (%s, %s, l%d): %s= "format"\n", \
2080 __FILE__, __func__, __LINE__, #var, var);
2081
2082/* ------------------------------------------------------------
2083 Timers...
2084 ------------------------------------------------------------ */
2085
2087#define NTIMER 100
2088
2102#define PRINT_TIMERS \
2103 timer("END", "END", 1);
2104
2123#define SELECT_TIMER(id, group, color) { \
2124 NVTX_POP; \
2125 NVTX_PUSH(id, color); \
2126 timer(id, group, 0); \
2127 }
2128
2142#define START_TIMERS \
2143 NVTX_PUSH("START", NVTX_CPU);
2144
2157#define STOP_TIMERS \
2158 NVTX_POP;
2159
2160/* ------------------------------------------------------------
2161 NVIDIA Tools Extension (NVTX)...
2162 ------------------------------------------------------------ */
2163
2164#ifdef NVTX
2165#include "nvToolsExt.h"
2166
2168#define NVTX_CPU 0xFFADD8E6
2169
2171#define NVTX_GPU 0xFF00008B
2172
2174#define NVTX_H2D 0xFFFFFF00
2175
2177#define NVTX_D2H 0xFFFF8800
2178
2180#define NVTX_READ 0xFFFFCCCB
2181
2183#define NVTX_WRITE 0xFF8B0000
2184
2186#define NVTX_RECV 0xFFCCFFCB
2187
2189#define NVTX_SEND 0xFF008B00
2190
2220#define NVTX_PUSH(range_title, range_color) { \
2221 nvtxEventAttributes_t eventAttrib = {0}; \
2222 eventAttrib.version = NVTX_VERSION; \
2223 eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; \
2224 eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; \
2225 eventAttrib.colorType = NVTX_COLOR_ARGB; \
2226 eventAttrib.color = range_color; \
2227 eventAttrib.message.ascii = range_title; \
2228 nvtxRangePushEx(&eventAttrib); \
2229 }
2230
2243#define NVTX_POP { \
2244 nvtxRangePop(); \
2245 }
2246#else
2247
2248/* Empty definitions of NVTX_PUSH and NVTX_POP... */
2249#define NVTX_PUSH(range_title, range_color) {}
2250#define NVTX_POP {}
2251#endif
2252
2253/* ------------------------------------------------------------
2254 Structs...
2255 ------------------------------------------------------------ */
2256
2264typedef struct {
2265
2266 /* ------------------------------------------------------------
2267 Quantity parameters...
2268 ------------------------------------------------------------ */
2269
2271 int nq;
2272
2274 char qnt_name[NQ][LEN];
2275
2277 char qnt_longname[NQ][LEN];
2278
2280 char qnt_unit[NQ][LEN];
2281
2283 char qnt_format[NQ][LEN];
2284
2287
2290
2293
2296
2299
2302
2305
2308
2311
2314
2317
2320
2323
2326
2329
2332
2335
2338
2341
2344
2347
2350
2353
2356
2359
2362
2365
2368
2371
2374
2377
2380
2383
2386
2389
2392
2395
2398
2401
2404
2407
2410
2413
2416
2419
2422
2425
2428
2431
2434
2437
2440
2443
2446
2449
2452
2455
2458
2461
2464
2467
2470
2473
2476
2479
2482
2485
2488
2491
2494
2497
2500
2503
2506
2509
2512
2515
2518
2521
2524
2527
2530
2533
2536
2539
2542
2545
2548
2551
2554
2557
2560
2563
2566
2569
2572
2575
2577 double t_start;
2578
2580 double t_stop;
2581
2583 double dt_mod;
2584
2585 /* ------------------------------------------------------------
2586 Meteo data parameters...
2587 ------------------------------------------------------------ */
2588
2590 char metbase[LEN];
2591
2593 double dt_met;
2594
2597
2601
2605
2608
2611
2614
2617
2620
2622 int met_comp_prec[METVAR];
2623
2625 double met_comp_tol[METVAR];
2626
2629
2632
2636
2639
2642
2645
2648
2651
2654
2657
2660
2663
2666
2669
2672
2675
2678
2681
2684
2687
2690
2693
2696
2699
2701 double met_p[EP];
2702
2705
2708
2710 double met_lev_hyam[EP];
2711
2713 double met_lev_hybm[EP];
2714
2717
2720
2723
2726
2729
2732
2735
2739
2742
2745
2748
2751
2754
2757
2758 /* ------------------------------------------------------------
2759 Geophysical module parameters...
2760 ------------------------------------------------------------ */
2761
2763 double sort_dt;
2764
2768
2770 char balloon[LEN];
2771
2774
2778
2781
2784
2787
2790
2793
2796
2799
2802
2805
2808
2811
2814
2817
2819 double conv_cin;
2820
2822 double conv_dt;
2823
2826
2829
2832
2835
2838
2841
2843 double bound_p0;
2844
2846 double bound_p1;
2847
2850
2853
2856
2859
2861 char species[LEN];
2862
2864 double molmass;
2865
2868
2871
2874
2876 char clim_hno3_filename[LEN];
2877
2879 char clim_oh_filename[LEN];
2880
2882 char clim_h2o2_filename[LEN];
2883
2885 char clim_ho2_filename[LEN];
2886
2888 char clim_o1d_filename[LEN];
2889
2891 char clim_o3_filename[LEN];
2892
2894 char clim_ccl4_timeseries[LEN];
2895
2897 char clim_ccl3f_timeseries[LEN];
2898
2900 char clim_ccl2f2_timeseries[LEN];
2901
2903 char clim_n2o_timeseries[LEN];
2904
2906 char clim_sf6_timeseries[LEN];
2907
2910
2913
2916
2919
2922
2925
2928
2931
2934
2937
2940
2943
2946
2949
2952
2955
2958
2961
2964
2967
2970
2973
2975 double oh_chem[4];
2976
2979
2982
2985
2987 double dt_kpp;
2988
2991
2993 double wet_depo_pre[2];
2994
2997
3000
3003
3006
3008 double wet_depo_ic_h[2];
3009
3011 double wet_depo_bc_h[2];
3012
3015
3018
3021
3024
3027
3029 double psc_h2o;
3030
3032 double psc_hno3;
3033
3034 /* ------------------------------------------------------------
3035 Output parameters...
3036 ------------------------------------------------------------ */
3037
3039 char atm_basename[LEN];
3040
3042 char atm_gpfile[LEN];
3043
3046
3049
3052
3056
3061
3064
3066 int atm_nc_quant[NQ];
3067
3070
3072 char csi_basename[LEN];
3073
3075 char csi_kernel[LEN];
3076
3079
3081 char csi_obsfile[LEN];
3082
3085
3088
3091
3093 double csi_z0;
3094
3096 double csi_z1;
3097
3100
3102 double csi_lon0;
3103
3105 double csi_lon1;
3106
3109
3111 double csi_lat0;
3112
3114 double csi_lat1;
3115
3117 int nens;
3118
3120 char ens_basename[LEN];
3121
3124
3126 char grid_basename[LEN];
3127
3129 char grid_kernel[LEN];
3130
3132 char grid_gpfile[LEN];
3133
3136
3139
3142
3144 int grid_nc_quant[NQ];
3145
3148
3151
3153 double grid_z0;
3154
3156 double grid_z1;
3157
3160
3163
3166
3169
3172
3175
3178
3180 char prof_basename[LEN];
3181
3183 char prof_obsfile[LEN];
3184
3187
3189 double prof_z0;
3190
3192 double prof_z1;
3193
3196
3199
3202
3205
3208
3211
3213 char sample_basename[LEN];
3214
3216 char sample_kernel[LEN];
3217
3219 char sample_obsfile[LEN];
3220
3223
3226
3228 char stat_basename[LEN];
3229
3231 double stat_lon;
3232
3234 double stat_lat;
3235
3237 double stat_r;
3238
3240 double stat_t0;
3241
3243 double stat_t1;
3244
3246 char vtk_basename[LEN];
3247
3250
3253
3256
3259
3262
3263 /* ------------------------------------------------------------
3264 Domain decomposition...
3265 ------------------------------------------------------------ */
3266
3268 int dd;
3269
3272
3275
3278
3281
3282} ctl_t;
3283
3292typedef struct {
3293
3295 int np;
3296
3298 double time[NP];
3299
3301 double p[NP];
3302
3304 double lon[NP];
3305
3307 double lat[NP];
3308
3310 double q[NQ][NP];
3311
3312} atm_t;
3313
3321typedef struct {
3322
3324 double time;
3325
3327 double p;
3328
3330 double lon;
3331
3333 double lat;
3334
3336 double q[NQ];
3337
3338} particle_t;
3339
3340
3347typedef struct {
3348
3350 double iso_var[NP];
3351
3353 double iso_ps[NP];
3354
3356 double iso_ts[NP];
3357
3360
3362 float uvwp[NP][3];
3363
3365 double rs[3 * NP + 1];
3366
3368 double dt[NP];
3369
3370} cache_t;
3371
3379typedef struct {
3380
3382 int np;
3383
3385 int nsza;
3386
3388 int no3c;
3389
3391 double p[CP];
3392
3394 double sza[CSZA];
3395
3397 double o3c[CO3];
3398
3400 double n2o[CP][CSZA][CO3];
3401
3403 double ccl4[CP][CSZA][CO3];
3404
3406 double ccl3f[CP][CSZA][CO3];
3407
3409 double ccl2f2[CP][CSZA][CO3];
3410
3412 double o2[CP][CSZA][CO3];
3413
3415 double o3_1[CP][CSZA][CO3];
3416
3418 double o3_2[CP][CSZA][CO3];
3419
3421 double h2o2[CP][CSZA][CO3];
3422
3424 double h2o[CP][CSZA][CO3];
3425
3426} clim_photo_t;
3427
3435typedef struct {
3436
3439
3441 double time[CTS];
3442
3444 double vmr[CTS];
3445
3446} clim_ts_t;
3447
3455typedef struct {
3456
3459
3461 int nlat;
3462
3464 int np;
3465
3467 double time[CT];
3468
3470 double lat[CY];
3471
3473 double p[CP];
3474
3476 double vmr[CT][CP][CY];
3477
3478} clim_zm_t;
3479
3487typedef struct {
3488
3491
3494
3496 double tropo_time[12];
3497
3499 double tropo_lat[73];
3500
3502 double tropo[12][73];
3503
3506
3509
3512
3515
3518
3521
3524
3527
3530
3533
3536
3537} clim_t;
3538
3546typedef struct {
3547
3549 double time;
3550
3552 int nx;
3553
3555 int ny;
3556
3558 int np;
3559
3561 int npl;
3562
3564 double lon[EX];
3565
3567 double lat[EY];
3568
3570 double p[EP];
3571
3573 double hybrid[EP];
3574
3576 double hyam[EP];
3577
3579 double hybm[EP];
3580
3582 double eta[EP];
3583
3585 float ps[EX][EY];
3586
3588 float ts[EX][EY];
3589
3591 float zs[EX][EY];
3592
3594 float us[EX][EY];
3595
3597 float vs[EX][EY];
3598
3600 float ess[EX][EY];
3601
3603 float nss[EX][EY];
3604
3606 float shf[EX][EY];
3607
3609 float lsm[EX][EY];
3610
3612 float sst[EX][EY];
3613
3615 float pbl[EX][EY];
3616
3618 float pt[EX][EY];
3619
3621 float tt[EX][EY];
3622
3624 float zt[EX][EY];
3625
3627 float h2ot[EX][EY];
3628
3630 float pct[EX][EY];
3631
3633 float pcb[EX][EY];
3634
3636 float cl[EX][EY];
3637
3639 float plcl[EX][EY];
3640
3642 float plfc[EX][EY];
3643
3645 float pel[EX][EY];
3646
3648 float cape[EX][EY];
3649
3651 float cin[EX][EY];
3652
3654 float o3c[EX][EY];
3655
3657 float z[EX][EY][EP];
3658
3660 float t[EX][EY][EP];
3661
3663 float u[EX][EY][EP];
3664
3666 float v[EX][EY][EP];
3667
3669 float w[EX][EY][EP];
3670
3672 float pv[EX][EY][EP];
3673
3675 float h2o[EX][EY][EP];
3676
3678 float o3[EX][EY][EP];
3679
3681 float lwc[EX][EY][EP];
3682
3684 float rwc[EX][EY][EP];
3685
3687 float iwc[EX][EY][EP];
3688
3690 float swc[EX][EY][EP];
3691
3693 float cc[EX][EY][EP];
3694
3696 float pl[EX][EY][EP];
3697
3699 float ul[EX][EY][EP];
3700
3702 float vl[EX][EY][EP];
3703
3705 float wl[EX][EY][EP];
3706
3708 float zetal[EX][EY][EP];
3709
3711 float zeta_dotl[EX][EY][EP];
3712
3713} met_t;
3714
3720typedef struct {
3721
3722 /* ------------------------------------------------------------
3723 MPI Information
3724 ------------------------------------------------------------ */
3725
3727 int rank;
3728
3730 int size;
3731
3733 int neighbours[DD_NNMAX];
3734
3735#ifdef DD
3737 MPI_Datatype MPI_Particle;
3738#endif
3739
3740 /* ------------------------------------------------------------
3741 Properties of subdomains
3742 ------------------------------------------------------------ */
3743
3746
3749
3752
3755
3757 size_t subdomain_start[4];
3758
3760 size_t subdomain_count[4];
3761
3763 size_t halo_bnd_start[4];
3764
3766 size_t halo_bnd_count[4];
3767
3770
3773
3774 /* ------------------------------------------------------------
3775 Caches
3776 ------------------------------------------------------------ */
3777
3779 int init;
3780
3781#ifdef DD
3782
3784 double a[NP];
3785
3787 int p[NP];
3788
3790 double help[NP];
3791
3792#endif
3793
3794} dd_t;
3795
3796/* ------------------------------------------------------------
3797 OpenACC routines...
3798 ------------------------------------------------------------ */
3799
3800#ifdef _OPENACC
3801#pragma acc routine (clim_oh)
3802#pragma acc routine (clim_photo)
3803#pragma acc routine (clim_tropo)
3804#pragma acc routine (clim_ts)
3805#pragma acc routine (clim_zm)
3806#pragma acc routine (cos_sza)
3807#pragma acc routine (intpol_check_lon_lat)
3808#pragma acc routine (intpol_met_4d_zeta)
3809#pragma acc routine (intpol_met_space_3d)
3810#pragma acc routine (intpol_met_space_2d)
3811#pragma acc routine (intpol_met_time_3d)
3812#pragma acc routine (intpol_met_time_2d)
3813#pragma acc routine (kernel_weight)
3814#pragma acc routine (lapse_rate)
3815#pragma acc routine (locate_irr)
3816#pragma acc routine (locate_irr_float)
3817#pragma acc routine (locate_reg)
3818#pragma acc routine (locate_vert)
3819#pragma acc routine (nat_temperature)
3820#pragma acc routine (pbl_weight)
3821#pragma acc routine (sedi)
3822#pragma acc routine (stddev)
3823#pragma acc routine (tropo_weight)
3824#endif
3825
3826/* ------------------------------------------------------------
3827 Functions...
3828 ------------------------------------------------------------ */
3829
3852 void *data,
3853 size_t N);
3854
3869void cart2geo(
3870 const double *x,
3871 double *z,
3872 double *lon,
3873 double *lat);
3874
3897double clim_oh(
3898 const ctl_t * ctl,
3899 const clim_t * clim,
3900 const double t,
3901 const double lon,
3902 const double lat,
3903 const double p);
3904
3924 const ctl_t * ctl,
3925 clim_t * clim);
3926
3956double clim_photo(
3957 const double rate[CP][CSZA][CO3],
3958 const clim_photo_t * photo,
3959 const double p,
3960 const double sza,
3961 const double o3c);
3962
3988double clim_tropo(
3989 const clim_t * clim,
3990 const double t,
3991 const double lat);
3992
4011void clim_tropo_init(
4012 clim_t * clim);
4013
4030double clim_ts(
4031 const clim_ts_t * ts,
4032 const double t);
4033
4055double clim_zm(
4056 const clim_zm_t * zm,
4057 const double t,
4058 const double lat,
4059 const double p);
4060
4102 const ctl_t * ctl,
4103 const char *varname,
4104 float *array,
4105 const size_t nx,
4106 const size_t ny,
4107 const size_t np,
4108 const int decompress,
4109 FILE * inout);
4110
4143void compress_pck(
4144 const char *varname,
4145 float *array,
4146 const size_t nxy,
4147 const size_t nz,
4148 const int decompress,
4149 FILE * inout);
4150
4181 const char *varname,
4182 float *array,
4183 const int nx,
4184 const int ny,
4185 const int nz,
4186 const int precision,
4187 const double tolerance,
4188 const int decompress,
4189 FILE * inout);
4190
4230 const char *varname,
4231 float *array,
4232 const int nx,
4233 const int ny,
4234 const int nz,
4235 const int precision,
4236 const double tolerance,
4237 const int decompress,
4238 FILE * inout);
4239
4262 const char *varname,
4263 float *array,
4264 const size_t n,
4265 const int decompress,
4266 const int level,
4267 FILE * inout);
4268
4293double cos_sza(
4294 const double sec,
4295 const double lon,
4296 const double lat);
4297
4320void day2doy(
4321 const int year,
4322 const int mon,
4323 const int day,
4324 int *doy);
4325
4373 atm_t * atm,
4374 ctl_t * ctl,
4375 dd_t * dd,
4376 int init);
4377
4401 atm_t * atm,
4402 particle_t * particles,
4403 ctl_t * ctl,
4404 int *nparticles,
4405 cache_t * cache,
4406 int rank);
4407
4435 double lon,
4436 double lat,
4437 met_t * met,
4438 ctl_t * ctl,
4439 int mpi_size,
4440 int nx_glob,
4441 int ny_glob);
4442
4473 particle_t * particles,
4474 int *nparticles,
4475 MPI_Datatype MPI_Particle,
4476 int *neighbours,
4477 int nneighbours,
4478 ctl_t ctl);
4479
4503 const ctl_t ctl,
4504 dd_t * dd);
4505
4533 ctl_t * ctl,
4534 dd_t * dd,
4535 atm_t * atm);
4536
4561 met_t * met,
4562 int nx_glob);
4563
4589 atm_t * atm,
4590 particle_t * particles,
4591 ctl_t * ctl,
4592 int *nparticles,
4593 cache_t * cache);
4594
4617 MPI_Datatype * MPI_Particle);
4618
4653 const ctl_t * ctl,
4654 met_t * met0,
4655 atm_t * atm,
4656 dd_t * dd,
4657 int *nparticles,
4658 int *rank);
4659
4688 double *a,
4689 dd_t * dd,
4690 const int np);
4691
4713void doy2day(
4714 const int year,
4715 const int doy,
4716 int *mon,
4717 int *day);
4718
4745void fft_help(
4746 double *fcReal,
4747 double *fcImag,
4748 const int n);
4749
4776void geo2cart(
4777 const double z,
4778 const double lon,
4779 const double lat,
4780 double *x);
4781
4806void get_met_help(
4807 const ctl_t * ctl,
4808 const double t,
4809 const int direct,
4810 const char *metbase,
4811 const double dt_met,
4812 char *filename);
4813
4837void get_met_replace(
4838 char *orig,
4839 char *search,
4840 char *repl);
4841
4878void get_tropo(
4879 const int met_tropo,
4880 ctl_t * ctl,
4881 clim_t * clim,
4882 met_t * met,
4883 const double *lons,
4884 const int nx,
4885 const double *lats,
4886 const int ny,
4887 double *pt,
4888 double *zt,
4889 double *tt,
4890 double *qt,
4891 double *o3t,
4892 double *ps,
4893 double *zs);
4894
4916 const double *lons,
4917 const int nlon,
4918 const double *lats,
4919 const int nlat,
4920 const double lon,
4921 const double lat,
4922 double *lon2,
4923 double *lat2);
4924
4967 const met_t * met0,
4968 float height0[EX][EY][EP],
4969 float array0[EX][EY][EP],
4970 const met_t * met1,
4971 float height1[EX][EY][EP],
4972 float array1[EX][EY][EP],
4973 const double ts,
4974 const double height,
4975 const double lon,
4976 const double lat,
4977 double *var,
4978 int *ci,
4979 double *cw,
4980 const int init);
4981
5017 const met_t * met,
5018 float array[EX][EY][EP],
5019 const double p,
5020 const double lon,
5021 const double lat,
5022 double *var,
5023 int *ci,
5024 double *cw,
5025 const int init);
5026
5062 const met_t * met,
5063 float array[EX][EY],
5064 const double lon,
5065 const double lat,
5066 double *var,
5067 int *ci,
5068 double *cw,
5069 const int init);
5070
5105 const met_t * met0,
5106 float array0[EX][EY][EP],
5107 const met_t * met1,
5108 float array1[EX][EY][EP],
5109 const double ts,
5110 const double p,
5111 const double lon,
5112 const double lat,
5113 double *var,
5114 int *ci,
5115 double *cw,
5116 const int init);
5117
5153 const met_t * met0,
5154 float array0[EX][EY],
5155 const met_t * met1,
5156 float array1[EX][EY],
5157 const double ts,
5158 const double lon,
5159 const double lat,
5160 double *var,
5161 int *ci,
5162 double *cw,
5163 const int init);
5164
5202void intpol_tropo_3d(
5203 const double time0,
5204 float array0[EX][EY],
5205 const double time1,
5206 float array1[EX][EY],
5207 const double lons[EX],
5208 const double lats[EY],
5209 const int nlon,
5210 const int nlat,
5211 const double time,
5212 const double lon,
5213 const double lat,
5214 const int method,
5215 double *var,
5216 double *sigma);
5217
5244void jsec2time(
5245 const double jsec,
5246 int *year,
5247 int *mon,
5248 int *day,
5249 int *hour,
5250 int *min,
5251 int *sec,
5252 double *remain);
5253
5280double kernel_weight(
5281 const double kz[EP],
5282 const double kw[EP],
5283 const int nk,
5284 const double p);
5285
5324double lapse_rate(
5325 const double t,
5326 const double h2o);
5327
5357 ctl_t * ctl);
5358
5378int locate_irr(
5379 const double *xx,
5380 const int n,
5381 const double x);
5382
5409 const float *xx,
5410 const int n,
5411 const double x,
5412 const int ig);
5413
5434int locate_reg(
5435 const double *xx,
5436 const int n,
5437 const double x);
5438
5460void locate_vert(
5461 float profiles[EX][EY][EP],
5462 const int np,
5463 const int lon_ap_ind,
5464 const int lat_ap_ind,
5465 const double alt_ap,
5466 int *ind);
5467
5493void module_advect(
5494 const ctl_t * ctl,
5495 const cache_t * cache,
5496 met_t * met0,
5497 met_t * met1,
5498 atm_t * atm);
5499
5523 const ctl_t * ctl,
5524 const cache_t * cache,
5525 met_t * met0,
5526 met_t * met1,
5527 atm_t * atm);
5528
5566 const ctl_t * ctl,
5567 const cache_t * cache,
5568 const clim_t * clim,
5569 met_t * met0,
5570 met_t * met1,
5571 atm_t * atm);
5572
5614void module_chem_grid(
5615 const ctl_t * ctl,
5616 met_t * met0,
5617 met_t * met1,
5618 atm_t * atm,
5619 const double t);
5620
5647void module_chem_init(
5648 const ctl_t * ctl,
5649 const cache_t * cache,
5650 const clim_t * clim,
5651 met_t * met0,
5652 met_t * met1,
5653 atm_t * atm);
5654
5679 const ctl_t * ctl,
5680 cache_t * cache,
5681 met_t * met0,
5682 met_t * met1,
5683 atm_t * atm);
5684
5713 ctl_t * ctl,
5714 atm_t * atm,
5715 cache_t * cache,
5716 dd_t * dd,
5717 met_t ** met);
5718
5745void module_decay(
5746 const ctl_t * ctl,
5747 const cache_t * cache,
5748 const clim_t * clim,
5749 atm_t * atm);
5750
5787void module_diff_meso(
5788 const ctl_t * ctl,
5789 cache_t * cache,
5790 met_t * met0,
5791 met_t * met1,
5792 atm_t * atm);
5793
5827void module_diff_pbl(
5828 const ctl_t * ctl,
5829 cache_t * cache,
5830 met_t * met0,
5831 met_t * met1,
5832 atm_t * atm);
5833
5888void module_diff_turb(
5889 const ctl_t * ctl,
5890 cache_t * cache,
5891 const clim_t * clim,
5892 met_t * met0,
5893 met_t * met1,
5894 atm_t * atm);
5895
5915void module_dry_depo(
5916 const ctl_t * ctl,
5917 const cache_t * cache,
5918 met_t * met0,
5919 met_t * met1,
5920 atm_t * atm);
5921
5954void module_h2o2_chem(
5955 const ctl_t * ctl,
5956 const cache_t * cache,
5957 const clim_t * clim,
5958 met_t * met0,
5959 met_t * met1,
5960 atm_t * atm);
5961
5982 const ctl_t * ctl,
5983 cache_t * cache,
5984 met_t * met0,
5985 met_t * met1,
5986 atm_t * atm);
5987
6005void module_isosurf(
6006 const ctl_t * ctl,
6007 const cache_t * cache,
6008 met_t * met0,
6009 met_t * met1,
6010 atm_t * atm);
6011
6044 ctl_t * ctl,
6045 cache_t * cache,
6046 clim_t * clim,
6047 met_t * met0,
6048 met_t * met1,
6049 atm_t * atm);
6050
6069void module_meteo(
6070 const ctl_t * ctl,
6071 const cache_t * cache,
6072 const clim_t * clim,
6073 met_t * met0,
6074 met_t * met1,
6075 atm_t * atm);
6076
6094void module_mixing(
6095 const ctl_t * ctl,
6096 const clim_t * clim,
6097 atm_t * atm,
6098 const double t);
6099
6128 const ctl_t * ctl,
6129 const clim_t * clim,
6130 atm_t * atm,
6131 const int *ixs,
6132 const int *iys,
6133 const int *izs,
6134 const int qnt_idx,
6135 const int use_ensemble);
6136
6169void module_oh_chem(
6170 const ctl_t * ctl,
6171 const cache_t * cache,
6172 const clim_t * clim,
6173 met_t * met0,
6174 met_t * met1,
6175 atm_t * atm);
6176
6204void module_position(
6205 const cache_t * cache,
6206 met_t * met0,
6207 met_t * met1,
6208 atm_t * atm);
6209
6234void module_rng_init(
6235 const int ntask);
6236
6262void module_rng(
6263 const ctl_t * ctl,
6264 double *rs,
6265 const size_t n,
6266 const int method);
6267
6290void module_sedi(
6291 const ctl_t * ctl,
6292 const cache_t * cache,
6293 met_t * met0,
6294 met_t * met1,
6295 atm_t * atm);
6296
6320void module_sort(
6321 const ctl_t * ctl,
6322 met_t * met0,
6323 atm_t * atm);
6324
6344void module_sort_help(
6345 double *a,
6346 const int *p,
6347 const int np);
6348
6372void module_timesteps(
6373 const ctl_t * ctl,
6374 cache_t * cache,
6375 met_t * met0,
6376 atm_t * atm,
6377 const double t);
6378
6400 ctl_t * ctl,
6401 const atm_t * atm);
6402
6436 const ctl_t * ctl,
6437 const cache_t * cache,
6438 const clim_t * clim,
6439 met_t * met0,
6440 met_t * met1,
6441 atm_t * atm);
6442
6472void module_wet_depo(
6473 const ctl_t * ctl,
6474 const cache_t * cache,
6475 met_t * met0,
6476 met_t * met1,
6477 atm_t * atm);
6478
6509void mptrac_alloc(
6510 ctl_t ** ctl,
6511 cache_t ** cache,
6512 clim_t ** clim,
6513 met_t ** met0,
6514 met_t ** met1,
6515 atm_t ** atm,
6516 dd_t ** dd);
6517
6547void mptrac_free(
6548 ctl_t * ctl,
6549 cache_t * cache,
6550 clim_t * clim,
6551 met_t * met0,
6552 met_t * met1,
6553 atm_t * atm,
6554 dd_t * dd);
6555
6590void mptrac_get_met(
6591 ctl_t * ctl,
6592 clim_t * clim,
6593 const double t,
6594 met_t ** met0,
6595 met_t ** met1,
6596 dd_t * dd);
6597
6617void mptrac_init(
6618 ctl_t * ctl,
6619 cache_t * cache,
6620 clim_t * clim,
6621 atm_t * atm,
6622 const int ntask);
6623
6659int mptrac_read_atm(
6660 const char *filename,
6661 const ctl_t * ctl,
6662 atm_t * atm);
6663
6695void mptrac_read_clim(
6696 const ctl_t * ctl,
6697 clim_t * clim);
6698
6728void mptrac_read_ctl(
6729 const char *filename,
6730 int argc,
6731 char *argv[],
6732 ctl_t * ctl);
6733
6763int mptrac_read_met(
6764 const char *filename,
6765 const ctl_t * ctl,
6766 const clim_t * clim,
6767 met_t * met,
6768 dd_t * dd);
6769
6791 ctl_t * ctl,
6792 cache_t * cache,
6793 clim_t * clim,
6794 met_t ** met0,
6795 met_t ** met1,
6796 atm_t * atm,
6797 double t,
6798 dd_t * dd);
6799
6829void mptrac_write_atm(
6830 const char *filename,
6831 const ctl_t * ctl,
6832 const atm_t * atm,
6833 const double t);
6834
6872void mptrac_write_met(
6873 const char *filename,
6874 const ctl_t * ctl,
6875 met_t * met);
6876
6911 const char *dirname,
6912 const ctl_t * ctl,
6913 met_t * met0,
6914 met_t * met1,
6915 atm_t * atm,
6916 const double t);
6917
6949 const ctl_t * ctl,
6950 const cache_t * cache,
6951 const clim_t * clim,
6952 met_t ** met0,
6953 met_t ** met1,
6954 const atm_t * atm);
6955
6986 const ctl_t * ctl,
6987 const cache_t * cache,
6988 const clim_t * clim,
6989 met_t ** met0,
6990 met_t ** met1,
6991 const atm_t * atm);
6992
7020double nat_temperature(
7021 const double p,
7022 const double h2o,
7023 const double hno3);
7024
7045double pbl_weight(
7046 const ctl_t * ctl,
7047 const atm_t * atm,
7048 const int ip,
7049 const double pbl,
7050 const double ps);
7051
7084int read_atm_asc(
7085 const char *filename,
7086 const ctl_t * ctl,
7087 atm_t * atm);
7088
7119int read_atm_bin(
7120 const char *filename,
7121 const ctl_t * ctl,
7122 atm_t * atm);
7123
7148int read_atm_clams(
7149 const char *filename,
7150 const ctl_t * ctl,
7151 atm_t * atm);
7152
7182int read_atm_nc(
7183 const char *filename,
7184 const ctl_t * ctl,
7185 atm_t * atm);
7186
7215void read_clim_photo(
7216 const char *filename,
7217 clim_photo_t * photo);
7218
7236 const int ncid,
7237 const char *varname,
7238 const clim_photo_t * photo,
7239 double var[CP][CSZA][CO3]);
7240
7264int read_clim_ts(
7265 const char *filename,
7266 clim_ts_t * ts);
7267
7294void read_clim_zm(
7295 const char *filename,
7296 const char *varname,
7297 clim_zm_t * zm);
7298
7326void read_kernel(
7327 const char *filename,
7328 double kz[EP],
7329 double kw[EP],
7330 int *nk);
7331
7363int read_met_bin(
7364 const char *filename,
7365 const ctl_t * ctl,
7366 met_t * met);
7367
7393void read_met_bin_2d(
7394 FILE * in,
7395 const met_t * met,
7396 float var[EX][EY],
7397 const char *varname);
7398
7436void read_met_bin_3d(
7437 FILE * in,
7438 const ctl_t * ctl,
7439 const met_t * met,
7440 float var[EX][EY][EP],
7441 const char *varname,
7442 const float bound_min,
7443 const float bound_max);
7444
7471void read_met_cape(
7472 const ctl_t * ctl,
7473 const clim_t * clim,
7474 met_t * met);
7475
7498void read_met_cloud(
7499 met_t * met);
7500
7526void read_met_detrend(
7527 const ctl_t * ctl,
7528 met_t * met);
7529
7553 met_t * met);
7554
7581void read_met_geopot(
7582 const ctl_t * ctl,
7583 met_t * met);
7584
7612 const char *filename,
7613 const ctl_t * ctl,
7614 met_t * met);
7615
7637 codes_handle ** handles,
7638 int count_handles,
7639 met_t * met);
7640
7661 codes_handle ** handles,
7662 const int num_messages,
7663 const ctl_t * ctl,
7664 met_t * met);
7665
7696 codes_handle ** handles,
7697 const int num_messages,
7698 const ctl_t * ctl,
7699 met_t * met);
7700
7729void read_met_ml2pl(
7730 const ctl_t * ctl,
7731 const met_t * met,
7732 float var[EX][EY][EP],
7733 const char *varname);
7734
7757 const ctl_t * ctl,
7758 met_t * met);
7759
7789int read_met_nc(
7790 const char *filename,
7791 const ctl_t * ctl,
7792 met_t * met,
7793 dd_t * dd);
7794
7827void read_met_nc_grid(
7828 const char *filename,
7829 const int ncid,
7830 const ctl_t * ctl,
7831 met_t * met,
7832 dd_t * dd);
7833
7879 dd_t * dd,
7880 const ctl_t * ctl,
7881 met_t * met,
7882 const int ncid);
7883
7915 const int ncid,
7916 const ctl_t * ctl,
7917 met_t * met,
7918 dd_t * dd);
7919
7949 const int ncid,
7950 const ctl_t * ctl,
7951 met_t * met,
7952 dd_t * dd);
7953
7983int read_met_nc_2d(
7984 const int ncid,
7985 const char *varname,
7986 const char *varname2,
7987 const char *varname3,
7988 const char *varname4,
7989 const char *varname5,
7990 const char *varname6,
7991 const ctl_t * ctl,
7992 const met_t * met,
7993 dd_t * dd,
7994 float dest[EX][EY],
7995 const float scl,
7996 const int init);
7997
8028int read_met_nc_3d(
8029 const int ncid,
8030 const char *varname,
8031 const char *varname2,
8032 const char *varname3,
8033 const char *varname4,
8034 const ctl_t * ctl,
8035 const met_t * met,
8036 dd_t * dd,
8037 float dest[EX][EY][EP],
8038 const float scl);
8039
8085void read_met_pbl(
8086 const ctl_t * ctl,
8087 met_t * met);
8088
8121 met_t * met);
8122
8153 met_t * met);
8154
8185void read_met_pv(
8186 met_t * met);
8187
8210void read_met_ozone(
8211 met_t * met);
8212
8241void read_met_sample(
8242 const ctl_t * ctl,
8243 met_t * met);
8244
8273void read_met_tropo(
8274 const ctl_t * ctl,
8275 const clim_t * clim,
8276 met_t * met);
8277
8309void read_obs(
8310 const char *filename,
8311 const ctl_t * ctl,
8312 double *rt,
8313 double *rz,
8314 double *rlon,
8315 double *rlat,
8316 double *robs,
8317 int *nobs);
8318
8346void read_obs_asc(
8347 const char *filename,
8348 double *rt,
8349 double *rz,
8350 double *rlon,
8351 double *rlat,
8352 double *robs,
8353 int *nobs);
8354
8381void read_obs_nc(
8382 const char *filename,
8383 double *rt,
8384 double *rz,
8385 double *rlon,
8386 double *rlat,
8387 double *robs,
8388 int *nobs);
8389
8423double scan_ctl(
8424 const char *filename,
8425 int argc,
8426 char *argv[],
8427 const char *varname,
8428 const int arridx,
8429 const char *defvalue,
8430 char *value);
8431
8458double sedi(
8459 const double p,
8460 const double T,
8461 const double rp,
8462 const double rhop);
8463
8493void spline(
8494 const double *x,
8495 const double *y,
8496 const int n,
8497 const double *x2,
8498 double *y2,
8499 const int n2,
8500 const int method);
8501
8524float stddev(
8525 const float *data,
8526 const int n);
8527
8552void time2jsec(
8553 const int year,
8554 const int mon,
8555 const int day,
8556 const int hour,
8557 const int min,
8558 const int sec,
8559 const double remain,
8560 double *jsec);
8561
8590void timer(
8591 const char *name,
8592 const char *group,
8593 const int output);
8594
8620double time_from_filename(
8621 const char *filename,
8622 const int offset);
8623
8641double tropo_weight(
8642 const clim_t * clim,
8643 const atm_t * atm,
8644 const int ip);
8645
8668void write_atm_asc(
8669 const char *filename,
8670 const ctl_t * ctl,
8671 const atm_t * atm,
8672 const double t);
8673
8697void write_atm_bin(
8698 const char *filename,
8699 const ctl_t * ctl,
8700 const atm_t * atm);
8701
8725void write_atm_clams(
8726 const char *filename,
8727 const ctl_t * ctl,
8728 const atm_t * atm);
8729
8755 const char *dirname,
8756 const ctl_t * ctl,
8757 const atm_t * atm,
8758 const double t);
8759
8783void write_atm_nc(
8784 const char *filename,
8785 const ctl_t * ctl,
8786 const atm_t * atm);
8787
8816void write_csi(
8817 const char *filename,
8818 const ctl_t * ctl,
8819 const atm_t * atm,
8820 const double t);
8821
8863 const char *filename,
8864 const ctl_t * ctl,
8865 const atm_t * atm,
8866 const double t);
8867
8895void write_ens(
8896 const char *filename,
8897 const ctl_t * ctl,
8898 const atm_t * atm,
8899 const double t);
8900
8939void write_grid(
8940 const char *filename,
8941 const ctl_t * ctl,
8942 met_t * met0,
8943 met_t * met1,
8944 const atm_t * atm,
8945 const double t);
8946
8992void write_grid_asc(
8993 const char *filename,
8994 const ctl_t * ctl,
8995 const double *cd,
8996 double *mean[NQ],
8997 double *sigma[NQ],
8998 const double *vmr_impl,
8999 const double t,
9000 const double *z,
9001 const double *lon,
9002 const double *lat,
9003 const double *area,
9004 const double dz,
9005 const int *np);
9006
9049void write_grid_nc(
9050 const char *filename,
9051 const ctl_t * ctl,
9052 const double *cd,
9053 double *mean[NQ],
9054 double *sigma[NQ],
9055 const double *vmr_impl,
9056 const double t,
9057 const double *z,
9058 const double *lon,
9059 const double *lat,
9060 const double *area,
9061 const double dz,
9062 const int *np);
9063
9093void write_met_bin(
9094 const char *filename,
9095 const ctl_t * ctl,
9096 met_t * met);
9097
9125void write_met_bin_2d(
9126 FILE * out,
9127 met_t * met,
9128 float var[EX][EY],
9129 const char *varname);
9130
9168void write_met_bin_3d(
9169 FILE * out,
9170 const ctl_t * ctl,
9171 met_t * met,
9172 float var[EX][EY][EP],
9173 const char *varname,
9174 const int precision,
9175 const double tolerance);
9176
9204void write_met_nc(
9205 const char *filename,
9206 const ctl_t * ctl,
9207 met_t * met);
9208
9233void write_met_nc_2d(
9234 const int ncid,
9235 const char *varname,
9236 met_t * met,
9237 float var[EX][EY],
9238 const float scl);
9239
9265void write_met_nc_3d(
9266 const int ncid,
9267 const char *varname,
9268 met_t * met,
9269 float var[EX][EY][EP],
9270 const float scl);
9271
9302void write_prof(
9303 const char *filename,
9304 const ctl_t * ctl,
9305 met_t * met0,
9306 met_t * met1,
9307 const atm_t * atm,
9308 const double t);
9309
9341void write_sample(
9342 const char *filename,
9343 const ctl_t * ctl,
9344 met_t * met0,
9345 met_t * met1,
9346 const atm_t * atm,
9347 const double t);
9348
9375void write_station(
9376 const char *filename,
9377 const ctl_t * ctl,
9378 atm_t * atm,
9379 const double t);
9380
9409void write_vtk(
9410 const char *filename,
9411 const ctl_t * ctl,
9412 const atm_t * atm,
9413 const double t);
9414
9415#endif /* LIBTRAC_H */
void read_met_geopot(const ctl_t *ctl, met_t *met)
Calculates geopotential heights from meteorological data.
Definition: mptrac.c:8110
int dd_init(ctl_t *ctl, dd_t *dd, atm_t *atm)
Initializes domain decomposition for parallel processing.
void compress_zstd(const char *varname, float *array, const size_t n, const int decompress, const int level, FILE *inout)
Compresses or decompresses a float array using Zstandard (ZSTD).
#define LEN
Maximum length of ASCII data lines.
Definition: mptrac.h:298
void mptrac_alloc(ctl_t **ctl, cache_t **cache, clim_t **clim, met_t **met0, met_t **met1, atm_t **atm, dd_t **dd)
Allocates and initializes memory resources for MPTRAC.
Definition: mptrac.c:5148
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:6766
void day2doy(const int year, const int mon, const int day, int *doy)
Get day of year from date.
Definition: mptrac.c:1044
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:8070
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:11454
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.
Definition: mptrac.c:8740
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:12853
void read_met_sample(const ctl_t *ctl, met_t *met)
Downsamples meteorological data based on specified parameters.
Definition: mptrac.c:10493
void write_met_bin_3d(FILE *out, const ctl_t *ctl, met_t *met, float var[EX][EY][EP], const char *varname, const int precision, const double tolerance)
Writes a 3-dimensional meteorological variable to a binary file.
Definition: mptrac.c:12599
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:10838
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:2964
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.
Definition: mptrac.c:4864
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:4181
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:7198
void read_met_cloud(met_t *met)
Calculates cloud-related variables for each grid point.
Definition: mptrac.c:7909
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:3567
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:11011
double cos_sza(const double sec, const double lon, const double lat)
Calculates the cosine of the solar zenith angle.
Definition: mptrac.c:1003
#define METVAR
Number of 3-D meteorological variables.
Definition: mptrac.h:303
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:2363
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.
Definition: mptrac.c:9002
void dd_sort(const ctl_t *ctl, met_t *met0, atm_t *atm, dd_t *dd, int *nparticles, int *rank)
Sort particles according to box index and target rank for neighbours.
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:7165
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:10101
void read_met_detrend(const ctl_t *ctl, met_t *met)
Detrends meteorological data.
Definition: mptrac.c:7966
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:10666
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:10882
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:3412
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:2925
void get_tropo(const int met_tropo, ctl_t *ctl, 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:2063
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:2944
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:8543
void read_met_monotonize(const ctl_t *ctl, met_t *met)
Makes zeta and pressure profiles monotone.
Definition: mptrac.c:9736
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:7317
void read_met_periodic(met_t *met)
Applies periodic boundary conditions to meteorological data along longitudinal axis.
Definition: mptrac.c:10238
void mptrac_run_timestep(ctl_t *ctl, cache_t *cache, clim_t *clim, met_t **met0, met_t **met1, atm_t *atm, double t, dd_t *dd)
Executes a single timestep of the MPTRAC model simulation.
Definition: mptrac.c:6506
void module_timesteps_init(ctl_t *ctl, const atm_t *atm)
Initialize start time and time interval for time-stepping.
Definition: mptrac.c:4911
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:11936
void compress_cms(const ctl_t *ctl, const char *varname, float *array, const size_t nx, const size_t ny, const size_t np, const int decompress, FILE *inout)
Compresses or decompresses a 3D array of floats using a custom multiscale compression algorithm.
void module_mixing(const ctl_t *ctl, const clim_t *clim, atm_t *atm, const double t)
Update atmospheric properties through interparcel mixing.
Definition: mptrac.c:4288
void compress_zfp(const char *varname, float *array, const int nx, const int ny, const int nz, const int precision, const double tolerance, const int decompress, FILE *inout)
Compresses or decompresses a 3D array of floats using the ZFP library.
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:405
#define EY
Maximum number of latitudes for meteo data.
Definition: mptrac.h:293
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.
Definition: mptrac.c:4359
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:7289
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:9694
double clim_tropo(const clim_t *clim, const double t, const double lat)
Calculates the tropopause pressure based on climatological data.
Definition: mptrac.c:204
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:10910
void dd_particles2atm(atm_t *atm, particle_t *particles, ctl_t *ctl, int *nparticles, cache_t *cache)
Converts particle data to atmospheric data.
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:7659
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:2861
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:4005
void level_definitions(ctl_t *ctl)
Defines pressure levels for meteorological data.
Definition: mptrac.c:2651
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:2133
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:12224
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:6654
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:11112
void mptrac_init(ctl_t *ctl, cache_t *cache, clim_t *clim, atm_t *atm, const int ntask)
Initializes the MPTRAC model and its associated components.
Definition: mptrac.c:5356
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:2421
#define codes_handle
Placeholder when ECCODES is not available.
Definition: mptrac.h:190
void fft_help(double *fcReal, double *fcImag, const int n)
Computes the Fast Fourier Transform (FFT) of a complex sequence.
Definition: mptrac.c:1915
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:5013
void compress_pck(const char *varname, float *array, const size_t nxy, const size_t nz, const int decompress, FILE *inout)
Compresses or decompresses a 3D array of floats.
Definition: mptrac.c:672
double nat_temperature(const double p, const double h2o, const double hno3)
Calculates the nitric acid trihydrate (NAT) temperature.
Definition: mptrac.c:6961
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:11044
#define CP
Maximum number of pressure levels for climatological data.
Definition: mptrac.h:348
#define NQ
Maximum number of quantities per data point.
Definition: mptrac.h:313
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:147
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:7371
#define EX
Maximum number of longitudes for meteo data.
Definition: mptrac.h:288
void read_met_nc_grid_dd_naive(dd_t *dd, const ctl_t *ctl, met_t *met, const int ncid)
Read meteorological grid data from a NetCDF file and set up subdomain decomposition with halos.
Definition: mptrac.c:9861
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:4732
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:9821
void timer(const char *name, const char *group, const int output)
Measures and reports elapsed time for named and grouped timers.
Definition: mptrac.c:11143
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:11269
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:2305
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:3454
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:7470
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:3154
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:10939
#define CT
Maximum number of time steps for climatological data.
Definition: mptrac.h:358
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:3127
int dd_is_periodic_longitude(met_t *met, int nx_glob)
Check whether the longitude grid is periodic (global coverage).
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:5234
void module_sort_help(double *a, const int *p, const int np)
Reorder an array based on a given permutation.
Definition: mptrac.c:4826
float stddev(const float *data, const int n)
Calculates the standard deviation of a set of data.
Definition: mptrac.c:11091
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:2483
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:7688
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:2891
void dd_get_rect_neighbour(const ctl_t ctl, dd_t *dd)
Determines rectangular neighbouring ranks for MPI processes.
double time_from_filename(const char *filename, const int offset)
Extracts and converts a timestamp from a filename to Julian seconds.
Definition: mptrac.c:11211
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:12912
void dd_atm2particles(atm_t *atm, particle_t *particles, ctl_t *ctl, int *nparticles, cache_t *cache, int rank)
Converts atmospheric data to particle data.
void mptrac_read_clim(const ctl_t *ctl, clim_t *clim)
Reads various climatological data and populates the given climatology structure.
Definition: mptrac.c:5446
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:3250
double tropo_weight(const clim_t *clim, const atm_t *atm, const int ip)
Computes a weighting factor based on tropopause pressure.
Definition: mptrac.c:11246
void write_met_nc(const char *filename, const ctl_t *ctl, met_t *met)
Writes meteorological data to a NetCDF file.
Definition: mptrac.c:12689
void module_rng_init(const int ntask)
Initialize random number generators for parallel tasks.
Definition: mptrac.c:4596
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:5375
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:6710
void mptrac_write_output(const char *dirname, const ctl_t *ctl, met_t *met0, met_t *met1, atm_t *atm, const double t)
Writes various types of output data to files in a specified directory.
Definition: mptrac.c:6870
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:89
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.
#define CTS
Maximum number of data points of climatological time series.
Definition: mptrac.h:363
void read_met_ozone(met_t *met)
Calculates the total column ozone from meteorological ozone data.
Definition: mptrac.c:10464
int dd_calc_subdomain_from_coords(double lon, double lat, met_t *met, ctl_t *ctl, int mpi_size, int nx_glob, int ny_glob)
Assigns rectangular subdomains to atmospheric data particles.
void broadcast_large_data(void *data, size_t N)
Broadcasts large data across all processes in an MPI communicator.
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:8405
void clim_tropo_init(clim_t *clim)
Initializes the tropopause data in the climatology structure.
Definition: mptrac.c:232
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:4627
void get_met_help(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:1972
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:13301
void cart2geo(const double *x, double *z, double *lon, double *lat)
Converts Cartesian coordinates to geographic coordinates.
Definition: mptrac.c:74
#define NP
Maximum number of atmospheric data points.
Definition: mptrac.h:308
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:1885
void dd_communicate_particles(particle_t *particles, int *nparticles, MPI_Datatype MPI_Particle, int *neighbours, int nneighbours, ctl_t ctl)
Communicates particles between MPI processes.
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:2450
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.
Definition: mptrac.c:4545
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:115
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:12570
void read_met_pv(met_t *met)
Calculates potential vorticity (PV) from meteorological data.
Definition: mptrac.c:10358
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:7049
void get_met_replace(char *orig, char *search, char *repl)
Replaces occurrences of a substring in a string with another substring.
Definition: mptrac.c:2039
#define CY
Maximum number of latitudes for climatological data.
Definition: mptrac.h:338
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.
Definition: mptrac.c:3606
void module_dd(ctl_t *ctl, atm_t *atm, cache_t *cache, dd_t *dd, met_t **met)
Manages domain decomposition and particle communication in parallel processing.
void dd_sort_help(double *a, dd_t *dd, const int np)
Reorder an array according to a permutation vector.
void module_sort(const ctl_t *ctl, met_t *met0, atm_t *atm)
Sort particles according to box index.
Definition: mptrac.c:4761
double clim_ts(const clim_ts_t *ts, const double t)
Interpolates a time series of climatological variables.
Definition: mptrac.c:387
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:2574
int read_met_bin(const char *filename, const ctl_t *ctl, met_t *met)
Reads meteorological data from a binary file.
Definition: mptrac.c:7511
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:11401
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:3808
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:7105
void dd_assign_rect_subdomains_atm(atm_t *atm, ctl_t *ctl, dd_t *dd, int init)
Assign atmospheric particles to rectangular subdomains.
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:6397
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:13387
#define MPI_Datatype
Placeholder when MPI is not available.
Definition: mptrac.h:145
#define EP
Maximum number of pressure levels for meteo data.
Definition: mptrac.h:283
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:4942
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:5506
void mptrac_free(ctl_t *ctl, cache_t *cache, clim_t *clim, met_t *met0, met_t *met1, atm_t *atm, dd_t *dd)
Frees memory resources allocated for MPTRAC.
Definition: mptrac.c:5201
void read_met_polar_winds(met_t *met)
Applies a fix for polar winds in meteorological data.
Definition: mptrac.c:10299
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:3923
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:12328
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:6985
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:3683
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:12882
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:4075
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:343
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:4461
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:1954
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:8238
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:2607
void compress_sz3(const char *varname, float *array, const int nx, const int ny, const int nz, const int precision, const double tolerance, const int decompress, FILE *inout)
Compresses or decompresses a 3-D float array using the SZ3 library.
void dd_register_MPI_type_particle(MPI_Datatype *MPI_Particle)
Registers a custom MPI datatype for particle structures.
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:7007
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:2106
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:13139
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:12033
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:3860
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:12458
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:11351
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:7794
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:6826
#define CSZA
Maximum number of solar zenith angles for climatological data.
Definition: mptrac.h:353
double lapse_rate(const double t, const double h2o)
Calculates the moist adiabatic lapse rate in Kelvin per kilometer.
Definition: mptrac.c:2633
#define DD_NNMAX
Maximum number of neighbours to communicate with in domain decomposition.
Definition: mptrac.h:373
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:11661
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:11612
Air parcel data.
Definition: mptrac.h:3292
int np
Number of air parcels.
Definition: mptrac.h:3295
Cache data structure.
Definition: mptrac.h:3347
int iso_n
Isosurface balloon number of data points.
Definition: mptrac.h:3359
Climatological data in the form of photolysis rates.
Definition: mptrac.h:3379
int nsza
Number of solar zenith angles.
Definition: mptrac.h:3385
int np
Number of pressure levels.
Definition: mptrac.h:3382
int no3c
Number of total ozone columns.
Definition: mptrac.h:3388
Climatological data.
Definition: mptrac.h:3487
clim_ts_t ccl2f2
CFC-12 time series.
Definition: mptrac.h:3529
clim_photo_t photo
Photolysis rates.
Definition: mptrac.h:3505
clim_zm_t ho2
HO2 zonal means.
Definition: mptrac.h:3517
clim_zm_t hno3
HNO3 zonal means.
Definition: mptrac.h:3508
int tropo_ntime
Number of tropopause timesteps.
Definition: mptrac.h:3490
clim_ts_t sf6
SF6 time series.
Definition: mptrac.h:3535
clim_ts_t ccl4
CFC-10 time series.
Definition: mptrac.h:3523
clim_ts_t ccl3f
CFC-11 time series.
Definition: mptrac.h:3526
clim_zm_t o1d
O(1D) zonal means.
Definition: mptrac.h:3520
clim_zm_t h2o2
H2O2 zonal means.
Definition: mptrac.h:3514
int tropo_nlat
Number of tropopause latitudes.
Definition: mptrac.h:3493
clim_zm_t oh
OH zonal means.
Definition: mptrac.h:3511
clim_ts_t n2o
N2O time series.
Definition: mptrac.h:3532
Climatological data in the form of time series.
Definition: mptrac.h:3435
int ntime
Number of timesteps.
Definition: mptrac.h:3438
Climatological data in the form of zonal means.
Definition: mptrac.h:3455
int np
Number of pressure levels.
Definition: mptrac.h:3464
int ntime
Number of timesteps.
Definition: mptrac.h:3458
int nlat
Number of latitudes.
Definition: mptrac.h:3461
Control parameters.
Definition: mptrac.h:2264
double grid_z0
Lower altitude of gridded data [km].
Definition: mptrac.h:3153
int qnt_o3
Quantity array index for ozone volume mixing ratio.
Definition: mptrac.h:2376
double csi_lat1
Upper latitude of gridded CSI data [deg].
Definition: mptrac.h:3114
int qnt_Coh
Quantity array index for OH volume mixing ratio (chemistry code).
Definition: mptrac.h:2532
double wet_depo_ic_a
Coefficient A for wet deposition in cloud (exponential form).
Definition: mptrac.h:3002
int met_nc_scale
Check netCDF scaling factors (0=no, 1=yes).
Definition: mptrac.h:2610
int qnt_pel
Quantity array index for pressure at equilibrium level (EL).
Definition: mptrac.h:2409
int csi_nz
Number of altitudes of gridded CSI data.
Definition: mptrac.h:3090
double molmass
Molar mass [g/mol].
Definition: mptrac.h:2864
int qnt_p
Quantity array index for pressure.
Definition: mptrac.h:2355
int qnt_Cccl2f2
Quantity array index for CFC-12 volume mixing ratio (chemistry code).
Definition: mptrac.h:2556
int dd_halos_size
Domain decomposition size of halos given in grid-points.
Definition: mptrac.h:3280
int mixing_nx
Number of longitudes of mixing grid.
Definition: mptrac.h:2927
double chemgrid_z1
Upper altitude of chemistry grid [km].
Definition: mptrac.h:2951
int qnt_m
Quantity array index for mass.
Definition: mptrac.h:2295
int qnt_aoa
Quantity array index for age of air.
Definition: mptrac.h:2565
int qnt_rhop
Quantity array index for particle density.
Definition: mptrac.h:2304
int qnt_swc
Quantity array index for cloud snow water content.
Definition: mptrac.h:2388
double csi_obsmin
Minimum observation index to trigger detection.
Definition: mptrac.h:3084
int qnt_pcb
Quantity array index for cloud bottom pressure.
Definition: mptrac.h:2397
double bound_dzs
Boundary conditions surface layer depth [km].
Definition: mptrac.h:2852
double csi_lon1
Upper longitude of gridded CSI data [deg].
Definition: mptrac.h:3105
int qnt_u
Quantity array index for zonal wind.
Definition: mptrac.h:2364
double stat_lon
Longitude of station [deg].
Definition: mptrac.h:3231
double mixing_trop
Interparcel exchange parameter for mixing in the troposphere.
Definition: mptrac.h:2912
double sort_dt
Time step for sorting of particle data [s].
Definition: mptrac.h:2763
double mixing_z1
Upper altitude of mixing grid [km].
Definition: mptrac.h:2924
double stat_r
Search radius around station [km].
Definition: mptrac.h:3237
double wet_depo_bc_a
Coefficient A for wet deposition below cloud (exponential form).
Definition: mptrac.h:2996
int met_zstd_level
ZSTD compression level (from -5 to 22).
Definition: mptrac.h:2619
int csi_ny
Number of latitudes of gridded CSI data.
Definition: mptrac.h:3108
int vtk_sphere
Spherical projection for VTK data (0=no, 1=yes).
Definition: mptrac.h:3261
double chemgrid_z0
Lower altitude of chemistry grid [km].
Definition: mptrac.h:2948
double met_pbl_min
Minimum depth of planetary boundary layer [km].
Definition: mptrac.h:2731
int qnt_iwc
Quantity array index for cloud ice water content.
Definition: mptrac.h:2385
double chemgrid_lat0
Lower latitude of chemistry grid [deg].
Definition: mptrac.h:2966
double conv_cape
CAPE threshold for convection module [J/kg].
Definition: mptrac.h:2816
int qnt_Co1d
Quantity array index for O(1D) volume mixing ratio (chemistry code).
Definition: mptrac.h:2544
double met_cms_eps_pv
cmultiscale compression epsilon for potential vorticity.
Definition: mptrac.h:2653
int qnt_pw
Quantity array index for partial water vapor pressure.
Definition: mptrac.h:2463
double grid_z1
Upper altitude of gridded data [km].
Definition: mptrac.h:3156
int direction
Direction flag (1=forward calculation, -1=backward calculation).
Definition: mptrac.h:2574
int qnt_Cccl4
Quantity array index for CFC-10 volume mixing ratio (chemistry code).
Definition: mptrac.h:2550
int met_dp
Stride for pressure levels.
Definition: mptrac.h:2683
double met_dt_out
Time step for sampling of meteo data along trajectories [s].
Definition: mptrac.h:2750
int qnt_h2o2
Quantity array index for H2O2 volume mixing ratio (climatology).
Definition: mptrac.h:2427
int qnt_vh
Quantity array index for horizontal wind.
Definition: mptrac.h:2499
int csi_nx
Number of longitudes of gridded CSI data.
Definition: mptrac.h:3099
double csi_lat0
Lower latitude of gridded CSI data [deg].
Definition: mptrac.h:3111
double turb_dz_trop
Vertical turbulent diffusion coefficient (troposphere) [m^2/s].
Definition: mptrac.h:2798
int met_pbl
Planetary boundary layer data (0=file, 1=z2p, 2=Richardson, 3=theta).
Definition: mptrac.h:2728
int qnt_lwc
Quantity array index for cloud liquid water content.
Definition: mptrac.h:2379
double turb_mesoz
Vertical scaling factor for mesoscale wind fluctuations.
Definition: mptrac.h:2807
int grid_nc_level
zlib compression level of netCDF grid data files (0=off).
Definition: mptrac.h:3141
int grid_nx
Number of longitudes of gridded data.
Definition: mptrac.h:3159
int atm_type
Type of atmospheric data files (0=ASCII, 1=binary, 2=netCDF, 3=CLaMS_traj, 4=CLaMS_pos).
Definition: mptrac.h:3055
double bound_mass
Boundary conditions mass per particle [kg].
Definition: mptrac.h:2825
double grid_lat0
Lower latitude of gridded data [deg].
Definition: mptrac.h:3171
int qnt_ts
Quantity array index for surface temperature.
Definition: mptrac.h:2310
int qnt_loss_rate
Quantity array index for total loss rate.
Definition: mptrac.h:2454
double met_cms_eps_h2o
cmultiscale compression epsilon for water vapor.
Definition: mptrac.h:2656
int qnt_plfc
Quantity array index for pressure at level of free convection (LCF).
Definition: mptrac.h:2406
double grid_lon0
Lower longitude of gridded data [deg].
Definition: mptrac.h:3162
int qnt_o1d
Quantity array index for O(1D) volume mixing ratio (climatology).
Definition: mptrac.h:2433
int met_tropo_spline
Tropopause interpolation method (0=linear, 1=spline).
Definition: mptrac.h:2747
int qnt_tvirt
Quantity array index for virtual temperature.
Definition: mptrac.h:2493
double dt_met
Time step of meteo data [s].
Definition: mptrac.h:2593
double chemgrid_lat1
Upper latitude of chemistry grid [deg].
Definition: mptrac.h:2969
int met_geopot_sy
Latitudinal smoothing of geopotential heights.
Definition: mptrac.h:2719
double met_cms_eps_u
cmultiscale compression epsilon for zonal wind.
Definition: mptrac.h:2644
double turb_dx_strat
Horizontal turbulent diffusion coefficient (stratosphere) [m^2/s].
Definition: mptrac.h:2792
int qnt_vmr
Quantity array index for volume mixing ratio.
Definition: mptrac.h:2298
int qnt_lsm
Quantity array index for land-sea mask.
Definition: mptrac.h:2331
int qnt_theta
Quantity array index for potential temperature.
Definition: mptrac.h:2475
double bound_lat1
Boundary conditions maximum longitude [deg].
Definition: mptrac.h:2840
double stat_t1
Stop time for station output [s].
Definition: mptrac.h:3243
double turb_dx_trop
Horizontal turbulent diffusion coefficient (troposphere) [m^2/s].
Definition: mptrac.h:2789
int grid_type
Type of grid data files (0=ASCII, 1=netCDF).
Definition: mptrac.h:3177
double csi_lon0
Lower longitude of gridded CSI data [deg].
Definition: mptrac.h:3102
int qnt_pbl
Quantity array index for boundary layer pressure.
Definition: mptrac.h:2337
int grid_stddev
Include standard deviations in grid output (0=no, 1=yes).
Definition: mptrac.h:3147
int qnt_psice
Quantity array index for saturation pressure over ice.
Definition: mptrac.h:2460
double chemgrid_lon0
Lower longitude of chemistry grid [deg].
Definition: mptrac.h:2957
int bound_pbl
Boundary conditions planetary boundary layer (0=no, 1=yes).
Definition: mptrac.h:2858
int qnt_mloss_wet
Quantity array index for total mass loss due to wet deposition.
Definition: mptrac.h:2445
int met_geopot_sx
Longitudinal smoothing of geopotential heights.
Definition: mptrac.h:2716
int met_sy
Smoothing for latitudes.
Definition: mptrac.h:2689
int qnt_ps
Quantity array index for surface pressure.
Definition: mptrac.h:2307
int rng_type
Random number generator (0=GSL, 1=Squares, 2=cuRAND).
Definition: mptrac.h:2780
int isosurf
Isosurface parameter (0=none, 1=pressure, 2=density, 3=theta, 4=balloon).
Definition: mptrac.h:2767
double bound_p1
Boundary conditions top pressure [hPa].
Definition: mptrac.h:2846
int qnt_zs
Quantity array index for surface geopotential height.
Definition: mptrac.h:2313
int prof_nz
Number of altitudes of gridded profile data.
Definition: mptrac.h:3186
double csi_dt_out
Time step for CSI output [s].
Definition: mptrac.h:3078
int met_cape
Convective available potential energy data (0=file, 1=calculate).
Definition: mptrac.h:2725
double csi_modmin
Minimum column density to trigger detection [kg/m^2].
Definition: mptrac.h:3087
int met_sx
Smoothing for longitudes.
Definition: mptrac.h:2686
double chemgrid_lon1
Upper longitude of chemistry grid [deg].
Definition: mptrac.h:2960
double turb_mesox
Horizontal scaling factor for mesoscale wind fluctuations.
Definition: mptrac.h:2804
double met_cms_eps_iwc
cmultiscale compression epsilon for cloud ice water content.
Definition: mptrac.h:2668
double met_cms_eps_swc
cmultiscale compression epsilon for cloud snow water content.
Definition: mptrac.h:2671
double met_cms_eps_v
cmultiscale compression epsilon for meridional wind.
Definition: mptrac.h:2647
double prof_z0
Lower altitude of gridded profile data [km].
Definition: mptrac.h:3189
int qnt_w
Quantity array index for vertical velocity.
Definition: mptrac.h:2370
double bound_vmr
Boundary conditions volume mixing ratio [ppv].
Definition: mptrac.h:2831
double met_tropo_pv
Dynamical tropopause potential vorticity threshold [PVU].
Definition: mptrac.h:2741
int prof_nx
Number of longitudes of gridded profile data.
Definition: mptrac.h:3195
int qnt_stat
Quantity array index for station flag.
Definition: mptrac.h:2292
int met_tropo
Tropopause definition (0=none, 1=clim, 2=cold point, 3=WMO_1st, 4=WMO_2nd, 5=dynamical).
Definition: mptrac.h:2738
int qnt_rp
Quantity array index for particle radius.
Definition: mptrac.h:2301
int met_mpi_share
Use MPI to share meteo (0=no, 1=yes).
Definition: mptrac.h:2756
double mixing_strat
Interparcel exchange parameter for mixing in the stratosphere.
Definition: mptrac.h:2915
int qnt_vz
Quantity array index for vertical velocity.
Definition: mptrac.h:2502
int qnt_ho2
Quantity array index for HO2 volume mixing ratio (climatology).
Definition: mptrac.h:2430
double csi_z1
Upper altitude of gridded CSI data [km].
Definition: mptrac.h:3096
double stat_t0
Start time for station output [s].
Definition: mptrac.h:3240
double oh_chem_beta
Beta parameter for diurnal variablity of OH.
Definition: mptrac.h:2978
int dd
Domain decomposition (0=no, 1=yes, with 2x2 if not specified).
Definition: mptrac.h:3268
int qnt_eta
Quantity array index for eta vertical coordinate.
Definition: mptrac.h:2487
double wet_depo_so2_ph
pH value used to calculate effective Henry constant of SO2.
Definition: mptrac.h:3014
double mixing_z0
Lower altitude of mixing grid [km].
Definition: mptrac.h:2921
int qnt_mloss_decay
Quantity array index for total mass loss due to exponential decay.
Definition: mptrac.h:2451
int atm_type_out
Type of atmospheric data files for output (-1=same as ATM_TYPE, 0=ASCII, 1=binary,...
Definition: mptrac.h:3060
int met_nlev
Number of meteo data model levels.
Definition: mptrac.h:2707
double dt_kpp
Time step for KPP chemistry [s].
Definition: mptrac.h:2987
double dry_depo_dp
Dry deposition surface layer [hPa].
Definition: mptrac.h:3023
int qnt_shf
Quantity array index for surface sensible heat flux.
Definition: mptrac.h:2328
int qnt_vs
Quantity array index for surface meridional wind.
Definition: mptrac.h:2319
int qnt_Cco
Quantity array index for CO volume mixing ratio (chemistry code).
Definition: mptrac.h:2529
double vtk_dt_out
Time step for VTK data output [s].
Definition: mptrac.h:3249
double t_stop
Stop time of simulation [s].
Definition: mptrac.h:2580
double conv_dt
Time interval for convection module [s].
Definition: mptrac.h:2822
int qnt_hno3
Quantity array index for HNO3 volume mixing ratio (climatology).
Definition: mptrac.h:2421
int met_clams
Read MPTRAC or CLaMS meteo data (0=MPTRAC, 1=CLaMS).
Definition: mptrac.h:2607
int qnt_h2ot
Quantity array index for tropopause water vapor volume mixing ratio.
Definition: mptrac.h:2349
int qnt_rh
Quantity array index for relative humidity over water.
Definition: mptrac.h:2469
double met_cms_eps_cc
cmultiscale compression epsilon for cloud cover.
Definition: mptrac.h:2674
double bound_lat0
Boundary conditions minimum longitude [deg].
Definition: mptrac.h:2837
double met_pbl_max
Maximum depth of planetary boundary layer [km].
Definition: mptrac.h:2734
int met_dx
Stride for longitudes.
Definition: mptrac.h:2677
int qnt_destination
Quantity array index for destination subdomain in domain decomposition.
Definition: mptrac.h:2571
int mixing_ny
Number of latitudes of mixing grid.
Definition: mptrac.h:2936
int met_convention
Meteo data layout (0=[lev, lat, lon], 1=[lon, lat, lev]).
Definition: mptrac.h:2596
int qnt_zeta_d
Quantity array index for diagnosed zeta vertical coordinate.
Definition: mptrac.h:2481
int tracer_chem
Switch for first order tracer chemistry module (0=off, 1=on).
Definition: mptrac.h:2990
double dt_mod
Time step of simulation [s].
Definition: mptrac.h:2583
int diffusion
Diffusion scheme (0=off, 1=fixed-K, 2=PBL).
Definition: mptrac.h:2783
int qnt_tnat
Quantity array index for T_NAT.
Definition: mptrac.h:2517
int qnt_eta_dot
Quantity array index for velocity of eta vertical coordinate.
Definition: mptrac.h:2490
int qnt_tice
Quantity array index for T_ice.
Definition: mptrac.h:2511
int qnt_zg
Quantity array index for geopotential height.
Definition: mptrac.h:2352
double vtk_offset
Vertical offset for VTK data [km].
Definition: mptrac.h:3258
int qnt_v
Quantity array index for meridional wind.
Definition: mptrac.h:2367
int qnt_mloss_dry
Quantity array index for total mass loss due to dry deposition.
Definition: mptrac.h:2448
double bound_vmr_trend
Boundary conditions volume mixing ratio trend [ppv/s].
Definition: mptrac.h:2834
int met_cache
Preload meteo data into disk cache (0=no, 1=yes).
Definition: mptrac.h:2753
int qnt_oh
Quantity array index for OH volume mixing ratio (climatology).
Definition: mptrac.h:2424
int qnt_Ch
Quantity array index for H volume mixing ratio (chemistry code).
Definition: mptrac.h:2535
int met_press_level_def
Use predefined pressure levels or not.
Definition: mptrac.h:2704
int oh_chem_reaction
Reaction type for OH chemistry (0=none, 2=bimolecular, 3=termolecular).
Definition: mptrac.h:2972
int qnt_h2o
Quantity array index for water vapor volume mixing ratio.
Definition: mptrac.h:2373
int prof_ny
Number of latitudes of gridded profile data.
Definition: mptrac.h:3204
int qnt_rhice
Quantity array index for relative humidity over ice.
Definition: mptrac.h:2472
int qnt_rho
Quantity array index for density of air.
Definition: mptrac.h:2361
double sample_dz
Layer depth for sample output [km].
Definition: mptrac.h:3225
double tdec_strat
Life time of particles in the stratosphere [s].
Definition: mptrac.h:2870
int obs_type
Type of observation data files (0=ASCII, 1=netCDF).
Definition: mptrac.h:3069
double met_cms_eps_lwc
cmultiscale compression epsilon for cloud liquid water content.
Definition: mptrac.h:2662
int qnt_us
Quantity array index for surface zonal wind.
Definition: mptrac.h:2316
double met_cms_eps_z
cmultiscale compression epsilon for geopotential height.
Definition: mptrac.h:2638
double grid_lon1
Upper longitude of gridded data [deg].
Definition: mptrac.h:3165
int qnt_Cn2o
Quantity array index for N2O volume mixing ratio (chemistry code).
Definition: mptrac.h:2559
int qnt_Cccl3f
Quantity array index for CFC-11 volume mixing ratio (chemistry code).
Definition: mptrac.h:2553
double mixing_lat0
Lower latitude of mixing grid [deg].
Definition: mptrac.h:2939
int nens
Number of ensembles.
Definition: mptrac.h:3117
int qnt_pt
Quantity array index for tropopause pressure.
Definition: mptrac.h:2340
int qnt_cl
Quantity array index for total column cloud water.
Definition: mptrac.h:2400
int advect
Advection scheme (0=off, 1=Euler, 2=midpoint, 4=Runge-Kutta).
Definition: mptrac.h:2773
double prof_z1
Upper altitude of gridded profile data [km].
Definition: mptrac.h:3192
int qnt_t
Quantity array index for temperature.
Definition: mptrac.h:2358
int atm_filter
Time filter for atmospheric data output (0=none, 1=missval, 2=remove).
Definition: mptrac.h:3048
int kpp_chem
Switch for KPP chemistry module (0=off, 1=on).
Definition: mptrac.h:2984
int qnt_zeta
Quantity array index for zeta vertical coordinate.
Definition: mptrac.h:2478
double conv_pbl_trans
Depth of PBL transition layer (fraction of PBL depth).
Definition: mptrac.h:2813
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:2600
double csi_z0
Lower altitude of gridded CSI data [km].
Definition: mptrac.h:3093
int qnt_lapse
Quantity array index for lapse rate.
Definition: mptrac.h:2496
double stat_lat
Latitude of station [deg].
Definition: mptrac.h:3234
int qnt_Cho2
Quantity array index for HO2 volume mixing ratio (chemistry code).
Definition: mptrac.h:2538
int grid_ny
Number of latitudes of gridded data.
Definition: mptrac.h:3168
int qnt_Csf6
Quantity array index for SF6 volume mixing ratio (chemistry code).
Definition: mptrac.h:2562
int qnt_Ch2o
Quantity array index for H2O volume mixing ratio (chemistry code).
Definition: mptrac.h:2523
double met_detrend
FWHM of horizontal Gaussian used for detrending [km].
Definition: mptrac.h:2695
int conv_mix_pbl
Vertical mixing in the PBL (0=off, 1=on).
Definition: mptrac.h:2810
double bound_dps
Boundary conditions surface layer depth [hPa].
Definition: mptrac.h:2849
int dd_nbr_neighbours
Domain decomposition number of neighbours to communicate with.
Definition: mptrac.h:3277
double met_cms_eps_t
cmultiscale compression epsilon for temperature.
Definition: mptrac.h:2641
int chemgrid_nz
Number of altitudes of chemistry grid.
Definition: mptrac.h:2945
int qnt_cape
Quantity array index for convective available potential energy (CAPE).
Definition: mptrac.h:2412
int qnt_zeta_dot
Quantity array index for velocity of zeta vertical coordinate.
Definition: mptrac.h:2484
double bound_mass_trend
Boundary conditions mass per particle trend [kg/s].
Definition: mptrac.h:2828
int mixing_nz
Number of altitudes of mixing grid.
Definition: mptrac.h:2918
int qnt_o3c
Quantity array index for total column ozone.
Definition: mptrac.h:2418
double bound_p0
Boundary conditions bottom pressure [hPa].
Definition: mptrac.h:2843
double mixing_lon0
Lower longitude of mixing grid [deg].
Definition: mptrac.h:2930
int qnt_Co3
Quantity array index for O3 volume mixing ratio (chemistry code).
Definition: mptrac.h:2526
int qnt_tsts
Quantity array index for T_STS.
Definition: mptrac.h:2514
int grid_nz
Number of altitudes of gridded data.
Definition: mptrac.h:3150
int qnt_nss
Quantity array index for northward turbulent surface stress.
Definition: mptrac.h:2325
double ens_dt_out
Time step for ensemble output [s].
Definition: mptrac.h:3123
int atm_stride
Particle index stride for atmospheric data files.
Definition: mptrac.h:3051
int met_relhum
Try to read relative humidity (0=no, 1=yes).
Definition: mptrac.h:2722
double mixing_lat1
Upper latitude of mixing grid [deg].
Definition: mptrac.h:2942
double atm_dt_out
Time step for atmospheric data output [s].
Definition: mptrac.h:3045
double prof_lat1
Upper latitude of gridded profile data [deg].
Definition: mptrac.h:3210
int met_cms_batch
cmultiscale batch size.
Definition: mptrac.h:2628
double psc_h2o
H2O volume mixing ratio for PSC analysis.
Definition: mptrac.h:3029
int met_sp
Smoothing for pressure levels.
Definition: mptrac.h:2692
double prof_lon0
Lower longitude of gridded profile data [deg].
Definition: mptrac.h:3198
int chemgrid_nx
Number of longitudes of chemistry grid.
Definition: mptrac.h:2954
int qnt_pct
Quantity array index for cloud top pressure.
Definition: mptrac.h:2394
int qnt_mloss_kpp
Quantity array index for total mass loss due to KPP chemistry.
Definition: mptrac.h:2442
int qnt_psat
Quantity array index for saturation pressure over water.
Definition: mptrac.h:2457
int qnt_subdomain
Quantity array index for current subdomain in domain decomposition.
Definition: mptrac.h:2568
double prof_lat0
Lower latitude of gridded profile data [deg].
Definition: mptrac.h:3207
int qnt_cin
Quantity array index for convective inhibition (CIN).
Definition: mptrac.h:2415
double psc_hno3
HNO3 volume mixing ratio for PSC analysis.
Definition: mptrac.h:3032
double prof_lon1
Upper longitude of gridded profile data [deg].
Definition: mptrac.h:3201
double met_cms_eps_rwc
cmultiscale compression epsilon for cloud rain water content.
Definition: mptrac.h:2665
int met_nc_quant
Number of digits for quantization of netCDF meteo files (0=off).
Definition: mptrac.h:2616
int h2o2_chem_reaction
Reaction type for H2O2 chemistry (0=none, 1=SO2).
Definition: mptrac.h:2981
int qnt_Co3p
Quantity array index for O(3P) volume mixing ratio (chemistry code).
Definition: mptrac.h:2547
double wet_depo_bc_ret_ratio
Coefficients for wet deposition below cloud: retention ratio.
Definition: mptrac.h:3020
int chemgrid_ny
Number of latitudes of chemistry grid.
Definition: mptrac.h:2963
double met_cms_eps_o3
cmultiscale compression epsilon for ozone.
Definition: mptrac.h:2659
int met_cms_zstd
cmultiscale ZSTD compression (0=off, 1=on).
Definition: mptrac.h:2631
int grid_sparse
Sparse output in grid data files (0=no, 1=yes).
Definition: mptrac.h:3138
double dry_depo_vdep
Dry deposition velocity [m/s].
Definition: mptrac.h:3026
int qnt_tt
Quantity array index for tropopause temperature.
Definition: mptrac.h:2343
int met_np
Number of target pressure levels.
Definition: mptrac.h:2698
int qnt_ens
Quantity array index for ensemble IDs.
Definition: mptrac.h:2289
int met_nc_level
zlib compression level of netCDF meteo files (0=off).
Definition: mptrac.h:2613
double mixing_dt
Time interval for mixing [s].
Definition: mptrac.h:2909
int qnt_mloss_h2o2
Quantity array index for total mass loss due to H2O2 chemistry.
Definition: mptrac.h:2439
double vtk_scale
Vertical scaling factor for VTK data.
Definition: mptrac.h:3255
double met_cms_eps_w
cmultiscale compression epsilon for vertical velocity.
Definition: mptrac.h:2650
double turb_dx_pbl
Horizontal turbulent diffusion coefficient (PBL) [m^2/s].
Definition: mptrac.h:2786
double conv_cin
CIN threshold for convection module [J/kg].
Definition: mptrac.h:2819
int qnt_pv
Quantity array index for potential vorticity.
Definition: mptrac.h:2505
int advect_vert_coord
Vertical velocity of air parcels (0=omega_on_plev, 1=zetadot_on_mlev, 2=omega_on_mlev,...
Definition: mptrac.h:2777
int qnt_mloss_oh
Quantity array index for total mass loss due to OH chemistry.
Definition: mptrac.h:2436
int qnt_Ch2o2
Quantity array index for H2O2 volume mixing ratio (chemistry code).
Definition: mptrac.h:2541
int qnt_sst
Quantity array index for sea surface temperature.
Definition: mptrac.h:2334
double mixing_lon1
Upper longitude of mixing grid [deg].
Definition: mptrac.h:2933
int atm_nc_level
zlib compression level of netCDF atmospheric data files (0=off).
Definition: mptrac.h:3063
int met_cms_heur
cmultiscale coarsening heuristics (0=default, 1=mean diff, 2=median diff, 3=max diff).
Definition: mptrac.h:2635
double wet_depo_ic_ret_ratio
Coefficients for wet deposition in cloud: retention ratio.
Definition: mptrac.h:3017
int qnt_sh
Quantity array index for specific humidity.
Definition: mptrac.h:2466
int qnt_ess
Quantity array index for eastward turbulent surface stress.
Definition: mptrac.h:2322
double wet_depo_ic_b
Coefficient B for wet deposition in cloud (exponential form).
Definition: mptrac.h:3005
double wet_depo_bc_b
Coefficient B for wet deposition below cloud (exponential form).
Definition: mptrac.h:2999
int met_dy
Stride for latitudes.
Definition: mptrac.h:2680
int qnt_Cx
Quantity array index for trace species x volume mixing ratio (chemistry code).
Definition: mptrac.h:2520
double turb_dz_strat
Vertical turbulent diffusion coefficient (stratosphere) [m^2/s].
Definition: mptrac.h:2801
double bound_zetas
Boundary conditions surface layer zeta [K].
Definition: mptrac.h:2855
int dd_subdomains_zonal
Domain decomposition zonal subdomain number.
Definition: mptrac.h:3271
int qnt_idx
Quantity array index for air parcel IDs.
Definition: mptrac.h:2286
double met_tropo_theta
Dynamical tropopause potential temperature threshold [K].
Definition: mptrac.h:2744
int qnt_rwc
Quantity array index for cloud rain water content.
Definition: mptrac.h:2382
double t_start
Start time of simulation [s].
Definition: mptrac.h:2577
int nq
Number of quantities.
Definition: mptrac.h:2271
double tdec_trop
Life time of particles in the troposphere [s].
Definition: mptrac.h:2867
double sample_dx
Horizontal radius for sample output [km].
Definition: mptrac.h:3222
int vtk_stride
Particle index stride for VTK data.
Definition: mptrac.h:3252
double turb_dz_pbl
Vertical turbulent diffusion coefficient (PBL) [m^2/s].
Definition: mptrac.h:2795
double grid_lat1
Upper latitude of gridded data [deg].
Definition: mptrac.h:3174
int dd_subdomains_meridional
Domain decomposition meridional subdomain number.
Definition: mptrac.h:3274
int qnt_zt
Quantity array index for tropopause geopotential height.
Definition: mptrac.h:2346
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:2604
int qnt_cc
Quantity array index for cloud cover.
Definition: mptrac.h:2391
int qnt_plcl
Quantity array index for pressure at lifted condensation level (LCL).
Definition: mptrac.h:2403
double grid_dt_out
Time step for gridded data output [s].
Definition: mptrac.h:3135
int qnt_tdew
Quantity array index for dew point temperature.
Definition: mptrac.h:2508
Domain decomposition data structure.
Definition: mptrac.h:3720
int halo_offset_end
Hyperslab of boundary halos count.
Definition: mptrac.h:3772
int rank
Rank of node.
Definition: mptrac.h:3727
double subdomain_lon_min
Rectangular grid limit of subdomain.
Definition: mptrac.h:3748
double subdomain_lat_max
Rectangular grid limit of subdomain.
Definition: mptrac.h:3751
int init
Shows if domain decomposition was initialized.
Definition: mptrac.h:3779
double subdomain_lon_max
Rectangular grid limit of subdomain.
Definition: mptrac.h:3745
int halo_offset_start
Hyperslab of boundary halos count.
Definition: mptrac.h:3769
int size
Size of node.
Definition: mptrac.h:3730
double subdomain_lat_min
Rectangular grid limit of subdomain.
Definition: mptrac.h:3754
Meteo data structure.
Definition: mptrac.h:3546
int nx
Number of longitudes.
Definition: mptrac.h:3552
int ny
Number of latitudes.
Definition: mptrac.h:3555
int np
Number of pressure levels.
Definition: mptrac.h:3558
int npl
Number of model levels.
Definition: mptrac.h:3561
double time
Time [s].
Definition: mptrac.h:3549
Particle data.
Definition: mptrac.h:3321
double p
Pressure [hPa].
Definition: mptrac.h:3327
double lat
Latitude [deg].
Definition: mptrac.h:3333
double time
Time [s].
Definition: mptrac.h:3324
double lon
Longitude [deg].
Definition: mptrac.h:3330