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