TDMS
Time Domain Maxwell Solver
All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
simulation_parameters.h
Go to the documentation of this file.
1/**
2 * @file simulation_parameters.h
3 * @brief Classes collecting parameters for the simulation.
4 */
5#pragma once
6
7#include <string>
8
9#include "arrays.h"
10#include "arrays/vector_typedefs.h"
11#include "input_matrices.h"
12
13// Stores the thickness in each axial direction of the Perfectly Matched Layer
14// (pml)
16 int Dxl = 0;//!< Thickness of lower pml in the x direction
17 int Dxu = 0;//!< Thickness of upper pml in the x direction
18 int Dyl = 0;//!< Thickness of lower pml in the y direction
19 int Dyu = 0;//!< Thickness of upper pml in the y direction
20 int Dzl = 0;//!< Thickness of lower pml in the z direction
21 int Dzu = 0;//!< Thickness of upper pml in the z direction
22};
23
24/** @brief The x,y,z lengths of the cuboidal Yee cells */
26 double dx = 0.;//!< Yee cell width in the x direction
27 double dy = 0.;//!< Yee cell width in the y direction
28 double dz = 0.;//!< Yee cell width in the z direction
29};
30
31// Tracks whether the light source is pulsed or the simulation is at steady
32// state
33enum SourceMode { steadystate, pulsed };
34
35enum RunMode { complete, analyse };
36
37/** @brief Determines whether the simulation will compute all field components,
38 * or only the TE or TM modal components */
40 THREE, //< Full dimensionality - compute all H and E components
41 TRANSVERSE_ELECTRIC,//< Transverse electric - only compute Ex, Ey, and Hz
42 // components
43 TRANSVERSE_MAGNETIC //< Transverse magnetic - only compute Hx, Hy, and Ez
44 // components
45};
46
47/**
48 * @brief A three-tuple of integers that contain the stride in each direction
49 * to extract the phasors on.
50 *
51 * On the surface, a stride of EG x = 2 means extract from every 2nd Yee cell.
52 */
54 int x = 1;
55 int y = 1;
56 int z = 1;
57};
58
59/**
60 * @brief Class storing the various constants and behaviour flags for one
61 * executation of the tdms executable.
62 *
63 * Stores physical constants like the angular frequency, and Yee cell
64 * dimensions. Stores flags like whether the material is dispersive, or whether
65 * we want to extract phasors on a predefined surface. Stores numerical method
66 * constants like number of timesteps, length of timesteps.
67 *
68 */
70
71public:
73
74 double omega_an = 0.0;//< Angular ω
75 unsigned int Nt = 0; //< Number of simulation steps
76 unsigned int Np = 0; //< Number of times to extract the phasors
77 unsigned int Npe = 0; //< Extract the phasors every this number of iterations
78 unsigned int start_tind = 0;//< Starting iteration number for the time steps
79 double dt = 0.0; //< Time step
80 bool has_tdfdir =
81 false;//< Is the tdfdir (time domain field directory) defined?
82 bool is_multilayer = false;//< Is this simulation of a multilayer?
83 bool is_disp_ml = false; //< Is the material dispersive?
84 double to_l = 0.0; //< Time delay of pulse
85 double hwhm = 0.0; //< Half width at half max of pulse
87 pml;//< Perfectly matched layer struct with size attributes
88 bool exphasorsvolume =
89 false;//< Should phasors be extracted in the whole volume?
90 bool exphasorssurface = false; //< Should phasors be extracted on a surface?
91 bool intphasorssurface = false; //< Should phasors be extracted/interpolated?
92 RunMode run_mode = complete; //< Run mode
93 SourceMode source_mode = pulsed;//< Source mode
94 Dimension dimension = THREE; //< Dimensions to calculate in
95 bool is_structure = false; //< Has a grating structure been defined?
96 bool exdetintegral = false; //< TODO: detector sensitivity evaluation ?
97 int k_det_obs = 0; //< TODO: no idea what this is?!
98 double z_obs = 0.0;//< Value of the input grid_labels_z at k_det_obs
99 bool air_interface_present = false;
100 double air_interface = 0.0;//< TODO: what is this?!
101 bool interp_mat_props =
102 false; //< Should the material properties be interpolated?
103 bool exi_present = false;//< Is the time dependent x incident field present?
104 bool eyi_present = false;//< Is the time dependent y incident field present?
105 SurfaceSpacingStride spacing_stride;//< Surface stride for extracting phasors
106 //(in matlab this is called 'phasorinc')
107 YeeCellDimensions delta; //< Yee cell dimensions (dx, dy, dz)
108
109 void set_run_mode(std::string mode_string);
110
111 void set_source_mode(std::string mode_string);
112
113 void set_dimension(std::string mode_string);
114
115 /**
116 * @brief Set the surface spacing stride.
117 * The x, y, z step size for extracting phasors (in matlab this is called
118 * 'phasorinc')
119 * @param vector the x, y, z steps (i.e. x = 2 means extract from every 2nd
120 * Yee cell.)
121 */
122 void set_spacing_stride(const double *vector);
123
124 /** @brief Calculate the number of times to extract the phasors (Np), and the
125 * number of iterations between each extraction (Npe).
126 */
127 void set_Np_and_Npe(const FrequencyExtractVector &f_ex_vec);
128
129 /**
130 * @brief Unpacks all simulation parameters and flags from the matrix inputs
131 * the executable received.
132 *
133 * @param in_matrices The input arrays from the input file(s) to tdms
134 */
136};
Classes describing arrays, vertices etc.
Allows us to handle the MATLAB arrays from the input file in a human-readable format.
Definition input_matrices.h:15
Class storing the various constants and behaviour flags for one executation of the tdms executable.
Definition simulation_parameters.h:69
void unpack_from_input_matrices(InputMatrices in_matrices)
Unpacks all simulation parameters and flags from the matrix inputs the executable received.
Definition simulation_parameters.cpp:75
void set_Np_and_Npe(const FrequencyExtractVector &f_ex_vec)
Calculate the number of times to extract the phasors (Np), and the number of iterations between each ...
Definition simulation_parameters.cpp:60
void set_spacing_stride(const double *vector)
Set the surface spacing stride. The x, y, z step size for extracting phasors (in matlab this is calle...
Definition simulation_parameters.cpp:54
Class handling the input matrices that are read in from the input file.
Dimension
Determines whether the simulation will compute all field components, or only the TE or TM modal compo...
Definition simulation_parameters.h:39
Definition simulation_parameters.h:15
int Dyl
Thickness of lower pml in the y direction.
Definition simulation_parameters.h:18
int Dzu
Thickness of upper pml in the z direction.
Definition simulation_parameters.h:21
int Dzl
Thickness of lower pml in the z direction.
Definition simulation_parameters.h:20
int Dxl
Thickness of lower pml in the x direction.
Definition simulation_parameters.h:16
int Dxu
Thickness of upper pml in the x direction.
Definition simulation_parameters.h:17
int Dyu
Thickness of upper pml in the y direction.
Definition simulation_parameters.h:19
A three-tuple of integers that contain the stride in each direction to extract the phasors on.
Definition simulation_parameters.h:53
The x,y,z lengths of the cuboidal Yee cells.
Definition simulation_parameters.h:25
double dz
Yee cell width in the z direction.
Definition simulation_parameters.h:28
double dx
Yee cell width in the x direction.
Definition simulation_parameters.h:26
double dy
Yee cell width in the y direction.
Definition simulation_parameters.h:27