commit f84a61857ff7f04137e0f9f6bbcdffc0da7fe105
parent 5f2b3f675192505af87b13c2cb73f63a96ba2934
Author: Benjamin Piaud <benjamin.piaud@meso-star.com>
Date: Fri, 27 Apr 2018 16:13:21 +0200
ajout du radiatif
Diffstat:
5 files changed, 64 insertions(+), 20 deletions(-)
diff --git a/src/args.h b/src/args.h
@@ -20,14 +20,17 @@ struct args{
double probe[4];
enum stardis_mode mode;
double scale_factor;
+ double radiative_temp[2];
};
-#define ARGS_DEFAULT__ {NULL, NULL, 10000, SDIS_NTHREADS_DEFAULT, {0,0,0,INF}, PROBE_COMPUTE, 1.0}
+#define ARGS_DEFAULT__ {NULL, NULL, 10000, SDIS_NTHREADS_DEFAULT, {0,0,0,INF}, PROBE_COMPUTE, 1.0, {300,300}}
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] [-s SCALE_FACTOR] [-d] [-n NUM_OF_REALIZATIONS] [-t NUM_OF_THREADS]\n", prog);
+ printf("usage : \n%s -m MEDIUM.txt -b BOUNDARY.txt [-p X:Y:Z:TIME]\n", prog);
+ printf("[-s SCALE_FACTOR] [-d] [-n NUM_OF_REALIZATIONS] [-t NUM_OF_THREADS]\n");
+ printf("[-r AMBIENT_RAD_TEMP:REFERENCE_TEMP]\n");
printf("\n -h : print this help.\n");
printf("\nArguments\n");
printf("---------\n");
@@ -54,6 +57,13 @@ print_help(char* prog)
printf(" default value: 10000.\n");
printf("\n -t NUM_OF_THREADS :\n");
printf(" default value: all threads available.\n");
+ printf("\n -r AMBIENT_RAD_TEMP:REFERENCE_TEMP :\n");
+ printf(" solve the coupled radiative transfer.\n");
+ printf(" AMBIENT_RAD_TEMP is the ambient radiative temperature .\n");
+ printf(" REFERENCE_TEMP is the temperature used for the linearization.\n");
+ printf(" of theradiative transfer.\n");
+
+
}
static res_T
@@ -69,7 +79,7 @@ parse_args(const int argc, char** argv, struct args* args)
goto error;
}
- while((opt = getopt(argc, argv, "hn:t:b:m:p:ds:")) != -1) {
+ while((opt = getopt(argc, argv, "hn:t:b:m:p:ds:r:")) != -1) {
switch(opt) {
case 'h':
print_help(argv[0]);
@@ -109,9 +119,11 @@ parse_args(const int argc, char** argv, struct args* args)
goto error;
}
break;
+
case 'd':
args->mode = DUMP_VTK;
break;
+
case 's':
cstr_to_double(optarg, &args->scale_factor);
if (res != RES_OK){
@@ -119,6 +131,15 @@ parse_args(const int argc, char** argv, struct args* args)
goto error;
}
break;
+
+ case 'r':
+ cstr_to_list_double(optarg, ':', args->radiative_temp, &len, 2);
+ if(res == RES_OK && len != 2) res = RES_BAD_ARG;
+ if (res != RES_OK){
+ fprintf(stderr, "Invalid argument -r\n", optarg);
+ goto error;
+ }
+ break;
}
}
diff --git a/src/material.txt b/src/material.txt
@@ -1,4 +1,4 @@
-#STL_filename lambda rho cp delta Tinit(x,y,z) volumic_power(x,y,z,t)
-m_1.stl 1.0 1.0 1.0 0.05 "300" "1"
-m_2.stl 1.0 1.0 1.0 0.05 "300" "1"
-m_3.stl 1.0 1.0 1.0 0.05 "300" "1"
+#STL_filename lambda rho cp delta emissivity specular_fraction Tinit(x,y,z) volumic_power(x,y,z,t)
+m_1.stl 1.0 1.0 1.0 0.05 1.0 0.0 "300" "0"
+m_2.stl 1.0 1.0 1.0 0.05 1.0 0.0 "300" "0"
+m_3.stl 1.0 1.0 1.0 0.05 1.0 0.0 "300" "0"
diff --git a/src/stardis-app.c b/src/stardis-app.c
@@ -42,28 +42,41 @@ parse_medium_line(char* line, char** stl_filename, struct material* mat)
strcpy(*stl_filename,tk);
tk = strtok(NULL," ");
res = cstr_to_double(tk, &mat->lambda);
- if (res != RES_OK) {
+ if (res != RES_OK || mat->lambda <= 0.0) {
fprintf(stderr,"invalid lambda\n");
goto error;
}
tk = strtok(NULL," ");
res = cstr_to_double(tk, &mat->rho);
- if (res != RES_OK) {
+ if (res != RES_OK || mat->rho <= 0.0) {
fprintf(stderr,"invalid rho\n");
goto error;
}
tk = strtok(NULL," ");
res = cstr_to_double(tk, &mat->cp);
- if (res != RES_OK) {
+ if (res != RES_OK || mat->cp <= 0.0){
fprintf(stderr,"invalid cp\n");
goto error;
}
tk = strtok(NULL," ");
res = cstr_to_double(tk, &mat->delta);
- if (res != RES_OK) {
+ if (res != RES_OK || mat->delta <= 0.0){
fprintf(stderr,"invalid delta\n");
goto error;
}
+ tk = strtok(NULL," ");
+ res = cstr_to_double(tk, &mat->emissivity);
+ if (res != RES_OK || mat->emissivity < 0.0 || mat->emissivity > 1.0){
+ fprintf(stderr,"invalid emissivity\n");
+ goto error;
+ }
+ tk = strtok(NULL," ");
+ res = cstr_to_double(tk, &mat->specular_fraction);
+ if (res != RES_OK ||
+ mat->specular_fraction < 0.0 || mat->specular_fraction > 1.0){
+ fprintf(stderr,"invalid specular_fraction\n");
+ goto error;
+ }
tk = strtok(NULL,"\"");
tk = strtok(NULL,"\"");
mat->Tinit = malloc(strlen(tk) + 1);
@@ -353,6 +366,8 @@ stardis_init
stardis->probe[2] = args->probe[2];
stardis->probe[3] = args->probe[3];
stardis->scale_factor = args->scale_factor;
+ stardis->radiative_temp[0] = args->radiative_temp[0];
+ stardis->radiative_temp[1] = args->radiative_temp[1];
if (args->mode == PROBE_COMPUTE){
res = check_consistency(stardis->boundary, stardis->probe);
diff --git a/src/stardis-app.h b/src/stardis-app.h
@@ -94,10 +94,12 @@ struct material{
double rho;
double cp;
double delta;
+ double emissivity;
+ double specular_fraction;
char* Tinit;
char* power;
};
-#define NULL_MATERIAL__ {0.0 ,0.0 ,0.0, 0.0, NULL, NULL}
+#define NULL_MATERIAL__ {0.0 ,0.0 ,0.0, 0.0, 0.0, 0.0, NULL, NULL}
static const struct material NULL_MATERIAL = NULL_MATERIAL__;
struct boundary{
@@ -117,8 +119,9 @@ struct stardis{
unsigned nthreads;
double probe[4]; /*x,y,z,t of probe*/
double scale_factor;
+ double radiative_temp[2];
};
-#define NULL_STARDIS__ {NULL_GEOMETRY__, NULL, NULL, 0, 0, {0,0,0,0}, 0}
+#define NULL_STARDIS__ {NULL_GEOMETRY__, NULL, NULL, 0, 0, {0,0,0,0}, 0, {300,300}}
static const struct stardis NULL_STARDIS = NULL_STARDIS__;
extern res_T
diff --git a/src/stardis-compute.c b/src/stardis-compute.c
@@ -195,7 +195,7 @@ solid_get_power
struct interface {
double hc; /* Convection coefficient */
char* temperature;
- double epsilon;
+ double emissivity;
double alpha;
};
@@ -237,11 +237,11 @@ interface_get_temperature
}
static double
-interface_get_epsilon
+interface_get_emissivity
(const struct sdis_interface_fragment* frag, struct sdis_data* data)
{
const struct interface* interface_props = sdis_data_cget(data);
- return interface_props->epsilon;
+ return interface_props->emissivity;
}
@@ -339,7 +339,7 @@ stardis_compute(struct stardis* stardis)
/* Setup the interface shader */
interface_shader_front.temperature = interface_get_temperature;
interface_shader_front.flux = NULL;
- interface_shader_front.emissivity = interface_get_epsilon;
+ interface_shader_front.emissivity = interface_get_emissivity;
interface_shader_front.specular_fraction = interface_get_alpha;
interface_shader_back = interface_shader_front;
@@ -354,6 +354,10 @@ stardis_compute(struct stardis* stardis)
if (bound_id > -1){ /* boundary interface */
double hc = stardis->boundary[bound_id].hc;
char* T = stardis->boundary[bound_id].T;
+ double emissivity =
+ stardis->material[stardis->geometry.triangle[i].medium_front].emissivity;
+ double alpha =
+ stardis->material[stardis->geometry.triangle[i].medium_front].specular_fraction;
SDIS(data_create(dev, sizeof(struct interface), ALIGNOF(struct interface), NULL, &data));
interface_props = sdis_data_get(data);
@@ -363,8 +367,8 @@ stardis_compute(struct stardis* stardis)
} else {
interface_props->temperature = T;
}
- interface_props->epsilon = 0;
- interface_props->alpha = 0;
+ interface_props->emissivity = emissivity;
+ interface_props->alpha = alpha;
SDIS(interface_create(dev,
solid_medium[stardis->geometry.triangle[i].medium_front],
fluid_medium[bound2fluid[bound_id]],
@@ -395,7 +399,8 @@ stardis_compute(struct stardis* stardis)
stardis->N,
pos,time,
stardis->scale_factor,
- 300.0, 300.0,
+ stardis->radiative_temp[0],
+ stardis->radiative_temp[1],
&estimator));
/* Fetch the estimation data */