fork download
  1. import math
  2.  
  3. # Given constants
  4. D0 = 7.85e-5 # m^2/s
  5. Q_d = 3.63 # eV/atom
  6. R = 8.314 # J/(mol·K)
  7. eV_to_J = 1.602e-19 # Conversion factor: 1 eV = 1.602e-19 J
  8. Q_d_J = Q_d * eV_to_J # Convert activation energy to Joules
  9. T1 = 1175 + 273 # Temperature in Kelvin for 1175°C
  10. T2 = 925 + 273 # Temperature in Kelvin for 925°C
  11. delta_x = 2.35e-6 # Depth in meters (2.35 μm)
  12. t1_hours = 2 # Time at T1 in hours
  13. t1_seconds = t1_hours * 3600 # Convert hours to seconds
  14.  
  15. # Function to calculate diffusion coefficient
  16. def diffusion_coefficient(D0, Q_d, R, T):
  17. return D0 * math.exp(-Q_d / (R * T))
  18.  
  19. # Calculate D1 at T1
  20. D1 = diffusion_coefficient(D0, Q_d_J, R, T1)
  21.  
  22. # Calculate D2 at T2
  23. D2 = diffusion_coefficient(D0, Q_d_J, R, T2)
  24.  
  25. # Calculate t2 at T2 using the diffusion depth formula: delta_x = sqrt(2 * D * t)
  26. # Rearrange to solve for t: t = (delta_x^2) / (2 * D)
  27. t2_seconds = (delta_x**2) / (2 * D2)
  28. t2_hours = t2_seconds / 3600 # Convert seconds to hours
  29.  
  30. D1, D2, t2_hours
Success #stdin #stdout 0.04s 9876KB
stdin
Standard input is empty
stdout
Standard output is empty