freepaths 2.3.0__tar.gz → 2.3.1__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.
Files changed (40) hide show
  1. {freepaths-2.3.0 → freepaths-2.3.1}/PKG-INFO +1 -1
  2. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/__main__.py +1 -1
  3. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/main_tracing.py +1 -1
  4. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/output_info.py +40 -25
  5. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths.egg-info/PKG-INFO +1 -1
  6. {freepaths-2.3.0 → freepaths-2.3.1}/README.md +0 -0
  7. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/animation.py +0 -0
  8. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/config.py +0 -0
  9. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/data.py +0 -0
  10. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/default_config.py +0 -0
  11. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/electron.py +0 -0
  12. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/flight.py +0 -0
  13. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/interface_smmm.py +0 -0
  14. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/main_mfp_sampling.py +0 -0
  15. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/maps.py +0 -0
  16. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/materials.py +0 -0
  17. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/move.py +0 -0
  18. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/output_plots.py +0 -0
  19. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/output_structure.py +0 -0
  20. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/particle.py +0 -0
  21. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/particle_types.py +0 -0
  22. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/phonon.py +0 -0
  23. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/post_computations.py +0 -0
  24. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/progress.py +0 -0
  25. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/run_particle.py +0 -0
  26. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/scatterers.py +0 -0
  27. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/scattering.py +0 -0
  28. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/scattering_interfaces.py +0 -0
  29. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/scattering_primitives.py +0 -0
  30. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/scattering_semicircle.py +0 -0
  31. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/scattering_types.py +0 -0
  32. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths/sources.py +0 -0
  33. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths.egg-info/SOURCES.txt +0 -0
  34. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths.egg-info/dependency_links.txt +0 -0
  35. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths.egg-info/entry_points.txt +0 -0
  36. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths.egg-info/requires.txt +0 -0
  37. {freepaths-2.3.0 → freepaths-2.3.1}/freepaths.egg-info/top_level.txt +0 -0
  38. {freepaths-2.3.0 → freepaths-2.3.1}/pyproject.toml +0 -0
  39. {freepaths-2.3.0 → freepaths-2.3.1}/setup.cfg +0 -0
  40. {freepaths-2.3.0 → freepaths-2.3.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: freepaths
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: Phonon Monte Carlo simulator
5
5
  Home-page: https://github.com/anufrievroman/freepaths
6
6
  Author: Roman Anufriev
@@ -7,7 +7,7 @@ from colorama import Fore, Style
7
7
 
8
8
  from freepaths.particle_types import ParticleType
9
9
 
10
- __version__ = "2.3.0"
10
+ __version__ = "2.3.1"
11
11
 
12
12
  colorama.init()
13
13
 
@@ -299,7 +299,7 @@ def main(input_file, particle_type):
299
299
  # Output general information:
300
300
  output_general_information(start_time)
301
301
  output_scattering_information(scatter_stats)
302
- output_parameter_warnings()
302
+ output_parameter_warnings(particle_type)
303
303
 
304
304
  sys.stdout.write(f'\rSee the results in {Fore.GREEN}Results/{cf.output_folder_name}{Style.RESET_ALL}\n')
305
305
  sys.stdout.write(f"\r{Fore.BLUE}Thank you for using FreePATHS{Style.RESET_ALL}\n\n")
@@ -39,13 +39,18 @@ def output_scattering_information(scatter_stats):
39
39
  """Calculate and output general statistics on scattering events"""
40
40
 
41
41
  # Calculate the percentage of different scattering events:
42
- total = np.sum(scatter_stats.total)
43
42
  total_wall = np.sum(scatter_stats.wall_diffuse) + np.sum(scatter_stats.wall_specular)
44
43
  total_topbot = np.sum(scatter_stats.top_diffuse) + np.sum(scatter_stats.top_specular)
45
44
  total_hole = np.sum(scatter_stats.hole_diffuse) + np.sum(scatter_stats.hole_specular)
46
45
  total_pill = np.sum(scatter_stats.pillar_diffuse) + np.sum(scatter_stats.pillar_specular)
46
+ # total_interf counts ALL interface events (both reflection and transmission),
47
+ # because scattering_types.interfaces is set for both. total_transmission is
48
+ # a subset of total_interf, so must NOT be added separately to avoid double-counting.
47
49
  total_interf = np.sum(scatter_stats.interfaces_diffuse) + np.sum(scatter_stats.interfaces_specular)
48
50
  total_transmission = np.sum(scatter_stats.interfaces_transmission_specular) + np.sum(scatter_stats.interfaces_transmission_diffuse)
51
+ total_retherm = np.sum(scatter_stats.hot_side)
52
+ total_internal = np.sum(scatter_stats.internal)
53
+ total = total_wall + total_topbot + total_hole + total_pill + total_interf + total_retherm + total_internal
49
54
 
50
55
  sc_on_walls = 100*(np.sum(scatter_stats.wall_diffuse) +
51
56
  np.sum(scatter_stats.wall_specular)) / total
@@ -62,8 +67,8 @@ def output_scattering_information(scatter_stats):
62
67
  sc_on_topbot_diff = 0
63
68
  sc_on_topbot_spec = 0
64
69
 
65
- retherm = 100*np.sum(scatter_stats.hot_side) / total
66
- internal = 100*np.sum(scatter_stats.internal) / total
70
+ retherm = 100 * total_retherm / total
71
+ internal = 100 * total_internal / total
67
72
 
68
73
  info = [
69
74
  f'\n{sc_on_walls:.2f}% - scattering on side walls ',
@@ -100,14 +105,11 @@ def output_scattering_information(scatter_stats):
100
105
  )
101
106
 
102
107
  if cf.interfaces:
103
- total_all_interf = total_interf + total_transmission
104
- sc_on_interf = 100 * total_all_interf / total
105
- sc_on_interf_diff = 100 * (np.sum(scatter_stats.interfaces_diffuse) +
106
- np.sum(scatter_stats.interfaces_transmission_diffuse)) / total_all_interf
107
- sc_on_interf_spec = 100 * (np.sum(scatter_stats.interfaces_specular) +
108
- np.sum(scatter_stats.interfaces_transmission_specular)) / total_all_interf
109
- refl_on_interf = 100 * total_interf / total_all_interf
110
- trans_on_interf = 100 * total_transmission / total_all_interf
108
+ sc_on_interf = 100 * total_interf / total
109
+ sc_on_interf_diff = 100 * np.sum(scatter_stats.interfaces_diffuse) / total_interf
110
+ sc_on_interf_spec = 100 * np.sum(scatter_stats.interfaces_specular) / total_interf
111
+ trans_on_interf = 100 * total_transmission / total_interf
112
+ refl_on_interf = 100 * (total_interf - total_transmission) / total_interf
111
113
  info.extend([
112
114
  f'\n{sc_on_interf:.2f}% - scattering on interfaces ',
113
115
  f'({sc_on_interf_diff:.2f}% - diffuse, ',
@@ -120,19 +122,37 @@ def output_scattering_information(scatter_stats):
120
122
  with open("Information.txt", "a", encoding="utf-8") as file:
121
123
  file.writelines(info)
122
124
 
125
+ # Warn if multiple scattering events co-occur in a single timestep:
126
+ total_timesteps_with_scattering = np.sum(scatter_stats.total)
127
+ if total_timesteps_with_scattering > 0:
128
+ multi_event_percentage = 100 * (total - total_timesteps_with_scattering) / total_timesteps_with_scattering
129
+ if multi_event_percentage > 5:
130
+ logging.warning(f"In {multi_event_percentage:.1f}% of scattering timesteps, more than one scattering "
131
+ f"mechanism fired simultaneously. Consider reducing TIMESTEP.")
123
132
 
124
- def output_parameter_warnings():
133
+
134
+ def output_parameter_warnings(particle_type):
125
135
  """Check if parameters used for this simulation made sense considering the simulation results"""
126
136
 
127
- # Check if some particles had longer travel times than stabilization period:
137
+ from freepaths.particle_types import ParticleType
138
+
139
+ # These checks are only relevant for phonon simulations:
140
+ if particle_type is not ParticleType.ELECTRON:
141
+ travel_times = np.loadtxt("Data/All travel times.csv", encoding='utf-8')
142
+
143
+ total_time = cf.timestep * cf.number_of_timesteps
144
+ time_of_stabilization = cf.number_of_stabilization_timeframes * total_time / cf.number_of_timeframes
145
+ long_travel_times = travel_times[travel_times > time_of_stabilization]
146
+ percentage = (len(long_travel_times) / len(travel_times)) * 100
147
+ if percentage > 10:
148
+ logging.warning(f"Travel time of {percentage}% of particles was longer than the stabilization period.\n" +
149
+ "Increase stabilization period as the thermal conductivity might be incorrect.")
150
+
151
+ # Check how many particles reached the cold side during simulation:
128
152
  travel_times = np.loadtxt("Data/All travel times.csv", encoding='utf-8')
129
- total_time = cf.timestep * cf.number_of_timesteps
130
- time_of_stabilization = cf.number_of_stabilization_timeframes * total_time / cf. number_of_timeframes
131
- long_travel_times = travel_times[travel_times > time_of_stabilization]
132
- percentage = (len(long_travel_times) / len(travel_times)) * 100
133
- if percentage > 10:
134
- logging.warning(f"Travel time of {percentage}% of particles was longer than the stabilization period.\n" +
135
- "Increase stabilization period as the thermal conductivity might be incorrect.")
153
+ percentage = int(100 * np.count_nonzero(travel_times) / cf.number_of_particles)
154
+ if percentage < 95:
155
+ logging.warning(f"Only {percentage}% of particles reached the cold side. Increase the number of timesteps.")
136
156
 
137
157
  # Check if pixel size is too small:
138
158
  speeds = np.loadtxt("Data/All group velocities.csv", encoding='utf-8')
@@ -140,8 +160,3 @@ def output_parameter_warnings():
140
160
  logging.warning("Pixels in y direction are smaller than length of one step")
141
161
  if max(speeds) * cf.timestep > cf.width / cf.number_of_pixels_x:
142
162
  logging.warning("Pixels in x direction are smaller than length of one step")
143
-
144
- # Check how many particles reached the cold side during simulation:
145
- percentage = int(100 * np.count_nonzero(travel_times) / cf.number_of_particles)
146
- if percentage < 95:
147
- logging.warning(f"Only {percentage}% of particles reached the cold side. Increase the number of timesteps.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: freepaths
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: Phonon Monte Carlo simulator
5
5
  Home-page: https://github.com/anufrievroman/freepaths
6
6
  Author: Roman Anufriev
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes