fix portability.
[gss-tcad.git] / src / include / mix2.h
blob31a8dfd0700be255d2dcfcc8bd937e35fd7024be
1 /*****************************************************************************/
2 /* 8888888 88888888 88888888 */
3 /* 8 8 8 */
4 /* 8 8 8 */
5 /* 8 88888888 88888888 */
6 /* 8 8888 8 8 */
7 /* 8 8 8 8 */
8 /* 888888 888888888 888888888 */
9 /* */
10 /* A Two-Dimensional General Purpose Semiconductor Simulator. */
11 /* */
12 /* GSS 0.4x */
13 /* Last update: March 29, 2007 */
14 /* */
15 /* Gong Ding gdiso@ustc.edu */
16 /* Xuan Chun xiaomoyu505@163.com */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
18 /* */
19 /*****************************************************************************/
21 #ifndef _mix2_h_
22 #define _mix2_h_
24 #include "petscts.h"
25 #include "petscsnes.h"
26 #include "bsolver.h"
27 #include "ndevexch.h"
28 #include "mixcomm.h"
31 class DDM_Mix_Solver_L2E : virtual public BSolver
33 private:
34 vector<int> zofs; // the offset value of each zone in solution vector
35 SolveDefine *psv;
36 int listener; // Our listening socket.
37 int client; // The current client's socket.
38 sCKTinfo CKTInfo;
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.
42 public:
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
50 PetscReal norm;
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;
62 PetscReal hole_norm;
63 PetscReal temperature_norm;
64 PetscReal possion_norm;
65 PetscReal elec_continuty_norm;
66 PetscReal hole_continuty_norm;
67 PetscReal heat_equation_norm;
70 public:
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);
80 int DEV_LOAD();
81 int DEV_ACCEPT();
82 int DEV_CONV_TEST();
83 int tran_solve();
84 int dc_solve();
85 void solution_update();
86 void time_back_recovery();
87 void diverged_recovery();
93 #endif