stardis-solver

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

commit 8602f12a2b64d4631b8b7b281440666c3da322d4
parent a5f9211726fe4378464d84b9c53b9a804ed15f1d
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 21 Feb 2018 12:06:07 +0100

Merge branch 'feature_radiative' into develop

Diffstat:
M.gitignore | 1+
Mcmake/CMakeLists.txt | 2++
Msrc/sdis.h | 14++++++++++----
Msrc/sdis_interface.c | 15++++++---------
Msrc/sdis_interface_c.h | 18++++++++++++++++++
Msrc/sdis_scene.c | 1+
Msrc/sdis_scene_c.h | 2++
Msrc/sdis_solve_probe.c | 8+++++---
Msrc/sdis_solve_probe_Xd.h | 268++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
Asrc/test_sdis_conducto_radiative.c | 430+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/test_sdis_conducto_radiative_2d.c | 405+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/test_sdis_interface.c | 9++++++++-
Msrc/test_sdis_solve_probe.c | 35+++++++++++++++++++++++++++++------
Msrc/test_sdis_solve_probe2.c | 16+++++++++++-----
Msrc/test_sdis_solve_probe2_2d.c | 16+++++++++++-----
Msrc/test_sdis_solve_probe3.c | 18+++++++++++++-----
Msrc/test_sdis_solve_probe3_2d.c | 19+++++++++++++------
Msrc/test_sdis_solve_probe_2d.c | 12+++++++++++-
Msrc/test_sdis_utils.h | 10++++++++--
19 files changed, 1216 insertions(+), 83 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,3 +1,4 @@ +compile_commands.json .gitignore CMakeCache.txt CMakeFiles diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -119,9 +119,11 @@ if(NOT NO_TEST) new_test(test_sdis_solve_probe) new_test(test_sdis_solve_probe2) new_test(test_sdis_solve_probe3) + new_test(test_sdis_conducto_radiative) new_test(test_sdis_solve_probe_2d) new_test(test_sdis_solve_probe2_2d) new_test(test_sdis_solve_probe3_2d) + new_test(test_sdis_conducto_radiative_2d) target_link_libraries(test_sdis_solve_probe3 Star3DUT) if(CMAKE_COMPILER_IS_GNUCC) diff --git a/src/sdis.h b/src/sdis.h @@ -143,7 +143,11 @@ static const struct sdis_fluid_shader SDIS_FLUID_SHADER_NULL = struct sdis_interface_shader { sdis_interface_getter_T temperature; /* Limit condition. NULL <=> Unknown */ - sdis_interface_getter_T convection_coef; /* NULL <=> Solid/Solid interface */ + sdis_interface_getter_T convection_coef; /* May be NULL for solid/solid */ + + /* Interface emssivity. May be NULL for solid/solid interface */ + sdis_interface_getter_T emissivity; /* Overall emissivity */ + sdis_interface_getter_T specular_fraction; /* Specular fraction in [0, 1] */ }; #define SDIS_INTERFACE_SHADER_NULL__ {NULL} static const struct sdis_interface_shader SDIS_INTERFACE_SHADER_NULL = @@ -327,10 +331,12 @@ sdis_estimator_get_temperature SDIS_API res_T sdis_solve_probe (struct sdis_scene* scn, - const size_t nrealisations, - const double position[3], - const double time, + const size_t nrealisations, /* #realisations */ + const double position[3], /* Probe position */ + const double time, /* Observation time */ const double fp_to_meter,/* Scale from floating point units to meters */ + const double ambient_radiative_temperature, + const double reference_temperature, struct sdis_estimator** estimator); END_DECLS diff --git a/src/sdis_interface.c b/src/sdis_interface.c @@ -41,15 +41,12 @@ check_interface_shader type1 = sdis_medium_get_type(back); /* Fluid<->solid interface */ - if(type0 != type1 && shader->convection_coef == NULL) { - return 0; - } - - /* Solid<->solid interface */ - if(type0 == SDIS_MEDIUM_SOLID - && type1 == SDIS_MEDIUM_SOLID - && shader->convection_coef) { - return 0; + if(type0 != type1) { + if(shader->convection_coef == NULL + || shader->emissivity == NULL + || shader->specular_fraction == NULL) { + return 0; + } } return 1; diff --git a/src/sdis_interface_c.h b/src/sdis_interface_c.h @@ -76,5 +76,23 @@ interface_get_convection_coef return interf->shader.convection_coef(frag, interf->data); } +static INLINE double +interface_get_emissivity + (const struct sdis_interface* interf, + const struct sdis_interface_fragment* frag) +{ + ASSERT(interf && frag); + return interf->shader.emissivity(frag, interf->data); +} + +static INLINE double +interface_get_specular_fraction + (const struct sdis_interface* interf, + const struct sdis_interface_fragment* frag) +{ + ASSERT(interf && frag); + return interf->shader.specular_fraction(frag, interf->data); +} + #endif /* SDIS_INTERFACE_C_H */ diff --git a/src/sdis_scene.c b/src/sdis_scene.c @@ -361,6 +361,7 @@ scene_create ref_init(&scn->ref); SDIS(device_ref_get(dev)); scn->dev = dev; + scn->ambient_radiative_temperature = -1; darray_interf_init(dev->allocator, &scn->interfaces); darray_interf_init(dev->allocator, &scn->prim_interfaces); diff --git a/src/sdis_scene_c.h b/src/sdis_scene_c.h @@ -40,6 +40,8 @@ struct sdis_scene { struct s2d_scene_view* s2d_view; struct s3d_scene_view* s3d_view; + double ambient_radiative_temperature; /* In Kelvin */ + ref_T ref; struct sdis_device* dev; }; diff --git a/src/sdis_solve_probe.c b/src/sdis_solve_probe.c @@ -36,6 +36,8 @@ sdis_solve_probe const double position[3], const double time, const double fp_to_meter,/* Scale factor from floating point unit to meter */ + const double Tarad, /* Ambient radiative temperature */ + const double Tref, /* Reference temperature */ struct sdis_estimator** out_estimator) { const struct sdis_medium* medium = NULL; @@ -50,7 +52,7 @@ sdis_solve_probe ATOMIC res = RES_OK; if(!scn || !nrealisations || !position || time < 0 || fp_to_meter <= 0 - || !out_estimator) { + || Tref < 0 || !out_estimator) { res = RES_BAD_ARG; goto error; } @@ -92,10 +94,10 @@ sdis_solve_probe if(scene_is_2d(scn)) { res_local = probe_realisation_2d - (scn, rng, medium, position, time, fp_to_meter, &w); + (scn, rng, medium, position, time, fp_to_meter, Tarad, Tref, &w); } else { res_local = probe_realisation_3d - (scn, rng, medium, position, time, fp_to_meter, &w); + (scn, rng, medium, position, time, fp_to_meter, Tarad, Tref, &w); } if(res_local != RES_OK) { if(res_local == RES_BAD_OP) { diff --git a/src/sdis_solve_probe_Xd.h b/src/sdis_solve_probe_Xd.h @@ -30,6 +30,28 @@ * to handle numerical imprecisions */ #define RAY_RANGE_MAX_SCALE 1.0001f +#define BOLTZMANN_CONSTANT 5.6696e-8 /* W/m^2/K^4 */ + +struct rwalk_context { + double Tarad; /* Ambient radiative temperature */ + double Tref3; /* Reference temperature ^ 3 */ +}; + +/* Reflect the vector V wrt the normal N. By convention V points outward the + * surface. */ +static INLINE float* +reflect(float res[3], const float V[3], const float N[3]) +{ + float tmp[3]; + float cos_V_N; + ASSERT(res && V && N); + ASSERT(f3_is_normalized(V) && f3_is_normalized(N)); + cos_V_N = f3_dot(V, N); + f3_mulf(tmp, N, 2*cos_V_N); + f3_sub(res, tmp, V); + return res; +} + #endif /* SDIS_SOLVE_PROBE_XD_H */ #else @@ -79,6 +101,7 @@ struct XD(temperature) { res_T (*func)/* Next function to invoke in order to compute the temperature */ (const struct sdis_scene* scn, const double fp_to_meter, + const struct rwalk_context* ctx, struct XD(rwalk)* rwalk, struct ssp_rng* rng, struct XD(temperature)* temp); @@ -91,6 +114,7 @@ static res_T XD(boundary_temperature) (const struct sdis_scene* scn, const double fp_to_meter, + const struct rwalk_context* ctx, struct XD(rwalk)* rwalk, struct ssp_rng* rng, struct XD(temperature)* T); @@ -99,6 +123,7 @@ static res_T XD(solid_temperature) (const struct sdis_scene* scn, const double fp_to_meter, + const struct rwalk_context* ctx, struct XD(rwalk)* rwalk, struct ssp_rng* rng, struct XD(temperature)* T); @@ -107,6 +132,16 @@ static res_T XD(fluid_temperature) (const struct sdis_scene* scn, const double fp_to_meter, + const struct rwalk_context* ctx, + struct XD(rwalk)* rwalk, + struct ssp_rng* rng, + struct XD(temperature)* T); + +static res_T +XD(radiative_temperature) + (const struct sdis_scene* scn, + const double fp_to_meter, + const struct rwalk_context* ctx, struct XD(rwalk)* rwalk, struct ssp_rng* rng, struct XD(temperature)* T); @@ -114,16 +149,16 @@ XD(fluid_temperature) /******************************************************************************* * Helper functions ******************************************************************************/ + static FINLINE void XD(move_pos)(double pos[DIM], const float dir[DIM], const float delta) { ASSERT(pos && dir); pos[0] += dir[0] * delta; pos[1] += dir[1] * delta; -#if (SDIS_SOLVE_PROBE_DIMENSION == 3) +#if(SDIS_SOLVE_PROBE_DIMENSION == 3) pos[2] += dir[2] * delta; #endif - } /* Check that the interface fragment is consistent with the current state of @@ -153,16 +188,147 @@ XD(check_rwalk_fragment_consistency) } res_T +XD(radiative_temperature) + (const struct sdis_scene* scn, + const double fp_to_meter, + const struct rwalk_context* ctx, + struct XD(rwalk)* rwalk, + struct ssp_rng* rng, + struct XD(temperature)* T) +{ + const struct sdis_interface* interf; + + /* The radiative random walk is always perform in 3D. In 2D, the geometry are + * assumed to be extruded to the infinty along the Z dimension. */ + float N[3] = {0, 0, 0}; + float dir[3] = {0, 0, 0}; + + res_T res = RES_OK; + + ASSERT(scn && fp_to_meter > 0 && ctx && rwalk && rng && T); + ASSERT(!SXD_HIT_NONE(&rwalk->hit)); + (void)fp_to_meter; + + /* Fetch the current interface */ + interf = scene_get_interface(scn, rwalk->hit.prim.prim_id); + + /* Normalize the normal of the interface and ensure that it points toward the + * current medium */ + fX(normalize(N, rwalk->hit.normal)); + if(interf->medium_back == rwalk->mdm) { + fX(minus(N, N)); + } + + /* Cosine weighted sampling of a direction around the surface normal */ + ssp_ran_hemisphere_cos_float(rng, N, dir, NULL); + + /* Launch the radiative random walk */ + for(;;) { + struct sdis_interface_fragment frag = SDIS_INTERFACE_FRAGMENT_NULL; + const struct sdis_medium* chk_mdm = NULL; + double alpha; + double epsilon; + double r; + float pos[DIM]; + const float range[2] = { 0, FLT_MAX }; + + fX_set_dX(pos, rwalk->vtx.P); + + /* Trace the radiative ray */ +#if (SDIS_SOLVE_PROBE_DIMENSION == 2) + SXD(scene_view_trace_ray_3d + (scn->sXd(view), pos, dir, range, &rwalk->hit, &rwalk->hit)); +#else + SXD(scene_view_trace_ray + (scn->sXd(view), pos, dir, range, &rwalk->hit, &rwalk->hit)); +#endif + if(SXD_HIT_NONE(&rwalk->hit)) { /* Fetch the ambient radiative temperature */ + if(ctx->Tarad >= 0) { + T->value += ctx->Tarad; + T->done = 1; + break; + } else { + log_err(scn->dev, +"%s: the random walk reaches an invalid ambient radiative temperature of `%gK'\n" +"at position `%g %g %g'. This may be due to numerical inaccuracies or to\n" +"inconsistency in the simulated system (eg: unclosed geometry). For systems\n" +"where the random walks can reach such temperature, one has to setup a valid\n" +"ambient radiative temperature, i.e. it must be greater or equal to 0.\n", + FUNC_NAME, + ctx->Tarad, + SPLIT3(rwalk->vtx.P)); + res = RES_BAD_ARG; + goto error; + } + } + + /* Move the random walk to the hit position */ + XD(move_pos)(rwalk->vtx.P, dir, rwalk->hit.distance); + + /* Fetch the new interface and setup the hit fragment */ + interf = scene_get_interface(scn, rwalk->hit.prim.prim_id); + XD(setup_interface_fragment)(&frag, &rwalk->vtx, &rwalk->hit); + + /* Fetch the interface emissivity */ + epsilon = interface_get_emissivity(interf, &frag); + if(epsilon > 1 && epsilon >= 0) { + log_err(scn->dev, + "%s: invalid overall emissivity `%g' at position `%g %g %g'.\n", + FUNC_NAME, epsilon, SPLIT3(rwalk->vtx.P)); + res = RES_BAD_ARG; + goto error; + } + + /* Switch in boundary temperature ? */ + r = ssp_rng_canonical(rng); + if(r < epsilon) { + T->func = XD(boundary_temperature); + break; + } + + /* Normalize the normal of the interface and ensure that it points toward the + * current medium */ + fX(normalize)(N, rwalk->hit.normal); + if(f3_dot(N, dir) > 0) { + chk_mdm = interf->medium_back; + fX(minus)(N, N); + } else { + chk_mdm = interf->medium_front; + } + + if(chk_mdm != rwalk->mdm) { + log_err(scn->dev, "%s: inconsistent medium definition at `%g %g %g'.\n", + FUNC_NAME, SPLIT3(rwalk->vtx.P)); + res = RES_BAD_ARG; + goto error; + } + alpha = interface_get_specular_fraction(interf, &frag); + r = ssp_rng_canonical(rng); + if(r < alpha) { /* Sample specular part */ + reflect(dir, f3_minus(dir, dir), N); + } else { /* Sample diffuse part */ + ssp_ran_hemisphere_cos_float(rng, N, dir, NULL); + } + } + +exit: + return res; +error: + goto exit; +} + +res_T XD(fluid_temperature) (const struct sdis_scene* scn, const double fp_to_meter, + const struct rwalk_context* ctx, struct XD(rwalk)* rwalk, struct ssp_rng* rng, struct XD(temperature)* T) { double tmp; - (void)rng, (void)fp_to_meter; - ASSERT(scn && fp_to_meter > 0 && rwalk && rng && T); + (void)rng, (void)fp_to_meter, (void)ctx; + ASSERT(scn && fp_to_meter > 0 && ctx && rwalk && rng && T); ASSERT(rwalk->mdm->type == SDIS_MEDIUM_FLUID); tmp = fluid_get_temperature(rwalk->mdm, &rwalk->vtx); @@ -180,6 +346,7 @@ static void XD(solid_solid_boundary_temperature) (const struct sdis_scene* scn, const double fp_to_meter, + const struct rwalk_context* ctx, const struct sdis_interface_fragment* frag, struct XD(rwalk)* rwalk, struct ssp_rng* rng, @@ -196,9 +363,9 @@ XD(solid_solid_boundary_temperature) double tmp; double r; float pos[DIM], dir[DIM], range[2]; - ASSERT(scn && fp_to_meter > 0 && frag && rwalk && rng && T); + ASSERT(scn && fp_to_meter > 0 && ctx && frag && rwalk && rng && T); ASSERT(XD(check_rwalk_fragment_consistency)(rwalk, frag)); - (void)frag; + (void)frag, (void)ctx; /* Retrieve the current boundary media */ interf = scene_get_interface(scn, rwalk->hit.prim.prim_id); @@ -248,6 +415,7 @@ static void XD(solid_fluid_boundary_temperature) (const struct sdis_scene* scn, const double fp_to_meter, + const struct rwalk_context* ctx, const struct sdis_interface_fragment* frag, struct XD(rwalk)* rwalk, struct ssp_rng* rng, @@ -259,14 +427,17 @@ XD(solid_fluid_boundary_temperature) const struct sdis_medium* solid = NULL; const struct sdis_medium* fluid = NULL; double hc; + double hr; + double epsilon; /* Interface emissivity */ double lambda; double fluid_proba; + double radia_proba; double delta_boundary; double r; double tmp; float dir[DIM], pos[DIM], range[2]; - ASSERT(scn && fp_to_meter > 0 && rwalk && rng && T); + 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 */ @@ -285,14 +456,25 @@ XD(solid_fluid_boundary_temperature) /* Fetch the solid properties */ lambda = solid_get_thermal_conductivity(solid, &rwalk->vtx); delta_boundary = solid_get_delta_boundary(solid, &rwalk->vtx); + + /* Fetch the boundary properties */ + epsilon = interface_get_emissivity(interf, frag); hc = interface_get_convection_coef(interf, frag); + /* Compute the radiative coefficient */ + hr = 4.0 * BOLTZMANN_CONSTANT * ctx->Tref3 * epsilon; + /* Compute the probas to switch in solid or fluid random walk */ tmp = lambda / (delta_boundary*fp_to_meter); - fluid_proba = hc / (tmp + hc); + fluid_proba = hc / (tmp + hr + hc); + radia_proba = hr / (tmp + hr + hc); + /*solid_proba = tmp / (tmp + hr + hc);*/ r = ssp_rng_canonical(rng); - if(r < fluid_proba) { /* Switch to fluid random walk */ + if(r < radia_proba) { /* Switch in radiative random walk */ + rwalk->mdm = fluid; + T->func = XD(radiative_temperature); + } else if(r < fluid_proba + radia_proba) { /* Switch to fluid random walk */ rwalk->mdm = fluid; T->func = XD(fluid_temperature); } else { /* Solid random walk */ @@ -317,6 +499,7 @@ res_T XD(boundary_temperature) (const struct sdis_scene* scn, const double fp_to_meter, + const struct rwalk_context* ctx, struct XD(rwalk)* rwalk, struct ssp_rng* rng, struct XD(temperature)* T) @@ -326,7 +509,7 @@ XD(boundary_temperature) const struct sdis_medium* mdm_front = NULL; const struct sdis_medium* mdm_back = NULL; double tmp; - ASSERT(scn && fp_to_meter > 0 && rwalk && rng && T); + ASSERT(scn && fp_to_meter > 0 && ctx && rwalk && rng && T); ASSERT(!SXD_HIT_NONE(&rwalk->hit)); XD(setup_interface_fragment)(&frag, &rwalk->vtx, &rwalk->hit); @@ -346,9 +529,11 @@ XD(boundary_temperature) mdm_back = interface_get_medium(interf, SDIS_BACK); if(mdm_front->type == mdm_back->type) { - XD(solid_solid_boundary_temperature)(scn, fp_to_meter, &frag, rwalk, rng, T); + XD(solid_solid_boundary_temperature) + (scn, fp_to_meter, ctx, &frag, rwalk, rng, T); } else { - XD(solid_fluid_boundary_temperature)(scn, fp_to_meter, &frag, rwalk, rng, T); + XD(solid_fluid_boundary_temperature) + (scn, fp_to_meter, ctx, &frag, rwalk, rng, T); } return RES_OK; } @@ -357,6 +542,7 @@ res_T XD(solid_temperature) (const struct sdis_scene* scn, const double fp_to_meter, + const struct rwalk_context* ctx, struct XD(rwalk)* rwalk, struct ssp_rng* rng, struct XD(temperature)* T) @@ -365,6 +551,7 @@ XD(solid_temperature) const struct sdis_medium* mdm; ASSERT(scn && fp_to_meter > 0 && rwalk && rng && T); ASSERT(rwalk->mdm->type == SDIS_MEDIUM_SOLID); + (void)ctx; /* Check the random walk consistency */ CHK(scene_get_medium(scn, rwalk->vtx.P, &mdm) == RES_OK); @@ -485,6 +672,7 @@ static res_T XD(compute_temperature) (struct sdis_scene* scn, const double fp_to_meter, + const struct rwalk_context* ctx, struct XD(rwalk)* rwalk, struct ssp_rng* rng, struct XD(temperature)* T) @@ -494,10 +682,10 @@ XD(compute_temperature) size_t istack = 0; #endif res_T res = RES_OK; - ASSERT(scn && fp_to_meter && rwalk && rng && T); + ASSERT(scn && fp_to_meter > 0 && ctx && rwalk && rng && T); do { - res = T->func(scn, fp_to_meter, rwalk, rng, T); + res = T->func(scn, fp_to_meter, ctx, rwalk, rng, T); if(res != RES_OK) goto error; #ifndef NDEBUG @@ -523,31 +711,39 @@ XD(probe_realisation) const double position[], const double time, const double fp_to_meter,/* Scale factor from floating point unit to meter */ + const double ambient_radiative_temperature, + const double reference_temperature, double* weight) { - struct XD(rwalk) rwalk = XD(RWALK_NULL); - struct XD(temperature) T = XD(TEMPERATURE_NULL); - res_T res = RES_OK; - ASSERT(medium && position && fp_to_meter > 0 && weight && time >= 0); - - switch(medium->type) { - case SDIS_MEDIUM_FLUID: T.func = XD(fluid_temperature); break; - case SDIS_MEDIUM_SOLID: T.func = XD(solid_temperature); break; - default: FATAL("Unreachable code\n"); break; - } - - dX(set)(rwalk.vtx.P, position); - rwalk.vtx.time = time; - rwalk.hit = SXD_HIT_NULL; - rwalk.mdm = medium; - - res = XD(compute_temperature)(scn, fp_to_meter, &rwalk, rng, &T); - if(res != RES_OK) return res; - - *weight = T.value; - return RES_OK; -} + struct rwalk_context ctx; + struct XD(rwalk) rwalk = XD(RWALK_NULL); + struct XD(temperature) T = XD(TEMPERATURE_NULL); + res_T res = RES_OK; + ASSERT(medium && position && fp_to_meter > 0 && weight && time >= 0); + + switch(medium->type) { + case SDIS_MEDIUM_FLUID: T.func = XD(fluid_temperature); break; + case SDIS_MEDIUM_SOLID: T.func = XD(solid_temperature); break; + default: FATAL("Unreachable code\n"); break; + } + dX(set)(rwalk.vtx.P, position); + rwalk.vtx.time = time; + rwalk.hit = SXD_HIT_NULL; + rwalk.mdm = medium; + + ctx.Tarad = ambient_radiative_temperature; + ctx.Tref3 = + reference_temperature + * reference_temperature + * reference_temperature; + + res = XD(compute_temperature)(scn, fp_to_meter, &ctx, &rwalk, rng, &T); + if(res != RES_OK) return res; + + *weight = T.value; + return RES_OK; +} #undef SDIS_SOLVE_PROBE_DIMENSION #undef DIM diff --git a/src/test_sdis_conducto_radiative.c b/src/test_sdis_conducto_radiative.c @@ -0,0 +1,430 @@ +/* Copyright (C) |Meso|Star> 2016-2018 (contact@meso-star.com) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include "sdis.h" +#include "test_sdis_utils.h" + +#include <rsys/math.h> +#include <star/ssp.h> + +#define UNKNOWN_TEMPERATURE -1 + +/* The scene is composed of a solid cube whose temperature is unknown. The cube + * faces on +/-X are in contact with a fluid and their convection coefficient + * is null while their emissivity is 1. The left and right fluids are enclosed + * by surfaces whose emissivity are null excepted for the faces orthogonal to + * the X axis that are fully emissive and whose temperature is known. The + * medium that surrounds the solid cube and the 2 fluids is a solid with a null + * conductivity. + * + * Y (1, 1, 1) + * | +------+----------+------+ (1.5,1,1) + * o--- X /' /##########/' /| + * / +------+----------+------+ | + * Z | ' |##########|*' | | 310K + * | ' |##########|*' | | + * 300K | ' E=1|##########|*'E=1 | | + * | +....|##########|*+....|.+ + * |/ |##########|/ |/ + * (-1.5,-1,-1) +------+----------+------+ + * (-1,-1,-1) + */ + +/******************************************************************************* + * Geometry + ******************************************************************************/ +struct geometry { + const double* positions; + const size_t* indices; + struct sdis_interface** interfaces; +}; + +static const double vertices[16/*#vertices*/*3/*#coords per vertex*/] = { + -1.0,-1.0,-1.0, + 1.0,-1.0,-1.0, + -1.0, 1.0,-1.0, + 1.0, 1.0,-1.0, + -1.0,-1.0, 1.0, + 1.0,-1.0, 1.0, + -1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, + -1.5,-1.0,-1.0, + 1.5,-1.0,-1.0, + -1.5, 1.0,-1.0, + 1.5, 1.0,-1.0, + -1.5,-1.0, 1.0, + 1.5,-1.0, 1.0, + -1.5, 1.0, 1.0, + 1.5, 1.0, 1.0, +}; +static const size_t nvertices = sizeof(vertices) / sizeof(double[3]); + +static const size_t indices[32/*#triangles*/*3/*#indices per triangle*/] = { + 0, 2, 1, 1, 2, 3, /* Solid back face */ + 0, 4, 2, 2, 4, 6, /* Solid left face*/ + 4, 5, 6, 6, 5, 7, /* Solid front face */ + 3, 7, 1, 1, 7, 5, /* Solid right face */ + 2, 6, 3, 3, 6, 7, /* Solid top face */ + 0, 1, 4, 4, 1, 5, /* Solid bottom face */ + + 8, 10, 0, 0, 10, 2, /* Left fluid back face */ + 8, 12, 10, 10, 12, 14, /* Left fluid left face */ + 12, 4, 14, 14, 4, 6, /* Left fluid front face */ + 10, 14, 2, 2, 14, 6, /* Left fluid top face */ + 8, 0, 12, 12, 0, 4, /* Left fluid bottom face */ + + 1, 3, 9, 9, 3, 11, /* Right fluid back face */ + 5, 13, 7, 7, 13, 15, /* Right fluid front face */ + 11, 15, 9, 9, 15, 13, /* Right fluid right face */ + 3, 7, 11, 11, 7, 15, /* Right fluid top face */ + 1, 9, 5, 5, 9, 13 /* Right fluid bottom face */ +}; +static const size_t ntriangles = sizeof(indices) / sizeof(size_t[3]); + +static void +get_indices(const size_t itri, size_t ids[3], void* ctx) +{ + struct geometry* geom = ctx; + CHK(ctx != NULL); + ids[0] = geom->indices[itri*3+0]; + ids[1] = geom->indices[itri*3+1]; + ids[2] = geom->indices[itri*3+2]; +} + +static void +get_position(const size_t ivert, double pos[3], void* ctx) +{ + struct geometry* geom = ctx; + CHK(ctx != NULL); + pos[0] = geom->positions[ivert*3+0]; + pos[1] = geom->positions[ivert*3+1]; + pos[2] = geom->positions[ivert*3+2]; +} + +static void +get_interface(const size_t itri, struct sdis_interface** bound, void* ctx) +{ + struct geometry* geom = ctx; + CHK(ctx != NULL); + *bound = geom->interfaces[itri]; +} + +/******************************************************************************* + * Media + ******************************************************************************/ +struct solid { + double lambda; +}; + +static double +temperature_unknown(const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) +{ + CHK(vtx != NULL); (void)data; + return -1; +} + +static double +solid_get_calorific_capacity + (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) +{ + CHK(vtx != NULL); (void)data; + return 1; +} + +static double +solid_get_thermal_conductivity + (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) +{ + CHK(vtx != NULL); + CHK(data != NULL); + return ((const struct solid*)sdis_data_cget(data))->lambda; +} + +static double +solid_get_volumic_mass + (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) +{ + CHK(vtx != NULL); (void)data; + return 1; +} + +static double +solid_get_delta + (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) +{ + CHK(vtx != NULL); (void)data; + return 1.0/10.0; +} + +static double +solid_get_delta_boundary + (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) +{ + CHK(vtx != NULL); (void)data; + return 2.1/10.0; +} + +/******************************************************************************* + * Interface + ******************************************************************************/ +struct interface { + double temperature; + double convection_coef; + double emissivity; + double specular_fraction; +}; + +static double +interface_get_temperature + (const struct sdis_interface_fragment* frag, struct sdis_data* data) +{ + CHK(data != NULL && frag != NULL); + return ((const struct interface*)sdis_data_cget(data))->temperature; +} + +static double +interface_get_convection_coef + (const struct sdis_interface_fragment* frag, struct sdis_data* data) +{ + CHK(data != NULL && frag != NULL); + return ((const struct interface*)sdis_data_cget(data))->convection_coef; +} + +static double +interface_get_emissivity + (const struct sdis_interface_fragment* frag, struct sdis_data* data) +{ + CHK(data != NULL && frag != NULL); + return ((const struct interface*)sdis_data_cget(data))->emissivity; +} + +static double +interface_get_specular_fraction + (const struct sdis_interface_fragment* frag, struct sdis_data* data) +{ + CHK(data != NULL && frag != NULL); + return ((const struct interface*)sdis_data_cget(data))->specular_fraction; +} + +/******************************************************************************* + * Helper functions + ******************************************************************************/ +static void +create_interface + (struct sdis_device* dev, + struct sdis_medium* front, + struct sdis_medium* back, + const struct interface* interf, + struct sdis_interface** out_interf) +{ + struct sdis_interface_shader shader = DUMMY_INTERFACE_SHADER; + struct sdis_data* data = NULL; + + CHK(interf != NULL); + + shader.temperature = interface_get_temperature; + shader.convection_coef = interface_get_convection_coef; + shader.emissivity = interface_get_emissivity; + shader.specular_fraction = interface_get_specular_fraction; + + CHK(sdis_data_create(dev, sizeof(struct interface), ALIGNOF(struct interface), + NULL, &data) == RES_OK); + *((struct interface*)sdis_data_get(data)) = *interf; + + CHK(sdis_interface_create(dev, front, back, &shader, data, out_interf) == RES_OK); + CHK(sdis_data_ref_put(data) == RES_OK); +} + +/******************************************************************************* + * Test + ******************************************************************************/ +int +main(int argc, char** argv) +{ + struct mem_allocator allocator; + struct interface interf; + struct geometry geom; + struct sdis_data* data = NULL; + struct sdis_device* dev = NULL; + struct sdis_medium* fluid = NULL; + struct sdis_medium* solid = NULL; + struct sdis_medium* solid2 = NULL; + struct sdis_interface* interfaces[5] = {NULL}; + struct sdis_interface* prim_interfaces[32/*#triangles*/]; + struct sdis_fluid_shader fluid_shader = DUMMY_FLUID_SHADER; + struct sdis_solid_shader solid_shader = DUMMY_SOLID_SHADER; + struct sdis_scene* scn = NULL; + struct ssp_rng* rng = NULL; + const size_t nsimuls = 4; + size_t isimul; + const double emissivity = 1;/* Emissivity of the side +/-X of the solid */ + const double lambda = 0.1; /* Conductivity of the solid */ + const double Tref = 300; /* Reference temperature */ + const double T0 = 300; /* Fixed temperature on the left side of the system */ + const double T1 = 310; /* Fixed temperature on the right side of the system */ + const double thickness = 2.0; /* Thickness of the solid along X */ + double Ts0, Ts1, hr, tmp; + (void)argc, (void)argv; + + CHK(mem_init_proxy_allocator(&allocator, &mem_default_allocator) == RES_OK); + CHK(sdis_device_create + (NULL, &allocator, SDIS_NTHREADS_DEFAULT, 1, &dev) == RES_OK); + + /* Create the fluid medium */ + fluid_shader.temperature = temperature_unknown; + CHK(sdis_fluid_create(dev, &fluid_shader, NULL, &fluid) == RES_OK); + + /* Create the solid medium */ + CHK(sdis_data_create(dev, sizeof(struct solid), ALIGNOF(struct solid), + NULL, &data) == RES_OK); + ((struct solid*)sdis_data_get(data))->lambda = lambda; + 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.delta_boundary = solid_get_delta_boundary; + solid_shader.temperature = temperature_unknown; + CHK(sdis_solid_create(dev, &solid_shader, data, &solid) == RES_OK); + CHK(sdis_data_ref_put(data) == RES_OK); + + /* Create the surrounding solid medium */ + CHK(sdis_data_create(dev, sizeof(struct solid), ALIGNOF(struct solid), + NULL, &data) == RES_OK); + ((struct solid*)sdis_data_get(data))->lambda = 0; + 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.delta_boundary = solid_get_delta_boundary; + solid_shader.temperature = temperature_unknown; + CHK(sdis_solid_create(dev, &solid_shader, data, &solid2) == RES_OK); + CHK(sdis_data_ref_put(data) == RES_OK); + + /* Create the interface that forces to keep in conduction */ + interf.temperature = UNKNOWN_TEMPERATURE; + interf.convection_coef = -1; + interf.emissivity = -1; + interf.specular_fraction = -1; + create_interface(dev, solid, solid2, &interf, interfaces+0); + + /* Create the interface that emits radiative heat from the solid */ + interf.temperature = UNKNOWN_TEMPERATURE; + interf.convection_coef = 0; + interf.emissivity = emissivity; + interf.specular_fraction = 1; + create_interface(dev, solid, fluid, &interf, interfaces+1); + + /* Create the interface that forces the radiative heat to bounce */ + interf.temperature = UNKNOWN_TEMPERATURE; + interf.convection_coef = 0; + interf.emissivity = 0; + interf.specular_fraction = 1; + create_interface(dev, fluid, solid2, &interf, interfaces+2); + + /* Create the interface with a limit condition of T0 Kelvin */ + interf.temperature = T0; + interf.convection_coef = 0; + interf.emissivity = 1; + interf.specular_fraction = 1; + create_interface(dev, fluid, solid2, &interf, interfaces+3); + + /* Create the interface with a limit condition of T1 Kelvin */ + interf.temperature = T1; + interf.convection_coef = 0; + interf.emissivity = 1; + interf.specular_fraction = 1; + create_interface(dev, fluid, solid2, &interf, interfaces+4); + + /* Setup the per primitive interface of the solid medium */ + prim_interfaces[0] = prim_interfaces[1] = interfaces[0]; + prim_interfaces[2] = prim_interfaces[3] = interfaces[1]; + prim_interfaces[4] = prim_interfaces[5] = interfaces[0]; + prim_interfaces[6] = prim_interfaces[7] = interfaces[1]; + prim_interfaces[8] = prim_interfaces[9] = interfaces[0]; + prim_interfaces[10] = prim_interfaces[11] = interfaces[0]; + + /* Setup the per primitive interface of the fluid on the left of the medium */ + prim_interfaces[12] = prim_interfaces[13] = interfaces[2]; + prim_interfaces[14] = prim_interfaces[15] = interfaces[3]; + prim_interfaces[16] = prim_interfaces[17] = interfaces[2]; + prim_interfaces[18] = prim_interfaces[19] = interfaces[2]; + prim_interfaces[20] = prim_interfaces[21] = interfaces[2]; + + /* Setup the per primitive interface of the fluid on the right of the medium */ + prim_interfaces[22] = prim_interfaces[23] = interfaces[2]; + prim_interfaces[24] = prim_interfaces[25] = interfaces[2]; + prim_interfaces[26] = prim_interfaces[27] = interfaces[4]; + prim_interfaces[28] = prim_interfaces[29] = interfaces[2]; + prim_interfaces[30] = prim_interfaces[31] = interfaces[2]; + + /* Create the scene */ + geom.positions = vertices; + geom.indices = indices; + geom.interfaces = prim_interfaces; + CHK(sdis_scene_create(dev, ntriangles, get_indices, get_interface, nvertices, + get_position, &geom, &scn) == RES_OK); + + hr = 4.0 * BOLTZMANN_CONSTANT * Tref*Tref*Tref * emissivity; + tmp = lambda/(2*lambda + thickness*hr) * (T1 - T0); + Ts0 = T0 + tmp; + Ts1 = T1 - tmp; + + /* Run the simulations */ + CHK(ssp_rng_create(&allocator, &ssp_rng_kiss, &rng) == RES_OK); + FOR_EACH(isimul, 0, nsimuls) { + struct sdis_mc T = SDIS_MC_NULL; + struct sdis_estimator* estimator; + double pos[3]; + double ref, u; + size_t nreals = 0; + size_t nfails = 0; + + pos[0] = ssp_rng_uniform_double(rng, -0.9, 0.9); + pos[1] = ssp_rng_uniform_double(rng, -0.9, 0.9); + pos[2] = ssp_rng_uniform_double(rng, -0.9, 0.9); + + CHK(sdis_solve_probe(scn, 10000, pos, INF, 1, -1, Tref, &estimator) == RES_OK); + CHK(sdis_estimator_get_realisation_count(estimator, &nreals) == RES_OK); + CHK(sdis_estimator_get_failure_count(estimator, &nfails) == RES_OK); + CHK(sdis_estimator_get_temperature(estimator, &T) == RES_OK); + + u = (pos[0] + 1) / thickness; + ref = u * Ts1 + (1-u) * Ts0; + printf("Temperature at (%g, %g, %g) = %g ~ %g +/- %g\n", + SPLIT3(pos), ref, T.E, T.SE); + + CHK(eq_eps(T.E, ref, 2*T.SE) == 1); + + CHK(sdis_estimator_ref_put(estimator) == RES_OK); + } + + /* Release memory */ + CHK(sdis_scene_ref_put(scn) == RES_OK); + CHK(sdis_interface_ref_put(interfaces[0]) == RES_OK); + CHK(sdis_interface_ref_put(interfaces[1]) == RES_OK); + CHK(sdis_interface_ref_put(interfaces[2]) == RES_OK); + CHK(sdis_interface_ref_put(interfaces[3]) == RES_OK); + CHK(sdis_interface_ref_put(interfaces[4]) == RES_OK); + CHK(sdis_medium_ref_put(fluid) == RES_OK); + CHK(sdis_medium_ref_put(solid) == RES_OK); + CHK(sdis_medium_ref_put(solid2) == RES_OK); + CHK(sdis_device_ref_put(dev) == RES_OK); + CHK(ssp_rng_ref_put(rng) == RES_OK); + + check_memory_allocator(&allocator); + mem_shutdown_proxy_allocator(&allocator); + CHK(mem_allocated_size() == 0); + return 0; +} diff --git a/src/test_sdis_conducto_radiative_2d.c b/src/test_sdis_conducto_radiative_2d.c @@ -0,0 +1,405 @@ +/* Copyright (C) |Meso|Star> 2016-2018 (contact@meso-star.com) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include "sdis.h" +#include "test_sdis_utils.h" + +#include <star/ssp.h> + +#define UNKNOWN_TEMPERATURE -1 + +/* The scene is composed of a solid square whose temperature is unknown. The + * square segments on +/-X are in contact with a fluid and their convection + * coefficient is null while their emissivity is 1. The left and right fluids + * are enclosed by segments whose emissivity are null excepted for the segments + * orthogonal to the X axis that are fully emissive and whose temperature is + * known. The medium that surrounds the solid square and the 2 fluids is a + * solid with a null conductivity. + * + * (1, 1) + * +-----+----------+-----+ (1.5,1,1) + * | |##########| | + * | |##########| | + * 300K | E=1 |##########| E=1 | 310K + * | |##########| | + * | |##########| | + * (-1.5,-1) +-----+----------+-----+ + * (-1,-1) + */ + +/******************************************************************************* + * Geometry + ******************************************************************************/ +struct geometry { + const double* positions; + const size_t* indices; + struct sdis_interface** interfaces; +}; + +static const double vertices[8/*#vertices*/*2/*#coords par vertex*/] = { + 1.0, -1.0, + -1.0, -1.0, + -1.0, 1.0, + 1.0, 1.0, + 1.5, -1.0, + -1.5, -1.0, + -1.5, 1.0, + 1.5, 1.0 +}; +static const size_t nvertices = sizeof(vertices) / sizeof(double[2]); + +static const size_t indices[10/*#segments*/*2/*#indices per segment*/] = { + 0, 1, /* Solid bottom segment */ + 1, 2, /* Solid left segment */ + 2, 3, /* Solid top segment */ + 3, 0, /* Solid right segment */ + + 1, 5, /* Left fluid bottom segment */ + 5, 6, /* Left fluid left segment */ + 6, 2, /* Left fluid top segment */ + + 4, 0, /* Right fluid bottom segment */ + 3, 7, /* Right fluid top segment */ + 7, 4 /* Right fluid right segment */ +}; +static const size_t nsegments = sizeof(indices) / sizeof(size_t[2]); + +static void +get_indices(const size_t iseg, size_t ids[2], void* ctx) +{ + struct geometry* geom = ctx; + CHK(ctx != NULL); + ids[0] = geom->indices[iseg*2+0]; + ids[1] = geom->indices[iseg*2+1]; +} + +static void +get_position(const size_t ivert, double pos[2], void* ctx) +{ + struct geometry* geom = ctx; + CHK(ctx != NULL); + pos[0] = geom->positions[ivert*2+0]; + pos[1] = geom->positions[ivert*2+1]; +} + +static void +get_interface(const size_t iseg, struct sdis_interface** bound, void* ctx) +{ + struct geometry* geom = ctx; + CHK(ctx != NULL); + *bound = geom->interfaces[iseg]; +} + +/******************************************************************************* + * Media + ******************************************************************************/ +struct solid { + double lambda; +}; + +static double +temperature_unknown(const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) +{ + CHK(vtx != NULL); (void)data; + return -1; +} + +static double +solid_get_calorific_capacity + (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) +{ + CHK(vtx != NULL); (void)data; + return 1; +} + +static double +solid_get_thermal_conductivity + (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) +{ + CHK(vtx != NULL); + CHK(data != NULL); + return ((const struct solid*)sdis_data_cget(data))->lambda; +} + +static double +solid_get_volumic_mass + (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) +{ + CHK(vtx != NULL); (void)data; + return 1; +} + +static double +solid_get_delta + (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) +{ + CHK(vtx != NULL); (void)data; + return 1.0/10.0; +} + +static double +solid_get_delta_boundary + (const struct sdis_rwalk_vertex* vtx, struct sdis_data* data) +{ + CHK(vtx != NULL); (void)data; + return 2.1/10.0; +} + +/******************************************************************************* + * Interface + ******************************************************************************/ +struct interface { + double temperature; + double convection_coef; + double emissivity; + double specular_fraction; +}; + +static double +interface_get_temperature + (const struct sdis_interface_fragment* frag, struct sdis_data* data) +{ + CHK(data != NULL && frag != NULL); + return ((const struct interface*)sdis_data_cget(data))->temperature; +} + +static double +interface_get_convection_coef + (const struct sdis_interface_fragment* frag, struct sdis_data* data) +{ + CHK(data != NULL && frag != NULL); + return ((const struct interface*)sdis_data_cget(data))->convection_coef; +} + +static double +interface_get_emissivity + (const struct sdis_interface_fragment* frag, struct sdis_data* data) +{ + CHK(data != NULL && frag != NULL); + return ((const struct interface*)sdis_data_cget(data))->emissivity; +} + +static double +interface_get_specular_fraction + (const struct sdis_interface_fragment* frag, struct sdis_data* data) +{ + CHK(data != NULL && frag != NULL); + return ((const struct interface*)sdis_data_cget(data))->specular_fraction; +} + +/******************************************************************************* + * Helper functions + ******************************************************************************/ +static void +create_interface + (struct sdis_device* dev, + struct sdis_medium* front, + struct sdis_medium* back, + const struct interface* interf, + struct sdis_interface** out_interf) +{ + struct sdis_interface_shader shader = DUMMY_INTERFACE_SHADER; + struct sdis_data* data = NULL; + + CHK(interf != NULL); + + shader.temperature = interface_get_temperature; + shader.convection_coef = interface_get_convection_coef; + shader.emissivity = interface_get_emissivity; + shader.specular_fraction = interface_get_specular_fraction; + + CHK(sdis_data_create(dev, sizeof(struct interface), ALIGNOF(struct interface), + NULL, &data) == RES_OK); + *((struct interface*)sdis_data_get(data)) = *interf; + + CHK(sdis_interface_create(dev, front, back, &shader, data, out_interf) == RES_OK); + CHK(sdis_data_ref_put(data) == RES_OK); +} + + +/******************************************************************************* + * Test + ******************************************************************************/ +int +main(int argc, char** argv) +{ + struct mem_allocator allocator; + struct interface interf; + struct geometry geom; + struct ssp_rng* rng = NULL; + struct sdis_scene* scn = NULL; + struct sdis_data* data = NULL; + struct sdis_device* dev = NULL; + struct sdis_medium* fluid = NULL; + struct sdis_medium* solid = NULL; + struct sdis_medium* solid2 = NULL; + struct sdis_interface* interfaces[5] = {NULL}; + struct sdis_interface* prim_interfaces[10/*#segment*/]; + struct sdis_fluid_shader fluid_shader = DUMMY_FLUID_SHADER; + struct sdis_solid_shader solid_shader = DUMMY_SOLID_SHADER; + const size_t nsimuls = 4; + size_t isimul; + const double emissivity = 1;/* Emissivity of the side +/-X of the solid */ + const double lambda = 0.1; /* Conductivity of the solid */ + const double Tref = 300; /* Reference temperature */ + const double T0 = 300; /* Fixed temperature on the left side of the system */ + const double T1 = 310; /* Fixed temperature on the right side of the system */ + const double thickness = 2.0; /* Thickness of the solid along X */ + double Ts0, Ts1, hr, tmp; + (void)argc, (void)argv; + + CHK(mem_init_proxy_allocator(&allocator, &mem_default_allocator) == RES_OK); + CHK(sdis_device_create(NULL, &allocator, SDIS_NTHREADS_DEFAULT, 1, &dev) == RES_OK); + + /* Create the fluid medium */ + fluid_shader.temperature = temperature_unknown; + CHK(sdis_fluid_create(dev, &fluid_shader, NULL, &fluid) == RES_OK); + + /* Create the solid medium */ + CHK(sdis_data_create + (dev, sizeof(struct solid), ALIGNOF(struct solid), NULL, &data) == RES_OK); + ((struct solid*)sdis_data_get(data))->lambda = lambda; + 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.delta_boundary = solid_get_delta_boundary; + solid_shader.temperature = temperature_unknown; + CHK(sdis_solid_create(dev, &solid_shader, data, &solid) == RES_OK); + CHK(sdis_data_ref_put(data) == RES_OK); + + /* Create the surrounding solid medium */ + CHK(sdis_data_create(dev, sizeof(struct solid), ALIGNOF(struct solid), + NULL, &data) == RES_OK); + ((struct solid*)sdis_data_get(data))->lambda = 0; + solid_shader.calorific_capacity = solid_get_thermal_conductivity; + 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.delta_boundary = solid_get_delta_boundary; + CHK(sdis_solid_create(dev, &solid_shader, data, &solid2) == RES_OK); + CHK(sdis_data_ref_put(data) == RES_OK); + + /* Create the interface that forces to keep in conduction */ + interf.temperature = UNKNOWN_TEMPERATURE; + interf.convection_coef = -1; + interf.emissivity = -1; + interf.specular_fraction = -1; + create_interface(dev, solid, solid2, &interf, interfaces+0); + + /* Create the interface that emits radiative heat from the solid */ + interf.temperature = UNKNOWN_TEMPERATURE; + interf.convection_coef = 0; + interf.emissivity = emissivity; + interf.specular_fraction = -1; + create_interface(dev, solid, fluid, &interf, interfaces+1); + + /* Create the interface that forces the radiative heat to bounce */ + interf.temperature = UNKNOWN_TEMPERATURE; + interf.convection_coef = 0; + interf.emissivity = 0; + interf.specular_fraction = 1; + create_interface(dev, fluid, solid2, &interf, interfaces+2); + + /* Create the interface with a limit condition of T0 Kelvin */ + interf.temperature = T0; + interf.convection_coef = 0; + interf.emissivity = 1; + interf.specular_fraction = 1; + create_interface(dev, fluid, solid2, &interf, interfaces+3); + + /* Create the interface with a limit condition of T1 Kelvin */ + interf.temperature = T1; + interf.convection_coef = 0; + interf.emissivity = 1; + interf.specular_fraction = 1; + create_interface(dev, fluid, solid2, &interf, interfaces+4); + + /* Setup the per primitive interface of the solid medium */ + prim_interfaces[0] = interfaces[0]; + prim_interfaces[1] = interfaces[1]; + prim_interfaces[2] = interfaces[0]; + prim_interfaces[3] = interfaces[1]; + + /* Setup the per primitive interface of the fluid on the left of the medium */ + prim_interfaces[4] = interfaces[2]; + prim_interfaces[5] = interfaces[3]; + prim_interfaces[6] = interfaces[2]; + + /* Setup the per primitive interface of the fluid on the right of the medium */ + prim_interfaces[7] = interfaces[2]; + prim_interfaces[8] = interfaces[2]; + prim_interfaces[9] = interfaces[4]; + + /* Create the scene */ + geom.positions = vertices; + geom.indices = indices; + geom.interfaces = prim_interfaces; + CHK(sdis_scene_2d_create(dev, nsegments, get_indices, get_interface, nvertices, + get_position, &geom, &scn) == RES_OK); + + hr = 4*BOLTZMANN_CONSTANT * Tref*Tref*Tref * emissivity; + tmp = lambda/(2*lambda + thickness*hr) * (T1 - T0); + Ts0 = T0 + tmp; + Ts1 = T1 - tmp; + + /* Run the simulations */ + CHK(ssp_rng_create(&allocator, &ssp_rng_kiss, &rng) == RES_OK); + FOR_EACH(isimul, 0, nsimuls) { + struct sdis_mc T = SDIS_MC_NULL; + struct sdis_estimator* estimator; + double pos[2]; + double ref, u; + size_t nreals = 0; + size_t nfails = 0; + + pos[0] = ssp_rng_uniform_double(rng, -0.9, 0.9); + pos[1] = ssp_rng_uniform_double(rng, -0.9, 0.9); + + CHK(sdis_solve_probe(scn, 10000, pos, INF, 1, -1, Tref, &estimator) == RES_OK); + CHK(sdis_estimator_get_realisation_count(estimator, &nreals) == RES_OK); + CHK(sdis_estimator_get_failure_count(estimator, &nfails) == RES_OK); + CHK(sdis_estimator_get_temperature(estimator, &T) == RES_OK); + + u = (pos[0] + 1) / thickness; + ref = u * Ts1 + (1-u) * Ts0; + printf("Temperature at (%g, %g) = %g ~ %g +/- %g\n", + SPLIT2(pos), ref, T.E, T.SE); + + CHK(eq_eps(T.E, ref, 2*T.SE) == 1); + + CHK(sdis_estimator_ref_put(estimator) == RES_OK); + } + + /* Release memory */ + CHK(sdis_scene_ref_put(scn) == RES_OK); + CHK(sdis_interface_ref_put(interfaces[0]) == RES_OK); + CHK(sdis_interface_ref_put(interfaces[1]) == RES_OK); + CHK(sdis_interface_ref_put(interfaces[2]) == RES_OK); + CHK(sdis_interface_ref_put(interfaces[3]) == RES_OK); + CHK(sdis_interface_ref_put(interfaces[4]) == RES_OK); + CHK(sdis_medium_ref_put(fluid) == RES_OK); + CHK(sdis_medium_ref_put(solid) == RES_OK); + CHK(sdis_medium_ref_put(solid2) == RES_OK); + CHK(ssp_rng_ref_put(rng) == RES_OK); + CHK(sdis_device_ref_put(dev) == RES_OK); + + check_memory_allocator(&allocator); + mem_shutdown_proxy_allocator(&allocator); + CHK(mem_allocated_size() == 0); + + return 0; +} + diff --git a/src/test_sdis_interface.c b/src/test_sdis_interface.c @@ -76,8 +76,11 @@ main(int argc, char** argv) CHK(sdis_interface_ref_put(interf) == RES_OK); CHK(sdis_interface_ref_put(interf) == RES_OK); - CHK(CREATE(dev, solid, solid, &shader, NULL, &interf) == RES_BAD_ARG); + CHK(CREATE(dev, solid, solid, &shader, NULL, &interf) == RES_OK); + CHK(sdis_interface_ref_put(interf) == RES_OK); shader.convection_coef = NULL; + shader.specular_fraction = NULL; + shader.emissivity = NULL; CHK(CREATE(dev, solid, solid, &shader, NULL, &interf) == RES_OK); CHK(sdis_interface_ref_put(interf) == RES_OK); @@ -87,6 +90,10 @@ main(int argc, char** argv) CHK(CREATE(dev, solid, fluid, &shader, NULL, &interf) == RES_BAD_ARG); shader.convection_coef = DUMMY_INTERFACE_SHADER.convection_coef; + CHK(CREATE(dev, solid, fluid, &shader, NULL, &interf) == RES_BAD_ARG); + shader.emissivity = DUMMY_INTERFACE_SHADER.emissivity; + CHK(CREATE(dev, solid, fluid, &shader, NULL, &interf) == RES_BAD_ARG); + shader.specular_fraction = DUMMY_INTERFACE_SHADER.specular_fraction; CHK(CREATE(dev, solid, fluid, &shader, NULL, &interf) == RES_OK); CHK(sdis_interface_ref_put(interf) == RES_OK); #undef CREATE diff --git a/src/test_sdis_solve_probe.c b/src/test_sdis_solve_probe.c @@ -146,6 +146,8 @@ solid_get_temperature ******************************************************************************/ struct interf { double hc; + double rho_s; + double rho_d; }; static double @@ -156,6 +158,22 @@ interface_get_convection_coef return ((const struct interf*)sdis_data_cget(data))->hc; } +static double +interface_get_emissivity + (const struct sdis_interface_fragment* frag, struct sdis_data* data) +{ + CHK(data != NULL && frag != NULL); + return ((const struct interf*)sdis_data_cget(data))->rho_s; +} + +static double +interface_get_specular_fraction + (const struct sdis_interface_fragment* frag, struct sdis_data* data) +{ + CHK(data != NULL && frag != NULL); + return ((const struct interf*)sdis_data_cget(data))->rho_d; +} + /******************************************************************************* * Test ******************************************************************************/ @@ -222,8 +240,12 @@ main(int argc, char** argv) ALIGNOF(struct interf), NULL, &data) == RES_OK); interface_param = sdis_data_get(data); interface_param->hc = 0.5; + interface_param->rho_s = 0; + interface_param->rho_d = 0; interface_shader.convection_coef = interface_get_convection_coef; interface_shader.temperature = NULL; + interface_shader.emissivity = interface_get_emissivity; + interface_shader.specular_fraction = interface_get_specular_fraction; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, data, &interf) == RES_OK); CHK(sdis_data_ref_put(data) == RES_OK); @@ -246,12 +268,13 @@ main(int argc, char** argv) pos[1] = 0.5; pos[2] = 0.5; time = INF; - CHK(sdis_solve_probe(NULL, N, pos, time, 1.0, &estimator) == RES_BAD_ARG); - CHK(sdis_solve_probe(scn, 0, pos, time, 1.0, &estimator) == RES_BAD_ARG); - CHK(sdis_solve_probe(scn, N, NULL, time, 1.0, &estimator) == RES_BAD_ARG); - CHK(sdis_solve_probe(scn, N, pos, time, 0, &estimator) == RES_BAD_ARG); - CHK(sdis_solve_probe(scn, N, pos, time, 1.0, NULL) == RES_BAD_ARG); - CHK(sdis_solve_probe(scn, N, pos, time, 1.0, &estimator) == RES_OK); + CHK(sdis_solve_probe(NULL, N, pos, time, 1.0, 0, 0, &estimator) == RES_BAD_ARG); + CHK(sdis_solve_probe(scn, 0, pos, time, 1.0, 0, 0, &estimator) == RES_BAD_ARG); + CHK(sdis_solve_probe(scn, N, NULL, time, 1.0, 0, 0, &estimator) == RES_BAD_ARG); + CHK(sdis_solve_probe(scn, N, pos, time, 0, 0, 0, &estimator) == RES_BAD_ARG); + CHK(sdis_solve_probe(scn, N, pos, time, 0, 0, -1, &estimator) == RES_BAD_ARG); + CHK(sdis_solve_probe(scn, N, pos, time, 1.0, 0, 0, NULL) == RES_BAD_ARG); + CHK(sdis_solve_probe(scn, N, pos, time, 1.0, 0, 0, &estimator) == RES_OK); CHK(sdis_estimator_get_realisation_count(estimator, NULL) == RES_BAD_ARG); CHK(sdis_estimator_get_realisation_count(NULL, &nreals) == RES_BAD_ARG); diff --git a/src/test_sdis_solve_probe2.c b/src/test_sdis_solve_probe2.c @@ -131,7 +131,7 @@ struct interf { }; static double -null_convection_coef +null_interface_value (const struct sdis_interface_fragment* frag, struct sdis_data* data) { CHK(frag != NULL); @@ -196,8 +196,10 @@ main(int argc, char** argv) CHK(sdis_solid_create(dev, &solid_shader, NULL, &solid) == RES_OK); /* Create the fluid/solid interface with no limit conidition */ - interface_shader.convection_coef = null_convection_coef; + interface_shader.convection_coef = null_interface_value; interface_shader.temperature = NULL; + interface_shader.emissivity = null_interface_value; + interface_shader.specular_fraction = null_interface_value; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, NULL, &Tnone) == RES_OK); @@ -206,8 +208,10 @@ main(int argc, char** argv) ALIGNOF(struct interf), NULL, &data) == RES_OK); interface_param = sdis_data_get(data); interface_param->temperature = 300; - interface_shader.convection_coef = null_convection_coef; + interface_shader.convection_coef = null_interface_value; interface_shader.temperature = interface_get_temperature; + interface_shader.emissivity = null_interface_value; + interface_shader.specular_fraction = null_interface_value; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, data, &T300) == RES_OK); CHK(sdis_data_ref_put(data) == RES_OK); @@ -217,8 +221,10 @@ main(int argc, char** argv) ALIGNOF(struct interf), NULL, &data) == RES_OK); interface_param = sdis_data_get(data); interface_param->temperature = 350; - interface_shader.convection_coef = null_convection_coef; + interface_shader.convection_coef = null_interface_value; interface_shader.temperature = interface_get_temperature; + interface_shader.emissivity = null_interface_value; + interface_shader.specular_fraction = null_interface_value; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, data, &T350) == RES_OK); CHK(sdis_data_ref_put(data) == RES_OK); @@ -253,7 +259,7 @@ main(int argc, char** argv) pos[1] = 0.5; pos[2] = 0.5; time = INF; - CHK(sdis_solve_probe( scn, N, pos, time, 1.0, &estimator) == RES_OK); + CHK(sdis_solve_probe( scn, N, pos, time, 1.0, -1, 0, &estimator) == RES_OK); CHK(sdis_estimator_get_realisation_count(estimator, &nreals) == RES_OK); CHK(sdis_estimator_get_failure_count(estimator, &nfails) == RES_OK); CHK(sdis_estimator_get_temperature(estimator, &T) == RES_OK); diff --git a/src/test_sdis_solve_probe2_2d.c b/src/test_sdis_solve_probe2_2d.c @@ -128,7 +128,7 @@ struct interf { }; static double -null_convection_coef +null_interface_value (const struct sdis_interface_fragment* frag, struct sdis_data* data) { CHK(frag != NULL); @@ -193,8 +193,10 @@ main(int argc, char** argv) CHK(sdis_solid_create(dev, &solid_shader, NULL, &solid) == RES_OK); /* Create the fluid/solid interface with no limit conidition */ - interface_shader.convection_coef = null_convection_coef; + interface_shader.convection_coef = null_interface_value; interface_shader.temperature = NULL; + interface_shader.emissivity = null_interface_value; + interface_shader.specular_fraction = null_interface_value; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, NULL, &Tnone) == RES_OK); @@ -203,8 +205,10 @@ main(int argc, char** argv) ALIGNOF(struct interf), NULL, &data) == RES_OK); interface_param = sdis_data_get(data); interface_param->temperature = 300; - interface_shader.convection_coef = null_convection_coef; + interface_shader.convection_coef = null_interface_value; interface_shader.temperature = interface_get_temperature; + interface_shader.emissivity = null_interface_value; + interface_shader.specular_fraction = null_interface_value; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, data, &T300) == RES_OK); CHK(sdis_data_ref_put(data) == RES_OK); @@ -214,8 +218,10 @@ main(int argc, char** argv) ALIGNOF(struct interf), NULL, &data) == RES_OK); interface_param = sdis_data_get(data); interface_param->temperature = 350; - interface_shader.convection_coef = null_convection_coef; + interface_shader.convection_coef = null_interface_value; interface_shader.temperature = interface_get_temperature; + interface_shader.emissivity = null_interface_value; + interface_shader.specular_fraction = null_interface_value; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, data, &T350) == RES_OK); CHK(sdis_data_ref_put(data) == RES_OK); @@ -247,7 +253,7 @@ main(int argc, char** argv) pos[0] = 0.5; pos[1] = 0.5; time = INF; - CHK(sdis_solve_probe( scn, N, pos, time, 1.0, &estimator) == RES_OK); + CHK(sdis_solve_probe( scn, N, pos, time, 1.0, -1, 0, &estimator) == RES_OK); CHK(sdis_estimator_get_realisation_count(estimator, &nreals) == RES_OK); CHK(sdis_estimator_get_failure_count(estimator, &nfails) == RES_OK); CHK(sdis_estimator_get_temperature(estimator, &T) == RES_OK); diff --git a/src/test_sdis_solve_probe3.c b/src/test_sdis_solve_probe3.c @@ -153,7 +153,7 @@ struct interf { }; static double -null_convection_coef +null_interface_value (const struct sdis_interface_fragment* frag, struct sdis_data* data) { CHK(frag != NULL); @@ -223,8 +223,10 @@ main(int argc, char** argv) CHK(sdis_solid_create(dev, &solid_shader, NULL, &solid) == RES_OK); /* Create the fluid/solid interface with no limit conidition */ - interface_shader.convection_coef = null_convection_coef; + interface_shader.convection_coef = null_interface_value; interface_shader.temperature = NULL; + interface_shader.emissivity = null_interface_value; + interface_shader.specular_fraction = null_interface_value; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, NULL, &Tnone) == RES_OK); @@ -233,8 +235,10 @@ main(int argc, char** argv) ALIGNOF(struct interf), NULL, &data) == RES_OK); interface_param = sdis_data_get(data); interface_param->temperature = 300; - interface_shader.convection_coef = null_convection_coef; + interface_shader.convection_coef = null_interface_value; interface_shader.temperature = interface_get_temperature; + interface_shader.emissivity = null_interface_value; + interface_shader.specular_fraction = null_interface_value; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, data, &T300) == RES_OK); CHK(sdis_data_ref_put(data) == RES_OK); @@ -244,8 +248,10 @@ main(int argc, char** argv) ALIGNOF(struct interf), NULL, &data) == RES_OK); interface_param = sdis_data_get(data); interface_param->temperature = 350; - interface_shader.convection_coef = null_convection_coef; + interface_shader.convection_coef = null_interface_value; interface_shader.temperature = interface_get_temperature; + interface_shader.emissivity = null_interface_value; + interface_shader.specular_fraction = null_interface_value; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, data, &T350) == RES_OK); CHK(sdis_data_ref_put(data) == RES_OK); @@ -253,6 +259,8 @@ main(int argc, char** argv) /* Create the solid/solid interface */ interface_shader.convection_coef = NULL; interface_shader.temperature = NULL; + interface_shader.specular_fraction = NULL; + interface_shader.emissivity = NULL; CHK(sdis_interface_create (dev, solid, solid, &interface_shader, NULL, &solid_solid) == RES_OK); @@ -310,7 +318,7 @@ main(int argc, char** argv) pos[1] = 0.5; pos[2] = 0.5; time = INF; - CHK(sdis_solve_probe( scn, N, pos, time, 1.0, &estimator) == RES_OK); + CHK(sdis_solve_probe( scn, N, pos, time, 1.0, -1, 0, &estimator) == RES_OK); CHK(sdis_estimator_get_realisation_count(estimator, &nreals) == RES_OK); CHK(sdis_estimator_get_failure_count(estimator, &nfails) == RES_OK); CHK(sdis_estimator_get_temperature(estimator, &T) == RES_OK); diff --git a/src/test_sdis_solve_probe3_2d.c b/src/test_sdis_solve_probe3_2d.c @@ -150,7 +150,7 @@ struct interf { }; static double -null_convection_coef +null_interface_value (const struct sdis_interface_fragment* frag, struct sdis_data* data) { CHK(frag != NULL); @@ -218,8 +218,10 @@ main(int argc, char** argv) CHK(sdis_solid_create(dev, &solid_shader, NULL, &solid) == RES_OK); /* Create the fluid/solid interface with no limit conidition */ - interface_shader.convection_coef = null_convection_coef; + interface_shader.convection_coef = null_interface_value; interface_shader.temperature = NULL; + interface_shader.emissivity = null_interface_value; + interface_shader.specular_fraction = null_interface_value; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, NULL, &Tnone) == RES_OK); @@ -228,8 +230,10 @@ main(int argc, char** argv) ALIGNOF(struct interf), NULL, &data) == RES_OK); interface_param = sdis_data_get(data); interface_param->temperature = 300; - interface_shader.convection_coef = null_convection_coef; + interface_shader.convection_coef = null_interface_value; interface_shader.temperature = interface_get_temperature; + interface_shader.emissivity = null_interface_value; + interface_shader.specular_fraction = null_interface_value; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, data, &T300) == RES_OK); CHK(sdis_data_ref_put(data) == RES_OK); @@ -239,8 +243,10 @@ main(int argc, char** argv) ALIGNOF(struct interf), NULL, &data) == RES_OK); interface_param = sdis_data_get(data); interface_param->temperature = 350; - interface_shader.convection_coef = null_convection_coef; + interface_shader.convection_coef = null_interface_value; interface_shader.temperature = interface_get_temperature; + interface_shader.emissivity = null_interface_value; + interface_shader.specular_fraction = null_interface_value; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, data, &T350) == RES_OK); CHK(sdis_data_ref_put(data) == RES_OK); @@ -248,6 +254,8 @@ main(int argc, char** argv) /* Create the solid/solid interface */ interface_shader.convection_coef = NULL; interface_shader.temperature = NULL; + interface_shader.specular_fraction = NULL; + interface_shader.emissivity = NULL; CHK(sdis_interface_create (dev, solid, solid, &interface_shader, NULL, &solid_solid) == RES_OK); @@ -300,7 +308,7 @@ main(int argc, char** argv) pos[0] = 0.5; pos[1] = 0.5; time = INF; - CHK(sdis_solve_probe( scn, N, pos, time, 1.0, &estimator) == RES_OK); + CHK(sdis_solve_probe( scn, N, pos, time, 1.0, -1, 0, &estimator) == RES_OK); CHK(sdis_estimator_get_realisation_count(estimator, &nreals) == RES_OK); CHK(sdis_estimator_get_failure_count(estimator, &nfails) == RES_OK); CHK(sdis_estimator_get_temperature(estimator, &T) == RES_OK); @@ -325,5 +333,4 @@ main(int argc, char** argv) mem_shutdown_proxy_allocator(&allocator); CHK(mem_allocated_size() == 0); return 0; - } diff --git a/src/test_sdis_solve_probe_2d.c b/src/test_sdis_solve_probe_2d.c @@ -131,6 +131,14 @@ interface_get_convection_coef return 0.5; } +static double +interface_null_reflectivity + (const struct sdis_interface_fragment* frag, struct sdis_data* data) +{ + (void)frag, (void)data; + return 0; +} + /******************************************************************************* * Main test ******************************************************************************/ @@ -177,6 +185,8 @@ main(int argc, char** argv) /* Create the solid/fluid interface */ interface_shader.convection_coef = interface_get_convection_coef; interface_shader.temperature = NULL; + interface_shader.emissivity = interface_null_reflectivity; + interface_shader.specular_fraction = interface_null_reflectivity; CHK(sdis_interface_create (dev, solid, fluid, &interface_shader, NULL, &interf) == RES_OK); @@ -197,7 +207,7 @@ main(int argc, char** argv) pos[0] = 0.5; pos[1] = 0.5; time = INF; - CHK(sdis_solve_probe(scn, N, pos, time, 1.0, &estimator) == RES_OK); + CHK(sdis_solve_probe(scn, N, pos, time, 1.0, 0, 0, &estimator) == RES_OK); CHK(sdis_estimator_get_realisation_count(estimator, &nreals) == RES_OK); CHK(sdis_estimator_get_failure_count(estimator, &nfails) == RES_OK); diff --git a/src/test_sdis_utils.h b/src/test_sdis_utils.h @@ -16,9 +16,13 @@ #ifndef TEST_SDIS_UTILS_H #define TEST_SDIS_UTILS_H +#include "sdis.h" + #include <rsys/mem_allocator.h> #include <stdio.h> +#define BOLTZMANN_CONSTANT 5.6696e-8 /* W/m^2/K^4 */ + /******************************************************************************* * Box geometry ******************************************************************************/ @@ -82,7 +86,7 @@ dummy_medium_getter { (void)data; CHK(vert != NULL); - return 1; + return 0; } static INLINE double @@ -91,7 +95,7 @@ dummy_interface_getter { (void)data; CHK(frag != NULL); - return 1; + return 0; } static const struct sdis_solid_shader DUMMY_SOLID_SHADER = { @@ -111,6 +115,8 @@ static const struct sdis_fluid_shader DUMMY_FLUID_SHADER = { static const struct sdis_interface_shader DUMMY_INTERFACE_SHADER = { dummy_interface_getter, + dummy_interface_getter, + dummy_interface_getter, dummy_interface_getter };