diff --git a/desc/compute/_basis_vectors.py b/desc/compute/_basis_vectors.py index 04302bab9..dd0b24469 100644 --- a/desc/compute/_basis_vectors.py +++ b/desc/compute/_basis_vectors.py @@ -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", @@ -3244,11 +3244,11 @@ 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 @@ -3256,7 +3256,7 @@ def _periodic_grad_alpha(params, transforms, profiles, data, **kwargs): @register_compute_fun( - name="secular(grad(alpha))", + name="grad(alpha) (secular)", label="\\mathrm{secular}(\\nabla \\alpha)", units="m^{-1}", units_long="Inverse meters", @@ -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 diff --git a/desc/compute/_core.py b/desc/compute/_core.py index ef0466f8b..c6651c834 100644 --- a/desc/compute/_core.py +++ b/desc/compute/_core.py @@ -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", @@ -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", @@ -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 diff --git a/desc/compute/_metric.py b/desc/compute/_metric.py index 8aad617e3..e2ac6b1a8 100644 --- a/desc/compute/_metric.py +++ b/desc/compute/_metric.py @@ -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", @@ -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", @@ -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", @@ -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"] @@ -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 @@ -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 diff --git a/tests/inputs/master_compute_data_rpz.pkl b/tests/inputs/master_compute_data_rpz.pkl index dee179264..28bf91d6c 100644 Binary files a/tests/inputs/master_compute_data_rpz.pkl and b/tests/inputs/master_compute_data_rpz.pkl differ diff --git a/tests/test_axis_limits.py b/tests/test_axis_limits.py index 4e02eb775..c02bf4ff1 100644 --- a/tests/test_axis_limits.py +++ b/tests/test_axis_limits.py @@ -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)|", " Redl", # may not exist for all configurations @@ -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 diff --git a/tests/test_compute_funs.py b/tests/test_compute_funs.py index 030e4eedc..752cfdcc8 100644 --- a/tests/test_compute_funs.py +++ b/tests/test_compute_funs.py @@ -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", ], ) @@ -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"] )