示例#1
0
def star_deformation_plasticity_setup(keys, current_mat):
    """
    Sets up *DEFORMATION PLASTICITY
    Adds deformation plasticity constants to last material
    keys -- String of line split by commas with spaces removed
    current_mat -- dictionary of current material
    """
    reader_utils.untested_warning(keys[0])
    # Create empty array for values
    current_mat['DEFORMATIONPLASTICITY']['VALUES'] = []
    return
示例#2
0
def star_cyclic_hardening_setup(keys, current_mat):
    """
    Sets up *CYCLIC HARDENING
    Adds cyclic hardening property to last material
    keys -- String of line split by commas with spaces removed
    current_mat -- dictionary of current material
    """
    reader_utils.untested_warning(keys[0])
    # Create empty array for values
    current_mat['CYCLICHARDENING']['VALUES'] = []
    return
示例#3
0
def star_density_setup(keys, current_mat):
    """
    Sets up *DENSITY
    Adds density property to last material
    keys -- String of line split by commas with spaces removed
    current_mat -- dictionary of current material
    """
    reader_utils.untested_warning(keys[0])
    # Create empty array for values
    current_mat['DENSITY']['VALUES'] = []
    return
示例#4
0
def star_depvar_receive(line, current_mat):
    """
    Creates DEPVAR entry in current_mat dict
    line -- String of line, will be split and whitespace removed
    current_mat -- dictionary of current material
    """
    reader_utils.untested_warning("DEPVAR")
    # Remove all whitespace
    temp = ''.join(line.split())
    # Convert to int
    current_mat['DEPVAR']['VALUES'] = int(temp)
    return
示例#5
0
def star_specific_gas_constant_receive(line, current_mat):
    """
    Creates SPECIFICGASCONSTANT entry in current_mat dict
    line -- String of line, will be split and whitespace removed
    current_mat -- dictionary of current material
    """
    reader_utils.untested_warning("SPECGASCONST")
    # Remove all whitespace
    temp = ''.join(line.split())
    # Convert to int
    current_mat['SPECIFICGASCONSTANT']['VALUES'] = float(temp)
    return
示例#6
0
def star_conductivity_receive(line, current_mat):
    """
    Adds properties to CONDUCTIVITY entry in current_mat dict
    line -- String of line, will be split and whitespace removed
    current_mat -- dictionary of current material
    """
    reader_utils.untested_warning(keys[0])
    # Remove all whitespace
    temp = ''.join(line.split())
    # Split and convert to floats
    entries = [float(i) for i in temp.split(',')]
    current_mat['CONDUCTIVITY']['VALUES'].append(entries)
    return
示例#7
0
def star_elastic_receive(line, current_mat, num):
    """
    Adds properties to ELASTIC entry in current_mat dict
    line -- String of line, will be split and whitespace removed
    current_mat -- dictionary of current material
    num -- number denoting where property is in required lines
    """
    # Remove all whitespace
    temp = ''.join(line.split())
    # Split and convert to floats
    entries = [float(i) for i in temp.split(',')]
    elastic_type = current_mat['ELASTIC']['TYPE']
    if elastic_type == 'ISO':
        # reader_utils.untested_warning("*ELASTIC", elastic_type)
        # Add another row
        current_mat['ELASTIC']['VALUES'].append(entries)
        # Only one line per group so always 1
        return 1
    elif elastic_type == 'ORTHO' or elastic_type == 'ENGINEERINGCONSTANTS':
        reader_utils.untested_warning("*ELASTIC", elastic_type)
        if num == 1:
            # Add another row
            current_mat['ELASTIC']['VALUES'].append(entries)
            # Update to second row
            return 2
        elif num == 2:
            # Extend last row
            current_mat['ELASTIC']['VALUES'][-1].extend(entries)
            # Update to first row
            return 1
    elif elastic_type == 'ANISO':
        reader_utils.untested_warning("*ELASTIC", elastic_type)
        if num == 1:
            # Add another row
            current_mat['ELASTIC']['VALUES'].append(entries)
            # Update to second row
            return 2
        elif num == 2:
            # Extend last row
            current_mat['ELASTIC']['VALUES'][-1].extend(entries)
            # Update to first row
            return 3
        elif num == 3:
            # Extend last row
            current_mat['ELASTIC']['VALUES'][-1].extend(entries)
            # Update to first row
            return 1
    print("MISSED CASE!!!")
    return 1
示例#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
示例#9
0
def star_plastic_setup(keys, current_mat):
    """
    Sets up *PLASTIC
    Adds plastic property to last material
    keys -- String of line split by commas with spaces removed
    current_mat -- dictionary of current material
    """
    reader_utils.untested_warning(keys[0])
    current_mat['PLASTIC'] = dict()
    if len(keys) > 1:
        # Grab plastic property type if present
        current_mat['PLASTIC']['TYPE'] = keys[1].split('=')[1]
    else:
        # Otherwise apply the default (ISOTROPIC)
        current_mat['PLASTIC']['TYPE'] = 'ISOTROPIC'
    # Create empty array for values
    current_mat['PLASTIC']['VALUES'] = []
    return
示例#10
0
def star_creep_setup(keys, current_mat):
    """
    Sets up *CREEP
    Adds creep property to last material
    keys -- String of line split by commas with spaces removed
    current_mat -- dictionary of current material
    """
    reader_utils.untested_warning(keys[0])
    current_mat['CREEP'] = dict()
    if len(keys) > 1:
        # Grab creep property type if present
        current_mat['CREEP']['TYPE'] = keys[1].split('=')[1]
    else:
        # Otherwise apply the default (NORTON)
        current_mat['CREEP']['TYPE'] = 'NORTON'
    # Create empty array for values
    current_mat['CREEP']['VALUES'] = []
    return
示例#11
0
def star_hyperfoam_setup(keys, current_mat):
    """
    Sets up *HYPERFOAM
    Adds hyperfoam properties to last material
    keys -- String of line split by commas with spaces removed
    current_mat -- dictionary of current material
    """
    reader_utils.untested_warning(keys[0])
    # Set defaults and then overwrite if present
    current_mat['HYPERFOAM'] = dict()
    l = len(keys)
    if l == 1:
        # Default for N is 1
        current_mat['HYPERFOAM']['N'] = 1
    elif l == 2:
        # Set N
        current_mat['HYPERFOAM']['N'] = int(keys[1].split('=')[1])
    # Create empty array for values
    current_mat['HYPERFOAM']['VALUES'] = []
    return
示例#12
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
示例#13
0
def star_expansion_setup(keys, current_mat):
    """
    Sets up *EXPANSION
    Adds thermal expansion property to last material
    keys -- String of line split by commas with spaces removed
    current_mat -- dictionary of current material
    """
    reader_utils.untested_warning(keys[0])
    # Set defaults and then overwrite if present
    current_mat['EXPANSION'] = dict()
    # Otherwise apply the default (ISO)
    current_mat['EXPANSION']['TYPE'] = 'ISO'
    # Default for zero is 0
    current_mat['EXPANSION']['ZERO'] = 0
    for i in keys:
        if i.startswith('TYPE'):
            current_mat['EXPANSION']['TYPE'] = keys[1].split('=')[1]
        elif i.startwith('ZERO'):
            current_mat['EXPANSION']['ZERO'] = float(keys[1].split('=')[1])
    # Create empty array for values
    current_mat['EXPANSION']['VALUES'] = []
    return
示例#14
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
示例#15
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]
示例#16
0
def star_hyperelastic_setup(keys, current_mat):
    """
    Sets up *HYPERELASTIC
    Adds hyperelastic model and properties to last material
    keys -- String of line split by commas with spaces removed
    current_mat -- dictionary of current material
    """
    reader_utils.untested_warning(keys[0])
    # Set defaults and then overwrite if present
    current_mat['HYPERELASTIC'] = dict()
    l = len(keys)
    if l == 1:
        # Apply the default model (POLYNOMIAL)
        current_mat['HYPERELASTIC']['MODEL'] = 'POLYNOMIAL'
        # Default for N is 1
        current_mat['HYPERELASTIC']['N'] = 1
    elif l == 2:
        if keys[1].startswith('N='):
            # Apply the default model (POLYNOMIAL)
            current_mat['HYPERELASTIC']['MODEL'] = 'POLYNOMIAL'
            # Set N
            current_mat['HYPERELASTIC']['N'] = int(keys[1].split('=')[1])
        else:
            # Set model
            current_mat['HYPERELASTIC']['MODEL'] = keys[1].split('=')[1]
            # Set n even if unnecessary
            current_mat['HYPERELASTIC']['N'] = 1
    elif l == 3:
        # Assumes model is set first always
        # Set model
        current_mat['HYPERELASTIC']['MODEL'] = keys[1].split('=')[1]
        # Set N
        current_mat['HYPERELASTIC']['N'] = int(keys[2].split('=')[1])
    # Create empty array for values
    current_mat['HYPERELASTIC']['VALUES'] = []
    return
示例#17
0
def star_shell_section_setup(keys, sections):
    """
    Sets up a shell section for a set of shell 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"] = "SHELLSECTION"
    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("COMPOSITE"):
            reader_utils.untested_warning(keys[0], i)
            sections[cur_sec]["COMPOSITE"] = i.split("=")[1]
        elif i.startswith("ORIENTATION"):
            reader_utils.untested_warning(keys[0], i)
            sections[cur_sec]["ORIENTATION"] = i.split("=")[1]
        elif i.startswith("NODALTHICKNESS"):
            reader_utils.untested_warning(keys[0], i)
            sections[cur_sec]["NODALTHICKNESS"] = i.split("=")[1]
        elif i.startswith("OFFSET"):
            reader_utils.untested_warning(keys[0], i)
            sections[cur_sec]["OFFSET"] = i.split("=")[1]
        elif i != keys[0] and not i.startswith("ELSET"):
            reader_utils.missed_option(keys[0], i)
    return sections[cur_sec]
示例#18
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
示例#19
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]
示例#20
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