htmie

Optical properties of water droplets
git clone git://git.meso-star.fr/htmie.git
Log | Files | Refs | README | LICENSE

commit 36cc7c39d53850eb3af5d3c3b430e3a29d4ec75e
parent 53b53e4a8c3bda3cbaef95a1dc74927682cf6374
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu,  5 Jul 2018 14:21:15 +0200

Change the unit of the cross sections

Diffstat:
Msrc/htmie.c | 8++------
Msrc/htmie.h | 5+++++
Msrc/test_htmie_load.c | 8++------
3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/htmie.c b/src/htmie.c @@ -36,8 +36,8 @@ struct htmie { struct darray_double wavelengths; /* In nano-meters */ - struct darray_double xsections_absorption; /* In m^2.particle^-1 */ - struct darray_double xsections_scattering; /* In m^2.particle^-1 */ + struct darray_double xsections_absorption; /* In m^2.kg^-1 */ + struct darray_double xsections_scattering; /* In m^2.kg^-1 */ struct darray_double g; /* Asymetric parameter */ double rmod; /* Modal mean radius of droplet in micro-meters */ @@ -610,10 +610,6 @@ htmie_load(struct htmie* htmie, const char* path) CALL(load_distrib_x_lambda_array (htmie, nc, "mscs", range, &htmie->xsections_scattering)); CALL(load_distrib_x_lambda_array(htmie, nc, "g", range, &htmie->g)); - - /* The rmod and smod parameter must be loaded */ - CALL(massic_to_per_particle_xsections(htmie, &htmie->xsections_absorption)); - CALL(massic_to_per_particle_xsections(htmie, &htmie->xsections_scattering)); #undef CALL exit: diff --git a/src/htmie.h b/src/htmie.h @@ -74,14 +74,17 @@ htmie_load (struct htmie *htmie, const char* path); +/* In nano-meter */ HTMIE_API const double* htmie_get_wavelengths (const struct htmie* htmie); +/* In m^2.kg^-1 */ HTMIE_API const double* htmie_get_xsections_absorption (const struct htmie* htmie); +/* In m^2.kg^-1 */ HTMIE_API const double* htmie_get_xsections_scattering (const struct htmie* htmie); @@ -94,12 +97,14 @@ HTMIE_API size_t htmie_get_wavelengths_count (const struct htmie* htmie); +/* In m^2.kg^-1 */ HTMIE_API double htmie_fetch_xsection_absorption (const struct htmie* htmie, const double wavelength, const enum htmie_filter_type type); +/* In m^2.kg^-1 */ HTMIE_API double htmie_fetch_xsection_scattering (const struct htmie* htmie, diff --git a/src/test_htmie_load.c b/src/test_htmie_load.c @@ -85,7 +85,6 @@ main(int argc, char** argv) FILE* fp = NULL; struct htmie* htmie = NULL; double rmod, smod; - double r_bar, avg_vol; size_t i; if(argc < 3) { @@ -134,9 +133,6 @@ main(int argc, char** argv) CHK(fscanf(fp, "%*g") == EOF); CHK(fclose(fp) == 0); - r_bar = exp(rmod); - avg_vol = 4.0/3.0*PI*r_bar*r_bar*r_bar*exp(4.5*smod*smod); - /* Check absorption cross sections */ CHK((size_t)snprintf(buf, sizeof(buf), "%s/%s_macs", path, base)<sizeof(buf)); CHK(fp = fopen(buf, "r")); @@ -144,7 +140,7 @@ main(int argc, char** argv) const double Cabs = htmie_get_xsections_absorption(htmie)[i]; double macs; CHK(fscanf(fp, "%lg", &macs) == 1); - CHK(eq_eps(macs, Cabs / (avg_vol * 1.e-15), 1.e-6)); + CHK(eq_eps(macs, Cabs, 1.e-6)); } CHK(fscanf(fp, "%*g") == EOF); CHK(fclose(fp) == 0); @@ -156,7 +152,7 @@ main(int argc, char** argv) const double Csca = htmie_get_xsections_scattering(htmie)[i]; double mscs; CHK(fscanf(fp, "%lg", &mscs) == 1); - CHK(eq_eps(mscs, Csca / (avg_vol * 1.e-15), 1.e-6)); + CHK(eq_eps(mscs, Csca, 1.e-6)); } CHK(fscanf(fp, "%*g") == EOF); CHK(fclose(fp) == 0);