cherab / core

The core source repository for the Cherab project.
https://www.cherab.info
Other
44 stars 24 forks source link

Add focal_length property to the Beam #419

Open vsnever opened 1 year ago

vsnever commented 1 year ago

Currently Beam has it's minimum width at Z = 0. However, I came across a problem where a focused beam was injected into the plasma, having a minimum width in the region of the central plasma. Since it seems natural that Z=0 in the beam coordinates corresponds to the entry point of the beam into the plasma, I suggest adding the focal_length property, which defaults to 0.

This will change how the beam width is calculated. Instead of this:

sigma0_sqr = self._beam.get_sigma()**2
sigma_x = sqrt(sigma0_sqr + (z * self._tanxdiv)**2)
sigma_y = sqrt(sigma0_sqr + (z * self._tanydiv)**2)

we'll have this:

sigmaf_sqr = self._beam.get_sigma()**2  # sigma at beam focus
z_to_focal = z - self._beam.get_focal_length()
sigma_x = sqrt(sigmaf_sqr + (z_to_focal * self._tanxdiv)**2)
sigma_y = sqrt(sigmaf_sqr + (z_to_focal * self._tanydiv)**2)

This change also affects the _generate_geometry() method.

I already have this implemented in the fork, so I can make a PR with this feature and the the changes discussed in #414.

@Mateasek, @jacklovell, what do you think of this feature?

Mateasek commented 1 year ago

Having beam foci inside plasma is something this model doesn't support and is it's limitation.

I would personally wait with such changes for the new beam model which won't have backwards compatibility.

In the new architecture of the beam I implement the beam description through the DistributionFunction. One of the implementation will allow users to implement simply their profiles through Raysect's function framework, as it is done in the laser's case.

The basic beam profile model will be based on the Gaussian beam, which is in fact generalisation of the model we have now and allows users to place beam waists in arbitrary positions.

vsnever commented 1 year ago

I would personally wait with such changes for the new beam model which won't have backwards compatibility.

I agree. Also, currently the beam's dispersion is calculated as a sum:

sigma_x = self._beam.get_sigma() + z * self._tanxdiv
sigma_y = self._beam.get_sigma() + z * self._tanydiv

instead of:

sigma0_sqr = self._beam.get_sigma()**2
sigma_x = sqrt(sigma0_sqr + (z * self._tanxdiv)**2)
sigma_y = sqrt(sigma0_sqr + (z * self._tanydiv)**2)

I think this is just an error, but if we allow an arbitrary beam waist position, then we have to fix that too, which means it will be a different beam model.