commit 0c8e10d74898c9d1d217796de30e2ee080eae2cc
parent 394046dfc0ff56b2c651cea8473d6083c2c40ac1
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Thu, 14 Oct 2021 16:25:15 +0200
Remove DESC_BOUND_T_FOR_FLUID from descrition file grammar
This boundary was exactly the same than DESC_BOUND_H_FOR_FLUID that should now be used instead
Diffstat:
6 files changed, 9 insertions(+), 97 deletions(-)
diff --git a/doc/stardis-input.5.txt b/doc/stardis-input.5.txt
@@ -93,7 +93,6 @@ _______
| <fluid-frontier>
<medium-boundary> ::= <t-bound-for-solid>
- | <t-bound-for-fluid>
| <h-bound-for-solid>
| <h-bound-for-fluid>
| <f-bound-for-solid>
@@ -117,8 +116,6 @@ _______
<t-bound-for-solid> ::= "T_BOUNDARY_FOR_SOLID" <bound-name> <temperature> \
<triangles>
-<t-bound-for-fluid> ::= "T_BOUNDARY_FOR_FLUID" <bound-name> <temperature> \
- <emissivity> <specular-fraction> <hc> <triangles>
<h-bound-for-solid> ::= "H_BOUNDARY_FOR_SOLID" <bound-name> <emissivity> \
<specular-fraction> <hc> <outside-temperature> \
diff --git a/src/stardis-app.c b/src/stardis-app.c
@@ -536,18 +536,6 @@ validate_properties
goto end;
}
break;
- case DESC_BOUND_T_FOR_FLUID:
- if(!(solid_count == 0 && fluid_count == 1)) {
- if(solid_count + fluid_count == 2)
- *properties_conflict_status = BOUND_T_FOR_FLUID_BETWEEN_2_DEFS;
- else if(solid_count + fluid_count == 0)
- *properties_conflict_status = BOUND_T_FOR_FLUID_BETWEEN_2_UNDEFS;
- else if(solid_count == 1)
- *properties_conflict_status = BOUND_T_FOR_FLUID_ENCLOSING_SOLID;
- else FATAL("error:" STR(__FILE__) ":" STR(__LINE__)"\n");
- goto end;
- }
- break;
case DESC_BOUND_T_FOR_SOLID:
if(!(solid_count == 1 && fluid_count == 0)) {
if(solid_count + fluid_count == 2)
diff --git a/src/stardis-app.h b/src/stardis-app.h
@@ -102,7 +102,6 @@ enum description_type {
DESC_MAT_FLUID,
DESC_BOUND_H_FOR_FLUID,
DESC_BOUND_H_FOR_SOLID,
- DESC_BOUND_T_FOR_FLUID,
DESC_BOUND_T_FOR_SOLID,
DESC_BOUND_F_FOR_SOLID,
DESC_SOLID_FLUID_CONNECT,
@@ -114,7 +113,7 @@ enum description_type {
#define DESC_IS_H(D) \
((D) == DESC_BOUND_H_FOR_SOLID || (D) == DESC_BOUND_H_FOR_FLUID)
#define DESC_IS_T(D) \
- ((D) == DESC_BOUND_T_FOR_SOLID || (D) == DESC_BOUND_T_FOR_FLUID)
+ ((D) == DESC_BOUND_T_FOR_SOLID)
#define DESC_IS_F(D) \
((D) == DESC_BOUND_F_FOR_SOLID)
#define DESC_IS_MEDIUM(D) \
@@ -291,10 +290,6 @@ str_print_t_boundary
ARG3( (type == DESC_BOUND_T_FOR_SOLID ? "solid" : "fluid"),
str_cget(&b->name), b->imposed_temperature ) );
- if(type == DESC_BOUND_T_FOR_FLUID) {
- STR_APPEND_PRINTF(str, "emissivity=%g, specular_fraction=%g hc=%g ",
- ARG3( b->emissivity, b->specular_fraction, b->hc ) );
- }
STR_APPEND_PRINTF(str, "(using medium %u as external medium)",
ARG1( b->mat_id ) );
end:
@@ -505,7 +500,6 @@ release_description(struct description* desc)
release_h_boundary(&desc->d.h_boundary);
break;
case DESC_BOUND_T_FOR_SOLID:
- case DESC_BOUND_T_FOR_FLUID:
release_t_boundary(&desc->d.t_boundary);
break;
case DESC_BOUND_F_FOR_SOLID:
@@ -540,7 +534,6 @@ str_print_description
ERR(str_print_fluid(str, &desc->d.fluid));
break;
case DESC_BOUND_T_FOR_SOLID:
- case DESC_BOUND_T_FOR_FLUID:
ERR(str_print_t_boundary(str, &desc->d.t_boundary, desc->type));
break;
case DESC_BOUND_H_FOR_SOLID:
@@ -576,7 +569,6 @@ get_description_name
case DESC_MAT_FLUID:
return &desc->d.fluid.name;
case DESC_BOUND_T_FOR_SOLID:
- case DESC_BOUND_T_FOR_FLUID:
return &desc->d.t_boundary.name;
case DESC_BOUND_H_FOR_SOLID:
case DESC_BOUND_H_FOR_FLUID:
@@ -623,7 +615,6 @@ cp_description
ERR(cp_h_boundary(&dst->d.h_boundary, &src->d.h_boundary));
break;
case DESC_BOUND_T_FOR_SOLID:
- case DESC_BOUND_T_FOR_FLUID:
if(dst->type == DESCRIPTION_TYPE_COUNT__) {
dst->type = src->type;
init_t(src->d.t_boundary.name.allocator, &dst->d.t_boundary);
@@ -678,7 +669,6 @@ description_get_medium_id
*id = desc->d.h_boundary.mat_id;
return;
case DESC_BOUND_T_FOR_SOLID:
- case DESC_BOUND_T_FOR_FLUID:
*id = desc->d.t_boundary.mat_id;
return;
case DESC_BOUND_F_FOR_SOLID:
diff --git a/src/stardis-intface.c b/src/stardis-intface.c
@@ -255,37 +255,14 @@ create_intface
fluid_side_shader->specular_fraction = interface_get_alpha;
}
break;
- case DESC_BOUND_T_FOR_FLUID:
- if(sdis_medium_get_type(def_medium) != SDIS_FLUID) {
- res = RES_BAD_ARG;
- goto error;
- }
- type_checked = 1;
- interface_shader.convection_coef_upper_bound = connect->d.t_boundary.hc;
- interface_props->hc = connect->d.t_boundary.hc;
- if(connect->d.t_boundary.hc > 0) {
- ASSERT(connect->type == DESC_BOUND_T_FOR_FLUID);
- interface_shader.convection_coef = interface_get_convection_coef;
- }
- interface_props->emissivity = connect->d.t_boundary.emissivity;
- interface_props->alpha = connect->d.t_boundary.specular_fraction;
- if(connect->d.t_boundary.emissivity > 0) {
- ASSERT(fluid_side_shader);
- fluid_side_shader->emissivity = interface_get_emissivity;
- fluid_side_shader->specular_fraction = interface_get_alpha;
- }
- /* fall through */
case DESC_BOUND_T_FOR_SOLID:
- if(!type_checked
- && sdis_medium_get_type(def_medium) != SDIS_SOLID)
- {
+ if(sdis_medium_get_type(def_medium) != SDIS_SOLID) {
res = RES_BAD_ARG;
goto error;
}
ext_id = connect->d.t_boundary.mat_id; /* External material id */
ASSERT(ext_id < darray_media_ptr_size_get(&stardis->media));
- ASSERT(sdis_medium_get_type(media[ext_id])
- == (connect->type == DESC_BOUND_T_FOR_FLUID ? SDIS_SOLID: SDIS_FLUID));
+ ASSERT(sdis_medium_get_type(media[ext_id]) == SDIS_FLUID);
connection_count++;
boundary_count++;
if(front_defined) {
diff --git a/src/stardis-output.c b/src/stardis-output.c
@@ -95,7 +95,6 @@ merge_flux_terms
switch (descs[desc_id].type) {
case DESC_BOUND_T_FOR_SOLID:
- case DESC_BOUND_T_FOR_FLUID:
case DESC_BOUND_H_FOR_SOLID:
case DESC_BOUND_H_FOR_FLUID:
FATAL("Cannot have a flux term here.\n"); break;
@@ -807,7 +806,6 @@ print_sample
desc_id = d__->desc_id;
switch (descs[desc_id].type) {
case DESC_BOUND_T_FOR_SOLID:
- case DESC_BOUND_T_FOR_FLUID:
fprintf(w_ctx->stream, "T\t%u", desc_id);
break;
case DESC_BOUND_H_FOR_SOLID:
@@ -984,8 +982,8 @@ dump_green_ascii
FOR_EACH(i, 0, szd) {
const struct description* desc = descs + i;
const struct t_boundary* bd;
- if(desc->type != DESC_BOUND_T_FOR_SOLID
- && desc->type != DESC_BOUND_T_FOR_FLUID) continue;
+ if(desc->type != DESC_BOUND_T_FOR_SOLID)
+ continue;
bd = &desc->d.t_boundary;
fprintf(stream, "%u\t%s\t%g\n",
i, str_cget(&bd->name), bd->imposed_temperature);
diff --git a/src/stardis-parsing.c b/src/stardis-parsing.c
@@ -1306,13 +1306,11 @@ error:
goto end;
}
-/* T_BOUNDARY_FOR_SOLID Name T STL_filenames
- * T_BOUNDARY_FOR_FLUID Name T emissivity specular_fraction hc STL_filenames */
+/* T_BOUNDARY_FOR_SOLID Name T STL_filenames */
static res_T
process_t
(struct stardis* stardis,
struct dummies* dummies,
- const enum description_type type,
char** tok_ctx)
{
char* tk = NULL;
@@ -1329,9 +1327,8 @@ process_t
desc = darray_descriptions_data_get(&stardis->descriptions) + sz;
init_t(stardis->allocator, &desc->d.t_boundary);
- desc->type = type;
- desc->d.t_boundary.mat_id = (type == DESC_BOUND_T_FOR_FLUID)
- ? get_dummy_solid_id(stardis, dummies) : get_dummy_fluid_id(stardis, dummies);
+ desc->type = DESC_BOUND_T_FOR_SOLID;
+ desc->d.t_boundary.mat_id = get_dummy_fluid_id(stardis, dummies);
CHK_TOK(strtok_r(NULL, " \t", tok_ctx), "temperature boundary name");
ERR(description_set_name(stardis, &desc->d.t_boundary.name, tk));
@@ -1353,38 +1350,6 @@ process_t
if(res == RES_OK) res = RES_BAD_ARG;
goto end;
}
- if(type == DESC_BOUND_T_FOR_FLUID) {
- CHK_TOK(strtok_r(NULL, " \t", tok_ctx), "emissivity");
- res = cstr_to_double(tk, &desc->d.t_boundary.emissivity);
- if(res != RES_OK
- || desc->d.t_boundary.emissivity < 0
- || desc->d.t_boundary.emissivity > 1)
- {
- logger_print(stardis->logger, LOG_ERROR, "Invalid emissivity: %s\n", tk);
- if(res == RES_OK) res = RES_BAD_ARG;
- goto end;
- }
- CHK_TOK(strtok_r(NULL, " \t", tok_ctx), "specular fraction");
- res = cstr_to_double(tk, &desc->d.t_boundary.specular_fraction);
- if(res != RES_OK
- || desc->d.t_boundary.specular_fraction < 0
- || desc->d.t_boundary.specular_fraction > 1)
- {
- logger_print(stardis->logger, LOG_ERROR,
- "Invalid specular fraction: %s\n", tk);
- if(res == RES_OK) res = RES_BAD_ARG;
- goto end;
- }
- CHK_TOK(strtok_r(NULL, " \t", tok_ctx), "hc");
- res = cstr_to_double(tk, &desc->d.t_boundary.hc);
- if(res != RES_OK
- || desc->d.t_boundary.hc < 0)
- {
- logger_print(stardis->logger, LOG_ERROR, "Invalid hc: %s\n", tk);
- if(res == RES_OK) res = RES_BAD_ARG;
- goto end;
- }
- }
ASSERT(sz <= UINT_MAX);
ERR(read_sides_and_files(stardis, 1, (unsigned)sz, tok_ctx));
@@ -1900,7 +1865,6 @@ error:
* H_BOUNDARY_FOR_SOLID Name emissivity specular_fraction hc T_env STL_filenames
* H_BOUNDARY_FOR_FLUID Name emissivity specular_fraction hc T_env STL_filenames
* T_BOUNDARY_FOR_SOLID Name T STL_filenames
- * T_BOUNDARY_FOR_FLUID Name T emissivity specular_fraction hc STL_filenames */
* F_BOUNDARY_FOR_SOLID Name F STL_filenames
* SOLID_FLUID_CONNECTION Name emissivity specular_fraction hc STL_filenames
* SCALE scale_factor
@@ -1929,9 +1893,7 @@ process_model_line
else if(0 == strcasecmp(tk, "H_BOUNDARY_FOR_FLUID"))
ERR(process_h(stardis, dummies, DESC_BOUND_H_FOR_FLUID, &tok_ctx));
else if(0 == strcasecmp(tk, "T_BOUNDARY_FOR_SOLID"))
- ERR(process_t(stardis, dummies, DESC_BOUND_T_FOR_SOLID, &tok_ctx));
- else if(0 == strcasecmp(tk, "T_BOUNDARY_FOR_FLUID"))
- ERR(process_t(stardis, dummies, DESC_BOUND_T_FOR_FLUID, &tok_ctx));
+ ERR(process_t(stardis, dummies, &tok_ctx));
else if(0 == strcasecmp(tk, "F_BOUNDARY_FOR_SOLID"))
ERR(process_flx(stardis, dummies, &tok_ctx));
else if(0 == strcasecmp(tk, "SOLID_FLUID_CONNECTION"))