README.md (20026B)
1 # `htrdr` 2 3 `htrdr` evaluates the intensity at any position (probe) of the scene, in 4 any direction, in the presence of *surfaces* and an *absorbing and 5 diffusing semi-transparent medium*, for both *internal* (longwave) or 6 *external* (shortwave) *radiation sources*. The intensity is calculated 7 using the *Monte Carlo* method: a number of optical paths are simulated 8 backward, from the probe position and into the medium. Various 9 algorithms are used, depending on the specificities of the nature and 10 shape of the radiation source. 11 12 Applications are theoretically possible to any configuration. However, 13 it all eventually comes down to the possibility of using the physical 14 data of interest, in their most common formats, in each scientific 15 community. `htrdr` is currently suitable for three main application 16 fields: 17 18 1. *Atmospheric radiative transfer:* a clear-sky atmosphere is 19 vertically stratified, neglecting Earth sphericity, and described in 20 terms of absorption coefficients as a function of height and spectral 21 quadrature point as per a correlated-k model. Cloud physical 22 properties are provided on a 3D rectangular grid. Surface geometrical 23 and optical properties can be provided for an arbitrary number of 24 geometries. Internal radiation and solar radiation are taken into 25 account. 26 27 2. *Combustion* processes: thermodynamic data is provided at the nodes 28 of an unstructured tetrahedral mesh, while surface properties can 29 still be provided for various materials. The radiation source is only 30 external: a monochromatic laser sheet illuminates the inside of the 31 combustion chamber for diagnostic purposes. 32 33 3. *Planetary science*: takes into account the geometry of a "ground" of 34 arbitrary shape, described by a triangular mesh, with the possibility 35 of using an arbitrary number of materials. The radiative properties 36 of a gas mixture must be provided on a tetrahedral mesh, using the 37 k-distribution spectral model. The radiative properties of an 38 arbitrary number of aerosol and hydrometeores can also be provided on 39 their individual tetrahedral mesh. Calculations can be made for both 40 internal and external radiation sources. In the case of an external 41 source, a sphere of arbitrary size and position is used. This sphere 42 can radiate as a Planck source at a specified brightness temperature, 43 or be associated with a high-resolution radiance spectrum. 44 45 Since any radiative transfer observable is expressed as an integral of 46 the intensity, and since there is a strict equivalence between the 47 integral to be solved and the underlying Monte Carlo algorithm (each 48 integral results in the sampling of a random variable), the algorithms 49 that calculate the radiance are used for computing various quantities: 50 51 - *Images* on a camera sensor, in a given field of view. For combustion 52 applications, only monochromatic images are supported. In atmospheres, 53 spectral integration is also possible, both for solar and thermal 54 images: CIE colorimetry is used for solar images, while thermal images 55 are in fact brightness temperature maps, obtained from the incoming 56 radiative flux over a specified spectral interval. 57 58 - *Flux density maps*, on a sensor grid, integrated over an entire 59 hemisphere. In the case of combustion chambers, only monochromatic 60 flux maps can be calculated, while spectrally integrated flux density 61 maps (both on the visible part of the spectrum and on the infrared) 62 are possible for atmospheric applications. 63 64 ## Requirements 65 66 - C compiler with OpenMP support 67 - POSIX make 68 - pkg-config 69 - Message Passing Interface (MPI) 70 - [mandoc](https://mandoc.bsd.lv) 71 - [AW](https://gitlab.com/vaplv/loader_aw) 72 - [Astoria: Semi-Transparent Medium](https://gitlab.com/meso-star/atrstm) 73 (optional; required by COMBUSTION) 74 - [High-Tune: Sky](https://gitlab.com/meso-star/htsky) 75 (optional; required by ATMOSHPERE) 76 - [ModRadUrb: MaTeriaL](https://gitlab.com/meso-star/mrumtl) 77 - [Rad-Net ATMopshere](https://gitlab.com/meso-star/rnatm) 78 (optional; required by PLANETS) 79 - [Rad-Net GRounD](https://gitlab.com/meso-star/rngrd) 80 (optional; required by PLANETS) 81 - [RSys](https://gitlab.com/vaplv/rsys) 82 - [Star 3D](https://gitlab.com/meso-star/star-3d) 83 - [Star Buffer](https://gitlab.com/meso-star/star-buffer) 84 (optional; required by PLANETS) 85 - [Star Camera](https://gitlab.com/meso-star/star-camera) 86 - [Star Mesh](https://gitlab.com/meso-star/star-mesh) 87 (optional; required by PLANETS) 88 - [Star Scattering Functions](https://gitlab.com/meso-star/star-sf) 89 - [Star SamPling](https://gitlab.com/meso-star/star-sp) 90 - [Star VoXel](https://gitlab.com/meso-star/star-vx) 91 92 ## Installation 93 94 Edit config.mk as needed, then run: 95 96 make clean install 97 98 ## Release notes 99 100 ### Version 0.12 101 102 #### Volumic Radiative Budget 103 104 Add support for volumic radiative budget calculations to 105 `htrdr-planets`. Its new `-r` option allows listing the tetrahedra for 106 which the volumic radiative budget is estimated and the number of 107 realizations to be used per tetrahedron. 108 109 Note that, with the exception of the separate treatment of direct and 110 diffuse components, no specific sampling strategy has been developed to 111 manage the spectro-spatio-directional heterogeneity of the integration 112 to be performed. It is the same Monte Carlo algorithm as the one used 113 for rendering. The variance of the volumic budget can therefore be high, 114 and may therefore require a large number of realizations per tetrahedron 115 to ensure the validity of its estimation. 116 117 #### Work distribution 118 119 - Addition of a new distribution policy that does not distribute the 120 rendering of an image but a generic calculation: the workload is a 1D 121 set of computations partitioned into pieces distributed to the 122 processes. It was developed to parallelize the calculation of the 123 volumetric radiative budget added by this version to the 124 `htrdr-planets` command. 125 - Adjustment of the "work stealing" policy: steal more frequently and 126 steal more work. The additional costs are negligible and this improves 127 the balance of work when distributing to (very) heterogeneous 128 computers. 129 - Fix load balancing issues. Depending on the image resolution, the 130 workload could be poorly distributed among processes. More 131 importantly, a deadlock could occur. 132 133 #### Miscellaneous 134 135 - Use Star-Sampling 0.15 to avoid using too much temporary space, which 136 could lead to disk space shortages on some systems. In return, 137 increase memory usage per thread by approximately 4 MB. 138 - Compile the missing tests in planets and combustion: they do not 139 appear to have been compiled since version 0.10. 140 - Rewrite the Makefile: divide it into sub-makefiles, one for each 141 command, and an additional one for the base library. This makes the 142 build system easier to read and manage. 143 - Fix the bug when the number of discrete wavelengths to be taken into 144 account is equal to 1. 145 - `htrdr-planets`: make the source optional in long wave computations. 146 147 ### Version 0.11 148 149 - Renamed `planeto` sub-command to `planets`. 150 - Fix typos in manual pages and formatting problems. 151 - Ensure correct default value for a camera. 152 - Correct error handling when parsing planeto input arguments. 153 154 ### Version 0.10 155 156 #### Use POSIX make as a build system 157 158 The build procedure is now written in POSIX make instead of CMake. 159 In addition to the features already provided by its CMake alternative, 160 the Makefile supports the use of static libraries and provides an 161 uninstall target. In any case, the main motivation behind its writing is 162 to use a good old well-established standard with simple features, 163 available on all UNIX systems, thus simplifying its portability and 164 support while being much lighter 165 166 #### Proof-reading and editing manual pages 167 168 Write the man pages directly in mdoc's roff macros, instead of using the 169 scdoc markup language as a source for man pages. 170 171 Unlike writing manuals with man's roff macros, and even more so with 172 scdoc, mdoc macros take care of layout, font handling and all the other 173 typesetting details which, by construction, guarantee the consistency of 174 all manuals without leaving the responsibility to the individual author. 175 This also facilitates translation into other formats and documentation 176 tools. These are the main reasons for writing manual pages with mdoc 177 macros. 178 179 A complete re-reading of the manual pages was carried out during the 180 translation into mdoc, with several corrections and rewrites to make the 181 manual clearer. 182 183 #### Bug fixes 184 185 - Fix the construction of the planck/CIE cumulative: the memory space 186 required could be prohibitive, leading to a shortage of memory space. 187 - Update error handling in `htrdr_ran_wlen_planck_create` to avoid 188 freeing up the same memory space several times, and thus causing a 189 crash. 190 - All dependencies have been updated. In particular, the `htmi` and 191 `rnatm` libraries have been updated to version 0.1. They fixe several 192 problems with the atmosphere and planeto commands. See their release 193 note for more information. 194 195 ### Version 0.9.2 196 197 - Update the `rnatm` library to version 0.0.1. This versions fixes 198 several bugs when different atmospheric components do not have the 199 same volumetric meshes. 200 - Display an error message when parsing unknown arguments to the 201 `htrdr-planeto` command. 202 - Fix `htrdr-planeto` man page: there was an error in the `csplit` 203 command provided as an example to extract octrees from the output of 204 `htrdr-planeto` when the -d option is used. 205 206 ### Version 0.9.1 207 208 - Fix invalid read/write memory access when ray tracing the ground in 209 `htrdr-atmopshere`. 210 - Fix compilation warning detected by GCC 12. 211 - Fix `htrdr-planeto` man page (-S option): the unit of the radius and 212 the distance from the source is not the meter but the kilometer. 213 - Fix `htrdr` man page: replaced long options with short options. 214 - Reference and install the rnrl fileformat man page. 215 - Proofreading the README and man pages: correcting typos, spelling and 216 formatting errors and turns of phrase 217 218 ### Version 0.9 219 220 #### Adds radiative transfer simulation in 3D planetary atmospheres 221 222 The new `htrdr-planeto` command simulates radiative transfer in 223 planetology context, i.e. in the 3D atmosphere of a telluric planet. 224 Both infrared and visible computations are supported. `htrdr-planeto` is 225 actually a renderer that calculates an image for a given observation 226 position. Its internal rendering algorithm is based on Monte Carlo 227 integration, which consists for each pixel in simulating a given number 228 of optical paths from the sensor, taking into account the phenomena of 229 light absorption and scattering. 230 231 The planet's ground can be any set of triangles with BRDFs and 232 temperatures defined per triangle. The atmosphere is composed of a gas 233 mixture and a potentially empty set of aerosols. Both can have arbitrary 234 tetrahedral meshes with per-node radiative properties. 235 236 #### Miscellaneous 237 238 - Use scdoc rather than asciidoc as file format for man sources. 239 - Update all dependencies. More notably, use 240 [MruMtl 0.1](https://gitlab.com/meso-star/mrumtl/-/tree/0.1) 241 which introduces API breaks. 242 - Add the discrete wavelength distribution currently used in 243 `htrdr-planeto` only. 244 245 ### Version 0.8.1 246 247 Sets the required version of Star-SampPling to 0.12. This version fixes 248 compilation errors with gcc 11 but introduces API breaks. 249 250 ### Version 0.8 251 252 - Adds support for a thin lens camera model and an orthographic camera 253 model for combustion and atmosphere modes. 254 - Updates the size of a tile from 32x32 pixels to 8x8 pixels. A tile is 255 a block of pixels rendered by a thread. However, a size of 32x32 256 pixels could be too large when rendering on several dozen threads: the 257 image definition could be insufficient to give tiles to all threads. 258 - Fixes the calculation of shortwave radiance by `htrdr-combustion` and 259 the calculation of longwave radiance by `htrdr-atmosphere`. At each 260 scattering position, the range of the traced ray could be incorrect. 261 262 ### Version 0.7 263 264 #### Adds the simulation of radiative transfer in combustion media 265 266 The new `htrdr-combustion` command performs radiative transfer 267 computations in a scene representing a semi-transparent medium 268 enlightened by a laser sheet. It uses Monte Carlo to calculate a 269 monochromatic image of the medium or the radiative flux density. Both 270 computations are performed in the visible at a given frequency. 271 272 The medium data are defined on the vertices of an unstructured 273 tetrahedral mesh that may be surrounded by a triangular surface mesh 274 representing the inner limits of the combustion chamber. 275 276 #### Updates the `htrdr` command 277 278 The previous `htrdr` command is renamed to `htrdr-atmosphere`. `htrdr` 279 becomes a proxy for the `htrdr-atmosphere` command or the 280 `htrdr-combustion` command: calling `htrdr` with the 281 `<atmosphere|combustion>` options is equivalent to directly calling the 282 `htrdr-<atmosphere|combustion>` commands. 283 284 #### Miscellaneous 285 286 - Major update of the entire codebase to add multiple applications to 287 `htrdr`: It was originally designed to handle atmospheric applications 288 only. 289 - Always displays the number of processes and the number of threads: 290 previously they were only printed on multi-node executions. 291 - Fixed auto intersection issue on surfaces not facing the sun. 292 - Fixed writing of pixel data: assumed pixel layout could be wrong. 293 294 ### Version 0.6.1 295 296 - Fix the self-intersection issue in shortwave computations introduced 297 by the 0.6 version. 298 299 ### Version 0.6 300 301 #### New features 302 303 - Add support of flux map computation for both shortwave and longwave. 304 The flux is computed for the part of the flux map lying outside any 305 geometry. The new command line option `-p` defines the rectangle in 306 the scene onto which the flux is going to be integrated. The flux map 307 resolution and the realisations count per pixel is controlled by the 308 `-i` option. 309 - Add support of thin materials, i.e. materials without geometric 310 thickness as for instance the leaves of the trees. 311 - Add the temperature property to the materials and used it as the limit 312 condition during longwave computations. Previously, the surface 313 temperatures were fetched from the atmosphere at the given surface 314 position. 315 - Add the `-n` option to fix the name of the material defining the 316 atmosphere. 317 318 #### Fix 319 320 - In shortwave, fix how direct contribution is handled for purely 321 specular BRDF. 322 323 ### Version 0.5.1 324 325 - Fix the `undefined strtok_r symbol` issue exhibited by some GCC 326 versions that leads to memory corruption and segmentation fault when 327 parsing the ground interfaces. 328 - Fix typos in the man pages. 329 330 ### Version 0.5 331 332 #### New feature 333 334 Add support of shortwave integration with respect to the Planck function 335 for a reference temperature whose default value is the blackbody 336 temperature of the sun. Actually this is the counterpart of the longwave 337 integration introduced by the "infrared rendering" in the 0.4 version. 338 The main difference is that the source of radiation is the sun rather 339 than the medium and its boundaries. 340 341 The option `-l` that enabled the infrared rendering is now replaced by 342 the new `-s` option that controls the spectral integration that can be 343 CIE XYZ (i.e. regular image rendering), longwave or shortwave. 344 345 #### Fixes 346 347 - Fix the returned sun radiance: the precomputed per spectral band solar 348 incoming flux is removed and the sun radiance is now retrieved by 349 directly evaluating the monochromatic Planck for the blackbody 350 temperature of the sun. 351 - Fix CIE XYZ spectral integration: the pdf used to sample the CIE 352 tristimulus values was not correctly handled in the Monte Carlo 353 weight. 354 - Fix the longwave spectral integration: the Monte Carlo weight was 355 wrong leading to overestimated temperatures. 356 357 ### Version 0.4 358 359 #### New features 360 361 - Add support of infrared rendering: when defined, the new `-l` option 362 setups the range of longwave into which the rendering is performed. In 363 infrared rendering, each pixel stores the radiance per pixel and its 364 associated brightness temperature. Spectral integration is done with 365 respect to the Planck function for a reference temperature of 290 K. 366 - The ground geometry can now have several materials whose data vary 367 over the spectrum. These materials are listed in a new 368 [htrdr-materials](https://gitlab.com/meso-star/htrdr/-/blob/master/doc/htrdr-materials.5.txt) 369 file where each materials is defined by a name and a file storing its 370 spectral data with respect to the 371 [MruMtl](https://gitlab.com/meso-star/mrumtl/-/blob/master/doc/mrumtl.5.txt) 372 fileformat. A material is mapped to a part of the OBJ geometry by 373 using the `usemtl` directive of the 374 [OBJ fileformat](https://gitlab.com/meso-star/htrdr/-/blob/master/doc/htrdr-obj.5.txt). 375 - Improve the sampling of the spectral dimension: the per wavelength 376 realisation is now precisely sampled rather than arbitrarly fixed to 377 the center of the sampled spectral band. Consequently, high resolution 378 data defined per wavelength (e.g. Mie's properties and the 379 reflectivity of the materials) are now fully taken into account. 380 381 #### Fixes 382 383 - Fix a deadlock when `htrdr` was run through MPI. 384 - Fix a memory leak: the output file was not closed on exit. 385 386 ### Version 0.3 387 388 - Add the `-O` option that defines the file where the sky data are 389 cached. If the file does not exist, the sky data structures are built 390 from scratch and serialized into this new file. If this file exists, 391 these data structures are directly read from it, leading to a huge 392 speed up of the `htrdr` pre-processing step. Note that if the provided 393 file exists but is filled with data that do not match the submitted 394 HTGOP, HTCP and HTMie files, an error is detected and the program 395 stops. 396 - Rely on the HTSky library to manage the sky data. This library handles 397 the code previously defined into the `htrdr_sky.<c|h>` files. The 398 HTCP, HTGOP, HTMie libraries are thus no more dependencies of `htrdr` 399 since only the `htrdr_sky` files used them. 400 401 ### Version 0.2 402 403 - Add the `-b` option that controls the BRDF of the ground geometry. 404 - Make optional the use of a ground geometry (option `-g`). 405 - Make optional the definition of the optical properties of water 406 droplets (option `-m`) when no cloud field is used. 407 408 ### Version 0.1 409 410 - Add the `-V` option that fixes the maximum definition of the octrees 411 used to partitioned the radiative properties of the clouds. 412 - Add a per pixel estimation of the per radiative path computation time. 413 414 ### Version 0.0.4 415 416 - Fix the computation of the surface scattering: there was a bug in how 417 Russian roulette was implemented at surface scattering leading to an 418 underestimation of the surface reflection. 419 - Update the thread allocation policy: by default, the number of threads 420 is now defined as the maximum between the number of processors 421 detected by OpenMP and the number of threads defined by the 422 `OMP_NUM_THREADS` environment variable. This variable can be used to 423 counteract the number of processors detected by OpenMP that can be 424 lower than the real number of processors of the system. 425 426 ### Version 0.0.3 427 428 - Fix compilation on systems with a GNU C Library whose version is less 429 than 2.19. 430 - Fix a possible invalid memory access to cloud data leading to 431 segmentation faults. 432 433 ## Copyright notice 434 435 Copyright © 2018-2019, 2022-2025 Centre National de la Recherche Scientifique 436 Copyright © 2020-2022 Institut Mines Télécom Albi-Carmaux 437 Copyright © 2022-2025 Institut Pierre-Simon Laplace 438 Copyright © 2022-2025 Institut de Physique du Globe de Paris 439 Copyright © 2018-2025 [|Méso|Star>](http://www.meso-star.com) (contact@meso-star.com) 440 Copyright © 2022-2025 Observatoire de Paris 441 Copyright © 2022-2025 Université de Reims Champagne-Ardenne 442 Copyright © 2022-2025 Université de Versaille Saint-Quentin 443 Copyright © 2018-2019, 2022-2025 Université Paul Sabatier 444 445 ## License 446 447 `htrdr` is free software released under the GPL v3+ license: GNU GPL 448 version 3 or later. You are welcome to redistribute it under certain 449 conditions; refer to the COPYING file for details.