commit 7f1ef26feca9bdf8cb55210535bc0b40ef86e587
parent a58caadfdb60d2c0ca9efd3a5bbb59b6476e4d29
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 20 Jun 2018 16:23:22 +0200
Fix the 1D reinjection scheme
Avoid infinite "loop" on adiabatic parallel interfaces
Diffstat:
1 file changed, 23 insertions(+), 0 deletions(-)
diff --git a/src/sdis_solve_Xd.h b/src/sdis_solve_Xd.h
@@ -546,6 +546,13 @@ XD(solid_solid_boundary_temperature)
(MMIN(delta_front, delta_back),
MMIN(hit0.distance, hit1.distance));
dim = 1;
+
+ /* Hit something in 1D. Arbitrarly move the random walk to 0.5 of the hit
+ * distance */
+ if(delta == hit->distance) {
+ delta *= 0.5;
+ *hit = SXD_HIT_NULL;
+ }
}
/* Handle the volumic power */
@@ -664,6 +671,14 @@ XD(solid_fluid_boundary_temperature)
f2(range, 0, (float)delta*RAY_RANGE_MAX_SCALE);
SXD(scene_view_trace_ray(scn->sXd(view), pos, dir0, range, &rwalk->hit, &hit0));
delta_boundary = MMIN(hit0.distance, delta_boundary);
+
+ /* Hit something in 1D. Arbitrarly move the random walk to 0.5 of the hit
+ * distance in order to avoid infinite bounces for parallel plane */
+ if(!SXD_HIT_NONE(&hit0)) {
+ delta_boundary *= 0.5;
+ hit0 = SXD_HIT_NULL;
+ }
+
delta = delta_boundary;
dim = 1;
}
@@ -791,6 +806,14 @@ XD(solid_boundary_with_flux_temperature)
f2(range, 0, (float)delta*RAY_RANGE_MAX_SCALE);
SXD(scene_view_trace_ray(scn->sXd(view), pos, dir0, range, &rwalk->hit, &hit0));
delta_boundary = MMIN(hit0.distance, delta_boundary);
+
+ /* Hit something in 1D. Arbitrarly move the random walk to 0.5 of the hit
+ * distance in order to avoid infinite bounces for parallel plane */
+ if(!SXD_HIT_NONE(&hit0)) {
+ delta_boundary *= 0.5;
+ hit0 = SXD_HIT_NULL;
+ }
+
delta = delta_boundary;
dim = 1;
}