def __init__(self, card=None, data=None, comment=''): ThermalBC.__init__(self) if comment: self.comment = comment if card: #: NODAMB Ambient point for radiation exchange. (Integer > 0) self.nodamb = integer(card, 1, 'nodamb') assert self.nodamb > 0 #: Radiation view factor between the face and the ambient point. #: (Real > 0.0) self.famb = double(card, 2, 'famb') assert self.famb > 0.0 #: Control point for thermal flux load. (Integer > 0; Default = 0) self.cntrlnd = integer_or_blank(card, 3, 'cntrlnd', 0) assert self.cntrlnd >= 0 nfields = card.nfields eids = fields(integer_or_string, card, 'eid', i=4, j=nfields) #: CHBDYi element identification number self.eids = expand_thru_by(eids) else: raise NotImplementedError(data) min_eid = min(self.eids) if min_eid < 1: msg = 'min(eids)=%i' % min_eid raise ValueError(msg)
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 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(self, card, comment=''): """ Adds a PLOAD2 card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ sid = integer(card, 1, 'sid') pressure = double(card, 2, 'p') if integer_string_or_blank(card, 4, 'THRU') == 'THRU': e1 = integer(card, 3, 'Element1') e2 = integer(card, 5, 'Element1') eids = [i for i in range(e1, e2 + 1)] assert len(card) == 6, 'len(PLOAD2 card) = %i\ncard=%s' % ( len(card), card) else: eids = fields(integer, card, 'eid', i=3, j=len(card)) for eid in eids: self.add(sid, pressure, eid, comment=comment) comment = ''
def add_card(cls, card, comment=''): """ Adds an FLFACT card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ sid = integer(card, 1, 'sid') assert len(card) > 2, 'len(FLFACT card)=%s; card=%s' % (len(card), card) field3 = double_string_or_blank(card, 3, 'THRU') if field3 is None: f1 = double(card, 2, 'f1') factors = [f1] assert len(card) == 3, 'len(FLFACT card)=%s; card=%s' % (len(card), card) elif isinstance(field3, float): factors = fields(double, card, 'factors', i=2, j=len(card)) elif isinstance(field3, string_types) and field3 == 'THRU': f1 = double(card, 2, 'f1') fnf = double(card, 4, 'fnf') nf = integer(card, 5, 'nf') fmid_default = (f1 + fnf) / 2. fmid = double_or_blank(card, 6, 'fmid', fmid_default) assert len(card) <= 7, 'len(FLFACT card)=%s; card=%s' % (len(card), card) factors = [f1, 'THRU', fnf, nf, fmid] else: raise SyntaxError('expected a float or string for FLFACT field 3; value=%r' % field3) return FLFACT(sid, factors, comment=comment)
def __init__(self, card=None, data=None, comment=''): ThermalBC.__init__(self, card, data) if comment: self._comment = comment if card: #: NODAMB Ambient point for radiation exchange. (Integer > 0) self.nodamb = integer(card, 1, 'nodamb') assert self.nodamb > 0 #: Radiation view factor between the face and the ambient point. #: (Real > 0.0) self.famb = double(card, 2, 'famb') assert self.famb > 0.0 #: Control point for thermal flux load. (Integer > 0; Default = 0) self.cntrlnd = integer_or_blank(card, 3, 'cntrlnd', 0) assert self.cntrlnd >= 0 nfields = card.nfields eids = fields(integer_or_string, card, 'eid', i=4, j=nfields) #: CHBDYi element identification number self.eids = expand_thru_by(eids) else: raise NotImplementedError(data) min_eid = min(self.eids) if min_eid < 1: msg = 'min(eids)=%i' % min_eid raise ValueError(msg)
def add_card(cls, card, comment=''): sid = integer(card, 1, 'sid') Q0 = double(card, 2, 'Q0') cntrlnd = integer_or_blank(card, 3, 'cntrlnd', 0) nfields = card.nfields eids = fields(integer_or_string, card, 'eid', i=4, j=nfields) return QBDY3(sid, Q0, cntrlnd, eids, comment=comment)
def _read_ge(cls, card, istart): # Flag indicating that the next fields, 1 through 6 are structural # damping constants. See Remark 7. (Character) #self.ge = string(card, istart, 'ge') #: Nominal structural damping constant in directions 1 through 6. See #: Remarks 2. and 3. (Real; Default = 0.0) GEi = fields(double_or_blank, card, 'GEi', istart + 1, istart + 7) return GEi
def _read_k(cls, card, istart): # Flag indicating that the next 1 to 6 fields are stiffness values in # the element coordinate system. #self.k = string(card, istart, 'k') #: Nominal stiffness values in directions 1 through 6. #: See Remarks 2 and 3. (Real; Default = 0.0) Ki = fields(double_or_blank, card, 'Ki', istart + 1, istart + 7) return Ki
def add_card(cls, card, comment=''): eid = integer(card, 1, 'eid') pid = integer(card, 2, 'pid') # required 1-10, 19-28 # optional 11-18, 29-36, 37-64 # all/none 37-46 nids = fields(integer_or_blank, card, 'nid', 3, 67) # cap at +3 = 67 assert len(card) <= 67, 'len(CRAC3D card) = %i\ncard=%s' % (len(card), card) return CRAC3D(eid, pid, nids, comment=comment)
def _read_b(cls, card, istart): # Flag indicating that the next 1 to 6 fields are force-per-velocity # damping. #self.b = string(card, istart, 'b') #: Force per unit velocity (Real) #: Nominal damping coefficients in direction 1 through 6 in units of #: force per unit velocity. See Remarks 2, 3, and 9. (Real; Default=0.) Bi = fields(double_or_blank, card, 'Bi', istart + 1, istart + 7) return Bi
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment self.seid = integer(card, 1, 'seid') #: Grid or scalar point identification number. #: (0 < Integer < 1000000; G1 < G2) self.IDs = [] IDs = fields(integer_or_string, card, 'ID', i=2, j=len(card)) self.IDs = expand_thru(IDs) self.clean_ids()
def add_card(cls, card, comment=''): """ Adds a RADSET card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ ids = fields(integer_or_string, card, 'Cavity_', i=1, j=len(card)) return RADSET(ids, comment=comment)
def add_card(cls, card, comment=''): sid = integer(card, 1, 'sid') ids = fields(integer_or_string, card, 'ID', i=2, j=len(card)) is_skin = False i = 0 if len(ids) > 0: if isinstance(ids[0], string_types) and ids[0] == 'SKIN': is_skin = True i += 1 else: assert len(card) > 2, card return SET1(sid, ids[i:], is_skin=is_skin, comment=comment)
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 """ nids = fields(integer, card, 'n', i=1, j=len(card)) return CYAX(nids, comment=comment)
def add_card(cls, card, comment=''): """ Adds a FREQ card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ sid = integer(card, 1, 'sid') freqs = fields(double, card, 'freq', i=2, j=len(card)) return FREQ(sid, freqs, comment=comment)
def add_card(cls, card, comment=''): """ Adds a SESET card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ seid = integer_or_blank(card, 1, 'seid', 0) ids = fields(integer_or_string, card, 'ID', i=2, j=len(card)) return SESET(seid, ids, comment=comment)
def add_card(cls, card, comment=''): """ Adds a RADMTX card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ icavity = integer(card, 1, 'icavity') index = integer(card, 2, 'index') exchange_factors = fields(double, card, 'eid', i=3, j=card.nfields) return RADMTX(icavity, index, exchange_factors, comment=comment)
def add_card(cls, card, comment=''): """ Adds a SET3 card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ sid = integer(card, 1, 'sid') desc = string(card, 2, 'desc') ids = fields(integer_or_string, card, 'ID', i=3, j=len(card)) return SET3(sid, desc, ids, comment=comment)
def __init__(self, card=None, data=None, comment=''): SetSuper.__init__(self, card, data) if comment: self._comment = comment #: Identification number for secondary superelement. (Integer >= 0). self.ssid = integer(card, 1, 'ssid') #: Identification number for the primary superelement. (Integer >= 0). self.psid = integer(card, 2, 'psid') #: Exterior grid point identification numbers for the primary #: superelement. (Integer > 0) self.IDs = [] IDs = fields(integer_or_string, card, i=3, j=len(card)) self.IDs = expand_thru(IDs) self.clean_ids()
def add_card(cls, card, comment=''): """ Adds a RADLST card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ icavity = integer(card, 1, 'icavity') matrix_type = integer_or_blank(card, 2, 'matrix_type', 1) eids = fields(integer, card, 'eid', i=3, j=card.nfields) return RADLST(icavity, eids, matrix_type=matrix_type, comment=comment)
def add_card(cls, card, comment=''): """ Adds a RADM card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ nfields = card.nfields radmid = integer(card, 1, 'radmid') absorb = double_or_blank(card, 2, 'absorb') emissivity = fields(double, card, 'emissivity', i=3, j=nfields) return RADM(radmid, absorb, emissivity, comment=comment)
def add_card(cls, card, comment=''): """ Adds a CYJOIN card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ side = integer(card, 1, 'side') coord = string(card, 2, 'coord') nids = fields(integer_or_string, card, 'ID', i=3, j=len(card)) return CYJOIN(side, coord, nids, comment=comment)
def add_card(cls, card, comment=''): """ Adds a QBDY3 card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ sid = integer(card, 1, 'sid') q0 = double(card, 2, 'q0') cntrlnd = integer_or_blank(card, 3, 'cntrlnd', 0) nfields = card.nfields eids = fields(integer_or_string, card, 'eid', i=4, j=nfields) return QBDY3(sid, q0, cntrlnd, eids, comment=comment)
def add_card(cls, card, comment=''): """ Adds a RADBC card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ nodamb = integer(card, 1, 'nodamb') famb = double(card, 2, 'famb') cntrlnd = integer_or_blank(card, 3, 'cntrlnd', 0) nfields = card.nfields eids = fields(integer_or_string, card, 'eid', i=4, j=nfields) return RADBC(nodamb, famb, cntrlnd, eids, comment=comment)
def __init__(self, card=None, data=None, comment=''): ThermalBC.__init__(self, card, data) if comment: self._comment = comment if card: #: Material identification number self.radmid = integer(card, 1, 'radmid') assert self.radmid > 0 self.absorb = double(card, 2, 'absorb') assert 0. <= self.absorb <= 1.0 nfields = card.nfields self.emissivity = fields(double, card, 'emissivity', i=3, j=nfields) else: raise NotImplementedError(data) for e in self.emissivity: assert 0. <= e <= 1.0
def add_card(cls, card, comment=''): """ Adds a CRAC3D card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ eid = integer(card, 1, 'eid') pid = integer(card, 2, 'pid') # required 1-10, 19-28 # optional 11-18, 29-36, 37-64 # all/none 37-46 nids = fields(integer_or_blank, card, 'nid', 3, 67) # cap at +3 = 67 assert len(card) <= 67, 'len(CRAC3D card) = %i\ncard=%s' % (len(card), card) return CRAC3D(eid, pid, nids, comment=comment)
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment #: Unique identification number. (Integer > 0) self.sid = integer(card, 1, 'sid') #: Set description (Character). Valid options are 'GRID', 'ELEM', #: 'POINT' and 'PROP'. self.desc = string(card, 2, 'desc') if self.desc == 'ELEM': self.desc = 'ELEMENT' assert self.desc in ['GRID', 'POINT', 'ELEMENT', 'PROP'], 'desc = %r' % self.desc #: Identifiers of grids points, elements, points or properties. #: (Integer > 0) self.IDs = [] IDs = fields(integer_or_string, card, 'ID', i=3, j=len(card)) self.IDs = expand_thru(IDs) self.clean_ids()
def add_card(cls, card, comment=''): """ Adds a SET1 card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ sid = integer(card, 1, 'sid') ids = fields(integer_or_string, card, 'ID', i=2, j=len(card)) is_skin = False i = 0 if len(ids) > 0: if isinstance(ids[0], string_types) and ids[0] == 'SKIN': is_skin = True i += 1 else: assert len(card) > 2, card return SET1(sid, ids[i:], is_skin=is_skin, comment=comment)
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment #: Unique identification number. (Integer > 0) self.sid = integer(card, 1, 'sid') self.IDs = [] IDs = fields(integer_or_string, card, 'ID', i=2, j=len(card)) self.is_skin = False i = 0 if isinstance(IDs[0], string_types) and IDs[0] == 'SKIN': self.is_skin = True i += 1 #: List of structural grid point or element identification numbers. #: (Integer > 0 or 'THRU'; for the 'THRU' option, ID1 < ID2 or 'SKIN'; #: in field 3) self.IDs = expand_thru(IDs[i:]) self.clean_ids() self.xref_type = None
def add(self, card, comment): i = self.i self.property_id[i] = integer(card, 1, 'property_id') self.material_id[i] = integer(card, 2, 'material_id') self.group[i] = string_or_blank(card, 3, 'group', 'MSCBMLO') Type = string(card, 4, 'Type') self.Type[i] = Type ndim = self.valid_types[Type] j = 9 + ndim + 1 dim = fields(double_or_blank, card, 'dim', i=9, j=j) nsm = double_or_blank(card, 9 + ndim + 1, 'nsm', 0.0) if ndim > 0: nsm = set_default_if_blank(dim.pop(), 0.0) #else: #nsm = 0.0 self.dim[i] = dim self.nsm[i] = nsm assert isinstance(nsm, float), 'nsm=%r' % nsm if Type not in self.valid_types: msg = ('Invalid PBARL Type, Type=%s ' 'valid_types=%s' % (Type, self.valid_types.keys())) raise RuntimeError(msg) if len(dim) != self.valid_types[Type]: msg = 'dim=%s len(dim)=%s Type=%s len(dimType)=%s' % ( dim, len(dim), Type, self.valid_types[Type]) raise RuntimeError(msg) assert None not in dim self.i += 1
def __init__(self, card=None, data=None, comment=''): if comment: self._comment = comment self.sid = integer(card, 1, 'sid') self.freqs = fields(double, card, 'freq', i=2, j=len(card)) self.clean_freqs()
def add_card(cls, card, comment=''): ssid = integer(card, 1, 'ssid') psid = integer(card, 2, 'psid') ids = fields(integer_or_string, card, 'ID', i=3, j=len(card)) return SEQSEP(ssid, psid, ids, comment=comment)
def add_card(cls, card, comment=''): seid = integer_or_blank(card, 1, 'seid', 0) ids = fields(integer_or_string, card, 'ID', i=2, j=len(card)) return SESET(seid, ids, comment=comment)
def add_card(cls, card, comment=''): nfields = card.nfields radmid = integer(card, 1, 'radmid') absorb = double(card, 2, 'absorb') emissivity = fields(double, card, 'emissivity', i=3, j=nfields) return RADM(radmid, absorb, emissivity, comment=comment)
def add_card(cls, card, comment=''): sid = integer(card, 1, 'sid') desc = string(card, 2, 'desc') ids = fields(integer_or_string, card, 'ID', i=3, j=len(card)) return SET3(sid, desc, ids, comment=comment)
def add_card(cls, card, comment=''): sid = integer(card, 1, 'sid') freqs = fields(double, card, 'freq', i=2, j=len(card)) return FREQ(sid, freqs, comment=comment)
def _read_var(cls, card, var_prefix, istart, iend): print(card[istart:iend + 1]) Ki = fields(double_string_or_blank, card, var_prefix, istart, iend) return Ki
def _read_var(cls, card, var_prefix, istart, iend): Ki = fields(double_or_blank, card, var_prefix, istart, iend) return Ki