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

HeatingPower objective #1168

Merged
merged 35 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
137859f
initial commit of HeatingPower objective
daniel-dudt Aug 6, 2024
551e906
compute quantity for ni
daniel-dudt Aug 6, 2024
04184af
add <ne>_rho compute quantity
daniel-dudt Aug 6, 2024
5609439
add iota_23 compute quantity
daniel-dudt Aug 6, 2024
515850f
rename 'B0' to 'psi_r/sqrt(g)'
daniel-dudt Aug 6, 2024
e09710d
add new B0 compute quantity
daniel-dudt Aug 6, 2024
a4a5184
update HeatingPower objective
daniel-dudt Aug 6, 2024
8bbba7b
Merge branch 'master' into dd/iss04
ddudt Aug 15, 2024
d97ecfe
rename 'B0' to '<|B|>_axis'
daniel-dudt Aug 15, 2024
b228a5a
make it JAX compatible
daniel-dudt Aug 15, 2024
e51aba1
add normalization
daniel-dudt Aug 15, 2024
039e854
repair tests
daniel-dudt Aug 16, 2024
efde8bc
making Rory's requested changes
daniel-dudt Aug 16, 2024
05047e7
remove unneeded line from test
daniel-dudt Aug 16, 2024
bf9c683
exclude P_ISS04 from axis limit tests
daniel-dudt Aug 16, 2024
3fa64df
more requested changes
daniel-dudt Aug 16, 2024
d4e292e
update label for '<ne>_rho'
daniel-dudt Aug 16, 2024
0eca4f3
Merge branch 'master' into dd/iss04
ddudt Aug 16, 2024
9017d47
update line-average to work with 3D profile
daniel-dudt Aug 16, 2024
7e48df5
rename fx kwarg
daniel-dudt Aug 16, 2024
6267710
Merge branch 'master' into dd/iss04
ddudt Aug 18, 2024
40345c1
Merge branch 'master' into dd/iss04
ddudt Aug 18, 2024
5a959f6
update formula and normalization
daniel-dudt Aug 19, 2024
26f740e
Merge branch 'master' into dd/iss04
dpanici Aug 20, 2024
e5763d9
Merge branch 'master' into dd/iss04
ddudt Aug 22, 2024
1975d73
switch to volume average density
daniel-dudt Aug 22, 2024
19c3d31
update master_compute_data
daniel-dudt Aug 22, 2024
3434eab
update ne_vol function name
daniel-dudt Aug 22, 2024
ec972c4
remove line average test
daniel-dudt Aug 22, 2024
8663b1a
Merge branch 'master' into dd/iss04
ddudt Aug 22, 2024
00bf8ce
Merge branch 'master' into dd/iss04
ddudt Aug 22, 2024
5f4aa26
Merge branch 'master' into dd/iss04
ddudt Aug 22, 2024
de5210f
Merge branch 'master' into dd/iss04
ddudt Aug 23, 2024
a0ce1e3
improved formatting of equation
daniel-dudt Aug 23, 2024
07366ef
Merge branch 'master' into dd/iss04
ddudt Aug 25, 2024
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
40 changes: 40 additions & 0 deletions desc/compute/_equil.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
expensive computations.
"""

from interpax import interp1d
from scipy.constants import mu_0

from desc.backend import jnp
Expand Down Expand Up @@ -803,3 +804,42 @@ def _beta_volpol(params, transforms, profiles, data, **kwargs):
def _beta_voltor(params, transforms, profiles, data, **kwargs):
data["<beta_tor>_vol"] = jnp.abs(data["W_p"] / data["W_Btor"])
return data


@register_compute_fun(
name="P_ISS04",
label="P_{ISS04}",
units="W",
units_long="Watts",
description="Heating power required by the ISS04 energy confinement time scaling",
dim=0,
params=[],
transforms={"grid": []},
profiles=[],
coordinates="",
data=["a", "iota", "rho", "R0", "W_p", "<ne>_vol", "<|B|>_axis"],
method="str: Interpolation method. Default 'cubic'.",
H_ISS04="float: ISS04 confinement enhancement factor. Default 1.",
)
def _P_ISS04(params, transforms, profiles, data, **kwargs):
rho = transforms["grid"].compress(data["rho"], surface_label="rho")
iota = transforms["grid"].compress(data["iota"], surface_label="rho")
fx = {}
if "iota_r" in data:
fx["fx"] = transforms["grid"].compress(
data["iota_r"]
) # noqa: unused dependency
iota_23 = interp1d(2 / 3, rho, iota, method=kwargs.get("method", "cubic"), **fx)
data["P_ISS04"] = 1e6 * ( # MW -> W
jnp.abs(data["W_p"] / 1e6) # J -> MJ
/ (
0.134
* data["a"] ** 2.28 # m
* data["R0"] ** 0.64 # m
* (data["<ne>_vol"] / 1e19) ** 0.54 # 1/m^3 -> 1e19/m^3
unalmis marked this conversation as resolved.
Show resolved Hide resolved
* data["<|B|>_axis"] ** 0.84 # T
* iota_23**0.41
* kwargs.get("H_ISS04", 1)
)
) ** (1 / 0.39)
unalmis marked this conversation as resolved.
Show resolved Hide resolved
return data
Loading
Loading