def __init__(self, sid: int, nroots: int, machs: List[float], comment: str = ''): """ Creates an DIVERG card, which is used in divergence analysis (SOL 144). Parameters ---------- sid : int The name nroots : int the number of roots machs : List[float, ..., float] list of Mach numbers comment : str; default='' a comment for the card """ BaseCard.__init__(self) if comment: self.comment = comment self.sid = sid self.nroots = nroots self.machs = machs
def __init__(self, lid_s0, seid, lid_se, comment=''): BaseCard.__init__(self) if comment: self.comment = comment self.lid_s0 = lid_s0 self.seid = seid self.lid_se = lid_se
def __init__(self, seid, p1, p2, p3, comment=''): BaseCard.__init__(self) if comment: self.comment = comment self.seid = seid self.nodes = [p1, p2, p3] self.nodes_ref = None
def __init__(self, sid, ring_id, hid, scale, f_rtz, comment=''): """ Creates a PLOADX1 card, which defines surface traction for axisymmetric elements. Parameters ---------- sid: int Load set identification number. ring_id : int RINGAX entry identification number. hid: int Harmonic identification number or a sequence of harmonics. scale : float Scale factor for the force. f_rtz Force components in r, φ, z directions. comment : str; default='' a comment for the card """ BaseCard.__init__(self) if comment: self.comment = comment self.sid = sid self.ring_id = ring_id self.hid = hid self.scale = scale self.f_rtz = np.asarray(f_rtz) self.ring_id_ref = None
def __init__(self, sid, eid, t, tpy, tpz, tc, td, te, tf, eids, comment=''): BaseCard.__init__(self) self.comment = comment self.sid = sid self.eid = eid self.t = t self.tpy = tpy self.tpz = tpz self.tc = tc self.td = td self.te = te self.tf = tf self.eids = eids assert len(eids) > 0, str(self) self.eid_ref = None self.eids_ref = None
def __init__(self, sid, sets, comment=''): BaseCard.__init__(self) if comment: self.comment = comment self.sid = sid self.sets = expand_thru(sets) self.sets.sort()
def __init__(self, sid, dload, wg, x0, V=None, comment=''): """ Creates a GUST card, which defines a stationary vertical gust for use in aeroelastic response analysis. Parameters ---------- sid : int gust load id dload : int TLOADx or RLOADx entry that defines the time/frequency dependence wg : float Scale factor (gust velocity/forward velocity) for gust velocity x0 : float Streamwise location in the aerodynamic coordinate system of the gust reference point. V : float; default=None float : velocity of the vehicle (must be the same as the velocity on the AERO card) None : ??? comment : str; default='' a comment for the card """ BaseCard.__init__(self) if comment: self.comment = comment self.sid = sid self.dload = dload self.wg = wg self.x0 = x0 self.V = V
def __init__(self, seid, label, comment=''): BaseCard.__init__(self) if comment: self.comment = comment self.seid = seid self.label = label
def __init__(self, sid, factors, comment=''): """ Creates an FLFACT card, which defines factors used for flutter analysis. These factors define either: - density - mach - velocity - reduced frequency depending on the FLUTTER method chosen (e.g., PK, PKNL, PKNLS) Parameters ---------- sid : int the id of a density, reduced_frequency, mach, or velocity table the FLUTTER card defines the meaning factors : varies values : List[float, ..., float] list of factors List[f1, THRU, fnf, nf, fmid] f1 : float first value THRU : str the word THRU fnf : float second value nf : int number of values fmid : float; default=(f1 + fnf) / 2. the mid point to bias the array TODO: does f1 need be be greater than f2/fnf??? comment : str; default='' a comment for the card """ BaseCard.__init__(self) if comment: self.comment = comment self.sid = sid #self.f1 = f1 #self.fnf = fnf #self.nf = nf #self.fmid = fmid # the dumb string_types thing is because we also get floats if len(factors) > 1 and isinstance(factors[1], string_types) and factors[1] == 'THRU': #msg = 'embedded THRUs not supported yet on FLFACT card\n' nfactors = len(factors) if nfactors == 4: (f1, _thru, fnf, nf) = factors fmid = (f1 + fnf) / 2. elif nfactors == 5: (f1, _thru, fnf, nf, fmid) = factors #assert _thru.upper() == 'THRU', 'factors=%s' % str(factors) else: raise RuntimeError('factors must be length 4/5; factors=%s' % factors) i = np.linspace(0, nf, nf, endpoint=False) + 1 factors = ( (f1*(fnf - fmid) * (nf-i) + fnf * (fmid - f1) * (i-1)) / ( (fnf - fmid) * (nf-i) + (fmid - f1) * (i-1)) ) self.factors = np.asarray(factors)
def __init__(self, seid_a, seid_b, tol, loc, nodes_a, nodes_b, comment=''): """ Parameters ---------- SEIDA : int Partitioned superelement identification number. SEIDB : int Identification number of superelement for connection to SEIDA. TOL : float; default=1e-5 Location tolerance to be used when searching for or checking boundary grid points. LOC : str; default='YES' Coincident location check option for manual connection. {YES, NO} GIDAi : int Identification number of a grid or scalar point in superelement SEIDA, which will be connected to GIDBi. GIDBi : int Identification number of a grid or scalar point in superelement SEIDB, which will be connected to GIDAi. """ BaseCard.__init__(self) if comment: self.comment = comment self.seid_a = seid_a self.seid_b = seid_b self.tol = tol self.loc = loc self.nodes_a = nodes_a self.nodes_b = nodes_b self.nodes_a_ref = None self.nodes_b_ref = None
def __init__(self, seid, nodes_seid, nodes0, comment=''): """ Creates an SELOC card, which transforms the superelement SEID from PA to PB. Basically, define two CORD1Rs. Parameters ---------- seid : int the superelement to transform nodes_seid : List[int, int, int] the nodes in the superelement than define the resulting coordinate system nodes0 : List[int, int, int] the nodes in the superelement than define the starting coordinate system comment : str; default='' a comment for the card """ BaseCard.__init__(self) if comment: self.comment = comment self.seid = seid #: Identifiers of grids points. (Integer > 0) self.nodes_0 = expand_thru(nodes0, set_fields=False, sort_fields=False) self.nodes_seid = expand_thru(nodes_seid, set_fields=False, sort_fields=False) self.nodes_0_ref = None self.nodes_seid_ref = None
def __init__(self, eid, ul, ud, k, z, s=None, comment=''): """creates a GENEL card The required input is the {UL} list and the lower triangular portion of [K] or [Z]. Additional input may include the {UD} list and [S]. If [S] is input, must also be input. If {UD} is input but [S] is omitted, [S] is internally calculated. In this case, {UD} must contain six and only six degrees-of freedom. """ BaseCard.__init__(self) if comment: self.comment = comment self.eid = eid self.ul = ul self.ud = ud if k is not None: self.k = np.asarray(k) self.z = None else: self.z = np.asarray(z) self.k = None if s is not None: s = np.asarray(s) self.s = s self.ul_nodes_ref = None self.ud_nodes_ref = None
def __init__(self, sid, eid, tbar, tprime, t_stress, comment=''): BaseCard.__init__(self) self.comment = comment self.sid = sid self.eid = eid self.tbar = tbar self.tprime = tprime self.t_stress = t_stress
def __init__(self, seid, superelements, comment=''): BaseCard.__init__(self) if comment: self.comment = comment self.seid = seid #: Identifiers of grids points. (Integer > 0) self.superelements = expand_thru(superelements) self.superelements_ref = None
def __init__(self, side, coord, nids, comment=''): BaseCard.__init__(self) if comment: self.comment = comment self.side = side self.coord = coord self.nids = expand_thru(nids) assert coord in ['T1', 'T2', 'T3', 'R', 'C', 'S'], coord
def __init__(self, icavity, gitb=4, gips=4, cier=4, error_tol=0.1, zero_tol=1e-10, warp_tol=0.01, rad_check=3, comment=''): """ Creates a VIEW3D, which defines a 3D view factor Parameters ---------- icavity : int Radiant cavity identification number on RADCAV entry. (Integer > 0) gitb : int; default=4 Gaussian integration order to be implemented in calculating net effective view factors in the presence of third-body shadowing. (Integer 2, 3, 4, 5, 6 or 10) gips : int; default=4 Gaussian integration order to be implemented in calculating net effective view factors in the presence of self-shadowing. (Integer 2, 3, 4, 5, 6 or 10) cier : int; default=4 Discretization level used in the semi-analytic contour integration method. (1 < Integer < 20) error_tol : float; default=0.1 Error estimate above which a corrected view factor is calculated using the semi-analytic contour integration method. (Real > 0.0) zero_tol : float; default=1e-10 Assumed level of calculation below which the numbers are considered to be zero. (Real > 0.0) warp_tol : float; default=0.01 Assumed degree of warpage above which the actual value of will be calculated. (0.0 < Real < 1.0) rad_check : int; default=3 Type of diagnostic output desired for the radiation exchange surfaces. comment : str; default='' a comment for the card """ BaseCard.__init__(self) if comment: self.comment = comment #: Material identification number self.icavity = icavity self.gitb = gitb self.gips = gips self.cier = cier self.error_tol = error_tol self.zero_tol = zero_tol self.warp_tol = warp_tol self.rad_check = rad_check
def __init__(self, seid, psid, nodes, comment=''): BaseCard.__init__(self) if comment: self.comment = comment self.seid = seid self.psid = psid #: Identifiers of grids points. (Integer > 0) self.nodes = expand_thru(nodes) self.nodes_ref = None
def __init__(self, seid, comp, nids, comment=''): BaseCard.__init__(self) if comment: self.comment = comment self.seid = seid self.comp = comp #: Identifiers of grids points. (Integer > 0) self.nids = expand_thru(nids) self.nids_ref = None
def __init__(self, seid_a, seid_b, ids, comment=''): BaseCard.__init__(self) if comment: self.comment = comment self.seid_a = seid_a self.seid_b = seid_b #: Identifiers of grids points. (Integer > 0) self.ids = expand_thru(ids) self.ids_ref = None
def __init__(self, eid, nodes, comment=''): """ Defines a 1D dummy element used for plotting. +--------+-----+-----+-----+ | 1 | 2 | 3 | 4 | +========+=====+=====+=====+ | PLOTEL | EID | G1 | G2 | +--------+-----+-----+-----+ """ BaseCard.__init__(self) if comment: self.comment = comment self.eid = eid self.nodes = nodes
def __init__(self, set_id, n, comment=''): """ Parameters ---------- set_id : int / str Partitioned superelement identification number. (Integer > 0 or Character='ALL') n : int; default=0 Number of internally generated scalar points for dynamic reduction generalized coordinates (Integer > 0). """ BaseCard.__init__(self) if comment: self.comment = comment self.set_id = set_id self.n = n
def __init__(self, eid, nodes, comment=''): """ Adds a PLOTEL card Parameters ---------- eid : int Element ID nodes : List[int, int] Unique GRID point IDs """ BaseCard.__init__(self) if comment: self.comment = comment self.eid = eid self.nodes = nodes
def __init__(self, aestat_id, label, comment=''): """ Creates an AESTAT card, which is a variable to be used in a TRIM analysis Parameters ---------- id : int unique id label : str name for the id comment : str; default='' a comment for the card """ BaseCard.__init__(self) if comment: self.comment = comment self.aestat_id = aestat_id self.label = label
def __init__(self, sid, temperature, comment=''): """ Creates a TEMPD card Parameters ---------- sid : int Load set identification number. (Integer > 0) temperature : float default temperature comment : str; default='' a comment for the card """ BaseCard.__init__(self) if comment: self.comment = comment self.sid = sid self.temperature = temperature
def __init__(self, sid, mach, q, labels, uxs, aeqr=1.0, comment=''): """ Creates a TRIM card for a static aero (144) analysis. Parameters ---------- sid : int the trim id; referenced by the Case Control TRIM field mach : float the mach number q : float dynamic pressure labels : List[str] names of the fixed variables uxs : List[float] values corresponding to labels aeqr : float 0.0 : rigid trim analysis 1.0 : elastic trim analysis (default) comment : str; default='' a comment for the card """ BaseCard.__init__(self) if comment: self.comment = comment #: Trim set identification number. (Integer > 0) self.sid = sid #: Mach number. (Real > 0.0 and != 1.0) self.mach = mach #: Dynamic pressure. (Real > 0.0) self.q = q #: The label identifying aerodynamic trim variables defined on an #: AESTAT or AESURF entry. self.labels = labels #: The magnitude of the aerodynamic extra point degree-of-freedom. #: (Real) self.uxs = uxs #: 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. self.aeqr = aeqr
def __init__(self): """ Common class for AERO, AEROS Attributes ---------- acsid : int; default=0 aerodyanmic coordinate system defines the direction of the wind sym_xz : int; default=0 xz symmetry flag (+1=symmetry; -1=antisymmetric) sym_xy : int; default=0 xy symmetry flag (+1=symmetry; -1=antisymmetric) """ BaseCard.__init__(self) self.sym_xy = None self.sym_xz = None self.acsid = None self.acsid_ref = None
def __init__(self, machs, reduced_freqs, comment=''): """ Creates an MKAERO1 card, which defines a set of mach and reduced frequencies. Parameters ---------- machs : List[float] series of Mach numbers reduced_freqs : List[float] series of reduced frequencies comment : str; default='' a comment for the card """ BaseCard.__init__(self) if comment: self.comment = comment self.machs = np.unique(machs) self.reduced_freqs = np.unique(reduced_freqs)
def __init__(self, sid, sets, comment=''): """ Creates an NSMADD card, which sum NSM sets Parameters ---------- sid : int the NSM Case Control value sets : List[int] the NSM, NSM1, NSML, NSML1 values comment : str; default='' a comment for the card """ BaseCard.__init__(self) if comment: self.comment = comment self.sid = sid self.sets = expand_thru(sets) self.sets.sort()
def __init__(self, iview, icavity, shade='BOTH', nbeta=1, ngamma=1, dislin=0.0, comment=''): """ Creates a VIEW, which defines a 2D view factor Parameters ---------- iview : int Identification number icavity : int Cavity identification number for grouping the radiant exchange faces of CHBDYi elements shade : str; default='BOTH' Shadowing flag for the face of CHBDYi element - NONE means the face can neither shade nor be shaded by other faces - KSHD means the face can shade other faces - KBSHD means the face can be shaded by other faces - BOTH means the face can both shade and be shaded by other faces nbeta / ngamma : int; default=1 / 1 Subelement mesh size in the beta/gamma direction. (Integer > 0) dislin : float; default=0.0 The displacement of a surface perpendicular to the surface comment : str; default='' a comment for the card """ BaseCard.__init__(self) if comment: self.comment = comment #: Material identification number self.iview = iview self.icavity = icavity self.shade = shade self.nbeta = nbeta self.ngamma = ngamma self.dislin = dislin
def __init__(self, seid, superelement_type, rseid, method='AUTO', tol=1e-5, loc='YES', unitno=None, comment=''): """ Parameters ---------- seid : int Partitioned superelement identification number. Type : str Superelement type. {PRIMARY, REPEAT, MIRROR, COLLCTR, EXTERNAL, EXTOP2} rseid : int; default=0 Identification number of the reference superelement, used if TYPE = 'REPEAT' and 'MIRROR'. method : str; default='AUTO' Method to be used when searching for boundary grid points. {AUTO, MANUAL} tol : float; default=1e-5 Location tolerance to be used when searching for boundary grid points. loc : str; default='YES' Coincident location check option for manual conection option. {YES, NO} unitno : int / None FORTRAN unit number for the OUTPUT2 file (applicable and meaningful only when TYPE='EXTOP2'). """ BaseCard.__init__(self) if comment: self.comment = comment self.seid = seid self.superelement_type = superelement_type self.rseid = rseid self.method = method self.tol = tol self.loc = loc self.unitno = unitno
def assert_fields(card1: BaseCard, card2: BaseCard) -> None: try: fields1 = wipe_empty_fields(card1.repr_fields()) fields2 = wipe_empty_fields(card2.repr_fields()) except: print("card1 = \n%s" % (card1)) print("card2 = \n%s" % (card2)) raise if len(fields1) != len(fields2): msg = ('len(fields1)=%s len(fields2)=%s\n%r\n%r\n%s\n%s' % (len(fields1), len(fields2), fields1, fields2, print_card_8(fields1), print_card_8(fields2))) raise RuntimeError(msg) msg_end = '' max_int = 99999999 for (i, field1, field2) in zip(count(), fields1, fields2): if isinstance(field1, int) and field1 > max_int: value1a = print_field_16(field1) value2a = print_field_16(field2) else: value1a = print_field_8(field1) value2a = print_field_8(field2) msg_end += '%-2s: %-8s %-8s\n' % (i, field1, field2) if value1a != value2a: if isinstance(field1, int) and field1 > max_int: value1 = print_field_16(interpret_value(value1a)) value2 = print_field_16(interpret_value(value2a)) else: value1 = print_field_8(interpret_value(value1a)) value2 = print_field_8(interpret_value(value2a)) if value1 != value2: msg = 'value1 != value2\n' msg += ( 'card_name=%s ID=%s i=%s field1=%r field2=%r value1=%r ' 'value2=%r\n%r\n%r\n' % (fields1[0], fields1[1], i, field1, field2, value1, value2, fields1, fields2)) raise RuntimeError(msg + msg_end)
def __init__(self, sid, temperature, comment=''): BaseCard.__init__(self) if comment: self.comment = comment self.sid = sid self.temperature = temperature