freepaths 2.2.1__tar.gz → 2.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {freepaths-2.2.1 → freepaths-2.2.4}/PKG-INFO +12 -3
- {freepaths-2.2.1 → freepaths-2.2.4}/README.md +11 -2
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/__main__.py +1 -1
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/config.py +3 -3
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/data.py +4 -22
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/default_config.py +3 -3
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/flight.py +1 -1
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/main_mfp_sampling.py +135 -137
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/main_tracing.py +294 -295
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/maps.py +7 -11
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/materials.py +16 -10
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/move.py +1 -1
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/output_plots.py +53 -28
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/output_structure.py +1 -1
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/particle.py +15 -15
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/phonon.py +1 -1
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/post_computations.py +1 -1
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/run_particle.py +6 -9
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/scatterers.py +21 -13
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/scattering_interfaces.py +5 -6
- freepaths-2.2.4/freepaths/scattering_semicircle.py +422 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/scattering_types.py +11 -11
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths.egg-info/PKG-INFO +12 -3
- freepaths-2.2.1/freepaths/scattering_semicircle.py +0 -789
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/animation.py +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/electron.py +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/interface_smmm.py +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/output_info.py +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/particle_types.py +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/progress.py +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/scattering.py +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/scattering_primitives.py +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths/sources.py +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths.egg-info/SOURCES.txt +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths.egg-info/dependency_links.txt +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths.egg-info/entry_points.txt +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths.egg-info/requires.txt +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/freepaths.egg-info/top_level.txt +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/pyproject.toml +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/setup.cfg +0 -0
- {freepaths-2.2.1 → freepaths-2.2.4}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: freepaths
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.4
|
|
4
4
|
Summary: Phonon Monte Carlo simulator
|
|
5
5
|
Home-page: https://github.com/anufrievroman/freepaths
|
|
6
6
|
Author: Roman Anufriev
|
|
@@ -34,9 +34,9 @@ Dynamic: requires-dist
|
|
|
34
34
|
Dynamic: requires-python
|
|
35
35
|
Dynamic: summary
|
|
36
36
|
|
|
37
|
-
# FreePATHS - Free Phonon And
|
|
37
|
+
# FreePATHS - Free Phonon And THermal Simulator
|
|
38
38
|
|
|
39
|
-
This Monte Carlo algorithm simulates trajectories of phonons in 3D models of nanostructures, which consists of a box with holes or
|
|
39
|
+
This Monte Carlo algorithm simulates trajectories of phonons or electrons in 3D models of nanostructures, which consists of a box with holes, pillars, or interfaces of various shapes. For phonons, the algorithm outputs heat fluxes, temperature maps and profiles, thermal conductivity, scattering maps and statistics, and other information. For electrons, it outputs electrical conductivity, Seebeck coefficient, electronic thermal conductivity, power factor, and related quantities as a function of Fermi level. See [documentation](https://anufrievroman.gitbook.io/freepaths/) for the details of the simulation.
|
|
40
40
|
|
|
41
41
|

|
|
42
42
|
|
|
@@ -73,6 +73,15 @@ See [documentation](https://anufrievroman.gitbook.io/freepaths/examples) for exp
|
|
|
73
73
|
After the simulation, see the results in a newly created **Results** folder.
|
|
74
74
|
|
|
75
75
|
|
|
76
|
+
### Electron mode
|
|
77
|
+
|
|
78
|
+
FreePATHS can also simulate electron transport. In this mode, electrons are traced through the structure and thermoelectric properties — electrical conductivity, Seebeck coefficient, electronic thermal conductivity, and power factor — are computed as a function of Fermi level. To run in electron mode, add the `-e` flag:
|
|
79
|
+
|
|
80
|
+
`freepaths -e your_input_file.py`
|
|
81
|
+
|
|
82
|
+
See the [tutorial](https://anufrievroman.gitbook.io/freepaths/basic-tutorials/electrons-in-holey-membranes) and [theory](https://anufrievroman.gitbook.io/freepaths/theory/electrical-conductivity) for details.
|
|
83
|
+
|
|
84
|
+
|
|
76
85
|
### MFP sampling mode
|
|
77
86
|
|
|
78
87
|
Alternatively, you can run FreePATHS in the mean free path sampling mode, which is designed to calculate the thermal conductivity by integrating phonon dispersion. To run the program in this mode, it is advised to reduce the number of phonons to about 30 and add `-s` flag in the command:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# FreePATHS - Free Phonon And
|
|
1
|
+
# FreePATHS - Free Phonon And THermal Simulator
|
|
2
2
|
|
|
3
|
-
This Monte Carlo algorithm simulates trajectories of phonons in 3D models of nanostructures, which consists of a box with holes or
|
|
3
|
+
This Monte Carlo algorithm simulates trajectories of phonons or electrons in 3D models of nanostructures, which consists of a box with holes, pillars, or interfaces of various shapes. For phonons, the algorithm outputs heat fluxes, temperature maps and profiles, thermal conductivity, scattering maps and statistics, and other information. For electrons, it outputs electrical conductivity, Seebeck coefficient, electronic thermal conductivity, power factor, and related quantities as a function of Fermi level. See [documentation](https://anufrievroman.gitbook.io/freepaths/) for the details of the simulation.
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
@@ -37,6 +37,15 @@ See [documentation](https://anufrievroman.gitbook.io/freepaths/examples) for exp
|
|
|
37
37
|
After the simulation, see the results in a newly created **Results** folder.
|
|
38
38
|
|
|
39
39
|
|
|
40
|
+
### Electron mode
|
|
41
|
+
|
|
42
|
+
FreePATHS can also simulate electron transport. In this mode, electrons are traced through the structure and thermoelectric properties — electrical conductivity, Seebeck coefficient, electronic thermal conductivity, and power factor — are computed as a function of Fermi level. To run in electron mode, add the `-e` flag:
|
|
43
|
+
|
|
44
|
+
`freepaths -e your_input_file.py`
|
|
45
|
+
|
|
46
|
+
See the [tutorial](https://anufrievroman.gitbook.io/freepaths/basic-tutorials/electrons-in-holey-membranes) and [theory](https://anufrievroman.gitbook.io/freepaths/theory/electrical-conductivity) for details.
|
|
47
|
+
|
|
48
|
+
|
|
40
49
|
### MFP sampling mode
|
|
41
50
|
|
|
42
51
|
Alternatively, you can run FreePATHS in the mean free path sampling mode, which is designed to calculate the thermal conductivity by integrating phonon dispersion. To run the program in this mode, it is advised to reduce the number of phonons to about 30 and add `-s` flag in the command:
|
|
@@ -160,7 +160,7 @@ class Config:
|
|
|
160
160
|
|
|
161
161
|
for source in self.particles_sources:
|
|
162
162
|
if source.y > self.length:
|
|
163
|
-
logging.error("Y coordinate of a source exceeded
|
|
163
|
+
logging.error("Y coordinate of a source exceeded LENGTH")
|
|
164
164
|
sys.exit()
|
|
165
165
|
|
|
166
166
|
if source.y < 0:
|
|
@@ -215,7 +215,7 @@ class Config:
|
|
|
215
215
|
sys.exit()
|
|
216
216
|
|
|
217
217
|
|
|
218
|
-
def
|
|
218
|
+
def check_deprecated_parameters(self):
|
|
219
219
|
"""Check for deprecated parameters and warn about them"""
|
|
220
220
|
|
|
221
221
|
if 'COLD_SIDE_POSITION' in globals():
|
|
@@ -258,5 +258,5 @@ class Config:
|
|
|
258
258
|
cf = Config()
|
|
259
259
|
cf.convert_to_enums()
|
|
260
260
|
cf.check_parameter_validity()
|
|
261
|
-
cf.
|
|
261
|
+
cf.check_deprecated_parameters()
|
|
262
262
|
|
|
@@ -96,7 +96,6 @@ class GeneralData(Data):
|
|
|
96
96
|
self.interfaces_mode.extend(flight.interfaces_mode)
|
|
97
97
|
|
|
98
98
|
|
|
99
|
-
|
|
100
99
|
def write_into_files(self):
|
|
101
100
|
import os
|
|
102
101
|
if not os.path.exists("Data"):
|
|
@@ -142,7 +141,6 @@ class GeneralData(Data):
|
|
|
142
141
|
}
|
|
143
142
|
|
|
144
143
|
|
|
145
|
-
|
|
146
144
|
class ScatteringData(Data):
|
|
147
145
|
"""Statistics of particle scattering events"""
|
|
148
146
|
|
|
@@ -163,12 +161,6 @@ class ScatteringData(Data):
|
|
|
163
161
|
self.total = np.zeros(cf.number_of_length_segments+1)
|
|
164
162
|
self.interfaces_transmission_specular= np.zeros(cf.number_of_length_segments + 1)
|
|
165
163
|
self.interfaces_transmission_diffuse = np.zeros(cf.number_of_length_segments + 1)
|
|
166
|
-
self.interfaces_angles = np.zeros(cf.number_of_length_segments + 1)
|
|
167
|
-
self.interfaces_transmission_factor = np.zeros(cf.number_of_length_segments + 1)
|
|
168
|
-
self.interfaces_wavelength = np.zeros(cf.number_of_length_segments+1)
|
|
169
|
-
self.interfaces_frequency = np.zeros(cf.number_of_length_segments+1)
|
|
170
|
-
self.interfaces_mode = np.zeros(cf.number_of_length_segments+1)
|
|
171
|
-
|
|
172
164
|
|
|
173
165
|
|
|
174
166
|
def save_scattering_events(self, y, scattering_types):
|
|
@@ -215,14 +207,10 @@ class ScatteringData(Data):
|
|
|
215
207
|
data = np.vstack((self.wall_diffuse, self.wall_specular, self.top_diffuse, self.top_specular, self.hole_diffuse,
|
|
216
208
|
self.hole_specular, self.hot_side, self.internal, self.pillar_diffuse, self.pillar_specular,
|
|
217
209
|
self.interfaces_diffuse, self.interfaces_specular,
|
|
218
|
-
self.interfaces_transmission_diffuse, self.interfaces_transmission_specular
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
header2 = "Holes diffuse, Holes specular, Hot side, Internal, Pillars diffuse, Pillars specular"
|
|
223
|
-
header3 = "Interfaces diffuse, Interfaces specular, Interfaces transmission diffuse, Interfaces transmission specular, " \
|
|
224
|
-
"Interfaces transmission factor, Interfaces angles, Interfaces wavelength, Interfaces frequency, Interfaces mode"
|
|
225
|
-
header = header1 + header2 + header3
|
|
210
|
+
self.interfaces_transmission_diffuse, self.interfaces_transmission_specular)).T
|
|
211
|
+
header = ("Sidewalls diffuse, Sidewalls specular, Top & bottom diffuse, Top & bottom specular, "
|
|
212
|
+
"Holes diffuse, Holes specular, Hot side, Internal, Pillars diffuse, Pillars specular, "
|
|
213
|
+
"Interfaces diffuse, Interfaces specular, Interfaces transmission diffuse, Interfaces transmission specular")
|
|
226
214
|
np.savetxt(filename, data, fmt='%1.3e', delimiter=",", header=header, encoding='utf-8')
|
|
227
215
|
|
|
228
216
|
def dump_data(self):
|
|
@@ -242,11 +230,6 @@ class ScatteringData(Data):
|
|
|
242
230
|
'interfaces_specular': self.interfaces_specular,
|
|
243
231
|
'interfaces_transmission_specular': self.interfaces_transmission_specular,
|
|
244
232
|
'interfaces_transmission_diffuse': self.interfaces_transmission_diffuse,
|
|
245
|
-
'interfaces_angles': self.interfaces_angles,
|
|
246
|
-
'interfaces_transmission_factor': self.interfaces_transmission_factor,
|
|
247
|
-
'interfaces_wavelength': self.interfaces_wavelength,
|
|
248
|
-
'interfaces_frequency': self.interfaces_frequency,
|
|
249
|
-
'interfaces_mode' : self.interfaces_mode,
|
|
250
233
|
'total': self.total
|
|
251
234
|
}
|
|
252
235
|
|
|
@@ -297,7 +280,6 @@ class TriangleScatteringData(Data):
|
|
|
297
280
|
}
|
|
298
281
|
|
|
299
282
|
|
|
300
|
-
|
|
301
283
|
class SegmentData(Data):
|
|
302
284
|
"""Statistics of events happening in different segments"""
|
|
303
285
|
|
|
@@ -25,11 +25,11 @@ NUMBER_OF_STABILIZATION_TIMEFRAMES = 5
|
|
|
25
25
|
|
|
26
26
|
# Electron parameters [eV]
|
|
27
27
|
IS_CARRIER_ELECTRON = True
|
|
28
|
-
ENERGY_UPPER_BOUND =
|
|
28
|
+
ENERGY_UPPER_BOUND = 6*k*T / electron_volt
|
|
29
29
|
ENERGY_LOWER_BOUND = 0
|
|
30
30
|
ENERGY_STEP = 5e-3
|
|
31
31
|
|
|
32
|
-
ELECTRON_MFP =
|
|
32
|
+
ELECTRON_MFP = 10e-9 # [m]
|
|
33
33
|
MEAN_MAPPING_CONSTANT = 5e-6 # [m²]
|
|
34
34
|
|
|
35
35
|
|
|
@@ -88,7 +88,7 @@ INTERFACE_ROUGHNESS = 0.2e-9
|
|
|
88
88
|
HOLES = []
|
|
89
89
|
PILLARS = []
|
|
90
90
|
INTERFACES = []
|
|
91
|
-
BULKS = []
|
|
91
|
+
BULKS = []
|
|
92
92
|
|
|
93
93
|
# Multiprocessing:
|
|
94
94
|
NUMBER_OF_PROCESSES = 10
|
|
@@ -1,137 +1,135 @@
|
|
|
1
|
-
"""Module to run thermal conductivity calculations by integrating the phonon dispersion"""
|
|
2
|
-
|
|
3
|
-
import os
|
|
4
|
-
import numpy as np
|
|
5
|
-
import sys
|
|
6
|
-
import time
|
|
7
|
-
import shutil
|
|
8
|
-
import scipy
|
|
9
|
-
import math
|
|
10
|
-
import logging
|
|
11
|
-
from colorama import Fore, Style
|
|
12
|
-
|
|
13
|
-
# Modules:
|
|
14
|
-
from freepaths.animation import create_animation
|
|
15
|
-
from freepaths.config import cf
|
|
16
|
-
from freepaths.run_particle import run_particle
|
|
17
|
-
from freepaths.phonon import Phonon
|
|
18
|
-
from freepaths.flight import Flight
|
|
19
|
-
from freepaths.particle_types import ParticleType
|
|
20
|
-
from freepaths.data import ScatteringData, GeneralData, SegmentData, PathData, TriangleScatteringData
|
|
21
|
-
from freepaths.progress import Progress
|
|
22
|
-
from freepaths.materials import Si, SiC, Graphite,
|
|
23
|
-
from freepaths.maps import ScatteringMap, ThermalMaps
|
|
24
|
-
from freepaths.output_info import output_general_information, output_scattering_information, output_parameter_warnings
|
|
25
|
-
from freepaths.output_plots import plot_data
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def main(input_file, particle_type):
|
|
29
|
-
"""This is the main function, which integrates phonon dispersion to get thermal conductivity"""
|
|
30
|
-
|
|
31
|
-
print(f'Mean free path sampling of {Fore.GREEN}{cf.output_folder_name}{Style.RESET_ALL}')
|
|
32
|
-
start_time = time.time()
|
|
33
|
-
progress = Progress()
|
|
34
|
-
|
|
35
|
-
# Initialize the material:
|
|
36
|
-
if cf.media == "Si":
|
|
37
|
-
material = Si(cf.temp, num_points=cf.number_of_particles +1)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
elif cf.media == "
|
|
45
|
-
material =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
thermal_maps.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
sys.stdout.write(f
|
|
136
|
-
sys.stdout.write(f"\rThermal conductivity = {Fore.GREEN}{total_thermal_conductivity:.5f}{Style.RESET_ALL} W/m·K\n")
|
|
137
|
-
sys.stdout.write(f"\r{Fore.BLUE}Thank you for using FreePATHS{Style.RESET_ALL}\n\n")
|
|
1
|
+
"""Module to run thermal conductivity calculations by integrating the phonon dispersion"""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import numpy as np
|
|
5
|
+
import sys
|
|
6
|
+
import time
|
|
7
|
+
import shutil
|
|
8
|
+
import scipy
|
|
9
|
+
import math
|
|
10
|
+
import logging
|
|
11
|
+
from colorama import Fore, Style
|
|
12
|
+
|
|
13
|
+
# Modules:
|
|
14
|
+
from freepaths.animation import create_animation
|
|
15
|
+
from freepaths.config import cf
|
|
16
|
+
from freepaths.run_particle import run_particle
|
|
17
|
+
from freepaths.phonon import Phonon
|
|
18
|
+
from freepaths.flight import Flight
|
|
19
|
+
from freepaths.particle_types import ParticleType
|
|
20
|
+
from freepaths.data import ScatteringData, GeneralData, SegmentData, PathData, TriangleScatteringData
|
|
21
|
+
from freepaths.progress import Progress
|
|
22
|
+
from freepaths.materials import Si, SiC, Graphite, SiGe
|
|
23
|
+
from freepaths.maps import ScatteringMap, ThermalMaps
|
|
24
|
+
from freepaths.output_info import output_general_information, output_scattering_information, output_parameter_warnings
|
|
25
|
+
from freepaths.output_plots import plot_data
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def main(input_file, particle_type):
|
|
29
|
+
"""This is the main function, which integrates phonon dispersion to get thermal conductivity"""
|
|
30
|
+
|
|
31
|
+
print(f'Mean free path sampling of {Fore.GREEN}{cf.output_folder_name}{Style.RESET_ALL}')
|
|
32
|
+
start_time = time.time()
|
|
33
|
+
progress = Progress()
|
|
34
|
+
|
|
35
|
+
# Initialize the material:
|
|
36
|
+
if cf.media == "Si":
|
|
37
|
+
material = Si(cf.temp, num_points=cf.number_of_particles +1)
|
|
38
|
+
|
|
39
|
+
elif cf.media == "SiGe":
|
|
40
|
+
material = SiGe(cf.temp, num_points=cf.number_of_particles +1)
|
|
41
|
+
|
|
42
|
+
elif cf.media == "SiC":
|
|
43
|
+
material = SiC(cf.temp, num_points=cf.number_of_particles+1)
|
|
44
|
+
elif cf.media == "Graphite":
|
|
45
|
+
material = Graphite(cf.temp, num_points=cf.number_of_particles+1)
|
|
46
|
+
else:
|
|
47
|
+
logging.error(f"Material {cf.media} is not supported")
|
|
48
|
+
sys.exit()
|
|
49
|
+
|
|
50
|
+
# Initiate data structures:
|
|
51
|
+
scatter_stats = ScatteringData()
|
|
52
|
+
general_stats = GeneralData()
|
|
53
|
+
segment_stats = SegmentData()
|
|
54
|
+
places_stats = TriangleScatteringData()
|
|
55
|
+
path_stats = PathData()
|
|
56
|
+
scatter_maps = ScatteringMap()
|
|
57
|
+
thermal_maps = ThermalMaps()
|
|
58
|
+
|
|
59
|
+
total_thermal_conductivity = 0.0
|
|
60
|
+
|
|
61
|
+
# For each polarization branch:
|
|
62
|
+
for branch_number in range(3):
|
|
63
|
+
sys.stdout.write(f"\rIntegrating branch number {branch_number+1}.\n")
|
|
64
|
+
|
|
65
|
+
# For each phonon:
|
|
66
|
+
for index in range(cf.number_of_particles):
|
|
67
|
+
|
|
68
|
+
# Wave vector:
|
|
69
|
+
k_vector = (material.dispersion[index+1, 0] + material.dispersion[index, 0]) / 2
|
|
70
|
+
d_k_vector = (material.dispersion[index+1, 0] - material.dispersion[index, 0])
|
|
71
|
+
|
|
72
|
+
# Initiate a phonon and its flight:
|
|
73
|
+
phonon = Phonon(material, branch_number, index)
|
|
74
|
+
flight = Flight(phonon)
|
|
75
|
+
|
|
76
|
+
# Run this phonon through the structure:
|
|
77
|
+
run_particle(phonon, flight, scatter_stats, places_stats, segment_stats, thermal_maps, scatter_maps, material)
|
|
78
|
+
|
|
79
|
+
# Heat capacity, Ref. PRB 88 155318 (2013):
|
|
80
|
+
omega = 2 * math.pi * phonon.f
|
|
81
|
+
part = scipy.constants.hbar * omega / (scipy.constants.k * cf.temp)
|
|
82
|
+
c_p = scipy.constants.k * part**2 * math.exp(part) / (math.exp(part) - 1)**2
|
|
83
|
+
|
|
84
|
+
# Thermal conductivity, Ref. Phys. Rev. 132 2461 (1963):
|
|
85
|
+
mean_relax_time = flight.mean_free_path/phonon.speed
|
|
86
|
+
flight.thermal_conductivity = (1/(6*(math.pi**2)))*c_p*(phonon.speed**2)*mean_relax_time*(k_vector**2)*d_k_vector
|
|
87
|
+
total_thermal_conductivity += flight.thermal_conductivity
|
|
88
|
+
|
|
89
|
+
# Record the properties returned for this phonon:
|
|
90
|
+
general_stats.save_particle_data(phonon)
|
|
91
|
+
general_stats.save_flight_data(flight)
|
|
92
|
+
|
|
93
|
+
# Record trajectories of the first N phonons:
|
|
94
|
+
if index < cf.output_trajectories_of_first:
|
|
95
|
+
path_stats.save_particle_path(flight)
|
|
96
|
+
|
|
97
|
+
# Run additional calculations:
|
|
98
|
+
thermal_maps.calculate_thermal_conductivity()
|
|
99
|
+
thermal_maps.calculate_weighted_flux()
|
|
100
|
+
thermal_maps.calculate_heat_flux_modulus()
|
|
101
|
+
|
|
102
|
+
# Create the folder if it does not exist and copy input file there:
|
|
103
|
+
if not os.path.exists("Results/" + cf.output_folder_name):
|
|
104
|
+
os.makedirs("Results/" + cf.output_folder_name)
|
|
105
|
+
os.makedirs("Results/" + cf.output_folder_name + '/Data')
|
|
106
|
+
if input_file:
|
|
107
|
+
shutil.copy(input_file, "Results/" + cf.output_folder_name)
|
|
108
|
+
os.chdir("Results/" + cf.output_folder_name)
|
|
109
|
+
|
|
110
|
+
# Save data into files:
|
|
111
|
+
general_stats.write_into_files()
|
|
112
|
+
scatter_stats.write_into_files()
|
|
113
|
+
segment_stats.write_into_files()
|
|
114
|
+
thermal_maps.write_into_files()
|
|
115
|
+
|
|
116
|
+
scatter_maps.write_into_files()
|
|
117
|
+
path_stats.write_into_files()
|
|
118
|
+
|
|
119
|
+
# Generate animation of phonon paths:
|
|
120
|
+
if cf.output_path_animation:
|
|
121
|
+
create_animation()
|
|
122
|
+
|
|
123
|
+
# Analyze and plot the data:
|
|
124
|
+
sys.stdout.write("\rAnalyzing the data...")
|
|
125
|
+
plot_data(particle_type, cf, mfp_sampling=True)
|
|
126
|
+
|
|
127
|
+
# Output general information:
|
|
128
|
+
output_general_information(start_time)
|
|
129
|
+
output_scattering_information(scatter_stats)
|
|
130
|
+
output_parameter_warnings()
|
|
131
|
+
|
|
132
|
+
np.savetxt("Data/Thermal conductivity from MFP.csv", np.array([total_thermal_conductivity]), fmt='%2.4e', header="K [W/mK]", encoding='utf-8')
|
|
133
|
+
sys.stdout.write(f'\rSee the results in {Fore.GREEN}Results/{cf.output_folder_name}{Style.RESET_ALL}\n')
|
|
134
|
+
sys.stdout.write(f"\rThermal conductivity = {Fore.GREEN}{total_thermal_conductivity:.5f}{Style.RESET_ALL} W/m·K\n")
|
|
135
|
+
sys.stdout.write(f"\r{Fore.BLUE}Thank you for using FreePATHS{Style.RESET_ALL}\n\n")
|