def __init__(self, card=None, data=None, comment=''): if comment: self._comment = comment if card: self.nid = integer(card, 1, 'nid') self.ninc = integer_or_blank(card, 2, 'ninc', 10) self.dt = double_or_blank(card, 3, 'dt', 0.0) self.kMethod = string_or_blank(card, 4, 'kMethod', 'AUTO') self.kStep = integer_or_blank(card, 5, 'kStep', 5) self.maxIter = integer_or_blank(card, 6, 'maxIter', 25) self.conv = string_or_blank(card, 7, 'conv', 'PW') self.intOut = string_or_blank(card, 8, 'intOut', 'NO') # line 2 self.epsU = double_or_blank(card, 9, 'epsU', 0.01) self.epsP = double_or_blank(card, 10, 'epsP', 0.01) self.epsW = double_or_blank(card, 11, 'epsW', 0.01) self.maxDiv = integer_or_blank(card, 12, 'maxDiv', 3) if self.kMethod == 'PFNT': self.maxQn = integer_or_blank(card, 13, 'maxQn', 0) else: self.maxQn = integer_or_blank(card, 13, 'maxQn', self.maxIter) self.maxLs = integer_or_blank(card, 14, 'maxLs', 4) self.fStress = double_or_blank(card, 15, 'fStress', 0.2) self.lsTol = double_or_blank(card, 16, 'lsTol', 0.5) # line 3 self.maxBisect = integer_or_blank(card, 17, '', 5) self.maxR = double_or_blank(card, 21, 'maxR', 20.) self.rTolB = double_or_blank(card, 23, 'rTolB', 20.) assert len(card) <= 24, 'len(NLPARM card) = %i' % len(card) else: (sid, ninc, dt, kMethod, kStep, maxIter, conv, intOut, epsU, epsP, epsW, maxDiv, maxQn, maxLs, fStress, lsTol, maxBisect, maxR, rTolB) = data self.nid = sid self.ninc = ninc self.dt = dt self.kMethod = kMethod self.kStep = kStep self.maxIter = maxIter self.conv = conv self.intOut = intOut # line 2 self.epsU = epsU self.epsP = epsP self.epsW = epsW self.maxDiv = maxDiv self.maxQn = maxQn self.maxLs = maxLs self.fStress = fStress self.lsTol = lsTol # line 3 self.maxBisect = maxBisect self.maxR = maxR self.rTolB = rTolB
def __init__(self, card=None, data=None, comment=''): RandomTable.__init__(self, card, data) if comment: self._comment = comment if card: self.tid = integer(card, 1, 'tid') self.xaxis = string_or_blank(card, 2, 'xaxis', 'LINEAR') self.yaxis = string_or_blank(card, 3, 'yaxis', 'LINEAR') nfields = len(card) - 1 nterms = (nfields - 9) // 2 if nterms < 0: raise SyntaxError('%r card is too short' % self.type) xy = [] for i in range(nterms): n = 9 + i * 2 if card.field(n) == 'ENDT': break x = double(card, n, 'x' + str(i + 1)) y = double(card, n + 1, 'y' + str(i + 1)) xy += [x, y] ENDT = string(card, nfields, 'ENDT') isData = False else: self.tid = data[0] self.xaxis = self.map_axis(data[1]) self.yaxis = self.map_axis(data[2]) xy = data[3:] isData = True assert self.xaxis in ['LINEAR', 'LOG'], 'xaxis=|%s|' % (self.xaxis) assert self.yaxis in ['LINEAR', 'LOG'], 'yaxis=|%s|' % (self.yaxis) self.parse_fields(xy, nrepeated=2, isData=isData)
def add(self, card=None, comment=''): if comment: self._comment = comment self.nlparm_id = integer(card, 1, 'nlparm_id') self.ninc = integer_or_blank(card, 2, 'ninc', 10) self.dt = double_or_blank(card, 3, 'dt', 0.0) self.kMethod = string_or_blank(card, 4, 'kMethod', 'AUTO') self.kStep = integer_or_blank(card, 5, 'kStep', 5) self.maxIter = integer_or_blank(card, 6, 'maxIter', 25) self.conv = string_or_blank(card, 7, 'conv', 'PW') self.intOut = string_or_blank(card, 8, 'intOut', 'NO') # line 2 self.epsU = double_or_blank(card, 9, 'epsU', 0.01) self.epsP = double_or_blank(card, 10, 'epsP', 0.01) self.epsW = double_or_blank(card, 11, 'epsW', 0.01) self.maxDiv = integer_or_blank(card, 12, 'maxDiv', 3) if self.kMethod == 'PFNT': self.maxQn = integer_or_blank(card, 13, 'maxQn', 0) else: self.maxQn = integer_or_blank(card, 13, 'maxQn', self.maxIter) self.maxLs = integer_or_blank(card, 14, 'maxLs', 4) self.fStress = double_or_blank(card, 15, 'fStress', 0.2) self.lsTol = double_or_blank(card, 16, 'lsTol', 0.5) # line 3 self.maxBisect = integer_or_blank(card, 17, '', 5) self.maxR = double_or_blank(card, 21, 'maxR', 20.) self.rTolB = double_or_blank(card, 23, 'rTolB', 20.) assert len(card) <= 24, 'len(NLPARM card) = %i' % len(card)
def add(self, card=None, comment=''): if comment: self._comment = comment self.nlparm_id = integer(card, 1, 'nlparm_id') self.ninc = integer_or_blank(card, 2, 'ninc', 10) self.dt = double_or_blank(card, 3, 'dt', 0.0) self.kMethod = string_or_blank(card, 4, 'kMethod', 'AUTO') self.kStep = integer_or_blank(card, 5, 'kStep', 5) self.maxIter = integer_or_blank(card, 6, 'maxIter', 25) self.conv = string_or_blank(card, 7, 'conv', 'PW') self.intOut = string_or_blank(card, 8, 'intOut', 'NO') # line 2 self.epsU = double_or_blank(card, 9, 'epsU', 0.01) self.epsP = double_or_blank(card, 10, 'epsP', 0.01) self.epsW = double_or_blank(card, 11, 'epsW', 0.01) self.maxDiv = integer_or_blank(card, 12, 'maxDiv', 3) if self.kMethod == 'PFNT': self.maxQn = integer_or_blank(card, 13, 'maxQn', 0) else: self.maxQn = integer_or_blank(card, 13, 'maxQn', self.maxIter) self.maxLs = integer_or_blank(card, 14, 'maxLs', 4) self.fStress = double_or_blank(card, 15, 'fStress', 0.2) self.lsTol = double_or_blank(card, 16, 'lsTol', 0.5) # line 3 self.maxBisect = integer_or_blank(card, 17, '', 5) self.maxR = double_or_blank(card, 21, 'maxR', 20.) self.rTolB = double_or_blank(card, 23, 'rTolB', 20.) assert len(card) <= 24, 'len(NLPARM card) = %i' % len(card)
def __init__(self, card=None, data=None, comment=''): if comment: self._comment = comment if card: #: CRID Contact region ID. (Integer > 0) self.crid = integer(card, 1, 'crid') #: SURF Indicates the contact side. See Remark 1. (Character = "TOP" or #: "BOT"; Default = "TOP") self.surf = string_or_blank(card, 2, 'surf', 'TOP') #: Offset distance for the contact region. See Remark 2. (Real > 0.0, #: Default =OFFSET value in BCTPARA entry) self.offset = double_or_blank(card, 3, 'offset') #: Indicates whether a contact region is a rigid surface if it is used as a #: target region. See Remarks 3 and 4. (Character = "RIGID" or "FLEX", #: Default = "FLEX"). This is not supported for SOL 101. self.Type = string_or_blank(card, 4, 'type', 'FLEX') #: Master grid point for a target contact region with TYPE=RIGID or #: when the rigid-target algorithm is used. The master grid point may be #: used to control the motion of a rigid surface. (Integer > 0,; Default = 0) #: This is not supported for SOL 101. self.mgp = integer_or_blank(card, 5, 'mpg', 0) else: msg = '%s has not implemented data parsing' % self.type raise NotImplementedError(msg)
def __init__(self, card=None, data=None, comment=''): """ Intilizes the CORD3G :param self: the CORD3G coordinate system object :param card: a list version of the fields """ if comment: self._comment = comment Coord.__init__(self, card, data) self.cid = integer(card, 1, 'cid') method = string_or_blank(card, 2, 'E313') self.methodES = method[0] self.methodInt = int(method[1:]) assert self.methodES in ['E', 'S'] # Euler / Space-Fixed assert 0 < self.methodInt < 1000 self.form = string_or_blank(card, 3, 'form', 'EQN') self.thetas = [integer(card, 4, 'theta1'), integer(card, 5, 'theta2'), integer(card, 6, 'theta3')] assert len(self.thetas) == 3, 'thetas=%s' % (self.thetas) self.rid = integer_or_blank(card, 7, 'cidRef') assert len(card) <= 8, 'len(CORD3G card) = %i' % len(card) # EQN for DEQATN, TABLE for TABLE3D assert self.form in ['EQN', 'TABLE']
def __init__(self, card=None, data=None, comment=''): if comment: self._comment = comment if card: self.nid = integer(card, 1, 'nid') self.ninc = integer_or_blank(card, 2, 'ninc', 10) self.dt = double_or_blank(card, 3, 'dt', 0.0) self.kMethod = string_or_blank(card, 4, 'kMethod', 'AUTO') self.kStep = integer_or_blank(card, 5, 'kStep', 5) self.maxIter = integer_or_blank(card, 6, 'maxIter', 25) self.conv = string_or_blank(card, 7, 'conv', 'PW') self.intOut = string_or_blank(card, 8, 'intOut', 'NO') # line 2 self.epsU = double_or_blank(card, 9, 'epsU', 0.01) self.epsP = double_or_blank(card, 10, 'epsP', 0.01) self.epsW = double_or_blank(card, 11, 'epsW', 0.01) self.maxDiv = integer_or_blank(card, 12, 'maxDiv', 3) if self.kMethod == 'PFNT': self.maxQn = integer_or_blank(card, 13, 'maxQn', 0) else: self.maxQn = integer_or_blank(card, 13, 'maxQn', self.maxIter) self.maxLs = integer_or_blank(card, 14, 'maxLs', 4) self.fStress = double_or_blank(card, 15, 'fStress', 0.2) self.lsTol = double_or_blank(card, 16, 'lsTol', 0.5) # line 3 self.maxBisect = integer_or_blank(card, 17, '', 5) self.maxR = double_or_blank(card, 21, 'maxR', 20.) self.rTolB = double_or_blank(card, 23, 'rTolB', 20.) assert len(card) <= 24, 'len(NLPARM card) = %i' % len(card) else: (sid, ninc, dt, kMethod, kStep, maxIter, conv, intOut, epsU, epsP, epsW, maxDiv, maxQn, maxLs, fStress, lsTol, maxBisect, maxR, rTolB) = data self.nid = sid self.ninc = ninc self.dt = dt self.kMethod = kMethod self.kStep = kStep self.maxIter = maxIter self.conv = conv self.intOut = intOut # line 2 self.epsU = epsU self.epsP = epsP self.epsW = epsW self.maxDiv = maxDiv self.maxQn = maxQn self.maxLs = maxLs self.fStress = fStress self.lsTol = lsTol # line 3 self.maxBisect = maxBisect self.maxR = maxR self.rTolB = rTolB
def __init__(self, card=None, data=None, comment=''): """ Intilizes the CORD3G :param self: the CORD3G coordinate system object :param card: a list version of the fields """ Coord.__init__(self, card, data, comment) self.cid = integer(card, 1, 'cid') method = string_or_blank(card, 2, 'E313') self.methodES = method[0] self.methodInt = int(method[1:]) assert self.methodES in ['E', 'S'] # Euler / Space-Fixed assert 0 < self.methodInt < 1000 self.form = string_or_blank(card, 3, 'form', 'EQN') self.thetas = [ integer(card, 4, 'theta1'), integer(card, 5, 'theta2'), integer(card, 6, 'theta3') ] assert len(self.thetas) == 3, 'thetas=%s' % (self.thetas) self.rid = integer_or_blank(card, 7, 'cidRef') assert len(card) <= 8, 'len(CORD3G card) = %i' % len(card) # EQN for DEQATN, TABLE for TABLE3D assert self.form in ['EQN', 'TABLE']
def __init__(self, card=None, data=None, comment=''): RandomTable.__init__(self, card, data) if comment: self._comment = comment if card: self.tid = integer(card, 1, 'tid') self.xaxis = string_or_blank(card, 2, 'xaxis', 'LINEAR') self.yaxis = string_or_blank(card, 3, 'yaxis', 'LINEAR') nfields = len(card) - 1 nterms = (nfields - 9) // 2 if nterms < 0: raise SyntaxError('%r card is too short' % self.type) xy = [] for i in range(nterms): n = 9 + i * 2 if card.field(n) == 'ENDT': break x = double(card, n, 'x' + str(i + 1)) y = double(card, n + 1, 'y' + str(i + 1)) xy += [x, y] string(card, nfields, 'ENDT') isData = False else: self.tid = data[0] self.xaxis = self.map_axis(data[1]) self.yaxis = self.map_axis(data[2]) xy = data[3:] isData = True assert self.xaxis in ['LINEAR', 'LOG'], 'xaxis=|%s|' % (self.xaxis) assert self.yaxis in ['LINEAR', 'LOG'], 'yaxis=|%s|' % (self.yaxis) self.parse_fields(xy, nrepeated=2, isData=isData)
def __init__(self, card=None, data=None, comment=''): if comment: self._comment = comment if card: #: CRID Contact region ID. (Integer > 0) self.crid = integer(card, 1, 'crid') #: SURF Indicates the contact side. See Remark 1. (Character = "TOP" or #: "BOT"; Default = "TOP") self.surf = string_or_blank(card, 2, 'surf', 'TOP') #: Offset distance for the contact region. See Remark 2. (Real > 0.0, #: Default =OFFSET value in BCTPARA entry) self.offset = double_or_blank(card, 3, 'offset') #: Indicates whether a contact region is a rigid surface if it is used as a #: target region. See Remarks 3 and 4. (Character = "RIGID" or "FLEX", #: Default = "FLEX"). This is not supported for SOL 101. self.Type = string_or_blank(card, 4, 'type', 'FLEX') #: Master grid point for a target contact region with TYPE=RIGID or #: when the rigid-target algorithm is used. The master grid point may be #: used to control the motion of a rigid surface. (Integer > 0,; Default = 0) #: This is not supported for SOL 101. self.mgp = integer_or_blank(card, 5, 'mpg', 0) else: msg = '%s has not implemented data parsing' % self.type raise NotImplementedError(msg)
def __init__(self, card=None, data=None, comment=''): if comment: self._comment = comment if card: self.sid = integer(card, 1, 'sid') self.eid = integer(card, 2, 'eid') p1 = double_or_blank(card, 3, 'p1', 0.0) p = [p1, double_or_blank(card, 4, 'p2', p1), double_or_blank(card, 5, 'p3', p1), double_or_blank(card, 6, 'p4', p1)] self.pressures = p self.eids = [self.eid] if (integer_string_or_blank(card, 7, 'g1/THRU') == 'THRU' and integer_or_blank(card, 8, 'eid2')): # plates eid2 = integer(card, 8, 'eid2') if eid2: self.eids = expand_thru([self.eid, 'THRU', eid2]) self.g1 = None self.g34 = None else: #: used for CPENTA, CHEXA self.eids = [self.eid] #: used for solid element only self.g1 = integer_or_blank(card, 7, 'g1') #: g3/g4 - different depending on CHEXA/CPENTA or CTETRA self.g34 = integer_or_blank(card, 8, 'g34') #: Coordinate system identification number. See Remark 2. #: (Integer >= 0;Default=0) self.cid = integer_or_blank(card, 9, 'cid', 0) #print "PLOAD4 cid = ",self.cid self.NVector = array([double_or_blank(card, 10, 'N1', 0.0), double_or_blank(card, 11, 'N2', 0.0), double_or_blank(card, 12, 'N3', 0.0)]) self.sorl = string_or_blank(card, 13, 'sorl', 'SURF') self.ldir = string_or_blank(card, 14, 'ldir', 'NORM') assert len(card) <= 15, 'len(PLOAD4 card) = %i' % len(card) else: #print "PLOAD4 = ",data self.sid = data[0] self.eid = data[1] self.pressures = data[2] self.g1 = data[3] self.g34 = data[4] self.cid = data[5] self.NVector = data[6] self.sorl = data[7] #self.ldir = data[8] #assert len(data)==8 self.g1 = self.g1 self.g34 = self.g34 self.eids = [self.eid]
def __init__(self, card=None, data=None, comment=''): ShellProperty.__init__(self, card, data) if comment: self._comment = comment if card: self.pid = integer(card, 1, 'pid') # z0 will be calculated later self.nsm = double_or_blank(card, 3, 'nsm', 0.0) self.sb = double_or_blank(card, 4, 'sb', 0.0) self.ft = string_or_blank(card, 5, 'ft') assert self.ft in ['HILL', 'HOFF', 'TSAI', 'STRN', None] self.TRef = double_or_blank(card, 6, 'TRef', 0.0) self.ge = double_or_blank(card, 7, 'ge', 0.0) self.lam = string_or_blank(card, 8, 'lam') fields = card.fields(9) T = 0. # thickness midLast = None tLast = None self.plies = [] i = 0 #n = 0 while i < len(fields): gPlyID = integer(card, 9 + i, 'gPlyID') mid = integer_or_blank(card, 9 + i + 1, 'mid', midLast) # can be blank 2nd time thru thickness = double_or_blank(card, 9 + i + 2, 'thickness', tLast) theta = double_or_blank(card, 9 + i + 3, 'theta', 0.0) sout = string_or_blank(card, 9 + i + 4, 'sout', 'NO') #print('n=%s gPlyID=%s mid=%s thickness=%s len=%s' %( # n,gPlyID,mid,thickness,len(fields))) ply = [mid, thickness, theta, sout, gPlyID] #print("ply = %s" %(ply)) self.plies.append(ply) #[mid,t,theta,sout] # PCOMP assert mid is not None assert thickness is not None assert isinstance(mid, int), 'mid=%s' % mid assert isinstance(thickness, float), 'thickness=%s' % thickness midLast = mid tLast = thickness T += thickness i += 8 #n += 1 self.z0 = double_or_blank(card, 2, 'z0', -0.5 * T) else: raise NotImplementedError('PCOMPG data')
def __init__(self, card=None, data=None, sol=None, comment=''): Method.__init__(self, card, data) if comment: self._comment = comment if card: #: Set identification number. (Unique Integer > 0) self.sid = integer(card, 1, 'sid') #: For vibration analysis: frequency range of interest. For #: buckling analysis: eigenvalue range of interest. See Remark 4. #: (Real or blank, -5 10e16 <= V1 < V2 <= 5.10e16) self.v1 = double_or_blank(card, 2, 'v1') self.v2 = double_or_blank(card, 3, 'v2') #: Number of roots desired self.nd = integer_or_blank(card, 4, 'nd') #: Diagnostic level. (0 < Integer < 4; Default = 0) self.msglvl = integer_or_blank(card, 5, 'msglvl', 0) #: Number of vectors in block or set. Default is machine dependent self.maxset = integer_or_blank(card, 6, 'maxset') #: Estimate of the first flexible mode natural frequency #: (Real or blank) self.shfscl = double_or_blank(card, 7, 'shfscl') #: Method for normalizing eigenvectors (Character: 'MASS' or 'MAX') self.norm = string_or_blank(card, 8, 'norm') optionValues = card[9:] self.options = [] self.values = [] #print "optionValues = ",optionValues for optionValue in optionValues: #print "optionValue = ",optionValue (option, value) = optionValue.split('=') self.options.append(option) self.values.append(value) #: Method for normalizing eigenvectors if sol in [103, 115, 146]: # normal modes,cyclic normal modes, flutter self.norm = string_or_blank(card, 8, 'norm', 'MASS') elif sol in [105, 110, 111, 116]: # buckling, modal complex eigenvalues, # modal frequency response,cyclic buckling self.norm = string_or_blank(card, 8, 'norm', 'MAX') else: self.norm = string_or_blank(card, 8, 'norm') #assert len(card) <= 9, 'len(EIGRL card) = %i' % len(card) assert len(card) <= 10, 'len(EIGRL card) = %i' % len(card) #msg = 'norm=%s sol=%s' % (self.norm, sol) #assert self.norm in ['MASS', 'MAX'],msg #assert card.nFields()<9,'card = %s' %(card.fields(0)) else: raise NotImplementedError('EIGRL')
def __init__(self, card=None, data=None, sol=None, comment=''): Method.__init__(self, card, data) if comment: self._comment = comment if card: #: Set identification number. (Unique Integer > 0) self.sid = integer(card, 1, 'sid') #: For vibration analysis: frequency range of interest. For #: buckling analysis: eigenvalue range of interest. See Remark 4. #: (Real or blank, -5 10e16 <= V1 < V2 <= 5.10e16) self.v1 = double_or_blank(card, 2, 'v1') self.v2 = double_or_blank(card, 3, 'v2') #: Number of roots desired self.nd = integer_or_blank(card, 4, 'nd') #: Diagnostic level. (0 < Integer < 4; Default = 0) self.msglvl = integer_or_blank(card, 5, 'msglvl', 0) #: Number of vectors in block or set. Default is machine dependent self.maxset = integer_or_blank(card, 6, 'maxset') #: Estimate of the first flexible mode natural frequency #: (Real or blank) self.shfscl = double_or_blank(card, 7, 'shfscl') #: Method for normalizing eigenvectors (Character: 'MASS' or 'MAX') self.norm = string_or_blank(card, 8, 'norm') optionValues = [interpret_value(field) for field in card[9:] ] self.options = [] self.values = [] #print "optionValues = ",optionValues for optionValue in optionValues: #print "optionValue = ",optionValue (option, value) = optionValue.split('=') self.options.append(option) self.values.append(value) #: Method for normalizing eigenvectors if sol in [103, 115, 146]: # normal modes,cyclic normal modes, flutter self.norm = string_or_blank(card, 8, 'norm', 'MASS') elif sol in [105, 110, 111, 116]: # buckling, modal complex eigenvalues, # modal frequency response,cyclic buckling self.norm = string_or_blank(card, 8, 'norm', 'MAX') else: self.norm = string_or_blank(card, 8, 'norm') #assert len(card) <= 9, 'len(EIGRL card) = %i' % len(card) assert len(card) <= 10, 'len(EIGRL card) = %i' % len(card) #msg = 'norm=%s sol=%s' % (self.norm, sol) #assert self.norm in ['MASS', 'MAX'],msg #assert card.nFields()<9,'card = %s' %(card.fields(0)) else: raise NotImplementedError('EIGRL')
def __init__(self, card=None, data=None, comment=''): IntegratedLineProperty.__init__(self, card, data) if comment: self._comment = comment if card: #: Property ID self.pid = integer(card, 1, 'pid') #: Material ID self.mid = integer(card, 2, 'mid') self.group = string_or_blank(card, 3, 'group', 'MSCBMLO') #: Section Type (e.g. 'ROD', 'TUBE', 'I', 'H') self.Type = string(card, 4, 'Type') # determine the number of required dimensions on the PBEAM ndim = self.validTypes[self.Type] #nAll = ndim + 1 #: dimension list self.dim = [] Dim = [] #: Section position self.xxb = [0.] #: Output flag self.so = ['YES'] #: non-structural mass :math:`nsm` self.nsm = [] i = 9 n = 0 while i < len(card): if n > 0: so = string_or_blank(card, i, 'so_n=%i' % n, 'YES') xxb = double_or_blank(card, i + 1, 'xxb_n=%i' % n, 1.0) self.so.append(so) self.xxb.append(xxb) i += 2 Dim = [] for ii in range(ndim): dim = double(card, i, 'dim_n=%i_ii=%i' % (n, ii)) Dim.append(dim) i += 1 self.dim.append(Dim) nsm = double_or_blank(card, i, 'nsm_n=%i' % n, 0.0) self.nsm.append(nsm) n += 1 i += 1
def __init__(self, card=None, data=None, comment=''): ShellProperty.__init__(self, card, data) if comment: self._comment = comment if card: self.pid = integer(card, 1, 'pid') # z0 will be calculated later self.nsm = double_or_blank(card, 3, 'nsm', 0.0) self.sb = double_or_blank(card, 4, 'sb', 0.0) self.ft = string_or_blank(card, 5, 'ft') assert self.ft in ['HILL', 'HOFF', 'TSAI', 'STRN', None] self.TRef = double_or_blank(card, 6, 'TRef', 0.0) self.ge = double_or_blank(card, 7, 'ge', 0.0) self.lam = string_or_blank(card, 8, 'lam') fields = card.fields(9) T = 0. # thickness midLast = None tLast = None self.plies = [] i = 0 #n = 0 while i < len(fields): gPlyID = integer(card, 9 + i, 'gPlyID') mid = integer_or_blank(card, 9 + i + 1, 'mid', midLast) # can be blank 2nd time thru thickness = double_or_blank(card, 9 + i + 2, 'thickness', tLast) theta = double_or_blank(card, 9 + i + 3, 'theta', 0.0) sout = string_or_blank(card, 9 + i + 4, 'sout', 'NO') #print('n=%s gPlyID=%s mid=%s thickness=%s len=%s' %( # n,gPlyID,mid,thickness,len(fields))) ply = [mid, thickness, theta, sout, gPlyID] #print("ply = %s" %(ply)) self.plies.append(ply) #[mid,t,theta,sout] # PCOMP assert mid is not None assert thickness is not None assert isinstance(mid, int), 'mid=%s' % mid assert isinstance(thickness, float), 'thickness=%s' % thickness midLast = mid tLast = thickness T += thickness i += 8 #n += 1 self.z0 = double_or_blank(card, 2, 'z0', -0.5 * T) else: raise NotImplementedError('PCOMPG data')
def __init__(self, card=None, data=None, comment=''): IntegratedLineProperty.__init__(self, card, data) if comment: self._comment = comment if card: #: Property ID self.pid = integer(card, 1, 'pid') #: Material ID self.mid = integer(card, 2, 'mid') self.group = string_or_blank(card, 3, 'group', 'MSCBMLO') #: Section Type (e.g. 'ROD', 'TUBE', 'I', 'H') self.Type = string(card, 4, 'Type') # determine the number of required dimensions on the PBEAM ndim = self.validTypes[self.Type] #nAll = ndim + 1 #: dimension list self.dim = [] Dim = [] #: Section position self.xxb = [0.] #: Output flag self.so = ['YES'] #: non-structural mass :math:`nsm` self.nsm = [] i = 9 n = 0 while i < len(card): if n > 0: so = string_or_blank(card, i, 'so_n=%i' % n, 'YES') xxb = double_or_blank(card, i + 1, 'xxb_n=%i' % n, 1.0) self.so.append(so) self.xxb.append(xxb) i += 2 Dim = [] for ii in range(ndim): dim = double(card, i, 'dim_n=%i_ii=%i' % (n, ii)) Dim.append(dim) i += 1 self.dim.append(Dim) nsm = double_or_blank(card, i, 'nsm_n=%i' % n, 0.0) self.nsm.append(nsm) n += 1 i += 1
def __init__(self, card=None, data=None, comment=''): Method.__init__(self, card, data) if comment: self._comment = comment if card: #: Set identification number. (Unique Integer > 0) self.sid = integer(card, 1, 'sid') #: Method of eigenvalue extraction. (Character: 'INV' for inverse #: power method or 'SINV' for enhanced inverse power method.) self.method = string_or_blank(card, 2, 'method', 'LAN') assert self.method in [ 'LAN', 'AHOU', 'INV', 'SINV', 'GIV', 'MGIV', 'HOU', 'MHOU', 'AGIV' ], 'method=%s' % self.method #: Frequency range of interest self.f1 = double_or_blank(card, 3, 'f1') self.f2 = double_or_blank(card, 4, 'f2') #: Estimate of number of roots in range (Required for #: METHOD = 'INV'). Not used by 'SINV' method. self.ne = integer_or_blank(card, 5, 'ne') #: Desired number of roots (default=600 for SINV 3*ne for INV) if self.method in ['SINV']: self.nd = integer_or_blank(card, 6, 'nd', 600) if self.method in ['INV']: self.nd = integer_or_blank(card, 6, 'nd', 3 * self.ne) elif self.method in ['GIV', 'MGIV', 'HOU', 'MHOU']: self.nd = integer_or_blank(card, 6, 'nd', 0) else: self.nd = integer(card, 6, 'nd') #: Method for normalizing eigenvectors. ('MAX' or 'POINT'; #: Default='MAX') self.norm = string_or_blank(card, 9, 'norm', 'MASS') assert self.norm in ['POINT', 'MASS', 'MAX'] if self.method == 'POINT': #: Grid or scalar point identification number. Required only if #: NORM='POINT'. (Integer>0) self.G = integer(card, 10, 'G') #: Component number. Required only if NORM='POINT' and G is a #: geometric grid point. (1<Integer<6) self.C = components(card, 11, 'C') else: self.G = blank(card, 10, 'G') self.C = blank(card, 11, 'C') assert len(card) <= 12, 'len(EIGR card) = %i' % len(card) else: raise NotImplementedError('EIGR')
def __init__(self, card, data=None, comment=''): if comment: self._comment = comment if card: self.key = string(card, 1, 'key') n = 1 if self.key == 'ACOUT': self.value = string_or_blank(card, 2, 'value', 'PEAK') elif self.key == 'ACOWEAK': self.value = string_or_blank(card, 2, 'value', 'NO') elif self.key == 'ACSYM': self.value = string_or_blank(card, 2, 'value', 'YES') elif self.key == 'ADJMETH': self.value = integer_or_blank(card, 2, 'value', 0) elif self.key == 'ADMPOST': self.value = string_or_blank(card, 2, 'value', 0) elif self.key == 'ADSTAT': self.value = string_or_blank(card, 2, 'value', 'YES') elif self.key in ['ALPHA1', 'ALPHA2']: self.value1 = double_or_blank(card, 2, 'value1', 0.0) self.value2 = double_or_blank(card, 2, 'value2', 0.0) n = 2 elif self.key in ['ALPHA1FL', 'ALPHA2FL']: self.value1 = double_or_blank(card, 2, 'value1', 0.0) self.value2 = double_or_blank(card, 3, 'value2', 0.0) n = 2 elif self.key in [ 'CB1', 'CB2', 'CK1', 'CK2', 'CK3', 'CM1', 'CM2', 'CP1', 'CP2' ]: self.value1 = double_or_blank(card, 2, 'value1', 1.0) self.value2 = double_or_blank(card, 3, 'value2', 0.0) n = 2 else: self.value = integer_double_or_string(card, 2, 'value') if hasattr(self, 'value1'): self.values = [self.value1, self.value2] else: self.values = [self.value] if n == 1: assert len(card) == 3, 'len(PARAM card)=%i card=%r' % ( len(card), card) else: assert len(card) == 4, 'len(PARAM card)=%i card=%r' % ( len(card), card) else: self.key = data[0] self.value = data[1]
def __init__(self, card=None, data=None, comment=''): Method.__init__(self, card, data) if comment: self._comment = comment if card: #: Set identification number. (Unique Integer > 0) self.sid = integer(card, 1, 'sid') #: Method of eigenvalue extraction. (Character: 'INV' for inverse #: power method or 'SINV' for enhanced inverse power method.) self.method = string_or_blank(card, 2, 'method', 'LAN') assert self.method in ['LAN', 'AHOU', 'INV', 'SINV', 'GIV', 'MGIV', 'HOU', 'MHOU', 'AGIV'], 'method=%s' % self.method #: Frequency range of interest self.f1 = double_or_blank(card, 3, 'f1') self.f2 = double_or_blank(card, 4, 'f2') #: Estimate of number of roots in range (Required for #: METHOD = 'INV'). Not used by 'SINV' method. self.ne = integer_or_blank(card, 5, 'ne') #: Desired number of roots (default=600 for SINV 3*ne for INV) if self.method in ['SINV']: self.nd = integer_or_blank(card, 6, 'nd', 600) if self.method in ['INV']: self.nd = integer_or_blank(card, 6, 'nd', 3 * self.ne) elif self.method in ['GIV', 'MGIV', 'HOU', 'MHOU']: self.nd = integer_or_blank(card, 6, 'nd', 0) else: self.nd = integer(card, 6, 'nd') #: Method for normalizing eigenvectors. ('MAX' or 'POINT'; #: Default='MAX') self.norm = string_or_blank(card, 9, 'norm', 'MASS') assert self.norm in ['POINT', 'MASS', 'MAX'] if self.method == 'POINT': #: Grid or scalar point identification number. Required only if #: NORM='POINT'. (Integer>0) self.G = integer(card, 10, 'G') #: Component number. Required only if NORM='POINT' and G is a #: geometric grid point. (1<Integer<6) self.C = components(card, 11, 'C') else: self.G = blank(card, 10, 'G') self.C = blank(card, 11, 'C') assert len(card) <= 12, 'len(EIGR card) = %i' % len(card) else: raise NotImplementedError('EIGR')
def add(self, card, comment=''): i = self.i self.element_id[i] = integer(card, 1, 'element_id') self.caero[i] = integer(card, 2, 'caero') self.box1[i] = integer(card, 3, 'box1') self.box2[i] = integer(card, 4, 'box2') self.setg[i] = integer(card, 5, 'setg') self.dz[i] = double_or_blank(card, 6, 'dz', 0.0) self.method[i] = string_or_blank(card, 7, 'method', 'IPS') self.usage[i] = string_or_blank(card, 8, 'usage', 'BOTH') self.nelements[i] = integer_or_blank(card, 9, 'nelements', 10) self.melements[i] = integer_or_blank(card, 10, 'melements', 10) assert self.nelements[i] > 0, 'nelements = %s' % self.nelements[i] assert self.melements[i] > 0, 'melements = %s' % self.melements[i] assert len(card) <= 11, 'len(SPLINE1 card) = %i' % len(card) self.i += 1
def getShockA(self, card, iStart): self.shockType = string_or_blank(card, iStart + 1, 'shockType') self.shockCVT = double(card, iStart + 2, 'shockCVT') self.shockCVC = double_or_blank(card, iStart + 3, 'shockCVC') self.shockExpVT = double_or_blank(card, iStart + 4, 'shockExpVT', 1.0) self.shockExpVC = double_or_blank(card, iStart + 5, 'shockExpVC', self.shockExpVT) if self.shockType == 'TABLE': pass # self.shockIDTS = integer(card, iStart + 6, 'shockIDTS') # self.shockIDETS = blank(card, iStart + 9, 'shockIDETS') # self.shockIDECS = blank(card, iStart + 10, 'shockIDECS') # self.shockIDETSD = blank(card, iStart + 11, 'shockIDETSD') # self.shockIDECSD = blank(card, iStart + 12, 'shockIDECSD') elif self.shockType == 'EQUAT': self.shockIDTS = blank(card, iStart + 6, 'shockIDTS') self.shockIDETS = integer(card, iStart + 9, 'shockIDETS') self.shockIDECS = integer_or_blank(card, iStart + 10, 'shockIDECS', self.shockIDETS) self.shockIDETSD = integer(card, iStart + 11, 'shockIDETSD') self.shockIDECSD = integer_or_blank(card, iStart + 11, 'shockIDECSD', self.shockIDETSD) else: raise RuntimeError('Invalid shockType=|%s| on card\n%s' % (self.shockType, card)) iStart += 8 return iStart
def __init__(self, card=None, data=None, comment=''): SolidProperty.__init__(self, card, data) if comment: self._comment = comment if card: #: Property ID self.pid = integer(card, 1, 'pid') #: Material ID self.mid = integer(card, 2, 'mid') self.cordm = integer_or_blank(card, 3, 'cordm', 0) self.integ = integer_string_or_blank(card, 4, 'integ') #validIntegration = ['THREE', 'TWO', 'FULL', 'BUBBLE', # 2, 3, None, 'REDUCED'] self.stress = integer_string_or_blank(card, 5, 'stress') self.isop = integer_string_or_blank(card, 6, 'isop') self.fctn = string_or_blank(card, 7, 'fctn', 'SMECH') assert len(card) <= 8, 'len(PSOLID card) = %i' % len(card) else: self.pid = data[0] self.mid = data[1] self.cordm = data[2] self.integ = data[3] self.stress = data[4] self.isop = data[5] self.fctn = data[6] if self.fctn == 'SMEC': self.fctn = 'SMECH'
def __init__(self, card=None, data=None, comment=''): Table.__init__(self, card, data) if comment: self._comment = comment if card: self.tid = integer(card, 1, 'tid') self.Type = string_or_blank(card, 2, 'Type', 'G') assert self.Type in ['G', 'CRIT', 'Q'], 'Type=%r' % self.Type nfields = len(card) - 1 nterms = (nfields - 9) // 2 if nterms < 0: raise SyntaxError('%r card is too short' % self.type) xy = [] for i in range(nterms): n = 9 + i * 2 if card.field(n) == 'ENDT': break x = double(card, n, 'x' + str(i + 1)) y = double(card, n + 1, 'y' + str(i + 1)) xy += [x, y] ENDT = string(card, nfields, 'ENDT') isData = False else: self.tid = data[0] self.x1 = data[1] self.Type = data[2] xy = data[5:] isData = True self.parse_fields(xy, nrepeated=2, isData=isData)
def getShockA(self, card, iStart): self.shockType = string_or_blank(card, iStart + 1, 'shockType') self.shockCVT = double(card, iStart + 2, 'shockCVT') self.shockCVC = double_or_blank(card, iStart + 3, 'shockCVC') self.shockExpVT = double_or_blank(card, iStart + 4, 'shockExpVT', 1.0) self.shockExpVC = double_or_blank(card, iStart + 5, 'shockExpVC', self.shockExpVT) if self.shockType == 'TABLE': pass # self.shockIDTS = integer(card, iStart + 6, 'shockIDTS') # self.shockIDETS = blank(card, iStart + 9, 'shockIDETS') # self.shockIDECS = blank(card, iStart + 10, 'shockIDECS') # self.shockIDETSD = blank(card, iStart + 11, 'shockIDETSD') # self.shockIDECSD = blank(card, iStart + 12, 'shockIDECSD') elif self.shockType == 'EQUAT': self.shockIDTS = blank(card, iStart + 6, 'shockIDTS') self.shockIDETS = integer(card, iStart + 9, 'shockIDETS') self.shockIDECS = integer_or_blank(card, iStart + 10, 'shockIDECS', self.shockIDETS) self.shockIDETSD = integer(card, iStart + 11, 'shockIDETSD') self.shockIDECSD = integer_or_blank(card, iStart + 11, 'shockIDECSD', self.shockIDETSD) else: raise RuntimeError('Invalid shockType=|%s| on card\n%s' %(self.shockType, card)) iStart += 8 return iStart
def add(self, card=None, data=None, comment=''): if self.n == 1: raise RuntimeError('only one CBAROR is allowed') self.n = 1 if comment: self._comment = comment self.property_id = integer_or_blank(card, 2, 'pid') #--------------------------------------------------------- # x / g0 field5 = integer_double_or_blank(card, 5, 'g0_x1', 0.0) if isinstance(field5, int): self.is_g0 = True self.g0 = field5 self.x = [0., 0., 0.] elif isinstance(field5, float): self.is_g0 = False self.g0 = None self.x = array([ field5, double_or_blank(card, 6, 'x2', 0.0), double_or_blank(card, 7, 'x3', 0.0) ], dtype='float64') self.offt = string_or_blank(card, 8, 'offt', 'GGG') assert len(card) <= 9, 'len(CBAROR card) = %i' % len(card)
def __init__(self, card=None, data=None, comment=''): TabularLoad.__init__(self, card, data) if comment: self._comment = comment if card: self.sid = integer(card, 1, 'sid') self.exciteID = integer(card, 2, 'exciteID') self.delay = integer_double_or_blank(card, 3, 'delay') self.dphase = integer_double_or_blank(card, 4, 'dphase') self.tb = integer_or_blank(card, 5, 'tb', 0) self.tp = integer_or_blank(card, 6, 'tp', 0) self.Type = string_or_blank(card, 7, 'Type', 'LOAD') if self.Type in [0, 'L', 'LO', 'LOA', 'LOAD']: self.Type = 'LOAD' elif self.Type in [1, 'D', 'DI', 'DIS', 'DISP']: self.Type = 'DISP' elif self.Type in [2, 'V', 'VE', 'VEL', 'VELO']: self.Type = 'VELO' elif self.Type in [3, 'A', 'AC', 'ACC', 'ACCE']: self.Type = 'ACCE' else: msg = 'invalid RLOAD2 type Type=|%s|' % self.Type raise RuntimeError(msg) assert len(card) <= 8, 'len(RLOAD2 card) = %i' % len(card) else: raise NotImplementedError(data)
def __init__(self, card=None, data=None, comment=''): Table.__init__(self, card, data) if comment: self._comment = comment if card: self.tid = integer(card, 1, 'tid') self.Type = string_or_blank(card, 2, 'Type', 'G') assert self.Type in ['G', 'CRIT', 'Q'], 'Type=%r' % self.Type nfields = len(card) - 1 nterms = (nfields - 9) // 2 if nterms < 0: raise SyntaxError('%r card is too short' % self.type) xy = [] for i in range(nterms): n = 9 + i * 2 if card.field(n) == 'ENDT': break x = double(card, n, 'x' + str(i + 1)) y = double(card, n + 1, 'y' + str(i + 1)) xy += [x, y] string(card, nfields, 'ENDT') isData = False else: self.tid = data[0] self.x1 = data[1] self.Type = data[2] xy = data[5:] isData = True self.parse_fields(xy, nrepeated=2, isData=isData)
def add(self, card, comment=''): i = self.i self.property_id[i] = integer(card, 1, 'pid') self.material_id[i] = integer(card, 2, 'mid') self.cordm[i] = integer_or_blank(card, 3, 'cordm', 0) self.integ[i] = integer_string_or_blank(card, 4, 'integ', '') #validIntegration = ['THREE', 'TWO', 'FULL', 'BUBBLE', # 2, 3, None, 'REDUCED'] # ISOP # ------ # 1. FULL # 2. # 3. # REDUCED # IN # ------ # 1. # 2. TWO # 3. THREE # BUBBLE - 2 for CTETRA, 3 for CHEXA/CPENTA # STRESS # ------ # 1. GAUSS (no midside nodes on CPENTA/CHEXA; ok on CTETRA) # 2. self.stress[i] = integer_string_or_blank(card, 5, 'stress', '') self.isop[i] = integer_string_or_blank(card, 6, 'isop', '') self.fctn[i] = string_or_blank(card, 7, 'fctn', 'SMECH') assert len(card) <= 8, 'len(PSOLID card) = %i' % len(card) self.i += 1
def __init__(self, card=None, data=None, comment=''): """ Design Optimization Parameters Overrides default values of parameters used in design optimization :: DOPTPRM PARAM1 VAL1 PARAM2 VAL2 PARAM3 VAL3 PARAM4 VAL4 PARAM5 VAL5 -etc.- """ if comment: self._comment = comment nFields = len(card) - 1 self.params = {} for i in range(0, nFields, 2): param = string_or_blank(card, i + 1, 'param') default_value = None if param is None: continue if param in self.defaults: default_value = self.defaults[param] val = integer_double_or_blank(card, i + 2, '%s_value' % param, default_value) self.params[param] = val
def __init__(self, card=None, data=None, comment=''): """ Design Sensitivity Equation Response Quantities Defines equation responses that are used in the design, either as constraints or as an objective. """ if comment: self._comment = comment self.oid = integer(card, 1, 'oid') self.label = string(card, 2, 'label') self.eqidFunc = integer_or_string(card, 3, 'eqid_Func') self.region = integer_or_blank(card, 4, 'region') self.method = string_or_blank(card, 5, 'method', 'MIN') self.c1 = double_or_blank(card, 6, 'c1', 100.) self.c2 = double_or_blank(card, 7, 'c2', 0.005) self.c3 = double_or_blank(card, 8, 'c3') #: .. todo:: or blank? i = 0 fields = [interpret_value(field) for field in card[9:] ] key = '$NULL$' # dummy key self.params = {key: []} valueList = [] for (i, field) in enumerate(fields): if i % 8 == 0 and field is not None: self.params[key] = valueList key = field valueList = [] elif field is not None: valueList.append(field) #else: # pass self.params[key] = valueList del self.params['$NULL$']
def __init__(self, card=None, data=None, comment=''): """ Design Sensitivity Equation Response Quantities Defines equation responses that are used in the design, either as constraints or as an objective. """ if comment: self._comment = comment self.oid = integer(card, 1, 'oid') self.label = string(card, 2, 'label') self.eqidFunc = integer_or_string(card, 3, 'eqid_Func') self.region = integer_or_blank(card, 4, 'region') self.method = string_or_blank(card, 5, 'method', 'MIN') self.c1 = double_or_blank(card, 6, 'c1', 100.) self.c2 = double_or_blank(card, 7, 'c2', 0.005) self.c3 = double_or_blank(card, 8, 'c3') #: .. todo:: or blank? i = 0 fields = [interpret_value(field) for field in card[9:]] key = '$NULL$' # dummy key self.params = {key: []} valueList = [] for (i, field) in enumerate(fields): if i % 8 == 0 and field is not None: self.params[key] = valueList key = field valueList = [] elif field is not None: valueList.append(field) #else: # pass self.params[key] = valueList del self.params['$NULL$']
def add(self, card, comment=''): i = self.i self.property_id[i] = integer(card, 1, 'pid') self.material_id[i] = integer(card, 2, 'mid') self.cordm[i] = integer_or_blank(card, 3, 'cordm', 0) self.integ[i] = integer_string_or_blank(card, 4, 'integ', '') #validIntegration = ['THREE', 'TWO', 'FULL', 'BUBBLE', # 2, 3, None, 'REDUCED'] # ISOP # ------ # 1. FULL # 2. # 3. # REDUCED # IN # ------ # 1. # 2. TWO # 3. THREE # BUBBLE - 2 for CTETRA, 3 for CHEXA/CPENTA # STRESS # ------ # 1. GAUSS (no midside nodes on CPENTA/CHEXA; ok on CTETRA) # 2. self.stress[i] = integer_string_or_blank(card, 5, 'stress', '') self.isop[i] = integer_string_or_blank(card, 6, 'isop', '') self.fctn[i] = string_or_blank(card, 7, 'fctn', 'SMECH') assert len(card) <= 8, 'len(PSOLID card) = %i' % len(card) self.i += 1
def __init__(self, card=None, data=None, comment=''): SolidProperty.__init__(self, card, data) if comment: self._comment = comment if card: #: Property ID self.pid = integer(card, 1, 'pid') #: Material ID self.mid = integer(card, 2, 'mid') self.cordm = integer_or_blank(card, 3, 'cordm', 0) self.integ = integer_string_or_blank(card, 4, 'integ') #validIntegration = ['THREE', 'TWO', 'FULL', 'BUBBLE', # 2, 3, None, 'REDUCED'] self.stress = integer_string_or_blank(card, 5, 'stress') self.isop = integer_string_or_blank(card, 6, 'isop') self.fctn = string_or_blank(card, 7, 'fctn', 'SMECH') assert len(card) <= 8, 'len(PSOLID card) = %i' % len(card) else: self.pid = data[0] self.mid = data[1] self.cordm = data[2] self.integ = data[3] self.stress = data[4] self.isop = data[5] self.fctn = data[6] if self.fctn == 'SMEC': self.fctn = 'SMECH'
def add(self, card, comment=''): i = self.i self.element_id[i] = integer(card, 1, 'element_id') self.caero[i] = integer(card, 2, 'caero') self.box1[i] = integer(card, 3, 'box1') self.box2[i] = integer(card, 4, 'box2') self.setg[i] = integer(card, 5, 'setg') self.dz[i] = double_or_blank(card, 6, 'dz', 0.0) self.method[i] = string_or_blank(card, 7, 'method', 'IPS') self.usage[i] = string_or_blank(card, 8, 'usage', 'BOTH') self.nelements[i] = integer_or_blank(card, 9, 'nelements', 10) self.melements[i] = integer_or_blank(card, 10, 'melements', 10) assert self.nelements[i] > 0, 'nelements = %s' % self.nelements[i] assert self.melements[i] > 0, 'melements = %s' % self.melements[i] assert len(card) <= 11, 'len(SPLINE1 card) = %i' % len(card) self.i += 1
def __init__(self, card, data=None, comment=''): if comment: self._comment = comment if card: self.key = string(card, 1, 'key') n = 1 if self.key == 'ACOUT': self.value = string_or_blank(card, 2, 'value', 'PEAK') elif self.key == 'ACOWEAK': self.value = string_or_blank(card, 2, 'value', 'NO') elif self.key == 'ACSYM': self.value = string_or_blank(card, 2, 'value', 'YES') elif self.key == 'ADJMETH': self.value = integer_or_blank(card, 2, 'value', 0) elif self.key == 'ADMPOST': self.value = string_or_blank(card, 2, 'value', 0) elif self.key == 'ADSTAT': self.value = string_or_blank(card, 2, 'value', 'YES') elif self.key in ['ALPHA1', 'ALPHA2']: self.value1 = double_or_blank(card, 2, 'value1', 0.0) self.value2 = double_or_blank(card, 2, 'value2', 0.0) n = 2 elif self.key in ['ALPHA1FL', 'ALPHA2FL']: self.value1 = double_or_blank(card, 2, 'value1', 0.0) self.value2 = double_or_blank(card, 3, 'value2', 0.0) n = 2 elif self.key in ['CB1', 'CB2', 'CK1', 'CK2', 'CK3', 'CM1', 'CM2', 'CP1', 'CP2']: self.value1 = double_or_blank(card, 2, 'value1', 1.0) self.value2 = double_or_blank(card, 3, 'value2', 0.0) n = 2 else: self.value = integer_double_or_string(card, 2, 'value') if hasattr(self, 'value1'): self.values = [self.value1, self.value2] else: self.values = [self.value] if n == 1: assert len(card) == 3, 'len(PARAM card)=%i card=%r' % (len(card), card) else: assert len(card) == 4, 'len(PARAM card)=%i card=%r' % (len(card), card) else: self.key = data[0] self.value = data[1]
def __init__(self, card=None, data=None, comment=''): Method.__init__(self, card, data) if comment: self._comment = comment if card: #: Set identification number. (Unique Integer > 0) self.sid = integer(card, 1, 'sid') #: Method of eigenvalue extraction. (Character: 'INV' for inverse #: power method or 'SINV' for enhanced inverse power method.) #: apparently it can also be blank... self.method = string_or_blank(card, 2, 'method') if self.method not in ['INV', 'SINV', None]: msg = 'method must be INV or SINV. method=|%s|' % self.method raise RuntimeError(msg) #: Eigenvalue range of interest. (Real, L1 < L2) self.L1 = double(card, 3, 'L1') self.L2 = double(card, 4, 'L2') if not self.L1 < self.L2: msg = 'L1=%s L2=%s; L1<L2 is requried' % (self.L1, self.L2) raise RuntimeError(msg) #: Estimate of number of roots in positive range not used for #: METHOD = 'SINV'. (Integer > 0) self.nep = integer_or_blank(card, 5, 'nep', 0) #: Desired number of positive and negative roots. #: (Integer>0; Default = 3*NEP) self.ndp = integer_or_blank(card, 6, 'ndp', 3 * self.nep) self.ndn = integer_or_blank(card, 7, 'ndn', 3 * self.nep) #: Method for normalizing eigenvectors. #: ('MAX' or 'POINT';Default='MAX') self.norm = string_or_blank(card, 9, 'norm', 'MAX') if self.norm == 'POINT': self.G = integer(card, 10, 'G') self.C = components(card, 11, 'C') else: self.G = integer_or_blank(card, 10, 'G') self.C = components_or_blank(card, 11, 'C') assert len(card) <= 12, 'len(EIGB card) = %i' % len(card) else: raise NotImplementedError('EIGB')
def add(self, card, comment=''): #: Trim set identification number. (Integer > 0) self.trim_id = integer(card, 1, 'trim_id') #: Mach number. (Real > 0.0 and != 1.0) self.mach = double(card, 2, 'mach') assert self.mach >= 0.0 and self.mach != 1.0, 'mach = %s' % self.mach #: Dynamic pressure. (Real > 0.0) self.q = double(card, 3, 'q') assert self.q > 0.0, 'q=%s' % self.q #: The label identifying aerodynamic trim variables defined on an #: AESTAT or AESURF entry. self.labels = [] #: The magnitude of the aerodynamic extra point degree-of-freedom. #: (Real) self.uxs = [] label = string_or_blank(card, 4, 'label1') if label: ux = double(card, 5, 'ux1') self.uxs.append(ux) self.labels.append(label) label = string_or_blank(card, 6, 'label2') if label: ux = double(card, 7, 'ux1') self.uxs.append(ux) self.labels.append(label) #: Flag to request a rigid trim analysis (Real > 0.0 and < 1.0; #: Default = 1.0. A value of 0.0 provides a rigid trim analysis, #: not supported self.aeqr = double_or_blank(card, 8, 'aeqr', 1.0) i = 9 n = 3 while i < len(card): label = string(card, i, 'label%i' % n) ux = double(card, i + 1, 'ux%i' % n) self.labels.append(label) self.uxs.append(ux) i += 2
def __init__(self, card=None, data=None, comment=''): LineProperty.__init__(self, card, data) if comment: self._comment = comment if card: #: Property ID self.pid = integer(card, 1, 'pid') #: Material ID self.mid = integer(card, 2, 'mid') self.group = string_or_blank(card, 3, 'group', 'MSCBMLO') #: Section Type (e.g. 'ROD', 'TUBE', 'I', 'H') self.Type = string(card, 4, 'Type') ndim = self.validTypes[self.Type] j = 9 + ndim + 1 dims = [] #dim_old = None ## TODO: is there a default? for i in range(ndim): dim = double_or_blank(card, 9 + i, 'dim%i' % (i + 1)) dims.append(dim) #: dimension list self.dim = dims assert len(dims) == ndim, 'PBARL ndim=%s len(dims)=%s' % (ndim, len(dims)) assert len(dims) == len(self.dim), 'PBARL ndim=%s len(dims)=%s' % (ndim, len(self.dim)) #: non-structural mass self.nsm = double_or_blank(card, 9 + ndim + 1, 'nsm', 0.0) else: self.pid = data[0] self.mid = data[1] self.group = data[2].strip() self.Type = data[3].strip() self.dim = list(data[4:-1]) self.nsm = data[-1] #print("group = %r" % self.group) #print("Type = %r" % self.Type) #print("dim = ",self.dim) #print(str(self)) #print("*PBARL = ",data) #raise NotImplementedError('not finished...') if self.Type not in self.validTypes: msg = ('Invalid PBARL Type, Type=%s ' 'validTypes=%s' % (self.Type, self.validTypes.keys())) raise RuntimeError(msg) if len(self.dim) != self.validTypes[self.Type]: msg = 'dim=%s len(dim)=%s Type=%s len(dimType)=%s' % ( self.dim, len(self.dim), self.Type, self.validTypes[self.Type]) raise RuntimeError(msg) assert None not in self.dim
def __init__(self, card=None, data=None, comment=''): if comment: self._comment = comment self.nlparm_id = integer(card, 1, 'nlparm_id') self.Type = string_or_blank(card, 2, 'Type', 'CRIS') self.minalr = double_or_blank(card, 3, 'minalr', 0.25) self.maxalr = double_or_blank(card, 4, 'maxalr', 4.0) self.scale = double_or_blank(card, 5, 'scale', 0.0) blank(card, 6, 'blank') self.desiter = double_or_blank(card, 7, 'minalr', 12) self.mxinc = integer_or_blank(card, 8, 'minalr', 20)
def __init__(self, card=None, data=None, comment=''): if comment: self._comment = comment self.nlparm_id = integer(card, 1, 'nlparm_id') self.Type = string_or_blank(card, 2, 'Type', 'CRIS') self.minalr = double_or_blank(card, 3, 'minalr', 0.25) self.maxalr = double_or_blank(card, 4, 'maxalr', 4.0) self.scale = double_or_blank(card, 5, 'scale', 0.0) blank(card, 6, 'blank') self.desiter = double_or_blank(card, 7, 'minalr', 12) self.mxinc = integer_or_blank(card, 7, 'minalr', 20)
def __init__(self, card=None, data=None, comment=''): ShellProperty.__init__(self, card, data) if comment: self._comment = comment if card: #: Property ID self.pid = integer(card, 1, 'pid') self.mid = integer(card, 2, 'mid') # MATHE, MATHP self.cid = integer_or_blank(card, 3, 'cid', 0) self.str = string_or_blank(card, 4, 'str', 'GRID') else: raise NotImplementedError(data)
def __init__(self, card=None, data=None, comment=''): ShellProperty.__init__(self, card, data) if comment: self._comment = comment if card: #: Property ID self.pid = integer(card, 1, 'pid') self.mid = integer(card, 2, 'mid') # MATHE, MATHP self.cid = integer_or_blank(card, 3, 'cid', 0) self.str = string_or_blank(card, 4, 'str', 'GRID') else: raise NotImplementedError(data)
def __init__(self, card=None, data=None, comment=''): LineProperty.__init__(self, card, data) if comment: self._comment = comment if card: #: Property ID self.pid = integer(card, 1, 'pid') #: Material ID self.mid = integer(card, 2, 'mid') self.group = string_or_blank(card, 3, 'group', 'MSCBMLO') #: Section Type (e.g. 'ROD', 'TUBE', 'I', 'H') self.Type = string(card, 4, 'Type') ndim = self.validTypes[self.Type] j = 9 + ndim + 1 #: dimension list self.dim = fields(double_or_blank, card, 'dim', i=9, j=j) #: non-structural mass self.nsm = double_or_blank(card, 9 + ndim + 1, 'nsm', 0.0) if ndim > 0: self.nsm = set_default_if_blank(self.dim.pop(), 0.0) else: self.nsm = 0.0 assert isinstance(self.nsm, float), 'nsm=%r' % self.nsm else: self.pid = data[0] self.mid = data[1] self.group = data[2].strip() self.Type = data[3].strip() self.dim = list(data[4:-1]) self.nsm = data[-1] #print("group = %r" % self.group) #print("Type = %r" % self.Type) #print("dim = ",self.dim) #print(str(self)) #print("*PBARL = ",data) #raise NotImplementedError('not finished...') if self.Type not in self.validTypes: msg = ('Invalid PBARL Type, Type=%s ' 'validTypes=%s' % (self.Type, self.validTypes.keys())) raise RuntimeError(msg) if len(self.dim) != self.validTypes[self.Type]: msg = 'dim=%s len(dim)=%s Type=%s len(dimType)=%s' % ( self.dim, len(self.dim), self.Type, self.validTypes[self.Type]) raise RuntimeError(msg) assert None not in self.dim
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment #: Identifiers of grids points. (Integer > 0) self.IDs = [] if string_or_blank(card, 2, 'C') == 'ALL': self.components = '123456' else: self.components = components(card, 1, 'components') IDs = fields(integer_or_string, 'ID', i=2, j=len(card)) self.IDs = expand_thru(IDs)
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment #: Identifiers of grids points. (Integer > 0) self.IDs = [] if string_or_blank(card, 2, 'C') == 'ALL': self.components = '123456' else: self.components = components(card, 1, 'components') IDs = fields(integer_or_string, 'ID', i=2, j=len(card)) self.IDs = expand_thru(IDs)
def add(self, card, comment=''): i = self.i self.property_id[i] = integer(card, 1, 'pid') self.material_id[i] = integer(card, 2, 'mid') stress_strain = string_or_blank(card, 3, 'str', 'GRID') if stress_strain not in ('GRID', 'GAUS'): msg = 'STR="%s" doesnt have a valid stress/strain ' \ 'output value set; valid=["GRID", "GAUS"]\n' \ % stress_strain #raise RuntimeError(msg) self.stress_strain[i] = stress_strain assert len(card) <= 4, 'len(PLSOLID card) = %i' % len(card) self.i += 1
def add(self, card, comment=''): i = self.i self.property_id[i] = integer(card, 1, 'pid') self.material_id[i] = integer(card, 2, 'mid') stress_strain = string_or_blank(card, 3, 'str', 'GRID') if stress_strain not in ('GRID', 'GAUS'): msg = 'STR="%s" doesnt have a valid stress/strain ' \ 'output value set; valid=["GRID", "GAUS"]\n' \ % stress_strain #raise RuntimeError(msg) self.stress_strain[i] = stress_strain assert len(card) <= 4, 'len(PLSOLID card) = %i' % len(card) self.i += 1
def getDamper(self, card, iStart): self.damperType = string_or_blank(card, iStart + 1, 'damperType') self.damperIDT = integer(card, iStart + 2, 'damperIDT') if self.damperType == 'TABLE': self.damperIDC = blank(card, iStart + 3, 'damperIDC') self.damperIDTDV = blank(card, iStart + 4, 'damperIDTDV') self.damperIDCDV = blank(card, iStart + 5, 'damperIDCDV') elif self.damperType == 'EQUAT': self.damperIDC = integer_or_blank(card, iStart + 3, 'damperIDC') self.damperIDTDV = integer(card, iStart + 4, 'damperIDTDV') self.damperIDCDV = integer_or_blank(card, iStart + 5, 'damperIDCDV', self.damperIDTDV) else: raise RuntimeError('Invalid springType=|%s| on card\n%s' %(self.springType, card)) self.vars.append('DAMPER')
def getDamper(self, card, iStart): self.damperType = string_or_blank(card, iStart + 1, 'damperType') self.damperIDT = integer(card, iStart + 2, 'damperIDT') if self.damperType == 'TABLE': self.damperIDC = blank(card, iStart + 3, 'damperIDC') self.damperIDTDV = blank(card, iStart + 4, 'damperIDTDV') self.damperIDCDV = blank(card, iStart + 5, 'damperIDCDV') elif self.damperType == 'EQUAT': self.damperIDC = integer_or_blank(card, iStart + 3, 'damperIDC') self.damperIDTDV = integer(card, iStart + 4, 'damperIDTDV') self.damperIDCDV = integer_or_blank(card, iStart + 5, 'damperIDCDV', self.damperIDTDV) else: raise RuntimeError('Invalid springType=|%s| on card\n%s' %(self.springType, card)) self.vars.append('DAMPER')
def __init__(self, card=None, data=None, comment=''): """ Design Sensitivity Equation Response Quantities Defines equation responses that are used in the design, either as constraints or as an objective. """ if comment: self._comment = comment self.func = None self.dequation_str = None if card: self.oid = integer(card, 1, 'oid') self.label = string(card, 2, 'label') self.dequation = integer_or_string(card, 3, 'dequation_id') self.region = integer_or_blank(card, 4, 'region') self.method = string_or_blank(card, 5, 'method', 'MIN') self.c1 = double_or_blank(card, 6, 'c1', 100.) self.c2 = double_or_blank(card, 7, 'c2', 0.005) self.c3 = double_or_blank(card, 8, 'c3') #: .. todo:: or blank? #i = 0 fields = [interpret_value(field) for field in card[9:]] key = None # dummy key self.params = {} value_list = [] j = 0 for (i, field) in enumerate(fields): if i % 8 == 0 and field is not None: if i > 0: assert len(value_list) > 0, 'key=%s values=%s' % (key, value_list) self.params[key] = value_list j += 1 key = (j, field) value_list = [] elif field is not None: value_list.append(field) self.params[key] = value_list else: raise RuntimeError(data) print("--Params--") for key, value_list in sorted(iteritems(self.params)): print(" key=%s params=%s" %(key, value_list))
def getSpring(self, card, iStart): self.springType = string_or_blank(card, iStart + 1, 'springType') self.springIDT = integer(card, iStart + 2, 'springIDT') if self.springType == 'TABLE': self.springIDC = blank(card, iStart + 3, 'springIDC') self.springIDTDU = blank(card, iStart + 4, 'springIDTDU') self.springIDCDU = blank(card, iStart + 5, 'springIDCDU') elif self.springType == 'EQUAT': self.springIDC = integer_or_blank(card, iStart + 3, 'springIDC', self.springIDT) self.springIDTDU = integer(card, iStart + 4, 'springIDTDU') self.springIDCDU = integer_or_blank(card, iStart + 5, 'springIDCDU', self.springIDTDU) else: raise RuntimeError('Invalid springType=|%s| on card\n%s' %(self.springType, card)) self.vars.append('SPRING')
def getSpring(self, card, iStart): self.springType = string_or_blank(card, iStart + 1, 'springType') self.springIDT = integer(card, iStart + 2, 'springIDT') if self.springType == 'TABLE': self.springIDC = blank(card, iStart + 3, 'springIDC') self.springIDTDU = blank(card, iStart + 4, 'springIDTDU') self.springIDCDU = blank(card, iStart + 5, 'springIDCDU') elif self.springType == 'EQUAT': self.springIDC = integer_or_blank(card, iStart + 3, 'springIDC', self.springIDT) self.springIDTDU = integer(card, iStart + 4, 'springIDTDU') self.springIDCDU = integer_or_blank(card, iStart + 5, 'springIDCDU', self.springIDTDU) else: raise RuntimeError('Invalid springType=|%s| on card\n%s' %(self.springType, card)) self.vars.append('SPRING')
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment #: Identifiers of grids points. (Integer > 0) self.IDs = [] if string_or_blank(card, 2, 'C') == 'ALL': self.components = '123456' else: self.components = components(card, 1, 'components') IDs2 = [] ii = 1 for ifield in range(2, len(card)): integer_or_string(card, ifield, 'ID' % ii) ii += 1 self.IDs = expand_thru(IDs)
def __init__(self, card=None, data=None, comment=''): Method.__init__(self, card, data) if comment: self._comment = comment if card: #: Set identification number. (Unique Integer > 0) self.sid = integer(card, 1, 'sid') #: Method of eigenvalue extraction. (Character: 'INV' for inverse #: power method or 'SINV' for enhanced inverse power method.) self.method = string(card, 2, 'method') if self.method not in ['INV', 'SINV']: msg = 'method must be INV or SINV. method=|%s|' % self.method raise RuntimeError(msg) #: Eigenvalue range of interest. (Real, L1 < L2) self.L1 = double(card, 3, 'L1') self.L2 = double(card, 4, 'L2') if not (self.L1 < self.L2): msg = 'L1=%s L2=%s; L1<L2 is requried' % (self.L1, self.L2) raise RuntimeError(msg) #: Estimate of number of roots in positive range not used for #: METHOD = 'SINV'. (Integer > 0) self.nep = integer_or_blank(card, 5, 'nep', 0) #: Desired number of positive and negative roots. #: (Integer>0; Default = 3*NEP) self.ndp = integer_or_blank(card, 6, 'ndp', 3 * self.nep) self.ndn = integer_or_blank(card, 7, 'ndn', 3 * self.nep) #: Method for normalizing eigenvectors. #: ('MAX' or 'POINT';Default='MAX') self.norm = string_or_blank(card, 9, 'norm', 'MAX') if self.norm == 'POINT': self.G = integer(card, 10, 'G') self.C = components(card, 11, 'C') else: self.G = integer_or_blank(card, 10, 'G') self.C = components_or_blank(card, 11, 'C') assert len(card) <= 12, 'len(EIGB card) = %i' % len(card) else: raise NotImplementedError('EIGB')
def __init__(self, card=None, data=None, comment=''): SolidProperty.__init__(self, card, data) if comment: self._comment = comment if card: #: Property ID self.pid = integer(card, 1, 'pid') #: Material ID self.mid = integer(card, 2, 'mid') #: Location of stress and strain output self.str = string_or_blank(card, 3, 'str', 'GRID') assert len(card) <= 4, 'len(PLSOLID card) = %i' % len(card) else: self.pid = data[0] self.mid = data[1] self.ge = data[2] self.str = data[3] if self.str not in ['GRID', 'GAUS']: raise RuntimeError('STR="%s" doesnt have a valid stress/strain ' 'output value set; valid=["GRID", "GAUS"]\n' % self.str)