1 /*****************************************************************************/
2 /* 8888888 88888888 88888888 */
5 /* 8 88888888 88888888 */
8 /* 888888 888888888 888888888 */
10 /* A Two-Dimensional General Purpose Semiconductor Simulator. */
13 /* Last update: Apr 21, 2006 */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
19 /*****************************************************************************/
28 //simple error hanfle function
29 inline int read_config_err_handle(char *s
)
31 gss_log
.string_buf()<<s
;
36 /* ----------------------------------------------------------------------------
37 * BSolver::static_config: This function get global config data from CmdParseBuf
39 int BSolver::static_config(CmdBuf
*cmdbuf
)
48 //search the CmdParseBuf. setup global variables
49 for(pcmdbuf
->cmd_search_begin();!pcmdbuf
->cmd_search_end();)
51 if(pcmdbuf
->is_current_cmd("SET")) //it is a set structure
53 list
<Cmd
>::iterator pcmd
= pcmdbuf
->get_current_cmd();
54 if(pcmd
->is_arg_exist("latticetemp"))
55 LatticeTemp
= pcmd
->get_number("latticetemp",0,300.0);
56 if(pcmd
->is_arg_exist("z.width"))
57 DeviceDepth
= pcmd
->get_number("z.width",0,1.0);
58 if(pcmd
->is_arg_exist("dopingscale"))
59 mesh_scale
= pow(pcmd
->get_number("dopingscale",0,1e18
),1.0/3);
60 if(pcmd
->is_arg_exist("carrier"))
62 if(pcmd
->is_arg_value("carrier","pn")) Carrier
=PN_Both
;
63 else if(pcmd
->is_arg_value("carrier","p")) Carrier
=P_Type
;
64 else if(pcmd
->is_arg_value("carrier","n")) Carrier
=N_Type
;
65 else {sprintf(log_buf
,"line %d Set: Unrecognized carrier type!\n",pcmd
->lineno
);GSS_LOG();return 1;}
67 pcmdbuf
->delete_current_cmd();
70 pcmdbuf
->goto_next_cmd();
74 scale_unit
.SetPhysicalUnitScale(mesh_scale
);
75 DeviceDepth
= DeviceDepth
*scale_unit
.s_micron
;
76 LatticeTemp
= LatticeTemp
*scale_unit
.s_kelvin
;
77 set_mesh_scale(scale_unit
.s_centimeter
);
80 //set voltage and current sources
81 if(init_esource(pcmdbuf
->cmd_list
)) return 1;
83 if(init_PMI_Semiconductor(pcmdbuf
,PMIS_define
)) return 1;
85 if(init_doping_func()) return 1;
88 if(init_grid(pcmdbuf
->cmd_list
)) return 1;
92 gss_log
.string_buf()<<"\n";
98 /* ----------------------------------------------------------------------------
99 * BSolver::config_info: This function print global config data to screen
102 void BSolver::show_config_info()
105 gss_log
.string_buf()<<"\n--------------------------------------------------\n";
109 case N_Type
: gss_log
.string_buf()<<"carrier : n only\n";gss_log
.record();break;
110 case P_Type
: gss_log
.string_buf()<<"carrier : p only\n";gss_log
.record();break;
111 case PN_Both
: gss_log
.string_buf()<<"carrier : pn both\n";gss_log
.record();break;
114 gss_log
.string_buf()<<"device Z-width : "<<DeviceDepth
/scale_unit
.s_micron
<< "um\n";
117 gss_log
.string_buf()<<"lattice temprature : "<<LatticeTemp
/scale_unit
.s_kelvin
<< "K\n";
121 /* ----------------------------------------------------------------------------
122 * BSolver::clear_data: This function delete solution data structure
124 void BSolver::clear_data()
126 if(zonedata
.size()==0) return;
127 for(int i
=0;i
<zonedata
.size();i
++)
135 for(int i
=0;i
<vsrc
.size();i
++)
137 for(int i
=0;i
<isrc
.size();i
++)
139 for(int i
=0;i
<doping_func
.size();i
++)
140 delete doping_func
[i
];