Пример #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)
Пример #2
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)
Пример #3
0
def compare_exp_sim(name,loading_cycles=1,xitem='axial_strain',yitem='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])

    exp_filename = ExperimentDirectory + name + '.csv'
    experiment = ExperimentData(exp_filename)
    sim_filename = SimulationDirectory + name + '.csv'
    simulation = SimulationData(sim_filename,period)
    
    exp_xitem = experiment.obtainNthCycle(xitem,loading_cycles)
    exp_yitem = experiment.obtainNthCycle(yitem,loading_cycles)
    
    sim_xitem = simulation.obtainNthCycle(xitem,loading_cycles)
    sim_yitem = simulation.obtainNthCycle(yitem,loading_cycles)
    
    plt.plot(exp_xitem,exp_yitem,label='exp')
    plt.plot(sim_xitem,sim_yitem,label='sim')
    
    plt.legend(loc=0)
    
    figure_path = ArticleFigureDirectory
    figure_name = name + '_' + xitem + '_' + yitem
    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()
Пример #4
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)
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)
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()
Пример #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 ['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)
Пример #9
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)
Пример #10
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 ['7211', '7212', '7213']:
        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('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=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)