45 #include <Xyce_config.h>
52 #include <N_UTL_Expression.h>
127 Nmax_chopGiven(false),
142 bool bsuccess =
true;
158 ParameterMap::const_iterator p_i =
getParameterMap().find(std::string(
"FUNCTION"));
161 ExtendedString tmp = getValue<std::string, DopeInfo>(*
this, p);
162 setValue<std::string, DopeInfo>(*
this, p,
static_cast<std::string
>(tmp.toLower()));
166 ParameterMap::const_iterator p_i =
getParameterMap().find(std::string(
"TYPE"));
169 ExtendedString tmp = getValue<std::string, DopeInfo>(*
this, p);
170 setValue<std::string, DopeInfo>(*
this, p,
static_cast<std::string
>(tmp.toLower()));
183 std::vector<double> & CVec,
184 std::vector<double> & CdonorVec,
185 std::vector<double> & CacceptorVec,
186 std::vector<double> & xVec,
190 int NX (CVec.size());
194 if (
type ==
"ptype" ||
type ==
"acceptor")
198 else if (
type ==
"ntype" ||
type ==
"donor")
209 if (xVec[i] >
xmax || xVec[i] <
xmin)
215 CVec[i] += sign*
Nmax;
217 if (
type ==
"ptype" ||
type ==
"acceptor")
219 CacceptorVec[i] +=
Nmax;
221 else if (
type ==
"ntype" ||
type ==
"donor")
223 CdonorVec[i] +=
Nmax;
229 double deltaX = fabs(
xwidth);
231 double ax = log(
Nmax/
Nmin)/(deltaX*deltaX);
234 double scalarX = 1.0;
237 if (
given(
"XLOC") &&
given(
"XWIDTH") && deltaX != 0.0)
239 abs_dx = fabs(xVec[i]-
xloc);
244 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
248 bool flatReg = (xVec[i] >
xloc);
252 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
257 bool flatReg = (xVec[i] <
xloc);
261 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
266 CVec[i] += sign*
Nmax*scalarX;
268 if (
type ==
"ptype" ||
type ==
"acceptor")
270 CacceptorVec[i] +=
Nmax*scalarX;
272 else if (
type ==
"ntype" ||
type ==
"donor")
274 CdonorVec[i] +=
Nmax*scalarX;
287 if (
flatX == 0) regOn =
true;
291 if (x >
xloc) regOn =
false;
297 if (x <
xloc) regOn =
false;
302 CVec[i] += (regOn)?(sign*
Nmax):(sign*
Nmin);
304 if (
type ==
"ptype" ||
type ==
"acceptor")
306 CacceptorVec[i] += (regOn)?(Nmax):(sign*
Nmin);
308 else if (
type ==
"ntype" ||
type ==
"donor")
310 CdonorVec[i] += (regOn)?(Nmax):(sign*
Nmin);
318 std::string msg =
"Dope Region : ";
320 msg +=
" has specified the expression specification, but not provided an expression.";
322 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
328 Xyce::dout() <<
"DopeInfo::setupInfo: exprString = " <<
exprString << std::endl;
330 Util::Expression expr;
335 double dopeValue(0.0);
337 expr.set_var(std::string(
"#X"), xVec[i]);
338 expr.evaluateFunction (dopeValue);
339 CVec[i] += sign*dopeValue;
341 if (
type ==
"ptype" ||
type ==
"acceptor")
343 CacceptorVec[i] += dopeValue;
345 else if (
type ==
"ntype" ||
type ==
"donor")
347 CdonorVec[i] += dopeValue;
356 std::string msg =
"Dope Region : ";
358 msg +=
" has specified the file specification, but not specified a file name.";
360 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
371 for (
int id=0;
id<dopeSize;++id)
382 double xtmp = xVec[i];
383 double dopeValue(0.0);
385 CVec[i] += sign*dopeValue;
387 if (
type ==
"ptype" ||
type ==
"acceptor")
389 CacceptorVec[i] += dopeValue;
391 else if (
type ==
"ntype" ||
type ==
"donor")
393 CdonorVec[i] += dopeValue;
400 std::string msg =
"Unrecognized Dope Region function type: ";
402 msg +=
" for region: ";
405 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
419 std::vector<double> & CVec,
420 std::vector<double> & CdonorVec,
421 std::vector<double> & CacceptorVec,
422 std::vector<double> & xVec,
423 std::vector<double> & yVec,
427 int numMeshPoints (CVec.size());
430 if (
type ==
"ptype" ||
type ==
"acceptor") sign = -1.0;
434 for (i=0;i<numMeshPoints;++i)
439 if (xVec[i] >
xmax || xVec[i] <
xmin)
447 if (yVec[i] >
ymax || yVec[i] <
ymin)
453 CVec[i] += sign*
Nmax;
454 if (
type ==
"ptype" ||
type ==
"acceptor")
456 CacceptorVec[i] +=
Nmax;
460 CdonorVec[i] +=
Nmax;
466 double deltaX = fabs(
xwidth);
467 double deltaY = fabs(
ywidth);
474 ax = log(
Nmax/
Nmin)/(deltaX*deltaX);
479 ay = log(
Nmax/
Nmin)/(deltaY*deltaY);
482 for (i=0;i<numMeshPoints;++i)
484 double scalarX = 1.0;
485 double scalarY = 1.0;
486 double abs_dx, abs_dy;
488 if (
given(
"XLOC") &&
given(
"XWIDTH") && deltaX != 0.0)
490 abs_dx = fabs(xVec[i]-
xloc);
495 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
499 bool flatReg = (xVec[i] >
xloc);
503 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
508 bool flatReg = (xVec[i] <
xloc);
512 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
517 if (
given(
"YLOC") &&
given(
"YWIDTH") && deltaY != 0.0)
519 abs_dy = fabs(yVec[i]-
yloc);
523 scalarY *=
ngdep2(0.0, abs_dy, 1.0, ay);
527 bool flatReg = (yVec[i] >
yloc);
531 scalarY *=
ngdep2(0.0, abs_dy, 1.0, ay);
536 bool flatReg = (yVec[i] <
yloc);
540 scalarY *=
ngdep2(0.0, abs_dy, 1.0, ay);
545 CVec[i] += sign*
Nmax*scalarX*scalarY;
547 if (
type ==
"ptype" ||
type ==
"acceptor")
549 CacceptorVec[i] +=
Nmax*scalarX*scalarY;
553 CdonorVec[i] +=
Nmax*scalarX*scalarY;
559 for (i=0;i<numMeshPoints;++i)
568 if (
flatY == 0) regOnY =
true;
572 if(y >
yloc) regOnY =
false;
578 if (y <
yloc) regOnY =
false;
585 if (
flatX == 0) regOnX =
true;
589 if(x >
xloc) regOnX =
false;
595 if (x <
xloc) regOnX =
false;
599 bool regOn = (regOnX && regOnY);
601 CVec[i] += (regOn)?(sign*
Nmax):(sign*
Nmin);
602 if (
type ==
"ptype" ||
type ==
"acceptor")
604 CacceptorVec[i] += (regOn)?(Nmax):(sign*
Nmin);
608 CdonorVec[i] += (regOn)?(Nmax):(sign*
Nmin);
614 std::string msg =
"Unrecognized Dope Region function type: ";
616 msg +=
" for region: ";
619 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
640 double D = 2.0 * sqrt(Dt);
642 return 0.5 * (
erf((Wh + x)/D) +
erf((Wh - x)/D));
690 double xprime = fabs(x) - (0.5 *
W);
691 return ((xprime <= 0.0) ? 1.0 : exp(-ax*xprime*xprime))*
692 ((y > 0.0) ? 0.0 : exp(-ay*y*y));
732 double retVal = exp(-ax*x*x)* exp(-ay*y*y);
746 double t1 = 1.0 / (1.0 + 0.3275911 * fabs(x));
751 double result = 1.0 - (0.254829592*t1 - 0.284496736*t2 + 1.421413741*t3 -
752 1.453152027*t4 + 1.061405429*t5) * exp(-x*x);
753 return (x < 0.0) ? -result : result;
765 std::string & filename,
766 std::vector<double> & xloc,
767 std::vector<double> & nvec,
768 std::vector<double> & y2,
778 input.open( filename.c_str(), std::ios::in );
781 bool endOfFile = input.eof();
784 endOfFile = input.eof();
794 endOfFile = input.eof();
803 xloc.push_back(x_loc);
804 nvec.push_back(value);
807 y2.resize(xloc.size(),0.0);
808 devSupport.
spline (xloc, nvec, y2);
812 std::string msg =
"Error: Cannot open doping file: " + filename;
813 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, msg);
826 std::string & filename,
827 std::vector<double> & xloc,
828 std::vector<double> & nvec,
829 std::vector<double> & y2_n,
830 std::vector<double> & pvec,
831 std::vector<double> & y2_p,
844 input.open( filename.c_str(), std::ios::in );
847 bool endOfFile = input.eof();
850 endOfFile = input.eof();
860 endOfFile = input.eof();
869 endOfFile = input.eof();
879 xloc.push_back(x_loc);
880 nvec.push_back(value1);
881 pvec.push_back(value2);
886 y2_n.resize(xloc.size(),0.0);
887 y2_p.resize(xloc.size(),0.0);
888 devSupport.
spline (xloc, nvec, y2_n);
889 devSupport.
spline (xloc, pvec, y2_p);
893 std::string msg =
"Error: Cannot open doping file: " + filename;
894 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, msg);
911 std::vector<double> & CVec,
912 std::vector<double> & CdonorVec,
913 std::vector<double> & CacceptorVec,
914 std::vector<double> & xVec,
915 std::vector<bool> & el2Vec,
919 int NX (CVec.size());
923 if (
type ==
"ptype" ||
type ==
"acceptor")
927 else if (
type ==
"ntype" ||
type ==
"donor")
938 if (xVec[i] >
xmax || xVec[i] <
xmin)
953 if (xVec[i] >
xmax || xVec[i] <
xmin)
959 CVec[i] += sign*
Nmax;
961 if (
type ==
"ptype" ||
type ==
"acceptor")
963 CacceptorVec[i] +=
Nmax;
965 else if (
type ==
"ntype" ||
type ==
"donor")
967 CdonorVec[i] +=
Nmax;
973 double deltaX = fabs(
xwidth);
975 double ax = log(
Nmax/
Nmin)/(deltaX*deltaX);
978 double scalarX = 1.0;
981 if (
given(
"XLOC") &&
given(
"XWIDTH") && deltaX != 0.0)
983 abs_dx = fabs(xVec[i]-
xloc);
988 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
992 bool flatReg = (xVec[i] >
xloc);
996 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
1001 bool flatReg = (xVec[i] <
xloc);
1005 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
1010 CVec[i] += sign*
Nmax*scalarX;
1012 if (
type ==
"ptype" ||
type ==
"acceptor")
1014 CacceptorVec[i] +=
Nmax*scalarX;
1016 else if (
type ==
"ntype" ||
type ==
"donor")
1018 CdonorVec[i] +=
Nmax*scalarX;
1031 if (
flatX == 0) regOn =
true;
1035 if (x >
xloc) regOn =
false;
1041 if (x <
xloc) regOn =
false;
1046 CVec[i] += (regOn)?(sign*
Nmax):(sign*
Nmin);
1048 if (
type ==
"ptype" ||
type ==
"acceptor")
1050 CacceptorVec[i] += (regOn)?(Nmax):(sign*
Nmin);
1052 else if (
type ==
"ntype" ||
type ==
"donor")
1054 CdonorVec[i] += (regOn)?(Nmax):(sign*
Nmin);
1062 std::string msg =
"Dope Region : ";
1064 msg +=
" has specified the expression specification, but not provided an expression.";
1066 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
1072 Xyce::dout() <<
"DopeInfo::setupInfo: exprString = " <<
exprString << std::endl;
1074 Util::Expression expr;
1079 double dopeValue(0.0);
1081 expr.set_var(std::string(
"#X"), xVec[i]);
1082 expr.evaluateFunction (dopeValue);
1083 CVec[i] += sign*dopeValue;
1085 if (
type ==
"ptype" ||
type ==
"acceptor")
1087 CacceptorVec[i] += dopeValue;
1089 else if (
type ==
"ntype" ||
type ==
"donor")
1091 CdonorVec[i] += dopeValue;
1100 std::string msg =
"Dope Region : ";
1102 msg +=
" has specified the file specification, but not specified a file name.";
1104 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
1115 for (
int id=0;
id<dopeSize;++id)
1126 double xtmp = xVec[i];
1127 double dopeValue(0.0);
1129 CVec[i] += sign*dopeValue;
1131 if (
type ==
"ptype" ||
type ==
"acceptor")
1133 CacceptorVec[i] += dopeValue;
1135 else if (
type ==
"ntype" ||
type ==
"donor")
1137 CdonorVec[i] += dopeValue;
1144 std::string msg =
"Unrecognized Dope Region function type: ";
1146 msg +=
" for region: ";
1149 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
std::vector< double > dopeVec
static double ngdep(double x, double y, double W, double ax, double ay)
static ParametricData< DopeInfo > & getParametricData()
static double ngdep2(double x, double y, double ax, double ay)
static double nsdep(double x, double W, double Dt)
Pure virtual class to augment a linear system.
static void readDopingFile(std::string &filename, std::vector< double > &xloc, std::vector< double > &nvec, std::vector< double > &y2, DeviceSupport &devSup)
const T & value(const ParameterBase &entity, const Descriptor &descriptor)
Returns the value of the parameter for the entity.
void splint(std::vector< double > &xa, std::vector< double > &ya, std::vector< double > &y2a, double x_position, double &y_spline)
void spline(std::vector< double > &x, std::vector< double > &y, std::vector< double > &y2)
bool given(const std::string ¶meter_name) const
given returns true if the value was specified in the netlist (not defaulted).
std::vector< double > xlocVec
void setupInfo(std::vector< double > &CVec, std::vector< double > &CdonorVec, std::vector< double > &CacceptorVec, std::vector< double > &xVec, DeviceSupport &devSup)
std::vector< double > y2Vec
void setupInfo2d(std::vector< double > &CVec, std::vector< double > &CdonorVec, std::vector< double > &CacceptorVec, std::vector< double > &xVec, std::vector< double > &yVec, DeviceSupport &devSup)
Class Descriptor describes the parameters stored in the ParametricData parameter map.
static double erf(double x)
bool processParam(Param &ndParam, std::string ¶m, DevicePDEInstance &di)
ParametricData()
Constructs the parameter data map.
std::vector< double > splintDopeVec
Manages parameter binding for class C.
void processParams()
processParams post processes the parameters that have been set in the object of the derived class...
CompositeParam is the base class for classes that wish to only manage the processing of parameter dat...
const ParameterMap & getParameterMap() const
getParameterMap returns the parameter map which describes the parameters.