Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-2014 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.19 $
41 //
42 // Revision Date : $Date: 2014/04/08 23:30:28 $
43 //
44 // Current Owner : $Author: erkeite $
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 //-----------------------------------------------------------------------------
56 // Class : bcData
57 //
58 // Purpose : Boundary condition info for a single boundary.
59 //
60 // Special Notes : Kind of like the deviceInterfaceNode class from the 2D
61 // device.
62 //
63 // Creator : Eric Keiter
64 // Creation Date : 04/01/03
65 //-----------------------------------------------------------------------------
66 class bcData
67 {
68 private:
69 protected:
70 public:
71  bcData ():
72  eName(""),
73  nName(""),
74  type("ntype"),
75  index(-1),
76  Vequ(0.0),
77  VequGiven(false),
78  Vckt(0.0),
79  Vckt_orig(0.0),
80  gid(-1),
81  lid(-1), // local ID of the circuit node.
82  lidOffset(-1), // diagonal col in the ckt node matrix row. DMA only.
83  lidlidPtr(0), // diagonal matrix pointer.
84  colArray(),
85  li_colArray(),
86  crossOffsets(),
87  given(false),
88  area(1.0),
89  areaGiven(false),
90  currentSum(0.0), elecCurrent(0.0), holeCurrent(0.0),
91  stateC(-1), stateC_owned(true),
92  li_stateC(-1),
93  meshIndex(0),
94  neighborNode(1),
95  dIdVckt(0.0),
96  dFdVckt(),
97  dIdX(),
98  dIdXcols(),
99  dIdXoffset(),
100  numCrossTerms(0),
101  Vbc(0.0),
102  nnbc(0.0),
103  npbc(0.0),
104  dxdvPtr(0),
105  dxdvAllocated(false),
106  Vckt_old(0.0), Vckt_final(0.0),
107  Vckt_delta(0.0),
108  Vckt_deltaC(0.0),
109  Vckt_ramp(0.0), Vckt_ramp_old(0.0),
110  displCurrent(0.0),
111  material ("neutral"),
112  materialGiven(false),
113  oxideBndryFlag(false),
114  bulkMaterial ("si")
115  {};
116 
117 private:
118 protected:
119 public:
120  // electrode name
121  std::string eName; // device electrode name. Should be in all upper case.
122  std::string nName; // circuit node name.
123  std::string type; // std::string to indicate ntype or ptype.
124 
125  int index; // index w.r.t. the order it was listed in the netlist.
126 
127  // Equilibrium voltage
128  double Vequ;
129  bool VequGiven;
130 
131  // Circuit node voltage
132  double Vckt;
133 
134  // Vckt, before voltage limiting.
135  double Vckt_orig;
136 
137  int gid; // global ID of the circuit node. This is the global
138  // solution vector index. (used like a Vrowarray entry)
139 
140  int lid; // local ID of the circuit node.
141  int lidOffset; // diagonal col in the ckt node matrix row. DMA only.
142  double * lidlidPtr; // lid matrix diagonal pointer.
143 
144  std::vector<int> colArray; // matrix col array for the KCL equation.
145  std::vector<int> li_colArray; // matrix col array for the KCL equation, dma
146 
147  std::vector<int> crossOffsets; // columns for the other ckt nodes.
148 
149  bool given; // did the user specify this node or not. If not, the
150  // device electrode with be (probably) connected to gnd.
151 
152  // geometrical stuff:
153  double area; // total area for the edge.
154  bool areaGiven; // given boolean.
155 
156  // state variable stuff:
157  double currentSum; // sum of currents, to be stored as a state variable.
158  double elecCurrent; // electron current
159  double holeCurrent; // hole current
160 
161  int stateC; // state variable index, current.
163 
164  //local id's (offsets)
166 
167  // mesh index of this electrode:
169  int neighborNode; // node neighboring this boundary.
170 
171  // information needed for the 2-level Newton.
172  double dIdVckt; // derivative of currentSum w.r.t. Vckt.
173 
174  std::vector<double> dFdVckt; // deriv. of residual w.r.t. Vckt.
175 
176  std::vector<double> dIdX; // deriv. of currentSum w.r.t. PDE solution vars.
177  std::vector<int> dIdXcols; // nodes neighboring this boundary.
178  // (this may be the same as colArray, in which
179  // case one of them will be removed...)
180 
181  std::vector<int> dIdXoffset; // If running with DMA, use this instead of
182  // dIdXcols.
183 
185 
186  // boundary conditions to be imposed on V,n and p.
187  double Vbc;
188  double nnbc;
189  double npbc;
190 
191  // dxdv vector:
192  N_LAS_Vector * dxdvPtr;
194 
195  // These BC variables are only used for Continuation NL solves.
196  // first 3 are w.r.t change in Vckt between ckt iterations. Big change
197  double Vckt_old; // ckt value from the previous Newton solve.
198  double Vckt_final; // eventual ckt voltage value for the current solve.
199  double Vckt_delta; // total change in the Vckt. (Vckt_final-Vckt_old)
200 
201  // next 3, w.r.t change between continuation solves. small change
202  double Vckt_deltaC; // incremental, intermediate change in the Vckt.
203  double Vckt_ramp; // current intermediate value of Vckt used during
204  // continuation.
205  double Vckt_ramp_old; // old intermediate value of Vckt used during
206  // continuation.
207 
208  double displCurrent;
209 
210  // material information:
211  std::string material;
214 
215  std::string bulkMaterial;
216 
217  std::vector<int> volIndices;
218 
219 };
220 // inline functions
221 //-----------------------------------------------------------------------------
222 // Function : bcData::operator<<
223 // Purpose : "<<" operator
224 // Special Notes :
225 // Scope : public
226 // Creator : Eric R. Keiter, 9233, SNL, Parallel Computational Sciences
227 // Creation Date : 11/04/10
228 //-----------------------------------------------------------------------------
229 
230 inline std::ostream & operator<<(std::ostream & os, const bcData & bc)
231 {
232  os << Xyce::section_divider << std::endl;
233  os << "electrode name = " << bc.eName << "\n";
234  os << "node name = " << bc.nName << "\n";
235  os << " index = " << bc.index << "\n";
236 
237  os << " Vequ = " << bc.Vequ << "\n";
238  if (bc.VequGiven)
239  {
240  os << " VequGiven = true\n";
241  }
242  else
243  {
244  os << " VequGiven = false\n";
245  }
246 
247  os << " Vckt = " << bc.Vckt << "\n";
248  os << " Vckt_orig = " << bc.Vckt_orig << "\n";
249  os << " gid = " << bc.gid << "\n";
250  os << " lid = " << bc.lid << "\n";
251  os << " lidOffset = " << bc.lidOffset << "\n";
252  os << " given = " << bc.given << "\n";
253  os << " area = " << bc.area << "\n";
254 
255  if (bc.areaGiven)
256  {
257  os << " areaGiven = true\n";
258  }
259  else
260  {
261  os << " areaGiven = false\n";
262  }
263 
264  os << " currentSum = " << bc.currentSum << "\n";
265  os << " elecCurrent = " << bc.elecCurrent << "\n";
266  os << " holeCurrent = " << bc.holeCurrent << "\n";
267 
268  os << " stateC = " << bc.stateC << "\n";
269  os << " stateC_owned = " << bc.stateC_owned << "\n";
270  os << " li_stateC = " << bc.li_stateC << "\n";
271  os << " meshIndex = " << bc.meshIndex << "\n";
272  os << " neighborNode = " << bc.neighborNode << "\n";
273 
274  os << " dIdVckt = " << bc.dIdVckt << "\n";
275 
276  os << " numCrossTerms = " << bc.numCrossTerms << "\n";
277 
278  os << " Vbc = " << bc.Vbc << "\n";
279  os << " nnbc = " << bc.nnbc << "\n";
280  os << " npbc = " << bc.npbc << "\n";
281 
282 
283  os << "material = " << bc.material << "\n";
284 
285  if (bc.materialGiven)
286  {
287  os << "materialGiven = true\n";
288  }
289  else
290  {
291  os << "materialGiven = false\n";
292  }
293  if (bc.oxideBndryFlag)
294  {
295  os << "oxideBndrFlag = true\n";
296  }
297  else
298  {
299  os << "oxideBndrFlag = false\n";
300  }
301 
302  os << " Vckt_old = " << bc.Vckt_old << "\n";
303  os << " Vckt_final = " << bc.Vckt_final << "\n";
304  os << " Vckt_delta = " << bc.Vckt_delta << "\n";
305  os << " Vckt_deltaC = " << bc.Vckt_deltaC << "\n";
306  os << " Vckt_ramp = " << bc.Vckt_ramp << "\n";
307  os << " Vckt_ramp_old = " << bc.Vckt_ramp_old << "\n";
308  os << " displCurrent = " << bc.displCurrent << "\n";
309 
310  //N_LAS_Vector * dxdvPtr;
311  if (bc.dxdvAllocated)
312  {
313  os << " dxdvAllocated = true\n";
314  }
315  else
316  {
317  os << " dxdvAllocated = false\n";
318  }
319 
320  int i=0;
321  for (i=0;i<bc.dFdVckt.size();++i)
322  {
323  Xyce::dout() << " dFdVckt["<<i<<"] = " << bc.dFdVckt[i] << "\n";
324  }
325  for (i=0;i<bc.dIdX.size();++i)
326  {
327  Xyce::dout() << " dIdX["<<i<<"] = " << bc.dIdX[i] << "\n";
328  }
329  for (i=0;i<bc.dIdXcols.size();++i)
330  {
331  Xyce::dout() << " dIdXcols["<<i<<"] = " << bc.dIdXcols[i] << "\n";
332  }
333  for (i=0;i<bc.dIdXoffset.size();++i)
334  {
335  Xyce::dout() << " dIdXoffset["<<i<<"] = " << bc.dIdXoffset[i] << "\n";
336  }
337  for (i=0;i<bc.colArray.size();++i)
338  {
339  Xyce::dout() << " collArray["<<i<<"] = " << bc.colArray[i] << "\n";
340  }
341  for (i=0;i<bc.li_colArray.size();++i)
342  {
343  Xyce::dout() << " li_collArray["<<i<<"] = " << bc.li_colArray[i] << "\n";
344  }
345  for (i=0;i<bc.crossOffsets.size();++i)
346  {
347  Xyce::dout() << " crossOffsets["<<i<<"] = " << bc.crossOffsets[i] << "\n";
348  }
349 
350  os << Xyce::section_divider << std::endl;
351  os << std::endl;
352 
353  return os;
354 }
355 
356 #endif