initial checkin, based on GSS 0.46 CVS
[gss-tcad.git] / src / include / ebm_nt3e.h
blob1c76dc84be3035050fe35aa71da5f2e030e5b613
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: May 29, 2007 */
14 /* */
15 /* Gong Ding */
16 /* gdiso@ustc.edu */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
18 /* */
19 /*****************************************************************************/
21 #ifndef _ebm_nt3e_h_
22 #define _ebm_nt3e_h_
24 #include "bsolver.h"
25 #include "petscts.h"
26 #include "petscsnes.h"
28 class EBM_Solver_L3E : virtual public BSolver
30 private:
31 int N; // the scale of matrix
32 SNES snes; // nonlinear solver context
33 KSP ksp; // linear solver context
34 PC pc; // preconditioner context
35 vector<int> zofs; // the offset value of each zone in solution vector
36 PetscTruth mf_flg;
37 SNESConvergedReason reason;
38 void solver_pre_compute() ;
39 void solution_update() ;
40 void diverged_recovery() ;
41 void LET_norm_estimat(PetscScalar &);
42 public:
43 Vec x,r; // solution, residual vectors
44 Vec x_n,x_n1,x_n2; // privious solution vector for LET evaluation
45 Vec xp; // predict solution vector;
46 Vec LTE; // local truncation error vector;
47 Mat J,JPrec,JTmp; // Jacobian matrix
48 PetscInt its; // iteration number
49 PetscReal norm;
51 PetscReal relative_toler;
52 PetscReal toler_relax;
53 PetscReal possion_abs_toler;
54 PetscReal elec_continuty_abs_toler;
55 PetscReal hole_continuty_abs_toler;
56 PetscReal heat_equation_abs_toler;
57 PetscReal elec_energy_abs_toler;
58 PetscReal hole_energy_abs_toler;
59 PetscReal electrode_abs_toler;
61 PetscReal potential_norm;
62 PetscReal electron_norm;
63 PetscReal hole_norm;
64 PetscReal temperature_norm;
65 PetscReal elec_temperature_norm;
66 PetscReal hole_temperature_norm;
67 PetscReal possion_norm;
68 PetscReal elec_continuty_norm;
69 PetscReal hole_continuty_norm;
70 PetscReal heat_equation_norm;
71 PetscReal elec_energy_equation_norm;
72 PetscReal hole_energy_equation_norm;
73 PetscReal electrode_norm;
74 public:
75 int init_solver(SolveDefine &s) ;
76 int do_solve(SolveDefine &s) ;
77 int solve_equ(SolveDefine &s) ;
78 int solve_steadystate(SolveDefine &s) ;
79 int solve_dcsweep(SolveDefine &s) ;
80 int solve_transient(SolveDefine &s) ;
81 int destroy_solver(SolveDefine &s) ;
82 void form_function_pn_3E(PetscScalar *,PetscScalar *) ;
83 void form_jacobian_pn_3E(PetscScalar *, Mat *, Mat *) ;
84 void error_norm_pn_3E(PetscScalar *,PetscScalar *) ;
85 EBM_Solver_L3E():N(0),its(0),norm(0.0),mf_flg(PETSC_FALSE){}
89 #endif