Skip to content

Commit

Permalink
Finished up the TVE scan.
Browse files Browse the repository at this point in the history
  • Loading branch information
akaptano committed Dec 18, 2024
1 parent d0d729f commit 220c0d6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
4 changes: 2 additions & 2 deletions examples/3_Advanced/coil_force_optimization/analysis_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ def get_dfs(INPUT_DIR='./output/QA/with-force-penalty/1/optimizations/', OUTPUT_
f"and max_arclength_variance < 1e-2"
f"and coil_surface_distance < 0.375"
f"and coil_coil_distance < 0.15"
f"and max_length > 3.5"
f"and max_length > 3.0"
f"and normalized_BdotN < {4e-2}"
f"and max_max_force<60000"
f"and max_max_force<50000"
)

### STEP 3: Generate Pareto front and export UUIDs as .txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,34 @@
# import imageio
import matplotlib.pyplot as plt

INPUT_DIR = "./output/QA/TVE_new/"
INPUT_DIR = "./output/QA/TVE_fix/"
df, df_filtered, df_pareto = get_dfs(INPUT_DIR=INPUT_DIR)
success_plt(df, df_filtered).show()
df, df_filtered, df_pareto = get_dfs(INPUT_DIR=INPUT_DIR)

#df_filtered = df
#df_pareto = df
y_axes = ["tve"] #, "mean_RMS_force", "max_max_torque", "mean_RMS_torque", "net_forces", "net_torques"]
labels = ["Total Vacuum Magnetic Energy [J]"] #, "mean force [N/m]", "max torque [N]", "mean torque [N]", "net force [N]", "net torque [N-m]"]
y_lims = [(7500, 30000)] #, (5500, 10000), (5000, 30000), (2000, 6200), (4000, 13000), (5e2, 7000)]
#keys = ["coil_coil_distance"]
y_lims = [(20000, 60000)] #, (5500, 10000), (5000, 30000), (2000, 6200), (4000, 13000), (5e2, 7000)]
#keys = ["mean_RMS_force"]
#keys = ["mean_RMS_torque"]
#keys = ["max_max_torque"]
#keys = ["max_max_force"]
#keys = ["max_MSC"]
#keys = ["max_length"]
#keys = ["max_max_κ"]
keys = ["max_max_κ"]
#keys = ["force_threshold"]
#['max_max_torque']
keys = ['length_target', 'length_weight', 'max_κ_threshold', 'max_κ_weight',
'msc_threshold', 'msc_weight', 'cc_threshold', 'cc_weight',
'cs_threshold', 'cs_weight', 'force_threshold', 'force_weight',
'arclength_weight', 'JF', 'Jf', 'gradient_norm',
'max_length', 'max_max_κ','max_MSC',
'max_max_force', 'min_min_force',
'mean_RMS_force',
'max_max_torque', 'min_min_torque',
'mean_RMS_torque', 'max_arclength_variance',
'BdotN', 'mean_AbsB', 'normalized_BdotN', 'coil_coil_distance',
'coil_surface_distance']
#keys = ['length_target', 'length_weight', 'max_κ_threshold', 'max_κ_weight',
# 'msc_threshold', 'msc_weight', 'cc_threshold', 'cc_weight',
# 'cs_threshold', 'cs_weight', 'force_threshold', 'force_weight',
# 'arclength_weight', 'JF', 'Jf', 'gradient_norm',
# 'max_length', 'max_max_κ','max_MSC',
# 'max_max_force', 'min_min_force',
# 'mean_RMS_force',
# 'max_max_torque', 'min_min_torque',
# 'mean_RMS_torque', 'max_arclength_variance',
# 'BdotN', 'mean_AbsB', 'normalized_BdotN', 'coil_coil_distance',
# 'coil_surface_distance']
for color in keys:
print(color)
for y_axis, label, y_lim in zip(y_axes, labels, y_lims):
Expand Down Expand Up @@ -102,13 +104,13 @@
)
plt.xlabel(r'$\langle|\mathbf{B}\cdot\mathbf{n}|\rangle/\langle B \rangle$ [unitless]')
plt.ylabel(label)
plt.xlim(0.5 * min(df_filtered["normalized_BdotN"]), max(df_filtered["normalized_BdotN"]))
plt.xlim(0.7 * min(df_filtered["normalized_BdotN"]), max(df_filtered["normalized_BdotN"]))
plt.ylim(y_lim)
plt.xscale("log")
#if y_lim[0] < 1:
# plt.yscale("log")
plt.colorbar(label=color_label)
#plt.clim(0.17, 0.31)
plt.clim(3.0, 6.0)
# plt.clim(3.5, 6.5)
# plt.clim(6e3, 2e4)
#plt.clim(3.5, 4.8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def initial_optimizations(N=10000, with_force=True, MAXITER=14000,
if with_force:
# (1e-20, 1e-8) for Squared forces
# (1e-14, 1e-5) for Lpforces or TVE
FORCE_WEIGHT = 10.0 ** rand(-11, -6)
FORCE_WEIGHT = 10.0 ** rand(-13, -8)
else:
FORCE_WEIGHT = 0

Expand Down

0 comments on commit 220c0d6

Please sign in to comment.