stardis-solver

Solve coupled heat transfers
git clone git://git.meso-star.fr/stardis-solver.git
Log | Files | Refs | README | LICENSE

commit 87786480b1f1d2da7cd870cded7824a87d0a89d7
parent 76b864e8c22c131c1b65b476dcd78674427629c1
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue,  2 Jul 2024 11:25:28 +0200

Fix the time travel in WoS algorithm

A test that thought it was checking the travel distance actually checked
its pointer by comparing it with 0. However, this had no impact on the
result, since the travel time always remained zero. This error therefore
only had an impact on calculation time.

Another problem was using the distance in meters to update the position
when it reached the initial condition, whereas the distance should be
relative to the fp_to_meter factor.

Diffstat:
Msrc/sdis_heat_path_conductive_wos_Xd.h | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/sdis_heat_path_conductive_wos_Xd.h b/src/sdis_heat_path_conductive_wos_Xd.h @@ -120,7 +120,7 @@ XD(time_travel) ASSERT(dst >= 0); /* No displacement => no time travel */ - if(distance == 0) goto exit; + if(dst == 0) goto exit; /* Sample x = tau*alpha/distance^2 */ r = ssp_rng_canonical(rng); @@ -151,17 +151,18 @@ XD(time_travel) r = ssp_rng_canonical(rng); x = swf_tabulation_inverse(XD(scn->dev->H), SWF_QUADRATIC, r); dst = sqrt(alpha * time / x); - *distance = dst; /* Update travel distance */ + *distance = dst / scn->fp_to_meter; /* Update travel distance */ /* Uniformly sample a direction and move along it of the distance that - * separate the current position ot its initial condition */ + * separate the path position before diffusion position to its initial + * condition */ #if DIM == 2 ssp_ran_circle_uniform(rng, dir, NULL); #else ssp_ran_sphere_uniform(rng, dir, NULL); #endif - dX(muld)(dir, dir, dst); - dX(add)(rwalk->vtx.P, rwalk->vtx.P, dir); + dX(muld)(dir, dir, *distance); + dX(add)(rwalk->vtx.P, pos, dir); /* Fetch the initial temperature */ temperature = medium_get_temperature(mdm, &rwalk->vtx);