stardis-solver

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

commit 47ec5c8d066f6848efd9dd13b65dcf799f443c7e
parent f3b82059a3b066678ecf9ff63b30f2d474350530
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 16 Oct 2018 11:41:06 +0200

Fix error handling of surrounding medium with unknown temperature

Diffstat:
Msrc/sdis_solve.c | 4++--
Msrc/sdis_solve_Xd.h | 7++++---
Msrc/test_sdis_solve_probe.c | 2+-
Msrc/test_sdis_solve_probe_2d.c | 2+-
Msrc/test_sdis_solve_probe_boundary.c | 4++--
5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/sdis_solve.c b/src/sdis_solve.c @@ -262,7 +262,7 @@ exit: } if(rng_proxy) SSP(rng_proxy_ref_put(rng_proxy)); if(out_estimator) *out_estimator = estimator; - return (res_T)(res == RES_BAD_OP_IRRECOVERABLE ? RES_BAD_OP : res); + return (res_T)res; error: if(estimator) { SDIS(estimator_ref_put(estimator)); @@ -406,7 +406,7 @@ exit: } if(rng_proxy) SSP(rng_proxy_ref_put(rng_proxy)); if(out_estimator) *out_estimator = estimator; - return (res_T)(res == RES_BAD_OP_IRRECOVERABLE ? RES_BAD_OP : res); + return (res_T)res; error: if(estimator) { SDIS(estimator_ref_put(estimator)); diff --git a/src/sdis_solve_Xd.h b/src/sdis_solve_Xd.h @@ -501,11 +501,12 @@ XD(fluid_temperature) enc = scene_get_enclosure(scn, enc_id); if(!enc) { /* The possibility for a fluid enclosure to be unregistred is that it is - * the external enclosure. In this situation unknown temperature is forbidden. */ + * the external enclosure. In this situation unknown temperature is + * forbidden. */ log_err(scn->dev, "%s: invalid enclosure. The surrounding fluid has an unset temperature.\n", FUNC_NAME); - return RES_BAD_OP_IRRECOVERABLE; + return RES_BAD_ARG; } /* The hc upper bound can be 0 is h is uniformly 0. In that case the result @@ -1343,7 +1344,7 @@ exit: #ifndef NDEBUG sa_release(stack); #endif - return res; + return res == RES_BAD_OP_IRRECOVERABLE ? RES_BAD_OP : res; error: goto exit; } diff --git a/src/test_sdis_solve_probe.c b/src/test_sdis_solve_probe.c @@ -297,7 +297,7 @@ main(int argc, char** argv) /* The external fluid cannot have an unknown temperature */ fluid_param->temperature = -1; - CHK(sdis_solve_probe(scn, N, pos, time, 1.0, 0, 0, &estimator) == RES_BAD_OP); + CHK(sdis_solve_probe(scn, N, pos, time, 1.0, 0, 0, &estimator) == RES_BAD_ARG); CHK(sdis_scene_ref_put(scn) == RES_OK); CHK(sdis_device_ref_put(dev) == RES_OK); diff --git a/src/test_sdis_solve_probe_2d.c b/src/test_sdis_solve_probe_2d.c @@ -219,7 +219,7 @@ main(int argc, char** argv) /* The external fluid cannot have an unknown temperature */ fluid_param->temperature = -1; - CHK(sdis_solve_probe(scn, N, pos, time, 1.0, 0, 0, &estimator) == RES_BAD_OP); + CHK(sdis_solve_probe(scn, N, pos, time, 1.0, 0, 0, &estimator) == RES_BAD_ARG); CHK(sdis_scene_ref_put(scn) == RES_OK); CHK(sdis_device_ref_put(dev) == RES_OK); diff --git a/src/test_sdis_solve_probe_boundary.c b/src/test_sdis_solve_probe_boundary.c @@ -289,7 +289,7 @@ main(int argc, char** argv) /* The external fluid cannot have an unknown temperature */ fluid_param->temperature = UNKNOWN_TEMPERATURE; - CHK(SOLVE(box_scn, N, iprim, uv, INF, F, 1.0, 0, 0, &estimator) == RES_BAD_OP); + CHK(SOLVE(box_scn, N, iprim, uv, INF, F, 1.0, 0, 0, &estimator) == RES_BAD_ARG); fluid_param->temperature = Tf; uv[0] = 0.5; @@ -309,7 +309,7 @@ main(int argc, char** argv) /* The external fluid cannot have an unknown temperature */ fluid_param->temperature = UNKNOWN_TEMPERATURE; - CHK(SOLVE(square_scn, N, iprim, uv, INF, F, 1.0, 0, 0, &estimator) == RES_BAD_OP); + CHK(SOLVE(square_scn, N, iprim, uv, INF, F, 1.0, 0, 0, &estimator) == RES_BAD_ARG); #undef SOLVE CHK(sdis_scene_ref_put(box_scn) == RES_OK);