Skip to content

Commit

Permalink
Merge pull request #38 from connoramoreno/magnet_mesh
Browse files Browse the repository at this point in the history
Create magnet tet mesh via Cubit and mbconvert
  • Loading branch information
gonuke authored Feb 20, 2024
2 parents 5eea5aa + 46b70b3 commit d8763ee
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions magnet_coils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from sklearn.preprocessing import normalize
import os
from pathlib import Path
import subprocess


def mesh_magnets(vol_ids, export_dir, logger):
Expand All @@ -28,13 +29,10 @@ def mesh_magnets(vol_ids, export_dir, logger):
h5m_path = Path(export_dir) / 'coil_mesh.h5m'

# EXODUS export
cubit.cmd(f'export mesh "{exo_path}"')
cubit.cmd(f'export mesh "{exo_path}" overwrite')

# Convert EXODUS to H5M
mb = core.Core()
exodus_set = mb.create_meshset()
mb.load_file(str(exo_path), exodus_set)
mb.write_file(str(h5m_path), [exodus_set])
subprocess.run(f'mbconvert {exo_path} {h5m_path}', shell = True)


def cut_mags(tor_ext, vol_ids, r_avg):
Expand Down

0 comments on commit d8763ee

Please sign in to comment.