diff --git a/desc/compute/_field.py b/desc/compute/_field.py index e53f033464..d99cb8a42d 100644 --- a/desc/compute/_field.py +++ b/desc/compute/_field.py @@ -77,12 +77,11 @@ def _B_sup_rho(params, transforms, profiles, data, **kwargs): transforms={}, profiles=[], coordinates="rtz", - data=["B0", "iota", "lambda_z", "omega_z"], + data=["B0", "iota", "phi_z", "lambda_z"], ) def _B_sup_theta(params, transforms, profiles, data, **kwargs): - data["B^theta"] = data["B0"] * ( - data["iota"] * data["omega_z"] + data["iota"] - data["lambda_z"] - ) + # Assumes θ = ϑ − λ. + data["B^theta"] = data["B0"] * (data["iota"] * data["phi_z"] - data["lambda_z"]) return data @@ -97,11 +96,12 @@ def _B_sup_theta(params, transforms, profiles, data, **kwargs): transforms={}, profiles=[], coordinates="rtz", - data=["B0", "iota", "lambda_t", "omega_t"], + data=["B0", "iota", "theta_PEST_t", "omega_t"], ) def _B_sup_zeta(params, transforms, profiles, data, **kwargs): + # Assumes ζ = ϕ − ω. data["B^zeta"] = data["B0"] * ( - -data["iota"] * data["omega_t"] + data["lambda_t"] + 1 + -data["iota"] * data["omega_t"] + data["theta_PEST_t"] ) return data @@ -222,26 +222,14 @@ def _B0_r(params, transforms, profiles, data, **kwargs): transforms={}, profiles=[], coordinates="rtz", - data=[ - "B0", - "B0_r", - "iota", - "iota_r", - "lambda_rz", - "lambda_z", - "omega_rz", - "omega_z", - ], + data=["B0", "B0_r", "iota", "iota_r", "phi_rz", "phi_z", "lambda_rz", "lambda_z"], ) def _B_sup_theta_r(params, transforms, profiles, data, **kwargs): data["B^theta_r"] = data["B0"] * ( - data["iota"] * data["omega_rz"] - + data["iota_r"] * data["omega_z"] - + data["iota_r"] + data["iota"] * data["phi_rz"] + + data["iota_r"] * data["phi_z"] - data["lambda_rz"] - ) + data["B0_r"] * ( - data["iota"] * data["omega_z"] + data["iota"] - data["lambda_z"] - ) + ) + data["B0_r"] * (data["iota"] * data["phi_z"] - data["lambda_z"]) return data @@ -264,8 +252,8 @@ def _B_sup_theta_r(params, transforms, profiles, data, **kwargs): "B0_r", "iota", "iota_r", - "lambda_rt", - "lambda_t", + "theta_PEST_rt", + "theta_PEST_t", "omega_rt", "omega_t", ], @@ -274,8 +262,8 @@ def _B_sup_zeta_r(params, transforms, profiles, data, **kwargs): data["B^zeta_r"] = data["B0"] * ( -data["iota"] * data["omega_rt"] - data["iota_r"] * data["omega_t"] - + data["lambda_rt"] - ) + data["B0_r"] * (-data["iota"] * data["omega_t"] + data["lambda_t"] + 1) + + data["theta_PEST_rt"] + ) + data["B0_r"] * (-data["iota"] * data["omega_t"] + data["theta_PEST_t"]) return data @@ -347,14 +335,12 @@ def _B0_t(params, transforms, profiles, data, **kwargs): transforms={}, profiles=[], coordinates="rtz", - data=["B0", "B0_t", "iota", "lambda_tz", "lambda_z", "omega_tz", "omega_z"], + data=["B0", "B0_t", "iota", "lambda_tz", "lambda_z", "phi_tz", "phi_z"], ) def _B_sup_theta_t(params, transforms, profiles, data, **kwargs): data["B^theta_t"] = data["B0"] * ( - data["iota"] * data["omega_tz"] - data["lambda_tz"] - ) + data["B0_t"] * ( - data["iota"] * data["omega_z"] + data["iota"] - data["lambda_z"] - ) + data["iota"] * data["phi_tz"] - data["lambda_tz"] + ) + data["B0_t"] * (data["iota"] * data["phi_z"] - data["lambda_z"]) return data @@ -372,12 +358,12 @@ def _B_sup_theta_t(params, transforms, profiles, data, **kwargs): transforms={}, profiles=[], coordinates="rtz", - data=["B0", "B0_t", "iota", "lambda_t", "lambda_tt", "omega_t", "omega_tt"], + data=["B0", "B0_t", "iota", "theta_PEST_t", "theta_PEST_tt", "omega_t", "omega_tt"], ) def _B_sup_zeta_t(params, transforms, profiles, data, **kwargs): data["B^zeta_t"] = data["B0"] * ( - -data["iota"] * data["omega_tt"] + data["lambda_tt"] - ) + data["B0_t"] * (-data["iota"] * data["omega_t"] + data["lambda_t"] + 1) + -data["iota"] * data["omega_tt"] + data["theta_PEST_tt"] + ) + data["B0_t"] * (-data["iota"] * data["omega_t"] + data["theta_PEST_t"]) return data @@ -449,14 +435,12 @@ def _B0_z(params, transforms, profiles, data, **kwargs): transforms={}, profiles=[], coordinates="rtz", - data=["B0", "B0_z", "iota", "lambda_z", "lambda_zz", "omega_z", "omega_zz"], + data=["B0", "B0_z", "iota", "lambda_z", "lambda_zz", "phi_z", "phi_zz"], ) def _B_sup_theta_z(params, transforms, profiles, data, **kwargs): data["B^theta_z"] = data["B0"] * ( - data["iota"] * data["omega_zz"] - data["lambda_zz"] - ) + data["B0_z"] * ( - data["iota"] * data["omega_z"] + data["iota"] - data["lambda_z"] - ) + data["iota"] * data["phi_zz"] - data["lambda_zz"] + ) + data["B0_z"] * (data["iota"] * data["phi_z"] - data["lambda_z"]) return data @@ -474,12 +458,12 @@ def _B_sup_theta_z(params, transforms, profiles, data, **kwargs): transforms={}, profiles=[], coordinates="rtz", - data=["B0", "B0_z", "iota", "lambda_t", "lambda_tz", "omega_t", "omega_tz"], + data=["B0", "B0_z", "iota", "theta_PEST_t", "theta_PEST_tz", "omega_t", "omega_tz"], ) def _B_sup_zeta_z(params, transforms, profiles, data, **kwargs): data["B^zeta_z"] = data["B0"] * ( - -data["iota"] * data["omega_tz"] + data["lambda_tz"] - ) + data["B0_z"] * (-data["iota"] * data["omega_t"] + data["lambda_t"] + 1) + -data["iota"] * data["omega_tz"] + data["theta_PEST_tz"] + ) + data["B0_z"] * (-data["iota"] * data["omega_t"] + data["theta_PEST_t"]) return data @@ -615,31 +599,28 @@ def _B0_rr(params, transforms, profiles, data, **kwargs): "lambda_rrz", "lambda_rz", "lambda_z", - "omega_rrz", - "omega_rz", - "omega_z", + "phi_rrz", + "phi_rz", + "phi_z", ], ) def _B_sup_theta_rr(params, transforms, profiles, data, **kwargs): data["B^theta_rr"] = ( data["B0"] * ( - data["iota"] * data["omega_rrz"] - + 2 * data["iota_r"] * data["omega_rz"] - + data["iota_rr"] * data["omega_z"] - + data["iota_rr"] + data["iota"] * data["phi_rrz"] + + 2 * data["iota_r"] * data["phi_rz"] + + data["iota_rr"] * data["phi_z"] - data["lambda_rrz"] ) + 2 * data["B0_r"] * ( - data["iota"] * data["omega_rz"] - + data["iota_r"] * data["omega_z"] - + data["iota_r"] + data["iota"] * data["phi_rz"] + + data["iota_r"] * data["phi_z"] - data["lambda_rz"] ) - + data["B0_rr"] - * (data["iota"] * data["omega_z"] + data["iota"] - data["lambda_z"]) + + data["B0_rr"] * (data["iota"] * data["phi_z"] - data["lambda_z"]) ) return data @@ -665,9 +646,9 @@ def _B_sup_theta_rr(params, transforms, profiles, data, **kwargs): "iota", "iota_r", "iota_rr", - "lambda_rrt", - "lambda_rt", - "lambda_t", + "theta_PEST_rrt", + "theta_PEST_rt", + "theta_PEST_t", "omega_rrt", "omega_rt", "omega_t", @@ -680,16 +661,16 @@ def _B_sup_zeta_rr(params, transforms, profiles, data, **kwargs): data["iota"] * data["omega_rrt"] + 2 * data["iota_r"] * data["omega_rt"] + data["iota_rr"] * data["omega_t"] - - data["lambda_rrt"] + - data["theta_PEST_rrt"] ) - 2 * data["B0_r"] * ( data["iota"] * data["omega_rt"] + data["iota_r"] * data["omega_t"] - - data["lambda_rt"] + - data["theta_PEST_rt"] ) - + data["B0_rr"] * (-data["iota"] * data["omega_t"] + data["lambda_t"] + 1) + + data["B0_rr"] * (-data["iota"] * data["omega_t"] + data["theta_PEST_t"]) ) return data @@ -784,17 +765,16 @@ def _B0_tt(params, transforms, profiles, data, **kwargs): "lambda_ttz", "lambda_tz", "lambda_z", - "omega_ttz", - "omega_tz", - "omega_z", + "phi_ttz", + "phi_tz", + "phi_z", ], ) def _B_sup_theta_tt(params, transforms, profiles, data, **kwargs): data["B^theta_tt"] = ( - data["B0"] * (data["iota"] * data["omega_ttz"] - data["lambda_ttz"]) - + 2 * data["B0_t"] * (data["iota"] * data["omega_tz"] - data["lambda_tz"]) - + data["B0_tt"] - * (data["iota"] * data["omega_z"] + data["iota"] - data["lambda_z"]) + data["B0"] * (data["iota"] * data["phi_ttz"] - data["lambda_ttz"]) + + 2 * data["B0_t"] * (data["iota"] * data["phi_tz"] - data["lambda_tz"]) + + data["B0_tt"] * (data["iota"] * data["phi_z"] - data["lambda_z"]) ) return data @@ -818,9 +798,9 @@ def _B_sup_theta_tt(params, transforms, profiles, data, **kwargs): "B0_t", "B0_tt", "iota", - "lambda_t", - "lambda_tt", - "lambda_ttt", + "theta_PEST_t", + "theta_PEST_tt", + "theta_PEST_ttt", "omega_t", "omega_tt", "omega_ttt", @@ -828,9 +808,9 @@ def _B_sup_theta_tt(params, transforms, profiles, data, **kwargs): ) def _B_sup_zeta_tt(params, transforms, profiles, data, **kwargs): data["B^zeta_tt"] = ( - -data["B0"] * (data["iota"] * data["omega_ttt"] - data["lambda_ttt"]) - - 2 * data["B0_t"] * (data["iota"] * data["omega_tt"] - data["lambda_tt"]) - + data["B0_tt"] * (-data["iota"] * data["omega_t"] + data["lambda_t"] + 1) + -data["B0"] * (data["iota"] * data["omega_ttt"] - data["theta_PEST_ttt"]) + - 2 * data["B0_t"] * (data["iota"] * data["omega_tt"] - data["theta_PEST_tt"]) + + data["B0_tt"] * (-data["iota"] * data["omega_t"] + data["theta_PEST_t"]) ) return data @@ -925,17 +905,16 @@ def _B0_zz(params, transforms, profiles, data, **kwargs): "lambda_z", "lambda_zz", "lambda_zzz", - "omega_z", - "omega_zz", - "omega_zzz", + "phi_z", + "phi_zz", + "phi_zzz", ], ) def _B_sup_theta_zz(params, transforms, profiles, data, **kwargs): data["B^theta_zz"] = ( - data["B0"] * (data["iota"] * data["omega_zzz"] - data["lambda_zzz"]) - + 2 * data["B0_z"] * (data["iota"] * data["omega_zz"] - data["lambda_zz"]) - + data["B0_zz"] - * (data["iota"] * data["omega_z"] + data["iota"] - data["lambda_z"]) + data["B0"] * (data["iota"] * data["phi_zzz"] - data["lambda_zzz"]) + + 2 * data["B0_z"] * (data["iota"] * data["phi_zz"] - data["lambda_zz"]) + + data["B0_zz"] * (data["iota"] * data["phi_z"] - data["lambda_z"]) ) return data @@ -959,9 +938,9 @@ def _B_sup_theta_zz(params, transforms, profiles, data, **kwargs): "B0_z", "B0_zz", "iota", - "lambda_t", - "lambda_tz", - "lambda_tzz", + "theta_PEST_t", + "theta_PEST_tz", + "theta_PEST_tzz", "omega_t", "omega_tz", "omega_tzz", @@ -969,9 +948,9 @@ def _B_sup_theta_zz(params, transforms, profiles, data, **kwargs): ) def _B_sup_zeta_zz(params, transforms, profiles, data, **kwargs): data["B^zeta_zz"] = ( - -data["B0"] * (data["iota"] * data["omega_tzz"] - data["lambda_tzz"]) - - 2 * data["B0_z"] * (data["iota"] * data["omega_tz"] - data["lambda_tz"]) - + data["B0_zz"] * (-data["iota"] * data["omega_t"] + data["lambda_t"] + 1) + -data["B0"] * (data["iota"] * data["omega_tzz"] - data["theta_PEST_tzz"]) + - 2 * data["B0_z"] * (data["iota"] * data["omega_tz"] - data["theta_PEST_tz"]) + + data["B0_zz"] * (-data["iota"] * data["omega_t"] + data["theta_PEST_t"]) ) return data @@ -1074,30 +1053,28 @@ def _B0_rt(params, transforms, profiles, data, **kwargs): "lambda_rz", "lambda_tz", "lambda_z", - "omega_rtz", - "omega_rz", - "omega_tz", - "omega_z", + "phi_rtz", + "phi_rz", + "phi_tz", + "phi_z", ], ) def _B_sup_theta_rt(params, transforms, profiles, data, **kwargs): data["B^theta_rt"] = ( data["B0"] * ( - data["iota"] * data["omega_rtz"] - + data["iota_r"] * data["omega_tz"] + data["iota"] * data["phi_rtz"] + + data["iota_r"] * data["phi_tz"] - data["lambda_rtz"] ) - + data["B0_r"] * (data["iota"] * data["omega_tz"] - data["lambda_tz"]) + + data["B0_r"] * (data["iota"] * data["phi_tz"] - data["lambda_tz"]) + data["B0_t"] * ( - data["iota"] * data["omega_rz"] - + data["iota_r"] * data["omega_z"] - + data["iota_r"] + data["iota"] * data["phi_rz"] + + data["iota_r"] * data["phi_z"] - data["lambda_rz"] ) - + data["B0_rt"] - * (data["iota"] * data["omega_z"] + data["iota"] - data["lambda_z"]) + + data["B0_rt"] * (data["iota"] * data["phi_z"] - data["lambda_z"]) ) return data @@ -1123,10 +1100,10 @@ def _B_sup_theta_rt(params, transforms, profiles, data, **kwargs): "B0_t", "iota", "iota_r", - "lambda_rt", - "lambda_rtt", - "lambda_t", - "lambda_tt", + "theta_PEST_rt", + "theta_PEST_rtt", + "theta_PEST_t", + "theta_PEST_tt", "omega_rt", "omega_rtt", "omega_t", @@ -1139,16 +1116,16 @@ def _B_sup_zeta_rt(params, transforms, profiles, data, **kwargs): * ( data["iota"] * data["omega_rtt"] + data["iota_r"] * data["omega_tt"] - - data["lambda_rtt"] + - data["theta_PEST_rtt"] ) - - data["B0_r"] * (data["iota"] * data["omega_tt"] - data["lambda_tt"]) + - data["B0_r"] * (data["iota"] * data["omega_tt"] - data["theta_PEST_tt"]) - data["B0_t"] * ( data["iota"] * data["omega_rt"] + data["iota_r"] * data["omega_t"] - - data["lambda_rt"] + - data["theta_PEST_rt"] ) - + data["B0_rt"] * (-data["iota"] * data["omega_t"] + data["lambda_t"] + 1) + + data["B0_rt"] * (-data["iota"] * data["omega_t"] + data["theta_PEST_t"]) ) return data @@ -1258,19 +1235,18 @@ def _B0_tz(params, transforms, profiles, data, **kwargs): "lambda_tzz", "lambda_z", "lambda_zz", - "omega_tz", - "omega_tzz", - "omega_z", - "omega_zz", + "phi_tz", + "phi_tzz", + "phi_z", + "phi_zz", ], ) def _B_sup_theta_tz(params, transforms, profiles, data, **kwargs): data["B^theta_tz"] = ( - data["B0"] * (data["iota"] * data["omega_tzz"] - data["lambda_tzz"]) - + data["B0_t"] * (data["iota"] * data["omega_zz"] - data["lambda_zz"]) - + data["B0_z"] * (data["iota"] * data["omega_tz"] - data["lambda_tz"]) - + data["B0_tz"] - * (data["iota"] * data["omega_z"] + data["iota"] - data["lambda_z"]) + data["B0"] * (data["iota"] * data["phi_tzz"] - data["lambda_tzz"]) + + data["B0_t"] * (data["iota"] * data["phi_zz"] - data["lambda_zz"]) + + data["B0_z"] * (data["iota"] * data["phi_tz"] - data["lambda_tz"]) + + data["B0_tz"] * (data["iota"] * data["phi_z"] - data["lambda_z"]) ) return data @@ -1295,10 +1271,10 @@ def _B_sup_theta_tz(params, transforms, profiles, data, **kwargs): "B0_tz", "B0_z", "iota", - "lambda_t", - "lambda_tt", - "lambda_ttz", - "lambda_tz", + "theta_PEST_t", + "theta_PEST_tt", + "theta_PEST_ttz", + "theta_PEST_tz", "omega_t", "omega_tt", "omega_ttz", @@ -1307,10 +1283,10 @@ def _B_sup_theta_tz(params, transforms, profiles, data, **kwargs): ) def _B_sup_zeta_tz(params, transforms, profiles, data, **kwargs): data["B^zeta_tz"] = ( - -data["B0"] * (data["iota"] * data["omega_ttz"] - data["lambda_ttz"]) - - data["B0_t"] * (data["iota"] * data["omega_tz"] - data["lambda_tz"]) - - data["B0_z"] * (data["iota"] * data["omega_tt"] - data["lambda_tt"]) - + data["B0_tz"] * (-data["iota"] * data["omega_t"] + data["lambda_t"] + 1) + -data["B0"] * (data["iota"] * data["omega_ttz"] - data["theta_PEST_ttz"]) + - data["B0_t"] * (data["iota"] * data["omega_tz"] - data["theta_PEST_tz"]) + - data["B0_z"] * (data["iota"] * data["omega_tt"] - data["theta_PEST_tt"]) + + data["B0_tz"] * (-data["iota"] * data["omega_t"] + data["theta_PEST_t"]) ) return data @@ -1419,30 +1395,28 @@ def _B0_rz(params, transforms, profiles, data, **kwargs): "lambda_rzz", "lambda_z", "lambda_zz", - "omega_rz", - "omega_rzz", - "omega_z", - "omega_zz", + "phi_rz", + "phi_rzz", + "phi_z", + "phi_zz", ], ) def _B_sup_theta_rz(params, transforms, profiles, data, **kwargs): data["B^theta_rz"] = ( data["B0"] * ( - data["iota"] * data["omega_rzz"] - + data["iota_r"] * data["omega_zz"] + data["iota"] * data["phi_rzz"] + + data["iota_r"] * data["phi_zz"] - data["lambda_rzz"] ) - + data["B0_r"] * (data["iota"] * data["omega_zz"] - data["lambda_zz"]) + + data["B0_r"] * (data["iota"] * data["phi_zz"] - data["lambda_zz"]) + data["B0_z"] * ( - data["iota"] * data["omega_rz"] - + data["iota_r"] * data["omega_z"] - + data["iota_r"] + data["iota"] * data["phi_rz"] + + data["iota_r"] * data["phi_z"] - data["lambda_rz"] ) - + data["B0_rz"] - * (data["iota"] * data["omega_z"] + data["iota"] - data["lambda_z"]) + + data["B0_rz"] * (data["iota"] * data["phi_z"] - data["lambda_z"]) ) return data @@ -1468,10 +1442,10 @@ def _B_sup_theta_rz(params, transforms, profiles, data, **kwargs): "B0_z", "iota", "iota_r", - "lambda_rt", - "lambda_rtz", - "lambda_t", - "lambda_tz", + "theta_PEST_rt", + "theta_PEST_rtz", + "theta_PEST_t", + "theta_PEST_tz", "omega_rt", "omega_rtz", "omega_t", @@ -1484,16 +1458,16 @@ def _B_sup_zeta_rz(params, transforms, profiles, data, **kwargs): * ( data["iota"] * data["omega_rtz"] + data["iota_r"] * data["omega_tz"] - - data["lambda_rtz"] + - data["theta_PEST_rtz"] ) - - data["B0_r"] * (data["iota"] * data["omega_tz"] - data["lambda_tz"]) + - data["B0_r"] * (data["iota"] * data["omega_tz"] - data["theta_PEST_tz"]) - data["B0_z"] * ( data["iota"] * data["omega_rt"] + data["iota_r"] * data["omega_t"] - - data["lambda_rt"] + - data["theta_PEST_rt"] ) - + data["B0_rz"] * (-data["iota"] * data["omega_t"] + data["lambda_t"] + 1) + + data["B0_rz"] * (-data["iota"] * data["omega_t"] + data["theta_PEST_t"]) ) return data diff --git a/desc/compute/_omnigenity.py b/desc/compute/_omnigenity.py index 892800d48e..f56a8bb356 100644 --- a/desc/compute/_omnigenity.py +++ b/desc/compute/_omnigenity.py @@ -233,10 +233,10 @@ def _nu_z(params, transforms, profiles, data, **kwargs): transforms={}, profiles=[], coordinates="rtz", - data=["theta", "lambda", "iota", "nu"], + data=["theta_PEST", "iota", "nu"], ) def _theta_B(params, transforms, profiles, data, **kwargs): - data["theta_B"] = data["theta"] + data["lambda"] + data["iota"] * data["nu"] + data["theta_B"] = data["theta_PEST"] + data["iota"] * data["nu"] return data @@ -251,10 +251,10 @@ def _theta_B(params, transforms, profiles, data, **kwargs): transforms={}, profiles=[], coordinates="rtz", - data=["zeta", "nu"], + data=["phi", "nu"], ) def _zeta_B(params, transforms, profiles, data, **kwargs): - data["zeta_B"] = data["zeta"] + data["nu"] + data["zeta_B"] = data["phi"] + data["nu"] return data @@ -263,18 +263,20 @@ def _zeta_B(params, transforms, profiles, data, **kwargs): label="\\sqrt{g}_{B}", units="~", units_long="None", - description="Jacobian determinant of Boozer coordinates", + description="Jacobian determinant from Boozer to DESC coordinates", dim=1, params=[], transforms={}, profiles=[], coordinates="rtz", - data=["lambda_t", "lambda_z", "nu_t", "nu_z", "iota"], + data=["theta_PEST_t", "theta_PEST_z", "phi_t", "phi_z", "nu_t", "nu_z", "iota"], ) def _sqrtg_B(params, transforms, profiles, data, **kwargs): - data["sqrt(g)_B"] = (1 + data["lambda_t"]) * (1 + data["nu_z"]) + ( - data["iota"] - data["lambda_z"] - ) * data["nu_t"] + data["sqrt(g)_B"] = ( + data["theta_PEST_t"] * (data["phi_z"] + data["nu_z"]) + - data["theta_PEST_z"] * (data["phi_t"] + data["nu_t"]) + + data["iota"] * (data["nu_t"] * data["phi_z"] - data["nu_z"] * data["phi_t"]) + ) return data diff --git a/desc/compute/_profiles.py b/desc/compute/_profiles.py index 1cfbc2f23f..a6bd178f97 100644 --- a/desc/compute/_profiles.py +++ b/desc/compute/_profiles.py @@ -705,6 +705,7 @@ def _iota(params, transforms, profiles, data, **kwargs): data["iota"] = profiles["iota"].compute(transforms["grid"], params["i_l"], dr=0) elif profiles["current"] is not None: # See the document attached to GitHub pull request #556 for the math. + # Assumes ζ = ϕ − ω and θ = ϑ − λ. data["iota"] = transforms["grid"].replace_at_axis( safediv(data["iota_num"], data["iota_den"]), lambda: safediv(data["iota_num_r"], data["iota_den_r"]), @@ -733,6 +734,7 @@ def _iota_r(params, transforms, profiles, data, **kwargs): ) elif profiles["current"] is not None: # See the document attached to GitHub pull request #556 for the math. + # Assumes ζ = ϕ − ω and θ = ϑ − λ. data["iota_r"] = transforms["grid"].replace_at_axis( safediv( data["iota_num_r"] * data["iota_den"] @@ -776,6 +778,7 @@ def _iota_rr(params, transforms, profiles, data, **kwargs): ) elif profiles["current"] is not None: # See the document attached to GitHub pull request #556 for the math. + # Assumes ζ = ϕ − ω and θ = ϑ − λ. data["iota_rr"] = transforms["grid"].replace_at_axis( safediv( data["iota_num_rr"] * data["iota_den"] ** 2 @@ -863,7 +866,7 @@ def _iota_num_current(params, transforms, profiles, data, **kwargs): iota = profiles["iota"].compute(transforms["grid"], params["i_l"], dr=0) data["iota_num current"] = iota * data["iota_den"] - data["iota_num vacuum"] elif profiles["current"] is not None: - # 4π^2 I = 4π^2 (mu_0 current / 2π) = 2π mu_0 current + # 4π² I = 4π² (μ₀ current / 2π) = 2π μ₀ current current = profiles["current"].compute(transforms["grid"], params["c_l"], dr=0) current_r = profiles["current"].compute(transforms["grid"], params["c_l"], dr=1) data["iota_num current"] = ( @@ -895,6 +898,7 @@ def _iota_num_current(params, transforms, profiles, data, **kwargs): ) def _iota_num_vacuum(params, transforms, profiles, data, **kwargs): """Vacuum contribution to the numerator of rotational transform formula.""" + # Assumes ζ = ϕ − ω and θ = ϑ − λ. iota_num_vacuum = transforms["grid"].replace_at_axis( safediv( data["lambda_z"] * data["g_tt"] - (1 + data["lambda_t"]) * data["g_tz"], @@ -976,6 +980,7 @@ def _iota_num_r_current(params, transforms, profiles, data, **kwargs): resolution_requirement="tz", ) def _iota_num_r_vacuum(params, transforms, profiles, data, **kwargs): + # Assumes ζ = ϕ − ω and θ = ϑ − λ. iota_num_vacuum = safediv( data["lambda_z"] * data["g_tt"] - (1 + data["lambda_t"]) * data["g_tz"], data["sqrt(g)"], @@ -1095,11 +1100,11 @@ def _iota_num_rr(params, transforms, profiles, data, **kwargs): Computes d2(𝛼+𝛽)/d𝜌2 as defined in the document attached to the description of GitHub pull request #556. 𝛼 supplements the rotational transform with an additional term to account for the enclosed net toroidal current. + Assumes ζ = ϕ − ω and θ = ϑ − λ. """ if profiles["iota"] is not None: data["iota_num_rr"] = jnp.nan * data["0"] elif profiles["current"] is not None: - # 4π^2 I = 4π^2 (mu_0 current / 2π) = 2π mu_0 current current = profiles["current"].compute(transforms["grid"], params["c_l"], dr=0) current_r = profiles["current"].compute(transforms["grid"], params["c_l"], dr=1) current_rr = profiles["current"].compute( @@ -1108,6 +1113,7 @@ def _iota_num_rr(params, transforms, profiles, data, **kwargs): current_rrr = profiles["current"].compute( transforms["grid"], params["c_l"], dr=3 ) + # 4π² I = 4π² (μ₀ current / 2π) = 2π μ₀ current alpha_rr = ( jnp.pi * mu_0 @@ -1224,6 +1230,7 @@ def _iota_num_rrr(params, transforms, profiles, data, **kwargs): Computes d3(𝛼+𝛽)/d𝜌3 as defined in the document attached to the description of GitHub pull request #556. 𝛼 supplements the rotational transform with an additional term to account for the enclosed net toroidal current. + Assumes ζ = ϕ − ω and θ = ϑ − λ. """ if profiles["iota"] is not None: data["iota_num_rrr"] = jnp.nan * data["0"] @@ -1239,7 +1246,7 @@ def _iota_num_rrr(params, transforms, profiles, data, **kwargs): current_rrrr = profiles["current"].compute( transforms["grid"], params["c_l"], dr=4 ) - # 4π^2 I = 4π^2 (mu_0 current / 2π) = 2π mu_0 current + # 4π² I = 4π² (μ₀ current / 2π) = 2π μ₀ current alpha_rrr = ( jnp.pi * mu_0 @@ -1343,14 +1350,14 @@ def _iota_den(params, transforms, profiles, data, **kwargs): """Denominator of rotational transform formula. Computes 𝛾 as defined in the document attached to the description - of GitHub pull request #556. + of GitHub pull request #556. Assumes ζ = ϕ − ω and θ = ϑ − λ. """ gamma = safediv( (1 + data["omega_z"]) * data["g_tt"] - data["omega_t"] * data["g_tz"], data["sqrt(g)"], ) # Assumes toroidal stream function behaves such that the magnetic axis limit - # of gamma is zero (as it would if omega = 0 identically). + # of γ is zero (as it would if ω = 0 identically). gamma = transforms["grid"].replace_at_axis( surface_integrals(transforms["grid"], gamma), 0 ) @@ -1388,7 +1395,7 @@ def _iota_den_r(params, transforms, profiles, data, **kwargs): """Denominator of rotational transform formula, first radial derivative. Computes d𝛾/d𝜌 as defined in the document attached to the description - of GitHub pull request #556. + of GitHub pull request #556. Assumes ζ = ϕ − ω and θ = ϑ − λ. """ gamma = safediv( (1 + data["omega_z"]) * data["g_tt"] - data["omega_t"] * data["g_tz"], @@ -1455,7 +1462,7 @@ def _iota_den_rr(params, transforms, profiles, data, **kwargs): """Denominator of rotational transform formula, second radial derivative. Computes d2𝛾/d𝜌2 as defined in the document attached to the description - of GitHub pull request #556. + of GitHub pull request #556. Assumes ζ = ϕ − ω and θ = ϑ − λ. """ gamma = safediv( (1 + data["omega_z"]) * data["g_tt"] - data["omega_t"] * data["g_tz"], @@ -1550,7 +1557,7 @@ def _iota_den_rrr(params, transforms, profiles, data, **kwargs): """Denominator of rotational transform formula, third radial derivative. Computes d3𝛾/d𝜌3 as defined in the document attached to the description - of GitHub pull request #556. + of GitHub pull request #556. Assumes ζ = ϕ − ω and θ = ϑ − λ. """ gamma = safediv( (1 + data["omega_z"]) * data["g_tt"] - data["omega_t"] * data["g_tz"], @@ -1616,9 +1623,12 @@ def _iota_den_rrr(params, transforms, profiles, data, **kwargs): axis_limit_data=["iota_rr", "psi_rr"], ) def _iota_psi(params, transforms, profiles, data, **kwargs): - # Existence of limit at magnetic axis requires ∂ᵨ iota = 0 at axis. - # Assume iota may be expanded as an even power series of ρ so that this - # condition is satisfied. + """∂ι/∂ψ. + + Existence of limit at magnetic axis requires ∂ι/∂ρ = 0 at axis. + Assume ι may be expanded as an even power series of ρ so that this + condition is satisfied. + """ data["iota_psi"] = transforms["grid"].replace_at_axis( safediv(data["iota_r"], data["psi_r"]), lambda: safediv(data["iota_rr"], data["psi_rr"]),