city_generator2

Generated conformal 3D meshes representing a city
git clone git://git.meso-star.fr/city_generator2.git
Log | Files | Refs | README | LICENSE

cg_stardis_model.h (11647B)


      1 /* Copyright (C) 2022 Université de Pau et des Pays de l'Adour UPPA
      2  * Copyright (C) 2022 CNRS
      3  * Copyright (C) 2022 Sorbonne Université
      4  * Copyright (C) 2022 Université Paul Sabatier
      5  * Copyright (C) 2022 |Meso|Star> (contact@meso-star.com)
      6  *
      7  * This program is free software: you can redistribute it and/or modify
      8  * it under the terms of the GNU General Public License as published by
      9  * the Free Software Foundation, either version 3 of the License, or
     10  * (at your option) any later version.
     11  *
     12  * This program is distributed in the hope that it will be useful,
     13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     15  * GNU General Public License for more details.
     16  *
     17  * You should have received a copy of the GNU General Public License
     18  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     19 
     20 #ifndef STARDIS_MODEL_H
     21 #define STARDIS_MODEL_H
     22 
     23 #include <rsys/rsys.h>
     24 
     25 /* Utility macros for stardis model output */
     26 #define STARDIS_FLUID_2(Group, Name) { \
     27   model_count += fprintf(model, \
     28       "FLUID %s " \
     29       "$%s_RHO $%s_CP $%s_TINIT $%s_T_IMPOSED " \
     30       "FRONT %s.stl\n", \
     31       Name, Name, Name, Name, Name, Name); \
     32   fprintf(vars, \
     33       "export %s_RHO=$" #Group "_RHO\n" \
     34       "export %s_CP=$" #Group "_CP\n" \
     35       "export %s_TINIT=$" #Group "_TINIT\n" \
     36       "export %s_T_IMPOSED=$" #Group "_T_IMPOSED\n", \
     37       Name, Name, Name, Name); \
     38 } (void)0
     39 
     40 #define STARDIS_FLUID(Field) { \
     41   const char* n___; \
     42   ERR(scad_geometry_get_name(data_cad->Field, &n___)); \
     43   STARDIS_FLUID_2(Field, n___); \
     44 } (void)0
     45 
     46 #define STARDIS_SOLID_2_model(Group, Name) { \
     47   model_count += fprintf(model, \
     48       "SOLID %s " \
     49       "$%s_LAMBDA $%s_RHO $%s_CP $%s_DELTA " \
     50       "$%s_TINIT $%s_T_IMPOSED $%s_POWER " \
     51       "FRONT %s.stl\n", \
     52       Name, Name, Name, Name, Name, Name, Name, Name, Name); \
     53 } (void)0
     54 
     55 #define STARDIS_SOLID_2_vars(Group, Name) { \
     56   fprintf(vars, \
     57       "export %s_LAMBDA=$" #Group "_LAMBDA\n" \
     58       "export %s_RHO=$" #Group "_RHO\n" \
     59       "export %s_CP=$" #Group "_CP\n" \
     60       "export %s_DELTA=$" #Group "_DELTA\n" \
     61       "export %s_TINIT=$" #Group "_TINIT\n" \
     62       "export %s_T_IMPOSED=$" #Group "_T_IMPOSED\n" \
     63       "export %s_POWER=$" #Group "_POWER\n", \
     64       Name, Name, Name, Name, Name, Name, Name); \
     65 } (void)0
     66 
     67 #define STARDIS_SOLID_2(Group, Name) { \
     68   STARDIS_SOLID_2_model(Group, Name); \
     69   STARDIS_SOLID_2_vars(Group, Name); \
     70 } (void)0
     71 
     72 #define STARDIS_SOLID(Field) { \
     73   const char* n___; \
     74   ERR(scad_geometry_get_name(data_cad->Field, &n___)); \
     75   STARDIS_SOLID_2(Field, n___); \
     76 } (void)0
     77 
     78 #define STARDIS_F_BOUND_2_model(Group, Name) { \
     79     model_count += fprintf(model, \
     80         "F_BOUNDARY_FOR_SOLID %s " \
     81         "$%s_F " \
     82         "%s.stl\n", \
     83         Name, Name, Name); \
     84 } (void)0
     85 
     86 #define STARDIS_F_BOUND_2_vars(Group, Name) { \
     87     fprintf(vars, \
     88         "export %s_F=$" #Group "_F\n", \
     89         Name); \
     90 } (void)0
     91 
     92 #define STARDIS_F_BOUND_2(Group, Name) { \
     93   STARDIS_F_BOUND_2_model(Group, Name); \
     94   STARDIS_F_BOUND_2_vars(Group, Name); \
     95 } (void)0
     96 
     97 #define STARDIS_F_BOUND(Field) { \
     98   const char* n___; \
     99   ERR(scad_geometry_get_name(data_cad->Field, &n___)); \
    100   STARDIS_F_BOUND_2(Field, n___); \
    101 } (void)0
    102 
    103 #define STARDIS_T_BOUND_2_model(Group, Name) { \
    104     model_count += fprintf(model, \
    105         "T_BOUNDARY_FOR_SOLID %s " \
    106         "$%s_T " \
    107         "%s.stl\n", \
    108         Name, Name, Name); \
    109 } (void)0
    110 
    111 #define STARDIS_T_BOUND_2_vars(Group, Name) { \
    112     fprintf(vars, \
    113         "export %s_T=$" #Group "_T\n", \
    114         Name); \
    115 } (void)0
    116 
    117 #define STARDIS_T_BOUND_2(Group, Name) { \
    118   STARDIS_T_BOUND_2_model(Group, Name); \
    119   STARDIS_T_BOUND_2_vars(Group, Name); \
    120 } (void)0
    121 
    122 #define STARDIS_T_BOUND(Field) { \
    123   const char* n___; \
    124   ERR(scad_geometry_get_name(data_cad->Field, &n___)); \
    125   STARDIS_T_BOUND_2(Field, n___); \
    126 } (void)0
    127 
    128 #define STARDIS_H_BOUND_2_model(Group, Name) { \
    129     model_count += fprintf(model, \
    130         "H_BOUNDARY_FOR_SOLID %s " \
    131         "$%s_TREF $%s_EMISSIVITY $%s_SPEC_FRACTION $%s_H $%s_TEXT " \
    132         "%s.stl\n", \
    133         Name, Name, Name, Name, Name, Name, Name); \
    134 } (void)0
    135 
    136 #define STARDIS_H_BOUND_2_vars(Group, Name) { \
    137     fprintf(vars, \
    138         "export %s_TREF=$" #Group "_TREF\n" \
    139         "export %s_EMISSIVITY=$" #Group "_EMISSIVITY\n" \
    140         "export %s_SPEC_FRACTION=$" #Group "_SPEC_FRACTION\n" \
    141         "export %s_H=$" #Group "_H\n" \
    142         "export %s_TEXT=$" #Group "_TEXT\n", \
    143         Name, Name, Name, Name, Name); \
    144 } (void)0
    145 
    146 #define STARDIS_H_BOUND_2(Group, Name) { \
    147   STARDIS_H_BOUND_2_model(Group, Name); \
    148   STARDIS_H_BOUND_2_vars(Group, Name); \
    149 } (void)0
    150 
    151 #define STARDIS_H_BOUND(Field) { \
    152   const char* n___; \
    153   ERR(scad_geometry_get_name(data_cad->Field, &n___)); \
    154   STARDIS_H_BOUND_2(Field, n___); \
    155 } (void)0
    156 
    157 #define STARDIS_SFC_2_model(Group, Name) { \
    158   model_count += fprintf(model, \
    159       "SOLID_FLUID_CONNECTION %s " \
    160       "$%s_TREF $%s_EMISSIVITY $%s_SPEC_FRACTION $%s_H " \
    161       "%s.stl\n", \
    162       Name, Name, Name, Name, Name, Name); \
    163 } (void)0
    164 
    165 #define STARDIS_SFC_2_vars(Group, Name) { \
    166       fprintf(vars, \
    167           "export %s_TREF=$" #Group "_TREF\n" \
    168           "export %s_EMISSIVITY=$" #Group "_EMISSIVITY\n" \
    169           "export %s_SPEC_FRACTION=$" #Group "_SPEC_FRACTION\n" \
    170           "export %s_H=$" #Group "_H\n", \
    171           Name, Name, Name, Name); \
    172 } (void)0
    173 
    174 #define STARDIS_SFC_2(Group, Name) { \
    175   STARDIS_SFC_2_model(Group, Name); \
    176   STARDIS_SFC_2_vars(Group, Name); \
    177 } (void)0
    178 
    179 #define STARDIS_SFC(Field) { \
    180   const char* n___; \
    181   ERR(scad_geometry_get_name(data_cad->Field, &n___)); \
    182   STARDIS_SFC_2(Field, n___); \
    183 } (void)0
    184 
    185 #define GENERIC_GROUND_VARS \
    186   "# GROUND properties.\n" \
    187   "export ground_body_LAMBDA=2\n" \
    188   "export ground_body_RHO=2000\n" \
    189   "export ground_body_CP=1000\n" \
    190   "export ground_body_DELTA=AUTO\n" \
    191   "export ground_body_TINIT=273\n" \
    192   "export ground_body_T_IMPOSED=UNKNOWN\n" \
    193   "export ground_body_POWER=0\n"
    194 
    195 #define GENERIC_B_GROUND_VARS \
    196   "# GROUND BOUNDARIES properties.\n" \
    197   "export ground_B_top_TREF=273\n" \
    198   "export ground_B_top_EMISSIVITY=0.9\n" \
    199   "export ground_B_top_SPEC_FRACTION=0\n" \
    200   "export ground_B_top_H=10\n" \
    201   "export ground_B_top_TEXT=273\n" \
    202   "export ground_B_bottom_T=286\n" \
    203   "export ground_B_lateral_F=0\n"
    204 
    205 #define GENERIC_WALL_VARS \
    206   "# Generic WALL properties.\n" \
    207   "export wall_LAMBDA=0.4\n" \
    208   "export wall_RHO=650\n" \
    209   "export wall_CP=1000\n" \
    210   "export wall_DELTA=AUTO\n" \
    211   "export wall_TINIT=273\n" \
    212   "export wall_T_IMPOSED=UNKNOWN\n" \
    213   "export wall_POWER=0\n"
    214 
    215 #define GENERIC_FLOOR_VARS \
    216   "# Generic FLOOR properties.\n" \
    217   "export floor_LAMBDA=1.5\n" \
    218   "export floor_RHO=2300\n" \
    219   "export floor_CP=2500\n" \
    220   "export floor_DELTA=AUTO\n" \
    221   "export floor_TINIT=273\n" \
    222   "export floor_T_IMPOSED=UNKNOWN\n" \
    223   "export floor_POWER=0\n"
    224 
    225 #define GENERIC_INTERMEDIATE_FLOOR_VARS \
    226   "# Generic INTERMEDIATE FLOOR properties.\n" \
    227   "export intermediate_floor_LAMBDA=1.5\n" \
    228   "export intermediate_floor_RHO=2300\n" \
    229   "export intermediate_floor_CP=2500\n" \
    230   "export intermediate_floor_DELTA=AUTO\n" \
    231   "export intermediate_floor_TINIT=273\n" \
    232   "export intermediate_floor_T_IMPOSED=UNKNOWN\n" \
    233   "export intermediate_floor_POWER=0\n"
    234 
    235 #define GENERIC_ROOF_VARS \
    236   "# Generic ROOF properties.\n" \
    237   "export roof_LAMBDA=1.5\n" \
    238   "export roof_RHO=2300\n" \
    239   "export roof_CP=2500\n" \
    240   "export roof_DELTA=AUTO\n" \
    241   "export roof_TINIT=273\n" \
    242   "export roof_T_IMPOSED=UNKNOWN\n" \
    243   "export roof_POWER=0\n"
    244 
    245 #define GENERIC_FOUNDATION_VARS \
    246   "# Generic FOUNDATION properties.\n" \
    247   "export foundation_LAMBDA=1.5\n" \
    248   "export foundation_RHO=2300\n" \
    249   "export foundation_CP=2500\n" \
    250   "export foundation_DELTA=AUTO\n" \
    251   "export foundation_TINIT=273\n" \
    252   "export foundation_T_IMPOSED=UNKNOWN\n" \
    253   "export foundation_POWER=0\n"
    254 
    255 #define GENERIC_GLAZING_VARS \
    256   "# Generic GLAZING properties.\n" \
    257   "export glazing_LAMBDA=1\n" \
    258   "export glazing_RHO=2500\n" \
    259   "export glazing_CP=720\n" \
    260   "export glazing_DELTA=AUTO\n" \
    261   "export glazing_TINIT=273\n" \
    262   "export glazing_T_IMPOSED=UNKNOWN\n" \
    263   "export glazing_POWER=0\n"
    264 
    265 #define GENERIC_INTERNAL_INSULATION_VARS \
    266   "# Generic INTERNAL INSULATION properties.\n" \
    267   "export internal_insulation_LAMBDA=0.05\n" \
    268   "export internal_insulation_RHO=18\n" \
    269   "export internal_insulation_CP=1000\n" \
    270   "export internal_insulation_DELTA=AUTO\n" \
    271   "export internal_insulation_TINIT=273\n" \
    272   "export internal_insulation_T_IMPOSED=UNKNOWN\n" \
    273   "export internal_insulation_POWER=0\n"
    274 
    275 #define GENERIC_EXTERNAL_INSULATION_VARS \
    276   "# Generic EXTERNAL INSULATION properties.\n" \
    277   "export external_insulation_LAMBDA=0.05\n" \
    278   "export external_insulation_RHO=18\n" \
    279   "export external_insulation_CP=1000\n" \
    280   "export external_insulation_DELTA=AUTO\n" \
    281   "export external_insulation_TINIT=273\n" \
    282   "export external_insulation_T_IMPOSED=UNKNOWN\n" \
    283   "export external_insulation_POWER=0\n"
    284 
    285 #define GENERIC_ROOF_INSULATION_VARS \
    286   "# Generic ROOF INSULATION properties.\n" \
    287   "export roof_insulation_LAMBDA=0.05\n" \
    288   "export roof_insulation_RHO=18\n" \
    289   "export roof_insulation_CP=1000\n" \
    290   "export roof_insulation_DELTA=AUTO\n" \
    291   "export roof_insulation_TINIT=273\n" \
    292   "export roof_insulation_T_IMPOSED=UNKNOWN\n" \
    293   "export roof_insulation_POWER=0\n"
    294 
    295 #define GENERIC_FLOOR_INSULATION_VARS \
    296   "# Generic FLOOR INSULATION properties.\n" \
    297   "export floor_insulation_LAMBDA=0.05\n" \
    298   "export floor_insulation_RHO=18\n" \
    299   "export floor_insulation_CP=1000\n" \
    300   "export floor_insulation_DELTA=AUTO\n" \
    301   "export floor_insulation_TINIT=273\n" \
    302   "export floor_insulation_T_IMPOSED=UNKNOWN\n" \
    303   "export floor_insulation_POWER=0\n"
    304 
    305 #define GENERIC_CAVITY_VARS \
    306   "# Generic FLUID CAVITY properties.\n" \
    307   "export cavity_RHO=1.25\n" \
    308   "export cavity_CP=1000\n" \
    309   "export cavity_TINIT=273\n" \
    310   "export cavity_T_IMPOSED=UNKNOWN\n"
    311 
    312 #define GENERIC_ATTIC_CAVITY_VARS \
    313   "# Generic FLUID ATTIC CAVITY properties.\n" \
    314   "export attic_cavity_RHO=1.25\n" \
    315   "export attic_cavity_CP=1000\n" \
    316   "export attic_cavity_TINIT=273\n" \
    317   "export attic_cavity_T_IMPOSED=UNKNOWN\n"
    318 
    319 #define GENERIC_HABITABLE_CAVITY_VARS \
    320   "# Generic FLUID HABITABLE CAVITY properties.\n" \
    321   "export habitable_cavity_RHO=1.25\n" \
    322   "export habitable_cavity_CP=1000\n" \
    323   "export habitable_cavity_TINIT=273\n" \
    324   "export habitable_cavity_T_IMPOSED=UNKNOWN\n"
    325 
    326 #define GENERIC_CRAWLSPACE_CAVITY_VARS \
    327   "# Generic FLUID CRAWLSPACE CAVITY properties.\n" \
    328   "export crawlspace_cavity_RHO=1.25\n" \
    329   "export crawlspace_cavity_CP=1000\n" \
    330   "export crawlspace_cavity_TINIT=273\n" \
    331   "export crawlspace_cavity_T_IMPOSED=UNKNOWN\n"
    332 
    333 #define GENERIC_SFC_VARS \
    334   "# Generic SOLID-FLUID CONNECTION properties.\n" \
    335   "export SFC_TREF=293\n" \
    336   "export SFC_EMISSIVITY=0.9\n" \
    337   "export SFC_SPEC_FRACTION=0\n" \
    338   "export SFC_H=5\n" \
    339   "export SFC_TEXT=273\n"
    340 
    341 #define GENERIC_B_WALL_VARS \
    342   "# Generic WALL BOUNDARY properties.\n" \
    343   "export boundary_wall_TREF=273\n" \
    344   "export boundary_wall_EMISSIVITY=0.9\n" \
    345   "export boundary_wall_SPEC_FRACTION=0\n" \
    346   "export boundary_wall_H=10\n" \
    347   "export boundary_wall_TEXT=273\n" \
    348 
    349 #define GENERIC_B_ROOF_VARS \
    350   "# Generic ROOF BOUNDARY properties.\n" \
    351   "export boundary_roof_TREF=273\n" \
    352   "export boundary_roof_EMISSIVITY=0.9\n" \
    353   "export boundary_roof_SPEC_FRACTION=0\n" \
    354   "export boundary_roof_H=10\n" \
    355   "export boundary_roof_TEXT=273\n"
    356 
    357 #endif /* STARDIS_MODEL_H */