stardis-solver

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

commit 3d6d29f5c0aa1a353459007afbc492126ab9e5dd
parent 87786480b1f1d2da7cd870cded7824a87d0a89d7
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue,  2 Jul 2024 12:24:48 +0200

Correct WoS position when initial condition is reached

When the initial condition is reached, the trajectory must be "rewound"
to the position of the initial condition. To do this, we sample a
displacement distance between the previous position and the position at
which the initial time is reached. But we were using this distance to
update the trajectory's position _after_ its diffusive step, whereas it
was its previous position that had to be updated to move backwards in
its diffusive step

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

diff --git a/src/sdis_heat_path_conductive_wos_Xd.h b/src/sdis_heat_path_conductive_wos_Xd.h @@ -103,6 +103,7 @@ XD(time_travel) struct sdis_medium* mdm, const double alpha, /* Diffusivity, i.e. lambda/(rho*cp) */ const double t0, /* Initial time [s] */ + const double pos[3], /* Position before the diffusive step */ double* distance, /* Displacement [m/fp_to_meter] */ struct temperature* T) { @@ -114,7 +115,7 @@ XD(time_travel) double temperature = 0; /* [k] */ double time = 0; /* [s] */ res_T res = RES_OK; - ASSERT(scn && rwalk && rng && alpha > 0 && distance && T); + ASSERT(scn && rwalk && rng && alpha > 0 && pos && distance && T); dst = *distance * scn->fp_to_meter; ASSERT(dst >= 0); @@ -604,6 +605,7 @@ XD(conductive_path_wos) /* Sample a diffusive path */ for(;;) { double power_term = 0; /* */ + double pos[3] = {0,0,0}; /* Position before diffusive step */ double dst = 0; /* [m/fp_to_meter] */ /* Register the new vertex against the heat path */ @@ -621,12 +623,14 @@ XD(conductive_path_wos) break; } + d3_set(pos, rwalk->vtx.P); + /* Find the next position of the conductive path */ res = XD(sample_next_position)(scn, rwalk, rng, &dst); if(res != RES_OK) goto error; /* Going back in time */ - res = XD(time_travel)(scn, rwalk, rng, mdm, alpha, props.t0, &dst, T); + res = XD(time_travel)(scn, rwalk, rng, mdm, alpha, props.t0, pos, &dst, T); if(res != RES_OK) goto error; /* Add the volumic power density */