MSRE/scripts/step_to_h5m.py

46 lines
1.5 KiB
Python
Raw Permalink Normal View History

2022-07-21 14:31:53 +02:00
###############################################################################
# Converting step files to h5m file to be read by openmc
###############################################################################
import numpy as np
import os
import sys
sys.path.append('../CAD_to_openMC/src/')
import CAD_to_OpenMC.assembly as ab
###############################################################################
# inputs
step_filepath = "./step_files/msre_parts.step"
2022-07-21 14:31:53 +02:00
h5m_out_filepath = os.getcwd() + '/h5m_files/msre.h5m'
# mesher config
ab.mesher_config['min_mesh_size'] = 0.2
2022-07-28 11:10:29 +02:00
ab.mesher_config['mesh_algorithm'] = 4
2022-11-03 08:05:05 +01:00
ab.mesher_config['threads'] = 32
2022-07-21 14:31:53 +02:00
#ab.mesher_config['max_mesh_size'] = 1000
#ab.mesher_config['curve_samples'] = 100
#ab.mesher_config['vetoed'] = [474,1157,1243,1341,1537]
#ab.mesher_config['angular_tolerance'] = 0.09
#ab.mesher_config['tolerance'] = 0.001
2022-11-03 08:05:05 +01:00
ab.mesher_config['refine']=False
2022-07-21 14:31:53 +02:00
# output
a=ab.Assembly()
2022-11-03 08:05:05 +01:00
a.remove_intermediate_files=True
2022-07-21 14:31:53 +02:00
a.stp_files=[step_filepath]
tags={'hold-down.*':'graphite',\
'thimble.*':'inor', 'core\ support':'graphite',\
'graphite':'graphite',\
'core.*':'inor',\
2022-11-03 08:05:05 +01:00
'vessel':'inconel',\
'.*stringer.*':'graphite',\
'inor.*':'inor',\
2022-11-03 08:05:05 +01:00
'(bottom|top|basket)':'inconel',\
'(lower|upper) lattice':'graphite',\
'lifting stud':'inor',\
'distributor':'inor',\
'restrictor':'inor',\
'(support|lower) ring':'inor',\
'^(left|right|back|front)$':'graphite',\
'.*grid support':'inor'}
a.import_stp_files(tags=tags, match_anywhere=True)
2022-07-21 14:31:53 +02:00
a.solids_to_h5m(backend='gmsh',h5m_filename=h5m_out_filepath)