Skip to content

Commit

Permalink
Merge pull request #275 from trontrytel/new_names
Browse files Browse the repository at this point in the history
New names
  • Loading branch information
pdziekan authored Feb 27, 2017
2 parents 659d000 + 838be9c commit 7a0e55c
Show file tree
Hide file tree
Showing 64 changed files with 123 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .travis_scripts/icicle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cd ../../..

## icicle
if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install libboost-program-options-dev; fi
cd libcloudphxx/tests/paper_GMD_2015
cd libcloudphxx/tests/2D_cloud
mkdir -p build
cd build
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then cmake .. -DBOOST_ROOT=/usr/local; fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ if (NOT libcloudphxx_LIBRARIES)
endif()

add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(paper_GMD_2015)
add_subdirectory(thesis_2017)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_subdirectory(fig_a)
add_subdirectory(fig_b)
add_subdirectory(fig_c)
add_subdirectory(chem_sandbox)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int main(int ac, char** av)
if (ac != 2) error_macro("expecting 1 argument: CMAKE_BINARY_DIR")

std::string
dir = string(av[1]) + "/tests/fig_a/",
dir = string(av[1]) + "/paper_GMD_2015/fig_a/",
h5 = dir + "out_blk_1m";

auto n = h5n(h5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int main(int ac, char** av)
if (ac != 2) error_macro("expecting 1 argument: CMAKE_BINARY_DIR")

std::string
dir = string(av[1]) + "/tests/fig_a/",
dir = string(av[1]) + "/paper_GMD_2015/fig_a/",
h5 = dir + "out_blk_2m";

auto n = h5n(h5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int main(int ac, char** av)
if (ac != 2) error_macro("expecting 1 argument: CMAKE_BINARY_DIR")

std::string
dir = string(av[1]) + "/tests/fig_a/",
dir = string(av[1]) + "/paper_GMD_2015/fig_a/",
h5 = dir + "out_lgrngn";

auto n = h5n(h5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int main(int ac, char** av)
if (ac != 2) error_macro("expecting 1 argument: CMAKE_BINARY_DIR")

std::string
dir = string(av[1]) + "/tests/fig_a/",
dir = string(av[1]) + "/paper_GMD_2015/fig_a/",
h5 = dir + "out_lgrngn",
svg = dir + "out_lgrngn_spec.svg";

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
int main(int ac, char** av)
{
//read w_max, X and Z
std::string filename = string(av[1]) + "/tests/fig_a/out_lgrngn/const.h5";
std::string filename = string(av[1]) + "/paper_GMD_2015/fig_a/out_lgrngn/const.h5";
H5::H5File h5f(filename, H5F_ACC_RDONLY);
auto h5_group = h5f.openGroup("/");
auto h5_data = h5f.openDataSet("G");
Expand All @@ -25,7 +25,7 @@ int main(int ac, char** av)
std::map<std::string, int> n({{"x", 15},{"z", 15}});

Gnuplot gp;
init(gp, "./plot.svg", 1, 1, n);
init(gp, string(av[1]) + "/paper_GMD_2015/fig_c/plot.svg", 1, 1, n);

float dx = X / (n["x"]-1), dz = Z / (n["z"]-1);

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions tests/2D_cloud/thesis_2017/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_subdirectory(thesis_chap_6)
40 changes: 40 additions & 0 deletions tests/2D_cloud/thesis_2017/common.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#pragma once

#include <iostream>
#include <iomanip>
#include <set>
#include <string>
#include <sstream>
#include <vector>

using std::set;
using std::string;
using std::ostringstream;
using std::cerr;
using std::endl;
using std::exception;
using std::vector;

#include <boost/units/systems/si.hpp>
namespace si = boost::units::si;
using boost::units::quantity;


// error reporting
#define error_macro(msg) \
{ \
cerr << "error: " << msg << endl; \
throw exception(); \
}

#define notice_macro(msg) \
{ \
cerr << " info: " << msg << endl; \
}

string zeropad(int n, int w=3)
{
std::ostringstream tmp;
tmp << std::setw(w) << std::setfill('0') << n;
return tmp.str();
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
add_executable(calc_chem calc_chem.cpp)
add_test(calc_chem calc_chem ${CMAKE_BINARY_DIR})
#add_test(calc_chem calc_chem ${CMAKE_BINARY_DIR})

find_package(HDF5 COMPONENTS CXX REQUIRED QUIET)
find_package(Boost COMPONENTS iostreams system filesystem REQUIRED)

foreach(case lgrngn_ch lgrngn_ch_spec lgrngn_ch_chem lgrngn_ch_spec_chem)
foreach(case lgrngn_ch lgrngn_ch_chem)
add_executable(plot_${case} plot_${case}.cpp)
add_test(plot_${case} plot_${case} ${CMAKE_BINARY_DIR})
#add_test(plot_${case} plot_${case} ${CMAKE_BINARY_DIR})
target_link_libraries(plot_${case} ${HDF5_LIBRARIES})
target_include_directories(plot_${case} PUBLIC ${HDF5_INCLUDE_DIRS})
target_link_libraries(plot_${case} ${Boost_LIBRARIES})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from libcloudphxx import common as cm

# path to build directory with data
dir_path = '../../../build/tests/chem_sandbox/'
dir_path = '../../../build/thesis_2017/thesis_chap_6/'

for case in ['case_base', 'case3', 'case4', 'case5', 'case6']:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

for case in ('case_base', 'case1a', 'case3', 'case4', 'case5', 'case6'):
# path to build directory with data and plots
dir_path = '../../../build/tests/chem_sandbox/'
dir_path = '../../../build/thesis_2017/thesis_chap_6/'

# read in the data
data = h5.File(dir_path + 'out_' + case + '/timestep0000011800.h5', 'r')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os

# path to build directory with data
dir_path = '../../../build/tests/chem_sandbox/'
dir_path = '../../../build/thesis_2017/thesis_chap_6/'

# all the collision kernels
kernels = { "hall_pinsky_stratocumulus",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
num_wet = wet_edges.size - 1

# path to directory with data
dir_path = '../../../build/tests/chem_sandbox/'
dir_path = '../../../build/thesis_2017/thesis_chap_6/'

# loop for case with and without aqueous chemistry
for case in ['case1', 'case_base', 'case3', 'case4', 'case5', 'case6']:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from libcloudphxx import common as cm

# path to directory with data
dir_path = '../../../build/tests/chem_sandbox/'
dir_path = '../../../build/thesis_2017/thesis_chap_6/'

for case in ['case_base', 'case3', 'case4', 'case5', 'case6']:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ int main(int ac, char** av)
{
if (ac != 2) error_macro("expecting 1 argument: CMAKE_BINARY_DIR")

std::string dir = string(av[1]) + "/tests/chem_sandbox/";
std::string dir = string(av[1]) + "/thesis_2017/thesis_chap_6/";

for (const std::string sim_run :
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ int main(int ac, char** av)
{
if (ac != 2) error_macro("expecting 1 argument: CMAKE_BINARY_DIR")

std::string dir = string(av[1]) + "/tests/chem_sandbox/";
std::string dir = string(av[1]) + "/thesis_2017/thesis_chap_6/";

for (const std::string sim_run :
{
Expand Down
62 changes: 62 additions & 0 deletions tests/2D_cloud/thesis_2017/thesis_chap_6/thesis_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

# Runs all the simulations and plots the results from chapter 6 of PhD thesis of Jaruga.
# The simulations take up to 12 hours (on cuda-k-2 server using CUDA and one thread)
# It might be useful to run them in the background: nohup ./thesis_script.sh &

cd ../../build/thesis_2017/thesis_chap_6

export OMP_NUM_THREADS=1

# run all the thesis test cases
./calc_chem ../../

plot the quicklook plots
./plot_lgrngn_ch ../../
./plot_lgrngn_ch_chem ../../

# plot the python scripts for pH and size distributions
python ../../../thesis_2017/thesis_chap_6/chem_plots/ph_plot.py
python ../../../thesis_2017/thesis_chap_6/chem_plots/rain_histograms_single.py
python ../../../thesis_2017/thesis_chap_6/chem_plots/rain_histograms_all.py

# check how much H2SO4 mass was created and what is the error
python ../../../thesis_2017/thesis_chap_6/chem_plots/how_effective.py
python ../../../thesis_2017/thesis_chap_6/chem_plots/test_mole_const.py

# thesis_plots folder will contain all plots included in thesis
mkdir -p thesis_plots

copy quicklook plots from case1 and case4
for sim_run in case1 case4; do
for el in nc na ef rd rr sd_conc; do
dir_name=out_${sim_run}.plot/${el}/;
mkdir -p thesis_plots/${dir_name};
for sim_time in 10000 11800; do
cp ${dir_name}/${sim_time}.svg thesis_plots/${dir_name}/${sim_time}.svg;
done
done
done

# copy quicklook plots from the base case
for el in nc na ef rd rr sd_conc SO2g O3g H2O2g S_VI_aq H2O2_aq O3_aq; do
dir_name=out_case_base.plot/${el}/;
mkdir -p thesis_plots/${dir_name};
for sim_time in 10000 11800; do
cp ${dir_name}/${sim_time}.svg thesis_plots/${dir_name}/${sim_time}.svg;
done
done

# copy quicklook plots from case2
for kernel in hall hall_davis_no_waals hall_pinsky_stratocumulus onishi_hall onishi_hall_davis_no_waals vohl_davis_no_waals; do
dir_name=out_case2_${kernel}_42.plot/rr/;
mkdir -p thesis_plots/${dir_name};
cp ${dir_name}/11800.svg thesis_plots/${dir_name}/11800.svg;
done

# copy pH and size distribution plots
cp -r plots_of_pH/ thesis_plots/.
cp -r plots_of_size_distr/ thesis_plots/.

# pack all plots included in thesis
tar -cvf thesis_plots.tar thesis_plots

0 comments on commit 7a0e55c

Please sign in to comment.