stardis

Perform coupled heat transfer calculations
git clone git://git.meso-star.fr/stardis.git
Log | Files | Refs | README | LICENSE

commit 4f83c748f2dfd0743334fd17de7898ea1eb36238
parent eb36c7daf650ed2a9fbe8726a9cba2c6f4b7b080
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Wed,  5 Jun 2019 16:28:10 +0200

Fix Flux Boundaries

Diffstat:
Msrc/stardis-app.c | 21---------------------
Msrc/stardis-app.h | 41++++-------------------------------------
Msrc/stardis-compute.c | 6+++---
3 files changed, 7 insertions(+), 61 deletions(-)

diff --git a/src/stardis-app.c b/src/stardis-app.c @@ -420,27 +420,6 @@ parse_boundary_line(char* line, char** stl_filename, struct description* desc) } desc->d.f_boundary.flux = malloc(strlen(tk) + 1); strcpy(desc->d.f_boundary.flux, tk); - - /* hc and hc_max are optional */ - tk = strtok(NULL, " "); - if (tk) { - res = cstr_to_double(tk, &desc->d.f_boundary.hc); - if (res != RES_OK || desc->d.f_boundary.hc < 0) { - fprintf(stderr, "Invalid hc value: %s\n", tk); - res = RES_BAD_ARG; - goto exit; - } - desc->d.f_boundary.has_hc = (desc->d.f_boundary.hc > 0); - CHK_TOK(strtok(NULL, " "), "hc max"); - res = cstr_to_double(tk, &desc->d.f_boundary.hc_max); - if (res != RES_OK - || desc->d.f_boundary.hc_max < desc->d.f_boundary.hc - || desc->d.f_boundary.hc_max < 0) { - fprintf(stderr, "Invalid hc_max value: %s\n", tk); - res = RES_BAD_ARG; - goto exit; - } - } } else if (sf_connect) { desc->type = DESC_SOLID_FLUID_CONNECT; diff --git a/src/stardis-app.h b/src/stardis-app.h @@ -635,9 +635,6 @@ struct f_boundary { unsigned mat_id; char* flux; struct te_expr* te_flux; - double hc; - double hc_max; - int has_hc; }; static void @@ -648,23 +645,17 @@ print_f_boundary { ASSERT(stream && b && type == DESC_BOUND_F_FOR_SOLID); (void)type; fprintf(stream, - "F boundary %s for SOLID: hc=%g hc_max=%g flux='%s'\n", + "F boundary %s for SOLID: flux='%s'\n", b->name, - (b->has_hc ? b->hc : 0), - (b->has_hc ? b->hc_max : 0), (b->flux ? b->flux : "0")); } static char eq_f_boundary(const struct f_boundary* a, const struct f_boundary* b) { - if (a->mat_id != b->mat_id - || strcmp(a->name, b->name) - || strcmp(a->flux, b->flux) - || a->has_hc != b->has_hc) - return 0; - if (a->has_hc && (a->hc != b->hc || a->hc_max != b->hc_max)) return 0; - return 1; + return (a->mat_id == b->mat_id + && 0 == strcmp(a->name, b->name) + && 0 == strcmp(a->flux, b->flux)); } static size_t @@ -686,22 +677,10 @@ hash_f_boundary(const struct f_boundary* key) hash = hash ^ (uint32_t)((unsigned char)((const char*)&key->mat_id)[i]); hash = hash * FNV32_PRIME; } - FOR_EACH(i, 0, sizeof(key->hc)) { - hash = hash ^ (uint32_t)((unsigned char)((const char*)&key->hc)[i]); - hash = hash * FNV32_PRIME; - } - FOR_EACH(i, 0, sizeof(key->hc_max)) { - hash = hash ^ (uint32_t)((unsigned char)((const char*)&key->hc_max)[i]); - hash = hash * FNV32_PRIME; - } FOR_EACH(i, 0, strlen(key->flux) * sizeof(*key->flux)) { hash = hash ^ (uint32_t)((unsigned char)((const char*)key->flux)[i]); hash = hash * FNV32_PRIME; } - FOR_EACH(i, 0, sizeof(key->has_hc)) { - hash = hash ^ (uint32_t)((unsigned char)((const char*)&key->has_hc)[i]); - hash = hash * FNV32_PRIME; - } return hash; #elif defined(ARCH_64BITS) /* 64-bits Fowler/Noll/Vo hash function */ @@ -719,22 +698,10 @@ hash_f_boundary(const struct f_boundary* key) hash = hash ^ (uint32_t)((unsigned char)((const char*)&key->mat_id)[i]); hash = hash * FNV64_PRIME; } - FOR_EACH(i, 0, sizeof(key->hc)) { - hash = hash ^ (uint32_t)((unsigned char)((const char*)&key->hc)[i]); - hash = hash * FNV64_PRIME; - } - FOR_EACH(i, 0, sizeof(key->hc_max)) { - hash = hash ^ (uint32_t)((unsigned char)((const char*)&key->hc_max)[i]); - hash = hash * FNV64_PRIME; - } FOR_EACH(i, 0, strlen(key->flux) * sizeof(*key->flux)) { hash = hash ^ (uint32_t)((unsigned char)((const char*)key->flux)[i]); hash = hash * FNV64_PRIME; } - FOR_EACH(i, 0, sizeof(key->has_hc)) { - hash = hash ^ (uint32_t)((unsigned char)((const char*)&key->has_hc)[i]); - hash = hash * FNV64_PRIME; - } return hash; #else #error "Unexpected architecture" diff --git a/src/stardis-compute.c b/src/stardis-compute.c @@ -1648,14 +1648,14 @@ stardis_compute(struct stardis* stardis, enum stardis_mode mode) } if (fbound_count) { printf("# F Boundaries\n"); - printf("# ID Name hc hc_max\n"); + printf("# ID Name flux\n"); FOR_EACH(i, 0, sa_size(stardis->descriptions)) { struct description* desc = stardis->descriptions + i; struct f_boundary* bd; if (desc->type != DESC_BOUND_F_FOR_SOLID) continue; bd = &desc->d.f_boundary; - printf("%u\t%s\t%g\t%g\n", - i, bd->name, (bd->has_hc ? bd->hc : 0), (bd->has_hc ? bd->hc_max : 0)); + printf("%u\t%s\t%s\n", + i, bd->name, bd->flux); } }