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

Enable general weight scaling for radial particle distributions #5009

Open
wants to merge 39 commits into
base: development
Choose a base branch
from

Conversation

dpgrote
Copy link
Member

@dpgrote dpgrote commented Jun 21, 2024

This PR adds the new input parameter radial_weight_power which specifies the radial power for the particle weight when using cylindrical geometry. The default value of 1 gives uniform particles per cells with increasing weight with radius, the value 0 gives uniformly weighted particles.

Note that this removes the parameter radially_weighted which is no longer used and could not be changed from its default value anyway.

Several CI benchmarks are updated due to changes in round-off.

Note that this replaces PR #4342

EyaDammak and others added 25 commits October 4, 2023 14:19
Trying to fix the error during the test:
/home/runner/work/WarpX/WarpX/Source/Initialization/PlasmaInjector.cpp:72:5: warning: 'zmax' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
    zmax = std::numeric_limits<amrex::Real>::max();
Adding "amrex::Real" to define xmin,ymin,zmin,xmax,ymax,zmax
@dpgrote dpgrote added geometry: RZ axisymmetric 2D and quasi-3D component: initialization Changes related to the initialization of the simulation labels Jun 21, 2024
@dpgrote dpgrote requested a review from RemiLehe June 21, 2024 00:12
@@ -142,6 +142,7 @@ def calculate_error(E_axis, xmin, dx, nx):
print("L2 error along x-axis = %s" %L2_error_x)
print("L2 error along y-axis = %s" %L2_error_y)
print("L2 error along z-axis = %s" %L2_error_z)
print("L2 error tolerance = %s" %l2_tolerance)
Copy link
Member Author

Choose a reason for hiding this comment

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

These print statements were added to provide more output in cases when the checks fail. This was helpful in getting the new CI test working.

electron.charge = -q_e
electron.mass = m_e
electron.injection_style = "NUniformPerCell"
electron.num_particles_per_cell_each_dim = 6 2 2
Copy link
Member Author

Choose a reason for hiding this comment

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

Note here that more particles are needed in this test compared to the non-uniformly weighted case to get to the same tolerance. This is because the error is being checked on axis which has fewer particles when doing uniform weighting.

@@ -51,7 +51,7 @@
##########################

uniform_plasma = picmi.UniformDistribution(density = density,
upper_bound = [+18e-6, +18e-6, None],
upper_bound = [+18e-6, None, +40e-6],
Copy link
Member Author

Choose a reason for hiding this comment

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

This was a bug found in this input file that made this test fail with the updated code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: initialization Changes related to the initialization of the simulation geometry: RZ axisymmetric 2D and quasi-3D
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants