psim  1.0
Generalized 2D phonon transport using a Monte Carlo method
Model Class Reference

#include <model.h>

Public Types

using Point = Geometry::Point
 
using SimulationType = Sensor::SimulationType
 

Public Member Functions

 Model (std::size_t num_cells, std::size_t num_sensors, std::size_t measurement_steps, std::size_t num_phonons, double simulation_time, double t_eq, bool phasor_sim=false)
 
void setSimulationType (SimulationType type, std::size_t step_interval=0)
 
void addMaterial (const std::string &material_name, const Material &material)
 
void addSensor (std::size_t ID, const std::string &material_name, double t_init, Sensor::SimulationType type)
 
void addCell (Geometry::Triangle &&triangle, std::size_t sensor_ID, double spec=1.)
 
void addCell (Point &&p1, Point &&p2, std::size_t sensor_ID, double spec=1.)
 
bool setEmitSurface (const Point &p1, const Point &p2, double temp, double duration, double start_time)
 
void runSimulation ()
 
void exportResults (const fs::path &filepath, double time) const
 

Detailed Description

The Model class primarily controls the geometrical aspects of the simulation. Materials must be added first with the addMaterials function. Then the sensors must be added as each sensor is linked to a material. Then the cells can be added as they are linked to sensors. If a cell contains emitting surfaces, they must be added immediately after the cell is added. The class will throw if components are not added in this sequence.

Member Typedef Documentation

◆ Point

◆ SimulationType

Constructor & Destructor Documentation

◆ Model()

Model::Model ( std::size_t  num_cells,
std::size_t  num_sensors,
std::size_t  measurement_steps,
std::size_t  num_phonons,
double  simulation_time,
double  t_eq,
bool  phasor_sim = false 
)
Parameters
num_cells- The number of cells that the model will contain.
num_sensors- The number of sensors should be <= num_cells
measurement_steps- The total number of measurement steps (temp/flux recordings)
num_phonons- The total number of phonons to simulate. More phonons gives more precision but increases simulation time.
simulation_time- The duration of the simulation
t_eq- The linearization (equilibrium) temperature of the system - 0 indicates a full simulation
phasor_sim- True -> phonons have uniform direction & velocity & no scattering

Member Function Documentation

◆ addCell() [1/2]

void Model::addCell ( Geometry::Triangle &&  triangle,
std::size_t  sensor_ID,
double  spec = 1. 
)

Adds a triangular cell to the system. Ensures new cells are not contained in existing cells and existing cells do not contain the new cell. Also verifies that the new cell does not intersect any existing cells. Will throw if any of these occur.

Parameters
triangle- The underlying shape of the cell
sensor_ID- The sensor this cell is linked to -> will throw if the sensor does not exist
spec- The specularity of the cell's boundary surfaces [0-1]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addCell() [2/2]

void Model::addCell ( Point &&  p1,
Point &&  p2,
std::size_t  sensor_ID,
double  spec = 1. 
)

This not not used as the python interface takes care of this

Adds a rectangular cell to the system. This will count as 2 cells as the surface is broken down into two right angled triangles.

Parameters
p1- The lower left point of the rectangle
p2- The upper right point of the rectangle
sensor_ID- The sensor this cell is linked to -> will throw if the sensor does not exist
spec- The specularity of the cell's boundary surfaces [0-1]
Here is the call graph for this function:

◆ addMaterial()

void Model::addMaterial ( const std::string &  material_name,
const Material material 
)

Adds a Material object to the model. A Material is linked to sensor objects which it turn specifies how the cells attached to those sensors should act.

Parameters
material_name- A string representing the name of the material
material- An object that specifies the properties of the material

◆ addSensor()

void Model::addSensor ( std::size_t  ID,
const std::string &  material_name,
double  t_init,
Sensor::SimulationType  type 
)

Adds a Sensor object to the model. Each sensor is linked to a number of cells so that not every cell must independently track its own temperature and flux values in addition to scattering considerations.

Parameters
ID- The ID of the sensor, each sensor needs a unique ID. Throws if the ID already exists in the model
material_name- The name of the material this sensor is linked to. Throws if the material does not exist
t_init- The initial temperature of the cells linked to the sensor
type- The type of simulation - steady-state periodic or transient
Here is the caller graph for this function:

◆ exportResults()

void Model::exportResults ( const fs::path &  filepath,
double  time 
) const
Here is the call graph for this function:

◆ runSimulation()

void Model::runSimulation ( )
Here is the call graph for this function:

◆ setEmitSurface()

bool Model::setEmitSurface ( const Point p1,
const Point p2,
double  temp,
double  duration,
double  start_time 
)

Tries to set the line given by p1 and p2 to an emitting surface. A transient surface is set if a start time and duration are specified. Otherwise, the surface emits from phonons from time 0 until the end of the simulation - non transient cases. If a transient surface is specified, the simulation type must be transient.

Throws if the input line overlaps with an existing transition or existing emitting surface or if start_times < 0 or >= simulation_time_ and if duration is < 0 or >= simulation_time_-start_time. Also throws if a transient surface is specified but the simulation type is not transient.

Parameters
p1- point 1 of a line segment
p2- point 2 of a line segment
temp- The temperature of the emitting surface
duration- The duration of time the transient surface will emit phonons
start_time- The amount of time into the simulation at which this surface starts emitting phonons
Returns
- True if the surface is successfully added and false if the incoming line segment cannot be turned cannot be found in the existing system.
Here is the caller graph for this function:

◆ setSimulationType()

void Model::setSimulationType ( SimulationType  type,
std::size_t  step_interval = 0 
)
Parameters
type- The type of simulation. Default is steady state.
step_interval- For periodic and transient simulations only. The distance between steps for which measurements are recorded. Throws if the step interval is not valid for the given simulation type. This throw can be handled but an error here likely indicates the user is not performing the simulation they think they are.
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: