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 DDM_Solver_L2E
: 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 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 heat_equation_abs_toler
;
58 PetscReal electrode_abs_toler
;
60 PetscReal potential_norm
;
61 PetscReal electron_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
;
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
){}