stardis-solver

Solve coupled heat transfers
git clone git://git.meso-star.fr/stardis-solver.git
Log | Files | Refs | README | LICENSE

commit 6226c8528bb7818552f463e217f1bd16ae3e6867
parent d4f04e95cdf0c8484edac2174d70eb8be5f11c7a
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 23 May 2018 23:01:43 +0200

Push further the tests of the volumic_power2_2d test

Diffstat:
Msrc/sdis_solve_Xd.h | 21++++++++++++++++++++-
Msrc/test_sdis_volumic_power2_2d.c | 23+++++++++++++----------
2 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/src/sdis_solve_Xd.h b/src/sdis_solve_Xd.h @@ -512,7 +512,7 @@ XD(solid_fluid_boundary_temperature) ASSERT(scn && fp_to_meter > 0 && rwalk && rng && T && ctx); ASSERT(XD(check_rwalk_fragment_consistency)(rwalk, frag)); - /* Retrieve the solid and the fluid split by the boundary */ + /* Retrieve the solid and the fluid split by the boundary */ interf = scene_get_interface(scn, rwalk->hit.prim.prim_id); mdm_front = interface_get_medium(interf, SDIS_FRONT); mdm_back = interface_get_medium(interf, SDIS_BACK); @@ -658,10 +658,20 @@ XD(solid_temperature) { double position_start[DIM]; const struct sdis_medium* mdm; + float low[DIM], upp[DIM]; + int i; ASSERT(scn && fp_to_meter > 0 && rwalk && rng && T); ASSERT(rwalk->mdm->type == SDIS_SOLID); (void)ctx; + /* FIXME hack */ + SXD(scene_view_get_aabb(scn->sXd(view), low, upp)); + FOR_EACH(i, 0, DIM) { + low[i] *= low[i] < 0 ? 1.01f : 0.99f; + upp[i] *= upp[i] < 0 ? 0.99f : 1.01f; + } + + /* Check the random walk consistency */ CHK(scene_get_medium(scn, rwalk->vtx.P, NULL, &mdm) == RES_OK); if(mdm != rwalk->mdm) { @@ -759,6 +769,14 @@ XD(solid_temperature) /* Update the random walk position */ XD(move_pos)(rwalk->vtx.P, dir0, delta); +#if 0 + FOR_EACH(i, 0, DIM) { + if(rwalk->vtx.P[i] < low[i] || rwalk->vtx.P[i] > upp[i]) { + log_err(scn->dev,"%s: invalid solid random walk.\n", FUNC_NAME); + return RES_BAD_OP; + } + } +#else /* Fetch the current medium */ if(SXD_HIT_NONE(&rwalk->hit)) { CHK(scene_get_medium(scn, rwalk->vtx.P, &info, &mdm) == RES_OK); @@ -796,6 +814,7 @@ XD(solid_temperature) #undef VEC_SPLIT return RES_BAD_OP; } +#endif /* Keep going while the solid random walk does not hit an interface */ } while(SXD_HIT_NONE(&rwalk->hit)); diff --git a/src/test_sdis_volumic_power2_2d.c b/src/test_sdis_volumic_power2_2d.c @@ -17,21 +17,27 @@ #include "test_sdis_utils.h" #include <rsys/math.h> -#define Tboundary1 373.15 -#define Tboundary2 273.15 +#define N 10000 /* #realisations */ +#define NONE -1 /* H delta T */ +/*#define Tboundary1 NONE +#define Tboundary2 NONE*/ /*#define DELTA 0.01*/ /* 324.258 +/- 2.52665; #failures: 0 */ /*#define DELTA 0.005*/ /* 314.234 +/- 2.48794; #failures: 4 */ /*#define DELTA 0.0025*/ /* 306.579 +/- 2.36081; #failures: 26 */ /*#define DELTA 0.00125 */ /* 297.787 +/- 2.3423; #failures: 0 */ /*#define DELTA 0.000625*/ /* 284.659 +/- 2.18559; #failures: 379 */ -/* Dirichlets */ -/*#define DELTA 0.01*/ /* 290.442 +/- 2.18906; #failures: 0 */ -/*#define DELTA 0.005*/ /* 270.611 +/- 1.98415; #failures: 0 */ -/*#define DELTA 0.0025*/ /* 264.352 +/- 1.96071; #failures: 0 */ -#define DELTA 0.00125 +/* Dirichlets : expected 246.93 C*/ +#define Tboundary1 373.15 +#define Tboundary2 273.15 +/*#define DELTA 0.01*/ /* 287.487 +/- 2.17576; #failures: 0 */ +/*#define DELTA 0.005*/ /* 273.532 +/- 1.98965; #failures: 0 */ +/*#define DELTA 0.0025*/ /* 263.626 +/- 1.90191; #failures: 0 */ +/*#define DELTA 0.00125*/ /* 256.081 +/- 1.8687; #failures: 0 */ +/*#define DELTA 0.000625*/ /* 250.615 +/- 1.80813; #failures: 0 */ +#define DELTA 0.0003125 /* */ /* * _\ T1 @@ -55,7 +61,6 @@ * \__/ */ - static const double vertices[8/*#vertices*/*2/*#coords per vertex*/] = { -0.5,-1.0, -0.5, 1.0, @@ -245,9 +250,7 @@ main(int argc, char** argv) struct sdis_interface* interfaces[8 /*#segment*/]; struct sdis_mc T = SDIS_MC_NULL; size_t nfails, nreals; - const size_t N = 10000; double pos[2]; - size_t i; (void)argc, (void)argv; CHK(mem_init_proxy_allocator(&allocator, &mem_default_allocator) == RES_OK);