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

Create magnet tet mesh via Cubit and mbconvert #38

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Changes from all commits
Commits
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
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