Skip to content

Commit

Permalink
Add PICMI interface for injecting from embedded boundary (ECP-WarpX#5395
Browse files Browse the repository at this point in the history
)

This adds the option to inject particles from the embedded boundary with
PICMI.
  • Loading branch information
RemiLehe authored Oct 29, 2024
1 parent bf90514 commit f8b3270
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions Python/pywarpx/picmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,11 @@ def setup_parse_momentum_functions(
class UniformFluxDistribution(
picmistandard.PICMI_UniformFluxDistribution, DensityDistributionBase
):
def init(self, kw):
self.inject_from_embedded_boundary = kw.pop(
"warpx_inject_from_embedded_boundary", False
)

def distribution_initialize_inputs(
self, species_number, layout, species, density_scale, source_name
):
Expand All @@ -702,13 +707,22 @@ def distribution_initialize_inputs(
species.add_new_group_attr(source_name, "flux", self.flux)
if density_scale is not None:
species.add_new_group_attr(source_name, "flux", density_scale)
species.add_new_group_attr(
source_name, "flux_normal_axis", self.flux_normal_axis
)
species.add_new_group_attr(
source_name, "surface_flux_pos", self.surface_flux_position
)
species.add_new_group_attr(source_name, "flux_direction", self.flux_direction)

if not self.inject_from_embedded_boundary:
species.add_new_group_attr(
source_name, "flux_normal_axis", self.flux_normal_axis
)
species.add_new_group_attr(
source_name, "surface_flux_pos", self.surface_flux_position
)
species.add_new_group_attr(
source_name, "flux_direction", self.flux_direction
)
else:
species.add_new_group_attr(
source_name, "inject_from_embedded_boundary", True
)

species.add_new_group_attr(source_name, "flux_tmin", self.flux_tmin)
species.add_new_group_attr(source_name, "flux_tmax", self.flux_tmax)

Expand Down

0 comments on commit f8b3270

Please sign in to comment.