Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 11, 2024
1 parent d594d71 commit 4e0e5fc
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions Python/pywarpx/picmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ def setup_parse_momentum_functions(
f"({expression})/{constants.c}",
)


class UniformDistribution(
picmistandard.PICMI_UniformDistribution, DensityDistributionBase
):
Expand All @@ -702,16 +703,17 @@ def distribution_initialize_inputs(
if density_scale is not None:
species.add_new_group_attr(source_name, "density", density_scale)


class FluxDistributionBase(object):
""" This is a base class for both uniform and analytic flux distributions."""
"""This is a base class for both uniform and analytic flux distributions."""

def init(self, kw):
self.inject_from_embedded_boundary = kw.pop(
"warpx_inject_from_embedded_boundary", False
)

def initialize_flux_profile_func(self, species, density_scale, source_name):
""" Initialize the flux profile and flux function."""
"""Initialize the flux profile and flux function."""
pass

def distribution_initialize_inputs(
Expand Down Expand Up @@ -751,11 +753,13 @@ def distribution_initialize_inputs(
source_name, "momentum_distribution_type", "gaussianflux"
)


class AnalyticFluxDistribution(
picmistandard.PICMI_AnalyticFluxDistribution, FluxDistributionBase, DensityDistributionBase
picmistandard.PICMI_AnalyticFluxDistribution,
FluxDistributionBase,
DensityDistributionBase,
):
def initialize_flux_profile_func(self, species, density_scale, source_name
):
def initialize_flux_profile_func(self, species, density_scale, source_name):
species.add_new_group_attr(source_name, "flux_profile", "parse_flux_function")
if density_scale is not None:
species.add_new_group_attr(source_name, "flux", density_scale)
Expand All @@ -771,16 +775,19 @@ def initialize_flux_profile_func(self, species, density_scale, source_name
"{}*({})".format(density_scale, expression),
)


class UniformFluxDistribution(
picmistandard.PICMI_UniformFluxDistribution, FluxDistributionBase, DensityDistributionBase
picmistandard.PICMI_UniformFluxDistribution,
FluxDistributionBase,
DensityDistributionBase,
):
def initialize_flux_profile_func(self, species, density_scale, source_name
):
def initialize_flux_profile_func(self, species, density_scale, source_name):
species.add_new_group_attr(source_name, "flux_profile", "constant")
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)


class AnalyticDistribution(
picmistandard.PICMI_AnalyticDistribution, DensityDistributionBase
):
Expand Down

0 comments on commit 4e0e5fc

Please sign in to comment.