Xyce  6.1
N_DEV_2DPDEParam.C
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_2DPDEParam.C,v $
27 //
28 // Purpose : This class only contains the instance processParams
29 // function. This was a big enough, confusing enough,
30 // function, that I decided to give it its own file. Most
31 // of the functions that are called from here can be found
32 // in N_DEV_2DPDESetup.C.
33 //
34 // Special Notes :
35 //
36 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
37 //
38 // Creation Date : 07/15/03
39 //
40 // Revision Information:
41 // ---------------------
42 //
43 // Revision Number: $Revision: 1.60 $
44 //
45 // Revision Date : $Date: 2015/04/08 19:18:25 $
46 //
47 // Current Owner : $Author: tvrusso $
48 //-------------------------------------------------------------------------
49 
50 #include <Xyce_config.h>
51 
52 // ---------- Standard Includes ----------
53 #include <iostream>
54 
55 // ---------- Xyce Includes ----------
56 #include <N_DEV_2DPDE.h>
57 #include <N_DEV_PDE_2DMesh.h>
58 #include <N_DEV_SourceData.h>
59 #include <N_DEV_DeviceOptions.h>
60 
61 namespace Xyce {
62 namespace Device {
63 namespace TwoDPDE {
64 
65 //-----------------------------------------------------------------------------
66 // Function : Instance::processParams
67 //
68 // Purpose : This function processes the user-specified parameters.
69 // This includes setting up the mesh.
70 //
71 // Special Notes : There are three modes in which processParams can
72 // be called:
73 //
74 // 1) Initialization of the class, for a standard simulation.
75 //
76 // 2) perturbing away from the original as part of a sensitivity
77 // calculation, in order to obtain a numerical df/dp.
78 //
79 // 3) restoring the device to its normal, unperturbed state.
80 //
81 // Call (1) is obviously the most common, and happens at
82 // the beginning of any simulation. This call will have
83 // no parameter argument.
84 //
85 // Calls (2) and (3) only happen for sensitivity calculations,
86 // and they always come in pairs. Anytime a (2) style call
87 // happens, it should be followed shortly by a (3) call.
88 //
89 // Call (2) will have a parameter argument, specifying which
90 // param to perturb. Call (3) doesn't have a param argument,
91 // and for most devices is identical to a call (1). However,
92 // for the PDE case, it doesn't makes sense to reallocate all
93 // the mesh stuff, so it just restores old values of the mesh
94 // from a copy.
95 //
96 // Scope : public
97 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
98 // Creation Date : 6/03/02
99 //-----------------------------------------------------------------------------
101 {
102  bool bsuccess = true;
103 
104  return bsuccess;
105 }
106 
107 
108 //-----------------------------------------------------------------------------
109 // Function : Instance::processDopingParams
110 // Purpose :
111 // Special Notes :
112 // Scope : public
113 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
114 // Creation Date : 4/04/04
115 //-----------------------------------------------------------------------------
116 bool Instance::processDopingParams (Param & ndParam, std::string param)
117 {
118  ExtendedString tagES = ndParam.tag ();
119  tagES.toLower ();
120 
121  // Start of the new doping section:
122  //string tmpTag (tagES,0,3);
123  if (std::string(tagES,0,3) == "reg" && ndParam.given())
124  //if dope region param, continue:
125  {
126  // the new metadata doesn't have a limitation on the number of
127  // regions.
128 
129  // first find the "." character.
130  int periodLocation = 0;
131  bool foundPeriod = false;
132  for (int iloc=0;iloc<tagES.size();++iloc)
133  {
134  std::string singleChar(tagES,iloc,1);
135  if (singleChar == ".")
136  {
137  periodLocation = iloc;
138  foundPeriod = true;
139  break;
140  }
141  }
142  if (!foundPeriod)
143  {
144  std::string msg =
145  "::processDopingParams. The region specification needs a period\n";
146  N_ERH_ErrorMgr::report( N_ERH_ErrorMgr::DEV_FATAL_0,msg);
147  }
148 
149  std::string regionName(tagES,0,periodLocation);
150 
151  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
152  {
153  Xyce::dout() << "tagES = "<< tagES;
154  Xyce::dout() << " regionName = "<< regionName;
155  Xyce::dout() << " param: " << ndParam.stringValue() << std::endl;
156  }
157 
158  if ( dopeInfoMap.find(regionName) == dopeInfoMap.end() )
159  {
160  dopeInfoMap[regionName] = new DopeInfo();
161  dopeInfoMap[regionName]->name = regionName;
162  }
163 
164  // The actual processing of the parameter is handled in the DopeInfo
165  // class.
166  dopeInfoMap[regionName]->processParam (ndParam, param, *this);
167 
168  }
169  // End of the new doping section.
170 
171  return true;
172 }
173 //-----------------------------------------------------------------------------
174 // Function : Instance::processElectrodeParams
175 // Purpose :
176 // Special Notes :
177 // Scope : public
178 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
179 // Creation Date : 6/18/04
180 //-----------------------------------------------------------------------------
182 {
183 
184  ExtendedString tagES = ndParam.tag ();
185  tagES.toLower ();
186 
187  if (std::string(tagES,0,4) == "node" && ndParam.given() )
188  {
189  int periodLocation = 5;
190 
191  // Now that we've determined that this is an electrode parameter,
192  // ( and not one of the older "legacy" parameters )
193  // check if an electrode with this name already exists in the
194  // map.
195 
196  // If so, just modify the existing electrode. If not, add it
197  // to the map, with a set of default params (created by the
198  // default constructor).
199  //
200  // get the name by searching for the ".", just like in the case for
201  // the region specification.
202  // the new metadata doesn't have a limitation on the number of
203  // nodes.
204 
205  // first find the "." character.
206  periodLocation = 0;
207  bool foundPeriod = false;
208  for (int iloc=0;iloc<tagES.size();++iloc)
209  {
210  std::string singleChar(tagES,iloc,1);
211  if (singleChar == ".")
212  {
213  periodLocation = iloc;
214  foundPeriod = true;
215  break;
216  }
217  }
218 
219  // if no period is found, then report an error.
220  // At this point, node1 and node1bc style specifications have
221  // already been trapped for.
222  if (!foundPeriod)
223  {
224  std::string msg =
225  "::processParams. The node specification needs a period\n";
226  N_ERH_ErrorMgr::report( N_ERH_ErrorMgr::DEV_FATAL_0,msg);
227  }
228 
229  std::string nodeName(tagES,0,periodLocation);
230  if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
231  {
232  Xyce::dout() << "tagES = "<< tagES << std::endl;
233  Xyce::dout() << "nodeName = "<< nodeName << std::endl;
234  }
235 
236  if ( electrodeMap.find(nodeName) == electrodeMap.end() )
237  {
238  PDE_2DElectrode * elPtr = new PDE_2DElectrode ();
239  elPtr->nodeName = nodeName;
240  electrodeMap[nodeName] = elPtr;
241  }
242 
243  // now do the actual processing of the param.
244  int tagSize = tagES.size();
245 
246  if (tagSize > periodLocation+1)
247  {
248  std::string tmpParam(tagES,periodLocation+1,tagSize);
249 
250  if (tmpParam == "name")
251  {
252  DeviceInterfaceNode dINode;
253  ExtendedString dIName = ndParam.stringValue();
254  dIName.toUpper ();
255 
256  dINode.eName = dIName;
257  dINode.nName = nodeName;
258  dINode.given = ndParam.given();
259  dINode.index = 0;
260 
261  if (dINode.given) ++numElectrodes;
262  if (dINode.given) dIVec.push_back(dINode);
263  }
264 
265  if (tmpParam == "bc")
266  {
267  ExtendedString nmName = ndParam.stringValue();
268  nmName.toUpper ();
269  if (nmName == "NEUMANN" ||
270  nmName == "MIXED" )
271  {
272  tmpBCmap[nodeName] = nmName;
273  Xyce::dout() << "found a neumann. name = " << tagES << std::endl;
274  }
275  }
276 
277  if (tmpParam == "side")
278  {
279  if (ndParam.given())
280  {
281  ExtendedString tmpstr = ndParam.stringValue();
282  tmpstr.toLower ();
283  electrodeMap[nodeName]->side = tmpstr;
284  electrodeMap[nodeName]->sideGiven = true;
285  }
286  }
287 
288  if (tmpParam == "start")
289  {
290  electrodeMap[nodeName]->start = ndParam.getImmutableValue<double>();
291  electrodeMap[nodeName]->startGiven = ndParam.given ();
292  }
293 
294  if (tmpParam == "end")
295  {
296  electrodeMap[nodeName]->end = ndParam.getImmutableValue<double>();
297  electrodeMap[nodeName]->endGiven = ndParam.given ();
298  }
299 
300  if (tmpParam == "material")
301  {
302  ExtendedString tmpName = ndParam.stringValue();
303  tmpName.toLower();
304  electrodeMap[nodeName]->material = tmpName;
305  electrodeMap[nodeName]->materialGiven = ndParam.given ();
306  }
307 
308  if (tmpParam == "oxidebndryflag")
309  {
310  if (ndParam.given() && ndParam.getImmutableValue<int>() == 1)
311  electrodeMap[nodeName]->oxideBndryFlag = true;
312  else
313  electrodeMap[nodeName]->oxideBndryFlag = false;
314  }
315 
316  if (tmpParam == "oxthick")
317  {
318  electrodeMap[nodeName]->oxthick = ndParam.getImmutableValue<double>();
319  }
320 
321  if (tmpParam == "oxcharge")
322  {
323  electrodeMap[nodeName]->oxcharge = ndParam.getImmutableValue<double>();
324  }
325  }
326  }
327 
328  return true;
329 }
330 
331 } // namespace TwoDPDE
332 } // namespace Device
333 } // namespace Xyce
bool processElectrodeParams(Param &ndParam)
Pure virtual class to augment a linear system.
bool given() const
Definition: N_DEV_Param.h:114
std::map< std::string, PDE_2DElectrode * > electrodeMap
Definition: N_DEV_2DPDE.h:508
std::vector< DeviceInterfaceNode > dIVec
Definition: N_DEV_2DPDE.h:291
std::map< std::string, DopeInfo * > dopeInfoMap
bool processDopingParams(Param &ndParam, std::string param)
std::map< std::string, std::string > tmpBCmap
Definition: N_DEV_2DPDE.h:496