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

Add tokamak option psi_divide_twopi #172

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Changes from all 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
16 changes: 16 additions & 0 deletions hypnotoad/cases/tokamak.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class TokamakEquilibrium(Equilibrium):
doc="Reverse the sign of the poloidal field",
value_type=bool,
),
psi_divide_twopi=WithMeta(
False,
doc="Divide poloidal flux, and so poloidal field, by 2pi",
value_type=bool,
),
extrapolate_profiles=WithMeta(
False,
doc=(
Expand Down Expand Up @@ -364,6 +369,16 @@ def __init__(
psi2D *= -1.0
psi1D *= -1.0

if self.user_options.psi_divide_twopi:
warnings.warn("Dividing poloidal flux by 2pi")
twopi = 2 * np.pi
psi2D /= twopi
psi1D /= twopi
if psi_axis_gfile is not None:
psi_axis_gfile /= twopi
if psi_bdry_gfile is not None:
psi_bdry_gfile /= twopi

if self.user_options.reverse_Bt:
warnings.warn("Reversing the sign of the toroidal field")
fpol1D *= -1.0
Expand Down Expand Up @@ -1679,6 +1694,7 @@ def read_geqdsk(

* ``reverse_current = bool`` - Changes the sign of poloidal flux psi
* ``extrapolate_profiles = bool`` - Extrapolate pressure using exponential
* ``psi_divide_twopi = bool`` - Divide poloidal flux, and so poloidal field, by 2pi
"""

if settings is None:
Expand Down
Loading