solstice-solver

Solver library of the solstice app
git clone git://git.meso-star.com/solstice-solver.git
Log | Files | Refs | README | LICENSE

commit 66bab09cfbdf417103e0ebabcd1925de180e7662
parent 15bce572ec4ab60e396d05bb465da1e60aef7b9b
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri, 19 Jun 2026 12:37:18 +0200

Use new star-cem 0.1

This implies renaming zenith nb elevation everywhere.

Diffstat:
Mconfig.mk | 2+-
Msrc/ssol_ranst_sun_dir.c | 12++++++------
Msrc/ssol_sun.c | 31++-----------------------------
3 files changed, 9 insertions(+), 36 deletions(-)

diff --git a/config.mk b/config.mk @@ -36,7 +36,7 @@ S3DUT_VERSION = 0.4 SCPR_VERSION = 0.5 SSF_VERSION = 0.10 SSP_VERSION = 0.15 -SCEM_VERSION = 0.0 +SCEM_VERSION = 0.1 INCS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags rsys s3d s3dut scpr ssf star-sp scem)\ -fopenmp diff --git a/src/ssol_ranst_sun_dir.c b/src/ssol_ranst_sun_dir.c @@ -109,21 +109,21 @@ chi_value(const double csr) static FINLINE double phi_solar_disk(const double theta) { - /* The parameter theta is the zenith angle in radians */ + /* The parameter theta is the elevation in radians */ return cos(326 * theta) / cos(308 * theta); } static FINLINE double phi_circum_solor_region(const double theta, const struct ran_buie_state* state) { - /* The parameter theta is the zenith angle in radians */ + /* The parameter theta is the elevation in radians */ return state->etokTimes1000toGamma * pow(theta, state->gamma); } static FINLINE double phi(const double theta, const struct ran_buie_state* state) { - /* The parameter theta is the zenith angle in radians */ + /* The parameter theta is the elevation in radians */ if (theta < state->thetaSD) return phi_solar_disk(theta); else return phi_circum_solor_region(theta, state); } @@ -131,7 +131,7 @@ phi(const double theta, const struct ran_buie_state* state) static FINLINE double pdf_theta(const double theta, const struct ran_buie_state* state) { - /* The parameter theta is the zenith angle in radians */ + /* The parameter theta is the elevation in radians */ return state->alpha * phi(theta, state) * sin(theta); } @@ -174,7 +174,7 @@ proba_rect1 } static FINLINE double -zenith_angle(struct ssp_rng* rng, const struct ran_buie_state* state) +elevation_angle(struct ssp_rng* rng, const struct ran_buie_state* state) { double theta; double value; @@ -228,7 +228,7 @@ ran_buie_get double phi, theta, sinTheta, cosTheta, cosPhi, sinPhi; ASSERT(ran->state.buie.thetaSD > 0); phi = ssp_rng_uniform_double(rng, 0, 2 * PI); - theta = zenith_angle(rng, &ran->state.buie); + theta = elevation_angle(rng, &ran->state.buie); sinTheta = sin(theta); cosTheta = cos(theta); cosPhi = cos(phi); diff --git a/src/ssol_sun.c b/src/ssol_sun.c @@ -81,33 +81,6 @@ error: goto exit; } -static INLINE void -scem_to_cartesian_sun_dir - (struct scem_sun_pos* scem, double sun_dir[3]) -{ - double cos_azimuth; - double sin_azimuth; - double cos_zenith; - double sin_zenith; - double azimuth; - double zenith; - ASSERT(scem && sun_dir); - - /* scem->azimuth: East = 0, CCW - * scem->zenith: XY plane = 0, UP = +PI/2, DOWN = -PI/2 */ - azimuth = scem->azimuth; - zenith = scem->zenith; - - cos_azimuth = cos(azimuth); - sin_azimuth = sin(azimuth); - cos_zenith = cos(zenith); - sin_zenith = sin(zenith); - - sun_dir[0] = -(cos_zenith * cos_azimuth); - sun_dir[1] = -(cos_zenith * sin_azimuth); - sun_dir[2] = -(sin_zenith); -} - /******************************************************************************* * Exported ssol_image functions ******************************************************************************/ @@ -202,8 +175,8 @@ ssol_sun_set_location_and_date } res = scem_sun_position_from_earth(date, &scem_loc, algorithm, &sun_pos); if(res != RES_OK) goto error; - - scem_to_cartesian_sun_dir(&sun_pos, sun->direction); + res = scem_sun_position_to_sun_vector(&sun_pos, sun->direction); + if(res != RES_OK) goto error; exit: return res;