Skip to content

Commit

Permalink
Name change 2 (#1429)
Browse files Browse the repository at this point in the history
  • Loading branch information
unalmis authored Dec 5, 2024
2 parents 1d03f2f + 7e44363 commit 76dd4ab
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 42 deletions.
20 changes: 10 additions & 10 deletions desc/compute/_basis_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3223,15 +3223,15 @@ def _e_sub_zeta_zz(params, transforms, profiles, data, **kwargs):
transforms={},
profiles=[],
coordinates="rtz",
data=["periodic(grad(alpha))", "secular(grad(alpha))"],
data=["grad(alpha) (periodic)", "grad(alpha) (secular)"],
)
def _grad_alpha(params, transforms, profiles, data, **kwargs):
data["grad(alpha)"] = data["periodic(grad(alpha))"] + data["secular(grad(alpha))"]
data["grad(alpha)"] = data["grad(alpha) (periodic)"] + data["grad(alpha) (secular)"]
return data


@register_compute_fun(
name="periodic(grad(alpha))",
name="grad(alpha) (periodic)",
label="\\mathrm{periodic}(\\nabla \\alpha)",
units="m^{-1}",
units_long="Inverse meters",
Expand All @@ -3244,19 +3244,19 @@ def _grad_alpha(params, transforms, profiles, data, **kwargs):
transforms={},
profiles=[],
coordinates="rtz",
data=["e^rho", "e^theta", "e^zeta", "periodic(alpha_r)", "alpha_t", "alpha_z"],
data=["e^rho", "e^theta", "e^zeta", "alpha_r (periodic)", "alpha_t", "alpha_z"],
)
def _periodic_grad_alpha(params, transforms, profiles, data, **kwargs):
data["periodic(grad(alpha))"] = (
data["periodic(alpha_r)"] * data["e^rho"].T
data["grad(alpha) (periodic)"] = (
data["alpha_r (periodic)"] * data["e^rho"].T
+ data["alpha_t"] * data["e^theta"].T
+ data["alpha_z"] * data["e^zeta"].T
).T
return data


@register_compute_fun(
name="secular(grad(alpha))",
name="grad(alpha) (secular)",
label="\\mathrm{secular}(\\nabla \\alpha)",
units="m^{-1}",
units_long="Inverse meters",
Expand All @@ -3269,11 +3269,11 @@ def _periodic_grad_alpha(params, transforms, profiles, data, **kwargs):
transforms={},
profiles=[],
coordinates="rtz",
data=["e^rho", "secular(alpha_r)"],
data=["e^rho", "alpha_r (secular)"],
)
def _secular_grad_alpha(params, transforms, profiles, data, **kwargs):
data["secular(grad(alpha))"] = (
data["secular(alpha_r)"][:, jnp.newaxis] * data["e^rho"]
data["grad(alpha) (secular)"] = (
data["alpha_r (secular)"][:, jnp.newaxis] * data["e^rho"]
)
return data

Expand Down
12 changes: 6 additions & 6 deletions desc/compute/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1518,15 +1518,15 @@ def _alpha(params, transforms, profiles, data, **kwargs):
transforms={},
profiles=[],
coordinates="rtz",
data=["periodic(alpha_r)", "secular(alpha_r)"],
data=["alpha_r (periodic)", "alpha_r (secular)"],
)
def _alpha_r(params, transforms, profiles, data, **kwargs):
data["alpha_r"] = data["periodic(alpha_r)"] + data["secular(alpha_r)"]
data["alpha_r"] = data["alpha_r (periodic)"] + data["alpha_r (secular)"]
return data


@register_compute_fun(
name="periodic(alpha_r)",
name="alpha_r (periodic)",
label="\\mathrm{periodic}(\\partial_\\rho \\alpha)",
units="~",
units_long="None",
Expand All @@ -1540,12 +1540,12 @@ def _alpha_r(params, transforms, profiles, data, **kwargs):
data=["theta_PEST_r", "iota", "phi_r"],
)
def _periodic_alpha_r(params, transforms, profiles, data, **kwargs):
data["periodic(alpha_r)"] = data["theta_PEST_r"] - data["iota"] * data["phi_r"]
data["alpha_r (periodic)"] = data["theta_PEST_r"] - data["iota"] * data["phi_r"]
return data


@register_compute_fun(
name="secular(alpha_r)",
name="alpha_r (secular)",
label="\\mathrm{secular}(\\partial_\\rho \\alpha)",
units="~",
units_long="None",
Expand All @@ -1559,7 +1559,7 @@ def _periodic_alpha_r(params, transforms, profiles, data, **kwargs):
data=["iota_r", "phi"],
)
def _secular_alpha_r(params, transforms, profiles, data, **kwargs):
data["secular(alpha_r)"] = -data["iota_r"] * data["phi"]
data["alpha_r (secular)"] = -data["iota_r"] * data["phi"]
return data


Expand Down
32 changes: 16 additions & 16 deletions desc/compute/_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -1952,15 +1952,15 @@ def _g_sup_ra(params, transforms, profiles, data, **kwargs):
transforms={},
profiles=[],
coordinates="rtz",
data=["periodic(gbdrift)", "secular(gbdrift)"],
data=["gbdrift (periodic)", "gbdrift (secular)"],
)
def _gbdrift(params, transforms, profiles, data, **kwargs):
data["gbdrift"] = data["periodic(gbdrift)"] + data["secular(gbdrift)"]
data["gbdrift"] = data["gbdrift (periodic)"] + data["gbdrift (secular)"]
return data


@register_compute_fun(
name="periodic(gbdrift)",
name="gbdrift (periodic)",
label="\\mathrm{periodic}(\\nabla \\vert B \\vert)_{\\mathrm{drift}}",
units="1 / Wb",
units_long="Inverse webers",
Expand All @@ -1970,18 +1970,18 @@ def _gbdrift(params, transforms, profiles, data, **kwargs):
transforms={},
profiles=[],
coordinates="rtz",
data=["|B|^2", "b", "periodic(grad(alpha))", "grad(|B|)"],
data=["|B|^2", "b", "grad(alpha) (periodic)", "grad(|B|)"],
)
def _periodic_gbdrift(params, transforms, profiles, data, **kwargs):
data["periodic(gbdrift)"] = (
dot(data["b"], cross(data["grad(|B|)"], data["periodic(grad(alpha))"]))
data["gbdrift (periodic)"] = (
dot(data["b"], cross(data["grad(|B|)"], data["grad(alpha) (periodic)"]))
/ data["|B|^2"]
)
return data


@register_compute_fun(
name="secular(gbdrift)",
name="gbdrift (secular)",
label="\\mathrm{secular}(\\nabla \\vert B \\vert)_{\\mathrm{drift}}",
units="1 / Wb",
units_long="Inverse webers",
Expand All @@ -1991,18 +1991,18 @@ def _periodic_gbdrift(params, transforms, profiles, data, **kwargs):
transforms={},
profiles=[],
coordinates="rtz",
data=["|B|^2", "b", "secular(grad(alpha))", "grad(|B|)"],
data=["|B|^2", "b", "grad(alpha) (secular)", "grad(|B|)"],
)
def _secular_gbdrift(params, transforms, profiles, data, **kwargs):
data["secular(gbdrift)"] = (
dot(data["b"], cross(data["grad(|B|)"], data["secular(grad(alpha))"]))
data["gbdrift (secular)"] = (
dot(data["b"], cross(data["grad(|B|)"], data["grad(alpha) (secular)"]))
/ data["|B|^2"]
)
return data


@register_compute_fun(
name="secular(gbdrift)/phi",
name="gbdrift (secular)/phi",
label="\\mathrm{secular}(\\nabla \\vert B \\vert)_{\\mathrm{drift}} / \\phi",
units="1 / Wb",
units_long="Inverse webers",
Expand All @@ -2016,7 +2016,7 @@ def _secular_gbdrift(params, transforms, profiles, data, **kwargs):
data=["|B|^2", "b", "e^rho", "grad(|B|)", "iota_r"],
)
def _secular_gbdrift_over_phi(params, transforms, profiles, data, **kwargs):
data["secular(gbdrift)/phi"] = (
data["gbdrift (secular)/phi"] = (
dot(data["b"], cross(data["e^rho"], data["grad(|B|)"]))
* data["iota_r"]
/ data["|B|^2"]
Expand All @@ -2040,10 +2040,10 @@ def _secular_gbdrift_over_phi(params, transforms, profiles, data, **kwargs):
transforms={},
profiles=[],
coordinates="rtz",
data=["periodic(cvdrift)", "secular(gbdrift)"],
data=["periodic(cvdrift)", "gbdrift (secular)"],
)
def _cvdrift(params, transforms, profiles, data, **kwargs):
data["cvdrift"] = data["periodic(cvdrift)"] + data["secular(gbdrift)"]
data["cvdrift"] = data["periodic(cvdrift)"] + data["gbdrift (secular)"]
return data


Expand All @@ -2058,11 +2058,11 @@ def _cvdrift(params, transforms, profiles, data, **kwargs):
transforms={},
profiles=[],
coordinates="rtz",
data=["p_r", "psi_r", "|B|^2", "periodic(gbdrift)"],
data=["p_r", "psi_r", "|B|^2", "gbdrift (periodic)"],
)
def _periodic_cvdrift(params, transforms, profiles, data, **kwargs):
data["periodic(cvdrift)"] = (
mu_0 * data["p_r"] / data["psi_r"] / data["|B|^2"] + data["periodic(gbdrift)"]
mu_0 * data["p_r"] / data["psi_r"] / data["|B|^2"] + data["gbdrift (periodic)"]
)
return data

Expand Down
Binary file modified tests/inputs/master_compute_data_rpz.pkl
Binary file not shown.
14 changes: 7 additions & 7 deletions tests/test_axis_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
"g^ra",
"gbdrift",
"grad(alpha)",
"periodic(grad(alpha))",
"periodic(gbdrift)",
"periodic(cvdrift)",
"grad(alpha) (periodic)",
"gbdrift (periodic)",
"cvdrift (periodic)",
"|e^helical|",
"|grad(theta)|",
"<J*B> Redl", # may not exist for all configurations
Expand Down Expand Up @@ -292,10 +292,10 @@ def test_limit_continuity(self):
"iota_r": {"atol": 1e-6},
"iota_num_rr": {"atol": 5e-5},
"grad(B)": {"rtol": 1e-4},
"secular(alpha_r)": {"atol": 1e-4},
"secular(grad(alpha))": {"atol": 1e-4},
"secular(gbdrift)": {"atol": 1e-4},
"secular(gbdrift)/phi": {"atol": 1e-4},
"alpha_r (secular)": {"atol": 1e-4},
"grad(alpha) (secular)": {"atol": 1e-4},
"gbdrift (secular)": {"atol": 1e-4},
"gbdrift (secular)/phi": {"atol": 1e-4},
}
zero_map = dict.fromkeys(zero_limits, {"desired_at_axis": 0})
kwargs = weaker_tolerance | zero_map
Expand Down
6 changes: 3 additions & 3 deletions tests/test_compute_funs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1555,8 +1555,8 @@ def test_parallel_grad():
"|e_zeta|r,a|_z|r,a",
"B^zeta_z|r,a",
"|B|",
"secular(gbdrift)",
"secular(gbdrift)/phi",
"gbdrift (secular)",
"gbdrift (secular)/phi",
"phi",
],
)
Expand All @@ -1573,5 +1573,5 @@ def test_parallel_grad():
/ data["B^zeta"] ** 2,
)
np.testing.assert_allclose(
data["secular(gbdrift)"], data["secular(gbdrift)/phi"] * data["phi"]
data["gbdrift (secular)"], data["gbdrift (secular)/phi"] * data["phi"]
)

0 comments on commit 76dd4ab

Please sign in to comment.