stardis

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

commit df1263b1d5e4613033f18fe5e36eff1bbade48ca
parent fb0ce8af1449fcc8435d6046b39e634ccb6cd973
Author: Benjamin Piaud <benjamin.piaud@meso-star.com>
Date:   Fri, 27 Apr 2018 14:37:13 +0200

ajout de la possibilité de renseigner fp_to_meter (facteur d'échelle). Et ettoffage de l'aide.

Diffstat:
Msrc/args.h | 40+++++++++++++++++++++++++++++++++++++---
Msrc/stardis-app.c | 1+
Msrc/stardis-app.h | 3++-
Msrc/stardis-compute.c | 7++++++-
4 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/src/args.h b/src/args.h @@ -19,14 +19,41 @@ struct args{ unsigned nthreads; double probe[4]; enum stardis_mode mode; + double scale_factor; }; -#define ARGS_DEFAULT__ {NULL, NULL, 10000, SDIS_NTHREADS_DEFAULT, {0,0,0,INF}, PROBE_COMPUTE} +#define ARGS_DEFAULT__ {NULL, NULL, 10000, SDIS_NTHREADS_DEFAULT, {0,0,0,INF}, PROBE_COMPUTE, 1.0} static const struct args ARGS_DEFAULT = ARGS_DEFAULT__; static void print_help(char* prog) { - printf("usage %s -m MEDIUM.txt -b BOUNDARY.txt [-p X:Y:Z:TIME] [-d] [-n NUM_OF_REALIZATIONS] [-t NUM_OF_THREADS]\n", prog); + printf("usage %s -m MEDIUM.txt -b BOUNDARY.txt [-p X:Y:Z:TIME] [-s SCALE_FACTOR] [-d] [-n NUM_OF_REALIZATIONS] [-t NUM_OF_THREADS]\n", prog); + printf("\n -h : print this help.\n"); + printf("\nArguments\n"); + printf("---------\n"); + printf("\n -m MEDIUM.txt :\n"); + printf(" MEDIUM.txt is a text file which contains the description of the\n"); + printf(" media.\n"); + printf("\n -b BOUNDARY.txt :\n"); + printf(" BOUNDARY.txt is a text file which contains the description of the\n"); + printf(" boundary conditions.\n"); + printf("\nOptionnal arguments\n"); + printf("-------------------\n"); + printf("\n -p X:Y:Z:TIME :\n"); + printf(" this is the position and the time of the probe.\n"); + printf(" default value: 0.0:0.0:0.0:INF.\n"); + printf(" The probe must be in a medium. If some boundary consitions are\n"); + printf(" time-dependant, TIME can not be INF.\n"); + printf("\n -s SCALE_FACTOR :\n"); + printf(" default value: 1.0.\n"); + printf("\n -d :\n"); + printf(" dump geometry in VTK format which medium front/back id and\n"); + printf(" boundary id.\n"); + printf("\n -n NUM_OF_REALIZATIONS :\n"); + printf(" number of Monte-Carlo realizations.\n"); + printf(" default value: 10000.\n"); + printf("\n -t NUM_OF_THREADS :\n"); + printf(" default value: all threads available.\n"); } static res_T @@ -42,7 +69,7 @@ parse_args(const int argc, char** argv, struct args* args) goto error; } - while((opt = getopt(argc, argv, "hn:t:b:m:p:d")) != -1) { + while((opt = getopt(argc, argv, "hn:t:b:m:p:ds:")) != -1) { switch(opt) { case 'h': print_help(argv[0]); @@ -85,6 +112,13 @@ parse_args(const int argc, char** argv, struct args* args) case 'd': args->mode = DUMP_VTK; break; + case 's': + cstr_to_double(optarg, &args->scale_factor); + if (res != RES_OK){ + fprintf(stderr, "Invalid argument -s\n", optarg); + goto error; + } + break; } } diff --git a/src/stardis-app.c b/src/stardis-app.c @@ -352,6 +352,7 @@ stardis_init stardis->probe[1] = args->probe[1]; stardis->probe[2] = args->probe[2]; stardis->probe[3] = args->probe[3]; + stardis->scale_factor = args->scale_factor; if (args->mode == PROBE_COMPUTE){ res = check_consistency(stardis->boundary, stardis->probe); diff --git a/src/stardis-app.h b/src/stardis-app.h @@ -116,8 +116,9 @@ struct stardis{ size_t N; /*number of MC realizations*/ unsigned nthreads; double probe[4]; /*x,y,z,t of probe*/ + double scale_factor; }; -#define NULL_STARDIS__ {NULL_GEOMETRY__, NULL, NULL, 0, 0, {0,0,0,0}} +#define NULL_STARDIS__ {NULL_GEOMETRY__, NULL, NULL, 0, 0, {0,0,0,0}, 0} static const struct stardis NULL_STARDIS = NULL_STARDIS__; extern res_T diff --git a/src/stardis-compute.c b/src/stardis-compute.c @@ -391,7 +391,12 @@ stardis_compute(struct stardis* stardis) pos[1] = stardis->probe[1]; pos[2] = stardis->probe[2]; time = stardis->probe[3]; - SDIS(solve_probe(scn, stardis->N, pos, time, 1.0, 300.0, 300.0, &estimator)); + SDIS(solve_probe(scn, + stardis->N, + pos,time, + stardis->scale_factor, + 300.0, 300.0, + &estimator)); /* Fetch the estimation data */ SDIS(estimator_get_temperature(estimator, &temperature));