Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 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
ce8a451
command line option for spectra time step
pdziekan May 8, 2018
f662176
Merge remote-tracking branch 'origin/plots_with_dycoms_comparison' in…
pdziekan May 8, 2018
b60f3f8
prettier plot_lgrngn_spec plots
pdziekan May 9, 2018
f7dee78
Merge remote-tracking branch 'origin/plots_with_dycoms_comparison' in…
pdziekan May 9, 2018
8beed4e
cloud frac calc in series as in dycoms paper
pdziekan May 9, 2018
194c229
bring back the ratio of fields plots
pdziekan May 10, 2018
3cccd12
fix radiation sign
pdziekan May 10, 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
456ba05
add profile plot of nc in cloudy cells
pdziekan May 11, 2018
e000b2c
add aerosol water to total water profile
pdziekan May 11, 2018
b2e4634
remove smoothing of buoyancy force
pdziekan May 15, 2018
21cfa44
extrapolate values upward when calculating forward gradient of fluxes
pdziekan May 15, 2018
4b42741
analytical divergence of surface fluxes instead of numerical
pdziekan May 15, 2018
7f4c1ec
profile plotting: also plot on the loewst level
pdziekan May 15, 2018
f67f532
dont smooth subsidence
pdziekan May 16, 2018
151d443
cnt_grad = 0 in the uppermost layer - no subsidence there
pdziekan May 16, 2018
ed25cbb
default hgt_factor = 25
pdziekan May 16, 2018
f55daf1
pplot prof: theta_l fixes
pdziekan May 16, 2018
8fe63d8
Merge branch 'lasher_trapp' into lasher_trapp_plus_pres_env_in_cond
pdziekan May 16, 2018
f6eab11
plot prof: fix press calc in thetal profile
pdziekan May 16, 2018
40faf54
Revert "dont smooth subsidence"
pdziekan May 17, 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
a018e7f
Merge branch 'delayed_advection' of https://github.com/pdziekan/UWLCM…
mwarusz Jul 23, 2018
37d3dd1
add halo to 1d profiles so they have the same base index as 2d/3d fields
mwarusz Aug 3, 2018
815089d
do not reindex fields in force calculations
mwarusz Aug 3, 2018
43981bb
adjust to reindex changes in the lagrangian solver
mwarusz Aug 3, 2018
2df3780
Merge remote-tracking branch 'upstream/master' into no_reindex
mwarusz Aug 3, 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
5 changes: 3 additions & 2 deletions drawbicyc/drawbicyc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ int main(int argc, char** argv)

if(NDims == 2)
{

if(flag_series) plot_series(PlotterMicro_t<2>(h5, micro), Plots(type));
if(flag_profiles) plot_profiles(PlotterMicro_t<2>(h5, micro), Plots(type));
if(flag_fields) plot_fields(PlotterMicro_t<2>(h5, micro), Plots(type));
Expand All @@ -68,8 +69,8 @@ int main(int argc, char** argv)
if(flag_fields) plot_fields(PlotterMicro_t<3>(h5, micro), Plots(type));
if(flag_qv_qc_2_6_10_min) plot_qv_qc_2_6_10_min(PlotterMicro_t<2>(h5, micro), Plots(type));
if(flag_lgrngn_spec) {
plot_lgrngn_spec_positions(PlotterMicro_t<3>(h5, "lgrngn"), Plots(type), 12);
plot_lgrngn_spec(PlotterMicro_t<3>(h5, "lgrngn"), Plots(type), 12);
plot_lgrngn_spec_positions(PlotterMicro_t<3>(h5, "lgrngn"), Plots(type));
plot_lgrngn_spec(PlotterMicro_t<3>(h5, "lgrngn"), Plots(type));
}
}
else
Expand Down
22 changes: 21 additions & 1 deletion drawbicyc/plot_fields.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void plot_fields(Plotter_t plotter, Plots plots)
{
std::cout << at * n["outfreq"] << " : " << plt << std::endl;
Gnuplot gp;
init(gp, plotter.file + ".plot/" + plt + "/" + zeropad(at * n["outfreq"]) + ".svg", 1, 1, n);
init(gp, plotter.file + ".plot/" + plt + "/" + zeropad(at * n["outfreq"]) + ".svg", 1, 1, n, 1, 0.666666);

if (plt == "rl")
{
Expand Down 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
65 changes: 43 additions & 22 deletions drawbicyc/plot_lgrngn_spec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,33 @@
#include "bins.hpp"
#include <map>

namespace
{
po::variables_map vm;
};

//plot spectra positions
template<class Plotter_t>
void plot_lgrngn_spec_positions(Plotter_t plotter, Plots plots, int at)
void plot_lgrngn_spec_positions(Plotter_t plotter, Plots plots)
{
// read opts
po::options_description opts("spectra plotting options");
opts.add_options()
("spectra_step", po::value<int>()->required() , "time step number at which spectra are plotted")
;
handle_opts(opts, vm);
const int spectra_step = vm["spectra_step"].as<int>();

auto& n = plotter.map;
Gnuplot gp;

try{
// cloud water content
auto tmp = plotter.h5load_ract_timestep(at * n["outfreq"]) * 1e3;
auto tmp = plotter.h5load_ract_timestep(spectra_step * n["outfreq"]) * 1e3;

std::string title = "cloud water mixing ratio [g/kg]";
gp << "set title '" + title + " t = " << std::fixed << std::setprecision(2) << (double(at) * n["outfreq"] * n["dt"] / 60.) << "min'\n";
init(gp, plotter.file + "_spectra_positions_at" + zeropad(at) + ".svg", 1, 1, n, 2.);
gp << "set title '" + title + " t = " << std::fixed << std::setprecision(2) << (double(spectra_step) * n["outfreq"] * n["dt"] / 60.) << "min'\n";
init(gp, plotter.file + "_spectra_positions_at" + zeropad(spectra_step) + ".svg", 1, 1, n, 2.);

{
for (auto &fcs : focus_3d)
Expand Down Expand Up @@ -60,8 +72,10 @@ void plot_lgrngn_spec_positions(Plotter_t plotter, Plots plots, int at)

//plot spectra
template<class Plotter_t>
void plot_lgrngn_spec(Plotter_t plotter, Plots plots, int at)
void plot_lgrngn_spec(Plotter_t plotter, Plots plots)
{
const int spectra_step = vm["spectra_step"].as<int>();

const double r_c_adiab = 7.8; // adiabatic water content [g/kg] coming from Wojtek
auto& n = plotter.map;
for(auto elem : n)
Expand All @@ -71,38 +85,45 @@ void plot_lgrngn_spec(Plotter_t plotter, Plots plots, int at)
Gnuplot gp;
// int off = 2; // TODO!!!
int off = 0; // TODO!!!
string file = plotter.file + "_spectra_at" + zeropad(at) + ".svg";
string file = plotter.file + "_spectra_at" + zeropad(spectra_step) + ".svg";

int hor = min<int>(focus_3d.size(), 2);
int ver = double(focus_3d.size()) / 2. + 0.99999;
int hor = min<int>(focus_3d.size(), 5);
int ver = double(focus_3d.size()) / 5. + 0.99999;

init_prof(gp, file, ver, hor);


gp << "set xrange [0:30]\n";
gp << "set yrange [0:50]\n";
gp << "set xlabel 'r [μm]'\n";
gp << "set ylabel 'n [cm^{-3} μm^{-1}]'\n";

// read in density
auto tmp = plotter.h5load(plotter.file + "/const.h5", "G");
typename Plotter_t::arr_t rhod(tmp);

// focus to the gridbox from where the size distribution is plotted
char lbl = 'a';
bool setylabel = 1;
for (auto &fcs : focus_3d)
{
if(setylabel)
{
gp << "set ylabel 'n [cm^{-3} μm^{-1}]'\n";
setylabel = 0;
}
else
gp << "unset ylabel\n";
const int &x = fcs[0], &y = fcs[1], &z = fcs[2];
const blitz::RectDomain<3> focusBox({x-box_size, y-box_size, z-box_size}, {x+box_size, y+box_size, z+box_size});

gp << "set label 1 '(" << lbl << ")' at graph .1, .93 font ',20'\n";
gp << "set label 1 '(" << lbl << ")' at graph .1, .93 font \",15\"\n";
lbl += 1;

// calc ratio of water content to adiabatic water content
{
auto tmp = plotter.h5load_ract_timestep(at * n["outfreq"]) * 1e3;
auto tmp = plotter.h5load_ract_timestep(spectra_step * n["outfreq"]) * 1e3;
double ratio = mean(tmp(focusBox)) / r_c_adiab;
gp << "set label 4 'r_c / r_c^{adiab} = " << std::setprecision(2) << ratio << "' at graph .2, .93 font ',20'\n";
gp << "set label 4 'AF = " << std::fixed << std::setprecision(2) << ratio << "' at graph .2, .63 font \",15\"\n";
}

// calc mean and std dev of radius of acivated droplets in the box
Expand All @@ -111,15 +132,15 @@ void plot_lgrngn_spec(Plotter_t plotter, Plots plots, int at)
double act_rw_std_dev = 0.;
try
{
auto tmp = plotter.h5load_timestep("actrw_rw_mom0", at * n["outfreq"]);
auto tmp = plotter.h5load_timestep("actrw_rw_mom0", spectra_step * n["outfreq"]);
typename Plotter_t::arr_t snap(tmp);
act_conc = mean(snap(focusBox));
}
catch(...) {;}
// mean droplet radius in the box
try
{
auto tmp = plotter.h5load_timestep("actrw_rw_mom1", at * n["outfreq"]);
auto tmp = plotter.h5load_timestep("actrw_rw_mom1", spectra_step * n["outfreq"]);
typename Plotter_t::arr_t snap(tmp); // 1st raw moment / mass [m / kg]
if(act_conc > 0)
act_rw_mean = mean(snap(focusBox)) / act_conc;
Expand All @@ -130,13 +151,13 @@ void plot_lgrngn_spec(Plotter_t plotter, Plots plots, int at)
// std deviation of distribution of radius in the box
try
{
auto tmp = plotter.h5load_timestep("actrw_rw_mom0", at * n["outfreq"]);
auto tmp = plotter.h5load_timestep("actrw_rw_mom0", spectra_step * n["outfreq"]);
typename Plotter_t::arr_t zeroth_raw_mom(tmp); // 0th raw moment / mass [1 / kg]
tmp = plotter.h5load_timestep("actrw_rw_mom1", at * n["outfreq"]);
tmp = plotter.h5load_timestep("actrw_rw_mom1", spectra_step * n["outfreq"]);
typename Plotter_t::arr_t first_raw_mom(tmp); // 1st raw moment / mass [m / kg]
tmp = plotter.h5load_timestep("actrw_rw_mom2", at * n["outfreq"]);
tmp = plotter.h5load_timestep("actrw_rw_mom2", spectra_step * n["outfreq"]);
typename Plotter_t::arr_t second_raw_mom(tmp); // 2nd raw moment / mass [m^2 / kg]
tmp = plotter.h5load_timestep("sd_conc", at * n["outfreq"]);
tmp = plotter.h5load_timestep("sd_conc", spectra_step * n["outfreq"]);
typename Plotter_t::arr_t sd_conc(tmp); // number of SDs
if(act_conc > 0)
{
Expand Down Expand Up @@ -165,8 +186,8 @@ void plot_lgrngn_spec(Plotter_t plotter, Plots plots, int at)
catch(...) {;}


gp << "set label 2 '<r>_{act} = " << std::setprecision(2) << act_rw_mean * 1e6 <<"µm' at graph .1, .83 font '15'\n";
gp << "set label 3 'σ(r)_{act} = " << std::setprecision(2) << act_rw_std_dev * 1e6 <<"µm' at graph .1, .73 font ',15'\n";
gp << "set label 2 '<r> = " << std::fixed << std::setprecision(2) << act_rw_mean * 1e6 <<" µm' at graph .2, .83 font \",15\"\n";
gp << "set label 3 'σ = " << std::fixed << std::setprecision(2) << act_rw_std_dev * 1e6 <<" µm' at graph .2, .73 font \",15\"\n";


std::map<float, float> focus_w;
Expand All @@ -178,7 +199,7 @@ void plot_lgrngn_spec(Plotter_t plotter, Plots plots, int at)
for (int i = 0; i < nsw; ++i)
{
const string name = "rw_rng" + zeropad(i + off) + "_mom0";
auto tmp_w = plotter.h5load_timestep(name, at * n["outfreq"]);
auto tmp_w = plotter.h5load_timestep(name, spectra_step * n["outfreq"]);

focus_w[(left_edges_rw[i] + left_edges_rw[i+1]) / 2. / 1e-6 / si::metres] =
sum((tmp_w*rhod)(focusBox))
Expand All @@ -187,7 +208,7 @@ void plot_lgrngn_spec(Plotter_t plotter, Plots plots, int at)
/ ((left_edges_rw[i+1] - left_edges_rw[i]) / 1e-6 / si::metres); // per micrometre
}
const string name = "rw_rng" + zeropad(nsw + off) + "_mom0";
auto tmp_w = plotter.h5load_timestep(name, at * n["outfreq"]);
auto tmp_w = plotter.h5load_timestep(name, spectra_step * n["outfreq"]);

notice_macro("setting-up plot parameters");
std::cout << "larger drops conc: " << (tmp_w * rhod)(x,y,z) * 1e-6 << endl;
Expand Down
Loading