Xraytrace documentation

raytracing software for x-ray standing wave calculations

User Tools

Site Tools


running

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
running [2018/01/24 18:11]
89.103.122.186
running [2018/01/28 13:32]
pklapetek
Line 1: Line 1:
 ===== Running the computation ===== ===== Running the computation =====
  
-<​code>​ +When we have everything ready, like sample geometry, materials and source, we can run the calculationThere are may controls that can be used hereFirst of all, as we are raytracing, we should set the **number ​of rays** that will be casted, e.g
-VERBOSE +
-integer +
-</​code>​ +
- +
-- sets verbosity levelBelow 3 this means not many messages and should ​be used for normal workAbove 3 this means a lot of details ​of every individual ray. Value of 10 means also debugging data for each ray and no intensity decay in output field dataDefault value is 0.+
  
 <​code>​ <​code>​
 RAYS RAYS
-integer+1000
 </​code>​ </​code>​
  
-- sets total number of rays to be casted. Value around 10000 should ​be fine for beams of radius around 10Set to unity if you want to understand better what is happenning, ideally ​with increasing verbosity level and decreasing ​the beam radius. Default value is 1.+This is not necessary the total number of rays that will appear in the computation - most likely some additional rays will be created at interfaces and the final number of rays can be therefore even orders ​of magnitude higherThe recommended approach ​to set the value is to start with small number (e.g. 100) and increase it while the output will not be smooth and stable enough (as seen from spectra or from cros-section images).
  
 +To set the **main computation parameters**,​ we use this directive:
 <​code>​ <​code>​
 COMP COMP
-double double double double+90.4 90 100 0.359e-9
 </​code>​ </​code>​
 +here it sets the angle of incident beam to 0.4 degrees (measured from the sample surface), ray goes parallel to y axis of the computational space, beam size (for source mode = 0 only) is 100 voxels, and wavelength is 0.359 nm. Note that we use wavelengths instead of energies (that are more common in X-ray field).
  
-- sets ray direction in thetaphi coordinates,​ in degrees, with similar orientation as used in GSvitRay should ​be incident to the center of computational domain. If there is a material at the boundary, it does not refract there, and goes directly inside. As third parameter, this command also sets the radius of the beam - rays are randomly shifted in this radius to produce an idealaly collimated beam. Finally, wavelength is supplied, in meters. Default ​value is 90 degrees theta, 0 degrees phi, 1 voxel radius, which corresponds to ray propagating in x direction (towards positive values). See image below for angles meaning (polarisation angle psi is not used so far): +Sometimes we don't want to calculate only single valuebut an **angular scan**The following directive can be used for this, setting ​the scan startend and step value:
 <​code>​ <​code>​
 SCAN_THETA SCAN_THETA
 90.01 91.5 0.01 90.01 91.5 0.01
 </​code>​ </​code>​
 +Note that it is faster to use this regime to scan than to do it manually (e.g. calling xraytrace with different settings in some script), as the global precomputed values are shared in between of calculations.
 +Setting zero angle for start is not recommended,​ as it might take forever with some source conditions.
  
-Do multiple calculation to scan across some theta rangewith given step. +If we perform the scan for XSW calculationswe might be interested in normalizing the output to be unity at higher angles (which is sometimes done in literature either for computing or experimental tasks)This can be done using command like this
  
 <​code>​ <​code>​
 NORMALIZE NORMALIZE
-double int+92 3
 </​code>​ </​code>​
  
-- normalizes result by value obtained at given angle for given material. +where a  ​given angle and given material ​index is used as a base for signals normalization.
- +
- +
- +
- +
  
  
Line 52: Line 44:
 - multiplies the raytracing step by a double. Default is 1, which means approximately a voxel size. - multiplies the raytracing step by a double. Default is 1, which means approximately a voxel size.
  
 +An important setting is **centering** the voxel evaluations. The rays are propagated using some small steps in the ray direction. If we would evaluate the rays at randomly chosen points (or better say in equidistant intervals not synchronized in any sense with the voxel mesh), we would get quite chaotic behavior, especially for case when the wavelength is similar or smaller than voxel spacing. By performing evaluations at the voxel center we can get reasonable outputs in this case, as shown on the figures below. 
 +To switch on the centering, we use command
 <​code>​ <​code>​
 CENTER CENTER
-0/1+1
 </​code>​ </​code>​
  
-- sets if the ray evaluation should be centered to cell in coherent calculations.+{{ :centering.png?400 |}}
  
 +{{ :​centerednotcentered.png?​400 |}}
  
 +To control the algorithm **performance** for each individual ray we can set also some more parameters. The maximum number of steps in every ray calculation can be set using command like this
  
 +<​code>​
 +MAXSTEP
 +10000
 +</​code>​
 +
 +As the ray progresses by approximately one voxel in each step, this value should not be smaller than size of the computational domain. To control this can be useful in situations where the ray might be trapped in some interference structure.
 +
 +Similarily, we can control the maximum depth of secondary rays for multiple reflections,​ which is maximum number of rays produced from one ray (by reflections).
  
 <​code>​ <​code>​
 MAXDEPTH MAXDEPTH
-integer+50
 </​code>​ </​code>​
  
-- sets maximum ​depth of secondary rays for multiple reflections - i.e. maximum number of rays produced from one incident rayDefault value is 10. +The reasonable numbers are around 100, unless we use source method 2 in which ray is recycled many times by the periodic boundary condition and the depth should be therefore significantly higher, ​e.g10000.
  
 +Finally, we can shut down all rayw that are of so small intensity that they would not affect the result much. This happens very often with the x-ray reflections. To quit with every ray below 10 percent of the original ray intensity we can set the following parameter:
  
 <​code>​ <​code>​
-CUTMAT +TERMINATE_LIMIT 
-integer+0.1
 </​code>​ </​code>​
  
-- sets the material ​to which rays should not enter from sourceDefault ​is -1 which means not doing it.+There might a lot of vacuum in between of objects that we want to interact with. The default Xraytrace operation is based on following ​the ray path voxel by voxel. This is necessary as we want to have general voxel based objects in out computational domainIf we would be treating only analytical objects, we could use 3D analytical geometry tools to search for the boundaries and propagate ray through the vacuum in a single step. The level of generality that we want to keep is therefore a limiting factor in terms of computational demands for single ray propagationTo speedup the calculations we can assign regions in space where ray can be passing faster (as we know in advance that there are no objects). This is done via the speedup command, e.g. to set it to maximum of five voxels like here:
  
 <​code>​ <​code>​
-TERMINATE_LIMIT +SPEEDUP 
-double+5
 </​code>​ </​code>​
  
-- sets ray termination intensity limit, e.g. 1e-15 which is default value. Incident intensity of a ray is 1 and if the intensity fails below this criterium it is not propagated further.+{{ :speedups.png?400 |}} 
 + 
 + 
 +There are two more **debugging** comands to be listed in this section:
  
 <​code>​ <​code>​
Line 92: Line 98:
  
 - sets regime of calculation. 0 means illumination only - ray illuminates first material that is not zero and dies. 1 means rays illuminating volume, passing through without any optical effects. 2 means geometrical optics, 3 means only reflections like from perfect metal at any material interface Default value is 2. - sets regime of calculation. 0 means illumination only - ray illuminates first material that is not zero and dies. 1 means rays illuminating volume, passing through without any optical effects. 2 means geometrical optics, 3 means only reflections like from perfect metal at any material interface Default value is 2.
 +
  
 <​code>​ <​code>​
-MAXSTEP+VERBOSE
 integer integer
 </​code>​ </​code>​
  
-set maximum number of steps for every individual ray computationNormally, the ray progresses by one voxel in each step, so this value should not be smaller than size of the computational domain. If it is not enough, software issues a warning. Default value is 100000.+sets verbosity level. Below 3 this means not many messages and should be used for normal work. Above 3 this means a lot of details of every individual ray. Value of 10 means also debugging data for each ray and no intensity decay in output field data. Default value is 0.
  
-<​code>​ 
-PERIODIC_XY 
-xstart ystart xend yend optimize 
-</​code>​ 
  
-Creates periodic BC. If optimization is requested, end boundary is shifted towards making it periodic with respect of incident signal wavelength and angles. 
  
- 
- 
- 
-{{ :​centering.png?​400 |}} 
- 
-{{ :​centerednotcentered.png?​400 |}} 
  
  
running.txt · Last modified: 2018/01/28 13:32 by pklapetek