commit 769e578ae198020789e1a1dfaef43b8aa7e9316e
parent 801e9486ef77a5bf5817c7fa9d8237b45cc14443
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 22 Oct 2025 15:45:34 +0200
Manage programmable solids in temperature range calculations
A solid may reach a temperature that is not within the temperature
range of the connection conditions and boundary conditions carried by
the interfaces, which are the only temperatures used to calculate the
system's temperature interval.
This poses a problem when processing nonlinear radiative exchanges,
because in this case, the Picard algorithm checks the temperature
returned by a branch against the system's temperature range, which may
not include this temperature, thus causing an error.
In reality, there is no reason to query the temperature of programmable
solids alone. Conventional solids and fluids (programmable or not) could
have a known temperature in addition to an initial temperature. All of
these temperatures should therefore be taken into account when
calculating the temperature range.
The use of a programmable solid highlighted this issue. However,
correcting the calculation of the system's temperature range seems to
require further modifications. A more extensive correction requires
further consideration and additional testing to ensure that the new
method of calculating the temperature range is correct and does not
break the existing simulations. Hence this limited correction,
sufficient to verify that it corrects the problem on the system that
highlighted it, but not overly optimistic as to what it corrects versus
what it could deteriorate.
Diffstat:
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/stardis-parsing.c b/src/stardis-parsing.c
@@ -1820,11 +1820,22 @@ process_solid_prog
GET_LIB_SYMBOL_BASE(&solid_prog->sample_path, solid_prog->program->lib_handle,
stardis_sample_conductive_path, 1);
+ GET_LIB_SYMBOL_BASE(&solid_prog->t_range, solid_prog->program->lib_handle,
+ stardis_t_range, 1);
/* create and init custom data */
ctx.name = desc_name;
CREATE_DESC_DATA(solid_prog);
+ if(solid_prog->t_range) {
+ double t_range[2];
+ solid_prog->t_range(solid_prog->prog_data, t_range);
+ if(STARDIS_TEMPERATURE_IS_KNOWN(t_range[0]))
+ stardis->t_range[0] = MMIN(stardis->t_range[0], t_range[0]);
+ if(STARDIS_TEMPERATURE_IS_KNOWN(t_range[1]))
+ stardis->t_range[1] = MMAX(stardis->t_range[1], t_range[1]);
+ }
+
ERR(create_solver_solid_prog(stardis, solid_prog));
end:
diff --git a/src/stardis-solid-prog.h b/src/stardis-solid-prog.h
@@ -48,6 +48,7 @@ struct solid_prog {
double (*delta)(const struct stardis_vertex*, void*);
double (*temp)(const struct stardis_vertex*, void*);
double (*vpower)(const struct stardis_vertex*, void*);
+ double (*t_range)(void* data, double t_range[2]);
/* User-defined function for sampling a conductive path */
int