def test2(): """ using a HPB mesh with surfids, pickling mesh """ from abaqusreader import AbaqusInput model = AbaqusInput("inp/mesh/81fbi.inp") part = model.parts["FB"] # for a better check with multiple sids: #model = AbaqusInput("hpb_draft8.inp") #part = model.parts['P204_noAxKey_V0'.upper()] m1 = MESH(part.nodes, part.elements, part.surfids) with open(PKLFILE, 'wb') as pkl: pickle.dump(m1.get_data(), pkl, pickle.HIGHEST_PROTOCOL) with open(PKLFILE, 'r') as pkl: n, e, s = pickle.load(pkl) m2 = MESH(n, e, s) # check: compare_meshes(part.nodes, part.elements, part.surfids, m2) # make some bodies for a visual check: b1 = BODY(sol, 'RIGID', m1, mat, 'm1') b2 = BODY(sol, 'RIGID', TRANSLATE(m2, (1, 0, 0)), mat, 'm2')
def test09(self): """ .nodesets """ solfec = SOLFEC('DYNAMIC', 1E-3, 'out') m = AbaqusInput('MODEL07.inp', solfec) for inst in m.assembly.instances.values(): coords = [inst.mesh.node(n) for n in range(inst.mesh.nnod)] p = inst.part # checked the solfec node IDs below were right using the Viewer surf001 = [22, 32, 57, 66, 82, 76, 23, 29, 20, 30, 56, 60, 74, 80, 77, 68, 21, 28, 69, 72] surf002 = [10, 22, 42, 48, 57, 76, 104, 11, 14, 18, 8, 20, 43, 49, 53, 55, 68, 96, 88, 78, 100, 9, 12, 16, 70, 84, 92] surf003 = [42, 48, 62, 67, 82, 76, 104, 107, 43, 40, 44, 46, 50, 61, 80, 77, 99, 91, 83, 96, 88, 78, 105, 106, 41, 45, 79, 81, 89, 90, 97, 98] surf4 = [48, 57, 62, 66, 49, 53, 55, 46, 50, 56, 60, 63, 64, 65, 47, 51, 52, 54, 58, 59] self.assertEqual(p.nodesets['SURF001'], surf001) self.assertEqual(p.nodesets['SURF002'], surf002) self.assertEqual(p.nodesets['SURF003'], surf003) self.assertEqual(p.nodesets['SURF4'], surf4)
def test08(self): """ C3D20R elements with surface sets & 2x instances """ solfec = SOLFEC('DYNAMIC', 1E-3, 'out') self.failUnless(isinstance(AbaqusInput('MODEL08.inp', solfec), AbaqusInput))
def test06(self): """ C3D6 and C3D10 elements with surface sets """ solfec = SOLFEC('DYNAMIC', 1E-3, 'out') self.failUnless(isinstance(AbaqusInput('MODEL06.inp', solfec), AbaqusInput))
def test05(self): """ C3D6 elements """ solfec = SOLFEC('DYNAMIC', 1E-3, 'out') m = AbaqusInput('MODEL05.inp', solfec) self.failUnless(isinstance(m, AbaqusInput))
def test04(self): """ C3D10 elements """ solfec = SOLFEC('DYNAMIC', 1E-3, 'out') self.failUnless(isinstance(AbaqusInput('MODEL04.inp', solfec), AbaqusInput))
def test01(self): """ Test we can read the demo .inp which comes with Solfec """ solfec = SOLFEC('DYNAMIC', 1E-3, 'out') m = AbaqusInput('../../../inp/mesh/81array.inp', solfec) # in solfec/inp/mesh self.failUnless(isinstance(m, AbaqusInput))
if RANK () == 0: commands.getoutput ('bunzip2 ' + os.path.join(dirpath,'ts81.py.bz2')) # only first CPU unpacks the input BARRIER () # let all CPUs meet here from ts81 import TS81 # import the time series #This is a velocity-time series, for a 0.3g acceleration sine input at 3Hz, 2s dwell period, the 3Hz to 10Hz dwell sweep at 0.1Hz/s vel = TS81() if RANK () == 0: commands.getoutput ('bzip2 ' + os.path.join(dirpath,'ts81.py')) # only first CPU pack the input # Create a new AbaqusInput object from the .inp deck: model = AbaqusInput(afile, solfec) # read RO bases once if formu == 'RO': for label in ['FB1', 'FB2', 'IB1', 'IB2']: path = afile.replace ('.inp','_' + label + '_base.pickle.gz') try: robase = pickle.load(gzip.open(path, 'rb')) REGISTER_BASE (solfec, robase, label) except: print 'Reading %s failed --> run BC analysis in WRITE and READ modes first' % path sys.exit(0) if formu == 'MODAL' and not genbase: modalbase = {} for label in ['FB1', 'FB2', 'IB1', 'IB2']:
# Example of useage of abaqusreader # run with solfec -v -w example.py # Import the AbaqusInput class from the module: import sys sys.path.append('.') # add working directory to module search path from abaqusreader import AbaqusInput # Create a SOLFEC object for the new model - this is needed by the reader so it can generate materials: solfec = SOLFEC('DYNAMIC', 1E-3, 'out') # Create a new AbaqusInput object from the .inp deck: model = AbaqusInput('tests/MODEL04.inp', solfec) # Create a Finite Element body for each Instance in the Assembly: for inst in model.assembly.instances.values(): # .instances is a dict label = inst.name # use Abaqus instance name mesh = inst.mesh # solfec MESH object at the instance position bulkmat = inst.material # solfec BULK_MATERIAL object bdy = BODY(solfec, 'FINITE_ELEMENT', mesh, bulkmat, label) print model