kklmn / xrt

Package xrt (XRayTracer) is a python software library for ray tracing and wave propagation in x-ray regime. It is primarily meant for modeling synchrotron sources, beamlines and beamline elements.
MIT License
83 stars 30 forks source link

power density calculation based on ray tracing results #76

Open yangfg-bsrf opened 3 years ago

yangfg-bsrf commented 3 years ago

Hi, now I want to evaluate the heating-load on the mirror. The beam data for the following image has been exported , then I am not sure how to calculate the power density profile, because the N_good is equal to the N_all. Can you give me some advices? Thanks!

B3_HKBLocal

kklmn commented 3 years ago

Hi, Please see this example for how to make power plots with power density isolines. Search the examples for fluxKind='power' in py files.

yangfg-bsrf commented 3 years ago

yea, the total power is shown in the result. B3_HKBLocal -0 00196

Further, I want to get the map of the power density distribution along the mirror. is there any example for this function? In addition, I am some confused by the intensity in XYCPlot, I try to find code for its calculation, but failed.

def _get_flux(self): self.flux = float(self.intensity) / self.nRaysAll *\ self.nRaysSeededI / self.nRaysSeeded

`def _get_power(self):
    self.power = self.intensity / self.nRaysAll`
kklmn commented 3 years ago

Further, I want to generate the map of the power density distribution along the mirror.

The 2D and 1D histograms give you this distribution as plot.total2D and ax.total1D for ax in [plot.xaxis, plot.yaxis, plot.caxis]. The normalization constant = plot.power. Do you need something more?

yangfg-bsrf commented 3 years ago

we want to evaluate the thermal deformation of the mirror, so the 2D heating-load distribution is necessary. For this case, I believe plot.total2D is enough because the energy bandwidth is small. does it consider the power difference among the rays with different energy? that is why I want to know how the intensity is calculated.

kklmn commented 3 years ago

does it consider the power difference among the rays with different energy?

No. This would need 3D histogramming, which we don't do. If you need it, you should compose it manually from 2D histograms.

that is why I want to know how the intensity is calculated.

plot.intensity is only the sum of ray intensity values (Jss^2 + Jpp^2) over the 2D histogram. The name came from Shadow. The physical intensity (the flux density) is calculated by 2D histogramming in the module xrt.multipro.py