diff --git a/drawbicyc/drawbicyc.cpp b/drawbicyc/drawbicyc.cpp index 835703a49d..f731110a36 100644 --- a/drawbicyc/drawbicyc.cpp +++ b/drawbicyc/drawbicyc.cpp @@ -1,6 +1,7 @@ #include"plot_series.hpp" #include"plot_prof.hpp" #include"plot_fields.hpp" +#include"plot_qv_qc_2_6_10_min.hpp" int main(int argc, char** argv) { @@ -13,6 +14,7 @@ int main(int argc, char** argv) ("profs", po::value()->default_value(true), "plot profiles?") ("series", po::value()->default_value(true) , "plot series?") ("fields", po::value()->default_value(false) , "plot fields?") + ("qv_qc_2_6_10_min", po::value()->default_value(false) , "plot comparison of qv and qc fields at 2, 6 and 10 min?") ("dir", po::value()->required() , "directory containing out_lgrngn") ("micro", po::value()->required(), "one of: blk_1m, blk_2m, lgrngn") ("type", po::value()->required(), "one of: dycoms, moist_thermal") @@ -40,7 +42,8 @@ int main(int argc, char** argv) // reading required plot types bool flag_series = vm["series"].as(), flag_profiles = vm["profs"].as(), - flag_fields = vm["fields"].as(); + flag_fields = vm["fields"].as(), + flag_qv_qc_2_6_10_min = vm["qv_qc_2_6_10_min"].as(); // detecting input data dimensionality H5::H5File h5f(h5 + "/const.h5", H5F_ACC_RDONLY); @@ -53,12 +56,14 @@ int main(int argc, char** argv) 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)); + if(flag_qv_qc_2_6_10_min) plot_qv_qc_2_6_10_min(PlotterMicro_t<2>(h5, micro), Plots(type)); } else if(NDims == 3) { if(flag_series) plot_series(PlotterMicro_t<3>(h5, micro), Plots(type)); if(flag_profiles) plot_profiles(PlotterMicro_t<3>(h5, micro), Plots(type)); 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)); } else assert(false && "need 2d or 3d input data"); diff --git a/drawbicyc/plot_fields.hpp b/drawbicyc/plot_fields.hpp index 5769084711..621b56feb4 100644 --- a/drawbicyc/plot_fields.hpp +++ b/drawbicyc/plot_fields.hpp @@ -150,7 +150,7 @@ void plot_fields(Plotter_t plotter, Plots plots) try{ std::string title = "water vapour mixing ratio [g/kg]"; gp << "set title '" + title + " t = " << std::fixed << std::setprecision(2) << (double(at) * n["outfreq"] * n["dt"] / 60.) << "min'\n"; - auto tmp = plotter.h5load_timestep(plotter.file, "rv", at * n["outfreq"]); + auto tmp = plotter.h5load_timestep(plotter.file, "rv", at * n["outfreq"]) * 1e3; plotter.plot(gp, tmp); } catch(...){} diff --git a/drawbicyc/plot_qv_qc_2_6_10_min.hpp b/drawbicyc/plot_qv_qc_2_6_10_min.hpp new file mode 100644 index 0000000000..ba39ef4b0d --- /dev/null +++ b/drawbicyc/plot_qv_qc_2_6_10_min.hpp @@ -0,0 +1,142 @@ +#include +#include + +#include "common.hpp" +#include "PlotterMicro.hpp" +#include +#include "plots.hpp" + +template +void plot_qv_qc_2_6_10_min(Plotter_t plotter, Plots plots) +{ + using std::string; + auto& n = plotter.map; + + blitz::firstIndex i; + blitz::secondIndex j; + blitz::Range all = blitz::Range::all(); + + Gnuplot gp; + init(gp, "plots/out_lgrngn_qv_qc_2_6_10_min.tex", 2, 3, n); + gp << "unset multiplot\n"; + gp << "set pm3d map\n"; + gp << "set terminal epslatex color size 5, 2.8\n"; + gp << "set multiplot layout 2,3\n"; + + std::set times = {120, 360, 600}; + + string XTICS = "set xtics scale .5 rotate by 60 ('' 0.0, '0.6' 30, '1.2' 60, '1.8' 90, '2.4' 120, '3.0' 150, '' 180); set xlabel 'x [km]'\n"; + string NOXTICS = "set xtics scale .5 ('' 0.0, '' 30, '' 60, '' 90, '' 120, '' 150, '' 180); unset xlabel\n"; + string YTICS = "set xtics scale .5 rotate by 60 ('' 0.0, '0.6' 30, '1.2' 60, '1.8' 90, '2.4' 120); set ylabel 'y [km]'\n"; + string NOYTICS = "set xtics scale .5 rotate by 60 ('' 0.0, '' 30, '' 60, '' 90, '' 120); unset ylabel\n"; + // Margins for each row resp. column + string TMARGIN = "set tmargin at screen .9; set bmargin at screen 0.5\n"; + string BMARGIN = "set tmargin at screen 0.5; set bmargin at screen 0.1\n"; + + string LMARGIN = "set lmargin at screen 0.1; set rmargin at screen 0.36\n"; + string LRMARGIN = "set lmargin at screen 0.36; set rmargin at screen 0.62\n"; + string RMARGIN = "set lmargin at screen 0.62; set rmargin at screen 0.88\n"; + //color palette + string PALETTE = "set colorbox\n"; + string NOPALETTE = "unset colorbox\n"; + //titles + string TITLEQV = "set title offset 0,-0.8 '$q_v$ [g/kg]'\n"; + string TITLEQC = "set title offset 0,-0.8 '$q_c$ [g/kg]'\n"; + string NOTITLE = "unset title\n"; + + + gp << "set cbrange [0:8]\n"; + gp << "set cbtics (0, 2, 4, 6, 8)\n"; + + // --- GRAPH a + gp << TMARGIN; + gp << LMARGIN; + gp << NOXTICS; + gp << YTICS; + gp << NOPALETTE; + gp << "set title offset 0, -0.8 '$q_v$ [g/kg], t = 2 min'\n"; + try{ + typename Plotter_t::arr_t tmp(plotter.h5load_timestep(plotter.file, "rv", 120) * 1e3); + std::cout << tmp; + plotter.plot(gp, tmp); + } + catch(...){} + + // --- GRAPH b + gp << TMARGIN; + gp << LRMARGIN; + gp << NOXTICS; + gp << NOYTICS; + gp << NOPALETTE; + gp << "set title offset 0, -0.8 '$q_v$ [g/kg], t = 6 min'\n"; + try{ + typename Plotter_t::arr_t tmp(plotter.h5load_timestep(plotter.file, "rv", 320) * 1e3); + std::cout << tmp; + plotter.plot(gp, tmp); + } + catch(...){} + + // --- GRAPH c + gp << TMARGIN; + gp << RMARGIN; + gp << NOXTICS; + gp << NOYTICS; + gp << PALETTE; + gp << "set title offset 0, -0.8 '$q_v$ [g/kg], t = 10 min'\n"; + try{ + typename Plotter_t::arr_t tmp(plotter.h5load_timestep(plotter.file, "rv", 600) * 1e3); + std::cout << tmp; + plotter.plot(gp, tmp); + } + catch(...){} + + + gp << "set cbrange [0:2]\n"; + gp << "set cbtics (0, 0.5, 1, 1.5, 2)\n"; + + // --- GRAPH d + gp << BMARGIN; + gp << LMARGIN; + gp << XTICS; + gp << YTICS; + gp << NOPALETTE; + gp << "set title offset 0, -0.8 '$q_c$ [g/kg], t = 2 min'\n"; + try{ + // cloud water content + typename Plotter_t::arr_t tmp(plotter.h5load_ract_timestep(plotter.file, 60) * 1e3); + std::cout << tmp; + plotter.plot(gp, tmp); + } + catch(...){} + + // --- GRAPH e + gp << BMARGIN; + gp << LRMARGIN; + gp << XTICS; + gp << NOYTICS; + gp << NOPALETTE; + gp << "set title offset 0, -0.8 '$q_c$ [g/kg], t = 6 min'\n"; + try{ + // cloud water content + typename Plotter_t::arr_t tmp(plotter.h5load_ract_timestep(plotter.file, 360) * 1e3); + std::cout << tmp; + plotter.plot(gp, tmp); + } + catch(...){} + + // --- GRAPH f + gp << BMARGIN; + gp << RMARGIN; + gp << XTICS; + gp << NOYTICS; + gp << PALETTE; + gp << "set title offset 0, -0.8 '$q_c$ [g/kg], t = 10 min'\n"; + try{ + // cloud water content + typename Plotter_t::arr_t tmp (plotter.h5load_ract_timestep(plotter.file, 600) * 1e3); + std::cout << tmp; + plotter.plot(gp, tmp); + } + catch(...){} + +} diff --git a/drawbicyc/plot_series.hpp b/drawbicyc/plot_series.hpp index 23d0f7999a..4c820f23ed 100644 --- a/drawbicyc/plot_series.hpp +++ b/drawbicyc/plot_series.hpp @@ -915,14 +915,15 @@ void plot_series(Plotter_t plotter, Plots plots) std::cout << plt << " " << res_pos << res_prof << res_prof_std_dev << std::endl; gp.send1d(boost::make_tuple(res_pos, res_prof)); + oprof_file << res_prof ; if(plot_std_dev) { + oprof_file << res_prof_std_dev ; res_prof = res_prof + res_prof_std_dev; gp.send1d(boost::make_tuple(res_pos, res_prof)); res_prof = res_prof - 2*res_prof_std_dev; gp.send1d(boost::make_tuple(res_pos, res_prof)); } - oprof_file << res_prof ; // plot(gp, res); } // var loop }