1 /*****************************************************************************/
2 /* 8888888 88888888 88888888 */
5 /* 8 88888888 88888888 */
8 /* 888888 888888888 888888888 */
10 /* A Two-Dimensional General Purpose Semiconductor Simulator. */
13 /* Last update: Nov 27, 2005 */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
19 /*****************************************************************************/
23 #include "bzonedata.h"
27 #include "phy_scale.h"
34 const int NeumannBoundary
= 0x0001;
35 const int IF_Semiconductor_Vacuum
= 0x0002;
36 const int IF_Insulator_Vacuum
= 0x0004;
37 const int IF_Electrode_Vacuum
= 0x0008;
39 const int IF_Electrode_Insulator
= 0x0011;//not the same as gate contact.
40 const int InsulatorInterface
= 0x0012;
41 const int IF_Insulator_Semiconductor
= 0x0012;//the same as InsulatorInterface
42 const int IF_Insulator_Insulator
= 0x0013;
43 const int IF_Electrode_Electrode
= 0x0014;
44 const int HomoInterface
= 0x0015;
45 const int HeteroInterface
= 0x0016;
46 const int IF_Electrode_Semiconductor
= 0x0017;//electrode contact
49 const int OhmicContact
= 0x0101;
50 const int SchottkyContact
= 0x0102;
51 const int InsulatorContact
= 0x0104;
52 const int GateContact
= 0x0108;
53 const int ChargedContact
= 0x0111;
54 const int AbsorbingBoundary
= 0x1001;//by zhangxih 06-09-27
55 const int SourceBoundary
= 0x1002;//by zhangxih 06-09-27
57 const int NeumannMask
= 0x000F;
58 const int InterfaceMask
= 0x00F0;
59 const int ContactMask
= 0x0F00;
60 //stimulant type of electrode
61 const int VoltageBC
= 2005;
62 const int CurrentBC
= 2006;
65 /* ----------------------------------------------------------------------------
66 * BaseBC: The base class of boundary condition
71 int BCType
; //support 5 types of Contact and insulator interface now
72 Segment
* psegment
; //the pointer to the correlative segment
73 ZONE
* pzone
; //the pointer to the correlative zone
74 virtual BaseBC
* Get_this_pointer()=0; //for dynamic_cast operator
75 virtual void Set_R(PetscScalar r
) {}
76 virtual PetscScalar
Get_R() {return 0;}
77 virtual PetscScalar
Get_C() {return 0;}
78 virtual PetscScalar
Get_L() {return 0;}
79 virtual PetscScalar
Get_Vapp() {return 0;}
80 virtual PetscScalar
Get_Iapp() {return 0;}
81 virtual PetscScalar
Get_Potential() {return 0;}
82 virtual PetscScalar
Get_Potential_new() {return 0;}
83 virtual PetscScalar
Get_Potential_old() {return 0;}
84 virtual void Set_Vapp(PetscScalar V
) {}
85 virtual void Set_Iapp(PetscScalar I
) {}
86 virtual void Set_Potential(PetscScalar V
) {}
87 virtual void Set_Potential_new(PetscScalar V
) {}
88 virtual void Set_Potential_old(PetscScalar V
) {}
89 virtual void Set_Current(PetscScalar I
) {}
90 virtual void Set_Current_new(PetscScalar I
) {}
91 virtual void Set_Current_old(PetscScalar I
) {}
92 virtual PetscScalar
Get_Current() {return 0;}
93 virtual PetscScalar
Get_Current_new() {return 0;}
94 virtual PetscScalar
Get_Current_old() {return 0;}
95 virtual void Set_Cap_Current(PetscScalar Ic
) {}
96 virtual void Set_electrode_type(int type
) {}
98 virtual PetscScalar
Get_Vac() {return 0;}
99 virtual void Set_Vac(PetscScalar V
) {}
100 virtual complex<PetscScalar
> Get_Pac() {return 0;}
101 virtual void Set_Pac(complex<PetscScalar
> P
) {}
102 virtual complex<PetscScalar
> Get_Iac() {return 0;}
103 virtual void Set_Iac(complex<PetscScalar
> I
) {}
107 /* ----------------------------------------------------------------------------
108 * NeumannBC: The data structure of Neumann boundary
110 class NeumannBC
: public BaseBC
113 PetscScalar T_external
; //external temperature
114 PetscScalar heat_transfer
; //heat transfer
115 NeumannBC
* Get_this_pointer() //for dynamic_cast operator
120 /* ----------------------------------------------------------------------------
121 * OhmicBC: The data structure of Ohmic boundary
123 class OhmicBC
: public BaseBC
127 PetscScalar R
,C
,L
; //extern electrical parameters for electrode
128 PetscScalar Vapp
; //the application voltage
129 PetscScalar Iapp
; //the application current
130 PetscScalar Vac
; //the application voltage for AC sweep.
131 complex<PetscScalar
> Pac
; //the electrode potential for AC sweep.
132 complex<PetscScalar
> Iac
; //the electrode current for AC sweep.
133 PetscScalar potential
; //the potential of this electrode
134 PetscScalar potential_new
; //the potential for current iterative cycle
135 PetscScalar potential_old
; //the potential for last step
136 PetscScalar current
; //the current flow out of this electrode
137 PetscScalar current_new
; //the current for current iterative cycle
138 PetscScalar current_old
; //the current for last step
139 PetscScalar cap_current
; //the current which flow through lumped capacitance to ground
140 PetscScalar T_external
; //external temperature
141 PetscScalar heat_transfer
; //heat transfer
142 Interface
*pinterface
;
143 //connector to another electrode. i.e. cmos structure
144 string connect_elec
; //connect bc label
145 int inner_connect
; //connect bc index
146 int connect_zone
; //connect bc belongs to which zone
147 BZoneData
*pzonedata
; //pointer to zonedata
149 vector
<VSource
*> vsrc
; //vsource point array belongs to this bc
150 vector
<ISource
*> isrc
; //isource point array belongs to this bc
151 OhmicBC
* Get_this_pointer() //for dynamic_cast operator
153 void Set_R(PetscScalar r
) {R
=r
;}
154 PetscScalar
Get_R() {return R
;}
155 PetscScalar
Get_C() {return C
;}
156 PetscScalar
Get_L() {return L
;}
157 PetscScalar
Get_Vapp() {return Vapp
;}
158 PetscScalar
Get_Iapp() {return Iapp
;}
159 void Set_Vapp(PetscScalar V
) {Vapp
=V
;}
160 void Set_Iapp(PetscScalar I
) {Iapp
=I
;}
161 PetscScalar
Get_Potential() {return potential
;}
162 PetscScalar
Get_Potential_new() {return potential_new
;}
163 PetscScalar
Get_Potential_old() {return potential_old
;}
164 void Set_Potential(PetscScalar V
) {potential
=V
;}
165 void Set_Potential_new(PetscScalar V
) {potential_new
=V
;}
166 void Set_Potential_old(PetscScalar V
) {potential_old
=V
;}
167 void Set_Current(PetscScalar I
) {current
=I
;}
168 void Set_Current_new(PetscScalar I
) {current_new
=I
;}
169 void Set_Current_old(PetscScalar I
) {current_old
=I
;}
170 PetscScalar
Get_Current() {return current
;}
171 PetscScalar
Get_Current_new() {return current_new
;}
172 PetscScalar
Get_Current_old() {return current_old
;}
173 void Set_Cap_Current(PetscScalar Ic
) {cap_current
=Ic
;}
174 void Set_electrode_type(int type
) {electrode_type
=type
;}
175 PetscScalar
Get_Vac() {return Vac
;}
176 void Set_Vac(PetscScalar V
) {Vac
=V
;}
177 complex<PetscScalar
> Get_Pac() {return Pac
;}
178 void Set_Pac(complex<PetscScalar
> P
) {Pac
=P
;}
179 complex<PetscScalar
> Get_Iac() {return Iac
;}
180 void Set_Iac(complex<PetscScalar
> I
) {Iac
=I
;}
184 /* ----------------------------------------------------------------------------
185 * SchottkyBC: The data structure of Schottky boundary
187 class SchottkyBC
: public BaseBC
191 PetscScalar R
,C
,L
; //extern electrical parameters for electrode
192 PetscScalar WorkFunction
; //workfunction of electrode material
193 PetscScalar Vapp
; //the application voltage
194 PetscScalar Iapp
; //the application current
195 PetscScalar Vac
; //the application voltage for AC sweep.
196 complex<PetscScalar
> Pac
; //the electrode potential for AC sweep.
197 complex<PetscScalar
> Iac
; //the electrode current for AC sweep.
198 PetscScalar potential
; //the potential of this electrode
199 PetscScalar potential_new
; //the potential for current iterative cycle
200 PetscScalar potential_old
; //the potential for last step
201 PetscScalar current
; //the current flow out of this electrode
202 PetscScalar current_new
; //the current for current iterative cycle
203 PetscScalar current_old
; //the current for last step
204 PetscScalar cap_current
; //the current which flow through lumped capacitance to ground
205 PetscScalar T_external
; //external temperature
206 PetscScalar heat_transfer
; //heat transfer
207 Interface
*pinterface
;
208 //connector to another electrode. i.e. cmos structure
209 string connect_elec
; //connect bc label
210 int inner_connect
; //connect bc index
211 int connect_zone
; //connect bc belongs to which zone
212 BZoneData
*pzonedata
; //pointer to zonedata
214 vector
<VSource
*> vsrc
; //vsource point array belongs to this bc
215 vector
<ISource
*> isrc
; //isource point array belongs to this bc
216 SchottkyBC
*Get_this_pointer() //for dynamic_cast operator
218 void Set_R(PetscScalar r
) {R
=r
;}
219 PetscScalar
Get_R() {return R
;}
220 PetscScalar
Get_C() {return C
;}
221 PetscScalar
Get_L() {return L
;}
222 PetscScalar
Get_Vapp() {return Vapp
;}
223 PetscScalar
Get_Iapp() {return Iapp
;}
224 void Set_Vapp(PetscScalar V
) {Vapp
=V
;}
225 void Set_Iapp(PetscScalar I
) {Iapp
=I
;}
226 PetscScalar
Get_Potential() {return potential
;}
227 PetscScalar
Get_Potential_new() {return potential_new
;}
228 PetscScalar
Get_Potential_old() {return potential_old
;}
229 void Set_Potential(PetscScalar V
) {potential
=V
;}
230 void Set_Potential_new(PetscScalar V
) {potential_new
=V
;}
231 void Set_Potential_old(PetscScalar V
) {potential_old
=V
;}
232 void Set_Current(PetscScalar I
) {current
=I
;}
233 void Set_Current_new(PetscScalar I
) {current_new
=I
;}
234 void Set_Current_old(PetscScalar I
) {current_old
=I
;}
235 PetscScalar
Get_Current() {return current
;}
236 PetscScalar
Get_Current_new() {return current_new
;}
237 PetscScalar
Get_Current_old() {return current_old
;}
238 void Set_Cap_Current(PetscScalar Ic
) {cap_current
=Ic
;}
239 void Set_electrode_type(int type
) {electrode_type
=type
;}
240 PetscScalar
Get_Vac() {return Vac
;}
241 void Set_Vac(PetscScalar V
) {Vac
=V
;}
242 complex<PetscScalar
> Get_Pac() {return Pac
;}
243 void Set_Pac(complex<PetscScalar
> P
) {Pac
=P
;}
244 complex<PetscScalar
> Get_Iac() {return Iac
;}
245 void Set_Iac(complex<PetscScalar
> I
) {Iac
=I
;}
250 /* ----------------------------------------------------------------------------
251 * GateBC: The data structure of MOS Gate.
253 class GateBC
: public BaseBC
257 PetscScalar WorkFunction
; //workfunction of electrode material
258 PetscScalar R
,C
,L
; //extern electrical parameters for electrode
259 PetscScalar Vapp
; //the application voltage
260 PetscScalar Vac
; //the application voltage for AC sweep.
261 complex<PetscScalar
> Pac
; //the electrode potential for AC sweep.
262 complex<PetscScalar
> Iac
; //the electrode current for AC sweep.
263 PetscScalar potential
; //the potential of this electrode
264 PetscScalar potential_new
; //the potential for current iterative cycle
265 PetscScalar potential_old
; //the potential for last step
266 PetscScalar current
; //the current flow out of this electrode
267 PetscScalar current_new
; //the current for current iterative cycle
268 PetscScalar current_old
; //the current for last step
269 PetscScalar cap_current
; //the current which flow through lumped capacitance to ground
270 PetscScalar T_external
; //external temperature
271 PetscScalar heat_transfer
; //heat transfer
272 Interface
*pinterface
;
273 vector
<VSource
*> vsrc
; //vsource point array belongs to this bc
274 GateBC
* Get_this_pointer() //for dynamic_cast operator
276 void Set_R(PetscScalar r
) {R
=r
;}
277 PetscScalar
Get_R() {return R
;}
278 PetscScalar
Get_C() {return C
;}
279 PetscScalar
Get_L() {return L
;}
280 PetscScalar
Get_Vapp() {return Vapp
;}
281 void Set_Vapp(PetscScalar V
) {Vapp
=V
;}
282 PetscScalar
Get_Potential() {return potential
;}
283 PetscScalar
Get_Potential_new() {return potential_new
;}
284 PetscScalar
Get_Potential_old() {return potential_old
;}
285 void Set_Potential(PetscScalar V
) {potential
=V
;}
286 void Set_Potential_new(PetscScalar V
) {potential_new
=V
;}
287 void Set_Potential_old(PetscScalar V
) {potential_old
=V
;}
288 void Set_Current(PetscScalar I
) {current
=I
;}
289 void Set_Current_new(PetscScalar I
) {current_new
=I
;}
290 void Set_Current_old(PetscScalar I
) {current_old
=I
;}
291 PetscScalar
Get_Current() {return current
;}
292 PetscScalar
Get_Current_new() {return current_new
;}
293 PetscScalar
Get_Current_old() {return current_old
;}
294 void Set_Cap_Current(PetscScalar Ic
) {cap_current
=Ic
;}
295 void Set_electrode_type(int type
) {electrode_type
=type
;}
296 PetscScalar
Get_Vac() {return Vac
;}
297 void Set_Vac(PetscScalar V
) {Vac
=V
;}
298 complex<PetscScalar
> Get_Pac() {return Pac
;}
299 void Set_Pac(complex<PetscScalar
> P
) {Pac
=P
;}
300 complex<PetscScalar
> Get_Iac() {return Iac
;}
301 void Set_Iac(complex<PetscScalar
> I
) {Iac
=I
;}
306 /* ----------------------------------------------------------------------------
307 * InsulatorContactBC: The data structure of simplified MOS Gate
309 class InsulatorContactBC
: public BaseBC
313 PetscScalar WorkFunction
; //workfunction of electrode material
314 PetscScalar Thick
; //for simple SiSiO2 interface
315 PetscScalar eps
; //relative dielectric permittivity of insulator
316 PetscScalar R
,C
,L
; //extern electrical parameters for electrode
317 PetscScalar Vapp
; //the application voltage
318 PetscScalar Vac
; //the application voltage for AC sweep.
319 complex<PetscScalar
> Pac
; //the electrode potential for AC sweep.
320 complex<PetscScalar
> Iac
; //the electrode current for AC sweep.
321 PetscScalar potential
; //the potential of this electrode
322 PetscScalar potential_new
; //the potential for current iterative cycle
323 PetscScalar potential_old
; //the potential for last step
324 PetscScalar current
; //the current flow out of this electrode
325 PetscScalar current_new
; //the current for current iterative cycle
326 PetscScalar current_old
; //the current for last step
327 PetscScalar cap_current
; //the current which flow through lumped capacitance to ground
329 PetscScalar T_external
; //external temperature
330 PetscScalar heat_transfer
; //heat transfer
331 vector
<VSource
*> vsrc
; //vsource point array belongs to this bc
332 InsulatorContactBC
* Get_this_pointer() //for dynamic_cast operator
334 void Set_R(PetscScalar r
) {R
=r
;}
335 PetscScalar
Get_R() {return R
;}
336 PetscScalar
Get_C() {return C
;}
337 PetscScalar
Get_L() {return L
;}
338 PetscScalar
Get_Vapp() {return Vapp
;}
339 void Set_Vapp(PetscScalar V
) {Vapp
=V
;}
340 PetscScalar
Get_Potential() {return potential
;}
341 PetscScalar
Get_Potential_new() {return potential_new
;}
342 PetscScalar
Get_Potential_old() {return potential_old
;}
343 void Set_Potential(PetscScalar V
) {potential
=V
;}
344 void Set_Potential_new(PetscScalar V
) {potential_new
=V
;}
345 void Set_Potential_old(PetscScalar V
) {potential_old
=V
;}
346 void Set_Current(PetscScalar I
) {current
=I
;}
347 void Set_Current_new(PetscScalar I
) {current_new
=I
;}
348 void Set_Current_old(PetscScalar I
) {current_old
=I
;}
349 PetscScalar
Get_Current() {return current
;}
350 PetscScalar
Get_Current_new() {return current_new
;}
351 PetscScalar
Get_Current_old() {return current_old
;}
352 void Set_Cap_Current(PetscScalar Ic
) {cap_current
=Ic
;}
353 void Set_electrode_type(int type
) {electrode_type
=type
;}
354 PetscScalar
Get_Vac() {return Vac
;}
355 void Set_Vac(PetscScalar V
) {Vac
=V
;}
356 complex<PetscScalar
> Get_Pac() {return Pac
;}
357 void Set_Pac(complex<PetscScalar
> P
) {Pac
=P
;}
358 complex<PetscScalar
> Get_Iac() {return Iac
;}
359 void Set_Iac(complex<PetscScalar
> I
) {Iac
=I
;}
360 InsulatorContactBC();
364 /* ----------------------------------------------------------------------------
365 * ChargedContactBC: The data structure of float matel boundary
367 class ChargedContactBC
: public BaseBC
370 PetscScalar QF
; //the free charge of boundary
371 PetscScalar potential
; //the potential of float gate
372 PetscScalar potential_new
; //the potential for current iterative cycle
373 PetscScalar potential_old
; //the potential for last step
374 Interface
*pinterface
;
375 PetscScalar
Get_Potential() {return potential
;}
376 PetscScalar
Get_Potential_new() {return potential_new
;}
377 PetscScalar
Get_Potential_old() {return potential_old
;}
378 void Set_Potential(PetscScalar V
) {potential
=V
;}
379 void Set_Potential_new(PetscScalar V
) {potential_new
=V
;}
380 void Set_Potential_old(PetscScalar V
) {potential_old
=V
;}
381 ChargedContactBC
* Get_this_pointer() {return this;} //for dynamic_cast operator
387 /* ----------------------------------------------------------------------------
388 * ElectrodeElectrodeBC: The data structure of Interface between Electrode and Electrode
390 class ElectrodeElectrodeBC
: public BaseBC
393 Interface
*pinterface
;
394 ElectrodeElectrodeBC
* Get_this_pointer() //for dynamic_cast operator
396 ElectrodeElectrodeBC(){};
400 /* ----------------------------------------------------------------------------
401 * ElectrodeInsulatorBC: The data structure of interface between region of
402 * (Ohmic or Schottky) Electrode and Insulator.
404 class ElectrodeInsulatorBC
: public BaseBC
407 Interface
*pinterface
;
408 ElectrodeInsulatorBC
* Get_this_pointer() {return this;} //for dynamic_cast operator
409 ElectrodeInsulatorBC(){};
413 /* ----------------------------------------------------------------------------
414 * InsulatorInterfaceBC: The data structure of Interface between SiO2 and Si bulk
416 class InsulatorInterfaceBC
: public BaseBC
419 PetscScalar QF
; //InsulatorInterface fixed charge density
420 Interface
*pinterface
;
421 InsulatorInterfaceBC
* Get_this_pointer() //for dynamic_cast operator
423 InsulatorInterfaceBC();
427 /* ----------------------------------------------------------------------------
428 * InsulatorInsulatorBC: The data structure of Interface between Insulator and Insulator
430 class InsulatorInsulatorBC
: public BaseBC
433 Interface
*pinterface
;
434 InsulatorInsulatorBC
* Get_this_pointer() //for dynamic_cast operator
436 InsulatorInsulatorBC(){};
440 /* ----------------------------------------------------------------------------
441 * HomoInterfaceBC: The data structure of interface between region of same
442 * semiconductor material, mainly for further parallel code.
444 class HomoInterfaceBC
: public BaseBC
447 Interface
*pinterface
;
448 HomoInterfaceBC
* Get_this_pointer() {return this;} //for dynamic_cast operator
453 /* ----------------------------------------------------------------------------
454 * HeteroInterfaceBC: The data structure of Heterojuction
456 class HeteroInterfaceBC
: public BaseBC
459 PetscScalar QF
; //InsulatorInterface fixed charge density
460 Interface
*pinterface
;
461 HeteroInterfaceBC
* Get_this_pointer() //for dynamic_cast operator
467 /* ----------------------------------------------------------------------------
468 * AbsorbingBC: The data structure of absorbing boundary
470 class AbsorbingBC
: public BaseBC
//by zhangxih ---06-09-27
473 PetscScalar T_external
; //external temperature
474 PetscScalar heat_transfer
; //heat transfer
475 AbsorbingBC
* Get_this_pointer() //for dynamic_cast operator
481 /* ----------------------------------------------------------------------------
482 * SourceBC: The data structure of source boundary
484 class SourceBC
: public BaseBC
//by zhangxih ---06-09-27
487 PetscScalar T_external
; //external temperature
488 PetscScalar heat_transfer
; //heat transfer
489 SourceBC
* Get_this_pointer() //for dynamic_cast operator
495 /* ----------------------------------------------------------------------------
496 * DABC: The dynamic array of boundary condition
503 vector
<BaseBC
*> bc_point_array
; // dynamic array for bc point
504 Segment
** psegment_array
;
505 PhysicalUnitScale
*scale
;
506 ZoneInterface
*pzintface
;
507 double lattice_temperature
;
509 //these functions set BC by infos from CmdParseBuf
510 int SetBCNeumannBoundary(list
<Cmd
>::iterator
);
511 int SetBCOhmicContact(list
<Cmd
>::iterator
);
512 int SetBCInsulatorInterface(list
<Cmd
>::iterator
);
513 int SetBCHeterojunction(list
<Cmd
>::iterator
);
514 int SetBCInsulatorContact(list
<Cmd
>::iterator
);
515 int SetBCSchottkyContact(list
<Cmd
>::iterator
);
516 int SetBCGateContact(list
<Cmd
>::iterator
);
517 int SetBCChargedContact(list
<Cmd
>::iterator
);
518 int SetBCAbsorbingBoundary(list
<Cmd
>::iterator
);
519 int SetBCSourceBoundary(list
<Cmd
>::iterator
);
521 int SetElectrodeOhmicContact(list
<Cmd
>::iterator
,int,ZONE
*);
522 int SetElectrodeSchottkyContact(list
<Cmd
>::iterator
,int,ZONE
*);
523 int SetElectrodeGateContact(list
<Cmd
>::iterator
,int,ZONE
*);
524 int SetFloatMetal(list
<Cmd
>::iterator
,int,ZONE
*);
528 BaseBC
* Get_pointer(int );
529 int Get_bc_index (int, const char * );
530 int Get_bc_index(const char *, const char *);
531 int Get_bc_index (const char * );
532 int Get_bc_index_nocase (const char * );
534 int is_electrode(int );
535 int is_electrode(const char * );
536 BaseBC
* Get_electrode_pointer(const char * );
537 BaseBC
* Get_electrode_pointer_nocase(const char * );
538 int is_electrode_label(int, const char * );
539 int is_electrode_label_nocase(int, const char * );
540 const char * format_electrode_name(const char *);
541 const char * format_electrode_name_nocase(const char *);
542 void Update_Vapp(PetscScalar
); //set electrode application voltage by vsrc
544 void Update_Iapp(PetscScalar
); //set electrode application current by vsrc
546 void Set_Vapp(const char *, PetscScalar
); //set electrode application voltage by user specified value
547 void Set_Vapp_nocase(const char *, PetscScalar
);
548 void Set_Vac(const char *, PetscScalar
);
549 void Set_Iapp(const char *, PetscScalar
);
550 void Attach_Vapp(const char *, vector
<VSource
*> &);
551 void Attach_Iapp(const char *, vector
<ISource
*> &);
552 void Set_electrode_type(const char *,int);
553 const BaseBC
& operator[](int );
554 int EmitTo(int zone_index
, PetscScalar source_x
, PetscScalar source_y
, PetscScalar ex
, PetscScalar ey
);
556 int InitBC(int,Segment
**,int,ZONE
*,ZoneInterface
&,CmdBuf
*,double, PhysicalUnitScale
*);