How to init the added new comp of particles? #5098
-
To implement the initialization of properties for particles when they are injected, i can utilize the "AddRealComp" method to add properties. However, it's essential to initialize these properties at the point of particle injection or creation. If i'm using a particle injection mechanism (such as continuous injection with do_continuous_injection on), how should i initialize each particle's properties when it is created or injected. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @zhazhajust. I'm assuming you are using Python since you asked about getting the pointer to the added real component. The test at https://github.com/ECP-WarpX/WarpX/blob/development/Examples/Physics_applications/laser_ion/PICMI_inputs_2d.py shows how to set new real attributes with a given initialization function (which will be evaluated at the time of creation for each particle). Look for You can then access the data in the new components using the I hope that answers your questions! |
Beta Was this translation helpful? Give feedback.
Hi @zhazhajust. I'm assuming you are using Python since you asked about getting the pointer to the added real component.
The test at https://github.com/ECP-WarpX/WarpX/blob/development/Examples/Physics_applications/laser_ion/PICMI_inputs_2d.py shows how to set new real attributes with a given initialization function (which will be evaluated at the time of creation for each particle). Look for
warpx_add_real_attributes
in the linked example.You can then access the data in the new components using the
ParticleContainerWrapper
. See the example at https://github.com/ECP-WarpX/WarpX/blob/development/Examples/Tests/particle_data_python/PICMI_inputs_2d.py for how to access the data in a new att…