stardis-solver

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

sdis_realisation.h (9745B)


      1 /* Copyright (C) 2016-2025 |Méso|Star> (contact@meso-star.com)
      2  *
      3  * This program is free software: you can redistribute it and/or modify
      4  * it under the terms of the GNU General Public License as published by
      5  * the Free Software Foundation, either version 3 of the License, or
      6  * (at your option) any later version.
      7  *
      8  * This program is distributed in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     11  * GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License
     14  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     15 
     16 #ifndef SDIS_REALISATION_H
     17 #define SDIS_REALISATION_H
     18 
     19 #include "sdis.h"
     20 #include "sdis_estimator_c.h"
     21 
     22 #include <rsys/rsys.h>
     23 
     24 /* Forward declarations */
     25 struct bound_flux_result;
     26 struct green_path_handle;
     27 struct rwalk;
     28 struct sdis_heat_path;
     29 struct sdis_scene;
     30 struct ssp_rng;
     31 struct temperature;
     32 
     33 enum flux_flag {
     34   FLUX_FLAG_CONVECTIVE = BIT(FLUX_CONVECTIVE),
     35   FLUX_FLAG_RADIATIVE = BIT(FLUX_RADIATIVE),
     36   FLUX_FLAGS_ALL = FLUX_FLAG_CONVECTIVE | FLUX_FLAG_RADIATIVE
     37 };
     38 
     39 /*******************************************************************************
     40  * Helper function used to sample a coupled path
     41  ******************************************************************************/
     42 extern LOCAL_SYM res_T
     43 sample_coupled_path_2d
     44   (struct sdis_scene* scn,
     45    struct rwalk_context* ctx,
     46    struct rwalk* rwalk,
     47    struct ssp_rng* rng,
     48    struct temperature* T);
     49 
     50 extern LOCAL_SYM res_T
     51 sample_coupled_path_3d
     52   (struct sdis_scene* scn,
     53    struct rwalk_context* ctx,
     54    struct rwalk* rwalk,
     55    struct ssp_rng* rng,
     56    struct temperature* T);
     57 
     58 /*******************************************************************************
     59  * Realisation at a given position and time IN a medium
     60  ******************************************************************************/
     61 struct probe_realisation_args {
     62   struct ssp_rng* rng;
     63   unsigned enc_id; /* Enclosure into which the realisation starts */
     64   double position[3]; /* Probe position */
     65   double time; /* Observation time */
     66   size_t picard_order; /* Picard order to estimate radiative temperature */
     67   struct green_path_handle* green_path; /* May be NULL */
     68   struct sdis_heat_path* heat_path; /* May be NULL */
     69   size_t irealisation; /* Id of the realisation (for debug) */
     70   enum sdis_diffusion_algorithm diff_algo; /* Diffusion algorithm to be used */
     71 };
     72 #define PROBE_REALISATION_ARGS_NULL__ {                                        \
     73   NULL, /* RNG */                                                              \
     74   ENCLOSURE_ID_NULL, /* Enclosure */                                           \
     75   {0,0,0}, /* Position */                                                      \
     76   -1, /* Observation time */                                                   \
     77   0, /* Picard order */                                                        \
     78   NULL, /* Green path */                                                       \
     79   NULL, /* Heat path */                                                        \
     80   SIZE_MAX, /* Realisation ID */                                               \
     81   SDIS_DIFFUSION_NONE /* Diffusion algorithm */                                \
     82 }
     83 static const struct probe_realisation_args PROBE_REALISATION_ARGS_NULL =
     84   PROBE_REALISATION_ARGS_NULL__;
     85 
     86 extern LOCAL_SYM res_T
     87 probe_realisation_2d
     88   (struct sdis_scene* scn,
     89    struct probe_realisation_args* args,
     90    double* weight);
     91 
     92 extern LOCAL_SYM res_T
     93 probe_realisation_3d
     94   (struct sdis_scene* scn,
     95    struct probe_realisation_args* args,
     96    double* weight);
     97 
     98 /*******************************************************************************
     99  * Realisation at a given position and time ON a given side of a boundary
    100  ******************************************************************************/
    101 struct boundary_realisation_args {
    102   struct ssp_rng* rng;
    103   size_t iprim; /* Index of the geometruc primitive */
    104   double uv[2]; /* Parametric coordinate into the geometric primitive */
    105   double time; /* Observation time */
    106   size_t picard_order; /* Picard order to estimate radiative temperature */
    107   enum sdis_side side; /* Side of the geometric primitive */
    108   struct green_path_handle* green_path; /* May be NULL */
    109   struct sdis_heat_path* heat_path; /* May be NULL */
    110   size_t irealisation; /* Id of the realisation (for debug) */
    111   enum sdis_diffusion_algorithm diff_algo; /* Diffusion algorithm to be used */
    112 };
    113 #define BOUNDARY_REALISATION_ARGS_NULL__ {                                     \
    114   NULL, /* RNG */                                                              \
    115   SIZE_MAX,  /* Primitive ID */                                                \
    116   {0,0}, /* Parametric coordinates */                                          \
    117   -1, /* Observation time */                                                   \
    118   0, /* Picard order */                                                        \
    119   SDIS_SIDE_NULL__, /* Interface side */                                       \
    120   NULL, /* Green path */                                                       \
    121   NULL, /* Heat path */                                                        \
    122   SIZE_MAX, /* Realisation ID */                                               \
    123   SDIS_DIFFUSION_NONE /* Diffusion algorithm */                                \
    124 }
    125 static const struct boundary_realisation_args BOUNDARY_REALISATION_ARGS_NULL =
    126   BOUNDARY_REALISATION_ARGS_NULL__;
    127 
    128 extern LOCAL_SYM res_T
    129 boundary_realisation_2d
    130   (struct sdis_scene* scn,
    131    struct boundary_realisation_args* args,
    132    double* weight);
    133 
    134 extern LOCAL_SYM res_T
    135 boundary_realisation_3d
    136   (struct sdis_scene* scn,
    137    struct boundary_realisation_args* args,
    138    double* weight);
    139 
    140 /*******************************************************************************
    141  * Realisation at a given position and time ON a given side of a boundary
    142  ******************************************************************************/
    143 struct boundary_flux_realisation_args {
    144   struct ssp_rng* rng;
    145   size_t iprim; /* Index of the geometruc primitive */
    146   double uv[2]; /* Parametric coordinate into the geometric primitive */
    147   double time; /* Observation time */
    148   size_t picard_order; /* Picard order to estimate radiative temperature */
    149   enum sdis_side solid_side; /* Side of the geometric primitive */
    150   int flux_mask; /* Combination of enum flux_flag */
    151   size_t irealisation; /* Id of the realisation (for debug) */
    152   enum sdis_diffusion_algorithm diff_algo; /* Diffusion algorithm to be used */
    153 };
    154 #define BOUNDARY_FLUX_REALISATION_ARGS_NULL__ {                                \
    155   NULL, /* RNG */                                                              \
    156   SIZE_MAX, /* Primitive ID */                                                 \
    157   {0,0}, /* Parametric coordinates */                                          \
    158   -1, /* Observation time */                                                   \
    159   0, /* Picard order */                                                        \
    160   SDIS_SIDE_NULL__, /* Interface side */                                       \
    161   0, /* Flux mask */                                                           \
    162   SIZE_MAX, /* Realisation ID */                                               \
    163   SDIS_DIFFUSION_NONE /* Diffusion algorithm */                                \
    164 }
    165 static const struct boundary_flux_realisation_args
    166 BOUNDARY_FLUX_REALISATION_ARGS_NULL = BOUNDARY_FLUX_REALISATION_ARGS_NULL__;
    167 
    168 extern LOCAL_SYM res_T
    169 boundary_flux_realisation_2d
    170   (struct sdis_scene* scn,
    171    struct boundary_flux_realisation_args* args,
    172    struct bound_flux_result* result);
    173 
    174 extern LOCAL_SYM res_T
    175 boundary_flux_realisation_3d
    176   (struct sdis_scene* scn,
    177    struct boundary_flux_realisation_args* args,
    178    struct bound_flux_result* result);
    179 
    180 /*******************************************************************************
    181  * Realisation along a given ray at a given time. Available only in 3D
    182  ******************************************************************************/
    183 struct ray_realisation_args {
    184   struct ssp_rng* rng;
    185   unsigned enc_id; /* Enclosure into which the realisation starts */
    186   double position[3]; /* Ray position */
    187   double direction[3]; /* Ray direction */
    188   double time; /* Observation time */
    189   size_t picard_order; /* Picard order to estimate radiative temperature */
    190   struct sdis_heat_path* heat_path; /* May be NULL */
    191   size_t irealisation; /* Id of the realisation (for debug) */
    192   enum sdis_diffusion_algorithm diff_algo; /* Diffusion algorithm to be used */
    193 };
    194 #define RAY_REALISATION_ARGS_NULL__ {                                          \
    195   NULL, /* RNG */                                                              \
    196   ENCLOSURE_ID_NULL, /* Enclosure */                                           \
    197   {0,0,0}, /* Position */                                                      \
    198   {0,0,0}, /* Direction */                                                     \
    199   -1, /* Observation time */                                                   \
    200   0, /* Picard order */                                                        \
    201   NULL, /* Heat path */                                                        \
    202   SIZE_MAX, /* Realisation ID */                                               \
    203   SDIS_DIFFUSION_NONE /* Diffusion algorithm */                                \
    204 }
    205 static const struct ray_realisation_args RAY_REALISATION_ARGS_NULL =
    206   RAY_REALISATION_ARGS_NULL__;
    207 
    208 extern LOCAL_SYM res_T
    209 ray_realisation_3d
    210   (struct sdis_scene* scn,
    211    struct ray_realisation_args* args,
    212    double* weight);
    213 
    214 #endif /* SDIS_REALISATION_H */