DART-Ray
Data Types | Functions/Subroutines | Variables
visual_routines Module Reference

Contains the subroutines to calculate the surface brightness maps for either far-away observers or observers located within the radiation transfer model. More...

Data Types

type  texture
 

Functions/Subroutines

subroutine make_maps
 Calls routines to calculate surface brightness maps for the external observer. In MPI mode, every node calculates the maps corresponding to the wavelengths stored in the local i_obs_arr(). Then reduction of the map_arr_out() array is performed. If no communication mode is used, for simplicity only the master node calculates the maps. More...
 
subroutine convert_maps_to_mjy_sr
 Covert the map units to MJy/sr. More...
 
subroutine create_map_arrays
 Creates map_arr(), map_arr_hd() and map_out_arr(). It also sets size_map() and pixel_size(), pixel_size_hd(). More...
 
subroutine create_texture_array
 Creates texture_arr(). More...
 
subroutine calc_texture_array (theta, phi, obs_vec, xi_dir, yi_dir)
 Calculates texture_arr(), the normalized surface brightness profiles for the projections of the cells on the external observer maps. It also sets the direction of the axis on the observer maps. These directions are such that, when seeing the galaxy edge-on at a position along the 3D X axis, the Y' axis on the maps corresponds to the 3D Z axis while the X' axis on the map corresponds to the 3D Y axis. /todo maybe instead of 0.99 factor just subtract half pixel size. More...
 
subroutine find_ray_cell_intersections (rc, cellsize, ro, obs_vec, length)
 Finds the points of intersections between a line of sight and a cell. Used in the routines to calculate the cell normalized surface brightness profiles (both in the case of the external and internal observer). More...
 
subroutine calc_ray_inters (j, rc, cellsize, ro, obs_vec, flag_ray, p1, p2)
 
subroutine map_projection (idir, obs_vec, xi_dir, yi_dir)
 Projects the 3D grid cells onto the observer map. The calculated maps are only those corresponding to the wavelengths stored in the local i_obs_arr() array. More...
 
real(kind=real64) function average_section (map_section, ns)
 Returns the average of the values in a map section. Used for average smoothing. Note that zero elements are not considered in the average smoothing. More...
 
real(kind=real64) function median_section (map_section, ns, zero_value)
 calculates median of the input 2D array More...
 
subroutine find_projected_point (r, obs_vec, xi_dir, yi_dir, xpp, ypp, ix_p, iy_p)
 
real(kind=real64) function scal_prod (vector1, vector2)
 Calculates dot product between two 1-dimensional vectors. More...
 
subroutine normalize (vector)
 Normalises input vector. More...
 
subroutine cross_prod (vector1, vector2, out_arr)
 Calculates cross-product between two input arrays. Note that the all arrays need to have the same size. More...
 
subroutine map_in_projection (idir)
 Calculates surface brightness maps for internal observer by projecting emission of from each cell onto HealPix sphere centred at the observer position. More...
 
subroutine calc_cube_texture_sphere (cellsize, rc, ro, omega_cell, nside_map, n_px)
 Calculates normalized surface brightness profile of a projected cell over the observer sphere. This is done by calculating the intersection lengths of the line-of-sights corresponding to the HEALPix spherical pixels (and the observer position). The code determines the spherical region over which to calculate these intersections (calculating them over the entire sphere is inefficient and not necessary because cells cover only a limited region of the sky). This is done by calculating the intersections for neighbour pixels until all the neighbour pixels have zero intersection length. More...
 
subroutine find_starting_kall (kall)
 Finds the index of the first element of ind_out_maps() whose maps are being calculated. In the stellar RT this index is zero. In the dust RT it can be different. More...
 

Variables

real(kind=real64), dimension(:,:,:), allocatable map_arr
 
real(kind=real64), dimension(:,:), allocatable map_in_arr
 
integer npixel_maps_hd
 
real(kind=real64) pixel_size
 
real(kind=real64) pixel_size_hd
 
real(kind=real64) area_pixel
 
real(kind=real64) area_pixel_hd
 
type(texture), dimension(:), allocatable texture_arr
 
integer, dimension(:), allocatable im0
 
integer, dimension(:), allocatable im1
 
integer, dimension(:), allocatable nt_arr
 
integer, parameter hd_xfactor = 4
 
integer, dimension(:), allocatable iq_px
 
integer, dimension(:), allocatable pix_list
 
integer, dimension(:), allocatable neighbour_list
 
real(kind=real64), dimension(:), allocatable mproj
 

Detailed Description

Contains the subroutines to calculate the surface brightness maps for either far-away observers or observers located within the radiation transfer model.

Function/Subroutine Documentation

real(kind=real64) function visual_routines::average_section ( real(kind=real64), dimension(0:, 0:)  map_section,
integer  ns 
)

Returns the average of the values in a map section. Used for average smoothing. Note that zero elements are not considered in the average smoothing.

subroutine visual_routines::calc_cube_texture_sphere ( real(kind=real64)  cellsize,
real(kind=real64), dimension(0:2)  rc,
real(kind=real64), dimension(0:2)  ro,
real(kind=real64)  omega_cell,
integer  nside_map,
integer  n_px 
)

Calculates normalized surface brightness profile of a projected cell over the observer sphere. This is done by calculating the intersection lengths of the line-of-sights corresponding to the HEALPix spherical pixels (and the observer position). The code determines the spherical region over which to calculate these intersections (calculating them over the entire sphere is inefficient and not necessary because cells cover only a limited region of the sky). This is done by calculating the intersections for neighbour pixels until all the neighbour pixels have zero intersection length.

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine visual_routines::calc_ray_inters ( integer  j,
real(kind=real64), dimension(0:2)  rc,
real(kind=real64)  cellsize,
real(kind=real64), dimension(0:2)  ro,
real(kind=real64), dimension(0:2)  obs_vec,
integer  flag_ray,
real(kind=real64), dimension(0:2)  p1,
real(kind=real64), dimension(0:2)  p2 
)

Here is the caller graph for this function:

subroutine visual_routines::calc_texture_array ( real(kind=real64)  theta,
real(kind=real64)  phi,
real(kind=real64), dimension(0:2)  obs_vec,
real(kind=real64), dimension(0:2)  xi_dir,
real(kind=real64), dimension(0:2)  yi_dir 
)

Calculates texture_arr(), the normalized surface brightness profiles for the projections of the cells on the external observer maps. It also sets the direction of the axis on the observer maps. These directions are such that, when seeing the galaxy edge-on at a position along the 3D X axis, the Y' axis on the maps corresponds to the 3D Z axis while the X' axis on the map corresponds to the 3D Y axis. /todo maybe instead of 0.99 factor just subtract half pixel size.

Parameters
thetatheta0 phi0 lines of sight direction (it should not matter if in the reference frame of the observer or of the cell to be projected because the corresponding line is the same)
phitheta0 phi0 lines of sight direction (it should not matter if in the reference frame of the observer or of the cell to be projected because the corresponding line is the same)
obs_vecobs_vec versor parallel to observer line of sight
yi_diryi_dir first reference axis on projection plane. When Z is not parallel to the line of sight, yi_dir is the projection of Z on the observer plane. Otherwise, yi_dir is chosen such to be the limit in the case of very small differences between Z and obs_vec.
xi_dirxi_dir second reference axis on projection plane. Always chosen as the cross product between obs_vec and yi_dir
Parameters
lengthLength of the line-of-sight - cell intersection.

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine visual_routines::convert_maps_to_mjy_sr ( )

Covert the map units to MJy/sr.

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine visual_routines::create_map_arrays ( )

Creates map_arr(), map_arr_hd() and map_out_arr(). It also sets size_map() and pixel_size(), pixel_size_hd().

Here is the caller graph for this function:

subroutine visual_routines::create_texture_array ( )

Creates texture_arr().

Parameters
lsidecell size

Here is the caller graph for this function:

subroutine visual_routines::cross_prod ( real(kind=real64), dimension(0:)  vector1,
real(kind=real64), dimension(0:)  vector2,
real(kind=real64), dimension(0:)  out_arr 
)

Calculates cross-product between two input arrays. Note that the all arrays need to have the same size.

Here is the caller graph for this function:

subroutine visual_routines::find_projected_point ( real(kind=real64), dimension(0:2)  r,
real(kind=real64), dimension(0:2)  obs_vec,
real(kind=real64), dimension(0:2)  xi_dir,
real(kind=real64), dimension(0:2)  yi_dir,
real(kind=real64), dimension(0:)  xpp,
real(kind=real64), dimension(0:)  ypp,
integer  ix_p,
integer  iy_p 
)

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine visual_routines::find_ray_cell_intersections ( real(kind=real64), dimension(0:2)  rc,
real(kind=real64)  cellsize,
real(kind=real64), dimension(0:2)  ro,
real(kind=real64), dimension(0:2)  obs_vec,
real(kind=real64)  length 
)

Finds the points of intersections between a line of sight and a cell. Used in the routines to calculate the cell normalized surface brightness profiles (both in the case of the external and internal observer).

Parameters
p1p2 Coordinates of line-of-sight intersection points with a cell
flag_rayNumber of line-of-sight intersection points with a cell found

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine visual_routines::find_starting_kall ( integer  kall)

Finds the index of the first element of ind_out_maps() whose maps are being calculated. In the stellar RT this index is zero. In the dust RT it can be different.

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine visual_routines::make_maps ( )

Calls routines to calculate surface brightness maps for the external observer. In MPI mode, every node calculates the maps corresponding to the wavelengths stored in the local i_obs_arr(). Then reduction of the map_arr_out() array is performed. If no communication mode is used, for simplicity only the master node calculates the maps.

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine visual_routines::map_in_projection ( integer  idir)

Calculates surface brightness maps for internal observer by projecting emission of from each cell onto HealPix sphere centred at the observer position.

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine visual_routines::map_projection ( integer  idir,
real(kind=real64), dimension(0:2)  obs_vec,
real(kind=real64), dimension(0:2)  xi_dir,
real(kind=real64), dimension(0:2)  yi_dir 
)

Projects the 3D grid cells onto the observer map. The calculated maps are only those corresponding to the wavelengths stored in the local i_obs_arr() array.

Parameters
map_arr_hd(x,y,lambda)External observer surface brightness maps at the stellar emission or dust emission wavelengths, for a single line-of-sight, which are stored in the local i_obs_arr() array. The difference between this array and map_arr() is that it contains maps with much higher resolution (that is, many more pixels). These maps are the ones used in the cell projections. Then they are rebinned to smaller size when passed to map_arr

Here is the call graph for this function:

Here is the caller graph for this function:

real(kind=real64) function visual_routines::median_section ( real(kind=real64), dimension(0:, 0:)  map_section,
integer  ns,
logical  zero_value 
)

calculates median of the input 2D array

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine visual_routines::normalize ( real(kind=real64), dimension(0:)  vector)

Normalises input vector.

Here is the caller graph for this function:

real(kind=real64) function visual_routines::scal_prod ( real(kind=real64), dimension(0:)  vector1,
real(kind=real64), dimension(0:)  vector2 
)

Calculates dot product between two 1-dimensional vectors.

Here is the caller graph for this function:

Variable Documentation

real(kind=real64) visual_routines::area_pixel
Parameters
area_pixelPixel area for the observer map
real(kind=real64) visual_routines::area_pixel_hd
Parameters
area_pixel_hdPixel area for the high resolution observer map
integer, parameter visual_routines::hd_xfactor = 4
Parameters
hd_xfactorRatio between npixel_maps_hd() and npixel_map().
integer, dimension(:), allocatable visual_routines::im0
Parameters
im0"Start" indeces for the normalized brightness profile array. This is used so only the subsection of the prof2d() array is used when adding contributions to the surface brigthness map. Each index correspond to the different cell subdivision levels.
integer, dimension(:), allocatable visual_routines::im1
Parameters
im1"End" indeces for the normalized brightness profile array. This is used so only the subsection of the prof2d() array is used when adding contributions to the surface brigthness map. Each index correspond to the different cell subdivision levels.
integer, dimension(:), allocatable visual_routines::iq_px
Parameters
iq_pxList of subscripts corresponding to the HEALPix pixel number in the NESTED scheme. Used in the map calculations for the internal observer.
real(kind=real64), dimension(:,:,:), allocatable visual_routines::map_arr
Parameters
map_arr(x,y,lambda)External observer surface brightness maps at the stellar emission or dust emission wavelengths, for a single line-of-sight, which are stored in the local i_obs_arr() array.
real(kind=real64), dimension(:,:), allocatable visual_routines::map_in_arr
Parameters
map_in_arr(line-of-sightID,lambda) Internal observer surface brightness maps at the stellar emission or dust emission wavelengths, for a single line-of-sight, which are stored in the local i_obs_in_arr() array.
real(kind=real64), dimension(:), allocatable visual_routines::mproj
Parameters
mprojHEALPix map containing the normalized projection of the grid cells onto the observer sky.
integer, dimension(:), allocatable visual_routines::neighbour_list
Parameters
neighbour_listList of HEALPix pixel neighbours to pixels for which the intersection length with a certain grid cell has already been calculated. Neighbour pixels are always considered until all their intersection lengths are zero (see calc_cube_texture_sphere() ).
integer visual_routines::npixel_maps_hd
Parameters
npixel_maps_hdNumber of pixels per side for the surface brightness maps stored in map_arr_hd() within map_projection().
integer, dimension(:), allocatable visual_routines::nt_arr
Parameters
nt_arrNumber of pixels in each cell texture profile within texture_arr.
integer, dimension(:), allocatable visual_routines::pix_list
Parameters
pix_listList of HEALPix pixels that are used when calculating the ray intersection lengths with the grid cells. This calculation is needed when calculating the projection of the cells on the observer maps.
real(kind=real64) visual_routines::pixel_size
Parameters
pixel_sizeExternal observer map pixel size in the same units as csize() (only pc allowed for the moment).
real(kind=real64) visual_routines::pixel_size_hd
Parameters
pixel_size_hdHigh resolution external observer map pixel size in the same units as csize() (only pc allowed for the moment).
type(texture), dimension(:), allocatable visual_routines::texture_arr
Parameters
texture_arrContains the normalized texture profiles for each cube subsidivion level. Needed to project a cube surface brightness profile on an arbitrary inclined map. Note that the first index of this array is 1 not zero.