1 /*****************************************************************************/
2 /* 8888888 88888888 88888888 */
5 /* 8 88888888 88888888 */
8 /* 888888 888888888 888888888 */
10 /* A Two-Dimensional General Purpose Semiconductor Simulator. */
13 /* Last update: March 29, 2007 */
15 /* Gong Ding gdiso@ustc.edu */
16 /* Xuan Chun xiaomoyu505@163.com */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
19 /*****************************************************************************/
25 #include "petscsnes.h"
31 class DDM_Mix_Solver_L2E
: virtual public BSolver
34 vector
<int> zofs
; // the offset value of each zone in solution vector
36 int listener
; // Our listening socket.
37 int client
; // The current client's socket.
39 sDeviceinfo Deviceinfo
; // the numerical device information passed from ngspice
40 sPINinfo PINinfos
[7]; // the pin voltage and conduction matrix enties.
41 sPINcond PINconds
[7]; // structure for calculate pin conductance matrix entries.
43 int N
; // the scale of matrix
44 SNES snes
; // nonlinear solver context
45 KSP ksp
; // linear solver context
46 PC pc
; // preconditioner context
47 Vec x
,r
; // solution, residual vectors
48 Mat J
,JTmp
; // Jacobian matrix
49 PetscInt its
; // iteration number
51 SNESConvergedReason reason
;
53 PetscReal relative_toler
;
54 PetscReal toler_relax
;
55 PetscReal possion_abs_toler
;
56 PetscReal elec_continuty_abs_toler
;
57 PetscReal hole_continuty_abs_toler
;
58 PetscReal heat_equation_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
;
71 int init_solver(SolveDefine
&s
) ;
72 int do_solve(SolveDefine
&s
) ;
73 int destroy_solver(SolveDefine
&s
) ;
75 DDM_Mix_Solver_L2E():N(0),its(0),norm(0.0) {} ;
76 ~DDM_Mix_Solver_L2E() {};
77 void form_function_pn_Mix2(PetscScalar
*x
,PetscScalar
*f
);
78 void form_jacobian_pn_Mix2(PetscScalar
*x
, Mat
*jac
, Mat
*jtmp
);
79 void error_norm_pn_Mix2(PetscScalar
*x
,PetscScalar
*f
);
85 void solution_update();
86 void time_back_recovery();
87 void diverged_recovery();