1import numpy as np 2 3temps = [0.000000, 100.000000, 200.000000, 300.000000, 400.000000, 500.000000, 4 600.000000, 700.000000, 800.000000, 900.000000] 5fes = [4.856522, 3.916257, -0.275662, -6.808753, -14.961276, 6 -24.341220, -34.707527, -45.897738, -57.795132, -70.311860] 7entropies = [0.000000, 26.327525, 55.256537, 74.268068, 88.155267, 8 99.052543, 108.007856, 115.604464, 122.198503, 128.022838] 9cvs = [0.000000, 36.207244, 45.673361, 47.838756, 48.634184, 49.009290, 10 49.214930, 49.339570, 49.420727, 49.476488] 11 12 13def test_thermal_properties(ph_nacl): 14 ph_nacl.run_mesh([5, 5, 5]) 15 ph_nacl.run_thermal_properties(t_step=100, t_max=900, 16 cutoff_frequency=1e-5) 17 _test_thermal_properties(ph_nacl) 18 19 20def test_thermal_properties_at_temperatues(ph_nacl): 21 ph_nacl.run_mesh([5, 5, 5]) 22 temperatures = [0, 100, 200, 300, 400, 500, 600, 700, 800, 900] 23 ph_nacl.run_thermal_properties(temperatures=temperatures, 24 cutoff_frequency=1e-5) 25 _test_thermal_properties(ph_nacl) 26 27 28def _test_thermal_properties(ph): 29 tp = ph.thermal_properties 30 31 # for vals in tp.thermal_properties: 32 # print(", ".join(["%.6f" % v for v in vals])) 33 34 for i in range(2): 35 if i == 1: 36 tp.run(lang='py') 37 for vals_ref, vals in zip( 38 (temps, fes, entropies, cvs), tp.thermal_properties): 39 np.testing.assert_allclose(vals_ref, vals, atol=1e-5) 40