commit 38b608321d0df1918d170aa6fd2ebbce54913828
parent ee7fffb9a792e665176e510ee958697bff88c6a4
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 22 Jun 2018 10:23:12 +0200
Small update of the volumic_power test
Diffstat:
1 file changed, 34 insertions(+), 11 deletions(-)
diff --git a/src/test_sdis_volumic_power.c b/src/test_sdis_volumic_power.c
@@ -115,6 +115,13 @@ square_get_interface
/*******************************************************************************
* Media
******************************************************************************/
+struct solid {
+ double lambda;
+ double rho;
+ double cp;
+ double delta;
+};
+
static double
fluid_get_temperature
(const struct sdis_rwalk_vertex* vtx, struct sdis_data* data)
@@ -128,36 +135,32 @@ static double
solid_get_calorific_capacity
(const struct sdis_rwalk_vertex* vtx, struct sdis_data* data)
{
- (void)data;
CHK(vtx != NULL);
- return 2.0;
+ return ((struct solid*)sdis_data_cget(data))->cp;
}
static double
solid_get_thermal_conductivity
(const struct sdis_rwalk_vertex* vtx, struct sdis_data* data)
{
- (void)data;
CHK(vtx != NULL);
- return LAMBDA;
+ return ((struct solid*)sdis_data_cget(data))->lambda;
}
static double
solid_get_volumic_mass
(const struct sdis_rwalk_vertex* vtx, struct sdis_data* data)
{
- (void)data;
CHK(vtx != NULL);
- return 25.0;
+ return ((struct solid*)sdis_data_cget(data))->rho;
}
static double
solid_get_delta
(const struct sdis_rwalk_vertex* vtx, struct sdis_data* data)
{
- (void)data;
CHK(vtx != NULL);
- return DELTA;
+ return ((struct solid*)sdis_data_cget(data))->delta;
}
static double
@@ -214,6 +217,7 @@ main(int argc, char** argv)
struct sdis_device* dev = NULL;
struct sdis_medium* fluid = NULL;
struct sdis_medium* solid = NULL;
+ struct sdis_medium* solid2 = NULL; /* For debug */
struct sdis_interface* interf_adiabatic = NULL;
struct sdis_interface* interf_T0 = NULL;
struct sdis_scene* box_scn = NULL;
@@ -225,6 +229,7 @@ main(int argc, char** argv)
struct sdis_interface* box_interfaces[12 /*#triangles*/];
struct sdis_interface* square_interfaces[4/*#segments*/];
struct interf* interf_props = NULL;
+ struct solid* solid_props = NULL;
double pos[3];
double x;
double ref;
@@ -236,18 +241,35 @@ main(int argc, char** argv)
CHK(sdis_device_create
(NULL, &allocator, SDIS_NTHREADS_DEFAULT, 0, &dev) == RES_OK);
- /* Create the fluid medium */
fluid_shader.temperature = fluid_get_temperature;
CHK(sdis_fluid_create(dev, &fluid_shader, NULL, &fluid) == RES_OK);
- /* Create the solid_medium */
+ /* Setup the solid shader */
solid_shader.calorific_capacity = solid_get_calorific_capacity;
solid_shader.thermal_conductivity = solid_get_thermal_conductivity;
solid_shader.volumic_mass = solid_get_volumic_mass;
solid_shader.delta_solid = solid_get_delta;
solid_shader.temperature = solid_get_temperature;
solid_shader.volumic_power = solid_get_volumic_power;
- CHK(sdis_solid_create(dev, &solid_shader, NULL, &solid) == RES_OK);
+
+ /* Create the solid medium */
+ CHK(sdis_data_create(dev, sizeof(struct solid), 16, NULL, &data) == RES_OK);
+ solid_props = sdis_data_get(data);
+ solid_props->lambda = LAMBDA;
+ solid_props->cp = 2;
+ solid_props->rho = 25;
+ solid_props->delta = DELTA;
+ CHK(sdis_solid_create(dev, &solid_shader, data, &solid) == RES_OK);
+ CHK(sdis_data_ref_put(data) == RES_OK);
+
+ CHK(sdis_data_create(dev, sizeof(struct solid), 16, NULL, &data) == RES_OK);
+ solid_props = sdis_data_get(data);
+ solid_props->lambda = 0;
+ solid_props->cp = 0;
+ solid_props->rho = 0;
+ solid_props->delta = DELTA/4;
+ CHK(sdis_solid_create(dev, &solid_shader, data, &solid2) == RES_OK);
+ CHK(sdis_data_ref_put(data) == RES_OK);
/* Setup the interface shader */
interf_shader.convection_coef = interface_get_convection_coef;
@@ -271,6 +293,7 @@ main(int argc, char** argv)
/* Release the media */
CHK(sdis_medium_ref_put(solid) == RES_OK);
+ CHK(sdis_medium_ref_put(solid2) == RES_OK);
CHK(sdis_medium_ref_put(fluid) == RES_OK);
/* Map the interfaces to their box triangles */