Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Calc fluxes at ground #38

Open
wants to merge 86 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
3a14e33
use T_e and theta_e when calculating change od theta
pdziekan Apr 23, 2018
1b554ea
use p_e instead of T_e to make condensation easier
pdziekan Apr 24, 2018
c9711f9
a 2D/3D arr for p_e in blk_1m
pdziekan Apr 24, 2018
3d52711
sllkvr blk_1m: init p_e b4 first call to condevap
pdziekan Apr 24, 2018
52151c0
blk_1m: also pass p_d_env to adj_cellwise
pdziekan Apr 24, 2018
8f08983
blk_1m: condensation pre-advection, post-half-rhs; r_l stored in upda…
pdziekan Apr 25, 2018
4918726
add subsidence of rc and rr in blk_1m
pdziekan Apr 25, 2018
11d0314
fix suubsidence of rc and rr in blk_1m
pdziekan Apr 25, 2018
7c5002b
add subsidence of rc and rr in blk_1m cd
pdziekan Apr 25, 2018
2108039
fix params copy in slvr_blk_1m
pdziekan Apr 26, 2018
bb036c9
constant pressure profile in lgrngn too
pdziekan May 7, 2018
eabe64a
Merge branch 'lasher_trapp' into lasher_trapp_plus_pres_env_in_cond
pdziekan May 10, 2018
6540269
Merge branch 'lasher_trapp' into lasher_trapp_plus_pres_env_in_cond
pdziekan May 10, 2018
8fe63d8
Merge branch 'lasher_trapp' into lasher_trapp_plus_pres_env_in_cond
pdziekan May 16, 2018
3bd98b9
pressure profile 3d array in lgrngn
pdziekan May 17, 2018
350f8d9
Merge branch 'lasher_trapp' into lasher_trapp_plus_pres_env_in_cond
pdziekan May 17, 2018
510b8e7
add pressure plotting
pdziekan May 17, 2018
02c843b
bring back smoothing of buoyancy - otherwise occasional nans
pdziekan May 17, 2018
56298c7
save pressure + pass only env prof of p, not p_d
pdziekan May 17, 2018
e670848
fix pressure profile at the ground in moist thermal
mwarusz May 18, 2018
6c7799e
add temperature plotting
pdziekan May 18, 2018
fb01242
remove dry pressure in one-moment bulk solver
mwarusz May 18, 2018
876a52e
convert full tht to dry tht using initial rv not rv_e in moist thermal
mwarusz May 18, 2018
1cfba98
DYCOMS: reference state dry density and potential temp at z=0 equal t…
pdziekan May 21, 2018
7e05bf3
turn off smoothing in buoy and subsidence (again)
pdziekan May 21, 2018
32a3e56
record temperaturwe + remove old p_d_e
pdziekan May 21, 2018
4248ac5
comment in dycoms case
pdziekan May 22, 2018
1609265
Merge remote-tracking branch 'mwarusz/pdziekan-lasher_trapp_plus_pres…
pdziekan May 22, 2018
5274dd0
fix one-moment bulk model forces
mwarusz May 22, 2018
a935b86
add cheating to one-moment bulk solver (negtozero)
mwarusz May 22, 2018
00b21bc
Merge remote-tracking branch 'mwarusz/pdziekan-lasher_trapp_plus_pres…
pdziekan May 22, 2018
ac4e6c2
fix dycoms plots for blk_1m micro
pdziekan May 22, 2018
673088e
blk_1m: save puddle + use newton raphson condensation
pdziekan May 23, 2018
55d2cd1
negtozero: output suppressed in production runs
pdziekan May 23, 2018
735ee62
dycoms case output lwp
pdziekan May 24, 2018
e733c5c
pass p_d_e to lgrngn micro init
pdziekan Jun 8, 2018
1ac61eb
adapt moist thermal to the constant pressure profile
pdziekan Jun 8, 2018
6f53fb3
use p_d profile in blk_1m:
pdziekan Jun 8, 2018
643d732
pass p_e to intcond also in 3d
pdziekan Jun 11, 2018
6870c8d
blk_1m: fix p_d value
pdziekan Jun 12, 2018
0140422
timing of nondelayed step
pdziekan Jun 12, 2018
98fcbca
fix slvr_blk_1m pressures
pdziekan Jun 14, 2018
e394775
delay advection of th and rv, async calc of step_sync during advectio…
pdziekan Jun 18, 2018
3df4499
fix slvr_blk_1m pressures
pdziekan Jun 14, 2018
8453f72
Revert "pass p_d_e to lgrngn micro init"
pdziekan Jul 10, 2018
cbfe44b
Revert "use p_d profile in blk_1m:"
pdziekan Jul 10, 2018
7170529
Merge branch 'lasher_trapp_plus_pres_env_in_cond' into delayed_advection
pdziekan Jul 10, 2018
b3bed3d
DYCOMS: revert to reference state dry density and potential temp at z…
pdziekan Jul 10, 2018
faceda3
record RH_formula used
pdziekan Jul 18, 2018
928fc59
sd_conc_large_tail option
pdziekan Jul 19, 2018
e40b2ae
mixed explicit/implicit integration; breaks blk_1m
pdziekan Jul 25, 2018
4d1c205
lgrngn: sync in before rhs_apply, cond after rhs_apply
pdziekan Jul 25, 2018
9c40e58
w8 for async before mixed_rhs_ante
pdziekan Jul 26, 2018
349f0eb
add a todo in buoyancy
pdziekan Jul 27, 2018
c1da6c2
mixed_rhs_ante_step: update rhs after sync_in for code readability
pdziekan Jul 27, 2018
e9b1a4b
todo on rhs:'
pdziekan Jul 27, 2018
fa84db7
theta_std stuff: no std2dry and use rv_cc RH formula
pdziekan Jul 27, 2018
53dd515
thl profile: follow that th is no th_std
pdziekan Jul 27, 2018
2d11912
fix thl profile with th_std
pdziekan Jul 27, 2018
b635e0d
dycoms: theta_ref(0) = theta_virt_env(0)
pdziekan Jul 30, 2018
90398c3
use hall kernel instead of hall_davis_no_waals
pdziekan Jul 30, 2018
db95f2c
use the khvorostyanow_nonsppherical terminal velocity
pdziekan Jul 30, 2018
5111a60
use pv_cc instead of rv_cc - a little inconsistency with the lipps-he…
pdziekan Jul 30, 2018
ad098dc
Revert "use hall kernel instead of hall_davis_no_waals"
pdziekan Jul 31, 2018
3f26c43
Revert "use pv_cc instead of rv_cc - a little inconsistency with the …
pdziekan Jul 31, 2018
b21bb82
condensation after apply rhs at n
pdziekan Jul 31, 2018
b5ff2ff
add rv/th pre/post cond arrays to slvr_lgrngn
pdziekan Aug 1, 2018
609dc0b
slvr_lgrngn: store cond rhs and apply
pdziekan Aug 1, 2018
25bdabf
lgrngn: better nancheck messages + barriers update
pdziekan Aug 2, 2018
f78ddb7
lgrngn: rhs at n done after running step_sync
pdziekan Aug 2, 2018
55744d3
lgrngn: diag_rl post cond, advect and subside it
pdziekan Aug 2, 2018
bc5ecbd
Merge branch 'delayed_advection_and_theta_std' into delayed_advection…
pdziekan Aug 2, 2018
99cf445
Merge branch 'master' into delayed_advection
pdziekan Aug 14, 2018
c182d28
Merge branch 'master' into delayed_advection_and_theta_std
pdziekan Aug 14, 2018
7d61fc9
fix dry and moist thermals with pressure
pdziekan Aug 29, 2018
fd2c56b
conform to codacy's stupid requests
pdziekan Aug 29, 2018
af94e8a
use rv_cc RH formula
pdziekan Aug 29, 2018
47ef7d0
Merge branch 'delayed_advection' into delayed_advection_and_theta_std
pdziekan Aug 29, 2018
08def49
moist thermal: following th_std
pdziekan Aug 29, 2018
2612734
set a valid Cy_domain in 2D to silence asserts
pdziekan Aug 30, 2018
f102057
MT test: tweak lgrngn results a bit to constant pressure changes
pdziekan Aug 30, 2018
a2d6318
MT test: blk_1m th_std exp results
pdziekan Aug 30, 2018
74286e0
if usong large tail, set higher n_sd_max
pdziekan Sep 4, 2018
e319266
Merge branch 'delayed_advection_and_theta_std' into delayed_advection…
pdziekan Sep 4, 2018
87124ae
fluxes: rhod and p_e from ground level
pdziekan Sep 7, 2018
dc2be34
siurf flux: calc at ground
pdziekan Sep 10, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion drawbicyc/PlotterMicro.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ class PlotterMicro_t : public Plotter_t<NDims>
public:
// functions for diagnosing fields
//
// aerosol droplets mixing ratio
auto h5load_ra_timestep(
int at
) -> decltype(blitz::safeToReturn(arr_t() + 0))
{
if(this->micro == "lgrngn")
res = this->h5load_timestep("aerosol_rw_mom3", at) * 4./3. * 3.1416 * 1e3;
else if(this->micro == "blk_1m")
res = 0;
return blitz::safeToReturn(res + 0);
}

// cloud droplets mixing ratio
auto h5load_rc_timestep(
int at
Expand All @@ -40,7 +52,7 @@ class PlotterMicro_t : public Plotter_t<NDims>
if(this->micro == "lgrngn")
res = this->h5load_timestep("rain_rw_mom3", at) * 4./3. * 3.1416 * 1e3;
else if(this->micro == "blk_1m")
res = this->h5load_timestep("rc", at);
res = this->h5load_timestep("rr", at);
return blitz::safeToReturn(res + 0);
}

Expand All @@ -59,6 +71,48 @@ class PlotterMicro_t : public Plotter_t<NDims>
return blitz::safeToReturn(res + 0);
}

// cloud droplets concentration [1/kg]
auto h5load_nc_timestep(
int at
) -> decltype(blitz::safeToReturn(arr_t() + 0))
{
if(this->micro == "lgrngn")
res = this->h5load_timestep("cloud_rw_mom0", at);
else if(this->micro == "blk_1m")
res = 0;
return blitz::safeToReturn(res + 0);
}

// precipitation flux [W/m2]
auto h5load_prflux_timestep(
int at
) -> decltype(blitz::safeToReturn(arr_t() + 0))
{
if(this->micro == "lgrngn")
{
res = this->h5load_timestep("precip_rate", at)
* 4./3 * 3.14 * 1e3 // to get mass
/ this->CellVol // averaged over cell volume, TODO: make precip rate return specific moment? wouldnt need the dx and dy
* 2264.76e3; // latent heat of evaporation [J/kg]
}
else if(this->micro == "blk_1m")
res = 0;
return blitz::safeToReturn(res + 0);
}

// RH
auto h5load_RH_timestep(
int at
) -> decltype(blitz::safeToReturn(arr_t() + 0))
{
if(this->micro == "lgrngn")
res = this->h5load_timestep("RH", at);
else if(this->micro == "blk_1m")
res = 0;
return blitz::safeToReturn(res + 0);
}


// functions for diagnosing statistics

// helper function that calculates staistics (mean and std_dev) of a field only in cloudy cells
Expand Down
20 changes: 20 additions & 0 deletions drawbicyc/plot_fields.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,26 @@ void plot_fields(Plotter_t plotter, Plots plots)
}
catch(...){}
}
else if (plt == "lib_pres")
{
try{
std::string title = "libcloud pressure [Pa]";
gp << "set title '" + title + " t = " << std::fixed << std::setprecision(2) << (double(at) * n["outfreq"] * n["dt"] / 60.) << "min'\n";
auto tmp = plotter.h5load_timestep("libcloud_pressure", at * n["outfreq"]);
plotter.plot(gp, tmp);
}
catch(...){}
}
else if (plt == "lib_temp")
{
try{
std::string title = "libcloud temperature [K]";
gp << "set title '" + title + " t = " << std::fixed << std::setprecision(2) << (double(at) * n["outfreq"] * n["dt"] / 60.) << "min'\n";
auto tmp = plotter.h5load_timestep("libcloud_temperature", at * n["outfreq"]);
plotter.plot(gp, tmp);
}
catch(...){}
}
else if (plt == "supersat")
{
try{
Expand Down
79 changes: 24 additions & 55 deletions drawbicyc/plot_prof.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ void plot_profiles(Plotter_t plotter, Plots plots)
std::cout << at * n["outfreq"] << std::endl;
if (plt == "rliq")
{
// liquid water content (cloud + rain, missing droplets with r<0.5um!)
//res += plotter.h5load_timestep("aerosol_rw_mom3", at * n["outfreq"]) * 4./3 * 3.1416 * 1e3 * 1e3;
res += plotter.h5load_timestep("cloud_rw_mom3", at * n["outfreq"]) * 4./3 * 3.1416 * 1e3 * 1e3;
res += plotter.h5load_timestep("rain_rw_mom3", at * n["outfreq"]) * 4./3 * 3.1416 * 1e3 * 1e3;
// liquid water content
res += plotter.h5load_ra_timestep(at * n["outfreq"]) * 1e3; // aerosol
res += plotter.h5load_rc_timestep(at * n["outfreq"]) * 1e3; // cloud
res += plotter.h5load_rr_timestep(at * n["outfreq"]) * 1e3; // rain
gp << "set title 'liquid water [g/kg]'\n";
}
if (plt == "gccn_rw")
Expand Down Expand Up @@ -332,7 +332,7 @@ void plot_profiles(Plotter_t plotter, Plots plots)
else if (plt == "sat_RH")
{
{
auto tmp = plotter.h5load_timestep("RH", at * n["outfreq"]);
auto tmp = plotter.h5load_RH_timestep(at * n["outfreq"]);
typename Plotter_t::arr_t snap(tmp);
res_tmp = (snap -1) * 100;
}
Expand Down Expand Up @@ -360,26 +360,11 @@ void plot_profiles(Plotter_t plotter, Plots plots)
}
else if (plt == "00rtot")
{
{
auto tmp = plotter.h5load_timestep("aerosol_rw_mom3", at * n["outfreq"]) * 4./3 * 3.1416 * 1e3 * 1e3;
typename Plotter_t::arr_t snap(tmp);
res_tmp = snap;
}
{
auto tmp = plotter.h5load_timestep("cloud_rw_mom3", at * n["outfreq"]) * 4./3 * 3.1416 * 1e3 * 1e3;
typename Plotter_t::arr_t snap(tmp);
res_tmp += snap;
}
{
auto tmp = plotter.h5load_timestep("rain_rw_mom3", at * n["outfreq"]) * 4./3 * 3.1416 * 1e3 * 1e3;
typename Plotter_t::arr_t snap(tmp);
res_tmp += snap;
}
{
auto tmp = plotter.h5load_timestep("rv", at * n["outfreq"]) * 1e3;
typename Plotter_t::arr_t snap(tmp);
res_tmp += snap;
}
res_tmp = plotter.h5load_ra_timestep(at * n["outfreq"]) * 1e3; // aerosol
res_tmp += plotter.h5load_rc_timestep(at * n["outfreq"]) * 1e3; // cloud
res_tmp += plotter.h5load_rr_timestep(at * n["outfreq"]) * 1e3; // rain
res_tmp += plotter.h5load_timestep("rv", at * n["outfreq"]) * 1e3; // vapour

res += res_tmp;
res_prof = plotter.horizontal_mean(res_tmp); // average in x
// find instantaneous inversion height
Expand All @@ -390,7 +375,7 @@ void plot_profiles(Plotter_t plotter, Plots plots)
{
// cloud drops concentration [1/cm^3]
{
auto tmp = plotter.h5load_timestep("cloud_rw_mom0", at * n["outfreq"]);
auto tmp = plotter.h5load_nc_timestep(at * n["outfreq"]);
typename Plotter_t::arr_t snap(tmp);
snap *= rhod; // b4 it was specific moment
snap /= 1e6; // per cm^3
Expand All @@ -404,7 +389,7 @@ void plot_profiles(Plotter_t plotter, Plots plots)
try
{
// cloud fraction (cloudy if N_c > 20/cm^3)
auto tmp = plotter.h5load_timestep("cloud_rw_mom0", at * n["outfreq"]);
auto tmp = plotter.h5load_nc_timestep(at * n["outfreq"]);
typename Plotter_t::arr_t snap(tmp);
snap *= rhod; // b4 it was specific moment
snap /= 1e6; // per cm^3
Expand All @@ -425,34 +410,23 @@ void plot_profiles(Plotter_t plotter, Plots plots)
// liquid potential temp [K]
{
auto &ql(res_tmp2);
auto &T(res_tmp);
{
auto tmp = plotter.h5load_timestep("aerosol_rw_mom3", at * n["outfreq"]) * 4./3 * 3.1416 * 1e3;
typename Plotter_t::arr_t snap(tmp);
ql = snap;
}
{
auto tmp = plotter.h5load_timestep("cloud_rw_mom3", at * n["outfreq"]) * 4./3 * 3.14 * 1e3;
typename Plotter_t::arr_t snap(tmp);
ql += snap;
}
{
auto tmp = plotter.h5load_timestep("rain_rw_mom3", at * n["outfreq"]) * 4./3 * 3.14 * 1e3;
typename Plotter_t::arr_t snap(tmp);
ql += snap;
}
ql = plotter.h5load_ra_timestep(at * n["outfreq"]); // aerosol
ql += plotter.h5load_rc_timestep(at * n["outfreq"]); // cloud
ql += plotter.h5load_rr_timestep(at * n["outfreq"]); // rain
// ql is now q_l (liq water content)
// auto tmp = plotter.h5load_timestep("th", at * n["outfreq"]);
// typename Plotter_t::arr_t th_d(tmp);
typename Plotter_t::arr_t th_d(plotter.h5load_timestep("th", at * n["outfreq"]));
typename Plotter_t::arr_t th(plotter.h5load_timestep("th", at * n["outfreq"]));
///auto tmp = plotter.h5load_timestep("rv", at * n["outfreq"]);
typename Plotter_t::arr_t rv(plotter.h5load_timestep("rv", at * n["outfreq"]));

typename Plotter_t::arr_t T(plotter.h5load_timestep("libcloud_temperature", at * n["outfreq"]));
// init pressure, from rv just to get correct size
typename Plotter_t::arr_t p(rv);
T = pow(th_d * pow(rhod * R_d / (p_1000), R_d / c_pd), c_pd / (c_pd - R_d));
// typename Plotter_t::arr_t p(rv);
// T = pow(th_d * pow(rhod * R_d / (p_1000), R_d / c_pd), c_pd / (c_pd - R_d));
// TODO: env pressure should be used below!
p = rhod * R_d * (1 + 29./18. * rv) * T; // Rv/Rd = 29/18
res += pow(p_1000 / p, R_d / c_pd) * (T - ql * L / c_p);
// p = rhod * R_d * (1 + 29./18. * rv) * T; // Rv/Rd = 29/18
res += th / T * (T - ql * L / c_p);
// res += ql;
}
gp << "set title 'liquid potential temp [K]'\n";
Expand All @@ -461,7 +435,7 @@ void plot_profiles(Plotter_t plotter, Plots plots)
{
// cloud fraction (cloudy if N_c > 20/cm^3)
{
auto tmp = plotter.h5load_timestep("cloud_rw_mom0", at * n["outfreq"]);
auto tmp = plotter.h5load_nc_timestep(at * n["outfreq"]);
typename Plotter_t::arr_t snap(tmp);
snap *= rhod; // b4 it was specific moment
snap /= 1e6; // per cm^3
Expand All @@ -474,12 +448,7 @@ void plot_profiles(Plotter_t plotter, Plots plots)
{
// precipitation flux(doesnt include vertical volicty w!)
{
auto tmp = plotter.h5load_timestep("precip_rate", at * n["outfreq"]);
typename Plotter_t::arr_t snap(tmp);
snap = snap * 4./3 * 3.14 * 1e3 // to get mass
/ plotter.CellVol // averaged over cell volume, TODO: make precip rate return specific moment? wouldnt need the dx and dy
* 2264.76e3; // latent heat of evaporation [J/kg]
res += snap;
res += plotter.h5load_prflux_timestep(at * n["outfreq"]);
}
// add vertical velocity to precipitation flux (3rd mom of cloud drops * w)
/*
Expand Down
3 changes: 2 additions & 1 deletion drawbicyc/plots.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ std::vector<std::string> fields_dycoms({
"th", "rv",
"u", "w",
"sd_conc",//, "r_dry",
"RH", "supersat"
"RH", "supersat",
"lib_pres", "lib_temp"
});

std::vector<std::string> fields_moist_thermal({
Expand Down
Loading