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"
29 class QDDM_Solver_L1E
: virtual public BSolver
32 vector
<int> zofs
; // the offset value of each zone in solution vector
34 SNESConvergedReason reason
;
35 void solver_pre_compute() ;
36 void solver_post_compute() ;
37 void solution_update() ;
38 void diverged_recovery() ;
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 Mat J
,JPrec
,JTmp
; // Jacobian matrix
46 PetscInt its
; // iteration number
49 PetscReal relative_toler
;
50 PetscReal toler_relax
;
52 PetscReal possion_abs_toler
;
53 PetscReal elec_continuty_abs_toler
;
54 PetscReal hole_continuty_abs_toler
;
55 PetscReal elec_quantum_abs_toler
;
56 PetscReal hole_quantum_abs_toler
;
57 PetscReal electrode_abs_toler
;
59 PetscReal possion_norm
;
60 PetscReal elec_continuty_norm
;
61 PetscReal hole_continuty_norm
;
62 PetscReal elec_quantum_norm
;
63 PetscReal hole_quantum_norm
;
64 PetscReal electrode_norm
;
67 int init_solver(SolveDefine
&s
) ;
68 int do_solve(SolveDefine
&s
) ;
69 int solve_equ(SolveDefine
&s
) ;
70 int solve_steadystate(SolveDefine
&s
) ;
71 int solve_dcsweep(SolveDefine
&s
) ;
72 int solve_transient(SolveDefine
&s
) ;
73 int destroy_solver(SolveDefine
&s
) ;
75 void form_function_pn_1Q(PetscScalar
*,PetscScalar
*) ;
76 void form_jacobian_pn_1Q(PetscScalar
*, Mat
*,Mat
*) ;
77 void error_norm_pn_1Q(PetscScalar
*,PetscScalar
*) ;