part 1

作者: 痞子_4ae7 | 来源:发表于2019-03-17 10:49 被阅读0次
    import math
    
    
    def get_r(x, t, xso2):
        R = 1.987
        Keff = 0
    
        if 693.15 <= t < 748.15:
            Keff = 7.6915 * (10 ** 18) * math.exp(-76062 / (R * t))
        if 748.15 <= t <= 873.15:
            Keff = 1.5128 * (10 ** 7) * math.exp(-35992 / (R * t))
    
        K = 2.3 * (10 ** (-8)) * math.exp(27200 / (R * t))
        Kp = 2.26203 * (10 ** (-5)) * math.exp(11295.3 / t)
    
        Pso2 = (xso2 - xso2 * x) / (1 - xso2 * x / 2)
        Pso3 = (xso2 * x) / (1 - xso2 * x / 2)
        Po2 = (0.17 - xso2 - xso2 * x / 2) / (1 - xso2 * x / 2)
    
        r1 = Po2 * Pso2 / Pso3
        r2 = Pso3 / (Pso2 * math.sqrt(Po2) * Kp)
        B = 48148 * math.exp(-7355.5 / t)
    
        r3 = math.sqrt(B + (B - 1) * (1 - x) / x) + math.sqrt(K * (1 - x) / x)
    
        r = Keff * K * r1 * (1 - r2 * r2) / (r3 * r3)
    
        return r
    
    
    def calc_x(t, r0):
        xso2 = 0.08
        h = 0.00001
    
        x = 0.01
        x = x + h
        y = math.fabs((10 ** 5) * get_r(x, t, xso2) - (10 ** 5) * r0)
    
        while y > 0.0001:
            x = x + h
            if x >= 1:
                break
            y = math.fabs((10 ** 5) * get_r(x, t, xso2) - (10 ** 5) * r0)
        return x
    
    
    def write_2_file():
        r0 = 0
    
        for i in range(5):
            with open('data1-%s.csv' % (i + 1), 'w') as f:
                f.write('R = %.2e\n' % r0)
    
                for t in range(693, 874, 5):
                    t2 = t + 0.15
                    if calc_x(t2, r0) < 1:
                        f.write('%5.2f\t%5.4f\n' % (t2, calc_x(t2, r0)))
            r0 = r0 + (10 ** (-6))
    
    
    def main():
        write_2_file()
    
    
    if __name__ == '__main__':
        main()
    

    =============================
    运行结果:
    =============================

    R = 0.00e+00
    693.15  0.9838
    698.15  0.9820
    703.15  0.9799
    708.15  0.9776
    713.15  0.9751
    718.15  0.9724
    723.15  0.9694
    728.15  0.9661
    733.15  0.9625
    738.15  0.9586
    743.15  0.9544
    748.15  0.9499
    753.15  0.9450
    758.15  0.9397
    763.15  0.9340
    768.15  0.9280
    773.15  0.9216
    778.15  0.9147
    783.15  0.9074
    788.15  0.8997
    793.15  0.8915
    798.15  0.8829
    803.15  0.8738
    808.15  0.8643
    813.15  0.8543
    818.15  0.8438
    823.15  0.8330
    828.15  0.8217
    833.15  0.8100
    838.15  0.7978
    843.15  0.7853
    848.15  0.7724
    853.15  0.7592
    858.15  0.7456
    863.15  0.7317
    868.15  0.7176
    873.15  0.7032
    
    R = 1.00e-06
    703.15  0.0197
    708.15  0.2789
    713.15  0.4804
    718.15  0.6246
    723.15  0.7243
    728.15  0.7922
    733.15  0.8380
    738.15  0.8684
    743.15  0.8880
    748.15  0.9000
    753.15  0.8969
    758.15  0.8932
    763.15  0.8890
    768.15  0.8841
    773.15  0.8788
    778.15  0.8729
    783.15  0.8665
    788.15  0.8597
    793.15  0.8523
    798.15  0.8444
    803.15  0.8360
    808.15  0.8272
    813.15  0.8178
    818.15  0.8080
    823.15  0.7978
    828.15  0.7871
    833.15  0.7760
    838.15  0.7644
    843.15  0.7525
    848.15  0.7402
    853.15  0.7276
    858.15  0.7146
    863.15  0.7013
    868.15  0.6877
    873.15  0.6738
    
    R = 2.00e-06
    718.15  0.1880
    723.15  0.3892
    728.15  0.5395
    733.15  0.6490
    738.15  0.7278
    743.15  0.7838
    748.15  0.8231
    753.15  0.8244
    758.15  0.8245
    763.15  0.8237
    768.15  0.8219
    773.15  0.8193
    778.15  0.8159
    783.15  0.8118
    788.15  0.8070
    793.15  0.8014
    798.15  0.7953
    803.15  0.7885
    808.15  0.7811
    813.15  0.7731
    818.15  0.7646
    823.15  0.7556
    828.15  0.7460
    833.15  0.7360
    838.15  0.7255
    843.15  0.7146
    848.15  0.7032
    853.15  0.6914
    858.15  0.6793
    863.15  0.6669
    868.15  0.6541
    873.15  0.6411
    
    R = 3.00e-06
    723.15  0.0809
    728.15  0.2924
    733.15  0.4553
    738.15  0.5774
    743.15  0.6679
    748.15  0.7343
    753.15  0.7405
    758.15  0.7450
    763.15  0.7481
    768.15  0.7498
    773.15  0.7503
    778.15  0.7498
    783.15  0.7482
    788.15  0.7458
    793.15  0.7426
    798.15  0.7385
    803.15  0.7337
    808.15  0.7281
    813.15  0.7219
    818.15  0.7150
    823.15  0.7075
    828.15  0.6994
    833.15  0.6908
    838.15  0.6816
    843.15  0.6719
    848.15  0.6618
    853.15  0.6512
    858.15  0.6402
    863.15  0.6288
    868.15  0.6170
    873.15  0.6050
    
    R = 4.00e-06
    728.15  0.0656
    733.15  0.2705
    738.15  0.4298
    743.15  0.5510
    748.15  0.6424
    753.15  0.6536
    758.15  0.6624
    763.15  0.6692
    768.15  0.6743
    773.15  0.6778
    778.15  0.6800
    783.15  0.6810
    788.15  0.6809
    793.15  0.6798
    798.15  0.6777
    803.15  0.6748
    808.15  0.6711
    813.15  0.6666
    818.15  0.6613
    823.15  0.6554
    828.15  0.6488
    833.15  0.6416
    838.15  0.6339
    843.15  0.6255
    848.15  0.6167
    853.15  0.6073
    858.15  0.5975
    863.15  0.5873
    868.15  0.5767
    873.15  0.5658
    
    🧐

    相关文章

      网友评论

          本文标题:part 1

          本文链接:https://www.haomeiwen.com/subject/jlwymqtx.html