initial checkin, based on GSS 0.46 CVS
[gss-tcad.git] / src / include / ddm_nt1e.h
blobeacd3361640fbda724bd42929f14ad507fae2794
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_nt1e_h_
22 #define _ddm_nt1e_h_
24 #include "petscts.h"
25 #include "petscsnes.h"
26 #include "bsolver.h"
28 class DDM_Solver_L1E : virtual public BSolver
30 private:
31 vector<int> zofs; // the offset value of each zone in solution vector
32 PetscTruth mf_flg;
33 SNESConvergedReason reason;
34 void solver_pre_compute();
35 void solver_post_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 electrode_abs_toler;
59 PetscReal potential_norm;
60 PetscReal electron_norm;
61 PetscReal hole_norm;
62 PetscReal possion_norm;
63 PetscReal elec_continuty_norm;
64 PetscReal hole_continuty_norm;
65 PetscReal electrode_norm;
67 public:
68 int init_solver(SolveDefine &s) ;
69 int do_solve(SolveDefine &s);
70 int solve_equ(SolveDefine &s);
71 int solve_steadystate(SolveDefine &s);
72 int solve_dcsweep(SolveDefine &s);
73 int solve_transient(SolveDefine &s);
74 int solve_iv_trace(SolveDefine &s);
75 int destroy_solver(SolveDefine &s);
76 void form_function_pn_1E(PetscScalar *,PetscScalar *);
77 void form_jacobian_pn_1E(PetscScalar *, Mat *,Mat *);
78 void error_norm_estimat(PetscScalar *,PetscScalar *);
79 DDM_Solver_L1E():N(0),its(0),norm(0.0),mf_flg(PETSC_FALSE) {}
83 #endif