stardis-solver

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

commit 75ae9b8ab6cb7e323e1c4a7258ce904339257eec
parent c55239be13b18fd224915c5f18ad54a010948f24
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 26 Mar 2024 17:14:41 +0100

Allow negative temperatures

Temperatures are expressed in Kelvin and therefore cannot be negative in
absolute value. However, you may wish to perform calculations relative
to a given temperature T. In this case, the temperatures managed by
Stardis would be relative to T and could therefore be negative, since
they would express a deviation from T. Hence this commit, which
authorizes negative temperatures.

This is a major break in the API that callers MUST take into account.
Until now, negative temperatures were considered as unknown
temperatures, whereas they are now valid. For example, an interface with
a negative temperature could be considered adiabatic, whereas it is now
a Dirichlet boundary condition. In other words, the same data could
define totally different systems before or after this modification.

A new Stardis macro is added to define the unknown temperature value.
Two help macros are also provided to test whether the temperature is
known or not.

All tests have been updated accordingly to handle this API break. It
should be noted that while the complete code has been compiled without
error, the tests have still not been re-run since this update.

Diffstat:
Msrc/sdis.h | 17+++++++++++------
Msrc/sdis_heat_path_boundary_Xd.h | 2+-
Msrc/sdis_heat_path_boundary_Xd_solid_fluid_picard1.h | 9+++++----
Msrc/sdis_heat_path_conductive_delta_sphere_Xd.h | 2+-
Msrc/sdis_heat_path_conductive_wos_Xd.h | 4++--
Msrc/sdis_heat_path_convective_Xd.h | 2+-
Msrc/sdis_heat_path_radiative_Xd.h | 2+-
Msrc/sdis_interface_c.h | 7+++++--
Msrc/sdis_medium_c.h | 4++--
Msrc/sdis_misc_Xd.h | 2+-
Msrc/sdis_realisation_Xd.h | 6+++---
Msrc/sdis_solve_boundary_Xd.h | 4++--
Msrc/sdis_solve_probe_boundary_Xd.h | 4++--
Msrc/test_sdis_compute_power.c | 1-
Msrc/test_sdis_conducto_radiative.c | 14++++++--------
Msrc/test_sdis_conducto_radiative_2d.c | 12+++++-------
Msrc/test_sdis_contact_resistance.c | 9++++-----
Msrc/test_sdis_contact_resistance_2.c | 9++++-----
Msrc/test_sdis_convection.c | 5++---
Msrc/test_sdis_convection_non_uniform.c | 5++---
Msrc/test_sdis_draw_external_flux.c | 4++--
Msrc/test_sdis_enclosure_limit_conditions.c | 3+--
Msrc/test_sdis_external_flux.c | 4++--
Msrc/test_sdis_flux.c | 9++++-----
Msrc/test_sdis_flux2.c | 12+++++-------
Msrc/test_sdis_flux_with_h.c | 2+-
Msrc/test_sdis_picard.c | 9++++-----
Msrc/test_sdis_scene.c | 4++--
Msrc/test_sdis_solid_random_walk_robustness.c | 5++---
Msrc/test_sdis_solve_boundary.c | 13++++++-------
Msrc/test_sdis_solve_boundary_flux.c | 7+++----
Msrc/test_sdis_solve_camera.c | 17++++++++---------
Msrc/test_sdis_solve_medium.c | 6+++---
Msrc/test_sdis_solve_medium_2d.c | 4++--
Msrc/test_sdis_solve_probe.c | 6+++---
Msrc/test_sdis_solve_probe2.c | 2+-
Msrc/test_sdis_solve_probe2_2d.c | 2+-
Msrc/test_sdis_solve_probe3.c | 2+-
Msrc/test_sdis_solve_probe3_2d.c | 2+-
Msrc/test_sdis_solve_probe_2d.c | 4++--
Msrc/test_sdis_solve_probe_boundary_list.c | 2+-
Msrc/test_sdis_solve_probe_list.c | 2+-
Msrc/test_sdis_transcient.c | 6++----
Msrc/test_sdis_unstationary_atm.c | 14++++++--------
Msrc/test_sdis_unsteady.c | 2+-
Msrc/test_sdis_unsteady_1d.c | 6+++---
Msrc/test_sdis_volumic_power.c | 9++++-----
Msrc/test_sdis_volumic_power2.c | 17++++++++---------
Msrc/test_sdis_volumic_power2_2d.c | 9++++-----
Msrc/test_sdis_volumic_power3_2d.c | 17++++++++---------
Msrc/test_sdis_volumic_power4.c | 8++++----
51 files changed, 156 insertions(+), 173 deletions(-)

diff --git a/src/sdis.h b/src/sdis.h @@ -50,6 +50,11 @@ #define SDIS_FLUX_NONE DBL_MAX /* <=> No flux */ #define SDIS_PRIMITIVE_NONE SIZE_MAX /* Invalid primitive */ +/* Syntactic sugar used to define whether a temperature is known or not */ +#define SDIS_TEMPERATURE_NONE NaN /* Unknown temperature */ +#define SDIS_TEMPERATURE_IS_KNOWN(Temp) (IS_NaN(Temp)) +#define SDIS_TEMPERATURE_IS_UNKNOWN(Temp) (!SDIS_TEMPERATURE_IS_KNOWN(Temp)) + /* Forward declaration of external opaque data types */ struct logger; struct mem_allocator; @@ -242,8 +247,8 @@ struct sdis_solid_shader { * submitted position and time */ sdis_medium_getter_T volumic_power; /* In W.m^-3 */ - /* Initial/limit condition. A temperature < 0 means that the temperature is - * unknown for the submitted random walk vertex. + /* Initial/limit condition. A temperature set to SDIS_TEMPERATURE_NONE + * means that the temperature is unknown for the submitted random walk vertex. * This getter is always called at time >= t0 (see below). */ sdis_medium_getter_T temperature; @@ -262,8 +267,8 @@ struct sdis_fluid_shader { sdis_medium_getter_T calorific_capacity; /* In J.K^-1.kg^-1 */ sdis_medium_getter_T volumic_mass; /* In kg.m^-3 */ - /* Initial/limit condition. A temperature < 0 means that the temperature is - * unknown for the submitted random walk vertex. + /* Initial/limit condition. A temperature set to SDIS_TEMPERATURE_NONE + * means that the temperature is unknown for the submitted random walk vertex. * This getter is always called at time >= t0 (see below). */ sdis_medium_getter_T temperature; @@ -280,8 +285,8 @@ static const struct sdis_fluid_shader SDIS_FLUID_SHADER_NULL = struct sdis_interface_side_shader { /* Fixed temperature/flux. May be NULL if the temperature/flux is unknown * onto the whole interface */ - sdis_interface_getter_T temperature; /* In Kelvin. < 0 <=> Unknown temp */ - sdis_interface_getter_T flux; /* In W.m^-2. SDIS_FLUX_NONE <=> no flux */ + sdis_interface_getter_T temperature; /* [K]. SDIS_TEMPERATURE_NONE = Unknown */ + sdis_interface_getter_T flux; /* [W.m^-2]. SDIS_FLUX_NONE = no flux */ /* Control the emissivity of the interface. May be NULL for solid/solid * interface or if the emissivity is 0 onto the whole interface. */ diff --git a/src/sdis_heat_path_boundary_Xd.h b/src/sdis_heat_path_boundary_Xd.h @@ -54,7 +54,7 @@ XD(boundary_path) /* Check if the boundary temperature is known */ tmp = interface_side_get_temperature(interf, &frag); - if(tmp >= 0) { + if(SDIS_TEMPERATURE_IS_KNOWN(tmp)) { T->value += tmp; T->done = 1; diff --git a/src/sdis_heat_path_boundary_Xd_solid_fluid_picard1.h b/src/sdis_heat_path_boundary_Xd_solid_fluid_picard1.h @@ -36,10 +36,10 @@ XD(check_Tref) { ASSERT(scn && pos && func_name); - if(Tref < 0) { + if(SDIS_TEMPERATURE_IS_UNKNOWN(Tref)) { log_err(scn->dev, - "%s: invalid reference temperature `%gK' at the position `"FORMAT_VECX"'.\n", - func_name, Tref, SPLITX(pos)); + "%s: invalid reference temperature at the position `"FORMAT_VECX"'.\n", + func_name, SPLITX(pos)); return RES_BAD_OP_IRRECOVERABLE; } if(Tref > scn->tmax) { @@ -60,7 +60,7 @@ XD(rwalk_get_Tref) const struct XD(temperature)* T, double* out_Tref) { - double Tref = -1; + double Tref = SDIS_TEMPERATURE_NONE; res_T res = RES_OK; ASSERT(rwalk && T && out_Tref); @@ -304,6 +304,7 @@ XD(solid_fluid_boundary_picard1_path) /* Get the Tref at the end of the candidate radiative path */ res = XD(rwalk_get_Tref)(scn, &rwalk_s, &T_s, &Tref_s); if(res != RES_OK) goto error; + ASSERT(SDIS_TEMPERATURE_IS_KNOWN(Tref_s)); h_radi = BOLTZMANN_CONSTANT * epsilon * ( Tref*Tref*Tref diff --git a/src/sdis_heat_path_conductive_delta_sphere_Xd.h b/src/sdis_heat_path_conductive_delta_sphere_Xd.h @@ -390,7 +390,7 @@ XD(conductive_path_delta_sphere) /* Check the limit condition * REVIEW Rfo: This can be a bug if the random walk comes from a boundary */ - if(props.temperature >= 0) { + if(SDIS_TEMPERATURE_IS_KNOWN(props.temperature)) { T->value += props.temperature; T->done = 1; diff --git a/src/sdis_heat_path_conductive_wos_Xd.h b/src/sdis_heat_path_conductive_wos_Xd.h @@ -121,7 +121,7 @@ XD(time_travel) /* Fetch the initial temperature */ temperature = medium_get_temperature(rwalk->mdm, &rwalk->vtx); - if(temperature < 0) { + if(SDIS_TEMPERATURE_IS_UNKNOWN(temperature)) { log_err(scn->dev, "%s:%s: the path reaches the initial condition but the " "%s temperature remains unknown -- position=%g, %g, %g\n", @@ -558,7 +558,7 @@ XD(conductive_path_wos) } (void)0 /* The temperature is known */ - if(props.temperature >= 0) { + if(SDIS_TEMPERATURE_IS_KNOWN(props.temperature)) { REGISTER_HEAT_VERTEX; T->value += props.temperature; T->done = 1; diff --git a/src/sdis_heat_path_convective_Xd.h b/src/sdis_heat_path_convective_Xd.h @@ -119,7 +119,7 @@ XD(handle_known_fluid_temperature) temperature = fluid_get_temperature(rwalk->mdm, &rwalk->vtx); /* Check if the temperature is known */ - known_temperature = temperature >= 0; + known_temperature = SDIS_TEMPERATURE_IS_KNOWN(temperature); if(!known_temperature) goto exit; T->value += temperature; diff --git a/src/sdis_heat_path_radiative_Xd.h b/src/sdis_heat_path_radiative_Xd.h @@ -78,7 +78,7 @@ XD(trace_radiative_path) #endif if(SXD_HIT_NONE(&rwalk->hit)) { /* Fetch the ambient radiative temperature */ rwalk->hit_side = SDIS_SIDE_NULL__; - if(scn->trad.temperature >= 0) { + if(SDIS_TEMPERATURE_IS_KNOWN(scn->trad.temperature)) { T->value += scn->trad.temperature; T->done = 1; diff --git a/src/sdis_interface_c.h b/src/sdis_interface_c.h @@ -120,7 +120,9 @@ interface_side_get_temperature case SDIS_BACK: shader = &interf->shader.back; break; default: FATAL("Unreachable code.\n"); } - return shader->temperature ? shader->temperature(frag, interf->data) : -1; + return shader->temperature + ? shader->temperature(frag, interf->data) + : SDIS_TEMPERATURE_NONE; } static INLINE double @@ -182,7 +184,8 @@ interface_side_get_reference_temperature default: FATAL("Unreachable code\n"); break; } return shader->reference_temperature - ? shader->reference_temperature(frag, interf->data) : -1; + ? shader->reference_temperature(frag, interf->data) + : SDIS_TEMPERATURE_NONE; } static INLINE int diff --git a/src/sdis_medium_c.h b/src/sdis_medium_c.h @@ -109,7 +109,7 @@ static const struct solid_props SOLID_PROPS_NULL = SOLID_PROPS_NULL__; ******************************************************************************/ DEFINE_MDM_CHK_PROP_FUNC(fluid, calorific_capacity, 0, INF, 0, 1) DEFINE_MDM_CHK_PROP_FUNC(fluid, volumic_mass, 0, INF, 0, 1) -DEFINE_MDM_CHK_PROP_FUNC(fluid, temperature, 0, INF, 1, 1) +DEFINE_MDM_CHK_PROP_FUNC(fluid, temperature, -INF, INF, 1, 1) DEFINE_MDM_GET_PROP_FUNC(fluid, calorific_capacity) DEFINE_MDM_GET_PROP_FUNC(fluid, volumic_mass) @@ -165,7 +165,7 @@ DEFINE_MDM_CHK_PROP_FUNC(solid, thermal_conductivity, 0, INF, 0, 1) DEFINE_MDM_CHK_PROP_FUNC(solid, volumic_mass, 0, INF, 0, 1) DEFINE_MDM_CHK_PROP_FUNC(solid, delta, 0, INF, 0, 1) DEFINE_MDM_CHK_PROP_FUNC(solid, volumic_power, -INF, INF, 1, 1) -DEFINE_MDM_CHK_PROP_FUNC(solid, temperature, 0, INF, 1, 1) +DEFINE_MDM_CHK_PROP_FUNC(solid, temperature, -INF, INF, 1, 1) DEFINE_MDM_GET_PROP_FUNC(solid, calorific_capacity) DEFINE_MDM_GET_PROP_FUNC(solid, thermal_conductivity) diff --git a/src/sdis_misc_Xd.h b/src/sdis_misc_Xd.h @@ -54,7 +54,7 @@ XD(time_rewind) /* Fetch the initial temperature */ temperature = medium_get_temperature(rwalk->mdm, &rwalk->vtx); - if(temperature < 0) { + if(SDIS_TEMPERATURE_IS_UNKNOWN(temperature)) { log_err(rwalk->mdm->dev, "the path reaches the limit condition but the " "%s temperature remains unknown -- position=%g, %g, %g\n", medium_type_to_string(sdis_medium_get_type(rwalk->mdm)), diff --git a/src/sdis_realisation_Xd.h b/src/sdis_realisation_Xd.h @@ -211,7 +211,7 @@ XD(probe_realisation) /* Check the initial condition. */ rwalk.vtx.time = t0; tmp = get_initial_temperature(args->medium, &rwalk.vtx); - if(tmp >= 0) { + if(SDIS_TEMPERATURE_IS_KNOWN(tmp)) { *weight = tmp; goto exit; } @@ -242,7 +242,7 @@ XD(probe_realisation) res = XD(sample_coupled_path)(scn, &ctx, &rwalk, args->rng, &T); if(res != RES_OK) goto error; - ASSERT(T.value >= 0); + ASSERT(SDIS_TEMPERATURE_IS_KNOWN(T.value)); *weight = T.value; exit: @@ -424,7 +424,7 @@ XD(boundary_flux_realisation) T.func = XD(radiative_path); res = XD(sample_coupled_path)(scn, &ctx, &rwalk, args->rng, &T); if(res != RES_OK) return res; - ASSERT(T.value >= 0); + ASSERT(SDIS_TEMPERATURE_IS_KNOWN(T.value)); result->Tradiative = T.value; } diff --git a/src/sdis_solve_boundary_Xd.h b/src/sdis_solve_boundary_Xd.h @@ -790,7 +790,7 @@ XD(solve_boundary_flux) frag.side = solid_side; imposed_flux = interface_side_get_flux(interf, &frag); imposed_temp = interface_side_get_temperature(interf, &frag); - if(imposed_temp >= 0) { + if(SDIS_TEMPERATURE_IS_KNOWN(imposed_temp)) { /* Flux computation on T boundaries is not supported yet */ log_err(scn->dev, "%s: Attempt to compute a flux at a Dirichlet boundary " "(not available yet).\n", FUNC_NAME); @@ -829,7 +829,7 @@ XD(solve_boundary_flux) /* Convective flux from fluid to solid */ const double w_conv = hc * (result.Tfluid - result.Tboundary); /* Radiative flux from ambient to solid */ - const double w_rad = (result.Tradiative < 0) ? + const double w_rad = SDIS_TEMPERATURE_IS_UNKNOWN(result.Tradiative) ? 0 : hr * (result.Tradiative - result.Tboundary); /* Imposed flux that goes _into_ the solid */ const double w_imp = (imposed_flux != SDIS_FLUX_NONE) ? imposed_flux : 0; diff --git a/src/sdis_solve_probe_boundary_Xd.h b/src/sdis_solve_probe_boundary_Xd.h @@ -884,7 +884,7 @@ XD(solve_probe_boundary_flux) frag.side = solid_side; imposed_flux = interface_side_get_flux(interf, &frag); imposed_temp = interface_side_get_temperature(interf, &frag); - if(imposed_temp >= 0) { + if(SDIS_TEMPERATURE_IS_KNOWN(imposed_temp)) { /* Flux computation on T boundaries is not supported yet */ log_err(scn->dev, "%s: Attempt to compute a flux at a Dirichlet boundary " @@ -924,7 +924,7 @@ XD(solve_probe_boundary_flux) /* Convective flux from fluid to solid */ const double w_conv = hc * (result.Tfluid - result.Tboundary); /* Radiative flux from ambient to solid */ - const double w_rad = (result.Tradiative < 0) ? + const double w_rad = SDIS_TEMPERATURE_IS_UNKNOWN(result.Tradiative) ? 0 : hr * (result.Tradiative - result.Tboundary); /* Imposed flux that goes _into_ the solid */ const double w_imp = (imposed_flux != SDIS_FLUX_NONE) ? imposed_flux : 0; diff --git a/src/test_sdis_compute_power.c b/src/test_sdis_compute_power.c @@ -19,7 +19,6 @@ #include <rsys/stretchy_array.h> #include <star/s3dut.h> -#define UNKOWN_TEMPERATURE -1 #define N 100000ul /* #realisations */ #define POWER0 10 #define POWER1 5 diff --git a/src/test_sdis_conducto_radiative.c b/src/test_sdis_conducto_radiative.c @@ -19,8 +19,6 @@ #include <rsys/math.h> #include <star/ssp.h> -#define UNKNOWN_TEMPERATURE -1 - /* The scene is composed of a solid cube whose temperature is unknown. The cube * faces on +/-X are in contact with a fluid and their convection coefficient * is null while their emissivity is 1. The left and right fluids are enclosed @@ -134,7 +132,7 @@ static double temperature_unknown(const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) { CHK(vtx != NULL); (void)data; - return -1; + return SDIS_TEMPERATURE_NONE; } static double @@ -179,7 +177,7 @@ solid_get_temperature CHK(data != NULL); t0 = ((const struct solid*)sdis_data_cget(data))->t0; if(vtx->time > t0) { - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } else { return ((const struct solid*)sdis_data_cget(data))->initial_temperature; } @@ -395,7 +393,7 @@ main(int argc, char** argv) OK(sdis_data_ref_put(data)); /* Create the interface that forces to keep in conduction */ - interf.temperature = UNKNOWN_TEMPERATURE; + interf.temperature = SDIS_TEMPERATURE_NONE; interf.convection_coef = -1; interf.emissivity = -1; interf.specular_fraction = -1; @@ -403,7 +401,7 @@ main(int argc, char** argv) create_interface(dev, solid, solid2, &interf, interfaces+0); /* Create the interface that emits radiative heat from the solid */ - interf.temperature = UNKNOWN_TEMPERATURE; + interf.temperature = SDIS_TEMPERATURE_NONE; interf.convection_coef = 0; interf.emissivity = emissivity; interf.specular_fraction = 1; @@ -411,7 +409,7 @@ main(int argc, char** argv) create_interface(dev, solid, fluid, &interf, interfaces+1); /* Create the interface that forces the radiative heat to bounce */ - interf.temperature = UNKNOWN_TEMPERATURE; + interf.temperature = SDIS_TEMPERATURE_NONE; interf.convection_coef = 0; interf.emissivity = 0; interf.specular_fraction = 1; @@ -483,7 +481,7 @@ main(int argc, char** argv) struct sdis_estimator* estimator2; struct sdis_green_function* green; struct sdis_solve_probe_args solve_args = SDIS_SOLVE_PROBE_ARGS_DEFAULT; - double ref = -1; + double ref = SDIS_TEMPERATURE_NONE; size_t nreals = 0; size_t nfails = 0; const size_t N = 10000; diff --git a/src/test_sdis_conducto_radiative_2d.c b/src/test_sdis_conducto_radiative_2d.c @@ -18,8 +18,6 @@ #include <star/ssp.h> -#define UNKNOWN_TEMPERATURE -1 - /* The scene is composed of a solid square whose temperature is unknown. The * square segments on +/-X are in contact with a fluid and their convection * coefficient is null while their emissivity is 1. The left and right fluids @@ -113,7 +111,7 @@ static double temperature_unknown(const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) { CHK(vtx != NULL); (void)data; - return -1; + return SDIS_TEMPERATURE_NONE; } static double @@ -171,7 +169,7 @@ interface_get_temperature (const struct sdis_interface_fragment* frag, struct sdis_data* data) { const struct interfac* interf; - double T = -1; + double T = SDIS_TEMPERATURE_NONE; CHK(data != NULL && frag != NULL); interf = sdis_data_cget(data); switch(frag->side) { @@ -229,7 +227,7 @@ interface_get_reference_temperature (const struct sdis_interface_fragment* frag, struct sdis_data* data) { const struct interfac* interf; - double T = -1; + double T = SDIS_TEMPERATURE_NONE; CHK(data != NULL && frag != NULL); interf = sdis_data_cget(data); switch(frag->side) { @@ -398,7 +396,7 @@ main(int argc, char** argv) /* Create the interface that emits radiative heat from the solid */ interf = INTERFACE_NULL; - interf.back.temperature = UNKNOWN_TEMPERATURE; + interf.back.temperature = SDIS_TEMPERATURE_NONE; interf.back.emissivity = emissivity; interf.back.specular_fraction = -1; /* Should not be fetched */ interf.back.reference_temperature = Tref; @@ -406,7 +404,7 @@ main(int argc, char** argv) /* Create the interface that forces the radiative heat to bounce */ interf = INTERFACE_NULL; - interf.front.temperature = UNKNOWN_TEMPERATURE; + interf.front.temperature = SDIS_TEMPERATURE_NONE; interf.front.emissivity = 0; interf.front.specular_fraction = 1; interf.front.reference_temperature = Tref; diff --git a/src/test_sdis_contact_resistance.c b/src/test_sdis_contact_resistance.c @@ -52,7 +52,6 @@ * (0,0,0)///x=X0/// */ -#define UNKNOWN_TEMPERATURE -1 #define N 10000 /* #realisations */ #define T0 0.0 @@ -80,7 +79,7 @@ fluid_get_temperature { (void)data; CHK(vtx); - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } static double @@ -120,7 +119,7 @@ solid_get_temperature (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) { CHK(vtx && data); - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } /******************************************************************************* @@ -314,7 +313,7 @@ main(int argc, char** argv) /* Create the adiabatic interfaces */ OK(sdis_data_create(dev, sizeof(struct interf), 16, NULL, &data)); interf_props = sdis_data_get(data); - interf_props->temperature = UNKNOWN_TEMPERATURE; + interf_props->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_interface_create (dev, solid1, fluid, &interf_shader, data, &interf_adiabatic1)); OK(sdis_interface_create @@ -342,7 +341,7 @@ main(int argc, char** argv) interf_shader.thermal_contact_resistance = interface_get_contact_resistance; OK(sdis_data_create(dev, sizeof(struct interf), 16, NULL, &data)); interf_props = sdis_data_get(data); - interf_props->temperature = UNKNOWN_TEMPERATURE; + interf_props->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_interface_create (dev, solid1, solid2, &interf_shader, data, &interf_R)); OK(sdis_data_ref_put(data)); diff --git a/src/test_sdis_contact_resistance_2.c b/src/test_sdis_contact_resistance_2.c @@ -45,7 +45,6 @@ * (0,0,0)///x=X0/// */ -#define UNKNOWN_TEMPERATURE -1 #define N 10000 /* #realisations */ #define T0 0.0 @@ -73,7 +72,7 @@ fluid_get_temperature { (void)data; CHK(vtx); - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } static double @@ -113,7 +112,7 @@ solid_get_temperature (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) { CHK(vtx && data); - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } /******************************************************************************* @@ -408,7 +407,7 @@ main(int argc, char** argv) /* Create the adiabatic interfaces */ OK(sdis_data_create(dev, sizeof(struct interf), 16, NULL, &data)); interf_props = sdis_data_get(data); - interf_props->temperature = UNKNOWN_TEMPERATURE; + interf_props->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_interface_create (dev, solid1, fluid, &interf_shader, data, &interf_adiabatic1)); OK(sdis_interface_create @@ -436,7 +435,7 @@ main(int argc, char** argv) interf_shader.thermal_contact_resistance = interface_get_contact_resistance; OK(sdis_data_create(dev, sizeof(struct interf), 16, NULL, &data)); interf_props = sdis_data_get(data); - interf_props->temperature = UNKNOWN_TEMPERATURE; + interf_props->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_interface_create (dev, solid1, solid2, &interf_shader, data, &interf_R)); OK(sdis_data_ref_put(data)); diff --git a/src/test_sdis_convection.c b/src/test_sdis_convection.c @@ -48,7 +48,6 @@ * (0,0,0) */ -#define UNKNOWN_TEMPERATURE -1 #define N 100000 /* #realisations */ #define Tf_0 280.0 @@ -73,9 +72,9 @@ fluid_get_temperature { CHK(vtx != NULL); if(*((int*)sdis_data_cget(is_stationary))) { - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } else { - return vtx->time <= 0 ? Tf_0 : UNKNOWN_TEMPERATURE; + return vtx->time <= 0 ? Tf_0 : SDIS_TEMPERATURE_NONE; } } diff --git a/src/test_sdis_convection_non_uniform.c b/src/test_sdis_convection_non_uniform.c @@ -48,7 +48,6 @@ * (0,0,0) */ -#define UNKNOWN_TEMPERATURE -1 #define N 100000 /* #realisations */ #define Tf_0 280.0 @@ -80,9 +79,9 @@ fluid_get_temperature CHK(vtx != NULL); CHK(is_stationary != NULL); if(*((int*)sdis_data_cget(is_stationary))) { - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } else { - return vtx->time <= 0 ? Tf_0 : UNKNOWN_TEMPERATURE; + return vtx->time <= 0 ? Tf_0 : SDIS_TEMPERATURE_NONE; } } diff --git a/src/test_sdis_draw_external_flux.c b/src/test_sdis_draw_external_flux.c @@ -92,7 +92,7 @@ MEDIUM_PROP(solid, temperature, 310) /* [K] */ MEDIUM_PROP(solid, delta, 1.0/20.0) /* [m] */ MEDIUM_PROP(fluid, calorific_capacity, 2.0) /* [J/K/Kg] */ MEDIUM_PROP(fluid, volumic_mass, 25.0) /* |kg/m^3] */ -MEDIUM_PROP(fluid, temperature, -1/*<=> unknown*/) /* [K] */ +MEDIUM_PROP(fluid, temperature, SDIS_TEMPERATURE_NONE) /* [K] */ #undef MEDIUM_PROP static struct sdis_medium* @@ -138,7 +138,7 @@ interface_get_temperature struct sdis_data* data) { (void)frag, (void)data;/* Avoid the "unused variable" warning */ - return -1; + return SDIS_TEMPERATURE_NONE; } static double diff --git a/src/test_sdis_enclosure_limit_conditions.c b/src/test_sdis_enclosure_limit_conditions.c @@ -39,7 +39,6 @@ #define CONVECTION_COEF 10 #define DELTA 0.00625 -#define UNKNOWN_TEMPERATURE -1 #define NREALISATIONS 10000 #define Text 360.0 @@ -57,7 +56,7 @@ DEFINE_MEDIUM_GETTER(solid_get_calorific_capacity, 1) DEFINE_MEDIUM_GETTER(solid_get_thermal_conductivity, 1) DEFINE_MEDIUM_GETTER(solid_get_volumic_mass, 1) DEFINE_MEDIUM_GETTER(solid_get_delta, DELTA) -DEFINE_MEDIUM_GETTER(solid_get_temperature, UNKNOWN_TEMPERATURE) +DEFINE_MEDIUM_GETTER(solid_get_temperature, SDIS_TEMPERATURE_NONE) DEFINE_MEDIUM_GETTER(fluid_get_temperature, *((double*)sdis_data_cget(data))) #undef DEFINE_MEDIUM_GETTER diff --git a/src/test_sdis_external_flux.c b/src/test_sdis_external_flux.c @@ -138,7 +138,7 @@ MEDIUM_PROP(medium, volumic_mass, 1700) /* [kj/m^3] */ MEDIUM_PROP(medium, calorific_capacity, 800) /* [J/K/Kg] */ MEDIUM_PROP(solid, thermal_conductivity, 1.15) /* [W/m/K] */ MEDIUM_PROP(solid, delta, 0.1/20.0) /* [m] */ -MEDIUM_PROP(solid, temperature, -1/*<=> unknown*/) /* [K] */ +MEDIUM_PROP(solid, temperature, SDIS_TEMPERATURE_NONE/*<=> unknown*/) /* [K] */ MEDIUM_PROP(fluid, temperature, T_FLUID) /* [K] */ #undef MEDIUM_PROP @@ -188,7 +188,7 @@ struct interface { (void)frag, (void)data; /* Avoid the "unused variable" warning */ \ return Val; \ } -INTERF_PROP(temperature, -1/*<=> unknown*/) /* [K] */ +INTERF_PROP(temperature, SDIS_TEMPERATURE_NONE/*<=> unknown*/) /* [K] */ INTERF_PROP(reference_temperature, T_REF) /* [K] */ #undef INTERF_PROP diff --git a/src/test_sdis_flux.c b/src/test_sdis_flux.c @@ -43,7 +43,6 @@ * (0,0,0) ///// */ -#define UNKNOWN_TEMPERATURE -1 #define N 10000 #define PHI 10.0 @@ -96,7 +95,7 @@ solid_get_temperature (void)data; CHK(vtx != NULL); if(vtx->time > 0) - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; else return T0; } @@ -146,7 +145,7 @@ solve struct sdis_solve_probe_args solve_args = SDIS_SOLVE_PROBE_ARGS_DEFAULT; size_t nreals; size_t nfails; - double ref = -1; + double ref = SDIS_TEMPERATURE_NONE; const int nsimuls = 4; int isimul; enum sdis_scene_dimension dim; @@ -392,7 +391,7 @@ main(int argc, char** argv) /* Create the adiabatic interface */ OK(sdis_data_create(dev, sizeof(struct interf), 16, NULL, &data)); interf_props = sdis_data_get(data); - interf_props->temperature = UNKNOWN_TEMPERATURE; + interf_props->temperature = SDIS_TEMPERATURE_NONE; interf_props->phi = 0; OK(sdis_interface_create (dev, solid, fluid, &interf_shader, data, &interf_adiabatic)); @@ -409,7 +408,7 @@ main(int argc, char** argv) /* Create the PHI interface */ OK(sdis_data_create(dev, sizeof(struct interf), 16, NULL, &data)); interf_props = sdis_data_get(data); - interf_props->temperature = UNKNOWN_TEMPERATURE; + interf_props->temperature = SDIS_TEMPERATURE_NONE; interf_props->phi = PHI; OK(sdis_interface_create (dev, solid, fluid, &interf_shader, data, &interf_phi)); diff --git a/src/test_sdis_flux2.c b/src/test_sdis_flux2.c @@ -16,8 +16,6 @@ #include "sdis.h" #include "test_sdis_utils.h" -#define UNKNOWN_TEMPERATURE -1 - /* This test consists in solving the temperature profile in a solid slab * surrounded by two different convective and radiative temperatures. The * conductivity of the solid material is known, as well as its thickness. A net @@ -175,7 +173,7 @@ solid_get_temperature CHK(vtx && solid); if(vtx->time > 0) { - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } else { /* The initial temperature is a linear profile between T1 and T2, where T1 * and T2 are the temperature on the left and right slab boundary, @@ -489,8 +487,8 @@ main(int argc, char** argv) interf_props.h = 0; interf_props.emissivity = 0; interf_props.phi = SDIS_FLUX_NONE; - interf_props.temperature = UNKNOWN_TEMPERATURE; - interf_props.Tref = UNKNOWN_TEMPERATURE; + interf_props.temperature = SDIS_TEMPERATURE_NONE; + interf_props.Tref = SDIS_TEMPERATURE_NONE; create_interface(dev, solid, dummy, &interf_props, &interfaces[ADIABATIC]); /* Interfaces with a fixed temperature */ @@ -506,7 +504,7 @@ main(int argc, char** argv) interf_props.h = 2; interf_props.emissivity = 1; interf_props.phi = 10000; - interf_props.temperature = UNKNOWN_TEMPERATURE; + interf_props.temperature = SDIS_TEMPERATURE_NONE; interf_props.Tref = 300; create_interface (dev, solid, fluid1, &interf_props, &interfaces[SOLID_FLUID_WITH_FLUX]); @@ -514,7 +512,7 @@ main(int argc, char** argv) interf_props.h = 8; interf_props.emissivity = 1; interf_props.phi = SDIS_FLUX_NONE; - interf_props.temperature = UNKNOWN_TEMPERATURE; + interf_props.temperature = SDIS_TEMPERATURE_NONE; interf_props.Tref = 300; create_interface (dev, solid, fluid2, &interf_props, &interfaces[SOLID_FLUID]); diff --git a/src/test_sdis_flux_with_h.c b/src/test_sdis_flux_with_h.c @@ -107,7 +107,7 @@ solid_get_temperature struct sdis_data* data) { (void)data, (void)vtx; - return -1; + return SDIS_TEMPERATURE_NONE; } static double diff --git a/src/test_sdis_picard.c b/src/test_sdis_picard.c @@ -18,7 +18,6 @@ #include <string.h> -#define UNKNOWN_TEMPERATURE -1 #define N 10000 /* This test consists in solving the stationary temperature profile in a solid @@ -234,7 +233,7 @@ solid_get_temperature (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) { CHK(vtx && data); - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } static double @@ -607,15 +606,15 @@ main(int argc, char** argv) create_fluid(dev, &fluid); /* Create the adiabatic interface for the solid */ - interf_props.temperature = UNKNOWN_TEMPERATURE; + interf_props.temperature = SDIS_TEMPERATURE_NONE; interf_props.h = -1; interf_props.emissivity = -1; interf_props.specular_fraction = -1; - interf_props.Tref = UNKNOWN_TEMPERATURE; + interf_props.Tref = SDIS_TEMPERATURE_NONE; create_interface(dev, solid, dummy, &interf_props, interfaces+ADIABATIC); /* Create the interface between the solid and the fluid */ - interf_props.temperature = UNKNOWN_TEMPERATURE; + interf_props.temperature = SDIS_TEMPERATURE_NONE; interf_props.h = 0; interf_props.emissivity = 1; interf_props.specular_fraction = 0; diff --git a/src/test_sdis_scene.c b/src/test_sdis_scene.c @@ -408,8 +408,8 @@ test_scene_2d(struct sdis_device* dev, struct sdis_interface* interf) BA(sdis_scene_set_temperature_range(NULL, t_range)); BA(sdis_scene_set_temperature_range(scn, NULL)); OK(sdis_scene_set_temperature_range(scn, t_range)); - t_range[0] = -1; - t_range[1] = -1; + t_range[0] = SDIS_TEMPERATURE_NONE; + t_range[1] = SDIS_TEMPERATURE_NONE; OK(sdis_scene_get_temperature_range(scn, t_range)); CHK(t_range[0] == 1); CHK(t_range[1] == 100); diff --git a/src/test_sdis_solid_random_walk_robustness.c b/src/test_sdis_solid_random_walk_robustness.c @@ -24,7 +24,6 @@ #define Hcoef 1.0 /* Convection coefficient */ #define Pw 10000.0 /* Volumetric power */ #define Nreals 10000 /* #realisations */ -#define UNKNOWN -1 /******************************************************************************* * Helper functions @@ -160,7 +159,7 @@ interface_get_temperature interf = sdis_data_cget(data); switch(interf->profile) { case PROFILE_UNKNOWN: - temperature = UNKNOWN; + temperature = SDIS_TEMPERATURE_NONE; break; case PROFILE_VOLUMETRIC_POWER: temperature = volumetric_temperature(frag->P, interf->upper); @@ -305,7 +304,7 @@ main(int argc, char** argv) solid_param->lambda = 10; solid_param->cp = 1.0; solid_param->rho = 1.0; - solid_param->temperature = -1; + solid_param->temperature = SDIS_TEMPERATURE_NONE; solid_param->power = SDIS_VOLUMIC_POWER_NONE; OK(sdis_solid_create(dev, &solid_shader, data, &solid)); OK(sdis_data_ref_put(data)); diff --git a/src/test_sdis_solve_boundary.c b/src/test_sdis_solve_boundary.c @@ -42,7 +42,6 @@ * (0,0,0) ///// */ -#define UNKNOWN_TEMPERATURE -1 #define N 10000 /* #realisations */ #define N_dump 10 /* #dumped paths */ @@ -108,7 +107,7 @@ solid_get_temperature { (void)data; CHK(vtx != NULL); - if(vtx->time > 0) return UNKNOWN_TEMPERATURE; + if(vtx->time > 0) return SDIS_TEMPERATURE_NONE; return Tf; } @@ -237,7 +236,7 @@ main(int argc, char** argv) OK(sdis_data_create(dev, sizeof(struct interf), 16, NULL, &data)); interf_props = sdis_data_get(data); interf_props->hc = 0; - interf_props->temperature = UNKNOWN_TEMPERATURE; + interf_props->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_interface_create (dev, solid, fluid, &interf_shader, data, &interf_adiabatic)); OK(sdis_data_ref_put(data)); @@ -255,7 +254,7 @@ main(int argc, char** argv) OK(sdis_data_create(dev, sizeof(struct interf), 16, NULL, &data)); interf_props = sdis_data_get(data); interf_props->hc = H; - interf_props->temperature = UNKNOWN_TEMPERATURE; + interf_props->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_interface_create (dev, solid, fluid, &interf_shader, data, &interf_H)); OK(sdis_data_ref_put(data)); @@ -419,7 +418,7 @@ main(int argc, char** argv) } /* The external fluid cannot have an unknown temperature */ - fluid_param->temperature = UNKNOWN_TEMPERATURE; + fluid_param->temperature = SDIS_TEMPERATURE_NONE; BA(SOLVE(box_scn, &probe_args, &estimator)); fluid_param->temperature = Tf; @@ -445,7 +444,7 @@ main(int argc, char** argv) } /* The external fluid cannot have an unknown temperature */ - fluid_param->temperature = UNKNOWN_TEMPERATURE; + fluid_param->temperature = SDIS_TEMPERATURE_NONE; BA(SOLVE(square_scn, &probe_args, &estimator)); fluid_param->temperature = Tf; @@ -606,7 +605,7 @@ main(int argc, char** argv) bound_args.register_paths = SDIS_HEAT_PATH_ALL; /* Check simulation error handling when paths are registered */ - fluid_param->temperature = UNKNOWN_TEMPERATURE; + fluid_param->temperature = SDIS_TEMPERATURE_NONE; BA(SOLVE(box_scn, &bound_args, &estimator)); /* Dump path */ diff --git a/src/test_sdis_solve_boundary_flux.c b/src/test_sdis_solve_boundary_flux.c @@ -62,7 +62,6 @@ * (0,0)/////// */ -#define UNKNOWN_TEMPERATURE -1 #define N 100000 /* #realisations */ #define Tf 300.0 @@ -133,7 +132,7 @@ solid_get_temperature { (void) data; CHK(vtx != NULL); - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } /******************************************************************************* @@ -289,7 +288,7 @@ main(int argc, char** argv) OK(sdis_data_create(dev, sizeof(struct interf), 16, NULL, &data)); interf_props = sdis_data_get(data); interf_props->hc = 0; - interf_props->temperature = UNKNOWN_TEMPERATURE; + interf_props->temperature = SDIS_TEMPERATURE_NONE; interf_props->emissivity = 0; OK(sdis_interface_create (dev, solid, fluid, &interf_shader, data, &interf_adiabatic)); @@ -313,7 +312,7 @@ main(int argc, char** argv) OK(sdis_data_create(dev, sizeof(struct interf), 16, NULL, &data)); interf_props = sdis_data_get(data); interf_props->hc = H; - interf_props->temperature = UNKNOWN_TEMPERATURE; + interf_props->temperature = SDIS_TEMPERATURE_NONE; interf_props->emissivity = EPSILON; interf_props->reference_temperature = Tref; interf_shader.back.emissivity = interface_get_emissivity; diff --git a/src/test_sdis_solve_camera.c b/src/test_sdis_solve_camera.c @@ -28,7 +28,6 @@ #include <string.h> -#define UNKOWN_TEMPERATURE -1 #define IMG_WIDTH 157 #define IMG_HEIGHT 53 #define SPP 30 /* #Samples per pixel, i.e. #realisations per pixel */ @@ -152,7 +151,7 @@ struct fluid { double rho; double temperature; }; -static const struct fluid FLUID_NULL = {0, 0, UNKOWN_TEMPERATURE}; +static const struct fluid FLUID_NULL = {0, 0, SDIS_TEMPERATURE_NONE}; static double fluid_get_calorific_capacity @@ -188,7 +187,7 @@ struct solid { double delta; double temperature; }; -static const struct solid SOLID_NULL = {0, 0, 0, 0, UNKOWN_TEMPERATURE}; +static const struct solid SOLID_NULL = {0, 0, 0, 0, SDIS_TEMPERATURE_NONE}; static double solid_get_calorific_capacity @@ -241,7 +240,7 @@ struct interf { double reference_temperature; }; static const struct interf INTERF_NULL = { - 0, 0, 0, UNKOWN_TEMPERATURE, UNKOWN_TEMPERATURE + 0, 0, 0, SDIS_TEMPERATURE_NONE, SDIS_TEMPERATURE_NONE }; static double @@ -595,21 +594,21 @@ main(int argc, char** argv) solid_param.lambda = 0.1; solid_param.rho = 1.0; solid_param.delta = 1.0/20.0; - solid_param.temperature = UNKOWN_TEMPERATURE; + solid_param.temperature = SDIS_TEMPERATURE_NONE; create_solid(dev, &solid_param, &solid); /* Create the fluid0/solid interface */ interface_param.hc = 1; interface_param.epsilon = 0; interface_param.specular_fraction = 0; - interface_param.temperature = UNKOWN_TEMPERATURE; + interface_param.temperature = SDIS_TEMPERATURE_NONE; create_interface(dev, solid, fluid0, &interface_param, &interf0); /* Create the fluid1/solid interface */ interface_param.hc = 0.1; interface_param.epsilon = 1; interface_param.specular_fraction = 1; - interface_param.temperature = UNKOWN_TEMPERATURE; + interface_param.temperature = SDIS_TEMPERATURE_NONE; interface_param.reference_temperature = 300; create_interface(dev, fluid1, solid, &interface_param, &interf1); @@ -674,7 +673,7 @@ main(int argc, char** argv) BA(sdis_solve_camera(scn, &solve_args, &buf)); solve_args.cam = cam; OK(sdis_scene_get_ambient_radiative_temperature(scn, &trad)); - trad.temperature = -1; + trad.temperature = SDIS_TEMPERATURE_NONE; OK(sdis_scene_set_ambient_radiative_temperature(scn, &trad)); BA(sdis_solve_camera(scn, &solve_args, &buf)); trad.temperature = 300; @@ -767,7 +766,7 @@ main(int argc, char** argv) solve_args.rng_type = SDIS_SOLVE_CAMERA_ARGS_DEFAULT.rng_type; pfluid_param = sdis_data_get(sdis_medium_get_data(fluid1)); - pfluid_param->temperature = UNKOWN_TEMPERATURE; + pfluid_param->temperature = SDIS_TEMPERATURE_NONE; /* Check simulation error handling */ BA(sdis_solve_camera(scn, &solve_args, &buf)); diff --git a/src/test_sdis_solve_medium.c b/src/test_sdis_solve_medium.c @@ -272,7 +272,7 @@ main(int argc, char** argv) solid_param->lambda = 0.1; solid_param->rho = 1.0; solid_param->delta = 1.0/20.0; - solid_param->temperature = -1; /* Unknown temperature */ + solid_param->temperature = SDIS_TEMPERATURE_NONE; /* Unknown temperature */ OK(sdis_solid_create(dev, &solid_shader, data, &solid0)); OK(sdis_data_ref_put(data)); @@ -284,7 +284,7 @@ main(int argc, char** argv) solid_param->lambda = 1.0; solid_param->rho = 1.0; solid_param->delta = 1.0/20.0; - solid_param->temperature = -1; /* Unknown temperature */ + solid_param->temperature = SDIS_TEMPERATURE_NONE; /* Unknown temperature */ OK(sdis_solid_create(dev, &solid_shader, data, &solid1)); OK(sdis_data_ref_put(data)); @@ -403,7 +403,7 @@ main(int argc, char** argv) /* Check simulation error handling when paths are registered */ solve_args.nrealisations = 10; solve_args.register_paths = SDIS_HEAT_PATH_ALL; - fluid_param->temperature = -1; + fluid_param->temperature = SDIS_TEMPERATURE_NONE; BA(sdis_solve_medium(scn, &solve_args, &estimator)); fluid_param->temperature = Tf1; OK(sdis_solve_medium(scn, &solve_args, &estimator)); diff --git a/src/test_sdis_solve_medium_2d.c b/src/test_sdis_solve_medium_2d.c @@ -256,7 +256,7 @@ main(int argc, char** argv) solid_param->lambda = 0.1; solid_param->rho = 1.0; solid_param->delta = 1.0/20.0; - solid_param->temperature = -1; /* Unknown temperature */ + solid_param->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_solid_create(dev, &solid_shader, data, &solid0)); OK(sdis_data_ref_put(data)); @@ -268,7 +268,7 @@ main(int argc, char** argv) solid_param->lambda = 1.0; solid_param->rho = 1.0; solid_param->delta = 1.0/20.0; - solid_param->temperature = -1; /* Unknown temperature */ + solid_param->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_solid_create(dev, &solid_shader, data, &solid1)); OK(sdis_data_ref_put(data)); diff --git a/src/test_sdis_solve_probe.c b/src/test_sdis_solve_probe.c @@ -329,7 +329,7 @@ main(int argc, char** argv) solid_param->lambda = 0.1; solid_param->rho = 1.0; solid_param->delta = 1.0/20.0; - solid_param->temperature = -1; /* Unknown temperature */ + solid_param->temperature = SDIS_TEMPERATURE_NONE; /* Unknown temperature */ solid_shader.calorific_capacity = solid_get_calorific_capacity; solid_shader.thermal_conductivity = solid_get_thermal_conductivity; solid_shader.volumic_mass = solid_get_volumic_mass; @@ -457,7 +457,7 @@ main(int argc, char** argv) OK(sdis_estimator_ref_put(estimator)); /* The external fluid cannot have an unknown temperature */ - fluid_param->temperature = -1; + fluid_param->temperature = SDIS_TEMPERATURE_NONE; BA(sdis_solve_probe(scn, &solve_args, &estimator)); fluid_param->temperature = 300; @@ -571,7 +571,7 @@ main(int argc, char** argv) solve_args.register_paths = SDIS_HEAT_PATH_ALL; /* Check simulation error handling when paths are registered */ - fluid_param->temperature = -1; + fluid_param->temperature = SDIS_TEMPERATURE_NONE; BA(sdis_solve_probe(scn, &solve_args, &estimator)); fluid_param->temperature = 300; diff --git a/src/test_sdis_solve_probe2.c b/src/test_sdis_solve_probe2.c @@ -78,7 +78,7 @@ temperature_unknown(const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) { (void)data; CHK(vtx != NULL && IS_INF(vtx->time)); - return -1; + return SDIS_TEMPERATURE_NONE; } static double diff --git a/src/test_sdis_solve_probe2_2d.c b/src/test_sdis_solve_probe2_2d.c @@ -72,7 +72,7 @@ temperature_unknown(const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) { (void)data; CHK(vtx != NULL); - return -1; + return SDIS_TEMPERATURE_NONE; } static double diff --git a/src/test_sdis_solve_probe3.c b/src/test_sdis_solve_probe3.c @@ -97,7 +97,7 @@ temperature_unknown(const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) { (void)data; CHK(vtx != NULL); - return -1; + return SDIS_TEMPERATURE_NONE; } static double diff --git a/src/test_sdis_solve_probe3_2d.c b/src/test_sdis_solve_probe3_2d.c @@ -94,7 +94,7 @@ temperature_unknown(const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) { (void)data; CHK(vtx != NULL); - return -1; + return SDIS_TEMPERATURE_NONE; } static double diff --git a/src/test_sdis_solve_probe_2d.c b/src/test_sdis_solve_probe_2d.c @@ -116,7 +116,7 @@ solid_get_temperature (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) { (void)vtx, (void)data; - return -1; + return SDIS_TEMPERATURE_NONE; } static double @@ -234,7 +234,7 @@ main(int argc, char** argv) OK(sdis_green_function_ref_put(green)); /* The external fluid cannot have an unknown temperature */ - fluid_param->temperature = -1; + fluid_param->temperature = SDIS_TEMPERATURE_NONE; BA(sdis_solve_probe(scn, &solve_args, &estimator)); diff --git a/src/test_sdis_solve_probe_boundary_list.c b/src/test_sdis_solve_probe_boundary_list.c @@ -157,7 +157,7 @@ mesh_add_sphere(struct mesh* mesh) SOLID_PROP(calorific_capacity, 500.0) /* [J/K/Kg] */ SOLID_PROP(thermal_conductivity, 25.0) /* [W/m/K] */ SOLID_PROP(volumic_mass, 7500.0) /* [kg/m^3] */ -SOLID_PROP(temperature, -1/*<=> unknown*/) /* [K] */ +SOLID_PROP(temperature, SDIS_TEMPERATURE_NONE/*<=> unknown*/) /* [K] */ SOLID_PROP(delta, 1.0/20.0) /* [m] */ static struct sdis_medium* diff --git a/src/test_sdis_solve_probe_list.c b/src/test_sdis_solve_probe_list.c @@ -310,7 +310,7 @@ create_scene SOLID_PROP(calorific_capacity, 500.0) /* [J/K/Kg] */ SOLID_PROP(thermal_conductivity, 25.0) /* [W/m/K] */ SOLID_PROP(volumic_mass, 7500.0) /* [kg/m^3] */ -SOLID_PROP(temperature, -1/*<=> unknown*/) /* [K] */ +SOLID_PROP(temperature, SDIS_TEMPERATURE_NONE) /* [K] */ #undef SOLID_PROP static double diff --git a/src/test_sdis_transcient.c b/src/test_sdis_transcient.c @@ -18,8 +18,6 @@ #include <string.h> -#define UNKNOWN_TEMPERATURE -1 - /* * The scene is composed of a solid cuboid whose temperature is fixed on its 6 * faces. The test consist in checking that the estimated temperature at a @@ -225,7 +223,7 @@ solid_get_temperature if(vtx->time <= 0) { return ((const struct solid*)sdis_data_cget(data))->init_temperature; } else { - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } } @@ -542,7 +540,7 @@ main(int argc, char** argv) interfs[3] = create_interface(dev, solid, fluid, &interf_shader, Tbounds[3]); interfs[4] = create_interface(dev, solid, fluid, &interf_shader, Tbounds[4]); interfs[5] = create_interface(dev, solid, fluid, &interf_shader, Tbounds[5]); - interfs[6] = create_interface(dev, solid, solid, &interf_shader, UNKNOWN_TEMPERATURE); + interfs[6] = create_interface(dev, solid, solid, &interf_shader, SDIS_TEMPERATURE_NONE); /* Setup the box scene context */ ctx.indices = box_indices; diff --git a/src/test_sdis_unstationary_atm.c b/src/test_sdis_unstationary_atm.c @@ -60,8 +60,6 @@ #define T0_SOLID 300 #define T0_FLUID 300 -#define UNKNOWN_TEMPERATURE -1 - #define N 10000 /* #realisations */ #define TG 310 @@ -275,7 +273,7 @@ solid_get_temperature solid = ((struct solid*)sdis_data_cget(data)); if(vtx->time <= solid->t0) return solid->temperature; - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } struct fluid { @@ -294,7 +292,7 @@ fluid_get_temperature fluid = ((struct fluid*)sdis_data_cget(data)); if(vtx->time <= fluid->t0) return fluid->temperature; - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } static double @@ -756,7 +754,7 @@ main(int argc, char** argv) solid_props->rho = 1; solid_props->delta = 1; solid_props->t0 = INF; - solid_props->temperature = UNKNOWN_TEMPERATURE; + solid_props->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_solid_create(dev, &solid_shader, data, &dummy_solid)); OK(sdis_data_ref_put(data)); @@ -786,7 +784,7 @@ main(int argc, char** argv) OK(sdis_data_ref_put(data)); /* Create the adiabatic interfaces */ - interf_props.temperature = UNKNOWN_TEMPERATURE; + interf_props.temperature = SDIS_TEMPERATURE_NONE; interf_props.h = 0; interf_props.emissivity = 0; interf_props.Tref = TREF; @@ -794,7 +792,7 @@ main(int argc, char** argv) create_interface(dev, solid, dummy_solid, &interf_props, &interf_adiabatic_2); /* Create the P interface */ - interf_props.temperature = UNKNOWN_TEMPERATURE; + interf_props.temperature = SDIS_TEMPERATURE_NONE; interf_props.h = HC; interf_props.emissivity = 1; interf_props.Tref = TREF; @@ -808,7 +806,7 @@ main(int argc, char** argv) create_interface(dev, fluid, dummy_solid, &interf_props, &interf_TG); /* Create the TA interface */ - interf_props.temperature = UNKNOWN_TEMPERATURE; + interf_props.temperature = SDIS_TEMPERATURE_NONE; interf_props.h = HA; interf_props.emissivity = 1; interf_props.Tref = TREF; diff --git a/src/test_sdis_unsteady.c b/src/test_sdis_unsteady.c @@ -88,7 +88,7 @@ solid_get_temperature (void)data; ASSERT(vtx); if(vtx->time <= 0) return T_INIT; /* Initial temperature [K] */ - return -1; /* Unknown temperature */ + return SDIS_TEMPERATURE_NONE; } static struct sdis_medium* diff --git a/src/test_sdis_unsteady_1d.c b/src/test_sdis_unsteady_1d.c @@ -84,7 +84,7 @@ solid_get_temperature (void)data; ASSERT(vtx); if(vtx->time <= 0) return T_INIT; /* Initial temperature [K] */ - return -1; /* Unknown temperature */ + return SDIS_TEMPERATURE_NONE; /* Unknown temperature */ } static struct sdis_medium* @@ -132,8 +132,8 @@ interface_get_temperature if(frag->Ng[0] == 1) return T0; else if(frag->Ng[0] == -1) return T1; - else if(frag->Ng[1] == 1) return -1; /* Unknown temperature */ - else if(frag->Ng[1] == -1) return -1; /* Unknown temperature */ + else if(frag->Ng[1] == 1) return SDIS_TEMPERATURE_NONE; + else if(frag->Ng[1] == -1) return SDIS_TEMPERATURE_NONE; else FATAL("Unreachable code\n"); } diff --git a/src/test_sdis_volumic_power.c b/src/test_sdis_volumic_power.c @@ -45,7 +45,6 @@ * (0,0,0) ///// */ -#define UNKNOWN_TEMPERATURE -1 #define N 10000 /* #realisations */ #define T0 320 @@ -72,7 +71,7 @@ fluid_get_temperature { (void)data; CHK(vtx != NULL); - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } static double @@ -116,7 +115,7 @@ solid_get_temperature CHK(data != NULL); t0 = ((const struct solid*)sdis_data_cget(data))->t0; if(vtx->time > t0) { - return UNKNOWN_TEMPERATURE; + return SDIS_TEMPERATURE_NONE; } else { return ((const struct solid*)sdis_data_cget(data))->initial_temperature; } @@ -174,7 +173,7 @@ solve struct sdis_mc time = SDIS_MC_NULL; size_t nreals; size_t nfails; - double ref = -1; + double ref = SDIS_TEMPERATURE_NONE; enum sdis_scene_dimension dim; const int nsimuls = 4; int isimul; @@ -466,7 +465,7 @@ main(int argc, char** argv) /* Create the adiabatic interface */ OK(sdis_data_create(dev, sizeof(struct interf), 16, NULL, &data)); interf_props = sdis_data_get(data); - interf_props->temperature = UNKNOWN_TEMPERATURE; + interf_props->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_interface_create (dev, solid, fluid, &interf_shader, data, &interf_adiabatic)); OK(sdis_data_ref_put(data)); diff --git a/src/test_sdis_volumic_power2.c b/src/test_sdis_volumic_power2.c @@ -19,7 +19,6 @@ #define N 10000 /* #realisations */ #define Pw 10000 /* Volumic power */ -#define NONE -1 #define DELTA 0.01 #define DELTA_PSQUARE 0.01 @@ -294,10 +293,10 @@ main(int argc, char** argv) {{0,-0.55, 0}, 90.250, 90.040} }; const struct reference refs2[] = { /* Lambda1=0.1, Lambda2=10, Pw=10000 */ - {{0, 0.85}, 678.170, -1}, - {{0, 0.65}, 1520.84, -1}, - {{0, 0.45}, 1794.57, -1}, - {{0, 0.25}, 1429.74, -1} + {{0, 0.85}, 678.170, 0}, + {{0, 0.65}, 1520.84, 0}, + {{0, 0.45}, 1794.57, 0}, + {{0, 0.25}, 1429.74, 0} }; (void)argc, (void)argv; @@ -341,7 +340,7 @@ main(int argc, char** argv) solid_param->lambda = 1; solid_param->delta = DELTA; solid_param->P = SDIS_VOLUMIC_POWER_NONE; - solid_param->T = -1; + solid_param->T = SDIS_TEMPERATURE_NONE; OK(sdis_solid_create(dev, &solid_shader, data, &solid1)); OK(sdis_data_ref_put(data)); @@ -354,7 +353,7 @@ main(int argc, char** argv) solid_param->lambda = 10; solid_param->delta = DELTA_PSQUARE; solid_param->P = Pw; - solid_param->T = -1; + solid_param->T = SDIS_TEMPERATURE_NONE; OK(sdis_solid_create(dev, &solid_shader, data, &solid2)); OK(sdis_data_ref_put(data)); @@ -387,7 +386,7 @@ main(int argc, char** argv) NULL, &data)); interf_param = sdis_data_get(data); interf_param->h = 5; - interf_param->temperature = NONE; + interf_param->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_interface_create(dev, solid1, fluid1, &interf_shader, data, &interf_solid1_fluid1)); OK(sdis_data_ref_put(data)); @@ -397,7 +396,7 @@ main(int argc, char** argv) NULL, &data)); interf_param = sdis_data_get(data); interf_param->h = 10; - interf_param->temperature = NONE; + interf_param->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_interface_create(dev, solid1, fluid2, &interf_shader, data, &interf_solid1_fluid2)); OK(sdis_data_ref_put(data)); diff --git a/src/test_sdis_volumic_power2_2d.c b/src/test_sdis_volumic_power2_2d.c @@ -19,11 +19,10 @@ #define N 10000 /* #realisations */ #define Pw 10000 /* Volumic power */ -#define NONE -1 /* H delta T */ -#define Tboundary1 NONE -#define Tboundary2 NONE +#define Tboundary1 SDIS_TEMPERATURE_NONE +#define Tboundary2 SDIS_TEMPERATURE_NONE #define DELTA 0.01 #define Tref 286.83 /* In Celsius. Computed with Syrthes at the position 0.5 */ @@ -373,7 +372,7 @@ main(int argc, char** argv) solid_param->lambda = 1; solid_param->delta = DELTA; solid_param->P = SDIS_VOLUMIC_POWER_NONE; - solid_param->T = -1; + solid_param->T = SDIS_TEMPERATURE_NONE; OK(sdis_solid_create(dev, &solid_shader, data, &solid1)); OK(sdis_data_ref_put(data)); @@ -386,7 +385,7 @@ main(int argc, char** argv) solid_param->lambda = 10; solid_param->delta = DELTA; solid_param->P = Pw; - solid_param->T = -1; + solid_param->T = SDIS_TEMPERATURE_NONE; OK(sdis_solid_create(dev, &solid_shader, data, &solid2)); OK(sdis_data_ref_put(data)); diff --git a/src/test_sdis_volumic_power3_2d.c b/src/test_sdis_volumic_power3_2d.c @@ -41,11 +41,10 @@ #define Tb 1207.1122 /* Fixed temperatures */ -#define UNKNOWN_TEMPERATURE -1 -#define Tsolid1_fluid UNKNOWN_TEMPERATURE /*Tp1*/ -#define Tsolid2_fluid UNKNOWN_TEMPERATURE /*Tp2*/ -#define Tsolid_solid1 UNKNOWN_TEMPERATURE /*Ta*/ -#define Tsolid_solid2 UNKNOWN_TEMPERATURE /*Tb*/ +#define Tsolid1_fluid SDIS_TEMPERATURE_NONE /*Tp1*/ +#define Tsolid2_fluid SDIS_TEMPERATURE_NONE /*Tp2*/ +#define Tsolid_solid1 SDIS_TEMPERATURE_NONE /*Ta*/ +#define Tsolid_solid2 SDIS_TEMPERATURE_NONE /*Tb*/ #define PROBE_POS 1.8 @@ -304,7 +303,7 @@ main(int argc, char** argv) solid_param->lambda = LAMBDA1; solid_param->delta = DELTA1; solid_param->volumic_power = SDIS_VOLUMIC_POWER_NONE; - solid_param->temperature = -1; + solid_param->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_solid_create(dev, &solid_shader, data, &solid1)); OK(sdis_data_ref_put(data)); @@ -317,7 +316,7 @@ main(int argc, char** argv) solid_param->lambda = LAMBDA2; solid_param->delta = DELTA2; solid_param->volumic_power = SDIS_VOLUMIC_POWER_NONE; - solid_param->temperature = -1; + solid_param->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_solid_create(dev, &solid_shader, data, &solid2)); OK(sdis_data_ref_put(data)); @@ -330,7 +329,7 @@ main(int argc, char** argv) solid_param->lambda = LAMBDA; solid_param->delta = DELTA; solid_param->volumic_power = Pw; - solid_param->temperature = -1; + solid_param->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_solid_create(dev, &solid_shader, data, &solid)); OK(sdis_data_ref_put(data)); @@ -363,7 +362,7 @@ main(int argc, char** argv) NULL, &data)); interf_param = sdis_data_get(data); interf_param->h = 0; - interf_param->temperature = -1; + interf_param->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_interface_create(dev, solid, fluid, &interf_shader, data, &interf_solid_adiabatic)); OK(sdis_interface_create(dev, solid1, fluid, &interf_shader, data, diff --git a/src/test_sdis_volumic_power4.c b/src/test_sdis_volumic_power4.c @@ -270,7 +270,7 @@ main(int argc, char** argv) solid_param->lambda = LAMBDA; solid_param->delta = DELTA; solid_param->volumic_power = Power; - solid_param->temperature = -1; + solid_param->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_solid_create(dev, &solid_shader, data, &solid)); OK(sdis_data_ref_put(data)); @@ -283,7 +283,7 @@ main(int argc, char** argv) NULL, &data)); interf_param = sdis_data_get(data); interf_param->h = 0; - interf_param->temperature = -1; + interf_param->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_interface_create(dev, solid, fluid1, &interf_shader, data, &interf_adiabatic)); OK(sdis_data_ref_put(data)); @@ -293,7 +293,7 @@ main(int argc, char** argv) NULL, &data)); interf_param = sdis_data_get(data); interf_param->h = H; - interf_param->temperature = -1; + interf_param->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_interface_create(dev, solid, fluid1, &interf_shader, data, &interf_solid_fluid1)); OK(sdis_data_ref_put(data)); @@ -303,7 +303,7 @@ main(int argc, char** argv) NULL, &data)); interf_param = sdis_data_get(data); interf_param->h = H; - interf_param->temperature = -1; + interf_param->temperature = SDIS_TEMPERATURE_NONE; OK(sdis_interface_create(dev, solid, fluid2, &interf_shader, data, &interf_solid_fluid2)); OK(sdis_data_ref_put(data));