Skip to content

Commit

Permalink
formatting changes to reduce number of lines of code
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-dudt committed Apr 5, 2024
1 parent 6318ec9 commit 0d84c4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 30 deletions.
18 changes: 3 additions & 15 deletions desc/objectives/_coils.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ class QuadraticFlux(_Objective):

_scalar = False
_linear = False
_print_value_fmt = "Boundary normal field Error: {:10.3e} "
_print_value_fmt = "Boundary normal field error: {:10.3e} "
_units = "(T m^2)"
_coordinates = "rtz"

Expand Down Expand Up @@ -717,13 +717,7 @@ def build(self, use_jit=True, verbose=1):
else:
eval_grid = self._eval_grid

self._data_keys = [
"R",
"Z",
"n_rho",
"phi",
"|e_theta x e_zeta|",
]
self._data_keys = ["R", "Z", "n_rho", "phi", "|e_theta x e_zeta|"]

timer = Timer()
if verbose > 0:
Expand Down Expand Up @@ -796,13 +790,7 @@ def compute(self, field_params, constants=None):
eval_data = constants["eval_data"]
B_plasma = constants["B_plasma"]

x = jnp.array(
[
eval_data["R"],
eval_data["phi"],
eval_data["Z"],
]
).T
x = jnp.array([eval_data["R"], eval_data["phi"], eval_data["Z"]]).T

# B_ext is not pre-computed because field is not fixed
B_ext = constants["field"].compute_magnetic_field(
Expand Down
17 changes: 2 additions & 15 deletions desc/singularities.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,16 +834,7 @@ def compute_B_plasma(eq, eval_grid, source_grid=None, normal_only=False):
sym=False,
)

data_keys = [
"K_vc",
"B",
"R",
"phi",
"Z",
"e^rho",
"n_rho",
"|e_theta x e_zeta|",
]
data_keys = ["K_vc", "B", "R", "phi", "Z", "e^rho", "n_rho", "|e_theta x e_zeta|"]
eval_data = eq.compute(data_keys, grid=eval_grid)
source_data = eq.compute(data_keys, grid=source_grid)

Expand All @@ -860,11 +851,7 @@ def compute_B_plasma(eq, eval_grid, source_grid=None, normal_only=False):
interpolator = DFTInterpolator(eval_grid, source_grid, s, q)
if hasattr(eq.surface, "Phi_mn"):
source_data["K_vc"] += eq.surface.compute("K", grid=source_grid)["K"]
Bplasma = virtual_casing_biot_savart(
eval_data,
source_data,
interpolator,
)
Bplasma = virtual_casing_biot_savart(eval_data, source_data, interpolator)
# need extra factor of B/2 bc we're evaluating on plasma surface
Bplasma = Bplasma + eval_data["B"] / 2
if normal_only:
Expand Down

0 comments on commit 0d84c4e

Please sign in to comment.