psim  1.0
Generalized 2D phonon transport using a Monte Carlo method
modelSimulator.h
Go to the documentation of this file.
1 #ifndef PSIM_MODELSIMULATOR_H
2 #define PSIM_MODELSIMULATOR_H
3 
4 #include "phononBuilder.h"
5 #include <array>// for array
6 #include <cstddef>// for size_t
7 #include <optional>// for optional
8 #include <variant>// for variant
9 #include <vector>// for vector
10 
11 class Cell;
12 class CellOriginBuilder;
13 class PhasorBuilder;
14 class Phonon;
16 
18 public:
19  using BuilderObj = std::variant<CellOriginBuilder, SurfaceOriginBuilder, PhasorBuilder>;
20  ModelSimulator(std::size_t measurement_steps, double simulation_time, bool phasor_sim);
21 
22  void runSimulation(double t_eq);
23  void initPhononBuilders(std::vector<Cell>& cells, double t_eq, double eff_energy) noexcept;
24  [[nodiscard]] std::optional<double> nextImpact(Phonon& p, double time) const noexcept;// NOLINT
25  void reset() noexcept {
26  total_phonons_ = 0;
27  phonon_builders_.clear();
28  }
29  void setStepAdjustment(std::size_t step_adjustment) {
30  step_adjustment_ = step_adjustment;
31  }
32 
33 private:
34  std::vector<BuilderObj> phonon_builders_;
35  std::vector<double> step_times_;
36  double step_time_;
37  bool phasor_sim_;
38  std::size_t step_adjustment_{ 0 };
39  std::size_t total_phonons_{ 0 };
40 
41  void runPhononByPhonon(double t_eq);
42  void runUsingBuilders(double t_eq);
43  static void scatter(Phonon& p, const std::array<double, 3>& relax_rates) noexcept;// NOLINT
44  void simulatePhonon(Phonon&& p, std::size_t measurement_steps) const;// NOLINT
45  std::optional<double> handleImpacts(Phonon& p, double drift_time, std::size_t sensor_id) const;// NOLINT
46 };
47 
48 #endif// PSIM_MODELSIMULATOR_H
Definition: phononBuilder.h:38
Definition: cell.h:19
Definition: modelSimulator.h:17
std::optional< double > nextImpact(Phonon &p, double time) const noexcept
Definition: modelSimulator.cpp:100
void setStepAdjustment(std::size_t step_adjustment)
Definition: modelSimulator.h:29
ModelSimulator(std::size_t measurement_steps, double simulation_time, bool phasor_sim)
Definition: modelSimulator.cpp:42
void runSimulation(double t_eq)
Definition: modelSimulator.cpp:52
std::variant< CellOriginBuilder, SurfaceOriginBuilder, PhasorBuilder > BuilderObj
Definition: modelSimulator.h:19
void reset() noexcept
Definition: modelSimulator.h:25
void initPhononBuilders(std::vector< Cell > &cells, double t_eq, double eff_energy) noexcept
Definition: modelSimulator.cpp:56
Definition: phononBuilder.h:69
Definition: phonon.h:16
Definition: phononBuilder.h:53