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