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

Simplify normalization scales #1192

Merged
merged 11 commits into from
Aug 18, 2024
14 changes: 4 additions & 10 deletions desc/objectives/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,17 @@ def get_lowest_mode(basis, coeffs):

scales["R0"] = R00
scales["a"] = np.sqrt(np.abs(R10 * Z10))
scales["Psi"] = abs(thing.Psi)
scales["n"] = 1e19
ddudt marked this conversation as resolved.
Show resolved Hide resolved
scales["A"] = np.pi * scales["a"] ** 2
scales["V"] = 2 * np.pi * scales["R0"] * scales["A"]
scales["B_T"] = abs(thing.Psi) / scales["A"]
iota_avg = np.mean(np.abs(thing.get_profile("iota")(np.linspace(0, 1, 20))))
if np.isclose(iota_avg, 0):
scales["B_P"] = scales["B_T"]
else:
scales["B_P"] = scales["B_T"] * iota_avg
scales["B"] = np.sqrt(scales["B_T"] ** 2 + scales["B_P"] ** 2)
scales["I"] = scales["B_P"] * 2 * np.pi / mu_0
scales["B"] = scales["Psi"] / scales["A"] * np.sqrt(2)
scales["I"] = scales["B"] * 2 * np.pi / mu_0
scales["p"] = scales["B"] ** 2 / (2 * mu_0)
ddudt marked this conversation as resolved.
Show resolved Hide resolved
scales["W"] = scales["p"] * scales["V"]
ddudt marked this conversation as resolved.
Show resolved Hide resolved
scales["J"] = scales["B"] / scales["a"] / mu_0
scales["F"] = scales["p"] / scales["a"]
ddudt marked this conversation as resolved.
Show resolved Hide resolved
scales["f"] = scales["F"] * scales["V"]
scales["Psi"] = abs(thing.Psi)
scales["n"] = 1e19
scales["T"] = scales["p"] / (scales["n"] * elementary_charge)
ddudt marked this conversation as resolved.
Show resolved Hide resolved

elif isinstance(thing, FourierRZToroidalSurface):
Expand Down
Loading