igfuw / UWLCM

University of Warsaw Lagrangian Cloud Model
GNU General Public License v3.0
6 stars 13 forks source link

change hygroscopicity kappa #76

Closed claresinger closed 4 years ago

claresinger commented 5 years ago

What is the proper syntax for specifying kappa for an initial aerosol distribution? Say I want to initialize the simulation with two lognormal populations of aerosol: mean_rd1 = 0.01e-6, sdev_rd1 = 1.0, n1_stp=100e6, kappa1 = 0.6 mean_rd2 = 0.1e-6, sdev_rd2 = 1.5, n2_stp=10e6, kappa2 = 1.2

I have tried using the keyword --kappa=X when I call bicycles. It is difficult to tell if this has an effect because the hygroscopicity kappa is not output in the const.h5 file. What should change such that kappa is recorded in the output? And how can I specify different kappa for the different aerosol populations?

Thanks!

pdziekan commented 5 years ago

The initial aerosol distribution depends on the case modeled and cannot be changed from the command line. To have your desired distribution, you need to hardcode it in the opts_lgrngn.hpp file and recompile the code.

I have created a branch in which the aerosol distribution is as you specified it, independent of the case modeled (https://github.com/pdziekan/UWLCM/tree/issue_76). The syntax is a bit ugly, because log_dry_radii function assumes a bimodal distribution, while we need only one mode for each kappa, so we set n2_stp = 0.

In order to record kappa, you will also need to make some changes in the code. Model output is defined in the diag() function in slvr_lgrngn.hpp. A general pattern for defining output is the following:

  1. Select super droplets over which we want to calculate some statistic, e.g. diag_all() to select all super droplets or diag_kappa_rng(min, max) to select super droplets with kappa between min and max.

  2. Define what statistic to calculate, e.g. diag_wet_mom(1) to calculate the first moment of wet radius of the selected super droplets or diag_kappa_mom(1) to calculate the first moment of kappa of the selected super droplets.

  3. Define the name of the HDF5 dataset in which the output is stored, e.g. this->record_aux("rain_rw_mom0", prtcls->outbuf()) to name the dataset "rain_rw_mom0".

In you case, to see if the initial distribution is correct, I would output 0th, 1st and 2nd moments of the dry radius of super droplets with given kappa, something like:

diag_kappa_rng(0.5,0.7) diag_dry_mom(0) record_aux("kpa_rng_0.5_0.7_rd_mom0", prtcls->outbuf()) diag_dry_mom(1) record_aux("kpa_rng_0.5_0.7_rd_mom1", prtcls->outbuf()) diag_dry_mom(2) record_aux("kpa_rng_0.5_0.7_rd_mom2", prtcls->outbuf())

Next, using these moments, you can calculate mean_rd, sdev and n_stp of particles with given kappa and check if they agree with what you specified.

trontrytel commented 5 years ago

Thanks again @pdziekan ! Would it be possible to have a user specified number of modes in the initial size distribution (instead of the assumed two modes)? This way we could avoid recompiling the code (which takes long). Instead, we would specify an initial size distribution with, lets say 10 different kappas. Then at run time we could just zero out different n_stp concentrations.

If you think its feasible with the current code base I can try to add that.

pdziekan commented 5 years ago

It would be possible, but I don't think it's the best way to deal with this. Specifying kappa, mean radius, std dev and n_stp for each of the 10 modes from command line would be ugly. Also, what if someone wanted to use a different distribution than lognormal?

You can drastically decrease compilation time by disabling compilation of options that you do not use: ' cmake -DUWLCM_DISABLE=...'