Xyce  6.1
N_DEV_bcData.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2015 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-----------------------------------------------------------------------------
26 // Filename : $RCSfile: N_DEV_bcData.h,v $
27 //
28 // Purpose : This file contains the classes neccessary for a PDE
29 // based diode simulation.
30 //
31 // Special Notes :
32 //
33 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
34 //
35 // Creation Date : 02/28/00
36 //
37 // Revision Information:
38 // ---------------------
39 //
40 // Revision Number: $Revision: 1.20.2.1 $
41 //
42 // Revision Date : $Date: 2015/04/02 18:20:12 $
43 //
44 // Current Owner : $Author: tvrusso $
45 //-----------------------------------------------------------------------------
46 
47 #ifndef Xyce_N_DEV_bcData_h
48 #define Xyce_N_DEV_bcData_h
49 
50 // ---------- Xyce Includes ----------
51 
52 // ---------- Forward Declarations -------
53 #include <iosfwd>
54 
55 namespace Xyce {
56 namespace Device {
57 
58 //-----------------------------------------------------------------------------
59 // Class : bcData
60 //
61 // Purpose : Boundary condition info for a single boundary.
62 //
63 // Special Notes : Kind of like the deviceInterfaceNode class from the 2D
64 // device.
65 //
66 // Creator : Eric Keiter
67 // Creation Date : 04/01/03
68 //-----------------------------------------------------------------------------
69 class bcData
70 {
71 private:
72 protected:
73 public:
74  bcData ():
75  eName(""),
76  nName(""),
77  type("ntype"),
78  index(-1),
79  Vequ(0.0),
80  VequGiven(false),
81  Vckt(0.0),
82  Vckt_orig(0.0),
83  gid(-1),
84  lid(-1), // local ID of the circuit node.
85  lidOffset(-1), // diagonal col in the ckt node matrix row. DMA only.
86  lidlidPtr(0), // diagonal matrix pointer.
87  colArray(),
88  li_colArray(),
89  crossOffsets(),
90  given(false),
91  area(1.0),
92  areaGiven(false),
93  currentSum(0.0), elecCurrent(0.0), holeCurrent(0.0),
94  stateC(-1), stateC_owned(true),
95  li_stateC(-1),
96  meshIndex(0),
97  neighborNode(1),
98  dIdVckt(0.0),
99  dFdVckt(),
100  dIdX(),
101  dIdXcols(),
102  dIdXoffset(),
103  numCrossTerms(0),
104  Vbc(0.0),
105  nnbc(0.0),
106  npbc(0.0),
107  dxdvPtr(0),
108  dxdvAllocated(false),
109  Vckt_old(0.0), Vckt_final(0.0),
110  Vckt_delta(0.0),
111  Vckt_deltaC(0.0),
112  Vckt_ramp(0.0), Vckt_ramp_old(0.0),
113  displCurrent(0.0),
114  material ("neutral"),
115  materialGiven(false),
116  oxideBndryFlag(false),
117  bulkMaterial ("si")
118  {};
119 
120 private:
121 protected:
122 public:
123  // electrode name
124  std::string eName; // device electrode name. Should be in all upper case.
125  std::string nName; // circuit node name.
126  std::string type; // std::string to indicate ntype or ptype.
127 
128  int index; // index w.r.t. the order it was listed in the netlist.
129 
130  // Equilibrium voltage
131  double Vequ;
132  bool VequGiven;
133 
134  // Circuit node voltage
135  double Vckt;
136 
137  // Vckt, before voltage limiting.
138  double Vckt_orig;
139 
140  int gid; // global ID of the circuit node. This is the global
141  // solution vector index. (used like a Vrowarray entry)
142 
143  int lid; // local ID of the circuit node.
144  int lidOffset; // diagonal col in the ckt node matrix row. DMA only.
145  double * lidlidPtr; // lid matrix diagonal pointer.
146 
147  std::vector<int> colArray; // matrix col array for the KCL equation.
148  std::vector<int> li_colArray; // matrix col array for the KCL equation, dma
149 
150  std::vector<int> crossOffsets; // columns for the other ckt nodes.
151 
152  bool given; // did the user specify this node or not. If not, the
153  // device electrode with be (probably) connected to gnd.
154 
155  // geometrical stuff:
156  double area; // total area for the edge.
157  bool areaGiven; // given boolean.
158 
159  // state variable stuff:
160  double currentSum; // sum of currents, to be stored as a state variable.
161  double elecCurrent; // electron current
162  double holeCurrent; // hole current
163 
164  int stateC; // state variable index, current.
166 
167  //local id's (offsets)
169 
170  // mesh index of this electrode:
172  int neighborNode; // node neighboring this boundary.
173 
174  // information needed for the 2-level Newton.
175  double dIdVckt; // derivative of currentSum w.r.t. Vckt.
176 
177  std::vector<double> dFdVckt; // deriv. of residual w.r.t. Vckt.
178 
179  std::vector<double> dIdX; // deriv. of currentSum w.r.t. PDE solution vars.
180  std::vector<int> dIdXcols; // nodes neighboring this boundary.
181  // (this may be the same as colArray, in which
182  // case one of them will be removed...)
183 
184  std::vector<int> dIdXoffset; // If running with DMA, use this instead of
185  // dIdXcols.
186 
188 
189  // boundary conditions to be imposed on V,n and p.
190  double Vbc;
191  double nnbc;
192  double npbc;
193 
194  // dxdv vector:
195  Linear::Vector * dxdvPtr;
197 
198  // These BC variables are only used for Continuation NL solves.
199  // first 3 are w.r.t change in Vckt between ckt iterations. Big change
200  double Vckt_old; // ckt value from the previous Newton solve.
201  double Vckt_final; // eventual ckt voltage value for the current solve.
202  double Vckt_delta; // total change in the Vckt. (Vckt_final-Vckt_old)
203 
204  // next 3, w.r.t change between continuation solves. small change
205  double Vckt_deltaC; // incremental, intermediate change in the Vckt.
206  double Vckt_ramp; // current intermediate value of Vckt used during
207  // continuation.
208  double Vckt_ramp_old; // old intermediate value of Vckt used during
209  // continuation.
210 
211  double displCurrent;
212 
213  // material information:
214  std::string material;
217 
218  std::string bulkMaterial;
219 
220  std::vector<int> volIndices;
221 
222 };
223 // inline functions
224 //-----------------------------------------------------------------------------
225 // Function : bcData::operator<<
226 // Purpose : "<<" operator
227 // Special Notes :
228 // Scope : public
229 // Creator : Eric R. Keiter, 9233, SNL, Parallel Computational Sciences
230 // Creation Date : 11/04/10
231 //-----------------------------------------------------------------------------
232 
233 inline std::ostream & operator<<(std::ostream & os, const bcData & bc)
234 {
235  os << Xyce::section_divider << std::endl;
236  os << "electrode name = " << bc.eName << "\n";
237  os << "node name = " << bc.nName << "\n";
238  os << " index = " << bc.index << "\n";
239 
240  os << " Vequ = " << bc.Vequ << "\n";
241  if (bc.VequGiven)
242  {
243  os << " VequGiven = true\n";
244  }
245  else
246  {
247  os << " VequGiven = false\n";
248  }
249 
250  os << " Vckt = " << bc.Vckt << "\n";
251  os << " Vckt_orig = " << bc.Vckt_orig << "\n";
252  os << " gid = " << bc.gid << "\n";
253  os << " lid = " << bc.lid << "\n";
254  os << " lidOffset = " << bc.lidOffset << "\n";
255  os << " given = " << bc.given << "\n";
256  os << " area = " << bc.area << "\n";
257 
258  if (bc.areaGiven)
259  {
260  os << " areaGiven = true\n";
261  }
262  else
263  {
264  os << " areaGiven = false\n";
265  }
266 
267  os << " currentSum = " << bc.currentSum << "\n";
268  os << " elecCurrent = " << bc.elecCurrent << "\n";
269  os << " holeCurrent = " << bc.holeCurrent << "\n";
270 
271  os << " stateC = " << bc.stateC << "\n";
272  os << " stateC_owned = " << bc.stateC_owned << "\n";
273  os << " li_stateC = " << bc.li_stateC << "\n";
274  os << " meshIndex = " << bc.meshIndex << "\n";
275  os << " neighborNode = " << bc.neighborNode << "\n";
276 
277  os << " dIdVckt = " << bc.dIdVckt << "\n";
278 
279  os << " numCrossTerms = " << bc.numCrossTerms << "\n";
280 
281  os << " Vbc = " << bc.Vbc << "\n";
282  os << " nnbc = " << bc.nnbc << "\n";
283  os << " npbc = " << bc.npbc << "\n";
284 
285 
286  os << "material = " << bc.material << "\n";
287 
288  if (bc.materialGiven)
289  {
290  os << "materialGiven = true\n";
291  }
292  else
293  {
294  os << "materialGiven = false\n";
295  }
296  if (bc.oxideBndryFlag)
297  {
298  os << "oxideBndrFlag = true\n";
299  }
300  else
301  {
302  os << "oxideBndrFlag = false\n";
303  }
304 
305  os << " Vckt_old = " << bc.Vckt_old << "\n";
306  os << " Vckt_final = " << bc.Vckt_final << "\n";
307  os << " Vckt_delta = " << bc.Vckt_delta << "\n";
308  os << " Vckt_deltaC = " << bc.Vckt_deltaC << "\n";
309  os << " Vckt_ramp = " << bc.Vckt_ramp << "\n";
310  os << " Vckt_ramp_old = " << bc.Vckt_ramp_old << "\n";
311  os << " displCurrent = " << bc.displCurrent << "\n";
312 
313  //Linear::Vector * dxdvPtr;
314  if (bc.dxdvAllocated)
315  {
316  os << " dxdvAllocated = true\n";
317  }
318  else
319  {
320  os << " dxdvAllocated = false\n";
321  }
322 
323  int i=0;
324  for (i=0;i<bc.dFdVckt.size();++i)
325  {
326  Xyce::dout() << " dFdVckt["<<i<<"] = " << bc.dFdVckt[i] << "\n";
327  }
328  for (i=0;i<bc.dIdX.size();++i)
329  {
330  Xyce::dout() << " dIdX["<<i<<"] = " << bc.dIdX[i] << "\n";
331  }
332  for (i=0;i<bc.dIdXcols.size();++i)
333  {
334  Xyce::dout() << " dIdXcols["<<i<<"] = " << bc.dIdXcols[i] << "\n";
335  }
336  for (i=0;i<bc.dIdXoffset.size();++i)
337  {
338  Xyce::dout() << " dIdXoffset["<<i<<"] = " << bc.dIdXoffset[i] << "\n";
339  }
340  for (i=0;i<bc.colArray.size();++i)
341  {
342  Xyce::dout() << " collArray["<<i<<"] = " << bc.colArray[i] << "\n";
343  }
344  for (i=0;i<bc.li_colArray.size();++i)
345  {
346  Xyce::dout() << " li_collArray["<<i<<"] = " << bc.li_colArray[i] << "\n";
347  }
348  for (i=0;i<bc.crossOffsets.size();++i)
349  {
350  Xyce::dout() << " crossOffsets["<<i<<"] = " << bc.crossOffsets[i] << "\n";
351  }
352 
353  os << Xyce::section_divider << std::endl;
354  os << std::endl;
355 
356  return os;
357 }
358 
359 } // namespace Device
360 } // namespace Xyce
361 
362 #endif
Pure virtual class to augment a linear system.
std::vector< int > colArray
Definition: N_DEV_bcData.h:147
std::vector< int > volIndices
Definition: N_DEV_bcData.h:220
std::vector< int > li_colArray
Definition: N_DEV_bcData.h:148
std::string bulkMaterial
Definition: N_DEV_bcData.h:218
std::vector< double > dIdX
Definition: N_DEV_bcData.h:179
Linear::Vector * dxdvPtr
Definition: N_DEV_bcData.h:195
std::vector< int > crossOffsets
Definition: N_DEV_bcData.h:150
std::vector< int > dIdXcols
Definition: N_DEV_bcData.h:180
std::string material
Definition: N_DEV_bcData.h:214
std::vector< double > dFdVckt
Definition: N_DEV_bcData.h:177
std::ostream & operator<<(std::ostream &os, const Configuration &configuration)
Definition: N_DEV_Dump.C:134
std::vector< int > dIdXoffset
Definition: N_DEV_bcData.h:184