Skip to content

Commit

Permalink
Added total column ozone to interpolation functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
lars2015 committed Sep 12, 2023
1 parent 00c17cd commit 46ed98e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 21 deletions.
2 changes: 2 additions & 0 deletions src/libtrac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2230,6 +2230,7 @@ void read_ctl(
ctl->qnt_pel = -1;
ctl->qnt_cape = -1;
ctl->qnt_cin = -1;
ctl->qnt_o3c = -1;
ctl->qnt_hno3 = -1;
ctl->qnt_oh = -1;
ctl->qnt_h2o2 = -1;
Expand Down Expand Up @@ -2332,6 +2333,7 @@ void read_ctl(
SET_QNT(qnt_cape, "cape", "convective available potential energy",
"J/kg")
SET_QNT(qnt_cin, "cin", "convective inhibition", "J/kg")
SET_QNT(qnt_o3c, "o3c", "total column ozone", "DU")
SET_QNT(qnt_hno3, "hno3", "nitric acid", "ppv")
SET_QNT(qnt_oh, "oh", "hydroxyl radical", "ppv")
SET_QNT(qnt_h2o2, "h2o2", "hydrogen peroxide", "ppv")
Expand Down
7 changes: 6 additions & 1 deletion src/libtrac.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@
intpol_met_space_2d(met, met->pel, lon, lat, &pel, ci, cw, 0); \
intpol_met_space_2d(met, met->cape, lon, lat, &cape, ci, cw, 0); \
intpol_met_space_2d(met, met->cin, lon, lat, &cin, ci, cw, 0); \
intpol_met_space_2d(met, met->o3c, lon, lat, &o3c, ci, cw, 0); \
}

/*! Temporal interpolation of all meteo data. */
Expand Down Expand Up @@ -398,6 +399,7 @@
intpol_met_time_2d(met0, met0->pel, met1, met1->pel, time, lon, lat, &pel, ci, cw, 0); \
intpol_met_time_2d(met0, met0->cape, met1, met1->cape, time, lon, lat, &cape, ci, cw, 0); \
intpol_met_time_2d(met0, met0->cin, met1, met1->cin, time, lon, lat, &cin, ci, cw, 0); \
intpol_met_time_2d(met0, met0->o3c, met1, met1->o3c, time, lon, lat, &o3c, ci, cw, 0); \
}

/*! Calculate lapse rate between pressure levels. */
Expand Down Expand Up @@ -946,6 +948,9 @@ typedef struct {
/*! Quantity array index for convective inhibition (CIN). */
int qnt_cin;

/*! Quantity array index for total column ozone. */
int qnt_o3c;

/*! Quantity array index for nitric acid vmr. */
int qnt_hno3;

Expand Down Expand Up @@ -1861,7 +1866,7 @@ typedef struct {
/*! Convective inhibition [J/kg]. */
float cin[EX][EY];

/*! Total ozone column [DU]. */
/*! Total column ozone [DU]. */
float o3c[EX][EY];

/*! Geopotential height [km]. */
Expand Down
7 changes: 4 additions & 3 deletions src/met_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ int main(
tnatm[NX][NY], lwc, lwcm[NX][NY], iwc, iwcm[NX][NY], cc, ccm[NX][NY],
z, zm[NX][NY], pv, pvm[NX][NY], zt, ztm[NX][NY], tt, ttm[NX][NY],
pct, pctm[NX][NY], pcb, pcbm[NX][NY], cl, clm[NX][NY], plcl,
plclm[NX][NY], plfc, plfcm[NX][NY], pel, pelm[NX][NY],
cape, capem[NX][NY], cin, cinm[NX][NY], rhm[NX][NY], rhicem[NX][NY],
theta, ptop, pbot, t0, lon, lon0, lon1, lons[NX], dlon,
plclm[NX][NY], plfc, plfcm[NX][NY], pel, pelm[NX][NY], cape,
capem[NX][NY], cin, cinm[NX][NY], o3c, o3cm[NX][NY], rhm[NX][NY],
rhicem[NX][NY], theta, ptop, pbot, t0, lon, lon0, lon1, lons[NX], dlon,
lat, lat0, lat1, lats[NY], dlat, cw[3];

static int i, ix, iy, np[NX][NY], npc[NX][NY], npt[NX][NY], nx, ny, ci[3];
Expand Down Expand Up @@ -184,6 +184,7 @@ int main(
h2otm[ix][iy] += h2ot;
npt[ix][iy]++;
}
o3cm[ix][iy] += o3c;
hno3m[ix][iy] += clim_zm(&clim->hno3, met->time, lats[iy], p0);
tnatm[ix][iy] +=
nat_temperature(p0, h2o,
Expand Down
9 changes: 5 additions & 4 deletions src/met_prof.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ int main(
iwc, iwcm[NZ], cc, ccm[NZ], ps, psm[NZ], ts, tsm[NZ], zs, zsm[NZ],
us, usm[NZ], vs, vsm[NZ], lsm, lsmm[NZ], sst, sstm[NZ], pbl, pblm[NZ],
pt, ptm[NZ], pct, pctm[NZ], pcb, pcbm[NZ], cl, clm[NZ], plcl, plclm[NZ],
plfc, plfcm[NZ], pel, pelm[NZ], cape, capem[NZ], cin, cinm[NZ], tt,
ttm[NZ], zm[NZ], zt, ztm[NZ], pv, pvm[NZ], plev[NZ], rhm[NZ], rhicem[NZ],
tdewm[NZ], ticem[NZ], tnatm[NZ], hno3m[NZ], ohm[NZ], h2o2m[NZ],
ho2m[NZ], o1dm[NZ], cw[3];
plfc, plfcm[NZ], pel, pelm[NZ], cape, capem[NZ], cin, cinm[NZ],
o3c, o3cm[NZ], tt, ttm[NZ], zm[NZ], zt, ztm[NZ], pv, pvm[NZ], plev[NZ],
rhm[NZ], rhicem[NZ], tdewm[NZ], ticem[NZ], tnatm[NZ], hno3m[NZ],
ohm[NZ], h2o2m[NZ], ho2m[NZ], o1dm[NZ], cw[3];

static int i, iz, np[NZ], npc[NZ], npt[NZ], nz, ci[3];

Expand Down Expand Up @@ -168,6 +168,7 @@ int main(
h2otm[iz] += h2ot;
npt[iz]++;
}
o3cm[iz] += o3c;
rhm[iz] += RH(plev[iz], t, h2o);
rhicem[iz] += RHICE(plev[iz], t, h2o);
tdewm[iz] += TDEW(plev[iz], h2o);
Expand Down
4 changes: 2 additions & 2 deletions src/met_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ int main(
FILE *out;

double h2o, h2ot, o3, lwc, iwc, cc, p0, p1, ps, ts, zs, us, vs, lsm, sst,
pbl, pt, pct, pcb, cl, plcl, plfc, pel, cape, cin, pv, t, tt, u, v, w,
z, zm, zref, zt, cw[3], time_old = -999, p_old = -999, lon_old = -999,
pbl, pt, pct, pcb, cl, plcl, plfc, pel, cape, cin, o3c, pv, t, tt, u, v,
w, z, zm, zref, zt, cw[3], time_old = -999, p_old = -999, lon_old = -999,
lat_old = -999;

int geopot, grid_time, grid_z, grid_lon, grid_lat, ip, it, ci[3];
Expand Down
20 changes: 10 additions & 10 deletions src/met_zm.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,15 @@ int main(
static double timem[NZ][NY], psm[NZ][NY], tsm[NZ][NY], zsm[NZ][NY],
usm[NZ][NY], vsm[NZ][NY], lsmm[NZ][NY], sstm[NZ][NY], pblm[NZ][NY],
ptm[NZ][NY], pctm[NZ][NY], pcbm[NZ][NY], clm[NZ][NY], plclm[NZ][NY],
plfcm[NZ][NY], pelm[NZ][NY], capem[NZ][NY], cinm[NZ][NY], ttm[NZ][NY],
ztm[NZ][NY], tm[NZ][NY], um[NZ][NY], vm[NZ][NY], wm[NZ][NY], h2om[NZ][NY],
h2otm[NZ][NY], pvm[NZ][NY], o3m[NZ][NY], lwcm[NZ][NY], iwcm[NZ][NY],
ccm[NZ][NY], zm[NZ][NY], rhm[NZ][NY], rhicem[NZ][NY], tdewm[NZ][NY],
ticem[NZ][NY], tnatm[NZ][NY], hno3m[NZ][NY], ohm[NZ][NY], h2o2m[NZ][NY],
ho2m[NZ][NY], o1dm[NZ][NY], z, z0, z1, dz, zt, tt, plev[NZ],
ps, ts, zs, us, vs, lsm, sst, pbl, pt, pct, pcb, plcl, plfc, pel,
cape, cin, cl, t, u, v, w, pv, h2o, h2ot, o3,
lwc, iwc, cc, lat, lat0, lat1, dlat, lats[NY], lon0, lon1,
lonm[NZ][NY], cw[3];
plfcm[NZ][NY], pelm[NZ][NY], capem[NZ][NY], cinm[NZ][NY], o3cm[NZ][NY],
ttm[NZ][NY], ztm[NZ][NY], tm[NZ][NY], um[NZ][NY], vm[NZ][NY], wm[NZ][NY],
h2om[NZ][NY], h2otm[NZ][NY], pvm[NZ][NY], o3m[NZ][NY], lwcm[NZ][NY],
iwcm[NZ][NY], ccm[NZ][NY], zm[NZ][NY], rhm[NZ][NY], rhicem[NZ][NY],
tdewm[NZ][NY], ticem[NZ][NY], tnatm[NZ][NY], hno3m[NZ][NY], ohm[NZ][NY],
h2o2m[NZ][NY], ho2m[NZ][NY], o1dm[NZ][NY], z, z0, z1, dz, zt, tt,
plev[NZ], ps, ts, zs, us, vs, lsm, sst, pbl, pt, pct, pcb, plcl, plfc,
pel, cape, cin, o3c, cl, t, u, v, w, pv, h2o, h2ot, o3, lwc, iwc, cc, lat,
lat0, lat1, dlat, lats[NY], lon0, lon1, lonm[NZ][NY], cw[3];

static int i, ix, iy, iz, np[NZ][NY], npc[NZ][NY], npt[NZ][NY], ny, nz,
ci[3];
Expand Down Expand Up @@ -180,6 +179,7 @@ int main(
h2otm[iz][iy] += h2ot;
npt[iz][iy]++;
}
o3cm[iz][iy] += o3c;
rhm[iz][iy] += RH(plev[iz], t, h2o);
rhicem[iz][iy] += RHICE(plev[iz], t, h2o);
tdewm[iz][iy] += TDEW(plev[iz], h2o);
Expand Down
4 changes: 3 additions & 1 deletion src/trac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,8 @@ void module_meteo(
PARTICLE_LOOP(0, atm->np, 0, "acc data present(ctl,clim,met0,met1,atm,dt)") {

double ps, ts, zs, us, vs, lsm, sst, pbl, pt, pct, pcb, cl, plcl, plfc,
pel, cape, cin, pv, t, tt, u, v, w, h2o, h2ot, o3, lwc, iwc, cc, z, zt;
pel, cape, cin, o3c, pv, t, tt, u, v, w, h2o, h2ot, o3,
lwc, iwc, cc, z, zt;

/* Interpolate meteo data... */
INTPOL_INIT;
Expand Down Expand Up @@ -1418,6 +1419,7 @@ void module_meteo(
SET_ATM(qnt_pel, pel);
SET_ATM(qnt_cape, cape);
SET_ATM(qnt_cin, cin);
SET_ATM(qnt_o3c, o3c);
SET_ATM(qnt_hno3,
clim_zm(&clim->hno3, atm->time[ip], atm->lat[ip], atm->p[ip]));
SET_ATM(qnt_oh, clim_oh(ctl, clim, atm->time[ip],
Expand Down

0 comments on commit 46ed98e

Please sign in to comment.