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
108#ifndef LIBTRAC_H
109#define LIBTRAC_H
110
111/* ------------------------------------------------------------
112 Includes...
113 ------------------------------------------------------------ */
114
115#include <ctype.h>
116#include <gsl/gsl_fft_complex.h>
117#include <gsl/gsl_math.h>
118#include <gsl/gsl_randist.h>
119#include <gsl/gsl_rng.h>
120#include <gsl/gsl_spline.h>
121#include <gsl/gsl_statistics.h>
122#include <math.h>
123#include <netcdf.h>
124#include <omp.h>
125#include <stdint.h>
126#include <stdio.h>
127#include <stdlib.h>
128#include <string.h>
129#include <time.h>
130#include <sys/time.h>
131
132#ifdef MPI
133#include "mpi.h"
134#endif
135
136#ifdef _OPENACC
137#include "openacc.h"
138#endif
139
140#ifdef CURAND
141#include "curand.h"
142#endif
143
144#ifdef ZFP
145#include "zfp.h"
146#endif
147
148#ifdef ZSTD
149#include "zstd.h"
150#endif
151
152#ifdef CMS
153#include "cmultiscale.h"
154#endif
155
156#ifdef KPP
157#include "chem_Parameters.h"
158#include "chem_Global.h"
159#include "chem_Sparse.h"
160#endif
161
162#ifdef ECCODES
163#include "eccodes.h"
164#endif
165
166/* ------------------------------------------------------------
167 Constants...
168 ------------------------------------------------------------ */
169
171#ifndef AVO
172#define AVO 6.02214076e23
173#endif
174
176#ifndef CPD
177#define CPD 1003.5
178#endif
179
181#ifndef EPS
182#define EPS (MH2O / MA)
183#endif
184
186#ifndef G0
187#define G0 9.80665
188#endif
189
191#ifndef H0
192#define H0 7.0
193#endif
194
196#ifndef LV
197#define LV 2501000.
198#endif
199
201#ifndef KARMAN
202#define KARMAN 0.40
203#endif
204
206#ifndef KB
207#define KB 1.3806504e-23
208#endif
209
211#ifndef MA
212#define MA 28.9644
213#endif
214
216#ifndef MH2O
217#define MH2O 18.01528
218#endif
219
221#ifndef MO3
222#define MO3 48.00
223#endif
224
226#ifndef P0
227#define P0 1013.25
228#endif
229
231#ifndef RA
232#define RA (1e3 * RI / MA)
233#endif
234
236#ifndef RE
237#define RE 6367.421
238#endif
239
241#ifndef RI
242#define RI 8.3144598
243#endif
244
246#ifndef T0
247#define T0 273.15
248#endif
249
250/* ------------------------------------------------------------
251 Dimensions...
252 ------------------------------------------------------------ */
253
255#ifndef LEN
256#define LEN 5000
257#endif
258
260#ifndef NP
261#define NP 10000000
262#endif
263
265#ifndef NQ
266#define NQ 15
267#endif
268
270#ifndef NCSI
271#define NCSI 1000000
272#endif
273
275#ifndef EP
276#define EP 140
277#endif
278
280#ifndef EX
281#define EX 1202
282#endif
283
285#ifndef EY
286#define EY 602
287#endif
288
290#ifndef NENS
291#define NENS 2000
292#endif
293
295#ifndef NOBS
296#define NOBS 10000000
297#endif
298
300#ifndef NTHREADS
301#define NTHREADS 512
302#endif
303
305#ifndef CY
306#define CY 250
307#endif
308
310#ifndef CO3
311#define CO3 30
312#endif
313
315#ifndef CP
316#define CP 70
317#endif
318
320#ifndef CSZA
321#define CSZA 50
322#endif
323
325#ifndef CT
326#define CT 12
327#endif
328
330#ifndef CTS
331#define CTS 1000
332#endif
333
334/* ------------------------------------------------------------
335 Macros...
336 ------------------------------------------------------------ */
337
357#ifdef _OPENACC
358#define ALLOC(ptr, type, n) \
359 if(acc_get_num_devices(acc_device_nvidia) <= 0) \
360 ERRMSG("Not running on a GPU device!"); \
361 if((ptr=calloc((size_t)(n), sizeof(type)))==NULL) \
362 ERRMSG("Out of memory!");
363#else
364#define ALLOC(ptr, type, n) \
365 if((ptr=calloc((size_t)(n), sizeof(type)))==NULL) \
366 ERRMSG("Out of memory!");
367#endif
368
387#define ARRAY_2D(ix, iy, ny) \
388 ((ix) * (ny) + (iy))
389
406#define ARRAY_3D(ix, iy, ny, iz, nz) \
407 (((ix)*(ny) + (iy)) * (nz) + (iz))
408
431#define ARRHENIUS(a, b, t) \
432 ((a) * exp( -(b) / (t)))
433
455#define DEG2DX(dlon, lat) \
456 (RE * DEG2RAD(dlon) * cos(DEG2RAD(lat)))
457
476#define DEG2DY(dlat) \
477 (RE * DEG2RAD(dlat))
478
493#define DEG2RAD(deg) \
494 ((deg) * (M_PI / 180.0))
495
518#define DP2DZ(dp, p) \
519 (- (dp) * H0 / (p))
520
540#define DX2DEG(dx, lat) \
541 (((lat) < -89.999 || (lat) > 89.999) ? 0 \
542 : (dx) * 180. / (M_PI * RE * cos(DEG2RAD(lat))))
543
558#define DY2DEG(dy) \
559 ((dy) * 180. / (M_PI * RE))
560
577#define DZ2DP(dz, p) \
578 (-(dz) * (p) / H0)
579
593#define DIST(a, b) \
594 sqrt(DIST2(a, b))
595
609#define DIST2(a, b) \
610 ((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])+(a[2]-b[2])*(a[2]-b[2]))
611
625#define DOTP(a, b) \
626 (a[0]*b[0]+a[1]*b[1]+a[2]*b[2])
627
639#define ECC(cmd) { \
640 int ecc_result=(cmd); \
641 if(ecc_result!=0) \
642 ERRMSG("ECCODES error: %s", codes_get_error_message(ecc_result)); \
643 }
644
658#define ECC_READ_2D(variable,target,scaling_factor,found_flag){ \
659 if( strcmp(short_name,variable)==0){ \
660 for (int ix = 0; ix < met->nx; ix++) { \
661 for (int iy = 0; iy < met->ny; iy++) { \
662 target[ix][iy] = (float)(values[iy * met->nx + ix]*scaling_factor); \
663 } \
664 } \
665 found_flag =1; \
666 } \
667 }
668
682#define ECC_READ_3D(variable,level,target,scaling_factor,found_flag){ \
683 if( strcmp(short_name,variable)==0){ \
684 for (int ix = 0; ix < met->nx; ix++) { \
685 for (int iy = 0; iy < met->ny; iy++) { \
686 target[ix][iy][level] = (float) (values[iy * met->nx + ix]*scaling_factor); \
687 } \
688 } \
689 found_flag +=1; \
690 } \
691 }
692
709#define FMOD(x, y) \
710 ((x) - (int) ((x) / (y)) * (y))
711
727#define FREAD(ptr, type, size, in) { \
728 if(fread(ptr, sizeof(type), size, in)!=size) \
729 ERRMSG("Error while reading!"); \
730 }
731
747#define FWRITE(ptr, type, size, out) { \
748 if(fwrite(ptr, sizeof(type), size, out)!=size) \
749 ERRMSG("Error while writing!"); \
750 }
751
762#define INTPOL_INIT \
763 double cw[4] = {0.0, 0.0, 0.0, 0.0}; int ci[3] = {0, 0, 0};
764
776#define INTPOL_2D(var, init) \
777 intpol_met_time_2d(met0, met0->var, met1, met1->var, \
778 atm->time[ip], atm->lon[ip], atm->lat[ip], \
779 &var, ci, cw, init);
780
793#define INTPOL_3D(var, init) \
794 intpol_met_time_3d(met0, met0->var, met1, met1->var, \
795 atm->time[ip], atm->p[ip], \
796 atm->lon[ip], atm->lat[ip], \
797 &var, ci, cw, init);
798
812#define INTPOL_SPACE_ALL(p, lon, lat) { \
813 intpol_met_space_3d(met, met->z, p, lon, lat, &z, ci, cw, 1); \
814 intpol_met_space_3d(met, met->t, p, lon, lat, &t, ci, cw, 0); \
815 intpol_met_space_3d(met, met->u, p, lon, lat, &u, ci, cw, 0); \
816 intpol_met_space_3d(met, met->v, p, lon, lat, &v, ci, cw, 0); \
817 intpol_met_space_3d(met, met->w, p, lon, lat, &w, ci, cw, 0); \
818 intpol_met_space_3d(met, met->pv, p, lon, lat, &pv, ci, cw, 0); \
819 intpol_met_space_3d(met, met->h2o, p, lon, lat, &h2o, ci, cw, 0); \
820 intpol_met_space_3d(met, met->o3, p, lon, lat, &o3, ci, cw, 0); \
821 intpol_met_space_3d(met, met->lwc, p, lon, lat, &lwc, ci, cw, 0); \
822 intpol_met_space_3d(met, met->rwc, p, lon, lat, &rwc, ci, cw, 0); \
823 intpol_met_space_3d(met, met->iwc, p, lon, lat, &iwc, ci, cw, 0); \
824 intpol_met_space_3d(met, met->swc, p, lon, lat, &swc, ci, cw, 0); \
825 intpol_met_space_3d(met, met->cc, p, lon, lat, &cc, ci, cw, 0); \
826 intpol_met_space_2d(met, met->ps, lon, lat, &ps, ci, cw, 0); \
827 intpol_met_space_2d(met, met->ts, lon, lat, &ts, ci, cw, 0); \
828 intpol_met_space_2d(met, met->zs, lon, lat, &zs, ci, cw, 0); \
829 intpol_met_space_2d(met, met->us, lon, lat, &us, ci, cw, 0); \
830 intpol_met_space_2d(met, met->vs, lon, lat, &vs, ci, cw, 0); \
831 intpol_met_space_2d(met, met->ess, ess, lat, &ess, ci, cw, 0); \
832 intpol_met_space_2d(met, met->nss, nss, lat, &nss, ci, cw, 0); \
833 intpol_met_space_2d(met, met->shf, shf, lat, &shf, ci, cw, 0); \
834 intpol_met_space_2d(met, met->lsm, lon, lat, &lsm, ci, cw, 0); \
835 intpol_met_space_2d(met, met->sst, lon, lat, &sst, ci, cw, 0); \
836 intpol_met_space_2d(met, met->pbl, lon, lat, &pbl, ci, cw, 0); \
837 intpol_met_space_2d(met, met->pt, lon, lat, &pt, ci, cw, 0); \
838 intpol_met_space_2d(met, met->tt, lon, lat, &tt, ci, cw, 0); \
839 intpol_met_space_2d(met, met->zt, lon, lat, &zt, ci, cw, 0); \
840 intpol_met_space_2d(met, met->h2ot, lon, lat, &h2ot, ci, cw, 0); \
841 intpol_met_space_2d(met, met->pct, lon, lat, &pct, ci, cw, 0); \
842 intpol_met_space_2d(met, met->pcb, lon, lat, &pcb, ci, cw, 0); \
843 intpol_met_space_2d(met, met->cl, lon, lat, &cl, ci, cw, 0); \
844 intpol_met_space_2d(met, met->plcl, lon, lat, &plcl, ci, cw, 0); \
845 intpol_met_space_2d(met, met->plfc, lon, lat, &plfc, ci, cw, 0); \
846 intpol_met_space_2d(met, met->pel, lon, lat, &pel, ci, cw, 0); \
847 intpol_met_space_2d(met, met->cape, lon, lat, &cape, ci, cw, 0); \
848 intpol_met_space_2d(met, met->cin, lon, lat, &cin, ci, cw, 0); \
849 intpol_met_space_2d(met, met->o3c, lon, lat, &o3c, ci, cw, 0); \
850 }
851
866#define INTPOL_TIME_ALL(time, p, lon, lat) { \
867 intpol_met_time_3d(met0, met0->z, met1, met1->z, time, p, lon, lat, &z, ci, cw, 1); \
868 intpol_met_time_3d(met0, met0->t, met1, met1->t, time, p, lon, lat, &t, ci, cw, 0); \
869 intpol_met_time_3d(met0, met0->u, met1, met1->u, time, p, lon, lat, &u, ci, cw, 0); \
870 intpol_met_time_3d(met0, met0->v, met1, met1->v, time, p, lon, lat, &v, ci, cw, 0); \
871 intpol_met_time_3d(met0, met0->w, met1, met1->w, time, p, lon, lat, &w, ci, cw, 0); \
872 intpol_met_time_3d(met0, met0->pv, met1, met1->pv, time, p, lon, lat, &pv, ci, cw, 0); \
873 intpol_met_time_3d(met0, met0->h2o, met1, met1->h2o, time, p, lon, lat, &h2o, ci, cw, 0); \
874 intpol_met_time_3d(met0, met0->o3, met1, met1->o3, time, p, lon, lat, &o3, ci, cw, 0); \
875 intpol_met_time_3d(met0, met0->lwc, met1, met1->lwc, time, p, lon, lat, &lwc, ci, cw, 0); \
876 intpol_met_time_3d(met0, met0->rwc, met1, met1->rwc, time, p, lon, lat, &rwc, ci, cw, 0); \
877 intpol_met_time_3d(met0, met0->iwc, met1, met1->iwc, time, p, lon, lat, &iwc, ci, cw, 0); \
878 intpol_met_time_3d(met0, met0->swc, met1, met1->swc, time, p, lon, lat, &swc, ci, cw, 0); \
879 intpol_met_time_3d(met0, met0->cc, met1, met1->cc, time, p, lon, lat, &cc, ci, cw, 0); \
880 intpol_met_time_2d(met0, met0->ps, met1, met1->ps, time, lon, lat, &ps, ci, cw, 0); \
881 intpol_met_time_2d(met0, met0->ts, met1, met1->ts, time, lon, lat, &ts, ci, cw, 0); \
882 intpol_met_time_2d(met0, met0->zs, met1, met1->zs, time, lon, lat, &zs, ci, cw, 0); \
883 intpol_met_time_2d(met0, met0->us, met1, met1->us, time, lon, lat, &us, ci, cw, 0); \
884 intpol_met_time_2d(met0, met0->vs, met1, met1->vs, time, lon, lat, &vs, ci, cw, 0); \
885 intpol_met_time_2d(met0, met0->ess, met1, met1->ess, time, lon, lat, &ess, ci, cw, 0); \
886 intpol_met_time_2d(met0, met0->nss, met1, met1->nss, time, lon, lat, &nss, ci, cw, 0); \
887 intpol_met_time_2d(met0, met0->shf, met1, met1->shf, time, lon, lat, &shf, ci, cw, 0); \
888 intpol_met_time_2d(met0, met0->lsm, met1, met1->lsm, time, lon, lat, &lsm, ci, cw, 0); \
889 intpol_met_time_2d(met0, met0->sst, met1, met1->sst, time, lon, lat, &sst, ci, cw, 0); \
890 intpol_met_time_2d(met0, met0->pbl, met1, met1->pbl, time, lon, lat, &pbl, ci, cw, 0); \
891 intpol_met_time_2d(met0, met0->pt, met1, met1->pt, time, lon, lat, &pt, ci, cw, 0); \
892 intpol_met_time_2d(met0, met0->tt, met1, met1->tt, time, lon, lat, &tt, ci, cw, 0); \
893 intpol_met_time_2d(met0, met0->zt, met1, met1->zt, time, lon, lat, &zt, ci, cw, 0); \
894 intpol_met_time_2d(met0, met0->h2ot, met1, met1->h2ot, time, lon, lat, &h2ot, ci, cw, 0); \
895 intpol_met_time_2d(met0, met0->pct, met1, met1->pct, time, lon, lat, &pct, ci, cw, 0); \
896 intpol_met_time_2d(met0, met0->pcb, met1, met1->pcb, time, lon, lat, &pcb, ci, cw, 0); \
897 intpol_met_time_2d(met0, met0->cl, met1, met1->cl, time, lon, lat, &cl, ci, cw, 0); \
898 intpol_met_time_2d(met0, met0->plcl, met1, met1->plcl, time, lon, lat, &plcl, ci, cw, 0); \
899 intpol_met_time_2d(met0, met0->plfc, met1, met1->plfc, time, lon, lat, &plfc, ci, cw, 0); \
900 intpol_met_time_2d(met0, met0->pel, met1, met1->pel, time, lon, lat, &pel, ci, cw, 0); \
901 intpol_met_time_2d(met0, met0->cape, met1, met1->cape, time, lon, lat, &cape, ci, cw, 0); \
902 intpol_met_time_2d(met0, met0->cin, met1, met1->cin, time, lon, lat, &cin, ci, cw, 0); \
903 intpol_met_time_2d(met0, met0->o3c, met1, met1->o3c, time, lon, lat, &o3c, ci, cw, 0); \
904 }
905
920#define LAPSE(p1, t1, p2, t2) \
921 (1e3 * G0 / RA * ((t2) - (t1)) / ((t2) + (t1)) \
922 * ((p2) + (p1)) / ((p2) - (p1)))
923
939#define LIN(x0, y0, x1, y1, x) \
940 ((y0)+((y1)-(y0))/((x1)-(x0))*((x)-(x0)))
941
966#define MAX(a,b) \
967 (((a)>(b))?(a):(b))
968
980#define MET_HEADER \
981 fprintf(out, \
982 "# $1 = time [s]\n" \
983 "# $2 = altitude [km]\n" \
984 "# $3 = longitude [deg]\n" \
985 "# $4 = latitude [deg]\n" \
986 "# $5 = pressure [hPa]\n" \
987 "# $6 = temperature [K]\n" \
988 "# $7 = zonal wind [m/s]\n" \
989 "# $8 = meridional wind [m/s]\n" \
990 "# $9 = vertical velocity [hPa/s]\n" \
991 "# $10 = H2O volume mixing ratio [ppv]\n"); \
992 fprintf(out, \
993 "# $11 = O3 volume mixing ratio [ppv]\n" \
994 "# $12 = geopotential height [km]\n" \
995 "# $13 = potential vorticity [PVU]\n" \
996 "# $14 = surface pressure [hPa]\n" \
997 "# $15 = surface temperature [K]\n" \
998 "# $16 = surface geopotential height [km]\n" \
999 "# $17 = surface zonal wind [m/s]\n" \
1000 "# $18 = surface meridional wind [m/s]\n" \
1001 "# $19 = eastward turbulent surface stress [N/m^2]\n" \
1002 "# $20 = northward turbulent surface stress [N/m^2]\n"); \
1003 fprintf(out, \
1004 "# $21 = surface sensible heat flux [W/m^2]\n" \
1005 "# $22 = land-sea mask [1]\n" \
1006 "# $23 = sea surface temperature [K]\n" \
1007 "# $24 = tropopause pressure [hPa]\n" \
1008 "# $25 = tropopause geopotential height [km]\n" \
1009 "# $26 = tropopause temperature [K]\n" \
1010 "# $27 = tropopause water vapor [ppv]\n" \
1011 "# $28 = cloud liquid water content [kg/kg]\n" \
1012 "# $29 = cloud rain water content [kg/kg]\n" \
1013 "# $30 = cloud ice water content [kg/kg]\n"); \
1014 fprintf(out, \
1015 "# $31 = cloud snow water content [kg/kg]\n" \
1016 "# $32 = cloud cover [1]\n" \
1017 "# $33 = total column cloud water [kg/m^2]\n" \
1018 "# $34 = cloud top pressure [hPa]\n" \
1019 "# $35 = cloud bottom pressure [hPa]\n" \
1020 "# $36 = pressure at lifted condensation level (LCL) [hPa]\n" \
1021 "# $37 = pressure at level of free convection (LFC) [hPa]\n" \
1022 "# $38 = pressure at equilibrium level (EL) [hPa]\n" \
1023 "# $39 = convective available potential energy (CAPE) [J/kg]\n" \
1024 "# $40 = convective inhibition (CIN) [J/kg]\n"); \
1025 fprintf(out, \
1026 "# $41 = relative humidity over water [%%]\n" \
1027 "# $42 = relative humidity over ice [%%]\n" \
1028 "# $43 = dew point temperature [K]\n" \
1029 "# $44 = frost point temperature [K]\n" \
1030 "# $45 = NAT temperature [K]\n" \
1031 "# $46 = HNO3 volume mixing ratio [ppv]\n" \
1032 "# $47 = OH volume mixing ratio [ppv]\n" \
1033 "# $48 = H2O2 volume mixing ratio [ppv]\n" \
1034 "# $49 = HO2 volume mixing ratio [ppv]\n" \
1035 "# $50 = O(1D) volume mixing ratio [ppv]\n"); \
1036 fprintf(out, \
1037 "# $51 = boundary layer pressure [hPa]\n" \
1038 "# $52 = total column ozone [DU]\n" \
1039 "# $53 = number of data points\n" \
1040 "# $54 = number of tropopause data points\n" \
1041 "# $55 = number of CAPE data points\n");
1042
1067#define MIN(a,b) \
1068 (((a)<(b))?(a):(b))
1069
1082#define MOLEC_DENS(p,t) \
1083 (AVO * 1e-6 * ((p) * 100) / (RI * (t)))
1084
1096#define NC(cmd) { \
1097 int nc_result=(cmd); \
1098 if(nc_result!=NC_NOERR) \
1099 ERRMSG("%s", nc_strerror(nc_result)); \
1100 }
1101
1125#define NC_DEF_VAR(varname, type, ndims, dims, long_name, units, level, quant) { \
1126 NC(nc_def_var(ncid, varname, type, ndims, dims, &varid)); \
1127 NC(nc_put_att_text(ncid, varid, "long_name", strnlen(long_name, LEN), long_name)); \
1128 NC(nc_put_att_text(ncid, varid, "units", strnlen(units, LEN), units)); \
1129 if((quant) > 0) \
1130 NC(nc_def_var_quantize(ncid, varid, NC_QUANTIZE_GRANULARBR, quant)); \
1131 if((level) != 0) { \
1132 NC(nc_def_var_deflate(ncid, varid, 1, 1, level)); \
1133 /* unsigned int ulevel = (unsigned int)level; */ \
1134 /* NC(nc_def_var_filter(ncid, varid, 32015, 1, (unsigned int[]){ulevel})); */ \
1135 } \
1136 }
1137
1155#define NC_GET_DOUBLE(varname, ptr, force) { \
1156 if(force) { \
1157 NC(nc_inq_varid(ncid, varname, &varid)); \
1158 NC(nc_get_var_double(ncid, varid, ptr)); \
1159 } else { \
1160 if(nc_inq_varid(ncid, varname, &varid) == NC_NOERR) { \
1161 NC(nc_get_var_double(ncid, varid, ptr)); \
1162 } else \
1163 WARN("netCDF variable %s is missing!", varname); \
1164 } \
1165 }
1166
1183#define NC_INQ_DIM(dimname, ptr, min, max) { \
1184 int dimid; size_t naux; \
1185 NC(nc_inq_dimid(ncid, dimname, &dimid)); \
1186 NC(nc_inq_dimlen(ncid, dimid, &naux)); \
1187 *ptr = (int)naux; \
1188 if ((*ptr) < (min) || (*ptr) > (max)) \
1189 ERRMSG("Dimension %s is out of range!", dimname); \
1190 }
1191
1206#define NC_PUT_DOUBLE(varname, ptr, hyperslab) { \
1207 NC(nc_inq_varid(ncid, varname, &varid)); \
1208 if(hyperslab) { \
1209 NC(nc_put_vara_double(ncid, varid, start, count, ptr)); \
1210 } else { \
1211 NC(nc_put_var_double(ncid, varid, ptr)); \
1212 } \
1213 }
1214
1230#define NC_PUT_FLOAT(varname, ptr, hyperslab) { \
1231 NC(nc_inq_varid(ncid, varname, &varid)); \
1232 if(hyperslab) { \
1233 NC(nc_put_vara_float(ncid, varid, start, count, ptr)); \
1234 } else { \
1235 NC(nc_put_var_float(ncid, varid, ptr)); \
1236 } \
1237 }
1238
1253#define NC_PUT_INT(varname, ptr, hyperslab) { \
1254 NC(nc_inq_varid(ncid, varname, &varid)); \
1255 if(hyperslab) { \
1256 NC(nc_put_vara_int(ncid, varid, start, count, ptr)); \
1257 } else { \
1258 NC(nc_put_var_int(ncid, varid, ptr)); \
1259 } \
1260 }
1261
1275#define NC_PUT_ATT(varname, attname, text) { \
1276 NC(nc_inq_varid(ncid, varname, &varid)); \
1277 NC(nc_put_att_text(ncid, varid, attname, strnlen(text, LEN), text)); \
1278 }
1279
1292#define NC_PUT_ATT_GLOBAL(attname, text) \
1293 NC(nc_put_att_text(ncid, NC_GLOBAL, attname, strnlen(text, LEN), text));
1294
1312#define NN(x0, y0, x1, y1, x) \
1313 (fabs((x) - (x0)) <= fabs((x) - (x1)) ? (y0) : (y1))
1314
1327#define NORM(a) \
1328 sqrt(DOTP(a, a))
1329
1345#ifdef _OPENACC
1346#define PARTICLE_LOOP(ip0, ip1, check_dt, ...) \
1347 const int ip0_const = ip0; \
1348 const int ip1_const = ip1; \
1349 _Pragma(__VA_ARGS__) \
1350 _Pragma("acc parallel loop independent gang vector") \
1351 for (int ip = ip0_const; ip < ip1_const; ip++) \
1352 if (!check_dt || cache->dt[ip] != 0)
1353#else
1354#define PARTICLE_LOOP(ip0, ip1, check_dt, ...) \
1355 const int ip0_const = ip0; \
1356 const int ip1_const = ip1; \
1357 _Pragma("omp parallel for default(shared)") \
1358 for (int ip = ip0_const; ip < ip1_const; ip++) \
1359 if (!check_dt || cache->dt[ip] != 0)
1360#endif
1361
1384#define P(z) \
1385 (P0 * exp(-(z) / H0))
1386
1408#define PSAT(t) \
1409 (6.112 * exp(17.62 * ((t) - T0) / (243.12 + (t) - T0)))
1410
1432#define PSICE(t) \
1433 (6.112 * exp(22.46 * ((t) - T0) / (272.62 + (t) - T0)))
1434
1459#define PW(p, h2o) \
1460 ((p) * MAX((h2o), 0.1e-6) / (1. + (1. - EPS) * MAX((h2o), 0.1e-6)))
1461
1476#define RAD2DEG(rad) \
1477 ((rad) * (180.0 / M_PI))
1478
1506#define RH(p, t, h2o) \
1507 (PW(p, h2o) / PSAT(t) * 100.)
1508
1536#define RHICE(p, t, h2o) \
1537 (PW(p, h2o) / PSICE(t) * 100.)
1538
1561#define RHO(p, t) \
1562 (100. * (p) / (RA * (t)))
1563
1580#define SET_ATM(qnt, val) \
1581 if (ctl->qnt >= 0) \
1582 atm->q[ctl->qnt][ip] = val;
1583
1603#define SET_QNT(qnt, name, longname, unit) \
1604 if (strcasecmp(ctl->qnt_name[iq], name) == 0) { \
1605 ctl->qnt = iq; \
1606 sprintf(ctl->qnt_longname[iq], longname); \
1607 sprintf(ctl->qnt_unit[iq], unit); \
1608 } else
1609
1624#define SH(h2o) \
1625 (EPS * MAX((h2o), 0.1e-6))
1626
1637#define SQR(x) \
1638 ((x)*(x))
1639
1651#define SWAP(x, y, type) \
1652 do {type tmp = x; x = y; y = tmp;} while(0);
1653
1675#define TDEW(p, h2o) \
1676 (T0 + 243.12 * log(PW((p), (h2o)) / 6.112) \
1677 / (17.62 - log(PW((p), (h2o)) / 6.112)))
1678
1700#define TICE(p, h2o) \
1701 (T0 + 272.62 * log(PW((p), (h2o)) / 6.112) \
1702 / (22.46 - log(PW((p), (h2o)) / 6.112)))
1703
1724#define THETA(p, t) \
1725 ((t) * pow(1000. / (p), 0.286))
1726
1753#define THETAVIRT(p, t, h2o) \
1754 (TVIRT(THETA((p), (t)), MAX((h2o), 0.1e-6)))
1755
1774#define TOK(line, tok, format, var) { \
1775 if(((tok)=strtok((line), " \t"))) { \
1776 if(sscanf(tok, format, &(var))!=1) continue; \
1777 } else ERRMSG("Error while reading!"); \
1778 }
1779
1799#define TVIRT(t, h2o) \
1800 ((t) * (1. + (1. - EPS) * MAX((h2o), 0.1e-6)))
1801
1821#define Z(p) \
1822 (H0 * log(P0 / (p)))
1823
1852#define ZDIFF(lnp0, t0, h2o0, lnp1, t1, h2o1) \
1853 (RI / MA / G0 * 0.5 * (TVIRT((t0), (h2o0)) + TVIRT((t1), (h2o1))) \
1854 * ((lnp0) - (lnp1)))
1855
1871#define ZETA(ps, p, t) \
1872 (((p) / (ps) <= 0.3 ? 1. : \
1873 sin(M_PI / 2. * (1. - (p) / (ps)) / (1. - 0.3))) \
1874 * THETA((p), (t)))
1875
1876/* ------------------------------------------------------------
1877 Log messages...
1878 ------------------------------------------------------------ */
1879
1881#ifndef LOGLEV
1882#define LOGLEV 2
1883#endif
1884
1914#define LOG(level, ...) { \
1915 if(level >= 2) \
1916 printf(" "); \
1917 if(level <= LOGLEV) { \
1918 printf(__VA_ARGS__); \
1919 printf("\n"); \
1920 } \
1921 }
1922
1951#define WARN(...) { \
1952 printf("\nWarning (%s, %s, l%d): ", __FILE__, __func__, __LINE__); \
1953 LOG(0, __VA_ARGS__); \
1954 }
1955
1984#define ERRMSG(...) { \
1985 printf("\nError (%s, %s, l%d): ", __FILE__, __func__, __LINE__); \
1986 LOG(0, __VA_ARGS__); \
1987 exit(EXIT_FAILURE); \
1988 }
1989
2019#define PRINT(format, var) \
2020 printf("Print (%s, %s, l%d): %s= "format"\n", \
2021 __FILE__, __func__, __LINE__, #var, var);
2022
2023/* ------------------------------------------------------------
2024 Timers...
2025 ------------------------------------------------------------ */
2026
2028#define NTIMER 100
2029
2043#define PRINT_TIMERS \
2044 timer("END", "END", 1);
2045
2064#define SELECT_TIMER(id, group, color) { \
2065 NVTX_POP; \
2066 NVTX_PUSH(id, color); \
2067 timer(id, group, 0); \
2068 }
2069
2083#define START_TIMERS \
2084 NVTX_PUSH("START", NVTX_CPU);
2085
2098#define STOP_TIMERS \
2099 NVTX_POP;
2100
2101/* ------------------------------------------------------------
2102 NVIDIA Tools Extension (NVTX)...
2103 ------------------------------------------------------------ */
2104
2105#ifdef NVTX
2106#include "nvToolsExt.h"
2107
2109#define NVTX_CPU 0xFFADD8E6
2110
2112#define NVTX_GPU 0xFF00008B
2113
2115#define NVTX_H2D 0xFFFFFF00
2116
2118#define NVTX_D2H 0xFFFF8800
2119
2121#define NVTX_READ 0xFFFFCCCB
2122
2124#define NVTX_WRITE 0xFF8B0000
2125
2127#define NVTX_RECV 0xFFCCFFCB
2128
2130#define NVTX_SEND 0xFF008B00
2131
2161#define NVTX_PUSH(range_title, range_color) { \
2162 nvtxEventAttributes_t eventAttrib = {0}; \
2163 eventAttrib.version = NVTX_VERSION; \
2164 eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; \
2165 eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; \
2166 eventAttrib.colorType = NVTX_COLOR_ARGB; \
2167 eventAttrib.color = range_color; \
2168 eventAttrib.message.ascii = range_title; \
2169 nvtxRangePushEx(&eventAttrib); \
2170 }
2171
2184#define NVTX_POP { \
2185 nvtxRangePop(); \
2186 }
2187#else
2188
2189/* Empty definitions of NVTX_PUSH and NVTX_POP... */
2190#define NVTX_PUSH(range_title, range_color) {}
2191#define NVTX_POP {}
2192#endif
2193
2194/* ------------------------------------------------------------
2195 Thrust...
2196 ------------------------------------------------------------ */
2197
2223 double *__restrict__ c,
2224 int n,
2225 int *__restrict__ index);
2226
2227/* ------------------------------------------------------------
2228 Structs...
2229 ------------------------------------------------------------ */
2230
2238typedef struct {
2239
2240 /* ------------------------------------------------------------
2241 Quantity parameters...
2242 ------------------------------------------------------------ */
2243
2245 int nq;
2246
2248 char qnt_name[NQ][LEN];
2249
2251 char qnt_longname[NQ][LEN];
2252
2254 char qnt_unit[NQ][LEN];
2255
2257 char qnt_format[NQ][LEN];
2258
2261
2264
2267
2270
2273
2276
2279
2282
2285
2288
2291
2294
2297
2300
2303
2306
2309
2312
2315
2318
2321
2324
2327
2330
2333
2336
2339
2342
2345
2348
2351
2354
2357
2360
2363
2366
2369
2372
2375
2378
2381
2384
2387
2390
2393
2396
2399
2402
2405
2408
2411
2414
2417
2420
2423
2426
2429
2432
2435
2438
2441
2444
2447
2450
2453
2456
2459
2462
2465
2468
2471
2474
2477
2480
2483
2486
2489
2492
2495
2498
2501
2504
2507
2510
2513
2516
2519
2522
2525
2528
2531
2534
2536 double t_start;
2537
2539 double t_stop;
2540
2542 double dt_mod;
2543
2544 /* ------------------------------------------------------------
2545 Meteo data parameters...
2546 ------------------------------------------------------------ */
2547
2549 char metbase[LEN];
2550
2552 double dt_met;
2553
2556
2560
2564
2567
2570
2573
2576
2579
2582
2585
2588
2591
2594
2598
2601
2604
2607
2610
2613
2616
2619
2622
2625
2628
2631
2634
2637
2640
2643
2646
2649
2652
2655
2658
2661
2663 double met_p[EP];
2664
2667
2670
2672 double met_lev_hyam[EP];
2673
2675 double met_lev_hybm[EP];
2676
2679
2682
2685
2688
2691
2694
2697
2701
2704
2707
2710
2713
2716
2719
2720 /* ------------------------------------------------------------
2721 Geophysical module parameters...
2722 ------------------------------------------------------------ */
2723
2725 double sort_dt;
2726
2730
2732 char balloon[LEN];
2733
2736
2740
2743
2746
2749
2752
2755
2758
2761
2764
2767
2770
2773
2776
2779
2781 double conv_cin;
2782
2784 double conv_dt;
2785
2788
2791
2794
2797
2800
2803
2805 double bound_p0;
2806
2808 double bound_p1;
2809
2812
2815
2818
2821
2823 char species[LEN];
2824
2826 double molmass;
2827
2830
2833
2836
2838 char clim_hno3_filename[LEN];
2839
2841 char clim_oh_filename[LEN];
2842
2844 char clim_h2o2_filename[LEN];
2845
2847 char clim_ho2_filename[LEN];
2848
2850 char clim_o1d_filename[LEN];
2851
2853 char clim_o3_filename[LEN];
2854
2856 char clim_ccl4_timeseries[LEN];
2857
2859 char clim_ccl3f_timeseries[LEN];
2860
2862 char clim_ccl2f2_timeseries[LEN];
2863
2865 char clim_n2o_timeseries[LEN];
2866
2868 char clim_sf6_timeseries[LEN];
2869
2872
2875
2878
2881
2884
2887
2890
2893
2896
2899
2902
2905
2908
2911
2914
2917
2920
2923
2926
2929
2932
2935
2937 double oh_chem[4];
2938
2941
2944
2947
2949 double dt_kpp;
2950
2953
2955 double wet_depo_pre[2];
2956
2959
2962
2965
2968
2970 double wet_depo_ic_h[2];
2971
2973 double wet_depo_bc_h[2];
2974
2977
2980
2983
2986
2989
2991 double psc_h2o;
2992
2994 double psc_hno3;
2995
2996 /* ------------------------------------------------------------
2997 Output parameters...
2998 ------------------------------------------------------------ */
2999
3001 char atm_basename[LEN];
3002
3004 char atm_gpfile[LEN];
3005
3008
3011
3014
3018
3023
3026
3028 int atm_nc_quant[NQ];
3029
3032
3034 char csi_basename[LEN];
3035
3037 char csi_ens_basename[LEN];
3038
3040 int nens;
3041
3043 char csi_kernel[LEN];
3044
3047
3049 char csi_obsfile[LEN];
3050
3053
3056
3059
3061 double csi_z0;
3062
3064 double csi_z1;
3065
3068
3070 double csi_lon0;
3071
3073 double csi_lon1;
3074
3077
3079 double csi_lat0;
3080
3082 double csi_lat1;
3083
3085 char ens_basename[LEN];
3086
3089
3091 char grid_basename[LEN];
3092
3094 char grid_kernel[LEN];
3095
3097 char grid_gpfile[LEN];
3098
3101
3104
3107
3109 int grid_nc_quant[NQ];
3110
3113
3116
3118 double grid_z0;
3119
3121 double grid_z1;
3122
3125
3128
3131
3134
3137
3140
3143
3145 char prof_basename[LEN];
3146
3148 char prof_obsfile[LEN];
3149
3152
3154 double prof_z0;
3155
3157 double prof_z1;
3158
3161
3164
3167
3170
3173
3176
3178 char sample_basename[LEN];
3179
3181 char sample_kernel[LEN];
3182
3184 char sample_obsfile[LEN];
3185
3188
3191
3193 char stat_basename[LEN];
3194
3196 double stat_lon;
3197
3199 double stat_lat;
3200
3202 double stat_r;
3203
3205 double stat_t0;
3206
3208 double stat_t1;
3209
3211 char vtk_basename[LEN];
3212
3215
3218
3221
3224
3227
3228} ctl_t;
3229
3238typedef struct {
3239
3241 int np;
3242
3244 double time[NP];
3245
3247 double p[NP];
3248
3250 double lon[NP];
3251
3253 double lat[NP];
3254
3256 double q[NQ][NP];
3257
3258} atm_t;
3259
3266typedef struct {
3267
3269 double iso_var[NP];
3270
3272 double iso_ps[NP];
3273
3275 double iso_ts[NP];
3276
3279
3281 float uvwp[NP][3];
3282
3284 double rs[3 * NP + 1];
3285
3287 double dt[NP];
3288
3289} cache_t;
3290
3298typedef struct {
3299
3301 int np;
3302
3304 int nsza;
3305
3307 int no3c;
3308
3310 double p[CP];
3311
3313 double sza[CSZA];
3314
3316 double o3c[CO3];
3317
3319 double n2o[CP][CSZA][CO3];
3320
3322 double ccl4[CP][CSZA][CO3];
3323
3325 double ccl3f[CP][CSZA][CO3];
3326
3328 double ccl2f2[CP][CSZA][CO3];
3329
3331 double o2[CP][CSZA][CO3];
3332
3334 double o3_1[CP][CSZA][CO3];
3335
3337 double o3_2[CP][CSZA][CO3];
3338
3340 double h2o2[CP][CSZA][CO3];
3341
3343 double h2o[CP][CSZA][CO3];
3344
3345} clim_photo_t;
3346
3354typedef struct {
3355
3358
3360 double time[CTS];
3361
3363 double vmr[CTS];
3364
3365} clim_ts_t;
3366
3374typedef struct {
3375
3378
3380 int nlat;
3381
3383 int np;
3384
3386 double time[CT];
3387
3389 double lat[CY];
3390
3392 double p[CP];
3393
3395 double vmr[CT][CP][CY];
3396
3397} clim_zm_t;
3398
3406typedef struct {
3407
3410
3413
3415 double tropo_time[12];
3416
3418 double tropo_lat[73];
3419
3421 double tropo[12][73];
3422
3425
3428
3431
3434
3437
3440
3443
3446
3449
3452
3455
3456} clim_t;
3457
3465typedef struct {
3466
3468 double time;
3469
3471 int nx;
3472
3474 int ny;
3475
3477 int np;
3478
3480 int npl;
3481
3483 double lon[EX];
3484
3486 double lat[EY];
3487
3489 double p[EP];
3490
3492 double hybrid[EP];
3493
3495 float ps[EX][EY];
3496
3498 float ts[EX][EY];
3499
3501 float zs[EX][EY];
3502
3504 float us[EX][EY];
3505
3507 float vs[EX][EY];
3508
3510 float ess[EX][EY];
3511
3513 float nss[EX][EY];
3514
3516 float shf[EX][EY];
3517
3519 float lsm[EX][EY];
3520
3522 float sst[EX][EY];
3523
3525 float pbl[EX][EY];
3526
3528 float pt[EX][EY];
3529
3531 float tt[EX][EY];
3532
3534 float zt[EX][EY];
3535
3537 float h2ot[EX][EY];
3538
3540 float pct[EX][EY];
3541
3543 float pcb[EX][EY];
3544
3546 float cl[EX][EY];
3547
3549 float plcl[EX][EY];
3550
3552 float plfc[EX][EY];
3553
3555 float pel[EX][EY];
3556
3558 float cape[EX][EY];
3559
3561 float cin[EX][EY];
3562
3564 float o3c[EX][EY];
3565
3567 float z[EX][EY][EP];
3568
3570 float t[EX][EY][EP];
3571
3573 float u[EX][EY][EP];
3574
3576 float v[EX][EY][EP];
3577
3579 float w[EX][EY][EP];
3580
3582 float pv[EX][EY][EP];
3583
3585 float h2o[EX][EY][EP];
3586
3588 float o3[EX][EY][EP];
3589
3591 float lwc[EX][EY][EP];
3592
3594 float rwc[EX][EY][EP];
3595
3597 float iwc[EX][EY][EP];
3598
3600 float swc[EX][EY][EP];
3601
3603 float cc[EX][EY][EP];
3604
3606 float pl[EX][EY][EP];
3607
3609 float ul[EX][EY][EP];
3610
3612 float vl[EX][EY][EP];
3613
3615 float wl[EX][EY][EP];
3616
3618 float zetal[EX][EY][EP];
3619
3621 float zeta_dotl[EX][EY][EP];
3622
3623} met_t;
3624
3625/* ------------------------------------------------------------
3626 OpenACC routines...
3627 ------------------------------------------------------------ */
3628
3629#ifdef _OPENACC
3630#pragma acc routine (clim_oh)
3631#pragma acc routine (clim_photo)
3632#pragma acc routine (clim_tropo)
3633#pragma acc routine (clim_ts)
3634#pragma acc routine (clim_zm)
3635#pragma acc routine (intpol_check_lon_lat)
3636#pragma acc routine (intpol_met_4d_coord)
3637#pragma acc routine (intpol_met_space_3d)
3638#pragma acc routine (intpol_met_space_3d_ml)
3639#pragma acc routine (intpol_met_space_2d)
3640#pragma acc routine (intpol_met_time_3d)
3641#pragma acc routine (intpol_met_time_3d_ml)
3642#pragma acc routine (intpol_met_time_2d)
3643#pragma acc routine (kernel_weight)
3644#pragma acc routine (lapse_rate)
3645#pragma acc routine (locate_irr)
3646#pragma acc routine (locate_irr_float)
3647#pragma acc routine (locate_reg)
3648#pragma acc routine (locate_vert)
3649#pragma acc routine (nat_temperature)
3650#pragma acc routine (pbl_weight)
3651#pragma acc routine (sedi)
3652#pragma acc routine (stddev)
3653#pragma acc routine (sza_calc)
3654#pragma acc routine (tropo_weight)
3655#endif
3656
3657/* ------------------------------------------------------------
3658 Functions...
3659 ------------------------------------------------------------ */
3660
3683 void *data,
3684 size_t N);
3685
3700void cart2geo(
3701 const double *x,
3702 double *z,
3703 double *lon,
3704 double *lat);
3705
3728double clim_oh(
3729 const ctl_t * ctl,
3730 const clim_t * clim,
3731 const double t,
3732 const double lon,
3733 const double lat,
3734 const double p);
3735
3755 const ctl_t * ctl,
3756 clim_t * clim);
3757
3787double clim_photo(
3788 const double rate[CP][CSZA][CO3],
3789 const clim_photo_t * photo,
3790 const double p,
3791 const double sza,
3792 const double o3c);
3793
3819double clim_tropo(
3820 const clim_t * clim,
3821 const double t,
3822 const double lat);
3823
3842void clim_tropo_init(
3843 clim_t * clim);
3844
3861double clim_ts(
3862 const clim_ts_t * ts,
3863 const double t);
3864
3886double clim_zm(
3887 const clim_zm_t * zm,
3888 const double t,
3889 const double lat,
3890 const double p);
3891
3933 const ctl_t * ctl,
3934 const char *varname,
3935 float *array,
3936 const size_t nx,
3937 const size_t ny,
3938 const size_t np,
3939 const int decompress,
3940 FILE * inout);
3941
3974void compress_pck(
3975 const char *varname,
3976 float *array,
3977 const size_t nxy,
3978 const size_t nz,
3979 const int decompress,
3980 FILE * inout);
3981
4021 const char *varname,
4022 float *array,
4023 const int nx,
4024 const int ny,
4025 const int nz,
4026 const int precision,
4027 const double tolerance,
4028 const int decompress,
4029 FILE * inout);
4030
4053 const char *varname,
4054 float *array,
4055 const size_t n,
4056 const int decompress,
4057 const int level,
4058 FILE * inout);
4059
4082void day2doy(
4083 const int year,
4084 const int mon,
4085 const int day,
4086 int *doy);
4087
4109void doy2day(
4110 const int year,
4111 const int doy,
4112 int *mon,
4113 int *day);
4114
4141void fft_help(
4142 double *fcReal,
4143 double *fcImag,
4144 const int n);
4145
4172void geo2cart(
4173 const double z,
4174 const double lon,
4175 const double lat,
4176 double *x);
4177
4202void get_met_help(
4203 const ctl_t * ctl,
4204 const double t,
4205 const int direct,
4206 const char *metbase,
4207 const double dt_met,
4208 char *filename);
4209
4233void get_met_replace(
4234 char *orig,
4235 char *search,
4236 char *repl);
4237
4274void get_tropo(
4275 const int met_tropo,
4276 ctl_t * ctl,
4277 clim_t * clim,
4278 met_t * met,
4279 const double *lons,
4280 const int nx,
4281 const double *lats,
4282 const int ny,
4283 double *pt,
4284 double *zt,
4285 double *tt,
4286 double *qt,
4287 double *o3t,
4288 double *ps,
4289 double *zs);
4290
4312 const double *lons,
4313 const int nlon,
4314 const double *lats,
4315 const int nlat,
4316 const double lon,
4317 const double lat,
4318 double *lon2,
4319 double *lat2);
4320
4363 const met_t * met0,
4364 float height0[EX][EY][EP],
4365 float array0[EX][EY][EP],
4366 const met_t * met1,
4367 float height1[EX][EY][EP],
4368 float array1[EX][EY][EP],
4369 const double ts,
4370 const double height,
4371 const double lon,
4372 const double lat,
4373 double *var,
4374 int *ci,
4375 double *cw,
4376 const int init);
4377
4413 const met_t * met,
4414 float array[EX][EY][EP],
4415 const double p,
4416 const double lon,
4417 const double lat,
4418 double *var,
4419 int *ci,
4420 double *cw,
4421 const int init);
4422
4442 const met_t * met,
4443 float zs[EX][EY][EP],
4444 float vals[EX][EY][EP],
4445 const double z,
4446 const double lon,
4447 const double lat,
4448 double *val);
4449
4485 const met_t * met,
4486 float array[EX][EY],
4487 const double lon,
4488 const double lat,
4489 double *var,
4490 int *ci,
4491 double *cw,
4492 const int init);
4493
4528 const met_t * met0,
4529 float array0[EX][EY][EP],
4530 const met_t * met1,
4531 float array1[EX][EY][EP],
4532 const double ts,
4533 const double p,
4534 const double lon,
4535 const double lat,
4536 double *var,
4537 int *ci,
4538 double *cw,
4539 const int init);
4540
4564 const met_t * met0,
4565 float zs0[EX][EY][EP],
4566 float array0[EX][EY][EP],
4567 const met_t * met1,
4568 float zs1[EX][EY][EP],
4569 float array1[EX][EY][EP],
4570 const double ts,
4571 const double p,
4572 const double lon,
4573 const double lat,
4574 double *var);
4575
4611 const met_t * met0,
4612 float array0[EX][EY],
4613 const met_t * met1,
4614 float array1[EX][EY],
4615 const double ts,
4616 const double lon,
4617 const double lat,
4618 double *var,
4619 int *ci,
4620 double *cw,
4621 const int init);
4622
4660void intpol_tropo_3d(
4661 const double time0,
4662 float array0[EX][EY],
4663 const double time1,
4664 float array1[EX][EY],
4665 const double lons[EX],
4666 const double lats[EY],
4667 const int nlon,
4668 const int nlat,
4669 const double time,
4670 const double lon,
4671 const double lat,
4672 const int method,
4673 double *var,
4674 double *sigma);
4675
4702void jsec2time(
4703 const double jsec,
4704 int *year,
4705 int *mon,
4706 int *day,
4707 int *hour,
4708 int *min,
4709 int *sec,
4710 double *remain);
4711
4738double kernel_weight(
4739 const double kz[EP],
4740 const double kw[EP],
4741 const int nk,
4742 const double p);
4743
4782double lapse_rate(
4783 const double t,
4784 const double h2o);
4785
4815 ctl_t * ctl);
4816
4836int locate_irr(
4837 const double *xx,
4838 const int n,
4839 const double x);
4840
4867 const float *xx,
4868 const int n,
4869 const double x,
4870 const int ig);
4871
4892int locate_reg(
4893 const double *xx,
4894 const int n,
4895 const double x);
4896
4918void locate_vert(
4919 float profiles[EX][EY][EP],
4920 const int np,
4921 const int lon_ap_ind,
4922 const int lat_ap_ind,
4923 const double alt_ap,
4924 int *ind);
4925
4951void module_advect(
4952 const ctl_t * ctl,
4953 const cache_t * cache,
4954 met_t * met0,
4955 met_t * met1,
4956 atm_t * atm);
4957
4981 const ctl_t * ctl,
4982 const cache_t * cache,
4983 met_t * met0,
4984 met_t * met1,
4985 atm_t * atm);
4986
5024 const ctl_t * ctl,
5025 const cache_t * cache,
5026 const clim_t * clim,
5027 met_t * met0,
5028 met_t * met1,
5029 atm_t * atm);
5030
5048void module_chem_grid(
5049 const ctl_t * ctl,
5050 met_t * met0,
5051 met_t * met1,
5052 atm_t * atm,
5053 const double t);
5054
5092 const ctl_t * ctl,
5093 met_t * met0,
5094 met_t * met1,
5095 atm_t * atm,
5096 const double tt);
5097
5124void module_chem_init(
5125 const ctl_t * ctl,
5126 const cache_t * cache,
5127 const clim_t * clim,
5128 met_t * met0,
5129 met_t * met1,
5130 atm_t * atm);
5131
5156 const ctl_t * ctl,
5157 cache_t * cache,
5158 met_t * met0,
5159 met_t * met1,
5160 atm_t * atm);
5161
5188void module_decay(
5189 const ctl_t * ctl,
5190 const cache_t * cache,
5191 const clim_t * clim,
5192 atm_t * atm);
5193
5230void module_diff_meso(
5231 const ctl_t * ctl,
5232 cache_t * cache,
5233 met_t * met0,
5234 met_t * met1,
5235 atm_t * atm);
5236
5270void module_diff_pbl(
5271 const ctl_t * ctl,
5272 cache_t * cache,
5273 met_t * met0,
5274 met_t * met1,
5275 atm_t * atm);
5276
5331void module_diff_turb(
5332 const ctl_t * ctl,
5333 cache_t * cache,
5334 const clim_t * clim,
5335 met_t * met0,
5336 met_t * met1,
5337 atm_t * atm);
5338
5358void module_dry_depo(
5359 const ctl_t * ctl,
5360 const cache_t * cache,
5361 met_t * met0,
5362 met_t * met1,
5363 atm_t * atm);
5364
5397void module_h2o2_chem(
5398 const ctl_t * ctl,
5399 const cache_t * cache,
5400 const clim_t * clim,
5401 met_t * met0,
5402 met_t * met1,
5403 atm_t * atm);
5404
5425 const ctl_t * ctl,
5426 cache_t * cache,
5427 met_t * met0,
5428 met_t * met1,
5429 atm_t * atm);
5430
5448void module_isosurf(
5449 const ctl_t * ctl,
5450 const cache_t * cache,
5451 met_t * met0,
5452 met_t * met1,
5453 atm_t * atm);
5454
5487 ctl_t * ctl,
5488 cache_t * cache,
5489 clim_t * clim,
5490 met_t * met0,
5491 met_t * met1,
5492 atm_t * atm);
5493
5512void module_meteo(
5513 const ctl_t * ctl,
5514 const cache_t * cache,
5515 const clim_t * clim,
5516 met_t * met0,
5517 met_t * met1,
5518 atm_t * atm);
5519
5537void module_mixing(
5538 const ctl_t * ctl,
5539 const clim_t * clim,
5540 atm_t * atm,
5541 const double t);
5542
5563 const ctl_t * ctl,
5564 const clim_t * clim,
5565 atm_t * atm,
5566 const int *ixs,
5567 const int *iys,
5568 const int *izs,
5569 const int qnt_idx);
5570
5606 const ctl_t * ctl,
5607 const clim_t * clim,
5608 atm_t * atm,
5609 const int *ixs,
5610 const int *iys,
5611 const int *izs,
5612 const int qnt_idx);
5613
5646void module_oh_chem(
5647 const ctl_t * ctl,
5648 const cache_t * cache,
5649 const clim_t * clim,
5650 met_t * met0,
5651 met_t * met1,
5652 atm_t * atm);
5653
5681void module_position(
5682 const cache_t * cache,
5683 met_t * met0,
5684 met_t * met1,
5685 atm_t * atm);
5686
5711void module_rng_init(
5712 const int ntask);
5713
5739void module_rng(
5740 const ctl_t * ctl,
5741 double *rs,
5742 const size_t n,
5743 const int method);
5744
5767void module_sedi(
5768 const ctl_t * ctl,
5769 const cache_t * cache,
5770 met_t * met0,
5771 met_t * met1,
5772 atm_t * atm);
5773
5797void module_sort(
5798 const ctl_t * ctl,
5799 met_t * met0,
5800 atm_t * atm);
5801
5821void module_sort_help(
5822 double *a,
5823 const int *p,
5824 const int np);
5825
5849void module_timesteps(
5850 const ctl_t * ctl,
5851 cache_t * cache,
5852 met_t * met0,
5853 atm_t * atm,
5854 const double t);
5855
5877 ctl_t * ctl,
5878 const atm_t * atm);
5879
5913 const ctl_t * ctl,
5914 const cache_t * cache,
5915 const clim_t * clim,
5916 met_t * met0,
5917 met_t * met1,
5918 atm_t * atm);
5919
5949void module_wet_depo(
5950 const ctl_t * ctl,
5951 const cache_t * cache,
5952 met_t * met0,
5953 met_t * met1,
5954 atm_t * atm);
5955
5986void mptrac_alloc(
5987 ctl_t ** ctl,
5988 cache_t ** cache,
5989 clim_t ** clim,
5990 met_t ** met0,
5991 met_t ** met1,
5992 atm_t ** atm);
5993
6023void mptrac_free(
6024 ctl_t * ctl,
6025 cache_t * cache,
6026 clim_t * clim,
6027 met_t * met0,
6028 met_t * met1,
6029 atm_t * atm);
6030
6065void mptrac_get_met(
6066 ctl_t * ctl,
6067 clim_t * clim,
6068 const double t,
6069 met_t ** met0,
6070 met_t ** met1);
6071
6091void mptrac_init(
6092 ctl_t * ctl,
6093 cache_t * cache,
6094 clim_t * clim,
6095 atm_t * atm,
6096 const int ntask);
6097
6133int mptrac_read_atm(
6134 const char *filename,
6135 const ctl_t * ctl,
6136 atm_t * atm);
6137
6169void mptrac_read_clim(
6170 const ctl_t * ctl,
6171 clim_t * clim);
6172
6202void mptrac_read_ctl(
6203 const char *filename,
6204 int argc,
6205 char *argv[],
6206 ctl_t * ctl);
6207
6236int mptrac_read_met(
6237 const char *filename,
6238 const ctl_t * ctl,
6239 const clim_t * clim,
6240 met_t * met);
6241
6262 ctl_t * ctl,
6263 cache_t * cache,
6264 clim_t * clim,
6265 met_t ** met0,
6266 met_t ** met1,
6267 atm_t * atm,
6268 double t);
6269
6299void mptrac_write_atm(
6300 const char *filename,
6301 const ctl_t * ctl,
6302 const atm_t * atm,
6303 const double t);
6304
6340void mptrac_write_met(
6341 const char *filename,
6342 const ctl_t * ctl,
6343 met_t * met);
6344
6379 const char *dirname,
6380 const ctl_t * ctl,
6381 met_t * met0,
6382 met_t * met1,
6383 atm_t * atm,
6384 const double t);
6385
6417 const ctl_t * ctl,
6418 const cache_t * cache,
6419 const clim_t * clim,
6420 met_t ** met0,
6421 met_t ** met1,
6422 const atm_t * atm);
6423
6454 const ctl_t * ctl,
6455 const cache_t * cache,
6456 const clim_t * clim,
6457 met_t ** met0,
6458 met_t ** met1,
6459 const atm_t * atm);
6460
6488double nat_temperature(
6489 const double p,
6490 const double h2o,
6491 const double hno3);
6492
6513double pbl_weight(
6514 const ctl_t * ctl,
6515 const atm_t * atm,
6516 const int ip,
6517 const double pbl,
6518 const double ps);
6519
6552int read_atm_asc(
6553 const char *filename,
6554 const ctl_t * ctl,
6555 atm_t * atm);
6556
6587int read_atm_bin(
6588 const char *filename,
6589 const ctl_t * ctl,
6590 atm_t * atm);
6591
6616int read_atm_clams(
6617 const char *filename,
6618 const ctl_t * ctl,
6619 atm_t * atm);
6620
6650int read_atm_nc(
6651 const char *filename,
6652 const ctl_t * ctl,
6653 atm_t * atm);
6654
6683void read_clim_photo(
6684 const char *filename,
6685 clim_photo_t * photo);
6686
6704 const int ncid,
6705 const char *varname,
6706 const clim_photo_t * photo,
6707 double var[CP][CSZA][CO3]);
6708
6732int read_clim_ts(
6733 const char *filename,
6734 clim_ts_t * ts);
6735
6762void read_clim_zm(
6763 const char *filename,
6764 const char *varname,
6765 clim_zm_t * zm);
6766
6794void read_kernel(
6795 const char *filename,
6796 double kz[EP],
6797 double kw[EP],
6798 int *nk);
6799
6831int read_met_bin(
6832 const char *filename,
6833 const ctl_t * ctl,
6834 met_t * met);
6835
6861void read_met_bin_2d(
6862 FILE * in,
6863 const met_t * met,
6864 float var[EX][EY],
6865 const char *varname);
6866
6904void read_met_bin_3d(
6905 FILE * in,
6906 const ctl_t * ctl,
6907 const met_t * met,
6908 float var[EX][EY][EP],
6909 const char *varname,
6910 const float bound_min,
6911 const float bound_max);
6912
6939void read_met_cape(
6940 const ctl_t * ctl,
6941 const clim_t * clim,
6942 met_t * met);
6943
6966void read_met_cloud(
6967 met_t * met);
6968
6994void read_met_detrend(
6995 const ctl_t * ctl,
6996 met_t * met);
6997
7021 met_t * met);
7022
7049void read_met_geopot(
7050 const ctl_t * ctl,
7051 met_t * met);
7052
7074#ifdef ECCODES
7075void read_met_global_grib(
7076 codes_handle ** handles,
7077 int count_handles,
7078 met_t * met);
7079#endif
7080
7108 const char *filename,
7109 const ctl_t * ctl,
7110 const clim_t * clim,
7111 met_t * met);
7112
7144void read_met_grid(
7145 const char *filename,
7146 const int ncid,
7147 const ctl_t * ctl,
7148 met_t * met);
7149
7180void read_met_levels(
7181 const int ncid,
7182 const ctl_t * ctl,
7183 met_t * met);
7184
7204#ifdef ECCODES
7205void read_met_levels_grib(
7206 codes_handle ** handles,
7207 const int num_messages,
7208 const ctl_t * ctl,
7209 met_t * met);
7210#endif
7211
7240void read_met_ml2pl(
7241 const ctl_t * ctl,
7242 const met_t * met,
7243 float var[EX][EY][EP],
7244 const char *varname);
7245
7268 const ctl_t * ctl,
7269 met_t * met);
7270
7302int read_met_nc(
7303 const char *filename,
7304 const ctl_t * ctl,
7305 const clim_t * clim,
7306 met_t * met);
7307
7337int read_met_nc_2d(
7338 const int ncid,
7339 const char *varname,
7340 const char *varname2,
7341 const char *varname3,
7342 const char *varname4,
7343 const char *varname5,
7344 const char *varname6,
7345 const ctl_t * ctl,
7346 const met_t * met,
7347 float dest[EX][EY],
7348 const float scl,
7349 const int init);
7350
7381int read_met_nc_3d(
7382 const int ncid,
7383 const char *varname,
7384 const char *varname2,
7385 const char *varname3,
7386 const char *varname4,
7387 const ctl_t * ctl,
7388 const met_t * met,
7389 float dest[EX][EY][EP],
7390 const float scl);
7391
7437void read_met_pbl(
7438 const ctl_t * ctl,
7439 met_t * met);
7440
7473 met_t * met);
7474
7505 met_t * met);
7506
7537void read_met_pv(
7538 met_t * met);
7539
7562void read_met_ozone(
7563 met_t * met);
7564
7593void read_met_sample(
7594 const ctl_t * ctl,
7595 met_t * met);
7596
7637void read_met_surface(
7638 const int ncid,
7639 const ctl_t * ctl,
7640 met_t * met);
7641
7671#ifdef ECCODES
7672void read_met_surface_grib(
7673 codes_handle ** handles,
7674 const int num_messages,
7675 const ctl_t * ctl,
7676 met_t * met);
7677#endif
7678
7707void read_met_tropo(
7708 const ctl_t * ctl,
7709 const clim_t * clim,
7710 met_t * met);
7711
7743void read_obs(
7744 const char *filename,
7745 const ctl_t * ctl,
7746 double *rt,
7747 double *rz,
7748 double *rlon,
7749 double *rlat,
7750 double *robs,
7751 int *nobs);
7752
7780void read_obs_asc(
7781 const char *filename,
7782 double *rt,
7783 double *rz,
7784 double *rlon,
7785 double *rlat,
7786 double *robs,
7787 int *nobs);
7788
7815void read_obs_nc(
7816 const char *filename,
7817 double *rt,
7818 double *rz,
7819 double *rlon,
7820 double *rlat,
7821 double *robs,
7822 int *nobs);
7823
7857double scan_ctl(
7858 const char *filename,
7859 int argc,
7860 char *argv[],
7861 const char *varname,
7862 const int arridx,
7863 const char *defvalue,
7864 char *value);
7865
7892double sedi(
7893 const double p,
7894 const double T,
7895 const double rp,
7896 const double rhop);
7897
7927void spline(
7928 const double *x,
7929 const double *y,
7930 const int n,
7931 const double *x2,
7932 double *y2,
7933 const int n2,
7934 const int method);
7935
7958float stddev(
7959 const float *data,
7960 const int n);
7961
7981double sza_calc(
7982 const double sec,
7983 const double lon,
7984 const double lat);
7985
8010void time2jsec(
8011 const int year,
8012 const int mon,
8013 const int day,
8014 const int hour,
8015 const int min,
8016 const int sec,
8017 const double remain,
8018 double *jsec);
8019
8048void timer(
8049 const char *name,
8050 const char *group,
8051 const int output);
8052
8078double time_from_filename(
8079 const char *filename,
8080 const int offset);
8081
8099double tropo_weight(
8100 const clim_t * clim,
8101 const atm_t * atm,
8102 const int ip);
8103
8126void write_atm_asc(
8127 const char *filename,
8128 const ctl_t * ctl,
8129 const atm_t * atm,
8130 const double t);
8131
8155void write_atm_bin(
8156 const char *filename,
8157 const ctl_t * ctl,
8158 const atm_t * atm);
8159
8183void write_atm_clams(
8184 const char *filename,
8185 const ctl_t * ctl,
8186 const atm_t * atm);
8187
8213 const char *dirname,
8214 const ctl_t * ctl,
8215 const atm_t * atm,
8216 const double t);
8217
8241void write_atm_nc(
8242 const char *filename,
8243 const ctl_t * ctl,
8244 const atm_t * atm);
8245
8274void write_csi(
8275 const char *filename,
8276 const ctl_t * ctl,
8277 const atm_t * atm,
8278 const double t);
8279
8320void write_csi_ens(
8321 const char *filename,
8322 const ctl_t * ctl,
8323 const atm_t * atm,
8324 const double t);
8325
8353void write_ens(
8354 const char *filename,
8355 const ctl_t * ctl,
8356 const atm_t * atm,
8357 const double t);
8358
8397void write_grid(
8398 const char *filename,
8399 const ctl_t * ctl,
8400 met_t * met0,
8401 met_t * met1,
8402 const atm_t * atm,
8403 const double t);
8404
8450void write_grid_asc(
8451 const char *filename,
8452 const ctl_t * ctl,
8453 const double *cd,
8454 double *mean[NQ],
8455 double *sigma[NQ],
8456 const double *vmr_impl,
8457 const double t,
8458 const double *z,
8459 const double *lon,
8460 const double *lat,
8461 const double *area,
8462 const double dz,
8463 const int *np);
8464
8507void write_grid_nc(
8508 const char *filename,
8509 const ctl_t * ctl,
8510 const double *cd,
8511 double *mean[NQ],
8512 double *sigma[NQ],
8513 const double *vmr_impl,
8514 const double t,
8515 const double *z,
8516 const double *lon,
8517 const double *lat,
8518 const double *area,
8519 const double dz,
8520 const int *np);
8521
8551void write_met_bin(
8552 const char *filename,
8553 const ctl_t * ctl,
8554 met_t * met);
8555
8583void write_met_bin_2d(
8584 FILE * out,
8585 met_t * met,
8586 float var[EX][EY],
8587 const char *varname);
8588
8626void write_met_bin_3d(
8627 FILE * out,
8628 const ctl_t * ctl,
8629 met_t * met,
8630 float var[EX][EY][EP],
8631 const char *varname,
8632 const int precision,
8633 const double tolerance);
8634
8662void write_met_nc(
8663 const char *filename,
8664 const ctl_t * ctl,
8665 met_t * met);
8666
8691void write_met_nc_2d(
8692 const int ncid,
8693 const char *varname,
8694 met_t * met,
8695 float var[EX][EY],
8696 const float scl);
8697
8723void write_met_nc_3d(
8724 const int ncid,
8725 const char *varname,
8726 met_t * met,
8727 float var[EX][EY][EP],
8728 const float scl);
8729
8760void write_prof(
8761 const char *filename,
8762 const ctl_t * ctl,
8763 met_t * met0,
8764 met_t * met1,
8765 const atm_t * atm,
8766 const double t);
8767
8799void write_sample(
8800 const char *filename,
8801 const ctl_t * ctl,
8802 met_t * met0,
8803 met_t * met1,
8804 const atm_t * atm,
8805 const double t);
8806
8833void write_station(
8834 const char *filename,
8835 const ctl_t * ctl,
8836 atm_t * atm,
8837 const double t);
8838
8867void write_vtk(
8868 const char *filename,
8869 const ctl_t * ctl,
8870 const atm_t * atm,
8871 const double t);
8872
8873#endif /* LIBTRAC_H */
void read_met_geopot(const ctl_t *ctl, met_t *met)
Calculates geopotential heights from meteorological data.
Definition: mptrac.c:7346
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:256
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:6024
void day2doy(const int year, const int mon, const int day, int *doy)
Get day of year from date.
Definition: mptrac.c:942
void read_met_extrapolate(met_t *met)
Extrapolates meteorological data.
Definition: mptrac.c:7306
void read_met_levels(const int ncid, const ctl_t *ctl, met_t *met)
Reads meteorological variables at different vertical levels from a NetCDF file.
Definition: mptrac.c:7725
int read_met_nc(const char *filename, const ctl_t *ctl, const clim_t *clim, met_t *met)
Reads meteorological data from a NetCDF file and processes it.
Definition: mptrac.c:8397
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:10390
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:12048
void mptrac_alloc(ctl_t **ctl, cache_t **cache, clim_t **clim, met_t **met0, met_t **met1, atm_t **atm)
Allocates and initializes memory resources for MPTRAC.
Definition: mptrac.c:4525
void read_met_sample(const ctl_t *ctl, met_t *met)
Downsamples meteorological data based on specified parameters.
Definition: mptrac.c:9164
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:11808
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:9733
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:2130
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:4252
int mptrac_read_met(const char *filename, const ctl_t *ctl, const clim_t *clim, met_t *met)
Reads meteorological data from a file, supporting multiple formats and MPI broadcasting.
Definition: mptrac.c:5709
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:3433
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:6454
void read_met_cloud(met_t *met)
Calculates cloud-related variables for each grid point.
Definition: mptrac.c:7145
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:2819
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:9906
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:1504
void intpol_met_space_3d_ml(const met_t *met, float zs[EX][EY][EP], float vals[EX][EY][EP], const double z, const double lon, const double lat, double *val)
Interpolates meteorological data in 3D space.
Definition: mptrac.c:1437
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:6421
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...
Definition: mptrac.c:10859
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:8772
void read_met_detrend(const ctl_t *ctl, met_t *met)
Detrends meteorological data.
Definition: mptrac.c:7202
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, float dest[EX][EY], const float scl, const int init)
Reads a 2-dimensional meteorological variable from a NetCDF file.
Definition: mptrac.c:8468
void read_met_tropo(const ctl_t *ctl, const clim_t *clim, met_t *met)
Reads surface meteorological data from a grib file and stores it in the meteorological data structure...
Definition: mptrac.c:9561
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:9777
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:2704
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:2091
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:1137
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:2110
void mptrac_get_met(ctl_t *ctl, clim_t *clim, const double t, met_t **met0, met_t **met1)
Retrieves meteorological data for the specified time.
Definition: mptrac.c:4598
void read_met_monotonize(const ctl_t *ctl, met_t *met)
Makes zeta and pressure profiles monotone.
Definition: mptrac.c:8160
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:6573
int read_met_grib(const char *filename, const ctl_t *ctl, const clim_t *clim, met_t *met)
Reads global meteorological information from a grib file.
void read_met_periodic(met_t *met)
Applies periodic boundary conditions to meteorological data along longitudinal axis.
Definition: mptrac.c:8909
void module_chem_grid_ens(const ctl_t *ctl, met_t *met0, met_t *met1, atm_t *atm, const double tt)
Processes atmospheric ensemble chemical data on a defined 3D grid.
Definition: mptrac.c:2553
void module_timesteps_init(ctl_t *ctl, const atm_t *atm)
Initialize start time and time interval for time-stepping.
Definition: mptrac.c:4289
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:11156
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:3537
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:401
#define EY
Maximum number of latitudes for meteo data.
Definition: mptrac.h:286
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:6545
void read_met_ml2pl(const ctl_t *ctl, const met_t *met, float var[EX][EY][EP], const char *varname)
Reads meteorological variables at different vertical levels from a grib file.
Definition: mptrac.c:8118
double clim_tropo(const clim_t *clim, const double t, const double lat)
Calculates the tropopause pressure based on climatological data.
Definition: mptrac.c:200
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:9805
void read_met_grid(const char *filename, const int ncid, const ctl_t *ctl, met_t *met)
Reads meteorological grid information from a NetCDF file.
Definition: mptrac.c:7474
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:6915
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:2027
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:3258
void level_definitions(ctl_t *ctl)
Defines pressure levels for meteorological data.
Definition: mptrac.c:1817
void module_mixing_help_ens(const ctl_t *ctl, const clim_t *clim, atm_t *atm, const int *ixs, const int *iys, const int *izs, const int qnt_idx)
Applies ensemble-based interparcel mixing for a given tracer quantity.
Definition: mptrac.c:3758
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:11444
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:5912
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:10048
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:4719
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:1562
void fft_help(double *fcReal, double *fcImag, const int n)
Computes the Fast Fourier Transform (FFT) of a complex sequence.
Definition: mptrac.c:991
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:4390
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:706
double nat_temperature(const double p, const double h2o, const double hno3)
Calculates the nitric acid trihydrate (NAT) temperature.
Definition: mptrac.c:6221
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:9939
#define CP
Maximum number of pressure levels for climatological data.
Definition: mptrac.h:316
#define NQ
Maximum number of quantities per data point.
Definition: mptrac.h:266
double clim_photo(const double rate[CP][CSZA][CO3], const clim_photo_t *photo, const double p, const double sza, const double o3c)
Calculates the photolysis rate for a given set of atmospheric conditions.
Definition: mptrac.c:149
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:6627
#define EX
Maximum number of longitudes for meteo data.
Definition: mptrac.h:281
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:4127
void timer(const char *name, const char *group, const int output)
Measures and reports elapsed time for named and grouped timers.
Definition: mptrac.c:10079
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:10205
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:1379
void read_met_surface(const int ncid, const ctl_t *ctl, met_t *met)
Reads surface meteorological data from a netCDF file and stores it in the meteorological data structu...
Definition: mptrac.c:9336
void intpol_met_time_3d_ml(const met_t *met0, float zs0[EX][EY][EP], float array0[EX][EY][EP], const met_t *met1, float zs1[EX][EY][EP], float array1[EX][EY][EP], const double ts, const double p, const double lon, const double lat, double *var)
Interpolates meteorological data in both space and time.
Definition: mptrac.c:1591
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:2746
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:6726
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:2310
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:9834
#define CT
Maximum number of time steps for climatological data.
Definition: mptrac.h:326
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:2283
void module_sort_help(double *a, const int *p, const int np)
Reorder an array based on a given permutation.
Definition: mptrac.c:4216
float stddev(const float *data, const int n)
Calculates the standard deviation of a set of data.
Definition: mptrac.c:9986
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:1649
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, float dest[EX][EY][EP], const float scl)
Reads a 3-dimensional meteorological variable from a NetCDF file.
Definition: mptrac.c:8626
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:6944
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:2057
double time_from_filename(const char *filename, const int offset)
Extracts and converts a timestamp from a filename to Julian seconds.
Definition: mptrac.c:10147
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:12107
void mptrac_read_clim(const ctl_t *ctl, clim_t *clim)
Reads various climatological data and populates the given climatology structure.
Definition: mptrac.c:4809
void module_chem_grid(const ctl_t *ctl, met_t *met0, met_t *met1, atm_t *atm, const double t)
Calculate grid data for chemistry modules.
Definition: mptrac.c:2406
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:10182
void write_met_nc(const char *filename, const ctl_t *ctl, met_t *met)
Writes meteorological data to a NetCDF file.
Definition: mptrac.c:11884
void module_rng_init(const int ntask)
Initialize random number generators for parallel tasks.
Definition: mptrac.c:3991
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:4738
void intpol_met_4d_coord(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:1207
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:5968
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:6124
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
#define CTS
Maximum number of data points of climatological time series.
Definition: mptrac.h:331
void read_met_ozone(met_t *met)
Calculates the total column ozone from meteorological ozone data.
Definition: mptrac.c:9135
void broadcast_large_data(void *data, size_t N)
Broadcasts large data across all processes in an MPI communicator.
void mptrac_free(ctl_t *ctl, cache_t *cache, clim_t *clim, met_t *met0, met_t *met1, atm_t *atm)
Frees memory resources allocated for MPTRAC.
Definition: mptrac.c:4572
void clim_tropo_init(clim_t *clim)
Initializes the tropopause data in the climatology structure.
Definition: mptrac.c:228
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:4022
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:1048
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:12496
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:261
double sza_calc(const double sec, const double lon, const double lat)
Calculates the solar zenith angle.
Definition: mptrac.c:10007
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)
Perform interparcel mixing for a specific quantity.
Definition: mptrac.c:3664
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:961
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:1616
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:3940
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:116
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:11779
void read_met_pv(met_t *met)
Calculates potential vorticity (PV) from meteorological data.
Definition: mptrac.c:9029
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:6309
void get_met_replace(char *orig, char *search, char *repl)
Replaces occurrences of a substring in a string with another substring.
Definition: mptrac.c:1113
#define CY
Maximum number of latitudes for climatological data.
Definition: mptrac.h:306
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:2858
void module_sort(const ctl_t *ctl, met_t *met0, atm_t *atm)
Sort particles according to box index.
Definition: mptrac.c:4156
double clim_ts(const clim_ts_t *ts, const double t)
Interpolates a time series of climatological variables.
Definition: mptrac.c:383
void thrustSortWrapper(double *__restrict__ c, int n, int *__restrict__ index)
Wrapper to Thrust sorting function.
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:1740
int read_met_bin(const char *filename, const ctl_t *ctl, met_t *met)
Reads meteorological data from a binary file.
Definition: mptrac.c:6767
void mptrac_run_timestep(ctl_t *ctl, cache_t *cache, clim_t *clim, met_t **met0, met_t **met1, atm_t *atm, double t)
Executes a single timestep of the MPTRAC model simulation.
Definition: mptrac.c:5771
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:10337
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:3060
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:6365
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:12582
#define EP
Maximum number of pressure levels for meteo data.
Definition: mptrac.h:276
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:4320
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:4869
void read_met_polar_winds(met_t *met)
Applies a fix for polar winds in meteorological data.
Definition: mptrac.c:8970
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:3175
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:11548
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:6245
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:2935
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:12077
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:3328
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:311
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:3856
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:1030
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:1773
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:6267
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:1180
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:12334
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:11253
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:3112
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:11678
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:10287
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:7030
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:6084
#define CSZA
Maximum number of solar zenith angles for climatological data.
Definition: mptrac.h:321
double lapse_rate(const double t, const double h2o)
Calculates the moist adiabatic lapse rate in Kelvin per kilometer.
Definition: mptrac.c:1799
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:10597
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:10548
Air parcel data.
Definition: mptrac.h:3238
int np
Number of air parcels.
Definition: mptrac.h:3241
Cache data structure.
Definition: mptrac.h:3266
int iso_n
Isosurface balloon number of data points.
Definition: mptrac.h:3278
Climatological data in the form of photolysis rates.
Definition: mptrac.h:3298
int nsza
Number of solar zenith angles.
Definition: mptrac.h:3304
int np
Number of pressure levels.
Definition: mptrac.h:3301
int no3c
Number of total ozone columns.
Definition: mptrac.h:3307
Climatological data.
Definition: mptrac.h:3406
clim_ts_t ccl2f2
CFC-12 time series.
Definition: mptrac.h:3448
clim_photo_t photo
Photolysis rates.
Definition: mptrac.h:3424
clim_zm_t ho2
HO2 zonal means.
Definition: mptrac.h:3436
clim_zm_t hno3
HNO3 zonal means.
Definition: mptrac.h:3427
int tropo_ntime
Number of tropopause timesteps.
Definition: mptrac.h:3409
clim_ts_t sf6
SF6 time series.
Definition: mptrac.h:3454
clim_ts_t ccl4
CFC-10 time series.
Definition: mptrac.h:3442
clim_ts_t ccl3f
CFC-11 time series.
Definition: mptrac.h:3445
clim_zm_t o1d
O(1D) zonal means.
Definition: mptrac.h:3439
clim_zm_t h2o2
H2O2 zonal means.
Definition: mptrac.h:3433
int tropo_nlat
Number of tropopause latitudes.
Definition: mptrac.h:3412
clim_zm_t oh
OH zonal means.
Definition: mptrac.h:3430
clim_ts_t n2o
N2O time series.
Definition: mptrac.h:3451
Climatological data in the form of time series.
Definition: mptrac.h:3354
int ntime
Number of timesteps.
Definition: mptrac.h:3357
Climatological data in the form of zonal means.
Definition: mptrac.h:3374
int np
Number of pressure levels.
Definition: mptrac.h:3383
int ntime
Number of timesteps.
Definition: mptrac.h:3377
int nlat
Number of latitudes.
Definition: mptrac.h:3380
Control parameters.
Definition: mptrac.h:2238
double grid_z0
Lower altitude of gridded data [km].
Definition: mptrac.h:3118
int qnt_o3
Quantity array index for ozone volume mixing ratio.
Definition: mptrac.h:2350
double csi_lat1
Upper latitude of gridded CSI data [deg].
Definition: mptrac.h:3082
int qnt_Coh
Quantity array index for OH volume mixing ratio (chemistry code).
Definition: mptrac.h:2497
double wet_depo_ic_a
Coefficient A for wet deposition in cloud (exponential form).
Definition: mptrac.h:2964
int met_nc_scale
Check netCDF scaling factors (0=no, 1=yes).
Definition: mptrac.h:2569
int qnt_pel
Quantity array index for pressure at equilibrium level (EL).
Definition: mptrac.h:2383
int csi_nz
Number of altitudes of gridded CSI data.
Definition: mptrac.h:3058
double molmass
Molar mass [g/mol].
Definition: mptrac.h:2826
int qnt_p
Quantity array index for pressure.
Definition: mptrac.h:2329
int qnt_Cccl2f2
Quantity array index for CFC-12 volume mixing ratio (chemistry code).
Definition: mptrac.h:2521
int mixing_nx
Number of longitudes of mixing grid.
Definition: mptrac.h:2889
double chemgrid_z1
Upper altitude of chemistry grid [km].
Definition: mptrac.h:2913
int qnt_m
Quantity array index for mass.
Definition: mptrac.h:2269
int qnt_aoa
Quantity array index for age of air.
Definition: mptrac.h:2530
int qnt_rhop
Quantity array index for particle density.
Definition: mptrac.h:2278
int qnt_swc
Quantity array index for cloud snow water content.
Definition: mptrac.h:2362
double csi_obsmin
Minimum observation index to trigger detection.
Definition: mptrac.h:3052
int qnt_pcb
Quantity array index for cloud bottom pressure.
Definition: mptrac.h:2371
double bound_dzs
Boundary conditions surface layer depth [km].
Definition: mptrac.h:2814
double csi_lon1
Upper longitude of gridded CSI data [deg].
Definition: mptrac.h:3073
int qnt_u
Quantity array index for zonal wind.
Definition: mptrac.h:2338
double stat_lon
Longitude of station [deg].
Definition: mptrac.h:3196
double mixing_trop
Interparcel exchange parameter for mixing in the troposphere.
Definition: mptrac.h:2874
double sort_dt
Time step for sorting of particle data [s].
Definition: mptrac.h:2725
double mixing_z1
Upper altitude of mixing grid [km].
Definition: mptrac.h:2886
double stat_r
Search radius around station [km].
Definition: mptrac.h:3202
double wet_depo_bc_a
Coefficient A for wet deposition below cloud (exponential form).
Definition: mptrac.h:2958
int met_zstd_level
ZSTD compression level (from -5 to 22).
Definition: mptrac.h:2578
int csi_ny
Number of latitudes of gridded CSI data.
Definition: mptrac.h:3076
int vtk_sphere
Spherical projection for VTK data (0=no, 1=yes).
Definition: mptrac.h:3226
double chemgrid_z0
Lower altitude of chemistry grid [km].
Definition: mptrac.h:2910
double met_pbl_min
Minimum depth of planetary boundary layer [km].
Definition: mptrac.h:2693
int qnt_iwc
Quantity array index for cloud ice water content.
Definition: mptrac.h:2359
double chemgrid_lat0
Lower latitude of chemistry grid [deg].
Definition: mptrac.h:2928
double conv_cape
CAPE threshold for convection module [J/kg].
Definition: mptrac.h:2778
int qnt_Co1d
Quantity array index for O(1D) volume mixing ratio (chemistry code).
Definition: mptrac.h:2509
double met_cms_eps_pv
cmultiscale compression epsilon for potential vorticity.
Definition: mptrac.h:2615
int qnt_pw
Quantity array index for partial water vapor pressure.
Definition: mptrac.h:2437
double grid_z1
Upper altitude of gridded data [km].
Definition: mptrac.h:3121
int direction
Direction flag (1=forward calculation, -1=backward calculation).
Definition: mptrac.h:2533
int qnt_Cccl4
Quantity array index for CFC-10 volume mixing ratio (chemistry code).
Definition: mptrac.h:2515
int met_dp
Stride for pressure levels.
Definition: mptrac.h:2645
double met_dt_out
Time step for sampling of meteo data along trajectories [s].
Definition: mptrac.h:2712
int qnt_h2o2
Quantity array index for H2O2 volume mixing ratio (climatology).
Definition: mptrac.h:2401
int qnt_vh
Quantity array index for horizontal wind.
Definition: mptrac.h:2464
int csi_nx
Number of longitudes of gridded CSI data.
Definition: mptrac.h:3067
double csi_lat0
Lower latitude of gridded CSI data [deg].
Definition: mptrac.h:3079
double turb_dz_trop
Vertical turbulent diffusion coefficient (troposphere) [m^2/s].
Definition: mptrac.h:2760
int met_pbl
Planetary boundary layer data (0=file, 1=z2p, 2=Richardson, 3=theta).
Definition: mptrac.h:2690
int qnt_lwc
Quantity array index for cloud liquid water content.
Definition: mptrac.h:2353
double turb_mesoz
Vertical scaling factor for mesoscale wind fluctuations.
Definition: mptrac.h:2769
int grid_nc_level
zlib compression level of netCDF grid data files (0=off).
Definition: mptrac.h:3106
int grid_nx
Number of longitudes of gridded data.
Definition: mptrac.h:3124
int atm_type
Type of atmospheric data files (0=ASCII, 1=binary, 2=netCDF, 3=CLaMS_traj, 4=CLaMS_pos).
Definition: mptrac.h:3017
double bound_mass
Boundary conditions mass per particle [kg].
Definition: mptrac.h:2787
double grid_lat0
Lower latitude of gridded data [deg].
Definition: mptrac.h:3136
int qnt_ts
Quantity array index for surface temperature.
Definition: mptrac.h:2284
int qnt_loss_rate
Quantity array index for total loss rate.
Definition: mptrac.h:2428
double met_cms_eps_h2o
cmultiscale compression epsilon for water vapor.
Definition: mptrac.h:2618
int qnt_plfc
Quantity array index for pressure at level of free convection (LCF).
Definition: mptrac.h:2380
double grid_lon0
Lower longitude of gridded data [deg].
Definition: mptrac.h:3127
int qnt_o1d
Quantity array index for O(1D) volume mixing ratio (climatology).
Definition: mptrac.h:2407
int met_tropo_spline
Tropopause interpolation method (0=linear, 1=spline).
Definition: mptrac.h:2709
int qnt_tvirt
Quantity array index for virtual temperature.
Definition: mptrac.h:2458
double dt_met
Time step of meteo data [s].
Definition: mptrac.h:2552
double chemgrid_lat1
Upper latitude of chemistry grid [deg].
Definition: mptrac.h:2931
int met_geopot_sy
Latitudinal smoothing of geopotential heights.
Definition: mptrac.h:2681
double met_cms_eps_u
cmultiscale compression epsilon for zonal wind.
Definition: mptrac.h:2606
double turb_dx_strat
Horizontal turbulent diffusion coefficient (stratosphere) [m^2/s].
Definition: mptrac.h:2754
int qnt_vmr
Quantity array index for volume mixing ratio.
Definition: mptrac.h:2272
int qnt_lsm
Quantity array index for land-sea mask.
Definition: mptrac.h:2305
int qnt_theta
Quantity array index for potential temperature.
Definition: mptrac.h:2449
double bound_lat1
Boundary conditions maximum longitude [deg].
Definition: mptrac.h:2802
double stat_t1
Stop time for station output [s].
Definition: mptrac.h:3208
double turb_dx_trop
Horizontal turbulent diffusion coefficient (troposphere) [m^2/s].
Definition: mptrac.h:2751
int grid_type
Type of grid data files (0=ASCII, 1=netCDF).
Definition: mptrac.h:3142
double csi_lon0
Lower longitude of gridded CSI data [deg].
Definition: mptrac.h:3070
int qnt_pbl
Quantity array index for boundary layer pressure.
Definition: mptrac.h:2311
int grid_stddev
Include standard deviations in grid output (0=no, 1=yes).
Definition: mptrac.h:3112
int qnt_psice
Quantity array index for saturation pressure over ice.
Definition: mptrac.h:2434
double chemgrid_lon0
Lower longitude of chemistry grid [deg].
Definition: mptrac.h:2919
int bound_pbl
Boundary conditions planetary boundary layer (0=no, 1=yes).
Definition: mptrac.h:2820
int qnt_mloss_wet
Quantity array index for total mass loss due to wet deposition.
Definition: mptrac.h:2419
int met_geopot_sx
Longitudinal smoothing of geopotential heights.
Definition: mptrac.h:2678
int met_sy
Smoothing for latitudes.
Definition: mptrac.h:2651
int qnt_ps
Quantity array index for surface pressure.
Definition: mptrac.h:2281
int rng_type
Random number generator (0=GSL, 1=Squares, 2=cuRAND).
Definition: mptrac.h:2742
int isosurf
Isosurface parameter (0=none, 1=pressure, 2=density, 3=theta, 4=balloon).
Definition: mptrac.h:2729
double bound_p1
Boundary conditions top pressure [hPa].
Definition: mptrac.h:2808
int qnt_zs
Quantity array index for surface geopotential height.
Definition: mptrac.h:2287
int prof_nz
Number of altitudes of gridded profile data.
Definition: mptrac.h:3151
double csi_dt_out
Time step for CSI output [s].
Definition: mptrac.h:3046
int met_cape
Convective available potential energy data (0=file, 1=calculate).
Definition: mptrac.h:2687
double csi_modmin
Minimum column density to trigger detection [kg/m^2].
Definition: mptrac.h:3055
int met_sx
Smoothing for longitudes.
Definition: mptrac.h:2648
double chemgrid_lon1
Upper longitude of chemistry grid [deg].
Definition: mptrac.h:2922
double turb_mesox
Horizontal scaling factor for mesoscale wind fluctuations.
Definition: mptrac.h:2766
double met_cms_eps_iwc
cmultiscale compression epsilon for cloud ice water content.
Definition: mptrac.h:2630
double met_cms_eps_swc
cmultiscale compression epsilon for cloud snow water content.
Definition: mptrac.h:2633
int met_zfp_prec
ZFP compression precision for all variables, except z and T.
Definition: mptrac.h:2581
double met_cms_eps_v
cmultiscale compression epsilon for meridional wind.
Definition: mptrac.h:2609
double prof_z0
Lower altitude of gridded profile data [km].
Definition: mptrac.h:3154
int qnt_w
Quantity array index for vertical velocity.
Definition: mptrac.h:2344
double bound_vmr
Boundary conditions volume mixing ratio [ppv].
Definition: mptrac.h:2793
double met_tropo_pv
Dynamical tropopause potential vorticity threshold [PVU].
Definition: mptrac.h:2703
int prof_nx
Number of longitudes of gridded profile data.
Definition: mptrac.h:3160
int qnt_stat
Quantity array index for station flag.
Definition: mptrac.h:2266
int met_tropo
Tropopause definition (0=none, 1=clim, 2=cold point, 3=WMO_1st, 4=WMO_2nd, 5=dynamical).
Definition: mptrac.h:2700
int qnt_rp
Quantity array index for particle radius.
Definition: mptrac.h:2275
int met_mpi_share
Use MPI to share meteo (0=no, 1=yes).
Definition: mptrac.h:2718
double mixing_strat
Interparcel exchange parameter for mixing in the stratosphere.
Definition: mptrac.h:2877
int qnt_vz
Quantity array index for vertical velocity.
Definition: mptrac.h:2467
int qnt_ho2
Quantity array index for HO2 volume mixing ratio (climatology).
Definition: mptrac.h:2404
double csi_z1
Upper altitude of gridded CSI data [km].
Definition: mptrac.h:3064
double stat_t0
Start time for station output [s].
Definition: mptrac.h:3205
double oh_chem_beta
Beta parameter for diurnal variablity of OH.
Definition: mptrac.h:2940
double wet_depo_so2_ph
pH value used to calculate effective Henry constant of SO2.
Definition: mptrac.h:2976
double mixing_z0
Lower altitude of mixing grid [km].
Definition: mptrac.h:2883
int qnt_mloss_decay
Quantity array index for total mass loss due to exponential decay.
Definition: mptrac.h:2425
int atm_type_out
Type of atmospheric data files for output (-1=same as ATM_TYPE, 0=ASCII, 1=binary,...
Definition: mptrac.h:3022
int met_nlev
Number of meteo data model levels.
Definition: mptrac.h:2669
double dt_kpp
Time step for KPP chemistry [s].
Definition: mptrac.h:2949
double dry_depo_dp
Dry deposition surface layer [hPa].
Definition: mptrac.h:2985
int qnt_shf
Quantity array index for surface sensible heat flux.
Definition: mptrac.h:2302
int qnt_vs
Quantity array index for surface meridional wind.
Definition: mptrac.h:2293
int qnt_Cco
Quantity array index for CO volume mixing ratio (chemistry code).
Definition: mptrac.h:2494
double vtk_dt_out
Time step for VTK data output [s].
Definition: mptrac.h:3214
double t_stop
Stop time of simulation [s].
Definition: mptrac.h:2539
double conv_dt
Time interval for convection module [s].
Definition: mptrac.h:2784
int qnt_hno3
Quantity array index for HNO3 volume mixing ratio (climatology).
Definition: mptrac.h:2395
int met_clams
Read MPTRAC or CLaMS meteo data (0=MPTRAC, 1=CLaMS).
Definition: mptrac.h:2566
int qnt_h2ot
Quantity array index for tropopause water vapor volume mixing ratio.
Definition: mptrac.h:2323
int qnt_rh
Quantity array index for relative humidity over water.
Definition: mptrac.h:2443
double met_cms_eps_cc
cmultiscale compression epsilon for cloud cover.
Definition: mptrac.h:2636
double bound_lat0
Boundary conditions minimum longitude [deg].
Definition: mptrac.h:2799
double met_pbl_max
Maximum depth of planetary boundary layer [km].
Definition: mptrac.h:2696
int met_dx
Stride for longitudes.
Definition: mptrac.h:2639
int mixing_ny
Number of latitudes of mixing grid.
Definition: mptrac.h:2898
int met_convention
Meteo data layout (0=[lev, lat, lon], 1=[lon, lat, lev]).
Definition: mptrac.h:2555
int qnt_zeta_d
Quantity array index for diagnosed zeta vertical coordinate.
Definition: mptrac.h:2455
int tracer_chem
Switch for first order tracer chemistry module (0=off, 1=on).
Definition: mptrac.h:2952
double dt_mod
Time step of simulation [s].
Definition: mptrac.h:2542
int diffusion
Diffusion scheme (0=off, 1=fixed-K, 2=PBL).
Definition: mptrac.h:2745
int qnt_tnat
Quantity array index for T_NAT.
Definition: mptrac.h:2482
int qnt_tice
Quantity array index for T_ice.
Definition: mptrac.h:2476
int qnt_zg
Quantity array index for geopotential height.
Definition: mptrac.h:2326
double vtk_offset
Vertical offset for VTK data [km].
Definition: mptrac.h:3223
int qnt_v
Quantity array index for meridional wind.
Definition: mptrac.h:2341
int qnt_mloss_dry
Quantity array index for total mass loss due to dry deposition.
Definition: mptrac.h:2422
double bound_vmr_trend
Boundary conditions volume mixing ratio trend [ppv/s].
Definition: mptrac.h:2796
int met_cache
Preload meteo data into disk cache (0=no, 1=yes).
Definition: mptrac.h:2715
int qnt_oh
Quantity array index for OH volume mixing ratio (climatology).
Definition: mptrac.h:2398
int qnt_Ch
Quantity array index for H volume mixing ratio (chemistry code).
Definition: mptrac.h:2500
int met_press_level_def
Use predefined pressure levels or not.
Definition: mptrac.h:2666
int oh_chem_reaction
Reaction type for OH chemistry (0=none, 2=bimolecular, 3=termolecular).
Definition: mptrac.h:2934
int qnt_h2o
Quantity array index for water vapor volume mixing ratio.
Definition: mptrac.h:2347
int prof_ny
Number of latitudes of gridded profile data.
Definition: mptrac.h:3169
int qnt_rhice
Quantity array index for relative humidity over ice.
Definition: mptrac.h:2446
int qnt_rho
Quantity array index for density of air.
Definition: mptrac.h:2335
double sample_dz
Layer depth for sample output [km].
Definition: mptrac.h:3190
double tdec_strat
Life time of particles in the stratosphere [s].
Definition: mptrac.h:2832
int obs_type
Type of observation data files (0=ASCII, 1=netCDF).
Definition: mptrac.h:3031
double met_cms_eps_lwc
cmultiscale compression epsilon for cloud liquid water content.
Definition: mptrac.h:2624
int qnt_us
Quantity array index for surface zonal wind.
Definition: mptrac.h:2290
double met_cms_eps_z
cmultiscale compression epsilon for geopotential height.
Definition: mptrac.h:2600
double grid_lon1
Upper longitude of gridded data [deg].
Definition: mptrac.h:3130
int qnt_Cn2o
Quantity array index for N2O volume mixing ratio (chemistry code).
Definition: mptrac.h:2524
int qnt_Cccl3f
Quantity array index for CFC-11 volume mixing ratio (chemistry code).
Definition: mptrac.h:2518
double mixing_lat0
Lower latitude of mixing grid [deg].
Definition: mptrac.h:2901
int nens
Number of ensembles.
Definition: mptrac.h:3040
int qnt_pt
Quantity array index for tropopause pressure.
Definition: mptrac.h:2314
int qnt_cl
Quantity array index for total column cloud water.
Definition: mptrac.h:2374
int advect
Advection scheme (0=off, 1=Euler, 2=midpoint, 4=Runge-Kutta).
Definition: mptrac.h:2735
double prof_z1
Upper altitude of gridded profile data [km].
Definition: mptrac.h:3157
int qnt_t
Quantity array index for temperature.
Definition: mptrac.h:2332
int atm_filter
Time filter for atmospheric data output (0=none, 1=missval, 2=remove).
Definition: mptrac.h:3010
int kpp_chem
Switch for KPP chemistry module (0=off, 1=on).
Definition: mptrac.h:2946
int qnt_zeta
Quantity array index for zeta vertical coordinate.
Definition: mptrac.h:2452
double conv_pbl_trans
Depth of PBL transition layer (fraction of PBL depth).
Definition: mptrac.h:2775
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:2559
double csi_z0
Lower altitude of gridded CSI data [km].
Definition: mptrac.h:3061
int qnt_lapse
Quantity array index for lapse rate.
Definition: mptrac.h:2461
double stat_lat
Latitude of station [deg].
Definition: mptrac.h:3199
int qnt_Cho2
Quantity array index for HO2 volume mixing ratio (chemistry code).
Definition: mptrac.h:2503
int grid_ny
Number of latitudes of gridded data.
Definition: mptrac.h:3133
int qnt_Csf6
Quantity array index for SF6 volume mixing ratio (chemistry code).
Definition: mptrac.h:2527
int qnt_Ch2o
Quantity array index for H2O volume mixing ratio (chemistry code).
Definition: mptrac.h:2488
double met_detrend
FWHM of horizontal Gaussian used for detrending [km].
Definition: mptrac.h:2657
int conv_mix_pbl
Vertical mixing in the PBL (0=off, 1=on).
Definition: mptrac.h:2772
double bound_dps
Boundary conditions surface layer depth [hPa].
Definition: mptrac.h:2811
double met_cms_eps_t
cmultiscale compression epsilon for temperature.
Definition: mptrac.h:2603
int chemgrid_nz
Number of altitudes of chemistry grid.
Definition: mptrac.h:2907
int qnt_cape
Quantity array index for convective available potential energy (CAPE).
Definition: mptrac.h:2386
double bound_mass_trend
Boundary conditions mass per particle trend [kg/s].
Definition: mptrac.h:2790
int mixing_nz
Number of altitudes of mixing grid.
Definition: mptrac.h:2880
int qnt_o3c
Quantity array index for total column ozone.
Definition: mptrac.h:2392
double bound_p0
Boundary conditions bottom pressure [hPa].
Definition: mptrac.h:2805
double mixing_lon0
Lower longitude of mixing grid [deg].
Definition: mptrac.h:2892
int qnt_Co3
Quantity array index for O3 volume mixing ratio (chemistry code).
Definition: mptrac.h:2491
int qnt_tsts
Quantity array index for T_STS.
Definition: mptrac.h:2479
int grid_nz
Number of altitudes of gridded data.
Definition: mptrac.h:3115
int qnt_nss
Quantity array index for northward turbulent surface stress.
Definition: mptrac.h:2299
double ens_dt_out
Time step for ensemble output [s].
Definition: mptrac.h:3088
int atm_stride
Particle index stride for atmospheric data files.
Definition: mptrac.h:3013
int met_relhum
Try to read relative humidity (0=no, 1=yes).
Definition: mptrac.h:2684
double mixing_lat1
Upper latitude of mixing grid [deg].
Definition: mptrac.h:2904
double atm_dt_out
Time step for atmospheric data output [s].
Definition: mptrac.h:3007
double prof_lat1
Upper latitude of gridded profile data [deg].
Definition: mptrac.h:3175
int met_cms_batch
cmultiscale batch size.
Definition: mptrac.h:2590
double psc_h2o
H2O volume mixing ratio for PSC analysis.
Definition: mptrac.h:2991
int met_sp
Smoothing for pressure levels.
Definition: mptrac.h:2654
double prof_lon0
Lower longitude of gridded profile data [deg].
Definition: mptrac.h:3163
int chemgrid_nx
Number of longitudes of chemistry grid.
Definition: mptrac.h:2916
int qnt_pct
Quantity array index for cloud top pressure.
Definition: mptrac.h:2368
int qnt_mloss_kpp
Quantity array index for total mass loss due to KPP chemistry.
Definition: mptrac.h:2416
int qnt_psat
Quantity array index for saturation pressure over water.
Definition: mptrac.h:2431
double prof_lat0
Lower latitude of gridded profile data [deg].
Definition: mptrac.h:3172
int qnt_cin
Quantity array index for convective inhibition (CIN).
Definition: mptrac.h:2389
double psc_hno3
HNO3 volume mixing ratio for PSC analysis.
Definition: mptrac.h:2994
double prof_lon1
Upper longitude of gridded profile data [deg].
Definition: mptrac.h:3166
double met_cms_eps_rwc
cmultiscale compression epsilon for cloud rain water content.
Definition: mptrac.h:2627
int met_nc_quant
Number of digits for quantization of netCDF meteo files (0=off).
Definition: mptrac.h:2575
int h2o2_chem_reaction
Reaction type for H2O2 chemistry (0=none, 1=SO2).
Definition: mptrac.h:2943
int qnt_Co3p
Quantity array index for O(3P) volume mixing ratio (chemistry code).
Definition: mptrac.h:2512
double wet_depo_bc_ret_ratio
Coefficients for wet deposition below cloud: retention ratio.
Definition: mptrac.h:2982
int chemgrid_ny
Number of latitudes of chemistry grid.
Definition: mptrac.h:2925
double met_cms_eps_o3
cmultiscale compression epsilon for ozone.
Definition: mptrac.h:2621
int met_cms_zstd
cmultiscale zstd compression (0=off, 1=on).
Definition: mptrac.h:2593
int grid_sparse
Sparse output in grid data files (0=no, 1=yes).
Definition: mptrac.h:3103
double dry_depo_vdep
Dry deposition velocity [m/s].
Definition: mptrac.h:2988
int qnt_tt
Quantity array index for tropopause temperature.
Definition: mptrac.h:2317
int met_np
Number of target pressure levels.
Definition: mptrac.h:2660
int qnt_ens
Quantity array index for ensemble IDs.
Definition: mptrac.h:2263
int met_nc_level
zlib compression level of netCDF meteo files (0=off).
Definition: mptrac.h:2572
double met_zfp_tol_t
ZFP compression tolerance for temperature.
Definition: mptrac.h:2584
double mixing_dt
Time interval for mixing [s].
Definition: mptrac.h:2871
int qnt_mloss_h2o2
Quantity array index for total mass loss due to H2O2 chemistry.
Definition: mptrac.h:2413
double met_zfp_tol_z
ZFP compression tolerance for geopotential height.
Definition: mptrac.h:2587
double vtk_scale
Vertical scaling factor for VTK data.
Definition: mptrac.h:3220
double met_cms_eps_w
cmultiscale compression epsilon for vertical velocity.
Definition: mptrac.h:2612
double turb_dx_pbl
Horizontal turbulent diffusion coefficient (PBL) [m^2/s].
Definition: mptrac.h:2748
double conv_cin
CIN threshold for convection module [J/kg].
Definition: mptrac.h:2781
int qnt_pv
Quantity array index for potential vorticity.
Definition: mptrac.h:2470
int advect_vert_coord
Vertical velocity of air parcels (0=omega_on_plev, 1=zetadot_on_mlev, 2=omega_on_mlev).
Definition: mptrac.h:2739
int qnt_mloss_oh
Quantity array index for total mass loss due to OH chemistry.
Definition: mptrac.h:2410
int qnt_Ch2o2
Quantity array index for H2O2 volume mixing ratio (chemistry code).
Definition: mptrac.h:2506
int qnt_sst
Quantity array index for sea surface temperature.
Definition: mptrac.h:2308
double mixing_lon1
Upper longitude of mixing grid [deg].
Definition: mptrac.h:2895
int atm_nc_level
zlib compression level of netCDF atmospheric data files (0=off).
Definition: mptrac.h:3025
int met_cms_heur
cmultiscale coarsening heuristics (0=default, 1=mean diff, 2=median diff, 3=max diff).
Definition: mptrac.h:2597
double wet_depo_ic_ret_ratio
Coefficients for wet deposition in cloud: retention ratio.
Definition: mptrac.h:2979
int qnt_sh
Quantity array index for specific humidity.
Definition: mptrac.h:2440
int qnt_ess
Quantity array index for eastward turbulent surface stress.
Definition: mptrac.h:2296
double wet_depo_ic_b
Coefficient B for wet deposition in cloud (exponential form).
Definition: mptrac.h:2967
double wet_depo_bc_b
Coefficient B for wet deposition below cloud (exponential form).
Definition: mptrac.h:2961
int met_dy
Stride for latitudes.
Definition: mptrac.h:2642
int qnt_Cx
Quantity array index for trace species x volume mixing ratio (chemistry code).
Definition: mptrac.h:2485
double turb_dz_strat
Vertical turbulent diffusion coefficient (stratosphere) [m^2/s].
Definition: mptrac.h:2763
double bound_zetas
Boundary conditions surface layer zeta [K].
Definition: mptrac.h:2817
int qnt_idx
Quantity array index for air parcel IDs.
Definition: mptrac.h:2260
double met_tropo_theta
Dynamical tropopause potential temperature threshold [K].
Definition: mptrac.h:2706
int qnt_rwc
Quantity array index for cloud rain water content.
Definition: mptrac.h:2356
double t_start
Start time of simulation [s].
Definition: mptrac.h:2536
int nq
Number of quantities.
Definition: mptrac.h:2245
double tdec_trop
Life time of particles in the troposphere [s].
Definition: mptrac.h:2829
double sample_dx
Horizontal radius for sample output [km].
Definition: mptrac.h:3187
int vtk_stride
Particle index stride for VTK data.
Definition: mptrac.h:3217
double turb_dz_pbl
Vertical turbulent diffusion coefficient (PBL) [m^2/s].
Definition: mptrac.h:2757
double grid_lat1
Upper latitude of gridded data [deg].
Definition: mptrac.h:3139
int qnt_zt
Quantity array index for tropopause geopotential height.
Definition: mptrac.h:2320
int met_type
Type of meteo data files (0=netCDF, 1=binary, 2=pck, 3=zfp, 4=zstd, 5=cms).
Definition: mptrac.h:2563
int qnt_cc
Quantity array index for cloud cover.
Definition: mptrac.h:2365
int qnt_plcl
Quantity array index for pressure at lifted condensation level (LCL).
Definition: mptrac.h:2377
double grid_dt_out
Time step for gridded data output [s].
Definition: mptrac.h:3100
int qnt_tdew
Quantity array index for dew point temperature.
Definition: mptrac.h:2473
Meteo data structure.
Definition: mptrac.h:3465
int nx
Number of longitudes.
Definition: mptrac.h:3471
int ny
Number of latitudes.
Definition: mptrac.h:3474
int np
Number of pressure levels.
Definition: mptrac.h:3477
int npl
Number of model levels.
Definition: mptrac.h:3480
double time
Time [s].
Definition: mptrac.h:3468