1 /*****************************************************************************/
2 /* 8888888 88888888 88888888 */
5 /* 8 88888888 88888888 */
8 /* 888888 888888888 888888888 */
10 /* A Two-Dimensional General Purpose Semiconductor Simulator. */
13 /* Last update: Jan 19, 2006 */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
19 /*****************************************************************************/
25 #include "petscsnes.h"
28 class DDM_Solver_L1E
: virtual public BSolver
31 vector
<int> zofs
; // the offset value of each zone in solution vector
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
&);
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
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
;
62 PetscReal possion_norm
;
63 PetscReal elec_continuty_norm
;
64 PetscReal hole_continuty_norm
;
65 PetscReal electrode_norm
;
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
) {}