commit e9b35b9918d564dfac9c3074c685006777e12faf
parent 7c6877410f42df96fe1837898937bcd142166125
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 27 Nov 2019 11:42:48 +0100
Fix the boundary flux realisation
When there was radiative transfer on the boundary onto which the flux
was computed, the radiative random walk was wrongly initialised: the
medium into which the rays travel was NULL while it had to reference a
fluid. Several realisations were thus rejected due to data
inconsistencies. This commit fixes this issue.
Diffstat:
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/sdis_realisation_Xd.h b/src/sdis_realisation_Xd.h
@@ -298,6 +298,9 @@ XD(boundary_flux_realisation)
struct XD(temperature) T;
struct sXd(attrib) attr;
struct sXd(primitive) prim;
+ struct sdis_interface* interf = NULL;
+ struct sdis_medium* fluid_mdm = NULL;
+
#if SDIS_XD_DIMENSION == 2
float st;
#else
@@ -354,9 +357,13 @@ XD(boundary_flux_realisation)
if(res != RES_OK) return res;
weight[0] = T.value;
+ /* Fetch the fluid medium */
+ interf = scene_get_interface(scn, (unsigned)iprim);
+ fluid_mdm = interface_get_medium(interf, fluid_side);
+
/* Compute radiative temperature */
if(compute_radiative) {
- RESET_WALK(fluid_side, NULL);
+ RESET_WALK(fluid_side, fluid_mdm);
T.func = XD(radiative_path);
res = XD(compute_temperature)(scn, fp_to_meter, &ctx, &rwalk, rng, &T);
if(res != RES_OK) return res;
@@ -365,10 +372,7 @@ XD(boundary_flux_realisation)
/* Compute fluid temperature */
if(compute_convective) {
- struct sdis_interface* interf = scene_get_interface(scn, (unsigned)iprim);
- struct sdis_medium* mdm = interface_get_medium(interf, fluid_side);
-
- RESET_WALK(fluid_side, mdm);
+ RESET_WALK(fluid_side, fluid_mdm);
T.func = XD(convective_path);
res = XD(compute_temperature)(scn, fp_to_meter, &ctx, &rwalk, rng, &T);
if(res != RES_OK) return res;