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

Poloidal degree change #162

Merged
merged 8 commits into from
Oct 2, 2024
Merged
Changes from 7 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
14 changes: 9 additions & 5 deletions parastell/nwl_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ def flux_coords(plas_eq, wall_s, coords, num_threads):
for theta_coord_chunk in theta_coord_chunks
for theta_coord in theta_coord_chunk
]
# Ensures theta_coords are all positive (add 360 degrees where needed)
theta_coords = (theta_coords + 2 * np.pi) % 2*np.pi
Copy link
Member

Choose a reason for hiding this comment

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

will they need to be reordered/sorted?

Copy link
Collaborator

@connoramoreno connoramoreno Sep 30, 2024

Choose a reason for hiding this comment

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

@Edgar-21 correct me if I'm wrong but I don't believe theta_coords is sorted

Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't need to be reordered, theta_coords is just a list of the same length as the list of surface crossings from the surface source that stores the poloidal angle for each surface crossing, all we are doing here is changing the notation of theta, each theta_coord still corresponds to the same surface crossing.

For reference, here is what the NWL looks like from before:
image
And after:
image

The first has been rescaled as noted in its title, but looking at the overall profile the coordinate shift can be seen

connoramoreno marked this conversation as resolved.
Show resolved Hide resolved

return phi_coords.tolist(), theta_coords


Expand Down Expand Up @@ -339,8 +342,9 @@ def nwl_plot(
# Define minimum and maximum bin edges for each dimension
phi_min = 0 - tor_ext / num_phi / 2
phi_max = tor_ext + tor_ext / num_phi / 2
theta_min = -pol_ext / 2 - pol_ext / num_theta / 2
theta_max = pol_ext / 2 + pol_ext / num_theta / 2

theta_min = 0 - pol_ext / num_theta / 2
theta_max = pol_ext + pol_ext / num_theta / 2

# Bin particle crossings
count_mat, phi_bins, theta_bins = np.histogram2d(
Expand All @@ -353,12 +357,12 @@ def nwl_plot(
# adjust endpoints to eliminate overlap
phi_bins[0] = 0
phi_bins[-1] = tor_ext
theta_bins[0] = -pol_ext / 2
theta_bins[-1] = pol_ext / 2
theta_bins[0] = 0
theta_bins[-1] = pol_ext

# Compute centroids of bin dimensions
phi_pts = np.linspace(0, tor_ext, num=num_phi)
theta_pts = np.linspace(-pol_ext / 2, pol_ext / 2, num=num_theta)
theta_pts = np.linspace(0, pol_ext, num=num_theta)

# Define fusion neutron energy (eV)
n_energy = 14.1e6
Expand Down
Loading