Ejemplo n.º 1
0
def create_plot_data_exp_nth_cycle(name,
                                   nth_cycle,
                                   figure_path=None,
                                   figure_name=None):
    #==============================================================================
    # x,y label
    #==============================================================================
    xlabel = xylabels['axial_strain']
    ylabel = xylabels['axial_stress']
    #==============================================================================
    # plot lines
    #==============================================================================
    i = 0
    marker_list = ['s', 'o', '^', 'D']
    plot_data = PlotData()

    filename = ExperimentDirectory + name + '.csv'
    experiment = ExperimentData(filename)
    strain = experiment.obtainNthCycle('axial_strain', nth_cycle)
    stress = experiment.obtainNthCycle('axial_stress', nth_cycle)
    plot_data.addLine(strain * 100,
                      stress,
                      xlabel=xlabel,
                      ylabel=ylabel,
                      linelabel='',
                      linewidth=2,
                      linestyle='-',
                      marker=None,
                      markersize=12,
                      color='auto')
    i += 1

    plot_data.writeToFile(figure_path, figure_name)
Ejemplo n.º 2
0
def plot_exp_pv(names,item='axial_stress'):
    for name in names:
        experiment_log = ExperimentLog(ExperimentLogFile)
        experiment_log.output(name)
        regular = r'.*'
        load_type = experiment_log.obtainItem(name,'load_type',regular)[0]
        regular = r'\d+\.?\d*'
        temperature_mode = experiment_log.obtainItem(name,'temperature_mode',regular)
        if len(temperature_mode) == 1:
            temperature_list = [float(temperature_mode[0]), float(temperature_mode[0])]
        if len(temperature_mode) == 2:
            temperature_list = [float(temperature_mode[0]), float(temperature_mode[1])]
        d_out = float(experiment_log.obtainItem(name,'d_out',regular)[0])
        gauge_length = float(experiment_log.obtainItem(name,'gauge_length',regular)[0])
        axial_strain = float(experiment_log.obtainItem(name,'axial_strain',regular)[0])
        angel_strain = float(experiment_log.obtainItem(name,'angel_strain',regular)[0])
        equivalent_strain = float(experiment_log.obtainItem(name,'equivalent_strain',regular)[0])
        period = float(experiment_log.obtainItem(name,'period',regular)[0])
        axial_temperature_phase = float(experiment_log.obtainItem(name,'axial_temperature_phase',regular)[0])
    
        exp_filename = ExperimentDirectory + name + '.csv'
        experiment = ExperimentData(exp_filename)
        cycle,peak,valley = experiment.obtainPeakValley(item)
        plt.plot(cycle,peak)
        plt.plot(cycle,valley)
        
    plt.xscale('log')
#    plt.yscale('log')
    
    plt.show()
    plt.close()
Ejemplo n.º 3
0
def create_plot_data_exp_half_life_cycle(figure_path=None,figure_name=None):
#==============================================================================
# x,y label
#==============================================================================
    xlabel = xylabels['axial_strain']
    ylabel = xylabels['axial_stress']
#==============================================================================
# plot lines
#==============================================================================
    i = 0
    marker_list = ['s','o','^','D']
    plot_data = PlotData()
#    for name in experiment_type_dict['TC-IF']:
    for name in ['08','16']:
#        print name
        filename = ExperimentDirectory + name + '.csv'
        experiment = ExperimentData(filename)
#        print experiment.half_life_cycle
        strain = experiment.obtainNthCycle('axial_strain',experiment.half_life_cycle)
        stress = experiment.obtainNthCycle('axial_stress',experiment.half_life_cycle)
        plot_data.addLine(strain*100,
                          stress,
                          xlabel=xlabel,
                          ylabel=ylabel,
                          linelabel='',
                          linewidth=2,
                          linestyle='-',
                          marker=None,
                          markersize=12,
                          color='auto')
        i += 1
    
    plot_data.writeToFile(figure_path,figure_name)
Ejemplo n.º 4
0
def plot_exp_vs_sim_pv(name,item='axial_stress',save_types=['.png','.pdf']):
    experiment_log = ExperimentLog(ExperimentLogFile)
    experiment_log.output(name)
    regular = r'.*'
    load_type = experiment_log.obtainItem(name,'load_type',regular)[0]
    regular = r'\d+\.?\d*'
    temperature_mode = experiment_log.obtainItem(name,'temperature_mode',regular)
    if len(temperature_mode) == 1:
        temperature_list = [float(temperature_mode[0]), float(temperature_mode[0])]
    if len(temperature_mode) == 2:
        temperature_list = [float(temperature_mode[0]), float(temperature_mode[1])]
    d_out = float(experiment_log.obtainItem(name,'d_out',regular)[0])
    gauge_length = float(experiment_log.obtainItem(name,'gauge_length',regular)[0])
    axial_strain = float(experiment_log.obtainItem(name,'axial_strain',regular)[0])
    angel_strain = float(experiment_log.obtainItem(name,'angel_strain',regular)[0])
    equivalent_strain = float(experiment_log.obtainItem(name,'equivalent_strain',regular)[0])
    period = float(experiment_log.obtainItem(name,'period',regular)[0])
    axial_temperature_phase = float(experiment_log.obtainItem(name,'axial_temperature_phase',regular)[0])

    sim_filename = SimulationDirectory + name + '.csv'
    simulation = SimulationData(sim_filename,period)
    cycle,peak,valley = simulation.obtainPeakValley(item)
    plt.plot(cycle,peak,label='sim')
    plt.plot(cycle,valley,label='sim')
        
    exp_filename = ExperimentDirectory + name + '.csv'
    experiment = ExperimentData(exp_filename)
    cycle,peak,valley = experiment.obtainPeakValley(item)
    plt.plot(cycle,peak,label='exp')
    plt.plot(cycle,valley,label='exp')
    
    plt.xscale('log')
#    plt.yscale('log')
    
    plt.legend(loc=0)
    
    figure_path = ArticleFigureDirectory
    figure_name = name + '_' + item + '_pv'
    if not os.path.isdir(ArticleFigureDirectory):
        os.makedirs(ArticleFigureDirectory)
        print 'Create new directory:',ArticleFigureDirectory
    if figure_path <> None and figure_name<> None:
        for save_type in save_types:
            plt.savefig(figure_path + figure_name + save_type, dpi=150, transparent=True)
            print 'save as', figure_path + figure_name + save_type
            
    plt.show()
    plt.close()
Ejemplo n.º 5
0
def create_plot_data_exp_half_life_cycle(figure_path=None,figure_name=None):
#==============================================================================
# x,y label
#==============================================================================
    xlabel = xylabels['axial_strain']
    ylabel = xylabels['axial_stress']
#==============================================================================
# plot lines
#==============================================================================
    i = 0
    marker_list = ['s','o','^','D']
    plot_data = PlotData()
    for name in ['7116','7111','7115','7114']:
        filename = ExperimentDirectory + name + '.csv'
        experiment = ExperimentData(filename)
        strain = experiment.obtainNthCycle('axial_strain',experiment.half_life_cycle)
        stress = experiment.obtainNthCycle('axial_stress',experiment.half_life_cycle)
        plot_data.addLine(strain*100,
                          stress,
                          xlabel=xlabel,
                          ylabel=ylabel,
                          linelabel='',
                          linewidth=2,
                          linestyle='-',
                          marker=None,
                          markersize=12,
                          color='auto')
        i += 1
    
    material = material_in718()
    epsilon,sigma = material.plotCyclicStrengthCoefficient()
    plot_data.addLine(epsilon*100,
                      sigma,
                      xlabel=xlabel,
                      ylabel=ylabel,
                      linelabel='Ramberg-Osgood',
                      linewidth=4,
                      linestyle='--',
                      marker=None,
                      markersize=12,
                      color='black')
    
    plot_data.writeToFile(figure_path,figure_name)
Ejemplo n.º 6
0
def create_plot_data_exp_temperature(figure_path=None,figure_name=None):
#==============================================================================
# x,y label
#==============================================================================
    xlabel = xylabels['runing_time']
    ylabel = xylabels['temperature']
#==============================================================================
# plot lines
#==============================================================================
    i = 0
    marker_list = ['s','o','^','D']
    plot_data = PlotData()
#    for name in ['30_0_','50_0_','70_0_','90_0_']:
#    for name in ['30_25_','50_25_','70_25_','90_25_']:
#    for name in ['30_50_','50_50_','70_50_','90_50_']:
    for name in ['30_67_','50_67_','70_67_','90_67_']:
#    for name in ['90_0_','90_25_','90_50_','90_67_']:
#    for name in ['70_0_','70_25_','70_50_','70_67_']:
#    for name in ['50_0_','50_25_','50_50_','50_67_']:
#    for name in ['30_0_','30_25_','30_50_','30_67_']:
        ExperimentDirectory = 'F:\\Cloud\\Database\\IN718\\Temperature2\\'
        filename = ExperimentDirectory + name + '.csv'
        experiment = ExperimentData(filename)
        time = experiment.runing_time
        temperature = experiment.temperature
        plot_data.addLine(time,
                          temperature,
                          xlabel=xlabel,
                          ylabel=ylabel,
                          linelabel='Exp.' + name.split('_')[0] + '%',
                          linewidth=2,
                          linestyle='--',
                          marker='',
                          markersize=6,
                          color='auto')
        
        SimulationDirectory = 'F:\\Cloud\\Simulation\\Temperature\\'
        filename = SimulationDirectory + name + '.csv'
        simulation = SimulationData(filename,1)
        time = simulation.runing_time
        temperature = simulation.temperature
        plot_data.addLine(time,
                          temperature,
                          xlabel=xlabel,
                          ylabel=ylabel,
                          linelabel=name.split('_')[0] + '%',
                          linewidth=2,
                          linestyle='-',
                          marker=None,
                          markersize=12,
                          color='auto')
        i += 1
    
    plot_data.writeToFile(figure_path,figure_name)
Ejemplo n.º 7
0
def calc_material_in718():
    material = Material()
    material.setName(name='IN718')

    name = '7101'  #300C
    temperature = 300.0
    material.setTemperature(temperature=temperature)
    youngs_modulus, poisson_ratio, shear_modulus = calculate_elastic_by_temperature_in718(
        temperature)
    material.setMonotonic(youngs_modulus=youngs_modulus,
                          poisson_ratio=poisson_ratio,
                          yield_stress=1121.9,
                          K=1449.4,
                          n=0.041214)

    name = '7103'  #550C
    temperature = 550.0
    material.setTemperature(temperature=temperature)
    youngs_modulus, poisson_ratio, shear_modulus = calculate_elastic_by_temperature_in718(
        temperature)
    material.setMonotonic(youngs_modulus=youngs_modulus,
                          poisson_ratio=poisson_ratio,
                          yield_stress=1081.6,
                          K=1398.7,
                          n=0.041366)

    name = '7102'  #650C
    temperature = 650.0
    material.setTemperature(temperature=temperature)
    youngs_modulus, poisson_ratio, shear_modulus = calculate_elastic_by_temperature_in718(
        temperature)
    material.setMonotonic(youngs_modulus=youngs_modulus,
                          poisson_ratio=poisson_ratio,
                          yield_stress=1056.7,
                          K=1433.8,
                          n=0.049103)

    exp_full_name = ExperimentDirectory + name + '.csv'
    exp = ExperimentData(exp_full_name)
    epsilon = exp.axial_strain
    sigma = exp.axial_stress
    plt.plot(epsilon, sigma)
    material.calculateStrengthCoefficient(epsilon, sigma)
    material.show()
    material.plotStrengthCoefficient()
    print material.K * 0.002**material.n
    return material
Ejemplo n.º 8
0
def create_plot_data(figure_path=None,figure_name=None):
#==============================================================================
# x,y label
#==============================================================================
    xlabel = xylabels['axial_strain']
    ylabel = xylabels['axial_stress']
#==============================================================================
# plot lines
#==============================================================================
    i = 0
    marker_list = ['s','o','^','D']
    plot_data = PlotData()
    experiment_log = ExperimentLog(ExperimentLogFile)
    for name in ['7101','7102','7103']:
        experiment_log.output(name)
        regular = r'.*'
        load_type = experiment_log.obtainItem(name,'load_type',regular)[0]
        regular = r'\d+\.?\d*'
        temperature_mode = experiment_log.obtainItem(name,'temperature_mode',regular)
        if len(temperature_mode) == 1:
            temperature_list = [float(temperature_mode[0]), float(temperature_mode[0])]
        if len(temperature_mode) == 2:
            temperature_list = [float(temperature_mode[0]), float(temperature_mode[1])]
        d_out = float(experiment_log.obtainItem(name,'d_out',regular)[0])
        gauge_length = float(experiment_log.obtainItem(name,'gauge_length',regular)[0])
        axial_strain = float(experiment_log.obtainItem(name,'axial_strain',regular)[0])
        angel_strain = float(experiment_log.obtainItem(name,'angel_strain',regular)[0])
        equivalent_strain = float(experiment_log.obtainItem(name,'equivalent_strain',regular)[0])
        period = float(experiment_log.obtainItem(name,'period',regular)[0])
        axial_temperature_phase = float(experiment_log.obtainItem(name,'axial_temperature_phase',regular)[0])
        
        filename = ExperimentDirectory + name + '.csv'
        experiment = ExperimentData(filename)
        strain = experiment.axial_strain
        stress = experiment.axial_stress
        
        plot_data.addLine(strain*100,
                          stress,
                          xlabel=xlabel,
                          ylabel=ylabel,
                          linelabel='Exp.' + str(int(temperature_mode[0])+273)+'K',
                          linewidth=2,
                          linestyle='',
                          marker=marker_list[i],
                          markersize=12,
                          color=color_list[i],
                          skip=20)
        
        sim_filename = SimulationDirectory + name + '.csv'
        period = 200
        simulation = SimulationData(sim_filename,period)
        strain = simulation.axial_strain
        stress = simulation.axial_stress
        
        plot_data.addLine(strain*100,
                          stress,
                          xlabel=xlabel,
                          ylabel=ylabel,
                          linelabel='Sim.' + str(int(temperature_mode[0])+273)+'K',
                          linewidth=2,
                          linestyle='-',
                          marker=None,
                          markersize=12,
                          color=color_list[i])
        i += 1
    plot_data.writeToFile(figure_path,figure_name)
Ejemplo n.º 9
0
def workbench(name,
              loading_cycles=None,
              copy=True,
              film_coefficient=0.0,
              sink_temperature=0.0,
              temperature_list=[],
              thermal_strain_list=[0.0, -0.0],
              heat_flux=0.0,
              film_coefficient_outer=0.0,
              film_coefficient_inner=0.0,
              emissivity=0.95,
              sink_temperature_inner=293.15,
              sink_temperature_outer=293.15,
              outer_temperature=293.15):
    """
    某试件对应的边界条件下的数值模拟。
    """
    experiment_log = ExperimentLog(ExperimentLogFile)
    experiment_log.output(name)
    regular = r'.*'
    load_type = experiment_log.obtainItem(name, 'load_type', regular)[0]
    regular = r'\d+\.?\d*'
    temperature_mode = experiment_log.obtainItem(name, 'temperature_mode',
                                                 regular)
    if temperature_list == []:
        if len(temperature_mode) == 1:
            temperature_list = [
                float(temperature_mode[0]),
                float(temperature_mode[0])
            ]
        if len(temperature_mode) == 2:
            temperature_list = [
                float(temperature_mode[0]),
                float(temperature_mode[1])
            ]
    d_out = float(experiment_log.obtainItem(name, 'd_out', regular)[0])
    gauge_length = float(
        experiment_log.obtainItem(name, 'gauge_length', regular)[0])
    axial_strain = float(
        experiment_log.obtainItem(name, 'axial_strain', regular)[0])
    angel_strain = float(
        experiment_log.obtainItem(name, 'angel_strain', regular)[0])
    equivalent_strain = float(
        experiment_log.obtainItem(name, 'equivalent_strain', regular)[0])
    period = float(experiment_log.obtainItem(name, 'period', regular)[0])
    axial_temperature_phase = float(
        experiment_log.obtainItem(name, 'axial_temperature_phase', regular)[0])
    life = float(experiment_log.obtainItem(name, 'comments', regular)[0])
    #==============================================================================
    # material
    #==============================================================================
    material = Material()
    material.setName(name='IN718')
    material.setTemperature(temperature=650.0)
    material.setMonotonic(youngs_modulus=167100.0,
                          poisson_ratio=0.2886,
                          yield_stress=1064.0)
    material.setCyclicAxial(sigma_f=1034.0,
                            b=-0.04486,
                            epsilon_f=0.11499,
                            c=-0.52436)
    material.setCyclicTorsion(tau_f=1034.0 / np.sqrt(3),
                              b0=-0.04486,
                              gamma_f=0.11499 * np.sqrt(3),
                              c0=-0.52436)
    predicted_life = material.calculateMansonCoffinLife(equivalent_strain /
                                                        100.0)
    #==============================================================================
    # experiment
    #==============================================================================
    exp_full_name = ExperimentDirectory + name + '.csv'
    if os.path.exists(exp_full_name):
        exp = ExperimentData(exp_full_name)
        experimental_life = exp.total_axial_count
    else:
        print('%s is not existed' % exp_full_name)
#==============================================================================
# load
#==============================================================================
    temperature_mean = (temperature_list[0] + temperature_list[1]) / 2.0
    temperature_min = min(temperature_list)
    temperature_max = max(temperature_list)
    load = Load(runing_time=[0],
                temperature=[temperature_mean],
                axial_strain=[0],
                shear_strain=[0],
                first_cycle_shift=1)
    axial_strain = axial_strain / 100.0
    shear_strain = np.deg2rad(angel_strain) * d_out / 2.0 / gauge_length
    if loading_cycles == None:
        loading_cycles = min(int(predicted_life / 4.0), 5000)
    use_exp_data = True
    thermal_strain_min = min(thermal_strain_list) / 100.0
    thermal_strain_max = max(thermal_strain_list) / 100.0
    #==============================================================================
    # Diamond path TMF IP
    #==============================================================================
    if load_type == 'cyclic diamond path' and axial_temperature_phase == 0.0:
        use_exp_data = False
        load.setLoadBiaxial(
            int(loading_cycles),
            [0, period / 4.0, period / 2.0, period / 4.0 * 3.0, period], [
                temperature_mean, temperature_max, temperature_mean,
                temperature_min, temperature_mean
            ], [0, axial_strain, 0, -1 * axial_strain, 0],
            [-1 * shear_strain, 0, shear_strain, 0, -1 * shear_strain])
#==============================================================================
# Proportional path TMF IP
#==============================================================================
    if load_type == 'cyclic proportional path' and axial_temperature_phase == 0.0:
        use_exp_data = False
        load.setLoadBiaxial(
            int(loading_cycles),
            [0, period / 4.0, period / 2.0, period / 4.0 * 3.0, period], [
                temperature_mean, temperature_max, temperature_mean,
                temperature_min, temperature_mean
            ], [0, axial_strain, 0, -1 * axial_strain, 0],
            [0, shear_strain, 0, -1 * shear_strain, 0])
#==============================================================================
# Uniaxial TMF IP
#==============================================================================
    if load_type == 'cyclic tension compression' and axial_temperature_phase == 0.0:
        use_exp_data = False
        load.setLoadBiaxial(
            int(loading_cycles),
            [0, period / 4.0, period / 2.0, period / 4.0 * 3.0, period], [
                temperature_mean, temperature_max, temperature_mean,
                temperature_min, temperature_mean
            ], [0, axial_strain * 1, 0, -1 * axial_strain * 1, 0],
            [0, shear_strain, 0, -1 * shear_strain, 0])
#==============================================================================
# Uniaxial TMF OP
#==============================================================================
    if load_type == 'cyclic tension compression' and axial_temperature_phase == 180.0:
        use_exp_data = False
        load.setLoadBiaxial(
            int(loading_cycles),
            [0, period / 4.0, period / 2.0, period / 4.0 * 3.0, period], [
                temperature_mean, temperature_min, temperature_mean,
                temperature_max, temperature_mean
            ], [0, axial_strain, 0, -1 * axial_strain, 0],
            [0, shear_strain, 0, -1 * shear_strain, 0])
#==============================================================================
# Uniaxial TMF 90
#==============================================================================
    if load_type == 'cyclic tension compression' and axial_temperature_phase == 90.0:
        use_exp_data = False
        load.setLoadBiaxial(
            int(loading_cycles),
            [0, period / 4.0, period / 2.0, period / 4.0 * 3.0, period], [
                temperature_min, temperature_mean, temperature_max,
                temperature_mean, temperature_min
            ], [0, axial_strain, 0, -1 * axial_strain, 0],
            [0, shear_strain, 0, -1 * shear_strain, 0])
#==============================================================================
# load from experiment data
#==============================================================================
    if use_exp_data:
        if loading_cycles == None:
            load.setLoadFromExperiment(exp, runing_time=None)
        else:
            load.setLoadFromExperiment(exp,
                                       runing_time=period * loading_cycles)


#==============================================================================
# load of convection
#==============================================================================
    load.setConvection(film_coefficient, sink_temperature)
    #==============================================================================
    # load of thermal
    #==============================================================================
    load.setThermal(heat_flux, film_coefficient_outer, film_coefficient_inner,
                    emissivity, sink_temperature_inner, sink_temperature_outer,
                    outer_temperature)
    #==============================================================================
    # Step
    #==============================================================================
    #    step = Step(predefined_temperature = int(exp.initial_temperature),
    #              time_period = int(load.total_runing_time), initial_inc = 0.005,
    #              min_inc = 0.0001, max_inc = 5, nonlinear = 'ON')
    step = Step(predefined_temperature=temperature_mean,
                time_period=int(load.total_runing_time),
                initial_inc=0.00001,
                min_inc=0.00000001,
                max_inc=period / 40.0,
                nonlinear='OFF')
    #==============================================================================
    # UMAT
    #==============================================================================
    #    umat = UMAT(UMATDirectory = 'F:\\GitHub\\umat\\',
    #                UMATMainFile = 'MAIN_IN718.for',
    #                ParameterFortranFile = 'PARAMETERS_IN718_TMF.for',
    #                OutputFortranFile = 'OUTPUT.for',
    #                OutputTextFile = name + '_output.txt')

    umat = UMAT(UMATDirectory='F:\\GitHub\\umat\\',
                UMATMainFile='MAIN_IN718.for',
                ParameterFortranFile='PARAMETERS_SS304.for',
                OutputFortranFile='OUTPUT.for',
                OutputTextFile=name + '_output.txt')

    #    umat = UMAT(UMATDirectory = 'F:\\UMAT\\Fangjie\\',
    #                UMATMainFile = 'AO304Tanakav6VariDamageMyisokin3.for',
    #                ParameterFortranFile = 'PARAMETERS_SS304.for',
    #                OutputFortranFile = 'OUTPUT.for',
    #                OutputTextFile = name + '_output.txt')

    #    umat = UMAT(UMATDirectory = 'F:\\UMAT\\SS304\\',
    #                UMATMainFile = 'MAIN_SS304.for',
    #                ParameterFortranFile = 'PARAMETERS_SS304.for',
    #                OutputFortranFile = 'OUTPUT.for',
    #                OutputTextFile = name + '_output.txt')
    #==============================================================================
    # Job
    #==============================================================================
    job = Job(JobName=name, UMAT=umat, Step=step, Load=load, copy=copy)

    #    job.allProc()
    job.createDirectory()
    job.copyFiles()
    job.creatBatchFile()
    job.createAbaqusCAE()
    job.createAbaqusInput()
    job.run()
    job.autoPostProc()
def create_plot_data_exp_half_life_cycle(figure_path=None,figure_name=None):
#==============================================================================
# x,y label
#==============================================================================
    xlabel = xylabels['shear_strain']
    ylabel = xylabels['shear_stress']
#==============================================================================
# plot lines
#==============================================================================
    i = 0
    marker_list = ['s','o','^','D']
    plot_data = PlotData()
    experiment_log = ExperimentLog(ExperimentLogFile)
    for name in ['7006','7007','7009']:
        experiment_log.output(name)
        regular = r'.*'
        load_type = experiment_log.obtainItem(name,'load_type',regular)[0]
        regular = r'\d+\.?\d*'
        temperature_mode = experiment_log.obtainItem(name,'temperature_mode',regular)
        if len(temperature_mode) == 1:
            temperature_list = [float(temperature_mode[0]), float(temperature_mode[0])]
        if len(temperature_mode) == 2:
            temperature_list = [float(temperature_mode[0]), float(temperature_mode[1])]
        d_out = float(experiment_log.obtainItem(name,'d_out',regular)[0])
        gauge_length = float(experiment_log.obtainItem(name,'gauge_length',regular)[0])
        axial_strain = float(experiment_log.obtainItem(name,'axial_strain',regular)[0])
        angel_strain = float(experiment_log.obtainItem(name,'angel_strain',regular)[0])
        equivalent_strain = float(experiment_log.obtainItem(name,'equivalent_strain',regular)[0])
        period = float(experiment_log.obtainItem(name,'period',regular)[0])
        axial_temperature_phase = float(experiment_log.obtainItem(name,'axial_temperature_phase',regular)[0])
        
        filename = ExperimentDirectory + name + '.csv'
        experiment = ExperimentData(filename)
        strain = experiment.obtainNthCycle('shear_strain',experiment.half_life_cycle)
        stress = experiment.obtainNthCycle('shear_stress',experiment.half_life_cycle)
        plot_data.addLine(strain*100,
                          stress,
                          xlabel=xlabel,
                          ylabel=ylabel,
                          linelabel=str(int(temperature_mode[0])+273)+'K',
                          linewidth=2,
                          linestyle='-',
                          marker=None,
                          markersize=12,
                          color=color_list[i])
        i += 1
    
#    material = material_in718()
#    epsilon,sigma = material.plotCyclicStrengthCoefficient()
#    plot_data.addLine(epsilon*100,
#                      sigma,
#                      xlabel=xlabel,
#                      ylabel=ylabel,
#                      linelabel='Ramberg-Osgood',
#                      linewidth=4,
#                      linestyle='--',
#                      marker=None,
#                      markersize=12,
#                      color='black')
    
    plot_data.writeToFile(figure_path,figure_name)
Ejemplo n.º 11
0
def create_plot_data_monotonic_cyclic_osgood(figure_path=None,
                                             figure_name=None):
    #==============================================================================
    # x,y label
    #==============================================================================
    xlabel = xylabels['axial_strain_amplitude']
    ylabel = xylabels['axial_stress_amplitude']
    #==============================================================================
    # plot lines
    #==============================================================================
    i = 0
    marker_list = ['s', 'o', '^', 'D']
    plot_data = PlotData()
    cyclic_strain = []
    cyclic_stress = []
    for name in experiment_type_dict['TC-IF']:
        #        print name
        filename = ExperimentDirectory + name + '.csv'
        experiment = ExperimentData(filename)
        #        print experiment.half_life_cycle
        stress = experiment.obtainNthCycle('axial_stress',
                                           experiment.half_life_cycle)
        strain = experiment.obtainNthCycle('axial_strain',
                                           experiment.half_life_cycle)
        stress_amplitude = (max(stress) - min(stress)) / 2.0
        strain_amplitude = (max(strain) - min(strain)) / 2.0 * 100
        cyclic_strain.append(strain_amplitude)
        cyclic_stress.append(stress_amplitude)

    name = '7102'  # 650C monotonic tension
    filename = ExperimentDirectory + name + '.csv'
    experiment = ExperimentData(filename)
    monotonic_stress = list(experiment.axial_stress)[::20]
    monotonic_strain = list(experiment.axial_strain * 100.0)[::20]
    plot_data.addLine(monotonic_strain,
                      monotonic_stress,
                      xlabel=xlabel,
                      ylabel=ylabel,
                      linelabel='Monotonic Exp.',
                      linewidth=2,
                      linestyle='',
                      marker=marker_list[i],
                      markersize=12,
                      color='blue')
    i += 1

    plot_data.addLine(cyclic_strain,
                      cyclic_stress,
                      xlabel=xlabel,
                      ylabel=ylabel,
                      linelabel='Cyclic Exp.',
                      linewidth=2,
                      linestyle='',
                      marker=marker_list[i],
                      markersize=12,
                      color='red')
    i += 1

    material = material_in718()
    epsilon, sigma = material.plotStrengthCoefficient()
    plot_data.addLine(epsilon * 100,
                      sigma,
                      xlabel=xlabel,
                      ylabel=ylabel,
                      linelabel='Monotonic Fit.',
                      linewidth=2,
                      linestyle='-',
                      marker=None,
                      markersize=12,
                      color='blue')

    epsilon, sigma = material.plotCyclicStrengthCoefficient()
    plot_data.addLine(epsilon * 100,
                      sigma,
                      xlabel=xlabel,
                      ylabel=ylabel,
                      linelabel='Cyclic Fit.',
                      linewidth=2,
                      linestyle='-',
                      marker=None,
                      markersize=12,
                      color='red')

    plot_data.writeToFile(figure_path, figure_name)
def calculate_umat_parameters_in718(name='_output.txt'):
    parameters = []
    yield_stress = 300.0
    show = False
    #    plastic_strain_list=[0.001,0.005,0.01,0.02]
    plastic_strain_list = [
        0.00005, 0.0001, 0.0002, 0.0005, 0.001, 0.002, 0.004, 0.01, 0.02
    ]
    umat = UMAT(UMATDirectory='F:\\GitHub\\umat\\',
                UMATMainFile='MAIN_IN718.for',
                ParameterFortranFile='PARAMETERS_IN718_TMF.for',
                OutputFortranFile='OUTPUT.for',
                OutputTextFile=name + '_output.txt')
    outfile = open(umat.ParameterFortranFileFullName, 'w')
    print outfile.name
    #==============================================================================
    # 300C
    #==============================================================================
    temperature = 300.0
    youngs_modulus, poisson_ratio, shear_modulus, yield_stress = calculate_elastic_by_temperature_in718(
        temperature)

    name = '7101'
    exp_full_name = ExperimentDirectory + name + '.csv'
    exp_monotonic = ExperimentData(exp_full_name)

    name = '7211'
    exp_full_name = ExperimentDirectory + name + '.csv'
    exp_cyclic = ExperimentData(exp_full_name)

    monotonic_curve = [
        exp_monotonic.axial_log_strain, exp_monotonic.axial_true_stress
    ]
    cyclic_curve = [
        exp_cyclic.obtainNthCycle('axial_strain', 190),
        exp_cyclic.obtainNthCycle('axial_stress', 190)
    ]
    seg, zeta, r0, ri = obtain_kinematic_hardening_parameters(
        monotonic_curve,
        cyclic_curve,
        position_x_list=plastic_strain_list,
        yield_stress=yield_stress,
        youngs_modulus=youngs_modulus,
        show=show)
    parameters.append([temperature, seg, zeta, r0, ri])
    #==============================================================================
    # 550C
    #==============================================================================
    temperature = 550.0
    youngs_modulus, poisson_ratio, shear_modulus, yield_stress = calculate_elastic_by_temperature_in718(
        temperature)

    name = '7103'
    exp_full_name = ExperimentDirectory + name + '.csv'
    exp_monotonic = ExperimentData(exp_full_name)

    name = '7212'
    exp_full_name = ExperimentDirectory + name + '.csv'
    exp_cyclic = ExperimentData(exp_full_name)

    monotonic_curve = [
        exp_monotonic.axial_log_strain, exp_monotonic.axial_true_stress
    ]
    cyclic_curve = [
        exp_cyclic.obtainNthCycle('axial_strain', 190),
        exp_cyclic.obtainNthCycle('axial_stress', 190)
    ]
    seg, zeta, r0, ri = obtain_kinematic_hardening_parameters(
        monotonic_curve,
        cyclic_curve,
        position_x_list=plastic_strain_list,
        yield_stress=yield_stress,
        youngs_modulus=youngs_modulus,
        show=show)
    parameters.append([temperature, seg, zeta, r0, ri])
    #==============================================================================
    # 650C
    #==============================================================================
    temperature = 650.0
    youngs_modulus, poisson_ratio, shear_modulus, yield_stress = calculate_elastic_by_temperature_in718(
        temperature)

    name = '7102'
    exp_full_name = ExperimentDirectory + name + '.csv'
    exp_monotonic = ExperimentData(exp_full_name)

    name = '7213'
    exp_full_name = ExperimentDirectory + name + '.csv'
    exp_cyclic = ExperimentData(exp_full_name)

    monotonic_curve = [
        exp_monotonic.axial_log_strain, exp_monotonic.axial_true_stress
    ]
    cyclic_curve = [
        exp_cyclic.obtainNthCycle('axial_strain', 190),
        exp_cyclic.obtainNthCycle('axial_stress', 190)
    ]
    seg, zeta, r0, ri = obtain_kinematic_hardening_parameters(
        monotonic_curve,
        cyclic_curve,
        position_x_list=plastic_strain_list,
        yield_stress=yield_stress,
        youngs_modulus=youngs_modulus,
        show=show)
    parameters.append([temperature, seg, zeta, r0, ri])
    #==============================================================================
    # output elastic
    #==============================================================================
    print >> outfile, """C <ELASTKIC CONSTANTS>
C <Young's modulus 3rd order fitting>
      EMOD=206308.7426+(-51.20306)*TEMP+0.01109*TEMP**2
     1     +(-3.84391E-05)*TEMP**3
C <Poisson's Ratio 3rd order fitting>
      ENU=2.901300E-01+(1.457750E-05)*TEMP
     1     +(-2.067420E-07)*TEMP**2+(2.780300E-10)*TEMP**3
      EG=0.5D0*EMOD/(1.0D0+ENU)
      EBULK=EMOD/(3.0D0*(1.0D0-2.0D0*ENU))
      ELAM=EBULK-EG*2.0D0/3.0D0
      ELAMK0=0.0D0-EG*2.0D0/3.0D0
C <YIELD STRESS>
      SY=%sD0
C <KINEMATIC HARDENING PARAMETERS>
      MU=0.2D0
      TQ=3.0D1""" % yield_stress
    #==============================================================================
    # output zeta
    #==============================================================================
    for i in range(seg):
        lines = '      ZKI(%u)=(%.2f)' % (i + 1, parameters[0][2][i])
        print >> outfile, lines
#==============================================================================
# output r0
#==============================================================================
    for i in range(seg):
        x = np.array([parameters[0][0], parameters[2][0]])
        y = np.array([parameters[0][3][i], parameters[2][3][i]])
        z = np.polyfit(x, y, 1)
        p = np.poly1d(z)
        lines = '      R0KI(%u)=(%g)*TEMP+(%g)' % (i + 1, z[0], z[1])
        print >> outfile, lines
#==============================================================================
# output r_delta
#==============================================================================
    for i in range(seg):
        x = np.array([parameters[0][0], parameters[2][0]])
        y = np.array([parameters[0][4][i], parameters[2][4][i]])
        z = np.polyfit(x, y, 1)
        p = np.poly1d(z)
        lines = '      RDSSKI(%u)=(%g)*TEMP+(%g)' % (i + 1, z[0], z[1])
        print >> outfile, lines


#==============================================================================
# others
#==============================================================================
    print >> outfile, """
C <300C 200CYCLES>
C      CA1=0.4061D0
C      CB1=1.2746D0
C      CA2=1.0D0-CA1
C      CB2=9.4506D0
C      CB3=0.0D0
C <300C 800CYCLES>
C      CA1=0.3073D0
C      CB1=0.42549D0
C      CA2=1.0D0-CA1
C      CB2=5.78033D0
C      CB3=0.0D0
C <550C 200CYCLES>
C      CA1=0.4007D0
C      CB1=0.8672D0
C      CA2=1.0D0-CA1
C      CB2=11.81D0
C      CB3=0.0D0
C <650C 200CYCLES>
      CA1=0.4163D0
      CB1=0.4952D0
      CA2=1.0D0-CA1
      CB2=9.108D0
      CB3=0.0D0
C <ISOTROPIC PARAMETERS>
      YDNONPSS=000.0D0
      GAMAP=5.0D1
      GAMAQ=5.0D0
      YDPTS=0.0D0
      T1=20.0D0
      M1=2.0D0
C <NONPROPORTIONAL PARAMETERS>
      CCOEF=50.0D0
C <DAMAGE PARAMETERS>
      PD=1000.0D0"""
    outfile.close()
Ejemplo n.º 13
0
def create_plot_data(figure_path=None, figure_name=None):
    #==============================================================================
    # x,y label
    #==============================================================================
    xlabel = xylabels['axial_strain']
    ylabel = xylabels['axial_stress']
    #==============================================================================
    # plot lines
    #==============================================================================
    i = 0
    marker_list = ['s', 'o', '^', 'D']
    plot_data = PlotData()
    experiment_log = ExperimentLog(ExperimentLogFile)
    #    for name in ['7110','7111','7112','7113','7114','7115','7116']:
    #    for name in ['7110','7111','7112','7113','7114']:
    #    for name in experiment_type_dict['TC-IP'] + experiment_type_dict['TC-OP']:
    #    for name in experiment_type_dict['TC-OP']:
    #    for name in experiment_type_dict['PRO-IP']:
    #    for name in experiment_type_dict['NPR-IP']+experiment_type_dict['PRO-IP']+['7110','7111','7112','7113','7114']:
    for name in ['7111']:
        experiment_log.output(name)
        regular = r'.*'
        load_type = experiment_log.obtainItem(name, 'load_type', regular)[0]
        regular = r'\d+\.?\d*'
        temperature_mode = experiment_log.obtainItem(name, 'temperature_mode',
                                                     regular)
        if len(temperature_mode) == 1:
            temperature_list = [
                float(temperature_mode[0]),
                float(temperature_mode[0])
            ]
        if len(temperature_mode) == 2:
            temperature_list = [
                float(temperature_mode[0]),
                float(temperature_mode[1])
            ]
        d_out = float(experiment_log.obtainItem(name, 'd_out', regular)[0])
        gauge_length = float(
            experiment_log.obtainItem(name, 'gauge_length', regular)[0])
        axial_strain = float(
            experiment_log.obtainItem(name, 'axial_strain', regular)[0])
        angel_strain = float(
            experiment_log.obtainItem(name, 'angel_strain', regular)[0])
        equivalent_strain = float(
            experiment_log.obtainItem(name, 'equivalent_strain', regular)[0])
        period = float(experiment_log.obtainItem(name, 'period', regular)[0])
        axial_temperature_phase = float(
            experiment_log.obtainItem(name, 'axial_temperature_phase',
                                      regular)[0])

        filename = ExperimentDirectory + name + '.csv'
        experiment = ExperimentData(filename)
        #        print experiment.axial_count_index_list
        youngs_modulus, poisson_ratio, shear_modulus, yield_stress = calculate_elastic_by_temperature_in718(
            650)
        e_list = []
        count = []
        for i in experiment.axial_count_index_list[1:-1:1]:
            strain = experiment.obtainNthCycle('axial_strain', i)
            stress = experiment.obtainNthCycle('axial_stress', i)
            p = (max(strain) - max(stress) / youngs_modulus) * 4 * i
            masing = obtain_masing_curve([strain, stress])
            e = obtain_youngs_modulus(masing, 0.0025)
            count.append(i)
            e_list.append(e)

#        damage = 1.0 - np.array(e_list)/youngs_modulus
        damage = 1.0 - np.array(e_list) / max(e_list)
        if min(damage) <= 0:
            damage += abs(min(damage))
        else:
            damage -= abs(min(damage))


#            plot_data.addLine(masing[0]*100,
#                              masing[1],
#                              xlabel=xlabel,
#                              ylabel=ylabel,
#                              linelabel=str(int(temperature_mode[0])+273)+'K',
#                              linewidth=2,
#                              linestyle='-',
#                              marker=None,
#                              markersize=12,
#                              color='auto')

        damage[0] = 0
        #        damage[1]=0
        #        damage[2]=0
        #        damage[3]=0

        plot_data.addLine(count,
                          damage,
                          xlabel='Accumulated plastic strain $p$ [%]',
                          ylabel='Damage $D$',
                          linelabel=axial_strain,
                          linewidth=2,
                          linestyle='',
                          marker='o',
                          markersize=12,
                          color='auto')

    plot_data.writeToFile(figure_path, figure_name)
Ejemplo n.º 14
0
def create_plot_data_exp_half_life_cycle(figure_path=None, figure_name=None):
    #==============================================================================
    # x,y label
    #==============================================================================
    xlabel = xylabels['axial_strain']
    ylabel = xylabels['axial_stress']
    #==============================================================================
    # plot lines
    #==============================================================================
    i = 0
    marker_list = ['s', 'o', '^', 'D']
    plot_data = PlotData()
    experiment_log = ExperimentLog(ExperimentLogFile)
    #    for name in ['7110','7111','7112','7113','7114','7115','7116']:
    for name in ['7045']:
        experiment_log.output(name)
        regular = r'.*'
        load_type = experiment_log.obtainItem(name, 'load_type', regular)[0]
        regular = r'\d+\.?\d*'
        temperature_mode = experiment_log.obtainItem(name, 'temperature_mode',
                                                     regular)
        if len(temperature_mode) == 1:
            temperature_list = [
                float(temperature_mode[0]),
                float(temperature_mode[0])
            ]
        if len(temperature_mode) == 2:
            temperature_list = [
                float(temperature_mode[0]),
                float(temperature_mode[1])
            ]
        d_out = float(experiment_log.obtainItem(name, 'd_out', regular)[0])
        gauge_length = float(
            experiment_log.obtainItem(name, 'gauge_length', regular)[0])
        axial_strain = float(
            experiment_log.obtainItem(name, 'axial_strain', regular)[0])
        angel_strain = float(
            experiment_log.obtainItem(name, 'angel_strain', regular)[0])
        equivalent_strain = float(
            experiment_log.obtainItem(name, 'equivalent_strain', regular)[0])
        period = float(experiment_log.obtainItem(name, 'period', regular)[0])
        axial_temperature_phase = float(
            experiment_log.obtainItem(name, 'axial_temperature_phase',
                                      regular)[0])

        filename = ExperimentDirectory + name + '.csv'
        experiment = ExperimentData(filename)
        print experiment.axial_count_index_list
        e_list = []
        count = []
        for i in experiment.axial_count_index_list[2:200:50]:
            strain = experiment.obtainNthCycle('axial_strain', i)
            stress = experiment.obtainNthCycle('axial_stress', i)
            masing = obtain_masing_curve([strain, stress])
            e = obtain_youngs_modulus(masing, 0.002)
            count.append(i)
            e_list.append(e)

            plot_data.addLine(masing[0] * 100,
                              masing[1],
                              xlabel=xlabel,
                              ylabel=ylabel,
                              linelabel=str(int(temperature_mode[0]) + 273) +
                              'K',
                              linewidth=2,
                              linestyle='-',
                              marker=None,
                              markersize=12,
                              color='auto')


#        plot_data.addLine(count,
#                          e_list,
#                          xlabel=xlabel,
#                          ylabel=ylabel,
#                          linelabel='',
#                          linewidth=2,
#                          linestyle='',
#                          marker='o',
#                          markersize=12,
#                          color='auto')

    plot_data.writeToFile(figure_path, figure_name)