1#ifndef G_COMPONENT_TCAD_2D_H
2#define G_COMPONENT_TCAD_2D_H
19 void ElectricField(
const double x,
const double y,
const double z,
double& ex,
20 double& ey,
double& ez,
double& v,
Medium*& m,
21 int& status)
override;
23 void ElectricField(
const double x,
const double y,
const double z,
double& ex,
24 double& ey,
double& ez,
Medium*& m,
int& status)
override {
29 void WeightingField(
const double x,
const double y,
const double z,
30 double& wx,
double& wy,
double& wz,
31 const std::string& label)
override;
33 const std::string& label)
override;
35 Medium*
GetMedium(
const double x,
const double y,
const double z)
override;
38 bool GetBoundingBox(
double& xmin,
double& ymin,
double& zmin,
double& xmax,
39 double& ymax,
double& zmax)
override;
40 void SetRangeZ(
const double zmin,
const double zmax);
46 bool Initialise(
const std::string& gridfilename,
47 const std::string& datafilename);
59 const std::string& datfile2,
const double dv);
65 void GetRegion(
const unsigned int i, std::string& name,
bool& active)
const;
75 bool GetElement(
const unsigned int i,
double& vol,
double& dmin,
double& dmax,
77 bool GetElement(
const unsigned int i,
double& vol,
double& dmin,
double& dmax,
78 int& type,
int& node1,
int& node2,
int& node3,
int& node4,
81 bool GetNode(
const unsigned int i,
double& x,
double& y,
double& v,
82 double& ex,
double& ey)
const;
85 bool GetMobility(
const double x,
const double y,
const double z,
double& emob,
90 double& vx,
double& vy,
double& vz,
Medium*& m,
91 int& status)
override;
92 void HoleVelocity(
const double x,
const double y,
const double z,
double& vx,
93 double& vy,
double& vz,
Medium*& m,
int& status)
override;
96 double& etau)
override;
98 double& htau)
override;
105 const unsigned int donorNumber,
106 double& occupationFraction);
108 const unsigned int acceptorNumber,
109 double& occupationFraction);
110 bool SetDonor(
const unsigned int donorNumber,
const double eXsec,
111 const double hxSec,
const double concentration);
112 bool SetAcceptor(
const unsigned int acceptorNumber,
const double eXsec,
113 const double hxSec,
const double concentration);
116 double& eta)
override;
117 bool HoleAttachment(
const double x,
const double y,
const double z,
118 double& eta)
override;
122 static constexpr unsigned int nMaxVertices = 4;
132 std::vector<Region> m_regions;
148 std::vector<float> donorOcc;
149 std::vector<float> acceptorOcc;
151 std::vector<Vertex> m_vertices;
154 std::vector<std::array<double, 2> > m_wf;
155 std::vector<double> m_wp;
160 int vertex[nMaxVertices];
171 std::vector<int> neighbours;
176 std::vector<Element> m_elements;
186 std::vector<Defect> m_donors;
187 std::vector<Defect> m_acceptors;
190 bool m_hasPotential =
false;
191 bool m_hasField =
false;
192 bool m_hasElectronMobility =
false;
193 bool m_hasHoleMobility =
false;
194 bool m_hasElectronVelocity =
false;
195 bool m_hasHoleVelocity =
false;
196 bool m_hasElectronLifetime =
false;
197 bool m_hasHoleLifetime =
false;
200 bool m_validTraps =
false;
207 bool m_hasRangeZ =
false;
208 double m_xMinBB, m_yMinBB, m_zMinBB;
209 double m_xMaxBB, m_yMaxBB, m_zMaxBB;
212 int m_lastElement = 0;
214 void Reset()
override;
215 void UpdatePeriodicity()
override;
216 unsigned int FindElement(
const double x,
const double y,
217 std::array<double, nMaxVertices>& w)
const;
220 bool CheckElement(
const double x,
const double y,
const Element& element,
221 std::array<double, nMaxVertices>& w)
const;
222 bool CheckRectangle(
const double x,
const double y,
const Element& element,
223 std::array<double, nMaxVertices>& w)
const;
224 bool CheckTriangle(
const double x,
const double y,
const Element& element,
225 std::array<double, nMaxVertices>& w)
const;
226 bool CheckLine(
const double x,
const double y,
const Element& element,
227 std::array<double, nMaxVertices>& w)
const;
229 bool LoadGrid(
const std::string& gridfilename);
230 bool LoadData(
const std::string& datafilename);
231 bool ReadDataset(std::ifstream& datafile,
const std::string& dataset);
232 bool LoadWeightingField(
const std::string& datafilename,
233 std::vector<std::array<double, 2> >& wf,
234 std::vector<double>& wp);
235 void FindNeighbours();
238 int FindRegion(
const std::string& name)
const;
240 void MapCoordinates(
double& x,
double& y,
bool& xmirr,
bool& ymirr)
const;
241 bool InsideBoundingBox(
const double x,
const double y,
242 const double z)
const {
244 if (x < m_xMinBB || x > m_xMaxBB || y < m_yMinBB || y > m_yMaxBB ||
245 (m_hasRangeZ && (z < m_zMinBB || z > m_zMaxBB))) {
250 bool CheckTraps()
const;
Abstract base class for components.
Interpolation in a two-dimensional field map created by Sentaurus Device.
unsigned int GetNumberOfElements() const
bool SetWeightingField(const std::string &datfile1, const std::string &datfile2, const double dv)
~ComponentTcad2d()
Destructor.
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override
Get the bounding box coordinates.
bool GetDonorOccupation(const double x, const double y, const double z, const unsigned int donorNumber, double &occupationFraction)
bool GetVoltageRange(double &vmin, double &vmax) override
Calculate the voltage range [V].
void GetRegion(const unsigned int i, std::string &name, bool &active) const
bool GetNode(const unsigned int i, double &x, double &y, double &v, double &ex, double &ey) const
bool SetDonor(const unsigned int donorNumber, const double eXsec, const double hxSec, const double concentration)
bool Initialise(const std::string &gridfilename, const std::string &datafilename)
ComponentTcad2d()
Constructor.
void WeightingField(const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label) override
unsigned int GetNumberOfNodes() const
void SetRangeZ(const double zmin, const double zmax)
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status) override
void PrintRegions() const
List all currently defined regions.
bool GetHoleLifetime(const double x, const double y, const double z, double &htau) override
bool HoleAttachment(const double x, const double y, const double z, double &eta) override
Get the hole attachment coefficient.
Medium * GetMedium(const double x, const double y, const double z) override
Get the medium at a given location (x, y, z).
bool GetAcceptorOccupation(const double x, const double y, const double z, const unsigned int acceptorNumber, double &occupationFraction)
unsigned int GetNumberOfRegions() const
Get the number of regions in the device.
void HoleVelocity(const double x, const double y, const double z, double &vx, double &vy, double &vz, Medium *&m, int &status) override
Get the hole drift velocity.
bool GetElement(const unsigned int i, double &vol, double &dmin, double &dmax, int &type) const
int GetNumberOfAcceptors()
void UnsetDriftRegion(const unsigned int ireg)
bool GetElectronLifetime(const double x, const double y, const double z, double &etau) override
bool ElectronAttachment(const double x, const double y, const double z, double &eta) override
Get the electron attachment coefficient.
void SetMedium(const unsigned int ireg, Medium *m)
Set the medium for a given region.
double WeightingPotential(const double x, const double y, const double z, const std::string &label) override
void SetDriftRegion(const unsigned int ireg)
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&m, int &status) override
Calculate the drift field [V/cm] and potential [V] at (x, y, z).
bool GetMobility(const double x, const double y, const double z, double &emob, double &hmob)
void ElectronVelocity(const double x, const double y, const double z, double &vx, double &vy, double &vz, Medium *&m, int &status) override
Get the electron drift velocity.
bool SetAcceptor(const unsigned int acceptorNumber, const double eXsec, const double hxSec, const double concentration)
Abstract base class for media.