Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make from_file and other laser init compatible #1157

Merged
merged 22 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 37 additions & 47 deletions docs/source/run/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -871,70 +871,60 @@ Parameters starting with ``lasers.`` apply to all laser pulses, parameters start
Whether to use the most stable discretization for the envelope solver.

* ``<laser name>.init_type`` (list of `string`) optional (default `gaussian`)
The initializing method of laser. Possible options are:
The initialisation method of laser. Possible options are:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency. We use US English.

Suggested change
The initialisation method of laser. Possible options are:
The initialization method of laser. Possible options are:


* ``gaussian``(default) the laser is iniliatized with an ideal gaussian pulse.
Option: ``gaussian`` (default) the laser is initialised with an ideal gaussian pulse.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Option: ``gaussian`` (default) the laser is initialised with an ideal gaussian pulse.
Option: ``gaussian`` (default) the laser is initialized with an ideal gaussian pulse.


* ``from_file``, the laser is loaded from an openPMD file.
* ``<laser name>.a0`` (`float`) optional (default `0`)
Peak normalized vector potential of the laser pulse.

* ``parser``, the laser is initialized with the expression of the complex envelope function.
* ``lasers.lambda0`` (`float`)
Wavelength of the laser pulses. Currently, all pulses must have the same wavelength.

Option: ``gaussian``
* ``<laser name>.position_mean`` (3 `float`) optional (default `0 0 0`)
The mean position of the laser in `x, y, z`.

* ``<laser name>.a0`` (`float`) optional (default `0`)
Peak normalized vector potential of the laser pulse.
* ``<laser name>.w0`` (2 `float`) optional (default `0 0`)
The laser waist in `x, y`.

* ``lasers.lambda0`` (`float`)
Wavelength of the laser pulses. Currently, all pulses must have the same wavelength.
* ``<laser name>.L0`` (`float`) optional (default `0`)
The laser pulse length in `z`. Use either the pulse length or the pulse duration ``<laser name>.tau``.

* ``<laser name>.position_mean`` (3 `float`) optional (default `0 0 0`)
The mean position of the laser in `x, y, z`.
* ``<laser name>.tau`` (`float`) optional (default `0`)
The laser pulse duration. The pulse length is set to `laser.tau`:math:`*c_0`.
Use either the pulse length or the pulse duration.

* ``<laser name>.w0`` (2 `float`) optional (default `0 0`)
The laser waist in `x, y`.
* ``<laser name>.focal_distance`` (`float`)
Distance at which the laser pulse is focused (in the z direction, counted from laser initial position).

* ``<laser name>.L0`` (`float`) optional (default `0`)
The laser pulse length in `z`. Use either the pulse length or the pulse duration ``<laser name>.tau``.
* ``<laser name>.propagation_angle_yz`` (`float`) optional (default `0`)
Propagation angle of the pulse in the yz plane (0 is along the z axis)

* ``<laser name>.tau`` (`float`) optional (default `0`)
The laser pulse duration. The pulse length is set to `laser.tau`:math:`*c_0`.
Use either the pulse length or the pulse duration.
Option: ``from_file`` the laser is loaded from an openPMD file.

* ``<laser name>.focal_distance`` (`float`)
Distance at which the laser pulse if focused (in the z direction, counted from laser initial position).
* ``<laser name>.input_file`` (`string`) optional (default `""`)
Path to an openPMD file containing a laser envelope.
The file should comply with the `LaserEnvelope extension of the openPMD-standard <https://github.com/openPMD/openPMD-standard/blob/upcoming-2.0.0/EXT_LaserEnvelope.md>`__, as generated by `LASY <https://github.com/LASY-org/LASY>`__.
Currently supported geometries: 3D or cylindrical profiles with azimuthal decomposition.
The laser pulse is injected in the HiPACE++ simulation so that the beginning of the temporal profile from the file corresponds to the head of the simulation box, and time (in the file) is converted to space (HiPACE++ longitudinal coordinate) with ``z = -c*t + const``.
If this parameter is set, then the file is used to initialize all lasers instead of using a gaussian profile.

* ``<laser name>.propagation_angle_yz`` (`float`) optinal (default `0`)
Propagation angle of the pulse in the yz plane (0 is the along the z axis)
* ``<laser name>.openPMD_laser_name`` (`string`) optional (default `laserEnvelope`)
Name of the laser envelope field inside the openPMD file to be read in.

* ``<laser name>.PFT_yz`` (`float`) optinal (default `pi/2`)
Pulse front tilt angle on yz plane - the angle between the pulse front (maximum intensity contour)and the propagation
direction defined by [Selcuk Akturk Opt. Express 12 (2004)](pi/2 is no PFT)
* ``<laser name>.iteration`` (`int`) optional (default `0`)
Iteration of the openPMD file to be read in.

Option: ``from_file``

* ``lasers.input_file`` (`string`) optional (default `""`)
Path to an openPMD file containing a laser envelope.
The file should comply with the `LaserEnvelope extension of the openPMD-standard <https://github.com/openPMD/openPMD-standard/blob/upcoming-2.0.0/EXT_LaserEnvelope.md>`__, as generated by `LASY <https://github.com/LASY-org/LASY>`__.
Currently supported geometries: 3D or cylindrical profiles with azimuthal decomposition.
The laser pulse is injected in the HiPACE++ simulation so that the beginning of the temporal profile from the file corresponds to the head of the simulation box, and time (in the file) is converted to space (HiPACE++ longitudinal coordinate) with ``z = -c*t + const``.
If this parameter is set, then the file is used to initialize all lasers instead of using a gaussian profile.

* ``lasers.openPMD_laser_name`` (`string`) optional (default `laserEnvelope`)
Name of the laser envelope field inside the openPMD file to be read in.

* ``lasers.iteration`` (`int`) optional (default `0`)
Iteration of the openPMD file to be read in.

Option: ``parser``
Option: ``parser``, the laser is initialized with the expression of the complex envelope function.

* ``<laser name>.laser_real(x,y,z)`` (`string`)
Expression for the real part of the laser evelope in `x, y, z`.
* ``<laser name>.laser_real(x,y,z)`` optional (`string`) (default `""`)
Expression for the real part of the laser envelope in `x, y, z`.

* ``<laser name>.laser_imag(x,y,z)`` (`string`)
Expression for the imaginary part of the laser evelope `x, y, z`.
* ``<laser name>.laser_imag(x,y,z)`` optional (`string`) (default `""`)
Expression for the imaginary part of the laser envelope `x, y, z`.

* ``lasers.lambda0`` (`float`)
Wavelength of the laser pulses. Currently, all pulses must have the same wavelength.
* ``lasers.lambda0`` (`float`)
Wavelength of the laser pulses. Currently, all pulses must have the same wavelength.

Diagnostic parameters
---------------------
Expand Down
24 changes: 22 additions & 2 deletions src/laser/Laser.H
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
#include <AMReX_RealVect.H>
#include "utils/Constants.H"
#include "utils/Parser.H"
#include <AMReX_MultiFab.H>

class Laser
{
public:

Laser (std::string name);
/** \brief Read in a laser from an openPMD file
*\param[in] laser_geom_3D 3D laser geometry for level 0
*/
void GetEnvelopeFromFileHelper (amrex::Geometry laser_geom_3D);
template<typename input_type>
void GetEnvelopeFromFile (amrex::Geometry laser_geom_3D);
Laser (std::string name, amrex::Geometry laser_geom_3D);

std::string m_name {""};
/** The way to initialize a laser (from_file/gaussian/parser)*/
Expand All @@ -44,6 +50,20 @@ public:
amrex::ParserExecutor<3> m_profile_real;
/** stores the output function of makeFunctionWithParser for profile_imag_str */
amrex::ParserExecutor<3> m_profile_imag;
/** if the lasers are initialized from openPMD file */
bool m_laser_from_file = false;
/** full 3D laser data stored on the host */
amrex::FArrayBox m_F_input_file;
/** path to input openPMD file */
std::string m_input_file_path;
/** name of the openPMD species in the file */
std::string m_file_envelope_name = "laserEnvelope";
/** index of the iteration in the openPMD file */
int m_file_num_iteration = 0;
/** Geometry of the laser file, 'rt' or 'xyt' */
std::string m_file_geometry = "";
/** Wavelength from file */
amrex::Real m_lambda0_from_file {0.};
};

#endif // LASER_H_
Loading
Loading