Пример #1
0
def AlphaCalculate(fade_rate,
                   amplitude,
                   dadn,
                   dk,
                   kc,
                   a,
                   a_range,
                   a_amplitude,
                   stress_ratio,
                   numofaverage=7,
                   error_ratio=0.2):
    # 放弃
    # 移动平均
    kc_Manual_averaged2, dk_Manual_averaged2 = \
        DoubleDataSelectMovingAverage(data=kc, reference=dk,
                                      ratio=error_ratio, numofaverage=numofaverage)
    _, a_Manual_averaged2 = \
        DoubleDataSelectMovingAverage(data=kc, reference=a,
                                      ratio=error_ratio, numofaverage=numofaverage)
    _, dadn_Manual_averaged2 = \
        DoubleDataSelectMovingAverage(data=kc, reference=dadn,
                                      ratio=error_ratio, numofaverage=numofaverage)
    # 数据筛选a_range
    dadn_selecting_average2, dk_selecting_averaged2, kc_selecting_averaged2, a_selecting_averaged2 = \
        mts_analysis.FCGDataSelectByThreshold(dadn=dadn_Manual_averaged2, dk=dk_Manual_averaged2,
                                              n=kc_Manual_averaged2, a=a_Manual_averaged2,
                                              threshold=a_range[0], target='a', keepbigger=1)
    dadn_selected_averaged2, dk_selected_averaged2, kc_selected_averaged2, a_selected_averaged2 = \
        mts_analysis.FCGDataSelectByThreshold(dadn=dadn_selecting_average2, dk=dk_selecting_averaged2,
                                              n=kc_selecting_averaged2, a=a_selecting_averaged2,
                                              threshold=a_range[1], target='a', keepbigger=0)
    # 拟合数据准备
    kmin_selected_averaged2 = dk_selected_averaged2 * (
        stress_ratio / (1 - stress_ratio))  # Kmin计算
    kmax_selected_averaged2 = dk_selected_averaged2 * (1 / (1 - stress_ratio)
                                                       )  # Kmax计算
    c_p, m_p = paris_and_walker.ParisParameter(r=stress_ratio)  # Paris参数读取
    betas = (a_selected_averaged2 - a_amplitude) / a_amplitude  # 裂纹长度无量纲量
    # 计算参数alpha
    alpha_e = []
    for beta in betas:
        if beta < 0:
            alpha_e.append(2 / np.pi)
        else:
            alpha_e.append(amplitude * np.exp(-fade_rate * beta))
    alpha_e = np.array(alpha_e)
    # 基于参数计算有效应力强度因子
    dkeff_alpha_e = kmax_selected_averaged2 - alpha_e * kc_selected_averaged2 - (
        1 - alpha_e) * kmin_selected_averaged2
    # 计算dadn
    dadn_alpha_e = mts_analysis.ParisCalculating(c=c_p,
                                                 m=m_p,
                                                 dk=dkeff_alpha_e)
    return dk_selected_averaged2, dkeff_alpha_e, dadn_alpha_e, alpha_e, betas, a_selected_averaged2
Пример #2
0
# 实验参数
sequence = ["yang-baoban_Lu-420-06"]  # Graph Saving Sequence
pol = 4000
r = 0.1
threshold = 0
aol_hold = 12.0057  # 高载长度:按Hold时记录的裂纹长度
aol_maxrate = 12.0057  # 高载长度:对应FCGRate最大时的裂纹长度
aol_minrate = 12.7927  # 高载长度:对应FCGRate最小时的裂纹长度

# 程序参数
show = 1  # 绘图开关

# 裂纹扩展公式数据库
c_w, m_w, gamma = paris_and_walker.WalkerParameter()
c_p, m_p = paris_and_walker.ParisParameter(r=r)

# 读取数据并完成基本的FCG处理
specimen, width, notch_length, thickness, elastic_modulus, yield_strength, precrack_length = \
    read_data.ReadTestInf(sequence=sequence[0])
cycles, cracklength, kmax, kmin, pmax, pmin, kclosure, closureload = \
    read_data.ReadOriginResult(sequence=sequence[0], closure=True, cod=False)
dadn_Manual, n_Manual, dk_Manual, a_Manual, kc_Manual = \
    experiment_calculation.FCGRandDKbyOriginalData(b=thickness, w=width, n=cycles, pmax=pmax, pmin=pmin,
                                                   a=cracklength,
                                                   ys=yield_strength, r=r, kclosure=kclosure,
                                                   threshold=threshold)

# Kmax at Overload计算
k_max_ol = mts_analysis.DeltaKCalculating(b=thickness,
                                          w=width,
Пример #3
0
eta = -3  # Modified-wheeler模型修正
kappa = 100
plz_factor = 'Xiaoping'

# 类建立
specimen = OverloadSpecimen(name=sequence)
specimen.status_input_from_database()
specimen.basic_result_calculate()
#specimen.a_ol_applied -= 1.5
specimen.a_dadn_min = 13.8055
specimen.a_kc_max = specimen.a_alpha_end
specimen.a_alpha_end += 2.5
specimen.specimen_print()

# paris参数
c_ca, m_ca = paris_and_walker.ParisParameter(r=specimen.stress_ratio)

# Overload PLZ相关参数,塑性区系数为Irwin
kol = mts_analysis.DeltaKCalculating(b=specimen.thickness,
                                     w=specimen.width,
                                     a=specimen.a_ol_applied,
                                     pmax=specimen.overload,
                                     pmin=0)
plz_ol = overload_analysis.PlasticZoneWithFactor(kmax=np.array([kol]),
                                                 ys=specimen.yield_stress,
                                                 factor=plz_factor,
                                                 t=specimen.thickness)

# 数据筛选(筛选出dadn_min后的数据,标记为1)
dadn_1, dk_1, kc_1, n_1, a_1 = specimen.data_select_by_cracklength(
    lowerlimit=specimen.a_dadn_min, upperlimit=specimen.a_kc_max)
Пример #4
0
def Alpha2(sequence,
           stress_ratio,
           error_ratio,
           numofaverage,
           a_range,
           amplitude=0,
           fade_rate=0,
           fitting=0,
           model='paris'):
    # usage: 采用提出的Alpha方法先拟合出幅度系数M,再根据其计算dadn结果
    # input parameter:
    # sequence: 试件名(与MTS中一致,将直接读取文件)
    # stress_ratio:实验应力比
    # error_ratio:进行数据筛选的误差带半宽度,详细注释见函数DoubleDataSelectMovingAverage
    # numofaverage:进行移动平均的数据个数,详细注释见函数DoubleDataSelectMovingAverage
    # a_range:拟合的数据范围,格式为数组[a_begin, a_end],a_begin推荐为dkeff_basic的谷值或dadn的谷值,
    # a_end要注意截止在数据开始离散之前
    # fade_rate:幂函数中的指数系数,直接指定,常见[5,8]
    # amplitude: 幂函数中的幅度系数,可定2/pi
    # 注:函数自动将对输入为0的项先拟合参数再进行计算,若均不为零则直接计算不进行拟合
    # fitting: 若fitting为1,则输出拟合时对标的dkeff_experiment值,以用于计算lost
    # model: 设定计算过程中采用的model,默认采用paris,可选walker
    # return parameter:
    # Ce1: 计算得到的幅度系数
    # dk_selected_averaged2, dkeff_alpha_e, dadn_alpha_e:对应的裂纹扩展参数
    # alpha_e:对应的参数alpha

    # 数据读入
    dadn_Manual, n_Manual, dk_Manual, a_Manual, kc_Manual = \
        BasicDataDispose(sequence=sequence, r=stress_ratio)
    if model == 'walker':
        c_w, m_w, gamma = paris_and_walker.WalkerParameter(data=1)
    else:
        c_p, m_p = paris_and_walker.ParisParameter(r=stress_ratio)

    # 移动平均
    kc_Manual_averaged2, dk_Manual_averaged2 = \
        DoubleDataSelectMovingAverage(data=kc_Manual, reference=dk_Manual,
                                      ratio=error_ratio, numofaverage=numofaverage)
    _, a_Manual_averaged2 = \
        DoubleDataSelectMovingAverage(data=kc_Manual, reference=a_Manual,
                                      ratio=error_ratio, numofaverage=numofaverage)
    _, dadn_Manual_averaged2 = \
        DoubleDataSelectMovingAverage(data=kc_Manual, reference=dadn_Manual,
                                      ratio=error_ratio, numofaverage=numofaverage)

    # 数据筛选a_range
    dadn_selecting_average2, dk_selecting_averaged2, kc_selecting_averaged2, a_selecting_averaged2 = \
        mts_analysis.FCGDataSelectByThreshold(dadn=dadn_Manual_averaged2, dk=dk_Manual_averaged2,
                                              n=kc_Manual_averaged2, a=a_Manual_averaged2,
                                              threshold=a_range[0], target='a', keepbigger=1)
    dadn_selected_averaged2, dk_selected_averaged2, kc_selected_averaged2, a_selected_averaged2 = \
        mts_analysis.FCGDataSelectByThreshold(dadn=dadn_selecting_average2, dk=dk_selecting_averaged2,
                                              n=kc_selecting_averaged2, a=a_selecting_averaged2,
                                              threshold=a_range[1], target='a', keepbigger=0)

    # 拟合数据准备
    kmin_selected_averaged2 = dk_selected_averaged2 * (
        stress_ratio / (1 - stress_ratio))  # Kmin计算
    kmax_selected_averaged2 = dk_selected_averaged2 * (1 / (1 - stress_ratio)
                                                       )  # Kmax计算
    if model == 'walker':
        dkeff_experiment_averaged2 = (
            (dadn_selected_averaged2 / c_w)**(1 / m_w)) / (
                (1 - stress_ratio)**(gamma - 1))
    else:
        dkeff_experiment_averaged2 = (dadn_selected_averaged2 / c_p)**(
            1 / m_p)  # 拟合时的真值dkeff,由Paris给出
    beta = (a_selected_averaged2 - a_range[0]) / a_range[0]  # 裂纹长度无量纲量

    # 拟合,得到幅度或衰减系数
    if fade_rate != 0 and amplitude == 0:

        def residual_alpha_e(p):
            Ce = p
            return dkeff_experiment_averaged2 - (
                kmax_selected_averaged2 -
                (Ce * np.exp(-fade_rate * beta)) * kc_selected_averaged2 -
                (1 -
                 (Ce * np.exp(-fade_rate * beta))) * kmin_selected_averaged2)

        k = opt.leastsq(residual_alpha_e, np.array([1]))
        Ce1 = k[0]
    elif amplitude != 0 and fade_rate == 0:

        def residual_alpha_e(p):
            n = p
            return dkeff_experiment_averaged2 - (
                kmax_selected_averaged2 -
                (amplitude * np.exp(-n * beta)) * kc_selected_averaged2 -
                (1 -
                 (amplitude * np.exp(-n * beta))) * kmin_selected_averaged2)

        k = opt.leastsq(residual_alpha_e, np.array([1]))
        fade_rate = k[0]
        Ce1 = amplitude

    elif amplitude != 0 and fade_rate != 0:
        Ce1 = amplitude
    elif amplitude == 0 and fade_rate == 0:

        def residual_alpha_e(p):
            Ce, n = p
            return dkeff_experiment_averaged2 - (
                kmax_selected_averaged2 -
                (Ce * np.exp(-n * beta)) * kc_selected_averaged2 -
                (1 - (Ce * np.exp(-n * beta))) * kmin_selected_averaged2)

        k = opt.leastsq(residual_alpha_e, np.array([1, 1]))
        Ce1, fade_rate = k[0]

    # 计算参数alpha
    alpha_e = Ce1 * np.exp(-fade_rate * beta)
    print("alpha幂函数拟合:试件名:", sequence, "幅度:", Ce1, "衰减速率:", fade_rate)

    # 计算dkeff_alpha和对应的dadn
    dkeff_alpha_e = kmax_selected_averaged2 - alpha_e * kc_selected_averaged2 - (
        1 - alpha_e) * kmin_selected_averaged2
    if model == 'walker':
        dadn_alpha_e = mts_analysis.WalkerCalculating(c0=c_w,
                                                      gamma=gamma,
                                                      m0=m_w,
                                                      r=stress_ratio,
                                                      dk=dkeff_alpha_e)
    else:
        dadn_alpha_e = mts_analysis.ParisCalculating(c=c_p,
                                                     m=m_p,
                                                     dk=dkeff_alpha_e)
    if fitting:
        return Ce1, fade_rate, dk_selected_averaged2, dkeff_alpha_e, dadn_alpha_e, alpha_e, dkeff_experiment_averaged2
    else:
        return Ce1, fade_rate, dk_selected_averaged2, dkeff_alpha_e, dadn_alpha_e, alpha_e
from FCGAnalysisLib import closureanalysis
import numpy as np
import matplotlib.pyplot as plt

# 实验参数
sequence = [
    "yang-baoban_Lu-420-13", "yang-baoban_Lu-420-15", "yang-baoban_Lu-420-16",
    "yang-baoban_Lu-420-07", "yang-baoban_Lu-420-10"
]
stress_ratio = [0.5, 0.5, 0.5, 0.5, 0.5]

# 程序参数
show = 1  # 绘图开关

# paris参数读取,以stress_ratio中第一组的应力比为准
c_CA, m_CA = paris_and_walker.ParisParameter(r=stress_ratio[0])

# seqence中数据的读取和处理,未对SIFclosure进行读取(记为-)
dadn_Manual1, n_Manual1, dk_Manual1, a_Manual1, _ = \
    closureanalysis.BasicDataDispose(sequence=sequence[0], r=stress_ratio[0])

dadn_Manual2, n_Manual2, dk_Manual2, a_Manual2, _ = \
    closureanalysis.BasicDataDispose(sequence=sequence[1], r=stress_ratio[1])

dadn_Manual3, n_Manual3, dk_Manual3, a_Manual3, _ = \
    closureanalysis.BasicDataDispose(sequence=sequence[2], r=stress_ratio[2])

dadn_Manual4, n_Manual4, dk_Manual4, a_Manual4, _ = \
    closureanalysis.BasicDataDispose(sequence=sequence[3], r=stress_ratio[3])

dadn_Manual5, n_Manual5, dk_Manual5, a_Manual5, _ = \