commit 7c8d95eda05df1e7a4cb7231909a698f59eb6762
parent 3dcb5bfc1e471c40dd1051f36d088da3d62beac5
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 8 Apr 2024 11:25:07 +0200
Unknown temperature management updated
Stardis-Solver no longer uses negative values to define that a
temperature is unknown (commit Stardis-solver 75ae9b8). It now provides
the SDIS_TEMPERATURE_NONE macro. In fact, negative temperatures are now
valid for Stardis-Solver to calculate a relative temperature at a given
T in a linear situation.
This is a major break in the API, since the same entries before and
after the above-mentioned commit can correspond to two different
systems. This commit therefore replaces all negative values used as
unknown temperature with the new constant SDIS_TEMPERATURE_NONE.
We also correct the use of a negative value to define an unknown flux
when it should be set to SDIS_FLUX_NONE.
Diffstat:
9 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/stardis-app.h b/src/stardis-app.h
@@ -57,7 +57,7 @@ struct fluid;
#define DELTA_AUTO INF /* Placeholder until actual value is substituted */
-#define UNKNOWN_MEDIUM_TEMPERATURE -1 /* Unknown for stardis solver is -1 */
+#define UNKNOWN_MEDIUM_TEMPERATURE SDIS_TEMPERATURE_NONE
enum properties_conflict_t {
NO_PROPERTY_CONFLICT,
diff --git a/src/stardis-fbound.c b/src/stardis-fbound.c
@@ -45,7 +45,7 @@ init_f_boundary
str_init(allocator, &(*dst)->name);
str_initialized = 1;
(*dst)->mat_id = UINT_MAX;
- (*dst)->imposed_flux = -1;
+ (*dst)->imposed_flux = SDIS_FLUX_NONE;
end:
return res;
error:
diff --git a/src/stardis-fluid.c b/src/stardis-fluid.c
@@ -67,7 +67,7 @@ fluid_get_temperature
}
return (*fluid_props)->tinit;
}
- return -1; /* Unknown temperature */
+ return SDIS_TEMPERATURE_NONE; /* Unknown temperature */
}
/*******************************************************************************
@@ -122,8 +122,8 @@ init_fluid(struct mem_allocator* allocator, struct fluid** dst)
str_initialized = 1;
(*dst)->rho = 1;
(*dst)->cp = 1;
- (*dst)->tinit = -1;
- (*dst)->imposed_temperature = -1;
+ (*dst)->tinit = SDIS_TEMPERATURE_NONE;
+ (*dst)->imposed_temperature = SDIS_TEMPERATURE_NONE;
(*dst)->t0 = 0;
(*dst)->is_outside = 0;
(*dst)->is_green = 0;
diff --git a/src/stardis-hbound.c b/src/stardis-hbound.c
@@ -44,7 +44,7 @@ init_h_boundary
}
str_init(allocator, &(*dst)->name);
str_initialized = 1;
- (*dst)->imposed_temperature = -1;
+ (*dst)->imposed_temperature = SDIS_TEMPERATURE_NONE;
(*dst)->mat_id = UINT_MAX;
end:
return res;
diff --git a/src/stardis-hfbound.c b/src/stardis-hfbound.c
@@ -44,7 +44,7 @@ init_hf_boundary
}
str_init(allocator, &(*dst)->name);
str_initialized = 1;
- (*dst)->imposed_temperature = -1;
+ (*dst)->imposed_temperature = SDIS_TEMPERATURE_NONE;
(*dst)->mat_id = UINT_MAX;
end:
return res;
diff --git a/src/stardis-intface.c b/src/stardis-intface.c
@@ -283,7 +283,7 @@ create_intface
ERR(sdis_data_create(stardis->dev, sizeof(struct intface),
ALIGNOF(struct intface), NULL, &data));
interface_props = sdis_data_get(data);
- interface_props->imposed_temperature = -1;
+ interface_props->imposed_temperature = SDIS_TEMPERATURE_NONE;
interface_props->imposed_flux = SDIS_FLUX_NONE;
interface_props->front_medium_id = UINT_MAX;
interface_props->back_medium_id = UINT_MAX;
diff --git a/src/stardis-solid.c b/src/stardis-solid.c
@@ -98,7 +98,7 @@ solid_get_temperature
}
return (*solid_props)->tinit;
}
- return -1; /* Unknown temperature */
+ return SDIS_TEMPERATURE_NONE;
}
static double
@@ -171,8 +171,8 @@ init_solid(struct mem_allocator* allocator, struct solid** dst)
(*dst)->rho = 1;
(*dst)->cp = 1;
(*dst)->delta = 1;
- (*dst)->tinit = -1;
- (*dst)->imposed_temperature = -1;
+ (*dst)->tinit = SDIS_TEMPERATURE_NONE;
+ (*dst)->imposed_temperature = SDIS_TEMPERATURE_NONE;
(*dst)->vpower = SDIS_VOLUMIC_POWER_NONE;
(*dst)->t0 = 0;
(*dst)->is_outside = 0;
diff --git a/src/stardis-solid.h b/src/stardis-solid.h
@@ -32,7 +32,7 @@ struct solid {
double cp; /* Calorific capacity */
double delta; /* Numerical parameter */
double tinit; /* Initial temperature */
- double imposed_temperature; /* allow to impose a T; -1 if unset */
+ double imposed_temperature; /* Impose a T; SDIS_TEMPERATURE_NONE if unset */
double vpower;
double t0; /* End time of tinit */
int is_outside; /* the solid is used for a boundary */
diff --git a/src/stardis-tbound.c b/src/stardis-tbound.c
@@ -44,7 +44,7 @@ init_t_boundary
}
str_init(allocator, &(*dst)->name);
str_initialized = 1;
- (*dst)->imposed_temperature = -1;
+ (*dst)->imposed_temperature = SDIS_TEMPERATURE_NONE;
(*dst)->mat_id = UINT_MAX;
end:
return res;