def add_card_nx(cls, card, comment=''): # infor = string(card, 2, 'infor') fset = integer(card, 3, 'fset') sset = integer(card, 4, 'sset') normal = double_or_blank(card, 5, 'normal', 0.5) # olvpang = double_or_blank(card, 7, 'olvpang', 60.0) search_unit = string_or_blank(card, 8, 'search_unit', 'REL') intol = double_or_blank(card, 9, 'intol', 0.2) area_op = integer_or_blank(card, 10, 'area_op', 0) ctype = string_or_blank(card, 11, 'ctype', 'STRONG') assert len(card) <= 8, f'len(ACMODL card) = {len(card):d}\ncard={card}' return ACMODL(infor, fset, sset, normal=normal, olvpang=olvpang, search_unit=search_unit, intol=intol, area_op=area_op, ctype=ctype, nastran_version='nx', comment=comment)
def add_card(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\ncard=%s' % (len(card), card)
def add_card_msc(cls, card, comment=''): #print('MSC...ACMODL') inter = string_or_blank(card, 2, 'infor', 'DIFF') infor = string_or_blank(card, 2, 'infor', 'NONE') fset = integer_or_blank(card, 3, 'fset') sset = integer_or_blank(card, 4, 'sset') normal_default = 0.001 if inter == 'INDENT' else 1.0 normal = double_or_blank(card, 5, 'normal', normal_default) method = string_or_blank(card, 6, 'method', 'BW') # BW/CP sk_neps = double_or_blank(card, 7, 'sk_neps', 0.5) dsk_neps = double_or_blank(card, 8, 'dsk_neps', 0.75) intol = double_or_blank(card, 9, 'intol', 0.2) all_set = string_or_blank(card, 10, 'all_set', 'NO') # search_unit = string_or_blank(card, 11, 'search_unit', 'REL') assert len( card) <= 12, f'len(ACMODL card) = {len(card):d}\ncard={card}' return ACMODL(infor, fset, sset, inter=inter, normal=normal, method=method, sk_neps=sk_neps, dsk_neps=dsk_neps, all_set=all_set, search_unit=search_unit, intol=intol, nastran_version='msc', comment=comment)
def add_card(cls, card, comment=''): """ Adds a TABLED1 card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ table_id = integer(card, 1, 'tid') xaxis = string_or_blank(card, 2, 'xaxis', 'LINEAR') yaxis = string_or_blank(card, 3, 'yaxis', 'LINEAR') extrap = integer_or_blank(card, 4, 'yaxis', 0) x, y = read_table(card, table_id, 'TABLED1') return TABLED1(table_id, x, y, xaxis=xaxis, yaxis=yaxis, extrap=extrap, comment=comment)
def __init__(self, card=None, data=None, comment=''): if comment: self._comment = comment if card: 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) else: (nlparm_id, ninc, dt, kMethod, kStep, maxIter, conv, intOut, epsU, epsP, epsW, maxDiv, maxQn, maxLs, fStress, lsTol, maxBisect, maxR, rTolB) = data self.nlparm_id = nlparm_id 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 add_card(cls, card, comment=''): crid = integer(card, 1, 'crid') surf = string_or_blank(card, 2, 'surf', 'TOP') offset = double_or_blank(card, 3, 'offset') Type = string_or_blank(card, 4, 'type', 'FLEX') mgp = integer_or_blank(card, 5, 'mpg', 0) return BCRPARA(crid, surf, offset, Type=Type, mgp=mgp, comment=comment)
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 add_card(cls, card, comment=''): sid = integer(card, 1, 'sid') method = string_or_blank(card, 2, 'method') L1 = double(card, 3, 'L1') L2 = double(card, 4, 'L2') nep = integer_or_blank(card, 5, 'nep', 0) ndp = integer_or_blank(card, 6, 'ndp', 3 * nep) ndn = integer_or_blank(card, 7, 'ndn', 3 * nep) norm = string_or_blank(card, 9, 'norm', 'MAX') if norm == 'POINT': G = integer(card, 10, 'G') C = components(card, 11, 'C') else: G = integer_or_blank(card, 10, 'G') C = components_or_blank(card, 11, 'C') assert len(card) <= 12, 'len(EIGB card) = %i\ncard=%s' % (len(card), card) return EIGB(sid, method, L1, L2, nep, ndp, ndn, norm, G, C, comment=comment)
def add_card(cls, card, comment=''): """ Adds a TABLED1 card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ tid = integer(card, 1, 'tid') xaxis = string_or_blank(card, 2, 'xaxis', 'LINEAR') 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' % cls.type) xy = [] for i in range(nterms): n = 9 + i * 2 if card.field(n) == 'ENDT': break xi = double_or_string(card, n, 'x' + str(i + 1)) yi = double_or_string(card, n + 1, 'y' + str(i + 1)) if xi == 'SKIP' or yi == 'SKIP': continue xy.append([xi, yi]) string(card, nfields, 'ENDT') x, y = make_xy(tid, 'TABLED1', xy) return TABLED1(tid, x, y, xaxis=xaxis, yaxis=yaxis, comment=comment)
def add_card(cls, card, comment=''): sid = integer(card, 1, 'sid') method = string_or_blank(card, 2, 'method', 'LAN') f1 = double_or_blank(card, 3, 'f1') f2 = double_or_blank(card, 4, 'f2') ne = integer_or_blank(card, 5, 'ne') if method not in cls.allowed_methods: msg = 'method=%s; allowed_methods=[%s]' % (method, ', '.join( cls.allowed_methods)) raise ValueError(msg) if method == 'SINV': nd = integer_or_blank(card, 6, 'nd', 600) elif method == 'INV': nd = integer_or_blank(card, 6, 'nd', 3 * ne) elif method in ['GIV', 'MGIV', 'HOU', 'MHOU']: nd = integer_or_blank(card, 6, 'nd', 0) else: nd = integer(card, 6, 'nd') norm = string_or_blank(card, 9, 'norm', 'MASS') if method == 'POINT': G = integer(card, 10, 'G') C = components(card, 11, 'C') else: G = blank(card, 10, 'G') C = blank(card, 11, 'C') assert len(card) <= 12, 'len(EIGR card) = %i\ncard=%s' % (len(card), card) return EIGR(sid, method, f1, f2, ne, nd, norm, G, C, comment=comment)
def add_card(cls, card, comment=''): """ Adds an EIGB card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ sid = integer(card, 1, 'sid') method = string_or_blank(card, 2, 'method') L1 = double(card, 3, 'L1') L2 = double(card, 4, 'L2') nep = integer_or_blank(card, 5, 'nep', 0) ndp = integer_or_blank(card, 6, 'ndp', 3 * nep) ndn = integer_or_blank(card, 7, 'ndn', 3 * nep) norm = string_or_blank(card, 9, 'norm', 'MAX') if norm == 'POINT': G = integer(card, 10, 'G') C = parse_components(card, 11, 'C') else: G = integer_or_blank(card, 10, 'G') C = components_or_blank(card, 11, 'C') assert len(card) <= 12, 'len(EIGB card) = %i\ncard=%s' % (len(card), card) return EIGB(sid, method, L1, L2, nep, ndp, ndn, norm, G, C, comment=comment)
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_or_string(card, n, 'x' + str(i + 1)) y = double_or_string(card, n + 1, 'y' + str(i + 1)) if x == 'SKIP' or y == 'SKIP': continue xy += [x, y] string(card, nfields, 'ENDT') is_data = False else: self.tid = data[0] self.xaxis = self.map_axis(data[1]) self.yaxis = self.map_axis(data[2]) xy = data[3:] is_data = True assert self.xaxis in ['LINEAR', 'LOG'], 'xaxis=%r' % (self.xaxis) assert self.yaxis in ['LINEAR', 'LOG'], 'yaxis=%r' % (self.yaxis) self.parse_fields(xy, nrepeated=2, is_data=is_data)
def add_card(cls, card, comment=''): """ Adds a RADCAV card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ icavity = integer(card, 1, 'icavity') ele_amb = integer_or_blank(card, 2, 'ele_amb') shadow = string_or_blank(card, 3, 'shadow', 'YES') scale = double_or_blank(card, 4, 'scale', 0.0) prtpch = integer_or_blank(card, 5, 'prtpch') nefci = string_or_blank(card, 6, 'nefci') rmax = double_or_blank(card, 7, 'rmax', 1.0) ncomp = integer_or_blank(card, 8, 'ncomp', 32) sets = fields(integer, card, 'set', i=9, j=card.nfields) return RADCAV(icavity, sets, ele_amb=ele_amb, shadow=shadow, scale=scale, prtpch=prtpch, nefci=nefci, rmax=rmax, ncomp=ncomp, comment=comment)
def add_card(cls, card, comment=''): nlparm_id = integer(card, 1, 'nlparm_id') ninc = integer_or_blank(card, 2, 'ninc', 10) dt = double_or_blank(card, 3, 'dt', 0.0) kmethod = string_or_blank(card, 4, 'kMethod', 'AUTO') kStep = integer_or_blank(card, 5, 'kStep', 5) maxIter = integer_or_blank(card, 6, 'maxIter', 25) conv = string_or_blank(card, 7, 'conv', 'PW') int_out = string_or_blank(card, 8, 'intOut', 'NO') # line 2 epsU = double_or_blank(card, 9, 'epsU', 0.01) epsP = double_or_blank(card, 10, 'epsP', 0.01) epsW = double_or_blank(card, 11, 'epsW', 0.01) maxDiv = integer_or_blank(card, 12, 'maxDiv', 3) if kmethod == 'PFNT': maxQn = integer_or_blank(card, 13, 'maxQn', 0) else: maxQn = integer_or_blank(card, 13, 'maxQn', maxIter) maxLs = integer_or_blank(card, 14, 'maxLs', 4) fStress = double_or_blank(card, 15, 'fStress', 0.2) lsTol = double_or_blank(card, 16, 'lsTol', 0.5) # line 3 maxBisect = integer_or_blank(card, 17, '', 5) maxR = double_or_blank(card, 21, 'maxR', 20.) rTolB = double_or_blank(card, 23, 'rTolB', 20.) assert len(card) <= 24, 'len(NLPARM card) = %i\ncard=%s' % (len(card), card) return NLPARM(nlparm_id, ninc, dt, kmethod, kStep, maxIter, conv, int_out, epsU, epsP, epsW, maxDiv, maxQn, maxLs, fStress, lsTol, maxBisect, maxR, rTolB, comment=comment)
def add_card(cls, card, comment=''): sid = integer(card, 1, 'sid') method = string_or_blank(card, 2, 'method', 'LAN') f1 = double_or_blank(card, 3, 'f1') f2 = double_or_blank(card, 4, 'f2') ne = integer_or_blank(card, 5, 'ne') if method not in cls.allowed_methods: msg = 'method=%s; allowed_methods=[%s]' % ( method, ', '.join(cls.allowed_methods)) raise ValueError(msg) if method == 'SINV': nd = integer_or_blank(card, 6, 'nd', 600) if method == 'INV': nd = integer_or_blank(card, 6, 'nd', 3 * ne) elif method in ['GIV', 'MGIV', 'HOU', 'MHOU']: nd = integer_or_blank(card, 6, 'nd', 0) else: nd = integer(card, 6, 'nd') norm = string_or_blank(card, 9, 'norm', 'MASS') if method == 'POINT': G = integer(card, 10, 'G') C = components(card, 11, 'C') else: G = blank(card, 10, 'G') C = blank(card, 11, 'C') assert len(card) <= 12, 'len(EIGR card) = %i\ncard=%s' % (len(card), card) return EIGR(sid, method, f1, f2, ne, nd, norm, G, C, comment=comment)
def __init__(self, card=None, data=None, comment=''): """ Intilizes the CORD3G :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\ncard=%s' % (len(card), card) # EQN for DEQATN, TABLE for TABLE3D assert self.form in ['EQN', 'TABLE']
def add_card(cls, card, comment=''): """ Adds a TSTEPNL card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ sid = integer(card, 1, 'sid') ndt = integer(card, 2, 'ndt') dt = double(card, 3, 'dt') no = integer_or_blank(card, 4, 'no', 1) #: .. note:: not listed in all QRGs method = string_or_blank(card, 5, 'method', 'ADAPT') if method == 'ADAPT': kstep = integer_or_blank(card, 6, 'kStep', 2) elif method == 'ITER': kstep = integer_or_blank(card, 6, 'kStep', 10) elif method in ['AUTO', 'TSTEP', 'SEMI']: kstep = None #kstep = blank(card, 6, 'kStep') #: .. todo:: not blank else: msg = 'invalid TSTEPNL Method. method=%r; allowed_methods=[%s]' % ( method, ', '.join(cls.allowed_methods)) raise RuntimeError(msg) max_iter = integer_or_blank(card, 7, 'maxIter', 10) conv = string_or_blank(card, 8, 'conv', 'PW') # line 2 eps_u = double_or_blank(card, 9, 'epsU', 1.E-2) eps_p = double_or_blank(card, 10, 'epsP', 1.E-3) eps_w = double_or_blank(card, 11, 'epsW', 1.E-6) max_div = integer_or_blank(card, 12, 'maxDiv', 2) max_qn = integer_or_blank(card, 13, 'maxQn', 10) max_ls = integer_or_blank(card, 14, 'MaxLs', 2) fstress = double_or_blank(card, 15, 'fStress', 0.2) # line 3 max_bisect = integer_or_blank(card, 17, 'maxBisect', 5) adjust = integer_or_blank(card, 18, 'adjust', 5) mstep = integer_or_blank(card, 19, 'mStep') rb = double_or_blank(card, 20, 'rb', 0.6) max_r = double_or_blank(card, 21, 'maxR', 32.) utol = double_or_blank(card, 22, 'uTol', 0.1) rtol_b = double_or_blank(card, 23, 'rTolB', 20.) # not listed in all QRGs min_iter = integer_or_blank(card, 24, 'minIter') assert len(card) <= 25, 'len(TSTEPNL card) = %i\ncard=%s' % (len(card), card) return TSTEPNL( sid, ndt, dt, no, method, kstep, max_iter, conv, eps_u, eps_p, eps_w, max_div, max_qn, max_ls, fstress, max_bisect, adjust, mstep, rb, max_r, utol, rtol_b, min_iter, comment=comment)
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') option_values = [interpret_value(field) for field in card[9:]] self.options = [] self.values = [] for option_value in option_values: try: (option, value) = option_value.split('=') except AttributeError: msg = 'parsing EIGRL card incorrectly; option_values=%s\ncard=%s' % ( option_values, card) raise RuntimeError(msg) 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 add_card(cls, card, comment=''): seid = integer(card, 1, 'seid') superelement_type = string(card, 2, 'superelement_type') rseid = integer_or_blank(card, 3, 'rseid', 0) method = string_or_blank(card, 4, 'method', 'AUTO') tol = double_or_blank(card, 5, 'tol', 1e-5) loc = string_or_blank(card, 6, 'loc', 'YES') unitno = integer_or_blank(card, 7, 'seid') assert len(card) <= 8, f'len(SEBULK card) = {len(card):d}\ncard={card}' return SEBULK(seid, superelement_type, rseid, method=method, tol=tol, loc=loc, unitno=unitno, comment=comment)
def add_card(cls, card, comment=''): pid = integer(card, 1, 'pid') cordm = integer_or_blank(card, 2, 'cordm', 0) psdir = integer_or_blank(card, 3, 'psdir', 13) sb = double_or_blank(card, 4, 'sb') nb = double_or_blank(card, 5, 'nb') tref = double_or_blank(card, 6, 'tref', 0.0) ge = double_or_blank(card, 7, 'ge', 0.0) nfields = len(card) - 1 #nrows = ifield = 9 global_ply_ids = [] mids = [] thicknesses = [] thetas = [] failure_theories = [] interlaminar_failure_theories = [] souts = [] iply = 1 while ifield < nfields: global_ply_id = integer(card, ifield, 'global_ply_id_%i' % iply) mid = integer(card, ifield + 1, 'mid_%i' % iply) t = double(card, ifield + 2, 'thickness_%i' % iply) theta = double(card, ifield + 3, 'theta_%i' % iply) ft = string_or_blank(card, ifield + 4, 'failure_theory_%i' % iply) ift = string_or_blank(card, ifield + 5, 'interlaminar_failure_theory_%i' % iply) sout = string_or_blank(card, ifield + 6, 'sout_%i' % iply, 'NO') global_ply_ids.append(global_ply_id) mids.append(mid) thicknesses.append(t) thetas.append(theta) failure_theories.append(ft) interlaminar_failure_theories.append(ift) souts.append(sout) iply += 1 ifield += 8 assert len(card) <= ifield, 'len(PCOMPS card) = %i\ncard=%s' % ( len(card), card) return PCOMPS(pid, cordm, psdir, sb, nb, tref, ge, global_ply_ids, mids, thicknesses, thetas, failure_theories, interlaminar_failure_theories, souts, comment=comment)
def add_card(cls, card, comment=''): pid = integer(card, 1, 'pid') # z0 will be calculated later nsm = double_or_blank(card, 3, 'nsm', 0.0) sb = double_or_blank(card, 4, 'sb', 0.0) ft = string_or_blank(card, 5, 'ft') TRef = double_or_blank(card, 6, 'TRef', 0.0) ge = double_or_blank(card, 7, 'ge', 0.0) lam = string_or_blank(card, 8, 'lam') fields = card.fields(9) #T = 0. # thickness mid_last = None thick_last = None i = 0 #n = 0 mids = [] thicknesses = [] thetas = [] souts = [] global_ply_ids = [] while i < len(fields): global_ply_id = integer(card, 9 + i, 'global_ply_id') mid = integer_or_blank(card, 9 + i + 1, 'mid', mid_last) # can be blank 2nd time thru thickness = double_or_blank(card, 9 + i + 2, 'thickness', thick_last) theta = double_or_blank(card, 9 + i + 3, 'theta', 0.0) sout = string_or_blank(card, 9 + i + 4, 'sout', 'NO') #print('n=%s global_ply_id=%s mid=%s thickness=%s len=%s' %( # n,global_ply_id,mid,thickness,len(fields))) mids.append(mid) thicknesses.append(thickness) thetas.append(theta) souts.append(sout) global_ply_ids.append(global_ply_id) assert mid is not None assert thickness is not None assert isinstance(mid, int), 'mid=%s' % mid assert isinstance(thickness, float), 'thickness=%s' % thickness mid_last = mid thick_last = thickness #T += thickness i += 8 #n += 1 z0 = double_or_blank(card, 2, 'z0') return PCOMPG(pid, global_ply_ids, mids, thicknesses, thetas, souts, nsm, sb, ft, TRef, ge, lam, z0, comment=comment)
def add_card(cls, card, comment=''): """ Adds an EIGRL card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ sid = integer(card, 1, 'sid') v1 = double_or_blank(card, 2, 'v1') v2 = double_or_blank(card, 3, 'v2') nd = integer_or_blank(card, 4, 'nd') msglvl = integer_or_blank(card, 5, 'msglvl', 0) maxset = integer_or_blank(card, 6, 'maxset') shfscl = double_or_blank(card, 7, 'shfscl') norm = string_or_blank(card, 8, 'norm') option_values = [interpret_value(field) for field in card[9:]] options = [] values = [] for option_value in option_values: try: (option, value) = option_value.split('=') except AttributeError: msg = 'parsing EIGRL card incorrectly; option_values=%s\ncard=%s' % ( option_values, card) raise RuntimeError(msg) options.append(option) 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: norm = string_or_blank(card, 8, 'norm') #assert len(card) <= 9, f'len(EIGRL card) = {len(card):d}\ncard={card}' assert len(card) <= 10, f'len(EIGRL card) = {len(card):d}\ncard={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)) return EIGRL(sid, v1, v2, nd, msglvl, maxset, shfscl, norm, options, values, comment=comment)
def add_card(self, card, comment=None): i = self.i self._comments.append(comment) #element_ids = {} #for i in range(ncards): #element_ids[i] = [] self.load_id[i] = integer(card, 1, 'load_id') eid = integer(card, 2, 'element_id') self.element_ids[i] = 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[i, :] = p self.element_ids[i] = [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.element_ids[i] = list( unique( expand_thru([eid, 'THRU', eid2], set_fields=False, sort_fields=False))) #self.g1 = None #self.g34 = None else: #: used for CPENTA, CHEXA self.element_ids[i] = [eid] #: used for solid element only self.g1[i] = integer_or_blank(card, 7, 'g1', -1) #: g3/g4 - different depending on CHEXA/CPENTA or CTETRA self.g34[i] = integer_or_blank(card, 8, 'g34', -1) #: Coordinate system identification number. See Remark 2. #: (Integer >= 0;Default=0) self.cid[i] = integer_or_blank(card, 9, 'cid', 0) self.nvector[i, :] = [ double_or_blank(card, 10, 'N1'), double_or_blank(card, 11, 'N2'), double_or_blank(card, 12, 'N3'), ] self.sorl[i] = string_or_blank(card, 13, 'sorl', 'SURF') self.ldir[i] = string_or_blank(card, 14, 'ldir', 'NORM') assert len(card) <= 15, 'len(PLOAD4 card) = %i\ncard=%s' % (len(card), card) self.i += 1
def add_card(cls, card, comment=''): """ Adds a PCOMPS card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ pid = integer(card, 1, 'pid') cordm = integer_or_blank(card, 2, 'cordm', 0) psdir = integer_or_blank(card, 3, 'psdir', 13) sb = double_or_blank(card, 4, 'sb') nb = double_or_blank(card, 5, 'nb') tref = double_or_blank(card, 6, 'tref', 0.0) ge = double_or_blank(card, 7, 'ge', 0.0) nfields = len(card) - 1 #nrows = ifield = 9 global_ply_ids = [] mids = [] thicknesses = [] thetas = [] failure_theories = [] interlaminar_failure_theories = [] souts = [] iply = 1 while ifield < nfields: global_ply_id = integer(card, ifield, 'global_ply_id_%i' % iply) mid = integer(card, ifield + 1, 'mid_%i' % iply) t = double(card, ifield + 2, 'thickness_%i' % iply) theta = double(card, ifield + 3, 'theta_%i' % iply) ft = string_or_blank(card, ifield + 4, 'failure_theory_%i' % iply) ift = string_or_blank(card, ifield + 5, 'interlaminar_failure_theory_%i' % iply) sout = string_or_blank(card, ifield + 6, 'sout_%i' % iply, 'NO') global_ply_ids.append(global_ply_id) mids.append(mid) thicknesses.append(t) thetas.append(theta) failure_theories.append(ft) interlaminar_failure_theories.append(ift) souts.append(sout) iply += 1 ifield += 8 assert len(card) <= ifield, f'len(PCOMPS card) = {len(card):d}\ncard={card}' return PCOMPS(pid, global_ply_ids, mids, thicknesses, thetas, cordm, psdir, sb, nb, tref, ge, failure_theories, interlaminar_failure_theories, souts, comment=comment)
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_card(self, card, comment=''): if comment: self._comment = comment #: 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.valid_types[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=''): 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_or_string(card, n, 'x' + str(i + 1)) y = double_or_string(card, n + 1, 'y' + str(i + 1)) if x == 'SKIP' or y == 'SKIP': continue xy += [x, y] string(card, nfields, 'ENDT') is_data = False else: self.tid = data[0] self.x1 = data[1] self.Type = data[2] xy = data[5:] is_data = True self.parse_fields(xy, nrepeated=2, is_data=is_data)
def add_card(cls, card, comment=''): pid = integer(card, 1, 'pid') mid = integer(card, 2, 'mid') stress_strain = string_or_blank(card, 3, 'stress_strain', 'GRID') assert len(card) <= 4, 'len(PLSOLID card) = %i\ncard=%s' % (len(card), card) return PLSOLID(pid, mid, stress_strain, comment=comment)
def add_card(cls, card, comment=''): """ Adds a PACABS card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ pid = integer(card, 1, 'pid') synth = string_or_blank(card, 2, 'synth', 'YES') tid_resistance = integer(card, 3, 'tid_resistance') tid_reactance = integer(card, 4, 'tid_reactance') tid_weight = integer(card, 5, 'tid_weight') # cutfr = double(card, 7, 'cutfr') b = double_or_blank(card, 8, 'b') k = double_or_blank(card, 9, 'k') m = double_or_blank(card, 10, 'm') assert len(card) <= 8, f'len(PACABS card) = {len(card):d}\ncard={card}' assert synth in ['YES', 'NO'], synth is_synth = synth == 'YES' return PACABS(pid, cutfr, b, k, m, synth=is_synth, tid_resistance=tid_resistance, tid_reactance=tid_reactance, tid_weight=tid_weight, comment=comment)
def add_card(self, card, 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, integer_types): 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 = np.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\ncard=%s' % (len(card), card)
def _read_shock(self, card, istart): """ F(u, v) = Cv * S(u) * sign(v) * |v|^ev """ 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) #def DEquation(self): #if isinstance(self.dequation, int): #return self.dequation #return self.dequation.equation_id else: raise RuntimeError('Invalid shockType=%r on card\n%s' %(self.shockType, card)) istart += 8 return istart
def add_card(cls, card, comment=''): """ Adds a CGEN card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ Type = string(card, 1, 'Type') feid = integer(card, 2, 'feid') pid = integer(card, 3, 'pid') fid = integer(card, 4, 'fid') direction = string_or_blank(card, 5, 'direction', 'L') th = integer_or_blank(card, 6, 'th') eidl = integer(card, 7, 'eidl') eidh = integer(card, 8, 'eidh') t_abcd = [ double_or_blank(card, 9, 'ta', 0.), double_or_blank(card, 10, 'tb', 0.), double_or_blank(card, 11, 'tc', 0.), double_or_blank(card, 12, 'td', 0.), ] return CGEN(Type, feid, pid, fid, th, eidl, eidh, t_abcd=t_abcd, direction=direction, comment=comment)
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 add_card(cls, card, comment=''): """ Adds a AXIF card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ cid = integer(card, 1, 'cid') g = double(card, 2, 'g') drho = double(card, 3, 'drho') db = double_or_blank(card, 4, 'db') no_sym = string(card, 5, 'no_sym') f = string_or_blank(card, 6, 'f') n = fields(integer_or_string, card, 'n', i=9, j=len(card)) #cid : int #G : float #drho : float #db : float #no_sym : str #F : str #Ni : List[int] assert len(card) >= 7, 'len(AXIF card) = %i\ncard=%s' % (len(card), card) return AXIF(cid, g, drho, db, no_sym, f, n, comment=comment)
def add_card(cls, card, comment=''): """ Adds a NLPCI card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ nlpci_id = integer(card, 1, 'nlpci_id') Type = string_or_blank(card, 2, 'Type', 'CRIS') minalr = double_or_blank(card, 3, 'minalr', 0.25) maxalr = double_or_blank(card, 4, 'maxalr', 4.0) scale = double_or_blank(card, 5, 'scale', 0.0) blank(card, 6, 'blank') desiter = integer_or_blank(card, 7, 'desiter', 12) mxinc = integer_or_blank(card, 8, 'mxinc', 20) return NLPCI(nlpci_id, Type=Type, minalr=minalr, maxalr=maxalr, scale=scale, desiter=desiter, mxinc=mxinc, comment=comment)
def add_card(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\ncard=%s' % (len(card), card) self.i += 1
def add_card(cls, card, comment=''): """ Adds a VIEW card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ iview = integer(card, 1, 'iview') icavity = integer(card, 2, 'icavity') shade = string_or_blank(card, 3, 'shade', default='BOTH') nbeta = integer_or_blank(card, 4, 'nbeta', default=1) ngamma = integer_or_blank(card, 5, 'ngamma', default=1) dislin = double_or_blank(card, 6, 'dislin', default=0.0) return VIEW(iview, icavity, shade=shade, nbeta=nbeta, ngamma=ngamma, dislin=dislin, comment=comment)
def add_card(cls, card, comment=''): """ Adds a LOADCYN card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ sid = integer(card, 1, 'sid') scale = double(card, 2, 'scale') segment_id = integer(card, 3, 'segment_id') segment_type = string_or_blank(card, 4, 'segment_type') scalei = double(card, 5, 'sid1') loadi = integer(card, 6, 'load1') scales = [scalei] load_ids = [loadi] scalei = double_or_blank(card, 7, 'sid2') if scalei is not None: loadi = double_or_blank(card, 8, 'load2') scales.append(scalei) load_ids.append(loadi) return LOADCYN(sid, scale, segment_id, scales, load_ids, segment_type=segment_type, comment=comment)
def add_card(cls, card, comment=''): pid = integer(card, 1, 'pid') mid = integer(card, 2, 'mid') # MATHE, MATHP cid = integer_or_blank(card, 3, 'cid', 0) stress_strain_output_location = string_or_blank(card, 4, 'str', 'GRID') return PLPLANE(pid, mid, cid, stress_strain_output_location, comment=comment)
def add_card(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\ncard=%s' % (len(card), card) self.i += 1
def add_card(cls, card, comment=''): sid = integer(card, 1, 'sid') ndt = integer(card, 2, 'ndt') dt = double(card, 3, 'dt') no = integer_or_blank(card, 4, 'no', 1) #: .. note:: not listed in all QRGs method = string_or_blank(card, 5, 'method', 'ADAPT') if method == 'ADAPT': kstep = integer_or_blank(card, 6, 'kStep', 2) elif method == 'ITER': kstep = integer_or_blank(card, 6, 'kStep', 10) elif method in ['AUTO', 'TSTEP']: kstep = None #kstep = blank(card, 6, 'kStep') #: .. todo:: not blank else: msg = 'invalid TSTEPNL Method. method=%r' % (method) raise RuntimeError(msg) max_iter = integer_or_blank(card, 7, 'maxIter', 10) conv = string_or_blank(card, 8, 'conv', 'PW') # line 2 eps_u = double_or_blank(card, 9, 'epsU', 1.E-2) eps_p = double_or_blank(card, 10, 'epsP', 1.E-3) eps_w = double_or_blank(card, 11, 'epsW', 1.E-6) max_div = integer_or_blank(card, 12, 'maxDiv', 2) max_qn = integer_or_blank(card, 13, 'maxQn', 10) max_ls = integer_or_blank(card, 14, 'MaxLs', 2) fstress = double_or_blank(card, 15, 'fStress', 0.2) # line 3 max_bisect = integer_or_blank(card, 17, 'maxBisect', 5) adjust = integer_or_blank(card, 18, 'adjust', 5) mstep = integer_or_blank(card, 19, 'mStep') rb = double_or_blank(card, 20, 'rb', 0.6) max_r = double_or_blank(card, 21, 'maxR', 32.) utol = double_or_blank(card, 22, 'uTol', 0.1) rtol_b = double_or_blank(card, 23, 'rTolB', 20.) # not listed in all QRGs min_iter = integer_or_blank(card, 24, 'minIter') assert len(card) <= 25, 'len(TSTEPNL card) = %i\ncard=%s' % (len(card), card) return TSTEPNL( sid, ndt, dt, no, method, kstep, max_iter, conv, eps_u, eps_p, eps_w, max_div, max_qn, max_ls, fstress, max_bisect, adjust, mstep, rb, max_r, utol, rtol_b, min_iter, comment=comment)
def add_card(self, card, comment=None): i = self.i self._comments.append(comment) #element_ids = {} #for i in range(ncards): #element_ids[i] = [] self.load_id[i] = integer(card, 1, 'load_id') eid = integer(card, 2, 'element_id') self.element_ids[i] = 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[i, :] = p self.element_ids[i] = [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.element_ids[i] = list(unique(expand_thru([eid, 'THRU', eid2], set_fields=False, sort_fields=False))) #self.g1 = None #self.g34 = None else: #: used for CPENTA, CHEXA self.element_ids[i] = [eid] #: used for solid element only self.g1[i] = integer_or_blank(card, 7, 'g1', -1) #: g3/g4 - different depending on CHEXA/CPENTA or CTETRA self.g34[i] = integer_or_blank(card, 8, 'g34', -1) #: Coordinate system identification number. See Remark 2. #: (Integer >= 0;Default=0) self.cid[i] = integer_or_blank(card, 9, 'cid', 0) self.nvector[i, :] = [ double_or_blank(card, 10, 'N1'), double_or_blank(card, 11, 'N2'), double_or_blank(card, 12, 'N3'), ] self.sorl[i] = string_or_blank(card, 13, 'sorl', 'SURF') self.ldir[i] = string_or_blank(card, 14, 'ldir', 'NORM') assert len(card) <= 15, 'len(PLOAD4 card) = %i\ncard=%s' % (len(card), card) self.i += 1
def add_card(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, "mach = %r" % self.mach assert self.mach != 1.0, "mach = %r" % 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 add_card(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, 'mach = %r' % self.mach assert self.mach != 1.0, 'mach = %r' % 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=''): 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_card(cls, card, comment=''): """ Adds a NLPARM card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ nlparm_id = integer(card, 1, 'nlparm_id') ninc = integer_or_blank(card, 2, 'ninc', 10) dt = double_or_blank(card, 3, 'dt', 0.0) kmethod = string_or_blank(card, 4, 'kmethod', 'AUTO') kstep = integer_or_blank(card, 5, 'kstep', 5) max_iter = integer_or_blank(card, 6, 'max_iter', 25) conv = string_or_blank(card, 7, 'conv', 'PW') int_out = string_or_blank(card, 8, 'intOut', 'NO') # line 2 eps_u = double_or_blank(card, 9, 'eps_u', 0.01) eps_p = double_or_blank(card, 10, 'eps_p', 0.01) eps_w = double_or_blank(card, 11, 'eps_w', 0.01) max_div = integer_or_blank(card, 12, 'max_div', 3) if kmethod == 'PFNT': max_qn = integer_or_blank(card, 13, 'max_qn', 0) else: max_qn = integer_or_blank(card, 13, 'max_qn', max_iter) max_ls = integer_or_blank(card, 14, 'max_ls', 4) fstress = double_or_blank(card, 15, 'fstress', 0.2) ls_tol = double_or_blank(card, 16, 'ls_tol', 0.5) # line 3 max_bisect = integer_or_blank(card, 17, 'max_bisect', 5) max_r = double_or_blank(card, 21, 'max_r', 20.) rtol_b = double_or_blank(card, 23, 'rtol_b', 20.) assert len(card) <= 24, 'len(NLPARM card) = %i\ncard=%s' % (len(card), card) return NLPARM(nlparm_id, ninc, dt, kmethod, kstep, max_iter, conv, int_out, eps_u, eps_p, eps_w, max_div, max_qn, max_ls, fstress, ls_tol, max_bisect, max_r, rtol_b, comment=comment)
def add_card(cls, card, comment=''): pid = integer(card, 1, 'pid') mid = integer(card, 2, 'mid') group = string_or_blank(card, 3, 'group', 'MSCBMLO') Type = string(card, 4, 'Type') # determine the number of required dimensions on the PBEAM ndim = cls.valid_types[Type] #: dimension list dims = [] dim = [] #: Section position xxb = [0.] #: Output flag so = ['YES'] #: non-structural mass :math:`nsm` nsm = [] i = 9 n = 0 while i < len(card): if n > 0: soi = string_or_blank(card, i, 'so_n=%i' % n, 'YES') xxbi = double_or_blank(card, i + 1, 'xxb_n=%i' % n, 1.0) so.append(soi) xxb.append(xxbi) i += 2 dim = [] for ii in range(ndim): dimi = double(card, i, 'dim_n=%i_ii=%i' % (n, ii)) dim.append(dimi) i += 1 dims.append(dim) nsmi = double_or_blank(card, i, 'nsm_n=%i' % n, 0.0) nsm.append(nsmi) n += 1 i += 1 return PBEAML(pid, mid, group, Type, xxb, so, dims, nsm, comment=comment)
def add_card(cls, card, comment=''): eid = integer(card, 1, 'eid') pid = integer_or_blank(card, 2, 'pid') ga = integer(card, 3, 'ga') gb = integer(card, 4, 'gb') cid = integer_or_blank(card, 5, 'cid', 0) plane = string_or_blank(card, 6, 'plane', 'XY') sptid = integer_or_blank(card, 7, 'sptid') assert len(card) <= 8, 'len(CBUSH2D card) = %i\ncard=%s' % (len(card), card) return CBUSH2D(eid, pid, ga, gb, cid, plane, sptid, comment=comment)
def add_card(cls, card, comment=''): nlpci_id = integer(card, 1, 'nlpci_id') Type = string_or_blank(card, 2, 'Type', 'CRIS') minalr = double_or_blank(card, 3, 'minalr', 0.25) maxalr = double_or_blank(card, 4, 'maxalr', 4.0) scale = double_or_blank(card, 5, 'scale', 0.0) blank(card, 6, 'blank') desiter = integer_or_blank(card, 7, 'desiter', 12) mxinc = integer_or_blank(card, 8, 'mxinc', 20) return NLPCI(nlpci_id, Type, minalr, maxalr, scale, desiter, mxinc, comment=comment)
def add_card(cls, card, comment=''): sid = integer(card, 1, 'sid') v1 = double_or_blank(card, 2, 'v1') v2 = double_or_blank(card, 3, 'v2') nd = integer_or_blank(card, 4, 'nd') msglvl = integer_or_blank(card, 5, 'msglvl', 0) maxset = integer_or_blank(card, 6, 'maxset') shfscl = double_or_blank(card, 7, 'shfscl') norm = string_or_blank(card, 8, 'norm') option_values = [interpret_value(field) for field in card[9:]] options = [] values = [] for option_value in option_values: try: (option, value) = option_value.split('=') except AttributeError: msg = 'parsing EIGRL card incorrectly; option_values=%s\ncard=%s' % ( option_values, card) raise RuntimeError(msg) options.append(option) 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: norm = string_or_blank(card, 8, 'norm') #assert len(card) <= 9, 'len(EIGRL card) = %i\ncard=%s' % (len(card), card) assert len(card) <= 10, 'len(EIGRL card) = %i\ncard=%s' % (len(card), 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)) return EIGRL(sid, v1, v2, nd, msglvl, maxset, shfscl, norm, options, values, comment=comment)
def __init__(self, card=None, data=None, comment=''): if comment: self._comment = comment self.nlpci_id = integer(card, 1, 'nlpci_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 = integer_or_blank(card, 7, 'desiter', 12) self.mxinc = integer_or_blank(card, 8, 'mxinc', 20)
def add_card(cls, card, comment=''): pid = integer(card, 1, 'pid') mid = integer(card, 2, 'mid') cordm = integer_or_blank(card, 3, 'cordm', 0) integ = integer_string_or_blank(card, 4, 'integ') stress = integer_string_or_blank(card, 5, 'stress') isop = integer_string_or_blank(card, 6, 'isop') fctn = string_or_blank(card, 7, 'fctn', 'SMECH') assert len(card) <= 8, 'len(PSOLID card) = %i\ncard=%s' % (len(card), card) return cls(pid, mid, cordm, integ, stress, isop, fctn, comment=comment)
def add_card(cls, card, comment=''): pid = integer(card, 1, 'pid') cordm = integer_or_blank(card, 2, 'cordm', 0) psdir = integer_or_blank(card, 3, 'psdir', 13) sb = double_or_blank(card, 4, 'sb') nb = double_or_blank(card, 5, 'nb') tref = double_or_blank(card, 6, 'tref', 0.0) ge = double_or_blank(card, 7, 'ge', 0.0) nfields = len(card) - 1 #nrows = ifield = 9 global_ply_ids = [] mids = [] thicknesses = [] thetas = [] failure_theories = [] interlaminar_failure_theories = [] souts = [] iply = 1 while ifield < nfields: global_ply_id = integer(card, ifield, 'global_ply_id_%i' % iply) mid = integer(card, ifield + 1, 'mid_%i' % iply) t = double(card, ifield + 2, 'thickness_%i' % iply) theta = double(card, ifield + 3, 'theta_%i' % iply) ft = string_or_blank(card, ifield + 4, 'failure_theory_%i' % iply) ift = string_or_blank(card, ifield + 5, 'interlaminar_failure_theory_%i' % iply) sout = string_or_blank(card, ifield + 6, 'sout_%i' % iply, 'NO') global_ply_ids.append(global_ply_id) mids.append(mid) thicknesses.append(t) thetas.append(theta) failure_theories.append(ft) interlaminar_failure_theories.append(ift) souts.append(sout) iply += 1 ifield += 8 assert len(card) <= ifield, 'len(PCOMPS card) = %i\ncard=%s' % (len(card), card) return PCOMPS(pid, cordm, psdir, sb, nb, tref, ge, global_ply_ids, mids, thicknesses, thetas, failure_theories, interlaminar_failure_theories, souts, comment=comment)
def add_card(cls, card, comment=''): tid = integer(card, 1, 'tid') xaxis = string_or_blank(card, 2, 'xaxis', 'LINEAR') 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' % cls.type) xy = [] for i in range(nterms): n = 9 + i * 2 if card.field(n) == 'ENDT': break x = double_or_string(card, n, 'x' + str(i + 1)) y = double_or_string(card, n + 1, 'y' + str(i + 1)) if x == 'SKIP' or y == 'SKIP': continue xy.append([x, y]) string(card, nfields, 'ENDT') x, y = make_xy(tid, 'TABRND1', xy) return TABRND1(tid, x, y, xaxis=xaxis, yaxis=yaxis, comment=comment)