Esempio n. 1
0
def star_solid_section_setup(keys, sections):
    """
    Sets up a solid section for a set of solid elements
    """
    # reader_utils.untested_warning(keys[0])
    # Checks for ELSET in keywords
    # Spaces were removed so can't be a space
    cur_sec = " "
    for i in keys[1:]:
        if i.startswith("ELSET"):
            # reader_utils.untested_warning(keys[0], i)
            cur_sec = i.split("=")[1]
            sections[cur_sec] = dict()
    # Make sure keyword was present
    if cur_sec == " ":
        raise ValueError("ELSET not specified")
    # Add type
    sections[cur_sec]["TYPE"] = "SOLIDSECTION"
    for i in keys[1:]:
        if i.startswith("MATERIAL"):
            # reader_utils.untested_warning(keys[0], i)
            sections[cur_sec]["MATERIAL"] = i.split("=")[1]
        elif i.startswith("ORIENTATION"):
            reader_utils.untested_warning(keys[0], i)
            sections[cur_sec]["ORIENTATION"] = i.split("=")[1]
        elif i != keys[0] and not i.startswith("ELSET"):
            reader_utils.missed_option(keys[0], i)
    return sections[cur_sec]
Esempio n. 2
0
def star_element_setup(keys, elsets):
    """
    Set up the input deck reader to collect elements
    elsets is a dictionary that will be modified if
    the ELSET option is included after *ELEMENT
    Note that dictionaries are mutable
    keys -- String of line split by commas with spaces removed
    elsets -- dictionary of element sets
    Return True to start collecting elements
    Return the current elset to tell what it is or keep it as nothing
    """
    # reader_utils.untested_warning(keys[0])
    # print('Collecting Elements')
    # Check for elset and type
    if len(keys) > 1:
        for i in keys:
            if i.startswith("ELSET"):
                # reader_utils.untested_warning(keys[0], i)
                # Grab part after =
                current_elset = i.split('=')[1]
                # print("Grabbing "+current_elset)
                elsets[current_elset] = []
            elif i.startswith("TYPE"):
                # reader_utils.untested_warning(keys[0], i)
                last_type = i.split('=')[1]
            elif i != keys[0]:
                reader_utils.missed_option(keys[0], i)
    return current_elset, last_type
Esempio n. 3
0
def star_node_setup(keys, nsets):
    """
    Set up the input deck reader to collect nodes
    nsets is a dictionary that will be modified if
    the NSET option is included after *NODE
    Note that dictionaries are mutable
    keys -- String of line split by commas with spaces removed
    nsets -- dict of node sets
    Return True to start collecting nodes
    Return current_nset to tell what nset is or keep it as nothing
    """
    # reader_utils.untested_warning(keys[0])
    # print("Collecting Nodes")
    # Check if nodes are being put into node set
    if len(keys) > 1:
        for i in keys:
            if i.startswith("NSET"):
                # reader_utils.untested_warning(keys[0], i)
                # Grab part after =
                current_nset = keys[1].split('=')[1]
                # print("Grabbing "+current_nset)
                # Add node set
                nsets[current_nset] = []
            elif i != keys[0]:
                reader_utils.missed_option(keys[0], i)
    return current_nset
Esempio n. 4
0
def star_boundary_setup(keys, steps):
    # reader_utils.untested_warning(keys[0])
    # Can check if steps is empty by checking if false
    # Must create a place holder step if steps is empty
    if not steps:
        create_homo_step(steps)
    # Create an empty list for boundary conditions
    # in last step if not present
    if "BOUNDARY" not in steps[-1].keys():
        steps[-1]["BOUNDARY"] = []
    # Add a boundary condition
    steps[-1]["BOUNDARY"].append(dict())
    temp_bc = steps[-1]["BOUNDARY"][-1]
    # Nodes are left as strings
    # Node number or node set can be entered
    temp_bc["NODES"] = []
    # DOFs are ints
    temp_bc["DOFS"] = []
    # Magnitudes are floats
    # Only used if Inhomogeneous
    # !! submodels case not handled
    if "HOMOGENEOUS" not in steps[-1].keys():
        temp_bc["MAGNITUDES"] = []
    # Search through keys for optional keywords
    # Note that only OP has been completed
    # !! still need other keywords
    if len(keys) > 1:
        for i in keys:
            if i.startswith("OP"):
                # Grab NEW or MOD of OP=NEW/MOD
                temp_bc["OP"] = i.split("=")[1]
                reader_utils.untested_warning(keys[0], i)
            else:
                reader_utils.missed_option(keys[0], i)
    return
Esempio n. 5
0
def star_output_setup(keys, step):
    """
    Sets up a dictionary for output in step
    keys -- cleaned keywords separated by commas
    step -- dictionary of current step
    """
    reader_utils.untested_warning(keys[0])
    # Add dictionary for output if not present
    if 'OUTPUT' not in step.keys():
        step['OUTPUT'] = []
    # Grab output
    output = step['OUTPUT']
    # Create entry for current output
    output.append(dict())
    # Grab newly created dictionary
    op = output[-1]
    # Add type of output
    op["TYPE"] = "OUTPUT"

    # Look for optional keywords
    if len(keys) > 1:
        for i in keys[1:]:
            if i.startswith('FREQUENCYF'):
                op['FREQUENCYF'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith('FREQUENCY'):
                op['FREQUENCY'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i != keys[0]:
                reader_utils.missed_option(keys[0], i)
    return
Esempio n. 6
0
def star_cload_setup(keys, steps):
    # reader_utils.untested_warning(keys[0])
    # Create an empty list for concentrated loads
    # in last step if not present
    if "CLOAD" not in steps[-1].keys():
        steps[-1]["CLOAD"] = []
    # Add a concentrated load
    steps[-1]["CLOAD"].append(dict())
    temp_cl = steps[-1]["CLOAD"][-1]
    # Set up node number/set, DOFs, and magnitude
    # Strings
    temp_cl["NODES"] = []
    # Ints
    temp_cl["DOFS"] = []
    # Floats
    temp_cl["MAGNITUDES"] = []
    # Look for optional keywords
    if len(keys) > 1:
        for i in keys:
            if i.startswith("OP"):
                # Grab NEW or MOD of OP=NEW/MOD
                temp_cl["OP"] = i.split("=")[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith("AMPLITUDE"):
                temp_cl["AMPLITUDE"] = i.split("=")[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith("TIMEDELAY"):
                temp_cl["TIMEDELAY"] = float(i.split("=")[1])
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith("USER"):
                temp_cl["USER"] = True
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith("LOADCASE"):
                temp_cl["LOADCASE"] = int(i.split("=")[1])
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith("SECTOR"):
                # !! I don't really understand what sector is
                temp_cl["SECTOR"] = i.split("=")[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith("AMPLITUDE"):
                temp_cl["AMPLITUDE"] = i.split("=")[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith("SUBMODEL"):
                # !! I don't really understand what submodel keyword wants
                temp_cl["SUBMODEL"] = i.split("=")[1]
                reader_utils.untested_warning(keys[0], i)
            else:
                reader_utils.missed_option(keys[0], i)
    return
Esempio n. 7
0
def star_element_output_setup(keys, step):
    reader_utils.untested_warning(keys[0])
    # Add dictionary for output if not present
    if 'OUTPUT' not in step.keys():
        step['OUTPUT'] = []
    # Grab output
    output = step['OUTPUT']
    # Create entry for current output
    output.append(dict())
    # Grab newly created dictionary
    el_out = output[-1]
    # Add type of output
    el_out["TYPE"] = "ELEMENTOUTPUT"
    # Add set for variables
    # Dont care about order and dont want duplicates
    el_out["VARS"] = set()
    # Look for optional keywords
    if len(keys) > 1:
        for i in keys:
            if i.startswith('FREQUENCYF'):
                el_out['FREQUENCYF'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith('FREQUENCY'):
                el_out['FREQUENCY'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith('GLOBAL'):
                el_out['GLOBAL'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith('OUTPUT'):
                el_out['OUTPUT'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith('SECTIONFORCES'):
                el_out['SECTIONFORCES'] = True
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith('TIMEPOINTS'):
                el_out['TIMEPOINTS'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith('LASTITERATIONS'):
                el_out['LASTITERATIONS'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith('CONTACTELEMENTS'):
                el_out['CONTACTELEMENTS'] = True
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith('NSET'):
                el_out['NSET'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i != keys[0]:
                reader_utils.missed_option(keys[0], i)
    return
Esempio n. 8
0
def star_nset_setup(keys, nsets):
    # reader_utils.untested_warning(keys[0])
    # Check for elset
    for i in keys:
        if i.startswith("NSET"):
            # reader_utils.untested_warning(keys[0], i)
            # Grab part after =
            current_nset = i.split('=')[1]
            nsets[current_nset] = []
    for i in keys:
        if i.startswith("GENERATE"):
            # Place generate keyword at front of list
            reader_utils.untested_warning(keys[0], i)
            nsets[current_nset].append("GENERATE")
        elif i != keys[0] and not i.startswith("NSET"):
            reader_utils.missed_option(keys[0], i)
    return current_nset
Esempio n. 9
0
def star_step_setup(keys, steps):
    """
    Sets up *STEP
    Adds a step to steps with optional keywords added
    keys -- String of line split by commas with spaces removed
    steps -- list of steps
    """
    # reader_utils.untested_warning(keys[0])
    # Check to see how many steps there are already
    step_num = len(steps)
    # Add step to steps
    steps.append(dict())
    # Add optional keyword information
    # I decided against setting the defaults automatically
    # steps[step_num]['INC'] = 100
    # steps[step_num]['INCF'] = 10000
    # steps[step_num]['TURBULENCEMODEL'] = 'NONE'
    # steps[step_num]['SHOCKSMOOTHING'] = 0

    # !! Can NLGEOM and perturbation be set to off or no?
    # The code assumes they are just flags

    # Changes optional keywords from defaults if present
    for i in keys:
        if i.startswith('PERTURBATION'):
            reader_utils.untested_warning(keys[0], i)
            steps[step_num]['PERTURBATION'] = True
        elif i.startswith('NLGEOM'):
            reader_utils.untested_warning(keys[0], i)
            steps[step_num]['NLGEOM'] = True
        elif i.startswith('INCF'):
            reader_utils.untested_warning(keys[0], i)
            steps[step_num]['INCF'] = int(i.split('=')[1])
        elif i.startswith('INC'):
            reader_utils.untested_warning(keys[0], i)
            steps[step_num]['INC'] = int(i.split('=')[1])
        elif i.startswith('TURBULENCEMODEL'):
            reader_utils.untested_warning(keys[0], i)
            steps[step_num]['TURBULENCEMODEL'] = i.split('=')[1]
        elif i.startswith('SHOCKSMOOTHING'):
            reader_utils.untested_warning(keys[0], i)
            steps[step_num]['SHOCKSMOOTHING'] = float(i.split('=')[1])
        elif i != keys[0]:
            reader_utils.missed_option(keys[0], i)
    return steps[step_num]
Esempio n. 10
0
def step_rel_setup(keys, steps, last_info):
    """
    Completes necessary setup for
    step related keys
    """
    if keys[0] == "*STEP":
        # Set up steps
        # last_info contains dict of current step
        temp = star_step_setup(keys, steps)
        last_info = [temp]
    elif keys[0] == "*STATIC":
        # Set up static step
        star_static_setup(keys, last_info[0])
        # No update to last_info
    elif keys[0] == "*ENDSTEP":
        # Nothing to be done
        pass
    else:
        reader_utils.missed_option(keys[0])
    return last_info
Esempio n. 11
0
def op_rel_setup(keys, cur_step):
    """
    Completes necessary setup for
    output related keys
    """
    if keys[0] == "*OUTPUT":
        star_output_setup(keys, cur_step)
    elif keys[0] == "*ELEMENTOUTPUT":
        star_element_output_setup(keys, cur_step)
    elif keys[0] == "*ELFILE":
        star_el_file_setup(keys, cur_step)
    elif keys[0] == "*ELPRINT":
        star_el_print_setup(keys, cur_step)
    elif keys[0] == "*NODEOUTPUT":
        star_node_output_setup(keys, cur_step)
    elif keys[0] == "*NODEFILE":
        star_node_file_setup(keys, cur_step)
    elif keys[0] == "*NODEPRINT":
        star_node_print_setup(keys, cur_step)
    else:
        reader_utils.missed_option(keys[0])
    return
Esempio n. 12
0
def star_node_print_setup(keys, step):
    # Add dictionary for output if not present
    if 'OUTPUT' not in step.keys():
        step['OUTPUT'] = []
    # Grab output
    output = step['OUTPUT']
    # Create entry for current output
    output.append(dict())
    # Grab newly created dictionary
    n_out = output[-1]
    # Add type of output
    n_out["TYPE"] = "NODEPRINT"
    # Add set for variables
    # Dont care about order and dont want duplicates
    n_out["VARS"] = set()
    # Look for optional keywords
    if len(keys) > 1:
        for i in keys:
            if i.startswith('FREQUENCYF'):
                n_out['FREQUENCYF'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith('FREQUENCY'):
                n_out['FREQUENCY'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith('GLOBAL'):
                n_out['GLOBAL'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith('TIMEPOINTS'):
                n_out['TIMEPOINTS'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i.startswith('NSET'):
                n_out['NSET'] = i.split('=')[1]
                # reader_utils.untested_warning(keys[0], i)
            elif i.startswith('TOTALS'):
                n_out['TOTALS'] = i.split('=')[1]
                reader_utils.untested_warning(keys[0], i)
            elif i != keys[0]:
                reader_utils.missed_option(keys[0], i)
    return
Esempio n. 13
0
def star_beam_section_setup(keys, sections):
    """
    Sets up a beam section for a set of beam elements
    """
    # reader_utils.untested_warning(keys[0])
    # Checks for ELSET in keywords
    # Spaces were removed so can't be a space
    cur_sec = " "
    for i in keys[1:]:
        if i.startswith("ELSET"):
            # reader_utils.untested_warning(keys[0], i)
            cur_sec = i.split("=")[1]
            sections[cur_sec] = dict()
    # Make sure keyword was present
    if cur_sec == " ":
        raise ValueError("ELSET not specified")
    # Add type
    sections[cur_sec]["TYPE"] = "BEAMSECTION"
    for i in keys[1:]:
        # Orientation not included
        if i.startswith("MATERIAL"):
            # reader_utils.untested_warning(keys[0], i)
            sections[cur_sec]["MATERIAL"] = i.split("=")[1]
        elif i.startswith("SECTION"):
            # reader_utils.untested_warning(keys[0], i)
            sections[cur_sec]["SECTION"] = i.split("=")[1]
        elif i.startswith("OFFSET1"):
            reader_utils.untested_warning(keys[0], i)
            sections[cur_sec]["OFFSET1"] = i.split("=")[1]
        elif i.startswith("OFFSET2"):
            reader_utils.untested_warning(keys[0], i)
            sections[cur_sec]["OFFSET2"] = i.split("=")[1]
        elif i != keys[0] and not i.startswith("ELSET"):
            reader_utils.missed_option(keys[0], i)
    # There are no examples using ORIENTATION keyword
    # !! Orientation keyword not completed
    return sections[cur_sec]