commit a3496b80792ed74cd68c21576ffd6642b60652e0
parent cb5666c63e00f31675153a59184402720a5fa29a
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 18 Jan 2021 12:48:17 +0100
Test the "optprops_compute" internal function
Diffstat:
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -107,6 +107,7 @@ if(NOT NO_TEST)
endfunction()
build_test(test_atrstm)
+ new_test(test_atrstm_optprops)
endif()
################################################################################
diff --git a/src/test_atrstm_optprops.c b/src/test_atrstm_optprops.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2020 CNRS
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "atrstm_optprops.h"
+
+int
+main(int argc, char** argv)
+{
+ const double ka_ref = 5.7382401729092799E-019;
+ const double ks_ref = 7.2169062018378995E-024;
+
+ struct optprops optprops;
+ struct optprops_compute_args args = OPTPROPS_COMPUTE_ARGS_NULL;
+ (void)argc, (void)argv;
+
+ args.lambda = 633;
+ args.n = 1.90;
+ args.kappa = 0.55;
+ args.gyration_radius_prefactor = 1.70;
+ args.fractal_dimension = 1.75;
+ args.soot_volumic_fraction = 1.e-7;
+ args.soot_primary_particles_count = 100;
+ args.soot_primary_particles_diameter = 1;
+
+ optprops_compute(&optprops, &args);
+
+ printf("ka = %g; ks = %g\n", optprops.ka, optprops.ks);
+ CHK(eq_eps(optprops.ka, ka_ref, ka_ref*1.e-6));
+ CHK(eq_eps(optprops.ks, ks_ref, ks_ref*1.e-6));
+ return 0;
+}