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 */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
19 /*****************************************************************************/
25 #include "petscsnes.h"
30 class DDM_Mix_Solver_L1E
: virtual public BSolver
33 vector
<int> zofs
; // the offset value of each zone in solution vector
35 int listener
; // Our listening socket.
36 int client
; // The current client's socket.
38 sDeviceinfo Deviceinfo
; // the numerical device information passed from ngspice
39 sPINinfo PINinfos
[7]; // the pin voltage and conduction matrix enties.
40 sPINcond PINconds
[7]; // structure for calculate pin conductance matrix entries.
42 int N
; // the scale if matrix
43 SNES snes
; // nonlinear solver context
44 KSP ksp
; // linear solver context
45 PC pc
; // preconditioner context
46 Vec x
,r
; // solution, residual vectors
47 Mat J
,JTmp
; // Jacobian matrix
48 PetscInt its
; // iteration number
50 SNESConvergedReason reason
;
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
;
58 PetscReal potential_norm
;
59 PetscReal electron_norm
;
61 PetscReal possion_norm
;
62 PetscReal elec_continuty_norm
;
63 PetscReal hole_continuty_norm
;
67 int init_solver(SolveDefine
&s
) ;
68 int do_solve(SolveDefine
&s
) ;
69 int destroy_solver(SolveDefine
&s
) ;
71 DDM_Mix_Solver_L1E():N(0),its(0),norm(0.0) {} ;
72 ~DDM_Mix_Solver_L1E() {};
73 void form_function_pn_Mix1(PetscScalar
*x
,PetscScalar
*f
);
74 void form_jacobian_pn_Mix1(PetscScalar
*x
, Mat
*jac
, Mat
*jtmp
);
75 void error_norm_pn_Mix1(PetscScalar
*x
,PetscScalar
*f
);
81 void solution_update();
82 void time_back_recovery();
83 void diverged_recovery();