commit b65e165e11cc9b5c841e2bbf6bad13faf7f807a9
parent 82746bff05b3bc03507591dd1b18b630394dcfc9
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 13 Apr 2018 11:50:57 +0200
Small upd of how the time is handled in the solid random walk
Clamp the time to 0 and return an error if the temperature is still
unknown when the time is 0.
Diffstat:
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/sdis_solve_Xd.h b/src/sdis_solve_Xd.h
@@ -769,7 +769,7 @@ XD(solid_temperature)
/* Sample the time */
mu = (2*DIM*lambda) / (rho*cp*delta*fp_to_meter*delta*fp_to_meter);
tau = ssp_ran_exp(rng, mu);
- rwalk->vtx.time -= tau;
+ rwalk->vtx.time = MMAX(rwalk->vtx.time - tau, 0);
/* Check the initial condition */
tmp = solid_get_temperature(mdm, &rwalk->vtx);
@@ -779,6 +779,15 @@ XD(solid_temperature)
return RES_OK;
}
+ /* The initial condition should be reached */
+ if(rwalk->vtx.time <=0) {
+ log_err(scn->dev,
+ "%s: undefined initial condition. "
+ "The time is null but the temperature remains unknown.\n",
+ FUNC_NAME);
+ return RES_BAD_OP;
+ }
+
/* Add the volumic power density to the measured temperature */
power = solid_get_volumic_power(mdm, &rwalk->vtx);
if(power > 0) {