htrdr

Solving radiative transfer in heterogeneous media
git clone git://git.meso-star.fr/htrdr.git
Log | Files | Refs | README | LICENSE

commit c3f825a19c9f22ec12fdf220052213455081f67a
parent 572eabf7ade0c9d1927a6eb5c4bc838a276569f9
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon, 22 Feb 2021 12:47:36 +0100

Update the man pages

Rename the htrdr man page in htrdr-atmosphere and slightly change its
content from this renaming. Write the new htrdr man page and update all
remaining ones according to this new infrastructure.

Diffstat:
Mcmake/CMakeLists.txt | 2+-
Mcmake/doc/CMakeLists.txt | 8++++----
Adoc/htrdr-atmosphere.1.txt.in | 404+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdoc/htrdr-image.5.txt | 52+++++++++++++++++++++++++---------------------------
Mdoc/htrdr-materials.5.txt | 20+++++++++++---------
Mdoc/htrdr-obj.5.txt | 20++++++++++++--------
Adoc/htrdr.1.txt | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ddoc/htrdr.1.txt.in | 398-------------------------------------------------------------------------------
8 files changed, 534 insertions(+), 447 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -32,7 +32,7 @@ set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) add_subdirectory(core) add_subdirectory(atmosphere) add_subdirectory(commands) -#add_subdirectory(doc) +add_subdirectory(doc) ################################################################################ # Define output & install directories diff --git a/cmake/doc/CMakeLists.txt b/cmake/doc/CMakeLists.txt @@ -29,7 +29,7 @@ endif() ################################################################################ # Copy doc files ################################################################################ -set(MAN_NAMES htrdr-image.5 htrdr-materials.5 htrdr-obj.5) +set(MAN_NAMES htrdr.1 htrdr-image.5 htrdr-materials.5 htrdr-obj.5) set(MAN_FILES) foreach(_name IN LISTS MAN_NAMES) @@ -45,9 +45,9 @@ foreach(_name IN LISTS MAN_NAMES) endforeach() add_custom_target(man-copy ALL DEPENDS ${MAN_FILES}) -configure_file(${HTRDR_SOURCE_DIR}/../doc/htrdr.1.txt.in - ${CMAKE_CURRENT_BINARY_DIR}/htrdr.1.txt @ONLY) -list(APPEND MAN_NAMES htrdr.1) +configure_file(${HTRDR_SOURCE_DIR}/../doc/htrdr-atmosphere.1.txt.in + ${CMAKE_CURRENT_BINARY_DIR}/htrdr-atmosphere.1.txt @ONLY) +list(APPEND MAN_NAMES htrdr-atmosphere.1) ################################################################################ # ROFF man pages diff --git a/doc/htrdr-atmosphere.1.txt.in b/doc/htrdr-atmosphere.1.txt.in @@ -0,0 +1,404 @@ +// Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) +// Copyright (C) 2018, 2019, 2021 CNRS +// Copyright (C) 2018, 2019 Université Paul Sabatier +// (contact-edstar@laplace.univ-tlse.fr) +// +// 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/>. +:toc: + +htrdr-atmosphere(1) +=================== + +NAME +---- +htrdr-atmosphere - simulate radiative transfert in cloudy atmospheres + +SYNOPSIS +-------- +[verse] +*htrdr-atmosphere* [_option_]... -a _atmosphere_ + +DESCRIPTION +----------- +*htrdr-atmosphere* simulate radiative transfert in scenes composed of an +atmospheric gas mixture, clouds, and a ground. It evaluates the intensity +incoming on each pixel of the sensor array. The underlying algorithm is based +on a Monte-Carlo method: it consists in simulating a given number of optical +paths originating from the sensor, directed into the atmosphere, taking into +account light absorption and scattering phenomena. + +Radiative transfert can be evaluated in the visible or the infrared part of the +spectrum. It uses spectral data that should be provided for the pressure and +temperature atmospheric vertical profile [1] (*-a* _atmosphere_), the liquid +water content in suspension within the clouds stored in a *htcp*(5) file (*-c* +_clouds_), and the optical properties of water droplets that have been obtained +from a Mie code and formatted according to the *htmie*(5) file format (*-m* +_mie_). The user also has to set the position of the sun (*-D* +_azimuth_,_elevation_), the sensor type (*-C* _camera_ or *-p* _rectangle_) and +its definition (*-i* _image_). It is also possible to provide an *htrdr-obj*(5) +file representing the ground geometry (*-g* _ground_) whose materials are +listed in the *htrdr-material*(5) file provided through the *-M* option. Both, +the clouds and the ground, can be infinitely repeated along the X and Y axis by +setting the *-r* and the *-R* options, respectively. + +Two types of sensor are supported by *htrdr-atmosphere*. The camera (*-C* +_camera_) is used to render an image of the scene from the given point of view +while the rectangle sensor (*-p* _rectangle_) is used to compute a flux map. + +Spectral dimension can be integrated in many ways (*-s* option). When rendering +an image (*-C* _camera_), the computation is by default performed for the +visible part of the spectrum in [380, 780] nanometers, for the three components +of the CIE 1931 XYZ colorimetric space that are subsequently recombined in +order to obtain the final color for each pixel, and finally the whole image of +the scene as seen from the set observation position. The two other ways consist +in explicitly defining the longwave or shortwave spectral range to handle and +continuously sampling a wavelength in this range. Actually longwave and +shortwave are keywords that mean that the source of radiation is whether +external or internal to the medium, respectively. In shortwave rendering, only +the pixel radiance is evaluated and stored in the output image. For longwave +rendering this estimated radiance is then converted to its brightness +temperature and both are saved in the image. When computing a flux map (*-p* +_rectangle_), the per pixel flux is saved into the output map whether spectral +domain is longwave or shortwave. + +In *htrdr-atmosphere* the spatial unit 1.0 corresponds to one meter and the +temperatures are expressed in Kelvin. The estimated radiances are given in +W/sr/m^2 excepted for monochromatic computations where the computed spectral +radiance is defined in W/sr/m^2/nm. The fluxes are saved in W/m^2. The results +are written to the output file if the *-o* option is defined and the standard +output otherwise. The output image is a list of raw ASCII data formatted with +respect to the *htrdr-image*(5) file format. Since *htrdr-atmosphere* relies +on the Monte-Carlo method, each estimation is given with its numerical +accuracy. + +During the simulation, *htrdr-atmosphere* dynamically loads/unloads cloud +properties to handle clouds whose data that do not feat in main memory. +*htrdr-atmosphere* also supports shared memory parallelism and relies on the +Message Passing Interface specification [3] to parallelise its computations in +a distributed memory environment; it can thus be run either directly or through +a MPI process launcher like *mpirun*(1). + +OPTIONS +------- +*-a* _atmosphere_:: + Path toward the file containing the gas optical properties of the atmosphere. + Data must be formatted according to the fileformat described in [1]. + +*-c* _clouds_:: + Submit a *htcp*(5) file describing the properties of the clouds. If not + defined, only the atmosphere properties submitted through the *-a* option + are taken into account. + +*-C* <__camera-parameter__:...>:: + Define the rendering point of view. Available camera parameters are: + + **fov**=**_angle_**;; + Vertical field of view of the camera in [30, 120] degrees. By default + _angle_ is set to @HTRDR_ARGS_DEFAULT_CAMERA_FOV@ degrees. + + **pos**=**_x_**,**_y_**,**_z_**;; + Position of the camera. By default it is set to + {@HTRDR_ARGS_DEFAULT_CAMERA_POS@}. + + **tgt**=**_x_**,**_y_**,**_z_**;; + Position targeted by the camera. By default it is set to + {@HTRDR_ARGS_DEFAULT_CAMERA_TGT@}. + + **up**=**_x_**,**_y_**,**_z_**;; + Up vector of the camera. By default it is set to + {@HTRDR_ARGS_DEFAULT_CAMERA_UP@}. + +*-D* <__azimuth__,__elevation__>:: + Direction toward the sun center. The direction is defined by two angles in + degrees: the __azimuth__ angle in [0, 360[ and the __elevation__ angle in [0, + 90]. Following the right-handed convention, the azimuthal rotation is + counter-clockwise, with 0 degree on the X axis. The elevation starts from 0 + degree for a direction in the XY plane, up to 90 degrees at zenith. Thus + -D0,0 -D90,0 -D180,0 and -D270,0 will produce solar vectors {+1,0,0} {0,+1,0} + {-1,0,0} and {0,-1,0} respectively, while -D__azimuth__,90 will produce + {0,0,+1} regardless of _azimuth_ value. + +*-d*:: + Write in _output_ the space partitioning data structures used to speed up + the radiative transfer computations in the clouds. The written data are + octrees saved in the VTK file format [2]. Each octree node stores the minimum + and the maximum of the extinction coefficients of the cloud cells overlapped + by the octree node. In the _output_ file, each octree is separated from the + previous one by a line with three minus characters, i.e. '---'. + +*-f*:: + Force overwrite of the _output_ file. + +*-g* _ground_:: + Path toward a *htrdr-obj*(5) representing the ground geometry. + +*-h*:: + List short help and exit. + +*-i* <__image-parameter__:...>:: + Define the sensor array. Available image parameters are: + + **def**=**_width_**x**_height_**;; + Definition of the image. By default the image definition is + @HTRDR_ARGS_DEFAULT_IMG_WIDTH@x@HTRDR_ARGS_DEFAULT_IMG_HEIGHT@. + + **spp**=**_samples-count_**;; + Number of samples per pixel estimation. In regular image rendering, a pixel + will use "3 * _samples-count_" Monte-Carlo realisations, one set of + _samples-count_ realisations for each X, Y and Z component of the CIE 1931 + XYZ color space. In shortwave/longwave rendering or flux computation, only + one set of _samples-count_ is used. By default, *spp* is set to + @HTRDR_ARGS_DEFAULT_IMG_SPP@. + +*-R*:: + Infinitely repeat the _ground_ along the X and Y axis. + +*-r*:: + Infinitely repeat the _clouds_ along the X and Y axis. + +*-M* _materials_:: + Path toward a *htrdr-materials*(5) file listing the ground materials. + +*-m* _mie_:: + Path toward a *htmie*(5) file defining the optical properties of water + droplets. + +*-n* _sky-mtl_:: + Name of the material representing the sky in the *htrdr-materials*(5) file. + By default, _sky-mtl_ is @HTRDR_ARGS_DEFAULT_SKY_MTL_NAME@. + +*-O* _cache_:: + File used to cache the sky data. If the _cache_ file does not exists, it is + created and filled with the sky data built from the _clouds_, the + _atmosphere_ and the _mie_ input files. This cached data can then be reused + in the next runs as long as the input files provided on the command are the + same as the ones used to setup the cache; leading to a significant speed-up + of the pre-processing step. If _cache_ contains data generated from input + files that are not the ones submitted on the command line, an error is + notified and the execution is stopped, avoiding the use of wrong cached data. + Note that when the cache is used, *htrdr-atmosphere* ignores the arguments + used to parametrise the structures partitioning the sky data, i.e. the *-T* + and *-V* options. + +*-o* _output_:: + File where *htrdr-atmosphere* writes its _output_ data. If not defined, write + results to standard output. + +*-p* <__rectangle-parameter__:...>:: + Switch in flux map computation. The flux is computed for the part of the + sensor that is outside any geometry. The rectangular sensor onto which the + flux is integrated is defined by the following parameters: + + **pos**=**_x_**,**_y_**,**_z_**;; + Position of the center of the rectangle. By default it is set to + {@HTRDR_ARGS_DEFAULT_RECTANGLE_POS@}. + + **tgt**=**_x_**,**_y_**,**_z_**;; + Position targeted by the rectangle, i.e. *tgt* - *pos* is the rectangle + normal. By default it is set to {@HTRDR_ARGS_DEFAULT_RECTANGLE_TGT@}. + + **up**=**_x_**,**_y_**,**_z_**;; + Up vector of the rectangle. By default it is set to + {@HTRDR_ARGS_DEFAULT_RECTANGLE_UP@}. + + **sz**=**_width_**,**_height_**;; + Size of the rectangle. By default it is set to + {@HTRDR_ARGS_DEFAULT_RECTANGLE_SZ@}. + +*-s* <__spectral-parameter__:...>:: + Define the type and the range of the spectral integration. Available spectral + parameters are: + + **cie_xyz**;; + the radiance is computed for the visible part of the spectrum in [380, 780] + nanometers with respect to the XYZ CIE 1931 tristimulus values. This is the + default comportment of *htrdr-atmosphere*. + + **lw**=*_wlen-min_*,*_wlen-max_*;; + perform the spectral sampling continuously in the [_wlen-min_, _wlen-max_] + wavelength range (wavelength must be provided in nanometers) according to + the Planck function for a reference temperature. If _wlen-min_ and + _wlen-max_ are equals the computation is monochromatic. *lw* means for + longwave but is here a code word that really means "computation of radiance + using the internal source of radiation": in other words, radiation is + emitted by the medium and its boundaries (ground and space). Because the + application is for the terrestrial atmosphere, internal radiation is + emitted in the thermal longwave part of the electromagnetic spectrum. + Therefore the default value of the reference temperature used in the + spectral sampling is fixed at 290 K. + + **sw**=*_wlen-min_*,*_wlen-max_*;; + perform the spectral sampling continuously in the [_wlen-min_, _wlen-max_] + wavelength range (wavelength must be provided in nanometers) according to + the Planck function for a reference temperature. If _wlen-min_ and + _wlen-max_ are equals the computation is monochromatic. In the present + case, *sw* means that the source of radiation is external to the medium: + because the application is for the terrestrial atmosphere, the value of the + reference temperature is by default fixed at 5778 K, i.e. the blackbody + temperature of the Sun. + + **Tref**=**_temperature_**;; + reference temperature of the Planck function used to continuously sample the + longwave/shortwave spectral range. In longwave, it is set to 290 K by + default while in shortwave its default value is the blackbody temperature + of the sun (i.e. 5778 K). + +*-T* _threshold_:: + Optical thickness used as threshold criteria to partition the properties of + the clouds. By default its value is @HTRDR_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@. + This option is ignored if a cache file is used (option *-O*). + +*-t* _threads-count_:: + Hint on the number of threads to use. By default use as many threads as CPU + cores. + +*-V* **_x_**,**_y_**,**_z_**:: + Define the maximum definition of the acceleration data structure that + partitions the cloud properties. By default the finest definition is the + definition of the submitted *htcp*(5) file. This option is ignored if a cache + file is used (option *-O*). + +*-v*:: + Make *htrdr-atmosphere* verbose. + +EXAMPLES +-------- + +Render a clear sky scene, i.e. a scene without any cloud, whose sun is at +zenith. The vertical atmospheric gaz mixture along the Z axis is described in +the *gas.txt* file. the ground geometry is a quad repeated to the infinity +whose materials are listed in the *material.mtl* file. The camera is positioned +at *400* meters height and looks toward the positive Y axis. The definition of +the rendered image is *800* by *600* pixels and the radiance of each pixel +component is estimated with *64* Monte-Carlo realisations. The resulting image +is written to *output* excepted if the file already exists; in this case an +error is notified, the program stops and the *output* file remains unchanged: + + $ htrdr-atmosphere -D0,90 -a gas.txt -m Mie.nc -g quad.obj -R \ + -M materials.mtl \ + -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \ + -i def=800x600:spp=64 \ + -o output + +Add clouds to the previous scene and use a more complex geometry to represent +the ground. The Mie data are provided through the *Mie.nc* file. The ground +geometry was carefully designed to be cyclic and can be thus infinitely +repeated without visual glitches. Use the *-f* option to write the rendered +image to *output* even though the file already exists. Finally, use the +*htpp*(1) command to convert the *htrdr-image*(5) saved in output in a regular +PPM image [4]: + + $ htrdr-atmosphere -D0,90 -a gas.txt -m Mie.nc -g mountains.obj -R \ + -M materials.mtl \ + -c clouds.htcp \ + -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \ + -i def=800x600:spp=64 \ + -f -o output + $ htpp -o image.ppm output + +Render the previous scene in infrared for the wavelengths in [*9200*, *10000*] +nanometers with a reference temperature of *300* Kelvin: + + $ htrdr-atmosphere -a gas.txt -m Mie.nc -g mountains.obj -R \ + -M materials.mtl \ + -c clouds.htcp \ + -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \ + -i def=800x600:spp=64 \ + -s lw=9200,10000:Tref=300 + -f -o output + +Move the sun by setting its azimuthal and elevation angles to *120* and *40* +degrees respectively. Use the *-O* option to enable the cache mechanism on +sky data. Increase the image definition to *1280* by *720* and set the +number of samples per pixel component to *1024*. Write results on standard +output and convert the resulting image in PPM before visualising it through the +*feh*(1) image viewer: + + $ htrdr-atmosphere -D120,40 -a gas.txt -m Mie.nc -g mountains.obj -R \ + -M materials.mtl \ + -c clouds.htcp \ + -O my_cache \ + -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \ + -i def=1280x720:spp=1024 | htpp | feh - + +Compute the downward flux for the shortwave interval [*350*, *4000*] nanometers +on a square of *100* meters side positionned at the origin at *1* meter height. +The resolution of the flux map is *500* by *500* pixels and *1000* realisations +is used to estimate the flux per pixel. It is saved in the *flux_map.txt* file +even though this file already exists: + + $ htrdr-atmosphere -D0,90 -a gas.txt -m Mie.nc -g plane.obj -R \ + -M materials.mtl \ + -c clouds.htcp \ + -O my_cache \ + -p pos=0,0,1:tgt=0,0,2:up=0,1,0:sz=100,100 \ + -i def=500x500:spp=1000 \ + -s sw=350,4000 \ + -f -o flux_map.txt + +Write into *output* the data structures used to partition the clouds +properties. Use the *csplit*(1) Unix command to extract from *output* the list +of the generated grids and save each of them in a specific VTK file whose name +is *cloud_grid_*<__NUM__>*.vtk with __NUM__ in [0, N-1] where N is the number +of grids written into *output*: + + $ htrdr-atmosphere -a gas.txt -m Mie.nc -c clouds.htcp -d -f -o output + $ csplit -f cloud_grid_ -b %02d.vtk -z --suppress-matched output /^---$/ {*} + +Use *mpirun*(1) to launch *htrdr-atmosphere* on several hosts defined in the +*my_hosts* file. Make the clouds infinite along the X and Y axis: + + $ mpirun --hostfile my_hosts htrdr-atmosphere \ + -D120,40 -a gas.txt -m Mie.nc -g mountains.obj -R \ + -M materials.mtl \ + -c clouds.htcp -r \ + -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \ + -i def=1280x720:spp=1024 \ + -f -o output + +NOTES +----- +1. High-Tune: Gas Optical Properties file format - + <https://www.meso-star.com/projects/high-tune/downloads/gas_opt_prop_en.pdf> +2. VTK file format - + <http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf> +3. MPI specifications - <https://www.mpi-forum.org/docs/> +4. Portable PixMap - <http://netpbm.sourceforge.net/doc/ppm.html> + +COPYRIGHT +--------- +Copyright $copy; 2018, 2019, 2020, 2021 |Meso|Star> <contact@meso-star.com>. +Copyright &copy; 2018, 2019, 2021 CNRS +Copyright &copy; 2018, 2019 Université Paul Sabatier +<contact-edstar@laplace.univ-tlse.fr>. + +LICENSE +------- + +*htrdr-atmosphere* is free software released under the GPLv3+ license: GNU GPL +version 3 or later <https://gnu.org/licenses/gpl.html>. You are free to change +and redistribute it. There is NO WARRANTY, to the extent permitted by law. + +SEE ALSO +-------- +*csplit*(1), +*feh*(1), +*mpirun*(1), +*htcp*(5), +*htmie*(5), +*htpp*(1), +*htrdr*(1), +*htrdr-image*(5), +*htrdr-materials*(5) +*htrdr-obj*(5) diff --git a/doc/htrdr-image.5.txt b/doc/htrdr-image.5.txt @@ -1,5 +1,7 @@ -// Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) -// Copyright (C) 2018-2019 CNRS, Université Paul Sabatier +// Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) +// Copyright (C) 2018, 2019, 2021 CNRS +// Copyright (C) 2018, 2019 Université Paul Sabatier +// (contact-edstar@laplace.univ-tlse.fr) // // 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 @@ -30,37 +32,33 @@ thus ignored as well as empty lines. The first valid line stores 2 unsigned integers that represent the image definition, i.e. the number of pixels per line and per column. Then each line stores 8 pixel components. -If the image is a regular rendering in the visible part of the spectrum (*-C* -_camera_ and *-s* _cie_xyz_ options in *htrdr*(1)), the pixel components are -actually 4 pairs of floating points data representing the pixel color encoded -in the CIE 1931 XYZ color space and the per radiative path computation time. -The first, second and third pairs encode the estimated integrated radiance in -W/sr/m^2 of the X, Y and Z pixel components, respectively. The first value of -each pair is the expected value of the estimated radiance while the second one -is its associated standard deviation. The fourth pair saves the estimate in +If the image is a regular rendering in the visible part of the spectrum, the +pixel components are actually 4 pairs of floating points data representing the +pixel color encoded in the CIE 1931 XYZ color space and the per radiative path +computation time. The first, second and third pairs encode the estimated +integrated radiance in W/sr/m^2 of the X, Y and Z pixel components, +respectively. The first value of each pair is the expected value of the +estimated radiance while the second one is its associated standard deviation. +The fourth pair saves the estimate in microseconds of the per radiative path +computation time and its standard error. + +If the image is an infrared rendering the first and second pixel components +store the expected value and the standard error, respectively, of the +estimated brightness temperature in Kelvin. The third and fourth components +save the expected value and standard deviation of the pixel radiance that is +either an integrated radiance in W/sr/m^2 or a spectral radiance in +W/sr/m^2/nm whether this radiance is computed for a spectral range or for one +wavelength. The fifth and sixth pixel components are unused. Finally the last +2 pixel components save, as for a regular rendering, the estimate in microseconds of the per radiative path computation time and its standard error. -If the image is an infrared rendering (*-C* _camera_ and *-s* -*lw*=_wlen-min_,_wlen_max_ options in *htrdr*(1)), the first and second pixel -components store the expected value and the standard error, respectively, of -the estimated brightness temperature in Kelvin. The third and fourth -components save the expected value and standard deviation of the pixel -radiance that is either an integrated radiance in W/sr/m^2 or a spectral -radiance in W/sr/m^2/nm whether this radiance is computed for a spectral range -or for one wavelength. The fifth and sixth pixel components are unused. -Finally the last 2 pixel components save, as for a regular rendering, the -estimate in microseconds of the per radiative path computation time and its -standard error. - -If it was generating from a shortwave rendering (*-C* _camera_ and *-s* -*sw*=_wlen-min_,wlen-max_ options in *htrdr*(1)) the image is formatted as in +If it was generating from a shortwave rendering the image is formatted as in longwave rendering mode exepted that the first and second pixel components are unused since no brightness temperature was evaluated in shortwave. -For flux computations (*-p* _rectangle_ option in *htrdr*(1)), the first and -second pixel component stores the expected value and the standard error of the -pixel flux in W/m^2 for the part of the pixel that is outside any geometry. As +For flux computations, the first and second pixel component stores the +expected value and the standard error of the pixel flux in W/m^2. As previously, the seventh and eighth pixel components store the estimate of the radiative path computation time in microseconds and its standard error. The remaining components, i.e. the components 3 to 6, are unused. diff --git a/doc/htrdr-materials.5.txt b/doc/htrdr-materials.5.txt @@ -1,5 +1,7 @@ -// Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) -// Copyright (C) 2018-2019 CNRS, Université Paul Sabatier +// Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) +// Copyright (C) 2018, 2019, 2021 CNRS +// Copyright (C) 2018, 2019 Université Paul Sabatier +// (contact-edstar@laplace.univ-tlse.fr) // // 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 @@ -20,16 +22,16 @@ htrdr-materials(5) NAME ---- -htrdr-materials - list of materials used by the ground geometry in htrdr(1) +htrdr-materials - list of materials used by the geometries in htrdr(1) DESCRIPTION ----------- -A *htrdr-materials* file lists the materials that can be used by the ground -geometry provided through a *htrdr-obj*(5) file to the *htrdr*(1) program. -Each line of the file gives the name of the material. For opaque materials the -material name is followed by the path toward the *mrumtl*(5) file storing the -spectral properties of its associated Bidirectional Reflectance Distribution -Function. Furthermore, the temperature of the material must be defined too. +A *htrdr-materials* file lists the materials that can be used by geometries +provided through a *htrdr-obj*(5) file to the *htrdr*(1) program. Each line +of the file gives the name of the material. For opaque materials the material +name is followed by the path toward the *mrumtl*(5) file storing the spectral +properties of its associated Bidirectional Reflectance Distribution Function. +Furthermore, the temperature of the material must be defined too. The material name can be composed of any characters excepted for spaces and tabulations. The path toward the *mrumtl*(5) file must be a valid path diff --git a/doc/htrdr-obj.5.txt b/doc/htrdr-obj.5.txt @@ -1,5 +1,7 @@ -// Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) -// Copyright (C) 2018-2019 CNRS, Université Paul Sabatier +// Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) +// Copyright (C) 2018, 2019, 2021 CNRS +// Copyright (C) 2018, 2019 Université Paul Sabatier +// (contact-edstar@laplace.univ-tlse.fr) // // 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 @@ -27,12 +29,14 @@ DESCRIPTION A *htrdr-obj* file is a regular OBJ [1] composed only of triangular meshes. Each triangle must be included in a material group as defined by the 'usemtl' directive. The name of the material group must be of the form -"<__front-mtl-name__>:<__back-mtl-name__>", where <__front-mtl-name__> and -<__back-mtl-name__> are strings separated by a colon (:) defining the name of -the front and back facing materials, respectively. These names can be composed -of any characters expected for spaces and tabulations. Note that regarding the -*htrdr*(1) convention, a triangle side is said "front facing" when its -vertices are clock-wise ordered. +"<__front-mtl-name__>:[<__interface-mtl-name__>:]<__back-mtl-name__>", where +<__front-mtl-name__>, <__interface-mtl-name__> and <__back-mtl-name__> are +strings separated by a colon (:) defining the name of the front, interface, +and back facing materials, respectively. The interface material name is +optionnal: it is used for thin geometries, i.e. geometries with no thickness. +Material names can be composed of any characters expected for spaces and +tabulations. Note that regarding the *htrdr*(1) convention, a triangle side is +said "front facing" when its vertices are clock-wise ordered. Note that to be a valid *htrdr-obj*(5) file for *htrdr*(1), the front and the back facing names must reference a material listed in *htrdr-materials*(5) diff --git a/doc/htrdr.1.txt b/doc/htrdr.1.txt @@ -0,0 +1,77 @@ +// Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) +// Copyright (C) 2018, 2019, 2021 CNRS +// Copyright (C) 2018, 2019 Université Paul Sabatier +// (contact-edstar@laplace.univ-tlse.fr) +// +// 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/>. +:toc: + +htrdr(1) +======== + +NAME +---- +htrdr - the Monte-Carlo radiative transfert simulator + +SYNOPSIS +-------- +[verse] +*htrdr* [--version] [--help] <__mode__> [<__args__>] + +DESCRIPTION +----------- +*htrdr* computes images of scenes composed of semi transparent materials and +geometries with spectral varying reflectivities. The way the scenes are +described and the solved Monte-Carlo algorithms are controlled by the _mode_ +argument that defines the computation context. + +OPTIONS +------- +*--help*:: + Print short help and exit. + +*--version*:: + Display version information and exit. + +MODES +----- + +Each *htrdr* _mode_ is actually a mapping to a seperate command line named +*htrdr-<__mode__>* with its own set of arguments. Refer to their corresponding +man page for their complete description. + +The available *htrdr-<__mode__>* commands are: + +*htrdr-atmosphere*(1):: + Radiative transfer computations in a cloudy atmosphere. + +*htrdr-combustion*(1):: + Radiative transfer computations in a combustion medium. + +COPYRIGHT +--------- +Copyright &copy; 2018, 2019, 2020, 2021 |Meso|Star> <contact@meso-star.com>. +Copyright &copy; 2018, 2019, 2021 CNRS. +Copyright &copy; 2018, 2019 Université Paul Sabatier <contact-edstar@laplace.univ-tlse.fr>. + +LICENSE +------- +*htrdr* is free software released under the GPLv3+ license: GNU GPL version 3 +or later <https://gnu.org/licenses/gpl.html>. You are free to change and +redistribute it. There is NO WARRANTY, to the extent permitted by law. + +SEE ALSO +-------- +*htrdr-atmosphere*(1), +*htrdr-combustion*(1) diff --git a/doc/htrdr.1.txt.in b/doc/htrdr.1.txt.in @@ -1,398 +0,0 @@ -// Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) -// Copyright (C) 2018-2019 CNRS, Université Paul Sabatier -// -// 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/>. -:toc: - -htrdr(1) -======== - -NAME ----- -htrdr - simulate radiative transfert in cloudy atmospheres - -SYNOPSIS --------- -[verse] -*htrdr* [_option_]... -a _atmosphere_ - -DESCRIPTION ------------ -*htrdr* simulate radiative transfert in scenes composed of an atmospheric gas -mixture, clouds, and a ground. It evaluates the intensity incoming on each -pixel of the sensor array. The underlying algorithm is based on a Monte-Carlo -method: it consists in simulating a given number of optical paths originating -from the sensor, directed into the atmosphere, taking into account light -absorption and scattering phenomena. - -Radiative transfert can be evaluated in the visible or the infrared part of the -spectrum. It uses spectral data that should be provided for the pressure and -temperature atmospheric vertical profile [1] (*-a* _atmosphere_), the liquid -water content in suspension within the clouds stored in a *htcp*(5) file (*-c* -_clouds_), and the optical properties of water droplets that have been obtained -from a Mie code and formatted according to the *htmie*(5) file format (*-m* -_mie_). The user also has to set the position of the sun (*-D* -_azimuth_,_elevation_), the sensor type (*-C* _camera_ or *-p* _rectangle_) and -its definition (*-i* _image_). It is also possible to provide an *htrdr-obj*(5) -file representing the ground geometry (*-g* _ground_) whose materials are -listed in the *htrdr-material*(5) file provided through the *-M* option. Both, -the clouds and the ground, can be infinitely repeated along the X and Y axis by -setting the *-r* and the *-R* options, respectively. - -Two types of sensor are supported by *htrdr*. The camera (*-C* _camera_) is -used to render an image of the scene from the given point of view while the -rectangle sensor (*-p* _rectangle_) is used to compute a flux map. - -Spectral dimension can be integrated in many ways (*-s* option). When rendering -an image (*-C* _camera_), the computation is by default performed for the -visible part of the spectrum in [380, 780] nanometers, for the three components -of the CIE 1931 XYZ colorimetric space that are subsequently recombined in -order to obtain the final color for each pixel, and finally the whole image of -the scene as seen from the set observation position. The two other ways consist -in explicitly defining the longwave or shortwave spectral range to handle and -continuously sampling a wavelength in this range. Actually longwave and -shortwave are keywords that mean that the source of radiation is whether -external or internal to the medium, respectively. In shortwave rendering, only -the pixel radiance is evaluated and stored in the output image. For longwave -rendering this estimated radiance is then converted to its brightness -temperature and both are saved in the image. When computing a flux map (*-p* -_rectangle_), the per pixel flux is saved into the output map whether spectral -domain is longwave or shortwave. - -In *htrdr* the spatial unit 1.0 corresponds to one meter and the temperatures -are expressed in Kelvin. The estimated radiances are given in W/sr/m^2 excepted -for monochromatic computations where the computed spectral radiance is defined -in W/sr/m^2/nm. The fluxes are saved in W/m^2. The results are written to the -output file if the *-o* option is defined and the standard output otherwise. -The output image is a list of raw ASCII data formatted with respect to the -*htrdr-image*(5) file format. Since *htrdr* relies on the Monte-Carlo method, -each estimation is given with its numerical accuracy. - -During the simulation, *htrdr* dynamically loads/unloads cloud properties to -handle clouds whose data that do not feat in main memory. *htrdr* also supports -shared memory parallelism and relies on the Message Passing Interface -specification [3] to parallelise its computations in a distributed memory -environment; it can thus be run either directly or through a MPI process -launcher like *mpirun*(1). - -OPTIONS -------- -*-a* _atmosphere_:: - Path toward the file containing the gas optical properties of the atmosphere. - Data must be formatted according to the fileformat described in [1]. - -*-c* _clouds_:: - Submit a *htcp*(5) file describing the properties of the clouds. If not - defined, only the atmosphere properties submitted through the *-a* option - are taken into account. - -*-C* <__camera-parameter__:...>:: - Define the rendering point of view. Available camera parameters are: - - **fov**=**_angle_**;; - Vertical field of view of the camera in [30, 120] degrees. By default - _angle_ is set to @HTRDR_ARGS_DEFAULT_CAMERA_FOV@ degrees. - - **pos**=**_x_**,**_y_**,**_z_**;; - Position of the camera. By default it is set to - {@HTRDR_ARGS_DEFAULT_CAMERA_POS@}. - - **tgt**=**_x_**,**_y_**,**_z_**;; - Position targeted by the camera. By default it is set to - {@HTRDR_ARGS_DEFAULT_CAMERA_TGT@}. - - **up**=**_x_**,**_y_**,**_z_**;; - Up vector of the camera. By default it is set to - {@HTRDR_ARGS_DEFAULT_CAMERA_UP@}. - -*-D* <__azimuth__,__elevation__>:: - Direction toward the sun center. The direction is defined by two angles in - degrees: the __azimuth__ angle in [0, 360[ and the __elevation__ angle in [0, - 90]. Following the right-handed convention, the azimuthal rotation is - counter-clockwise, with 0 degree on the X axis. The elevation starts from 0 - degree for a direction in the XY plane, up to 90 degrees at zenith. Thus - -D0,0 -D90,0 -D180,0 and -D270,0 will produce solar vectors {+1,0,0} {0,+1,0} - {-1,0,0} and {0,-1,0} respectively, while -D__azimuth__,90 will produce - {0,0,+1} regardless of _azimuth_ value. - -*-d*:: - Write in _output_ the space partitioning data structures used to speed up - the radiative transfer computations in the clouds. The written data are - octrees saved in the VTK file format [2]. Each octree node stores the minimum - and the maximum of the extinction coefficients of the cloud cells overlapped - by the octree node. In the _output_ file, each octree is separated from the - previous one by a line with three minus characters, i.e. '---'. - -*-f*:: - Force overwrite of the _output_ file. - -*-g* _ground_:: - Path toward a *htrdr-obj*(5) representing the ground geometry. - -*-h*:: - List short help and exit. - -*-i* <__image-parameter__:...>:: - Define the sensor array. Available image parameters are: - - **def**=**_width_**x**_height_**;; - Definition of the image. By default the image definition is - @HTRDR_ARGS_DEFAULT_IMG_WIDTH@x@HTRDR_ARGS_DEFAULT_IMG_HEIGHT@. - - **spp**=**_samples-count_**;; - Number of samples per pixel estimation. In regular image rendering, a pixel - will use "3 * _samples-count_" Monte-Carlo realisations, one set of - _samples-count_ realisations for each X, Y and Z component of the CIE 1931 - XYZ color space. In shortwave/longwave rendering or flux computation, only - one set of _samples-count_ is used. By default, *spp* is set to - @HTRDR_ARGS_DEFAULT_IMG_SPP@. - -*-R*:: - Infinitely repeat the _ground_ along the X and Y axis. - -*-r*:: - Infinitely repeat the _clouds_ along the X and Y axis. - -*-M* _materials_:: - Path toward a *htrdr-materials*(5) file listing the ground materials. - -*-m* _mie_:: - Path toward a *htmie*(5) file defining the optical properties of water - droplets. - -*-n* _sky-mtl_:: - Name of the material representing the sky in the *htrdr-materials*(5) file. - By default, _sky-mtl_ is @HTRDR_ARGS_DEFAULT_SKY_MTL_NAME@. - -*-O* _cache_:: - File used to cache the sky data. If the _cache_ file does not exists, it is - created and filled with the sky data built from the _clouds_, the - _atmosphere_ and the _mie_ input files. This cached data can then be reused - in the next runs as long as the input files provided on the command are the - same as the ones used to setup the cache; leading to a significant speed-up - of the pre-processing step. If _cache_ contains data generated from input - files that are not the ones submitted on the command line, an error is - notified and the execution is stopped, avoiding the use of wrong cached data. - Note that when the cache is used, *htrdr* ignores the arguments used to - parametrise the structures partitioning the sky data, i.e. the *-T* and *-V* - options. - -*-o* _output_:: - File where *htrdr* writes its _output_ data. If not defined, write results to - standard output. - -*-p* <__rectangle-parameter__:...>:: - Switch in flux map computation. The flux is computed for the part of the - sensor that is outside any geometry. The rectangular sensor onto which the - flux is integrated is defined by the following parameters: - - **pos**=**_x_**,**_y_**,**_z_**;; - Position of the center of the rectangle. By default it is set to - {@HTRDR_ARGS_DEFAULT_RECTANGLE_POS@}. - - **tgt**=**_x_**,**_y_**,**_z_**;; - Position targeted by the rectangle, i.e. *tgt* - *pos* is the rectangle - normal. By default it is set to {@HTRDR_ARGS_DEFAULT_RECTANGLE_TGT@}. - - **up**=**_x_**,**_y_**,**_z_**;; - Up vector of the rectangle. By default it is set to - {@HTRDR_ARGS_DEFAULT_RECTANGLE_UP@}. - - **sz**=**_width_**,**_height_**;; - Size of the rectangle. By default it is set to - {@HTRDR_ARGS_DEFAULT_RECTANGLE_SZ@}. - -*-s* <__spectral-parameter__:...>:: - Define the type and the range of the spectral integration. Available spectral - parameters are: - - **cie_xyz**;; - the radiance is computed for the visible part of the spectrum in [380, 780] - nanometers with respect to the XYZ CIE 1931 tristimulus values. This is the - default comportment of *htrdr*. - - **lw**=*_wlen-min_*,*_wlen-max_*;; - perform the spectral sampling continuously in the [_wlen-min_, _wlen-max_] - wavelength range (wavelength must be provided in nanometers) according to - the Planck function for a reference temperature. If _wlen-min_ and - _wlen-max_ are equals the computation is monochromatic. *lw* means for - longwave but is here a code word that really means "computation of radiance - using the internal source of radiation": in other words, radiation is - emitted by the medium and its boundaries (ground and space). Because the - application is for the terrestrial atmosphere, internal radiation is - emitted in the thermal longwave part of the electromagnetic spectrum. - Therefore the default value of the reference temperature used in the - spectral sampling is fixed at 290 K. - - **sw**=*_wlen-min_*,*_wlen-max_*;; - perform the spectral sampling continuously in the [_wlen-min_, _wlen-max_] - wavelength range (wavelength must be provided in nanometers) according to - the Planck function for a reference temperature. If _wlen-min_ and - _wlen-max_ are equals the computation is monochromatic. In the present - case, *sw* means that the source of radiation is external to the medium: - because the application is for the terrestrial atmosphere, the value of the - reference temperature is by default fixed at 5778 K, i.e. the blackbody - temperature of the Sun. - - **Tref**=**_temperature_**;; - reference temperature of the Planck function used to continuously sample the - longwave/shortwave spectral range. In longwave, it is set to 290 K by - default while in shortwave its default value is the blackbody temperature - of the sun (i.e. 5778 K). - -*-T* _threshold_:: - Optical thickness used as threshold criteria to partition the properties of - the clouds. By default its value is @HTRDR_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@. - This option is ignored if a cache file is used (option *-O*). - -*-t* _threads-count_:: - Hint on the number of threads to use. By default use as many threads as CPU - cores. - -*-V* **_x_**,**_y_**,**_z_**:: - Define the maximum definition of the acceleration data structure that - partitions the cloud properties. By default the finest definition is the - definition of the submitted *htcp*(5) file. This option is ignored if a cache - file is used (option *-O*). - -*-v*:: - Make *htrdr* verbose. - -*--version*:: - Display version information and exit. - -EXAMPLES --------- - -Render a clear sky scene, i.e. a scene without any cloud, whose sun is at -zenith. The vertical atmospheric gaz mixture along the Z axis is described in -the *gas.txt* file. the ground geometry is a quad repeated to the infinity -whose materials are listed in the *material.mtl* file. The camera is positioned -at *400* meters height and looks toward the positive Y axis. The definition of -the rendered image is *800* by *600* pixels and the radiance of each pixel -component is estimated with *64* Monte-Carlo realisations. The resulting image -is written to *output* excepted if the file already exists; in this case an -error is notified, the program stops and the *output* file remains unchanged: - - $ htrdr -D0,90 -a gas.txt -m Mie.nc -g quad.obj -R \ - -M materials.mtl \ - -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \ - -i def=800x600:spp=64 \ - -o output - -Add clouds to the previous scene and use a more complex geometry to represent -the ground. The Mie data are provided through the *Mie.nc* file. The ground -geometry was carefully designed to be cyclic and can be thus infinitely -repeated without visual glitches. Use the *-f* option to write the rendered -image to *output* even though the file already exists. Finally, use the -*htpp*(1) command to convert the *htrdr-image*(5) saved in output in a regular -PPM image [4]: - - $ htrdr -D0,90 -a gas.txt -m Mie.nc -g mountains.obj -R \ - -M materials.mtl \ - -c clouds.htcp \ - -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \ - -i def=800x600:spp=64 \ - -f -o output - $ htpp -o image.ppm output - -Render the previous scene in infrared for the wavelengths in [*9200*, *10000*] -nanometers with a reference temperature of *300* Kelvin: - - $ htrdr -a gas.txt -m Mie.nc -g mountains.obj -R \ - -M materials.mtl \ - -c clouds.htcp \ - -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \ - -i def=800x600:spp=64 \ - -s lw=9200,10000:Tref=300 - -f -o output - -Move the sun by setting its azimuthal and elevation angles to *120* and *40* -degrees respectively. Use the *-O* option to enable the cache mechanism on -sky data. Increase the image definition to *1280* by *720* and set the -number of samples per pixel component to *1024*. Write results on standard -output and convert the resulting image in PPM before visualising it through the -*feh*(1) image viewer: - - $ htrdr -D120,40 -a gas.txt -m Mie.nc -g mountains.obj -R \ - -M materials.mtl \ - -c clouds.htcp \ - -O my_cache \ - -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \ - -i def=1280x720:spp=1024 | htpp | feh - - -Compute the downward flux for the shortwave interval [*350*, *4000*] nanometers -on a square of *100* meters side positionned at the origin at *1* meter height. -The resolution of the flux map is *500* by *500* pixels and *1000* realisations -is used to estimate the flux per pixel. It is saved in the *flux_map.txt* file -even though this file already exists: - - $ htrdr -D0,90 -a gas.txt -m Mie.nc -g plane.obj -R \ - -M materials.mtl \ - -c clouds.htcp \ - -O my_cache \ - -p pos=0,0,1:tgt=0,0,2:up=0,1,0:sz=100,100 \ - -i def=500x500:spp=1000 \ - -s sw=350,4000 \ - -f -o flux_map.txt - -Write into *output* the data structures used to partition the clouds -properties. Use the *csplit*(1) Unix command to extract from *output* the list -of the generated grids and save each of them in a specific VTK file whose name -is *cloud_grid_*<__NUM__>*.vtk with __NUM__ in [0, N-1] where N is the number -of grids written into *output*: - - $ htrdr -a gas.txt -m Mie.nc -c clouds.htcp -d -f -o output - $ csplit -f cloud_grid_ -b %02d.vtk -z --suppress-matched output /^---$/ {*} - -Use *mpirun*(1) to launch *htrdr* on several hosts defined in the *my_hosts* -file. Make the clouds infinite along the X and Y axis: - - $ mpirun --hostfile my_hosts htrdr \ - -D120,40 -a gas.txt -m Mie.nc -g mountains.obj -R \ - -M materials.mtl \ - -c clouds.htcp -r \ - -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \ - -i def=1280x720:spp=1024 \ - -f -o output - -NOTES ------ -1. High-Tune: Gas Optical Properties file format - - <https://www.meso-star.com/projects/high-tune/downloads/gas_opt_prop_en.pdf> -2. VTK file format - - <http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf> -3. MPI specifications - <https://www.mpi-forum.org/docs/> -4. Portable PixMap - <http://netpbm.sourceforge.net/doc/ppm.html> - -COPYRIGHT ---------- -Copyright &copy; 2018, 2019, 2020 |Meso|Star> <contact@meso-star.com>. -Copyright &copy; 2018, 2019 CNRS, Université Paul Sabatier -<contact-edstar@laplace.univ-tlse.fr>. *htrdr* is free software released under -the GPLv3+ license: GNU GPL version 3 or later -<https://gnu.org/licenses/gpl.html>. You are free to change and redistribute -it. There is NO WARRANTY, to the extent permitted by law. - -SEE ALSO --------- -*csplit*(1), -*feh*(1), -*mpirun*(1), -*htcp*(5), -*htmie*(5), -*htpp*(1), -*htrdr-image*(5), -*htrdr-materials*(5) -*htrdr-obj*(5)