fix portability.
[gss-tcad.git] / src / include / PMI.h
bloba21509602ccd0f12c47f33069335d239313968b6
1 /*****************************************************************************/
2 /* 8888888 88888888 88888888 */
3 /* 8 8 8 */
4 /* 8 8 8 */
5 /* 8 88888888 88888888 */
6 /* 8 8888 8 8 */
7 /* 8 8 8 8 */
8 /* 888888 888888888 888888888 */
9 /* */
10 /* A Two-Dimensional General Purpose Semiconductor Simulator. */
11 /* */
12 /* GSS 0.4x */
13 /* Last update: Feb 17 2008 */
14 /* */
15 /* Gong Ding */
16 /* gdiso@ustc.edu */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
18 /* */
19 /*****************************************************************************/
21 // This is the head file of physical model ineface (PMI), which contains base class of:
22 // physical model interface of semiconductor PMIS
23 // physical model interface of insulator PMII
24 // physical model interface of conductor PMIC
25 // physical model interface of vacuum PMIV
26 // physical model interface of PML PMIP
27 // It links the main solver and material. The solver load required parameters from
28 // re-implemented virtual functions.
30 #ifndef _PMIS_h_
31 #define _PMIS_h_
32 #include <complex>
33 #include <math.h>
34 #include "phy_scale.h"
35 #include "element.h"
36 #include "soldata.h"
37 #include "adolc.h"
39 using namespace adtl;
42 /*----------------------------------------------------------------------------
44 * Physical Model Interface for Semiconductor
46 *---------------------------------------------------------------------------*/
49 /* ----------------------------------------------------------------------------
50 * PMIS_Environment, this class contains data for initializing PMIS Server.
52 class PMIS_Environment
54 public:
55 PhysicalUnitScale *pscale; // physical unit
56 Node **ppnode; // the location of current node
57 SemiAuxData **ppsemi_data; // the physical parameter data
58 PetscScalar *pclock; // current time
59 public:
60 PMIS_Environment(PhysicalUnitScale *scale, Node** node, SemiAuxData **data, PetscScalar *time)
62 pscale = scale;
63 ppsemi_data = data;
64 ppnode = node;
65 pclock = time;
69 /* ----------------------------------------------------------------------------
70 * PMIS_Server, the base class of PMIS
72 class PMIS_Server
74 public:
75 PetscScalar m,cm,um,g,kg,C,V,eV,A,mA,J,W,s,K; //phusical unit
76 PetscScalar kb,e,me,eps0,mu0,h; //physical constant
77 public:
78 Node **ppnode; // the location of current node
79 SemiAuxData **ppsemi_data; // the physical parameter data
80 PetscScalar *pclock; // current time
81 // aux function return node coordinate.
82 void ReadCoordinate (PetscScalar& x, PetscScalar& y) const { x = (*ppnode)->x; y = (*ppnode)->y;}
83 // aux function return current time.
84 PetscScalar ReadTime () const { return *pclock;}
85 // aux function return first mole function.
86 PetscScalar ReadxMoleFraction () const { return (*ppsemi_data)->mole_x;}
87 // aux function return first mole function with upper and lower bind.
88 PetscScalar ReadxMoleFraction (const PetscScalar mole_xmin, const PetscScalar mole_xmax) const
90 PetscScalar mole_x=(*ppsemi_data)->mole_x;
91 if(mole_x<mole_xmin) return mole_xmin;
92 if(mole_x>mole_xmax) return mole_xmax;
93 return mole_x;
95 // aux function return second mole function.
96 PetscScalar ReadyMoleFraction () const { return (*ppsemi_data)->mole_y;}
97 // aux function return second mole function with upper and lower bind.
98 PetscScalar ReadyMoleFraction (const PetscScalar mole_ymin, const PetscScalar mole_ymax) const
100 PetscScalar mole_y=(*ppsemi_data)->mole_y;
101 if(mole_y<mole_ymin) return mole_ymin;
102 if(mole_y>mole_ymax) return mole_ymax;
103 return mole_y;
105 // aux function return doping Na
106 PetscScalar ReadDopingNa () const { return (*ppsemi_data)->Na; }
107 // aux function return doping Nd
108 PetscScalar ReadDopingNd () const { return (*ppsemi_data)->Nd; }
110 public:
111 PMIS_Server(const PMIS_Environment &env)
113 m = env.pscale->s_meter;
114 cm = env.pscale->s_centimeter;
115 um = env.pscale->s_micron;
116 kg = env.pscale->s_kg;
117 g = 0.001*kg;
118 C = env.pscale->s_coulomb;
119 V = env.pscale->s_volt;
120 eV = env.pscale->s_eV;
121 A = env.pscale->s_A;
122 mA = env.pscale->s_mA;
123 J = env.pscale->s_joule;
124 s = env.pscale->s_second;
125 W = J*s;
126 K = env.pscale->s_kelvin;
128 kb = 1.3806503e-23*J/K;
129 e = 1.602176462e-19*C;
130 me = 9.10938188e-31*kg;
131 eps0 = 8.854187818e-12*C/V/m;
132 mu0 = 12.56637061e-7*pow(s,2)/C*V/m;
133 h = 6.62606876e-34*J*s;
135 ppnode = env.ppnode;
136 ppsemi_data = env.ppsemi_data;
137 pclock = env.pclock;
139 virtual ~PMIS_Server(){};
143 /* ----------------------------------------------------------------------------
144 * PMIS_BasicParameter. The PMIS interface for basic physical parameters of
145 * semiconductor material. User should implement each pure virtual functions.
147 class PMIS_BasicParameter : public PMIS_Server
149 public:
150 PMIS_BasicParameter(const PMIS_Environment &env):PMIS_Server(env) { }
151 virtual PetscScalar Density (const PetscScalar &Tl) const=0;
152 virtual PetscScalar Permittivity () const=0;
153 virtual PetscScalar Permeability () const=0;
154 virtual PetscScalar Affinity (const PetscScalar &Tl) const=0;
155 virtual ~PMIS_BasicParameter() {};
158 /* ----------------------------------------------------------------------------
159 * PMIS_BandStructure. The PMIS interface for band structure of
160 * semiconductor material. User should implement each pure virtual functions.
162 class PMIS_BandStructure : public PMIS_Server
164 public:
165 PMIS_BandStructure(const PMIS_Environment &env):PMIS_Server(env) { }
166 virtual PetscScalar Eg (const PetscScalar &Tl) =0;
167 virtual AutoDScalar Eg (const AutoDScalar &Tl) =0;
168 virtual PetscScalar EgNarrow (const PetscScalar &Tl) =0;
169 virtual AutoDScalar EgNarrow (const AutoDScalar &Tl) =0;
170 virtual PetscScalar EgNarrowToEc (const PetscScalar &Tl) =0;
171 virtual PetscScalar EgNarrowToEv (const PetscScalar &Tl) =0;
172 virtual AutoDScalar EgNarrowToEc (const AutoDScalar &Tl) =0;
173 virtual AutoDScalar EgNarrowToEv (const AutoDScalar &Tl) =0;
175 virtual PetscScalar EffecElecMass (const PetscScalar &Tl) =0;
176 virtual PetscScalar EffecHoleMass (const PetscScalar &Tl) =0;
177 virtual PetscScalar Nc (const PetscScalar &Tl) =0;
178 virtual AutoDScalar Nc (const AutoDScalar &Tl) =0;
179 virtual PetscScalar Nv (const PetscScalar &Tl) =0;
180 virtual AutoDScalar Nv (const AutoDScalar &Tl) =0;
181 virtual PetscScalar nie (const PetscScalar &Tl) =0;
182 virtual AutoDScalar nie (const AutoDScalar &Tl) =0;
184 virtual PetscScalar TAUN (const PetscScalar &Tl) =0;
185 virtual PetscScalar TAUP (const PetscScalar &Tl) =0;
186 virtual PetscScalar Gamman () {return 1.0;}
187 virtual PetscScalar Gammap () {return 1.0;}
189 virtual PetscScalar R_Direct (const PetscScalar &p, const PetscScalar &n, const PetscScalar &Tl) =0;
190 virtual AutoDScalar R_Direct (const AutoDScalar &p, const AutoDScalar &n, const AutoDScalar &Tl) =0;
192 virtual PetscScalar R_Auger (const PetscScalar &p, const PetscScalar &n, const PetscScalar &Tl) =0;
193 virtual AutoDScalar R_Auger (const AutoDScalar &p, const AutoDScalar &n, const AutoDScalar &Tl) =0;
195 virtual PetscScalar R_SHR (const PetscScalar &p, const PetscScalar &n, const PetscScalar &Tl) =0;
196 virtual AutoDScalar R_SHR (const AutoDScalar &p, const AutoDScalar &n, const AutoDScalar &Tl) =0;
198 virtual PetscScalar R_Surf (const PetscScalar &p, const PetscScalar &n, const PetscScalar &Tl, const PetscScalar &len) =0;
199 virtual AutoDScalar R_Surf (const AutoDScalar &p, const AutoDScalar &n, const AutoDScalar &Tl, const PetscScalar &len) =0;
201 virtual PetscScalar Recomb (const PetscScalar &p, const PetscScalar &n, const PetscScalar &Tl) =0;
202 virtual AutoDScalar Recomb (const AutoDScalar &p, const AutoDScalar &n, const AutoDScalar &Tl) =0;
204 virtual PetscScalar ElecEnergyRelaxTime(const PetscScalar &Tn, const PetscScalar &Tl) =0;
205 virtual AutoDScalar ElecEnergyRelaxTime(const AutoDScalar &Tn, const AutoDScalar &Tl) =0;
206 virtual PetscScalar HoleEnergyRelaxTime(const PetscScalar &Tp, const PetscScalar &Tl) =0;
207 virtual AutoDScalar HoleEnergyRelaxTime(const AutoDScalar &Tp, const AutoDScalar &Tl) =0;
210 virtual PetscScalar SchottyJsn (PetscScalar n,PetscScalar Tl,PetscScalar Vb)=0;
211 virtual PetscScalar SchottyJsp (PetscScalar p,PetscScalar Tl,PetscScalar Vb)=0;
212 virtual PetscScalar SchottyBarrierLowerring (PetscScalar eps, PetscScalar E)=0;
213 virtual PetscScalar pdSchottyJsn_pdn(PetscScalar n,PetscScalar Tl,PetscScalar Vb)=0;
214 virtual PetscScalar pdSchottyJsp_pdp(PetscScalar p,PetscScalar Tl,PetscScalar Vb)=0;
215 virtual PetscScalar pdSchottyJsn_pdTl(PetscScalar n,PetscScalar Tl,PetscScalar Vb)=0;
216 virtual PetscScalar pdSchottyJsp_pdTl(PetscScalar p,PetscScalar Tl,PetscScalar Vb)=0;
218 virtual PetscScalar ThermalVn (PetscScalar Tl)=0;
219 virtual PetscScalar ThermalVp (PetscScalar Tl)=0;
220 virtual PetscScalar pdThermalVn_pdTl (PetscScalar Tl)=0;
221 virtual PetscScalar pdThermalVp_pdTl (PetscScalar Tl)=0;
223 virtual PetscScalar BB_Tunneling(const PetscScalar &Tl, const PetscScalar &E) =0;
224 virtual AutoDScalar BB_Tunneling(const AutoDScalar &Tl, const AutoDScalar &E) =0;
227 virtual ~PMIS_BandStructure() {};
231 /* ----------------------------------------------------------------------------
232 * PMIS_Mobility. The PMIS interface for semiconductor mobility.
233 * User should implement each pure virtual functions.
235 class PMIS_Mobility : public PMIS_Server
237 public:
238 PMIS_Mobility(const PMIS_Environment &env):PMIS_Server(env) { }
239 virtual PetscScalar ElecMob (const PetscScalar &p, const PetscScalar &n, const PetscScalar &Tl,
240 const PetscScalar &Ep, const PetscScalar &Et, const PetscScalar &Tn) const=0;
241 virtual PetscScalar HoleMob (const PetscScalar &p, const PetscScalar &n, const PetscScalar &Tl,
242 const PetscScalar &Ep, const PetscScalar &Et, const PetscScalar &Tp) const=0;
243 virtual AutoDScalar ElecMob (const AutoDScalar &p, const AutoDScalar &n, const AutoDScalar &Tl,
244 const AutoDScalar &Ep, const AutoDScalar &Et, const AutoDScalar &Tn) const=0;
245 virtual AutoDScalar HoleMob (const AutoDScalar &p, const AutoDScalar &n, const AutoDScalar &Tl,
246 const AutoDScalar &Ep, const AutoDScalar &Et, const AutoDScalar &Tp) const=0;
247 virtual ~PMIS_Mobility() {};
251 /* ----------------------------------------------------------------------------
252 * PMIS_Avalanche. The PMIS interface for semiconductor impact ionization parameter.
253 * User should implement each pure virtual functions.
255 class PMIS_Avalanche : public PMIS_Server
257 public:
258 PMIS_Avalanche(const PMIS_Environment &env):PMIS_Server(env) { }
259 //generation procedure for DDM
260 virtual PetscScalar ElecGenRate (const PetscScalar &Tl,const PetscScalar &Ep,const PetscScalar &Eg) const=0;
261 virtual PetscScalar HoleGenRate (const PetscScalar &Tl,const PetscScalar &Ep,const PetscScalar &Eg) const=0;
262 //Automatic Differentiation version for DDM
263 virtual AutoDScalar ElecGenRate (const AutoDScalar &Tl,const AutoDScalar &Ep,const AutoDScalar &Eg) const=0;
264 virtual AutoDScalar HoleGenRate (const AutoDScalar &Tl,const AutoDScalar &Ep,const AutoDScalar &Eg) const=0;
266 //generation procedure for EBM
267 virtual PetscScalar ElecGenRateEBM (const PetscScalar &Tn,const PetscScalar &Tl,const PetscScalar &Eg) const=0;
268 virtual PetscScalar HoleGenRateEBM (const PetscScalar &Tp,const PetscScalar &Tl,const PetscScalar &Eg) const=0;
269 //Automatic Differentiation version for EBM
270 virtual AutoDScalar ElecGenRateEBM (const AutoDScalar &Tn,const AutoDScalar &Tl,const AutoDScalar &Eg) const=0;
271 virtual AutoDScalar HoleGenRateEBM (const AutoDScalar &Tp,const AutoDScalar &Tl,const AutoDScalar &Eg) const=0;
272 virtual ~PMIS_Avalanche() {};
276 /* ----------------------------------------------------------------------------
277 * PMIS_Thermal. The PMIS interface for semiconductor thermal parameter.
278 * User should implement each pure virtual functions.
280 class PMIS_Thermal : public PMIS_Server
282 public:
283 PMIS_Thermal(const PMIS_Environment &env):PMIS_Server(env) { }
284 virtual PetscScalar HeatCapacity (const PetscScalar &Tl) const=0;
285 virtual AutoDScalar HeatCapacity (const AutoDScalar &Tl) const=0;
286 virtual PetscScalar HeatConduction(const PetscScalar &Tl) const=0;
287 virtual AutoDScalar HeatConduction(const AutoDScalar &Tl) const=0;
288 virtual ~PMIS_Thermal() {};
292 /* ----------------------------------------------------------------------------
293 * PMIS_Optical. The PMIS interface for semiconductor optical refraction index
294 * User should implement each pure virtual functions.
296 class PMIS_Optical : public PMIS_Server
298 public:
299 PMIS_Optical(const PMIS_Environment &env):PMIS_Server(env) { }
300 virtual complex<PetscScalar> RefractionIndex(PetscScalar lamda, PetscScalar Eg=0, PetscScalar Tl=1) const=0;
305 /*----------------------------------------------------------------------------
307 * Physical Model Interface for Insulator
309 *---------------------------------------------------------------------------*/
311 /* ----------------------------------------------------------------------------
312 * PMII_Environment, this class contains data for initializing PMII Server.
314 class PMII_Environment
316 public:
317 PhysicalUnitScale *pscale; // physical unit
318 Node **ppnode; // the location of current node
319 ISAuxData **ppis_data; // the physical parameter data
320 PetscScalar *pclock; // current time
321 public:
322 PMII_Environment(PhysicalUnitScale *scale, Node** node, ISAuxData **data, PetscScalar *time)
324 pscale = scale;
325 ppis_data = data;
326 ppnode = node;
327 pclock = time;
332 /* ----------------------------------------------------------------------------
333 * PMII_Server, the base class of PMII
335 class PMII_Server
337 public:
338 PetscScalar m,cm,um,g,kg,C,V,eV,A,mA,J,W,s,K; //phusical unit
339 PetscScalar kb,e,me,eps0,mu0,h; //physical constant
340 public:
341 Node **ppnode; // the location of current node
342 ISAuxData **ppis_data; // the physical parameter data
343 PetscScalar *pclock; // current time
344 // aux function return node coordinate.
345 void ReadCoordinate (PetscScalar& x, PetscScalar& y) const { x = (*ppnode)->x; y = (*ppnode)->y;}
346 // aux function return current time.
347 PetscScalar ReadTime () const { return *pclock;}
348 public:
349 PMII_Server(const PMII_Environment &env)
351 m = env.pscale->s_meter;
352 cm = env.pscale->s_centimeter;
353 um = env.pscale->s_micron;
354 kg = env.pscale->s_kg;
355 g = 0.001*kg;
356 C = env.pscale->s_coulomb;
357 V = env.pscale->s_volt;
358 eV = env.pscale->s_eV;
359 A = env.pscale->s_A;
360 mA = env.pscale->s_mA;
361 J = env.pscale->s_joule;
362 s = env.pscale->s_second;
363 W = J*s;
364 K = env.pscale->s_kelvin;
366 kb = 1.3806503e-23*J/K;
367 e = 1.602176462e-19*C;
368 me = 9.10938188e-31*kg;
369 eps0 = 8.854187818e-12*C/V/m;
370 mu0 = 12.56637061e-7*pow(s,2)/C*V/m;
371 h = 6.62606876e-34*J*s;
373 ppnode = env.ppnode;
374 ppis_data = env.ppis_data;
375 pclock = env.pclock;
377 virtual ~PMII_Server(){};
381 /* ----------------------------------------------------------------------------
382 * PMII_BasicParameter. The PMII interface for basic physical parameters of
383 * insulator material. User should implement each pure virtual functions.
385 class PMII_BasicParameter : public PMII_Server
387 public:
388 PMII_BasicParameter(const PMII_Environment &env):PMII_Server(env) { }
389 virtual PetscScalar Density (const PetscScalar &Tl) const=0;
390 virtual PetscScalar Permittivity () const=0;
391 virtual PetscScalar Permeability () const=0;
392 virtual PetscScalar Affinity (const PetscScalar &Tl) const=0;
393 virtual ~PMII_BasicParameter() {};
397 /* ----------------------------------------------------------------------------
398 * PMII_Thermal. The PMII interface for insulator thermal parameter.
399 * User should implement each pure virtual functions.
401 class PMII_Thermal : public PMII_Server
403 public:
404 PMII_Thermal(const PMII_Environment &env):PMII_Server(env) { }
405 virtual PetscScalar HeatCapacity (const PetscScalar &Tl) const=0;
406 virtual PetscScalar HeatConduction(const PetscScalar &Tl) const=0;
407 virtual ~PMII_Thermal() {};
411 /* ----------------------------------------------------------------------------
412 * PMII_Optical. The PMII interface for insulator optical refraction index
413 * User should implement each pure virtual functions.
415 class PMII_Optical : public PMII_Server
417 public:
418 PMII_Optical(const PMII_Environment &env):PMII_Server(env) { }
419 virtual complex<PetscScalar> RefractionIndex(PetscScalar lamda, PetscScalar Eg=0, PetscScalar Tl=1) const=0;
424 /*----------------------------------------------------------------------------
426 * Physical Model Interface for Conductor
428 *---------------------------------------------------------------------------*/
430 /* ----------------------------------------------------------------------------
431 * PMIC_Environment, this class contains data for initializing PMIC Server.
433 class PMIC_Environment
435 public:
436 PhysicalUnitScale *pscale; // physical unit
437 Node **ppnode; // the location of current node
438 ELAuxData **ppel_data; // the physical parameter data
439 PetscScalar *pclock; // current time
440 public:
441 PMIC_Environment(PhysicalUnitScale *scale, Node** node, ELAuxData **data, PetscScalar *time)
443 pscale = scale;
444 ppel_data = data;
445 ppnode = node;
446 pclock = time;
451 /* ----------------------------------------------------------------------------
452 * PMIC_Server, the base class of PMIC
454 class PMIC_Server
456 public:
457 PetscScalar m,cm,um,g,kg,C,V,eV,A,mA,J,W,s,K; //phusical unit
458 PetscScalar kb,e,me,eps0,mu0,h; //physical constant
459 public:
460 Node **ppnode; // the location of current node
461 ELAuxData **ppel_data; // the physical parameter data
462 PetscScalar *pclock; // current time
463 // aux function return node coordinate.
464 void ReadCoordinate (PetscScalar& x, PetscScalar& y) const { x = (*ppnode)->x; y = (*ppnode)->y;}
465 // aux function return current time.
466 PetscScalar ReadTime () const { return *pclock;}
467 public:
468 PMIC_Server(const PMIC_Environment &env)
470 m = env.pscale->s_meter;
471 cm = env.pscale->s_centimeter;
472 um = env.pscale->s_micron;
473 kg = env.pscale->s_kg;
474 g = 0.001*kg;
475 C = env.pscale->s_coulomb;
476 V = env.pscale->s_volt;
477 eV = env.pscale->s_eV;
478 A = env.pscale->s_A;
479 mA = env.pscale->s_mA;
480 J = env.pscale->s_joule;
481 s = env.pscale->s_second;
482 W = J*s;
483 K = env.pscale->s_kelvin;
485 kb = 1.3806503e-23*J/K;
486 e = 1.602176462e-19*C;
487 me = 9.10938188e-31*kg;
488 eps0 = 8.854187818e-12*C/V/m;
489 mu0 = 12.56637061e-7*pow(s,2)/C*V/m;
490 h = 6.62606876e-34*J*s;
492 ppnode = env.ppnode;
493 ppel_data = env.ppel_data;
494 pclock = env.pclock;
496 virtual ~PMIC_Server(){};
500 /* ----------------------------------------------------------------------------
501 * PMIC_BasicParameter. The PMIC interface for basic physical parameters of
502 * conductor material. User should implement each pure virtual functions.
504 class PMIC_BasicParameter : public PMIC_Server
506 public:
507 PMIC_BasicParameter(const PMIC_Environment &env):PMIC_Server(env) { }
508 virtual PetscScalar Density (const PetscScalar &Tl) const=0;
509 virtual PetscScalar Permittivity () const=0;
510 virtual PetscScalar Permeability () const=0;
511 virtual PetscScalar Affinity (const PetscScalar &Tl) const=0;
512 virtual ~PMIC_BasicParameter() {};
516 /* ----------------------------------------------------------------------------
517 * PMIC_Thermal. The PMIC interface for conductor thermal parameter.
518 * User should implement each pure virtual functions.
520 class PMIC_Thermal : public PMIC_Server
522 public:
523 PMIC_Thermal(const PMIC_Environment &env):PMIC_Server(env) { }
524 virtual PetscScalar HeatCapacity (const PetscScalar &Tl) const=0;
525 virtual PetscScalar HeatConduction(const PetscScalar &Tl) const=0;
526 virtual ~PMIC_Thermal() {};
530 /* ----------------------------------------------------------------------------
531 * PMIC_Optical. The PMIC interface for conductor optical refraction index
532 * User should implement each pure virtual functions.
534 class PMIC_Optical : public PMIC_Server
536 public:
537 PMIC_Optical(const PMIC_Environment &env):PMIC_Server(env) { }
538 virtual complex<PetscScalar> RefractionIndex(PetscScalar lamda, PetscScalar Eg=0, PetscScalar Tl=1) const=0;
542 /*----------------------------------------------------------------------------
544 * Physical Model Interface for Vacuum, only used in EM FEM solver.
546 *---------------------------------------------------------------------------*/
548 /*----------------------------------------------------------------------------
549 * PMIV_Environment, this class contains data for initializing PMIV Server.
551 class PMIV_Environment
553 public:
554 PhysicalUnitScale *pscale; // physical unit
555 Node **ppnode; // the location of current node
556 VacuumAuxData **ppvac_data; // the physical parameter data
557 PetscScalar *pclock; // current time
559 public:
560 PMIV_Environment(PhysicalUnitScale *scale, Node** node, VacuumAuxData **data, PetscScalar *time)
562 pscale = scale;
563 ppvac_data = data;
564 ppnode = node;
565 pclock = time;
570 /*----------------------------------------------------------------------------
571 * PMIV_Server, the base class of PMIV
573 class PMIV_Server
575 public:
576 PetscScalar m,cm,um,g,kg,C,V,eV,A,mA,J,W,s,K; //phusical unit
577 PetscScalar kb,e,me,eps0,mu0,h; //physical constant
578 public:
579 Node **ppnode; // the location of current node
580 VacuumAuxData **ppvac_data; // the physical parameter data
581 PetscScalar *pclock; // current time
582 // aux function return node coordinate.
583 void ReadCoordinate (PetscScalar& x, PetscScalar& y) const { x = (*ppnode)->x; y = (*ppnode)->y;}
584 // aux function return current time.
585 PetscScalar ReadTime () const { return *pclock;}
586 public:
587 PMIV_Server(const PMIV_Environment &env)
589 m = env.pscale->s_meter;
590 cm = env.pscale->s_centimeter;
591 um = env.pscale->s_micron;
592 kg = env.pscale->s_kg;
593 g = 0.001*kg;
594 C = env.pscale->s_coulomb;
595 V = env.pscale->s_volt;
596 eV = env.pscale->s_eV;
597 A = env.pscale->s_A;
598 mA = env.pscale->s_mA;
599 J = env.pscale->s_joule;
600 s = env.pscale->s_second;
601 W = J*s;
602 K = env.pscale->s_kelvin;
604 kb = 1.3806503e-23*J/K;
605 e = 1.602176462e-19*C;
606 me = 9.10938188e-31*kg;
607 eps0 = 8.854187818e-12*C/V/m;
608 mu0 = 12.56637061e-7*pow(s,2)/C*V/m;
609 h = 6.62606876e-34*J*s;
611 ppnode = env.ppnode;
612 ppvac_data = env.ppvac_data;
613 pclock = env.pclock;
615 virtual ~PMIV_Server(){};
619 /*----------------------------------------------------------------------------
620 * PMIV_BasicParameter. The PMIV interface for basic physical parameters of
621 * vacuum. User should implement each pure virtual functions.
623 class PMIV_BasicParameter : public PMIV_Server
625 public:
626 PMIV_BasicParameter(const PMIV_Environment &env):PMIV_Server(env) { }
627 virtual PetscScalar Density (const PetscScalar &Tl) const=0;
628 virtual PetscScalar Permittivity () const=0;
629 virtual PetscScalar Permeability () const=0;
630 virtual PetscScalar Affinity (const PetscScalar &Tl) const=0;
631 virtual ~PMIV_BasicParameter() {};
635 /* ----------------------------------------------------------------------------
636 * PMIV_Thermal. The PMIV interface for vacuum thermal parameter.
637 * User should implement each pure virtual functions.
639 class PMIV_Thermal : public PMIV_Server
641 public:
642 PMIV_Thermal(const PMIV_Environment &env):PMIV_Server(env) { }
643 virtual PetscScalar HeatCapacity (const PetscScalar &Tl) const=0;
644 virtual PetscScalar HeatConduction(const PetscScalar &Tl) const=0;
645 virtual ~PMIV_Thermal() {};
650 /*----------------------------------------------------------------------------
652 * Physical Model Interface for PML Boundary, only used in EM FEM solver.
654 *---------------------------------------------------------------------------*/
656 /*----------------------------------------------------------------------------
657 * PMIP_Environment, this class contains data for initializing PMIP Server.
659 class PMIP_Environment
661 public:
662 PhysicalUnitScale *pscale; // physical unit
663 Node **ppnode; // the location of current node
664 PMLAuxData **ppml_data; // the physical parameter data
665 PetscScalar *pclock; // current time
666 public:
667 PMIP_Environment(PhysicalUnitScale *scale, Node** node, PMLAuxData **data, PetscScalar *time)
669 pscale = scale;
670 ppml_data = data;
671 ppnode = node;
672 pclock = time;
677 /* ----------------------------------------------------------------------------
678 * PMIP_Server, the base class of PMIP
680 class PMIP_Server
682 public:
683 PetscScalar m,cm,um,g,kg,C,V,eV,A,mA,J,W,s,K; //phusical unit
684 PetscScalar kb,e,me,eps0,mu0,h; //physical constant
685 public:
686 Node **ppnode; // the location of current node
687 PMLAuxData **ppml_data; // the physical parameter data
688 PetscScalar *pclock; // current time
689 // aux function return node coordinate.
690 void ReadCoordinate (PetscScalar& x, PetscScalar& y) const { x = (*ppnode)->x; y = (*ppnode)->y;}
691 // aux function return node coordinate.
692 PetscScalar ReadTime () const { return *pclock;}
693 public:
694 PMIP_Server(const PMIP_Environment &env)
696 m = env.pscale->s_meter;
697 cm = env.pscale->s_centimeter;
698 um = env.pscale->s_micron;
699 kg = env.pscale->s_kg;
700 g = 0.001*kg;
701 C = env.pscale->s_coulomb;
702 V = env.pscale->s_volt;
703 eV = env.pscale->s_eV;
704 A = env.pscale->s_A;
705 mA = env.pscale->s_mA;
706 J = env.pscale->s_joule;
707 s = env.pscale->s_second;
708 W = J*s;
709 K = env.pscale->s_kelvin;
711 kb = 1.3806503e-23*J/K;
712 e = 1.602176462e-19*C;
713 me = 9.10938188e-31*kg;
714 eps0 = 8.854187818e-12*C/V/m;
715 mu0 = 12.56637061e-7*pow(s,2)/C*V/m;
716 h = 6.62606876e-34*J*s;
718 ppnode = env.ppnode;
719 ppml_data = env.ppml_data;
720 pclock = env.pclock;
722 virtual ~PMIP_Server(){};
726 /*----------------------------------------------------------------------------
727 * PMIP_BasicParameter. The PMIP interface for basic physical parameters of
728 * PML. User should implement each pure virtual functions.
730 class PMIP_BasicParameter : public PMIP_Server
732 public:
733 PMIP_BasicParameter(const PMIP_Environment &env):PMIP_Server(env) { }
734 virtual PetscScalar Density (const PetscScalar &Tl) const=0;
735 virtual PetscScalar Permittivity () const=0;
736 virtual PetscScalar Permeability () const=0;
737 virtual PetscScalar Affinity (const PetscScalar &Tl) const=0;
738 virtual ~PMIP_BasicParameter() {};
742 /* ----------------------------------------------------------------------------
743 * PMIP_Thermal. The PMIP interface for PML thermal parameter.
744 * User should implement each pure virtual functions.
746 class PMIP_Thermal : public PMIP_Server
748 public:
749 PMIP_Thermal(const PMIP_Environment &env):PMIP_Server(env) { }
750 virtual PetscScalar HeatCapacity (const PetscScalar &Tl) const=0;
751 virtual PetscScalar HeatConduction(const PetscScalar &Tl) const=0;
752 virtual ~PMIP_Thermal() {};
755 #endif