Untitled

 avatar
unknown
plain_text
2 months ago
4.6 kB
8
Indexable
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

# Sabitler
R = 8.314  # J/mol/K

# Sıcaklık verilerini tanımlama (sadece veri adı belirtiliyor)
temperature_data = [
    [0, 927.7, 752.3, 753.6, 804.7, 813.6, 838.2, 811.2, 791.1, 745.0, 706.9, 647.7],
    [500, 1056.8, 822.4, 834.9, 917.7, 930.0, 952.8, 930.5, 903.5, 856.3, 806.1, 721.3],
    [1000, 1191.2, 943.3, 964.7, 1070.6, 1110.6, 1120.6, 1087, 1038.9, 975.7, 863.2, 750.6],
    [1500, 1217.0, 1018.8, 1047.2, 1174.2, 1253.0, 1227.4, 1160, 1086.1, 1006, 853.6, 741.3],
    [2000, 1047.9, 1050.6, 1085.7, 1235.5, 1335.8, 1269.9, 1188.2, 1096.2, 1009.8, 852.5, 742.8],
    [2500, 937.5, 1086.4, 1122.2, 1273.7, 1393.9, 1291.4, 1211.6, 1111.2, 1021.7, 858.3, 744.6],
    [3000, 1093.5, 1110.8, 1137.6, 1276.6, 1409.4, 1298.7, 1224.8, 1119.7, 1026.2, 857.5, 743.9],
    [3500, 998.7, 1116.1, 1137.5, 1265.9, 1409.3, 1294.4, 1227.9, 1117.7, 1028.8, 856.4, 742],
    [4000, 770.8, 1112.6, 1134.9, 1257.9, 1410.3, 1299.9, 1229.8, 1117.1, 1032, 855.7, 739.3],
    [4500, 872.2, 1111.6, 1132.4, 1253.3, 1414, 1306.3, 1230.7, 1119.9, 1035.6, 854.5, 737.6],
    [5000, 850.5, 1108.8, 1128.7, 1250.9, 1411.9, 1304.7, 1230.1, 1121.6, 1035.6, 853.9, 736.5],
    [5500, 860.7, 1105.7, 1129.2, 1254.1, 1409.4, 1306.8, 1229.3, 1122.9, 1038.1, 854.5, 737.4],
    [6000, 907.8, 1104.4, 1127.2, 1245.3, 1404, 1292.9, 1229.8, 1123.4, 1038.4, 855.7, 736.2],
    [6500, 875.5, 1116.0, 1169.9, 1298.7, 1456.3, 1357.4, 1296.8, 1174.3, 1086, 890.2, 770.7],
    [7000, 930.5, 1198.4, 1286.6, 1487.9, 1690.5, 1516.8, 1436.8, 1308.9, 1179.6, 947.2, 801.9],
    [7500, 555.3, 818.0, 691.6, 312.0, 331.3, 396.1, 387.5, 376.5, 320.7, 358.6, 357.0],
    [8000, 319.8, 304.7, 273, 282.1, 291.9, 352.7, 351.5, 350.4, 305.4, 328.9, 329.9],
    [8500, 352.7, 304.6, 273, 281.3, 291.7, 355.9, 354.0, 354.4, 305.4, 339.3, 340.3]
]

# DataFrame sütun isimleri
columns = ["time", "T_1350", "T_1250", "T_1150", "T_1050", "T_950", "T_850", "T_750", "T_650", "T_550", "T_150", "T_50"]

# Kalınlık değişim hesaplama fonksiyonları
def calculate_thickness_sokolov(temp_profile, time_intervals, R):
    thickness = np.zeros(len(temp_profile))
    for t_idx in range(1, len(time_intervals)):
        dt = time_intervals.iloc[t_idx] - time_intervals.iloc[t_idx - 1]
        for z_idx, T in enumerate(temp_profile):
            if T <= 0:
                continue
            if T <= 1798:
                A = 2.252e-6
                B = 1.502e5
            elif T <= 1900:
                A = 3.371e-6
                B = 5.691e5
            else:
                A = 8.682-3
                B = 2.572e5
            K2 = A * np.exp(-B / (R * T))
            thickness[z_idx] = np.sqrt(thickness[z_idx]**2 + K2 * dt)
    return thickness

def calculate_thickness_experimental(temp_profile, time_intervals, R):
    thickness = np.zeros(len(temp_profile))
    for t_idx in range(1, len(time_intervals)):
        dt = time_intervals.iloc[t_idx] - time_intervals.iloc[t_idx - 1]
        for z_idx, T in enumerate(temp_profile):
            if T <= 0:
                continue
            if T <= 1773:
                A = 5.19e-7
                B = 1.2766e5
            else:
                A = 17.72e-7
                B = 1.2205e5
            K2 = A * np.exp(-B / (R * T))
            thickness[z_idx] = np.sqrt(thickness[z_idx]**2 + K2 * dt)
    return thickness

# Örnek veri ve parametrelerle hesaplama
z_heights = [1350, 950, 550] 
time_intervals = pd.Series([0, 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500, 6000, 6500, 7000, 7500, 8000, 8500])

results_sokolov = {}
results_experimental = {}

for time in [2000, 5000, 7200]:
    # Örnek sıcaklık profili (kullanıcıdan ya da temperature_data'dan alınmalı)
    temp_profile = np.random.uniform(900, 1800, len(z_heights))  # Örnek değerler

    results_sokolov[time] = calculate_thickness_sokolov(temp_profile, time_intervals, R)
    results_experimental[time] = calculate_thickness_experimental(temp_profile, time_intervals, R)

# Grafik çizimi
plt.figure(figsize=(10, 6))
for time, thickness in results_sokolov.items():
    plt.plot(z_heights, thickness, label=f'Sokolov Time = {time}s')
for time, thickness in results_experimental.items():
    plt.plot(z_heights, thickness, '--', label=f'Experimental Time = {time}s')

plt.xlabel('Height (mm)')
plt.ylabel('Thickness (mm)')
plt.title('Thickness Change vs Height at Different Times')
plt.legend()
plt.show()
Editor is loading...
Leave a Comment