From 19b30954c8a6b3438ae31cbe17a07fc2b6181b9c Mon Sep 17 00:00:00 2001 From: Lars Hoffmann Date: Mon, 15 Nov 2021 16:44:58 +0100 Subject: [PATCH] Update met tools (additional output variables). --- src/libtrac.c | 4 +++- src/met_map.c | 32 +++++++++++++++++++++----------- src/met_prof.c | 28 ++++++++++++++++++++-------- src/met_sample.c | 15 ++++++++++++--- src/met_zm.c | 39 +++++++++++++++++++++++++-------------- src/trac.c | 2 +- 6 files changed, 82 insertions(+), 38 deletions(-) diff --git a/src/libtrac.c b/src/libtrac.c index 3740c6c70..87b40834c 100644 --- a/src/libtrac.c +++ b/src/libtrac.c @@ -342,7 +342,9 @@ double clim_hno3( clim_hno3_lats[ilat + 1], aux11, lat); aux00 = LIN(clim_hno3_secs[isec], aux00, clim_hno3_secs[isec + 1], aux11, sec); - return GSL_MAX(aux00, 0.0); + + /* Convert from ppb to ppv... */ + return GSL_MAX(1e-9 * aux00, 0.0); } /*****************************************************************************/ diff --git a/src/met_map.c b/src/met_map.c index 756bc7364..bdb9aae7b 100644 --- a/src/met_map.c +++ b/src/met_map.c @@ -52,10 +52,12 @@ int main( zsm[NX][NY], us, usm[NX][NY], vs, vsm[NX][NY], pbl, pblm[NX][NY], pt, ptm[NX][NY], t, pm[NX][NY], tm[NX][NY], u, um[NX][NY], v, vm[NX][NY], w, wm[NX][NY], h2o, h2om[NX][NY], h2ot, h2otm[NX][NY], o3, o3m[NX][NY], + hno3m[NX][NY], ohm[NX][NY], tdewm[NX][NY], ticem[NX][NY], tnatm[NX][NY], lwc, lwcm[NX][NY], iwc, iwcm[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], theta, ptop, pbot, t0, + pel, pelm[NX][NY], cape, capem[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], nx, ny, ci[3]; @@ -162,6 +164,14 @@ int main( ztm[ix][iy] += zt; ttm[ix][iy] += tt; h2otm[ix][iy] += h2ot; + hno3m[ix][iy] += clim_hno3(met->time, lats[iy], p0); + tnatm[ix][iy] += + nat_temperature(p0, h2o, clim_hno3(met->time, lats[iy], p0)); + ohm[ix][iy] += clim_oh(met->time, lats[iy], p0); + rhm[ix][iy] += RH(p0, t, h2o); + rhicem[ix][iy] += RHICE(p0, t, h2o); + tdewm[ix][iy] += TDEW(p0, h2o); + ticem[ix][iy] += TICE(p0, h2o); np[ix][iy]++; } } @@ -211,15 +221,18 @@ int main( "# $33 = relative humidity over ice [%%]\n" "# $34 = dew point temperature [K]\n" "# $35 = frost point temperature [K]\n" - "# $36 = boundary layer pressure [hPa]\n"); + "# $36 = NAT temperature [K]\n" + "# $37 = HNO3 volume mixing ratio [ppv]\n" + "# $38 = OH concentration [molec/cm^3]\n" + "# $39 = boundary layer pressure [hPa]\n"); /* Write data... */ for (iy = 0; iy < ny; iy++) { fprintf(out, "\n"); for (ix = 0; ix < nx; ix++) fprintf(out, - "%.2f %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g" - " %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g\n", + "%.2f %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g" + " %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g\n", timem[ix][iy] / np[ix][iy], Z(pm[ix][iy] / np[ix][iy]), lons[ix], lats[iy], pm[ix][iy] / np[ix][iy], tm[ix][iy] / np[ix][iy], um[ix][iy] / np[ix][iy], @@ -235,13 +248,10 @@ int main( pctm[ix][iy] / np[ix][iy], pcbm[ix][iy] / np[ix][iy], plclm[ix][iy] / np[ix][iy], plfcm[ix][iy] / np[ix][iy], pelm[ix][iy] / np[ix][iy], capem[ix][iy] / np[ix][iy], - RH(pm[ix][iy] / np[ix][iy], tm[ix][iy] / np[ix][iy], - h2om[ix][iy] / np[ix][iy]), - RHICE(pm[ix][iy] / np[ix][iy], tm[ix][iy] / np[ix][iy], - h2om[ix][iy] / np[ix][iy]), - TDEW(pm[ix][iy] / np[ix][iy], h2om[ix][iy] / np[ix][iy]), - TICE(pm[ix][iy] / np[ix][iy], h2om[ix][iy] / np[ix][iy]), - pblm[ix][iy] / np[ix][iy]); + rhm[ix][iy] / np[ix][iy], rhicem[ix][iy] / np[ix][iy], + tdewm[ix][iy] / np[ix][iy], ticem[ix][iy] / np[ix][iy], + tnatm[ix][iy] / np[ix][iy], hno3m[ix][iy] / np[ix][iy], + ohm[ix][iy] / np[ix][iy], pblm[ix][iy] / np[ix][iy]); } /* Close file... */ diff --git a/src/met_prof.c b/src/met_prof.c index 28e94a393..8e3a423e6 100644 --- a/src/met_prof.c +++ b/src/met_prof.c @@ -52,7 +52,8 @@ int main( vs, vsm[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], tt, ttm[NZ], zm[NZ], zt, ztm[NZ], pv, pvm[NZ], - plev[NZ], cw[3]; + plev[NZ], rhm[NZ], rhicem[NZ], tdewm[NZ], ticem[NZ], tnatm[NZ], + hno3m[NZ], ohm[NZ], cw[3]; static int i, iz, np[NZ], npt[NZ], nz, ci[3]; @@ -152,6 +153,15 @@ int main( h2otm[iz] += h2ot; npt[iz]++; } + rhm[iz] += RH(plev[iz], t, h2o); + rhicem[iz] += RHICE(plev[iz], t, h2o); + tdewm[iz] += TDEW(plev[iz], h2o); + ticem[iz] += TICE(plev[iz], h2o); + hno3m[iz] += clim_hno3(met->time, lat, plev[iz]); + tnatm[iz] += + nat_temperature(plev[iz], h2o, + clim_hno3(met->time, lat, plev[iz])); + ohm[iz] += clim_oh(met->time, lat, plev[iz]); np[iz]++; } } @@ -202,13 +212,16 @@ int main( "# $33 = relative humidity over ice [%%]\n" "# $34 = dew point temperature [K]\n" "# $35 = frost point temperature [K]\n" - "# $36 = boundary layer pressure [hPa]\n\n"); + "# $36 = NAT temperature [K]\n" + "# $37 = HNO3 volume mixing ratio [ppv]\n" + "# $38 = OH concentration [molec/cm^3]\n" + "# $39 = boundary layer pressure [hPa]\n\n"); /* Write data... */ for (iz = 0; iz < nz; iz++) fprintf(out, - "%.2f %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g" - " %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g\n", + "%.2f %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g" + " %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g\n", timem[iz] / np[iz], Z(plev[iz]), lonm[iz] / np[iz], latm[iz] / np[iz], plev[iz], tm[iz] / np[iz], um[iz] / np[iz], vm[iz] / np[iz], wm[iz] / np[iz], h2om[iz] / np[iz], @@ -219,10 +232,9 @@ int main( lwcm[iz] / np[iz], iwcm[iz] / np[iz], clm[iz] / np[iz], pctm[iz] / np[iz], pcbm[iz] / np[iz], plclm[iz] / np[iz], plfcm[iz] / np[iz], pelm[iz] / np[iz], capem[iz] / np[iz], - RH(plev[iz], tm[iz] / np[iz], h2om[iz] / np[iz]), - RHICE(plev[iz], tm[iz] / np[iz], h2om[iz] / np[iz]), - TDEW(plev[iz], h2om[iz] / np[iz]), - TICE(plev[iz], h2om[iz] / np[iz]), pblm[iz] / np[iz]); + rhm[iz] / np[iz], rhicem[iz] / np[iz], tdewm[iz] / np[iz], + ticem[iz] / np[iz], tnatm[iz] / np[iz], hno3m[iz] / np[iz], + ohm[iz] / np[iz], pblm[iz] / np[iz]); /* Close file... */ fclose(out); diff --git a/src/met_sample.c b/src/met_sample.c index 6070c17c7..df186d6d6 100644 --- a/src/met_sample.c +++ b/src/met_sample.c @@ -117,7 +117,10 @@ int main( "# $33 = relative humidity over ice [%%]\n" "# $34 = dew point temperature [K]\n" "# $35 = frost point temperature [K]\n" - "# $36 = boundary layer pressure [hPa]\n\n"); + "# $36 = NAT temperature [K]\n" + "# $37 = HNO3 volume mixing ratio [ppv]\n" + "# $38 = OH concentration [molec/cm^3]\n" + "# $39 = boundary layer pressure [hPa]\n"); /* Loop over air parcels... */ for (ip = 0; ip < atm->np; ip++) { @@ -160,12 +163,18 @@ int main( /* Write data... */ fprintf(out, "%.2f %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g" - " %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g\n", + " %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g\n", atm->time[ip], Z(atm->p[ip]), atm->lon[ip], atm->lat[ip], atm->p[ip], t, u, v, w, h2o, o3, z, pv, ps, ts, zs, us, vs, pt, zt, tt, h2ot, lwc, iwc, cl, pct, pcb, plcl, plfc, pel, cape, RH(atm->p[ip], t, h2o), RHICE(atm->p[ip], t, h2o), - TDEW(atm->p[ip], h2o), TICE(atm->p[ip], h2o), pbl); + TDEW(atm->p[ip], h2o), TICE(atm->p[ip], h2o), + nat_temperature(atm->p[ip], h2o, + clim_hno3(atm->time[ip], atm->lat[ip], + atm->p[ip])), clim_hno3(atm->time[ip], + atm->lat[ip], + atm->p[ip]), + clim_oh(atm->time[ip], atm->lat[ip], atm->p[ip]), pbl); } /* Close file... */ diff --git a/src/met_zm.c b/src/met_zm.c index 2d7c156e0..ddaadd836 100644 --- a/src/met_zm.c +++ b/src/met_zm.c @@ -53,10 +53,12 @@ int main( pcbm[NZ][NY], clm[NZ][NY], plclm[NZ][NY], plfcm[NZ][NY], pelm[NZ][NY], capem[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], zm[NZ][NY], z, z0, z1, dz, zt, - tt, plev[NZ], ps, ts, zs, us, vs, pbl, pt, pct, pcb, plcl, plfc, pel, - cape, cl, t, u, v, w, pv, h2o, h2ot, o3, lwc, iwc, lat, lat0, lat1, dlat, - lats[NY], lon0, lon1, lonm[NZ][NY], cw[3]; + o3m[NZ][NY], lwcm[NZ][NY], iwcm[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], z, z0, z1, dz, zt, tt, plev[NZ], + ps, ts, zs, us, vs, pbl, pt, pct, pcb, plcl, plfc, pel, + cape, cl, t, u, v, w, pv, h2o, h2ot, o3, lwc, iwc, + lat, lat0, lat1, dlat, lats[NY], lon0, lon1, lonm[NZ][NY], cw[3]; static int i, ix, iy, iz, np[NZ][NY], npt[NZ][NY], ny, nz, ci[3]; @@ -161,6 +163,15 @@ int main( h2otm[iz][iy] += h2ot; npt[iz][iy]++; } + rhm[iz][iy] += RH(plev[iz], t, h2o); + rhicem[iz][iy] += RHICE(plev[iz], t, h2o); + tdewm[iz][iy] += TDEW(plev[iz], h2o); + ticem[iz][iy] += TICE(plev[iz], h2o); + hno3m[iz][iy] += clim_hno3(met->time, lats[iy], plev[iz]); + tnatm[iz][iy] += + nat_temperature(plev[iz], h2o, + clim_hno3(met->time, lats[iy], plev[iz])); + ohm[iz][iy] += clim_oh(met->time, lats[iy], plev[iz]); np[iz][iy]++; } } @@ -210,15 +221,18 @@ int main( "# $33 = relative humidity over ice [%%]\n" "# $34 = dew point temperature [K]\n" "# $35 = frost point temperature [K]\n" - "# $36 = boundary layer pressure [hPa]\n"); + "# $36 = NAT temperature [K]\n" + "# $37 = HNO3 volume mixing ratio [ppv]\n" + "# $38 = OH concentration [molec/cm^3]\n" + "# $39 = boundary layer pressure [hPa]\n"); /* Write data... */ for (iz = 0; iz < nz; iz++) { fprintf(out, "\n"); for (iy = 0; iy < ny; iy++) fprintf(out, - "%.2f %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g" - " %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g\n", + "%.2f %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g" + " %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g\n", timem[iz][iy] / np[iz][iy], Z(plev[iz]), lonm[iz][iy] / np[iz][iy], lats[iy], plev[iz], tm[iz][iy] / np[iz][iy], um[iz][iy] / np[iz][iy], @@ -234,13 +248,10 @@ int main( pctm[iz][iy] / np[iz][iy], pcbm[iz][iy] / np[iz][iy], plclm[iz][iy] / np[iz][iy], plfcm[iz][iy] / np[iz][iy], pelm[iz][iy] / np[iz][iy], capem[iz][iy] / np[iz][iy], - RH(plev[iz], tm[iz][iy] / np[iz][iy], - h2om[iz][iy] / np[iz][iy]), - RHICE(plev[iz], tm[iz][iy] / np[iz][iy], - h2om[iz][iy] / np[iz][iy]), - TDEW(plev[iz], h2om[iz][iy] / np[iz][iy]), - TICE(plev[iz], h2om[iz][iy] / np[iz][iy]), - pblm[iz][iy] / np[iz][iy]); + rhm[iz][iy] / np[iz][iy], rhicem[iz][iy] / np[iz][iy], + tdewm[iz][iy] / np[iz][iy], ticem[iz][iy] / np[iz][iy], + tnatm[iz][iy] / np[iz][iy], hno3m[iz][iy] / np[iz][iy], + ohm[iz][iy] / np[iz][iy], pblm[iz][iy] / np[iz][iy]); } /* Close file... */ diff --git a/src/trac.c b/src/trac.c index a48c12baf..5e087aab8 100644 --- a/src/trac.c +++ b/src/trac.c @@ -1090,7 +1090,7 @@ void module_meteo( SET_ATM(qnt_tnat, nat_temperature(atm->p[ip], h2o, clim_hno3(atm->time[ip], atm->lat[ip], - atm->p[ip]) * 1e-9)); + atm->p[ip]))); SET_ATM(qnt_tsts, 0.5 * (atm->q[ctl->qnt_tice][ip] + atm->q[ctl->qnt_tnat][ip])); }