psim  1.0
Generalized 2D phonon transport using a Monte Carlo method
surface.h
Go to the documentation of this file.
1 #ifndef PSIM_SURFACE_H
2 #define PSIM_SURFACE_H
3 
4 #include "geometry.h"
5 #include "material.h"
6 
7 class Phonon;
8 class Cell;
9 
10 // Intentional design choice to avoid virtual functions due to 'requiring' dummy variables and dummy functions.
11 // This will greatly hinder the ability to integrate new surface types, but I don't see there being any need
12 // for additional surface types.
13 // TODO - Inherit from Geometry::Line
14 class Surface {
15 public:
19 
20  Surface(Line surface_line, Cell& cell, double specularity, int norm_sign);
21  virtual ~Surface() = default;
22  Surface(const Surface&) = default;
23  Surface(Surface&&) noexcept = default;
24  Surface& operator=(const Surface&) = delete;
25  Surface& operator=(Surface&&) = delete;
26 
27  void boundaryHandlePhonon(Phonon& p) const noexcept;// NOLINT
28  void redirectPhonon(Phonon& p) const noexcept;// NOLINT
29 
30  [[nodiscard]] const Line& getSurfaceLine() const noexcept {
31  return surface_line_;
32  }
33  [[nodiscard]] bool contains(const Point& point) const noexcept {
34  return surface_line_.contains(point);
35  }
36  [[nodiscard]] Point getRandPoint(double r1) const noexcept {
37  return surface_line_.getRandPoint(r1);
38  }// NOLINT
39  [[nodiscard]] double getLength() const noexcept {
40  return surface_line_.length;
41  }
42  [[nodiscard]] double getSpecularity() const noexcept {
43  return specularity_;
44  }
45 
46  [[nodiscard]] Vector2D getNormal() const noexcept {
47  return normal_;
48  }
49  void setNormal(Vector2D normal) noexcept {
50  normal_ = normal;
51  }
52 
53  bool operator==(const Surface& rhs) const {
54  return (surface_line_ == rhs.surface_line_);
55  }
56  bool operator>(const Surface& rhs) const {
57  return surface_line_ > rhs.surface_line_;
58  }
59 
60 private:
61  const Line surface_line_;
62 
63 protected:
66  const double specularity_;
67 };
68 
69 // While an emitting surface is not emitting phonons (transient case) it acts as a boundary surface
70 class EmitSurface : public Surface {
71 public:
72  EmitSurface(Line surface_line,
73  Cell& cell,
74  double specularity,
75  int norm_sign,
76  const Material& mat,
77  double temp,
78  double duration,
79  double start_time);
80  void handlePhonon(Phonon& p, double step_time) const noexcept;// NOLINT
81  [[nodiscard]] double getEmitDuration() const noexcept {
82  return duration_;
83  }
84  [[nodiscard]] double getTemp() const noexcept {
85  return temp_;
86  }
87  [[nodiscard]] const Material::Table& getTable() const noexcept {
88  return *emit_table_;
89  }
90  [[nodiscard]] double getPhononTime() const noexcept;
91  void updateTable() {
93  }
94 
95 protected:
97  double temp_;
98  const Material::Table* emit_table_{ nullptr };
99  double duration_;
100  double start_time_;
101 };
102 
103 // Can act as a boundary surface during material interface interactions
104 class TransitionSurface : public Surface {
105 public:
106  using Surface::Surface;
107  void handlePhonon(Phonon& p) const noexcept;// NOLINT
108 };
109 
110 #endif// PSIM_SURFACE_H
Geometry::Point Point
Definition: cell.cpp:18
Geometry::Line Line
Definition: cell.cpp:17
Definition: cell.h:19
Definition: surface.h:70
double getTemp() const noexcept
Definition: surface.h:84
const Material & material_
Definition: surface.h:96
void handlePhonon(Phonon &p, double step_time) const noexcept
Definition: surface.cpp:62
const Material::Table & getTable() const noexcept
Definition: surface.h:87
double getEmitDuration() const noexcept
Definition: surface.h:81
double duration_
Definition: surface.h:99
double temp_
Definition: surface.h:97
EmitSurface(Line surface_line, Cell &cell, double specularity, int norm_sign, const Material &mat, double temp, double duration, double start_time)
Definition: surface.cpp:47
double getPhononTime() const noexcept
Definition: surface.cpp:68
double start_time_
Definition: surface.h:100
const Material::Table * emit_table_
Definition: surface.h:98
void updateTable()
Definition: surface.h:91
Definition: material.h:15
const Table * emitTable(double temp) const
Definition: material.h:53
std::array< std::pair< double, double >, NUM_FREQ_BINS > Table
Definition: material.h:20
Definition: phonon.h:16
Definition: surface.h:14
bool contains(const Point &point) const noexcept
Definition: surface.h:33
Vector2D getNormal() const noexcept
Definition: surface.h:46
double getSpecularity() const noexcept
Definition: surface.h:42
bool operator==(const Surface &rhs) const
Definition: surface.h:53
Surface(Surface &&) noexcept=default
void setNormal(Vector2D normal) noexcept
Definition: surface.h:49
double getLength() const noexcept
Definition: surface.h:39
bool operator>(const Surface &rhs) const
Definition: surface.h:56
Cell & cell_
Definition: surface.h:64
Point getRandPoint(double r1) const noexcept
Definition: surface.h:36
Vector2D normal_
Definition: surface.h:65
Surface(const Surface &)=default
const Line & getSurfaceLine() const noexcept
Definition: surface.h:30
const double specularity_
Definition: surface.h:66
void boundaryHandlePhonon(Phonon &p) const noexcept
Definition: surface.cpp:35
virtual ~Surface()=default
void redirectPhonon(Phonon &p) const noexcept
Definition: surface.cpp:27
Surface(Line surface_line, Cell &cell, double specularity, int norm_sign)
Definition: surface.cpp:15
Definition: surface.h:104
void handlePhonon(Phonon &p) const noexcept
Definition: surface.cpp:72
Geometry::Vector2D Vector2D
Definition: geometry.cpp:9
Definition: geometry.h:39
Point getRandPoint(double r1) const noexcept
Definition: geometry.cpp:142
bool contains(const Line &other) const noexcept
Definition: geometry.cpp:77
double length
Definition: geometry.h:48
Definition: geometry.h:23
Definition: geometry.h:14