commit 878a417064db845f31925bf906b3cd1f63bc62c0
parent a82e1f3fbc3c0d9724ac6f6a6646b6641dfbf33e
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Mon, 8 Nov 2021 16:51:44 +0100
Fix system Tmax computation and extand it to new API Trange
Diffstat:
3 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/src/stardis-app.c b/src/stardis-app.c
@@ -82,10 +82,10 @@ read_model
"Scaling factor is %g\n", stardis->scale_factor);
logger_print(stardis->logger, LOG_OUTPUT,
"Trad is %g, Trad reference is %g\n", stardis->trad, stardis->trad_ref);
- stardis->tmax = MMAX(stardis->tmax, stardis->trad);
- stardis->tmax = MMAX(stardis->tmax, stardis->trad_ref);
+ stardis->t_range[0] = MMIN(stardis->t_range[0], stardis->trad_ref);
+ stardis->t_range[1] = MMAX(stardis->t_range[1], stardis->trad_ref);
logger_print(stardis->logger, LOG_OUTPUT,
- "System Tmax is %g\n", stardis->tmax);
+ "System Tref range is [%g %g]\n", SPLIT2(stardis->t_range));
ASSERT(!f && !txtrdr);
exit:
@@ -244,6 +244,7 @@ stardis_init
stardis->trad = STARDIS_DEFAULT_TRAD;
stardis->trad_ref = STARDIS_DEFAULT_TRAD_REFERENCE;
stardis->trad_def = 0;
+ d2(stardis->t_range, INF, -INF);
stardis->dump_paths = SDIS_HEAT_PATH_NONE;
if(args->dump_paths & DUMP_ERROR)
stardis->dump_paths |= SDIS_HEAT_PATH_FAILURE;
@@ -403,7 +404,7 @@ stardis_init
scn_args.fp_to_meter = stardis->scale_factor;
scn_args.trad.temperature = stardis->trad;
scn_args.trad.reference = stardis->trad_ref;
- scn_args.tmax = stardis->tmax;
+ d2_set(scn_args.t_range, stardis->t_range);
scn_args.context = &create_context;
res = sdis_scene_create(stardis->dev, &scn_args, &stardis->sdis_scn);
if(res != RES_OK) {
diff --git a/src/stardis-app.h b/src/stardis-app.h
@@ -806,7 +806,7 @@ struct stardis {
unsigned nthreads;
double scale_factor;
double trad, trad_ref;
- double tmax;
+ double t_range[2];
struct mem_allocator* allocator;
struct logger* logger;
struct sdis_device* dev;
diff --git a/src/stardis-parsing.c b/src/stardis-parsing.c
@@ -1215,7 +1215,8 @@ process_h
if(res == RES_OK) res = RES_BAD_ARG;
goto end;
}
- stardis->tmax = MMAX(stardis->tmax, desc->d.h_boundary.ref_temperature);
+ stardis->t_range[0] = MMIN(stardis->t_range[0], desc->d.h_boundary.ref_temperature);
+ stardis->t_range[1] = MMAX(stardis->t_range[1], desc->d.h_boundary.ref_temperature);
CHK_TOK(strtok_r(NULL, " \t", tok_ctx), "emissivity");
res = cstr_to_double(tk, &desc->d.h_boundary.emissivity);
if(res != RES_OK
@@ -1255,7 +1256,6 @@ process_h
if(res == RES_OK) res = RES_BAD_ARG;
goto end;
}
- stardis->tmax = MMAX(stardis->tmax, desc->d.h_boundary.imposed_temperature);
if(type == DESC_BOUND_H_FOR_FLUID)
desc->d.h_boundary.mat_id = get_dummy_solid_id(stardis, dummies);
@@ -1330,7 +1330,6 @@ process_t
if(res == RES_OK) res = RES_BAD_ARG;
goto end;
}
- stardis->tmax = MMAX(stardis->tmax, desc->d.t_boundary.imposed_temperature);
ASSERT(sz <= UINT_MAX);
ERR(read_sides_and_files(stardis, 1, (unsigned)sz, tok_ctx));
@@ -1441,7 +1440,8 @@ process_sfc
if(res == RES_OK) res = RES_BAD_ARG;
goto end;
}
- stardis->tmax = MMAX(stardis->tmax, desc->d.sf_connect.ref_temperature);
+ stardis->t_range[0] = MMIN(stardis->t_range[0], desc->d.sf_connect.ref_temperature);
+ stardis->t_range[1] = MMAX(stardis->t_range[1], desc->d.sf_connect.ref_temperature);
CHK_TOK(strtok_r(NULL, " \t", tok_ctx), "emissivity");
res = cstr_to_double(tk, &desc->d.sf_connect.emissivity);
if(res != RES_OK
@@ -1696,7 +1696,6 @@ process_solid
if(res == RES_OK) res = RES_BAD_ARG;
goto end;
}
- stardis->tmax = MMAX(stardis->tmax, desc->d.solid.tinit);
ERR(read_imposed_temperature(stardis, &desc->d.solid.imposed_temperature,
tok_ctx));
if(desc->d.solid.imposed_temperature >= 0
@@ -1708,7 +1707,6 @@ process_solid
desc->d.solid.tinit, desc->d.solid.imposed_temperature); res = RES_BAD_ARG;
goto end;
}
- stardis->tmax = MMAX(stardis->tmax, desc->d.solid.imposed_temperature);
CHK_TOK(strtok_r(NULL, " \t", tok_ctx), "volumic power");
res = cstr_to_double(tk, &desc->d.solid.vpower);
if(res != RES_OK) {
@@ -1794,7 +1792,6 @@ process_fluid
if(res == RES_OK) res = RES_BAD_ARG;
goto end;
}
- stardis->tmax = MMAX(stardis->tmax, desc->d.fluid.tinit);
ERR(read_imposed_temperature(stardis, &desc->d.fluid.imposed_temperature,
tok_ctx));
@@ -1807,7 +1804,6 @@ process_fluid
desc->d.fluid.tinit, desc->d.fluid.imposed_temperature); res = RES_BAD_ARG;
goto end;
}
- stardis->tmax = MMAX(stardis->tmax, desc->d.fluid.imposed_temperature);
ERR(create_solver_fluid(stardis, &desc->d.fluid));