1 #ifndef PSIM_MATERIAL_H
2 #define PSIM_MATERIAL_H
19 using Array = std::array<double, NUM_FREQ_BINS>;
26 full_simulation_ =
true;
29 [[nodiscard]] std::size_t
id() const noexcept {
40 [[nodiscard]]
static std::pair<std::size_t, Polar>
freqIndex(
const Table& dist) noexcept;
45 [[nodiscard]]
double getFreq(std::size_t index)
const noexcept;
46 [[nodiscard]]
double getVel(std::size_t index,
Polar polar)
const noexcept;
48 return baseData(temp).first;
51 return baseData(temp).second;
54 return emitData(temp).first;
58 return emitData(temp).second;
61 return scatterData(temp).first;
65 return scatterData(temp).second;
68 [[nodiscard]]
double theoreticalEnergy(
double temp,
bool pseudo =
false) const noexcept;
69 void initializeTables(
double low_temp,
double high_temp,
float temp_interval);
83 bool full_simulation_{
false };
85 Array frequencies_{ 0. };
86 Array densities_la_{ 0. };
87 Array densities_ta_{ 0. };
88 Array velocities_la_{ 0. };
89 Array velocities_ta_{ 0. };
91 std::vector<double> temps_;
92 std::vector<TableData> base_tables_;
93 std::vector<TableData> emit_tables_;
94 std::vector<TableData> scatter_tables_;
96 [[nodiscard]]
static double getK(
double freq, std::array<double, 3> coeffs);
97 [[nodiscard]]
static double getGv(
double freq, std::array<double, 3> coeffs);
99 [[nodiscard]] std::pair<const Table*, double> baseData(
double temp)
const;
100 [[nodiscard]] std::pair<const Table*, double> emitData(
double temp)
const;
101 [[nodiscard]] std::pair<const Table*, double> scatterData(
double temp)
const;
103 [[nodiscard]] std::pair<Table, double> cumulDistEmit(
Array&& la_dist,
Array&& ta_dist)
const;
104 [[nodiscard]] std::pair<Table, double> cumulDistScatter(
Array&& la_dist,
Array&& ta_dist,
double temp)
const;
105 [[nodiscard]]
static Table buildCumulDist(
const Array& t1,
const Array& t2);
106 [[nodiscard]]
Array phononDist(
double temp,
Polar polarization)
const;
108 [[nodiscard]]
double tauNInv(
double temp,
double freq,
Polar polarization)
const noexcept;
109 [[nodiscard]]
double tauUInv(
double temp,
double freq,
Polar polarization)
const noexcept;
110 [[nodiscard]]
double tauIInv(
double freq)
const noexcept;
112 static void verifyInput(
double low_temp,
double high_temp,
float interval_size);
113 [[nodiscard]] std::size_t getTempIndex(
double temp)
const noexcept;
145 :
table{ std::move(mat_table) }
Definition: material.h:15
double max_freq_la() const noexcept
Definition: material.h:32
Material(std::size_t mat_id, const DispersionData &disp_data, const RelaxationData &relax_data)
Definition: material.cpp:20
double scatterEnergy(double temp) const
Definition: material.h:64
double baseEnergy(double temp) const
Definition: material.h:50
double getVel(std::size_t index, Polar polar) const noexcept
Definition: material.cpp:82
std::array< double, NUM_FREQ_BINS > Array
Definition: material.h:19
static std::pair< std::size_t, Polar > freqIndex(const Table &dist) noexcept
Definition: material.cpp:64
void initializeTables(double low_temp, double high_temp, float temp_interval)
Definition: material.cpp:101
double theoreticalEnergy(double temp, bool pseudo=false) const noexcept
Definition: material.cpp:97
double max_freq_ta() const noexcept
Definition: material.h:35
const Table * scatterTable(double temp) const
Definition: material.h:60
const Array & getFrequencies() const noexcept
Definition: material.h:42
const Table * emitTable(double temp) const
Definition: material.h:53
const Table * baseTable(double temp) const
Definition: material.h:47
std::size_t id() const noexcept
Definition: material.h:29
static constexpr std::size_t NUM_FREQ_BINS
Definition: material.h:17
double getFreq(std::size_t index) const noexcept
Definition: material.cpp:77
void setFullSimulation() noexcept
Definition: material.h:25
std::array< std::pair< double, double >, NUM_FREQ_BINS > Table
Definition: material.h:20
double emitEnergy(double temp) const
Definition: material.h:57
Phonon::RelaxRates relaxRates(double temp, double freq, Polar polarization) const noexcept
Definition: material.cpp:54
Polarization
Definition: phonon.h:19
std::array< double, NUM_RELAX_RATES > RelaxRates
Definition: phonon.h:21
Material::Array Array
Definition: material.cpp:16
Material::Table Table
Definition: material.cpp:17
Definition: material.h:126
std::array< double, 3 > TA_data
Definition: material.h:132
double w_max_ta
Definition: material.h:140
std::array< double, 3 > LA_data
Definition: material.h:127
double w_max_la
Definition: material.h:139
Definition: material.h:117
double b_l
Definition: material.h:118
double b_tu
Definition: material.h:120
double b_i
Definition: material.h:121
double b_tn
Definition: material.h:119
double w
Definition: material.h:122
Definition: material.h:143
std::array< std::pair< double, double >, Material::NUM_FREQ_BINS > table
Definition: material.h:149
TableData(Material::Table mat_table, double cumulative_sum)
Definition: material.h:144
double cumul_sum
Definition: material.h:150