commit 3efb987d5beb9b8c6cfaf3f652383b8237bd40ea
parent 7ca36c6e594737b618ab9ba72a92923a9231631a
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 27 Feb 2019 16:20:29 +0100
Adjust the volumic_power4_2d test
Diffstat:
2 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/src/sdis_scene_Xd.h b/src/sdis_scene_Xd.h
@@ -63,7 +63,7 @@ register_medium(struct sdis_scene* scn, struct sdis_medium* mdm)
res_T res = RES_OK;
ASSERT(scn && mdm);
- /* Check that the front medium is already registered against the scene */
+ /* Check that the medium is already registered against the scene */
id = medium_get_id(mdm);
nmedia = darray_medium_size_get(&scn->media);
if(id >= nmedia) {
diff --git a/src/test_sdis_volumic_power4_2d.c b/src/test_sdis_volumic_power4_2d.c
@@ -15,24 +15,23 @@
#include "sdis.h"
#include "test_sdis_utils.h"
+#include <rsys/clock_time.h>
#include <rsys/math.h>
-#define Tf1 0
-#define Tf2 100
-#define Power 0 /*10000*/
-#define H1 50
-#define H2 50
+#define Tf 100.0
+#define Power 10000.0
+#define H 50.0
#define LAMBDA 100.0
-#define DELTA (1.0/20.0)
-#define N 10000
+#define DELTA (1.0/2.0)
+#define N 10000000
/*
* The 2D scene is a solid slabs stretched along the X dimension to simulate a
- * 1D case. The slab has a volumic power and has a convective exchange with the
- * surrounding fluid whose temperature is fixed to Tfluid.
+ * 1D case. The slab has a volumic power and has a convective exchange with
+ * surrounding fluid whose temperature is fixed to Tf.
*
*
- * _\ TFluid
+ * _\ Tf
* / /
* \__/
*
@@ -42,17 +41,17 @@
*
* ... -----Hboundary----- ...
*
- * _\ TFluid
+ * _\ Tf
* / /
* \__/
*
*/
static const double vertices[4/*#vertices*/*2/*#coords per vertex*/] = {
- -10000.5,-0.5,
- -10000.5, 0.5,
- 10000.5, 0.5,
- 10000.5,-0.5
+ -1000000.5,-0.5,
+ -1000000.5, 0.5,
+ 1000000.5, 0.5,
+ 1000000.5,-0.5
};
static const size_t nvertices = sizeof(vertices)/sizeof(double[2]);
@@ -200,6 +199,8 @@ interface_get_temperature
int
main(int argc, char** argv)
{
+ char dump[128];
+ struct time t0, t1;
struct mem_allocator allocator;
struct solid* solid_param = NULL;
struct fluid* fluid_param = NULL;
@@ -223,8 +224,7 @@ main(int argc, char** argv)
double pos[2];
double time_range[2] = { INF, INF };
double Tref;
- double a, b, x;
- double L;
+ double x;
(void)argc, (void)argv;
OK(mem_init_proxy_allocator(&allocator, &mem_default_allocator));
@@ -238,14 +238,14 @@ main(int argc, char** argv)
OK(sdis_data_create
(dev, sizeof(struct fluid), ALIGNOF(struct fluid), NULL, &data));
fluid_param = sdis_data_get(data);
- fluid_param->temperature = Tf1;
+ fluid_param->temperature = Tf;
OK(sdis_fluid_create(dev, &fluid_shader, data, &fluid1));
OK(sdis_data_ref_put(data));
OK(sdis_data_create
(dev, sizeof(struct fluid), ALIGNOF(struct fluid), NULL, &data));
fluid_param = sdis_data_get(data);
- fluid_param->temperature = Tf2;
+ fluid_param->temperature = Tf;
OK(sdis_fluid_create(dev, &fluid_shader, data, &fluid2));
OK(sdis_data_ref_put(data));
@@ -288,7 +288,7 @@ main(int argc, char** argv)
OK(sdis_data_create (dev, sizeof(struct interf), ALIGNOF(struct interf),
NULL, &data));
interf_param = sdis_data_get(data);
- interf_param->h = H1;
+ interf_param->h = H;
interf_param->temperature = -1;
OK(sdis_interface_create(dev, solid, fluid1, &interf_shader, data,
&interf_solid_fluid1));
@@ -298,7 +298,7 @@ main(int argc, char** argv)
OK(sdis_data_create (dev, sizeof(struct interf), ALIGNOF(struct interf),
NULL, &data));
interf_param = sdis_data_get(data);
- interf_param->h = H2;
+ interf_param->h = H;
interf_param->temperature = -1;
OK(sdis_interface_create(dev, solid, fluid2, &interf_shader, data,
&interf_solid_fluid2));
@@ -332,13 +332,9 @@ main(int argc, char** argv)
pos[0] = 0;
pos[1] = 0.25;
- L = vertices[3] - vertices[1];
#if 1
- x = pos[1] + vertices[3];
- a = (H2*Power*L + H1*H2*(Tf1 - Tf2) + H1*H2*Power*L*L/(2*LAMBDA))
- / (LAMBDA * (H1 + H2) + H1*H2*L);
- b = Tf2 + a * LAMBDA / H2;
- Tref = -Power / (2*LAMBDA) * x*x + a * x + b;
+ x = pos[1];
+ Tref = -Power / (2*LAMBDA) * x*x + Tf + Power/(2*H) + Power/(8*LAMBDA);
#else
tmp = LAMBDA / L;
T1 = H1 * (H2+tmp) / (tmp*(H1+H2) + H1*H2) * Tf1
@@ -348,7 +344,12 @@ main(int argc, char** argv)
Tref = T2 + (T1-T2)/L * (pos[1] + vertices[3]);
#endif
+ time_current(&t0);
OK(sdis_solve_probe(scn, N, pos, time_range, 1.f, -1, 0, 0, &estimator));
+ time_sub(&t0, time_current(&t1), &t0);
+ time_dump(&t0, TIME_ALL, NULL, dump, sizeof(dump));
+ printf("Elapsed time = %s\n", dump);
+
OK(sdis_estimator_get_temperature(estimator, &T));
OK(sdis_estimator_get_realisation_count(estimator, &nreals));
OK(sdis_estimator_get_failure_count(estimator, &nfails));