Skip to content

Commit

Permalink
Removed m_maxima kwarg from grid
Browse files Browse the repository at this point in the history
  • Loading branch information
WillhHoffman committed Aug 7, 2024
1 parent 87d2fac commit 3546bc9
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions examples/2_Intermediate/permanent_magnet_PM4Stell.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@
max_nMagnets = 20
downsample = 100 # drastically downsample the grid if running CI
else:
N = 32 # >= 64 for high-resolution runs
nIter_max = 10000
N = 16 # >= 64 for high-resolution runs
nIter_max = 100000
max_nMagnets = 10000
downsample = 10
downsample = 1

nphi = N
ntheta = N
algorithm = 'ArbVec_backtracking'
nBacktracking = 200
nAdjacent = 10
thresh_angle = np.pi # / np.sqrt(2)
nHistory = 10
nHistory = 100
angle = int(thresh_angle * 180 / np.pi)
out_dir = Path("PM4Stell")
out_dir = Path("PM4Stell_angle{angle}_nb{nBacktracking)_na{nAdjacent}")
out_dir.mkdir(parents=True, exist_ok=True)
print('out directory = ', out_dir)

Expand Down Expand Up @@ -143,10 +143,7 @@
pol_vectors[:, :, 2] = mag_data.pol_z

# Using m_maxima functionality to try out unrealistically strong magnets
B_max = 5 # 5 Tesla!!!!
mu0 = 4 * np.pi * 1e-7
m_maxima = B_max / mu0
kwargs_geo = {"pol_vectors": pol_vectors, "m_maxima": m_maxima, "downsample": downsample}
kwargs_geo = {"pol_vectors": pol_vectors, "downsample": downsample}

# Initialize the permanent magnet grid from the PM4Stell arrangement
pm_ncsx = PermanentMagnetGrid.geo_setup_from_famus(
Expand Down Expand Up @@ -200,7 +197,7 @@
nmags = m_history.shape[0]
nhist = m_history.shape[2]
m_history_2d = m_history.reshape((nmags*m_history.shape[1], nhist))
np.savetxt(out_dir / 'm_history.txt', m_history_2d)
np.savetxt(out_dir / 'm_history_nmags={nmags}_nhist={nhist}.txt', m_history_2d)
t_end = time.time()
print('Script took in total t = ', t_end - t_start, ' s')

Expand Down

0 comments on commit 3546bc9

Please sign in to comment.