stardis

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

commit 76fdcad6dea3a8c1aa0045c8b61d46189f1f28f1
parent 9dc4d7f2f779c36fd5eebd36c1bea499d849d411
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon, 18 Oct 2021 16:26:50 +0200

Merge branch 'release_0.7'

Diffstat:
M.gitignore | 1+
MREADME.md | 17++++++++++++-----
Mcmake/CMakeLists.txt | 4++--
Mdoc/stardis-input.5.txt | 3---
Mdoc/stardis-output.5.txt | 18+++++++-----------
Mdoc/stardis.1.txt.in | 6++++--
Msrc/stardis-app.c | 12------------
Msrc/stardis-app.h | 36++++++------------------------------
Msrc/stardis-compute.c | 2+-
Msrc/stardis-intface.c | 41++++++++---------------------------------
Msrc/stardis-output.c | 6+-----
Msrc/stardis-parsing.c | 53+++++++++++------------------------------------------
12 files changed, 53 insertions(+), 146 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -8,4 +8,5 @@ tmp *.[ao] *~ tags +*.orig diff --git a/README.md b/README.md @@ -33,6 +33,13 @@ variable the install directories of its dependencies. ## Release notes +### Version 0.7 + +- Remove the boundary condition `T_BOUNDARY_FOR_FLUID`: it was exactly the same + than `H_BOUNDARY_FOR_FLUID` that should now be used instead. +- Sets the required version of Star-SampPling to 0.12. This version fixes + compilation errors with gcc 11 but introduces API breaks. + ### Version 0.6 - Add thermal contact resistances. @@ -65,9 +72,9 @@ variable the install directories of its dependencies. ### Version 0.3.2 -- Add the solve_probe_boundary feature. The solve_probe_boundary VS - solve_probe selection is automated according the probe-geometry distance. - solve_probe_boundary is called for probe points closer than 2.1 delta +- Add the `solve_probe_boundary` feature. The `solve_probe_boundary` VS + `solve_probe` selection is automated according the probe-geometry distance. + `solve_probe_boundary` is called for probe points closer than 2.1 delta from geometry. - Add flux boundary conditions. @@ -76,13 +83,13 @@ variable the install directories of its dependencies. Add radiative transfer computations. To achieve this, media gain 2 new parameters: - emissivity; -- specular_fraction. +- `specular_fraction`. ### Version 0.3 - Upgrade stardis-solver to v0.3. - Add volumic power sources on solids; -- Allow to use the fp_to_meter parameter of the stardis-solver solve function; +- Allow to use the `fp_to_meter` parameter of the stardis-solver solve function; - Add a dump geometry feature. It outputs the geometry as it is sent to stardis-solver in VTK format, together with the front and back media and boundary conditions information. diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -55,7 +55,7 @@ configure_file(${SDIS_SOURCE_DIR}/../doc/stardis.1.txt.in ${CMAKE_CURRENT_BINARY_DIR}/doc/stardis.1.txt @ONLY) set(SDIS_VERSION_MAJOR 0) -set(SDIS_VERSION_MINOR 6) +set(SDIS_VERSION_MINOR 7) set(SDIS_VERSION_PATCH 0) set(SDIS_VERSION ${SDIS_VERSION_MAJOR}.${SDIS_VERSION_MINOR}.${SDIS_VERSION_PATCH}) @@ -75,7 +75,7 @@ find_package(Star3D 0.8 REQUIRED) find_package(StarEnc3D 0.5.3 REQUIRED) find_package(Stardis 0.12 REQUIRED) find_package(StarSTL 0.3.3 REQUIRED) -find_package(StarSP 0.8.1 REQUIRED) +find_package(StarSP 0.12 REQUIRED) if(MSVC) find_package(MuslGetopt REQUIRED) endif() 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/doc/stardis-output.5.txt b/doc/stardis-output.5.txt @@ -76,10 +76,10 @@ continue a description next line. However, this trick is not part of the actual output, that continues on a single line. On the other hand, multiple lines not using the *\* convenience in multi-lines descriptions are truly different lines of output. Also, text appearing between quote marks is a -verbatim part of the output, except the quote characters, *#something* -denotes a count (the number of something), and the math symbols '*\+*' +verbatim part of the output, except the quote characters, *\#something* +denotes a count (the number of something), and the math operators '*+*' and '***', when not verbatim, are used with the usual meaning (like in -#something+1). Finally, text introduced by the *#* character in a description, +\#something+1). Finally, text introduced by the *#* character in a description, when neither verbatim nor count, is a comment and is not part of the output. == OUTPUT @@ -165,6 +165,7 @@ _______ <ext-probe-position> ::= "[" <x-value> "," <y-value> "," <z-value> "]" <ext-time> ::= "at t=" <time-value> "=" + | "with t in [" <time-value> <time-value> "] =" <ext-temp-estimate> ::= <expected-value> "K +/-" <standard-deviation> @@ -309,9 +310,6 @@ _______ struct t_boundary { struct str name; - double emissivity; - double specular_fraction; - double hc; double imposed_temperature; unsigned mat_id; }; @@ -338,7 +336,6 @@ _______ 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, @@ -543,11 +540,11 @@ _______ ------------------------------------- <end-name> ::= STRING # the name of the boundary at the end of the - # heat path, or AMBIANT for radiative ending + # heat path, or AMBIENT for radiative ending <end-id> ::= INTEGER # in [0 #boundaries] # order is the order in the description file, - # AMBIANT's id being #boundaries + # AMBIENT's id being #boundaries <x> ::= REAL @@ -975,4 +972,4 @@ _______ *stardis*(1), *stardis-input*(5), -*htrdr-image*(5) -\ No newline at end of file +*htrdr-image*(5) diff --git a/doc/stardis.1.txt.in b/doc/stardis.1.txt.in @@ -148,8 +148,9 @@ EXCLUSIVE OPTIONS provided, the result is written to _standard output_. **fmt=**_image_file_format_;; - Format of the image file in output. Can be *VTK* or *HT*. Default - _image_file_format_ is @STARDIS_ARGS_DEFAULT_RENDERING_OUTPUT_FILE_FMT@. + Format of the image file in output. Can be *VTK*, or *HT* (see + htrdr-image(5) and htpp(1)). Default _image_file_format_ is + @STARDIS_ARGS_DEFAULT_RENDERING_OUTPUT_FILE_FMT@. **fov=**_angle_;; Horizontal field of view of the camera in [30, 120] degrees. By default @@ -340,3 +341,4 @@ SEE ALSO *stardis-output*(5), *sgreen*(1), *htpp*(1) +*htrdr-image*(5) 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 @@ -75,10 +75,7 @@ enum properties_conflict_t { BOUND_H_FOR_SOLID_BETWEEN_2_DEFS, BOUND_H_FOR_SOLID_BETWEEN_2_UNDEFS, BOUND_H_FOR_SOLID_ENCLOSING_FLUID, - BOUND_T_FOR_FLUID_BETWEEN_2_DEFS, - BOUND_T_FOR_FLUID_BETWEEN_2_UNDEFS, - BOUND_T_FOR_FLUID_ENCLOSING_SOLID, - BOUND_T_FOR_SOLID_BETWEEN_2_DEFS, + BOUND_T_FOR_SOLID_BETWEEN_2_DEFS = 10, BOUND_T_FOR_SOLID_BETWEEN_2_UNDEFS, BOUND_T_FOR_SOLID_ENCLOSING_FLUID, BOUND_F_FOR_SOLID_BETWEEN_2_DEFS, @@ -102,7 +99,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 +110,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) \ @@ -255,9 +251,6 @@ cp_h_boundary(struct h_boundary* dst, const struct h_boundary* src) struct t_boundary { struct str name; - double emissivity; - double specular_fraction; - double hc; double imposed_temperature; unsigned mat_id; }; @@ -266,9 +259,6 @@ static FINLINE void init_t(struct mem_allocator* allocator, struct t_boundary* dst) { str_init(allocator, &dst->name); - dst->emissivity = 0; - dst->specular_fraction = 0; - dst->hc = 0; dst->imposed_temperature = -1; dst->mat_id = UINT_MAX; } @@ -282,19 +272,13 @@ release_t_boundary(struct t_boundary* bound) static res_T str_print_t_boundary (struct str* str, - const struct t_boundary* b, - const enum description_type type) + const struct t_boundary* b) { res_T res = RES_OK; ASSERT(str && b && DESC_IS_T(type)); - STR_APPEND_PRINTF(str, "T boundary for %s '%s': T=%g ", - ARG3( (type == DESC_BOUND_T_FOR_SOLID ? "solid" : "fluid"), - str_cget(&b->name), b->imposed_temperature ) ); + STR_APPEND_PRINTF(str, "T boundary for solid '%s': T=%g ", + ARG2( 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: @@ -306,9 +290,6 @@ error: static FINLINE res_T cp_t_boundary(struct t_boundary* dst, const struct t_boundary* src) { - dst->emissivity = src->emissivity; - dst->specular_fraction = src->specular_fraction; - dst->hc = src->hc; dst->imposed_temperature = src->imposed_temperature; dst->mat_id = src->mat_id; return str_copy(&dst->name, &src->name); @@ -505,7 +486,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,8 +520,7 @@ 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)); + ERR(str_print_t_boundary(str, &desc->d.t_boundary)); break; case DESC_BOUND_H_FOR_SOLID: case DESC_BOUND_H_FOR_FLUID: @@ -576,7 +555,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 +601,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 +655,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-compute.c b/src/stardis-compute.c @@ -385,7 +385,7 @@ error: name); \ goto error; \ } \ - ERR(ssp_rng_create(stardis->allocator, &ssp_rng_mt19937_64, &args.rng_state)); \ + ERR(ssp_rng_create(stardis->allocator, SSP_RNG_MT19937_64, &args.rng_state)); \ res = read_random_generator_state(args.rng_state, stream); \ if(res != RES_OK) { \ logger_print(stardis->logger, LOG_ERROR, \ 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) { @@ -295,16 +272,14 @@ create_intface ASSERT(!front_med); front_med = media[ext_id]; } - /* The imposed T is for the 2 sides (until there is contact resistnces) */ + /* The imposed T is for the 2 sides (until there is contact resistances) */ interface_shader.front.temperature = interface_get_temperature; interface_shader.back.temperature = interface_get_temperature; - if(connect->type == DESC_BOUND_T_FOR_SOLID) { - /* Set emissivity to 1 to allow radiative paths comming from - * a possible external fluid to 'see' the imposed T */ - ASSERT(fluid_side_shader); - fluid_side_shader->emissivity = interface_get_emissivity; - interface_props->emissivity = 1; - } + /* Set emissivity to 1 to allow radiative paths comming from + * a possible external fluid to 'see' the imposed T */ + ASSERT(fluid_side_shader); + fluid_side_shader->emissivity = interface_get_emissivity; + interface_props->emissivity = 1; ASSERT(connect->d.t_boundary.imposed_temperature >= 0); interface_props->imposed_temperature = connect->d.t_boundary.imposed_temperature; 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; @@ -444,7 +443,7 @@ dump_sample_end size_t ambient_id = darray_descriptions_size_get(e_ctx->desc); ASSERT(ambient_id <= UINT_MAX); /* End, End ID, X, Y, Z, Elapsed time */ - fprintf(stream, "AMBIANT, %u, 0, 0, 0, %g\n", + fprintf(stream, "AMBIENT, %u, 0, 0, 0, %g\n", (unsigned)ambient_id, elapsed); } else { struct sdis_point pt = SDIS_POINT_NULL; @@ -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,6 @@ 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; 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 @@ -508,6 +508,13 @@ short_help fprintf(stream, "\n -X <FILE>\n"); fprintf(stream, " Save the final random generator's state in a file.\n"); + + fprintf(stream, +"\nCopyright (C) 2018-2021 |Meso|Star> <contact@meso-star.com>.\n" +"stardis is free software released under the GNU GPL license, version 3 or later.\n" +"You are free to change or redistribute it under certain conditions\n" +"<http://gnu.org/licenses/gpl.html>.\n"); + } #define FREE_AARRAY(ARRAY) \ @@ -1299,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; @@ -1322,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)); @@ -1346,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)); @@ -1893,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 hc STL_filenames * F_BOUNDARY_FOR_SOLID Name F STL_filenames * SOLID_FLUID_CONNECTION Name emissivity specular_fraction hc STL_filenames * SCALE scale_factor @@ -1922,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"))