Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_TIA_TIAParams.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-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_TIA_TIAParams.C,v $
27 //
28 // Purpose : This file implements the class associated with all user
29 // specified parameters which relate to the time integration
30 // algorithms and problem definition.
31 //
32 // Special Notes :
33 //
34 // Creator : Buddy Watts
35 //
36 // Creation Date : 6/1/00
37 //
38 // Revision Information:
39 // ---------------------
40 //
41 // Revision Number: $Revision: 1.124 $
42 //
43 // Revision Date : $Date: 2014/08/07 23:08:55 $
44 //
45 // Current Owner : $Author: dgbaur $
46 //-----------------------------------------------------------------------------
47 
48 #include <Xyce_config.h>
49 
50 
51 // ---------- Standard Includes ----------
52 
53 #include <N_UTL_Misc.h>
54 
55 #ifdef HAVE_IOSTREAM
56 #include <iostream>
57 #else
58 #include <iostream.h>
59 #endif
60 
61 #include <string>
62 
63 // ---------- Xyce Includes ----------
64 #include <N_ANP_AnalysisManager.h>
66 #include <N_TIA_TIAParams.h>
67 #include <N_ERH_ErrorMgr.h>
68 
69 // -------- Forward declaration -----------
70 #include <N_IO_CmdParse.h>
71 
72 //-----------------------------------------------------------------------------
73 // Function : N_TIA_TIAParams::N_TIA_TIAParams
74 // Purpose : constructor
75 // Special Notes :
76 // Scope : public
77 // Creator : Buddy Watts, SNL
78 // Creation Date : 6/01/00
79 //-----------------------------------------------------------------------------
80 
82  :
83  commandLine(&cp),
84  tStart(0.0),
85  tStartGiven(false),
86  initialTime(0.0),
87  finalTime(0.0),
88  pauseTime(0.0),
89  pauseSetAtZero(false),
90  integrationMethod(7),
91  userSpecified_startingTimeStep(1.0e-10),
92  maxTimeStep(1.0e+99),
93  maxTimeStepGiven(false),
94  userSpecMinTimeStep(0.0),
95  userSpecMinTimeStepGiven(false),
96  constantStepSize(false),
97  useDeviceTimeStepMax(true),
98  restartingIntegrationFromSSS(false),
99  newBPStepping(true),
100 // newBPStepping(false),
101  minTimeStepsBP(10),
102 // minTimeStepsBPGiven(true),
103  minTimeStepsBPGiven(false),
104 // newLte(false),
105  newLte(true),
106  errorAnalysisOption(0),
107  NLmin(3),
108  NLmax(8),
109  TimeStepLimitedbyBP(false),
110  delmax(1.0e+99),
111  delmaxGiven(false),
112  errorAnalysisOptionResetIter(0),
113  timestepsReversal(false),
114  testFirstStep(false),
115  solutionSize(0),
116  stateSize(0),
117  relErrorTol(1.0e-3),
118 // relErrorTol(1.0e-2),
119  absErrorTol(1.0e-6),
120  relErrorTolGiven(false),
121  errTolAcceptance(1.0),
122 // errTolAcceptance(0.6859),
123  NOOP(false),
124  resume(false),
125 //#ifdef Xyce_MPDE
126 // sweepSteps(1),
127 //#else
128  sweepSteps(0),
129 //#endif // Xyce_MPDE
130  doubleDCOPStep(0),
131  firstDCOPStep(0),
132  lastDCOPStep(1),
133  exitTime(0.0),
134  exitStep(-1),
135 #ifdef Xyce_DEBUG_TIME
136  debugLevel(1),
137 #else
138  debugLevel(0),
139 #endif
140  bpEnable(true),
141  restartTimeStepScale(0.005),
142 // nlNearConvFlag(true),
143  nlNearConvFlag(false),
144  nlSmallUpdateFlag(true),
145  jacLimitFlag(false),
146  jacLimit(1.0e+17),
147  maxOrder(5),
148  minOrder(1),
149 // freq(0.0),
150 // freq2(0.0),
151 // freq2Given(false),
152  freqGiven(false),
153  type("DEC"),
154  np(10.0),
155  fStart(1.0),
156  fStop(1.0),
157  ROMsize(-1),
158  morMethod("PRIMA"),
159  morSaveRedSys(false),
160  morCompOrigTF(false),
161  morCompRedTF(false),
162  morCompType("DEC"),
163  morCompNP(10),
164  morCompFStart(1.0),
165  morCompFStop(1.0),
166  morExpPoint(0.0),
167  morScaleFactor(1.0),
168  morScaleType(0),
169  morScaleFactor1(0.01),
170  morSparsificationType(0),
171  outputInterpMPDE(true),
172  interpOutputFlag(true),
173  condTestFlag(false),
174  saveTimeStepsFlag(false),
175  passNLStall(false),
176  minTimeStepRecoveryCounter(0),
177  fastTests(false),
178  voltZeroTol(1.0e-6),
179  currZeroTol(1.0e-6),
180  historyTrackingDepth(25)
181 {
182  scalarTolerances = true;
183 
184  freqs.clear();
185 #ifdef Xyce_DEBUG_TIME
186  // override default debug level based on command line options
187  if ( commandLine->argExists( "-tdl" ) )
188  {
189  debugLevel = atoi( commandLine->getArgumentValue( "-tdl" ).c_str() );
190  }
191 #endif
192 }
193 
194 //-----------------------------------------------------------------------------
195 // Function : N_TIA_TIAParams::N_TIA_TIAParams
196 // Purpose : destructor
197 // Special Notes :
198 // Scope : public
199 // Creator : Buddy Watts, SNL
200 // Creation Date : 6/01/00
201 //-----------------------------------------------------------------------------
202 
204 {
205 
206 }
207 
208 //-----------------------------------------------------------------------------
209 // Function : N_TIA_TIAParams::printParams
210 // Purpose :
211 // Special Notes :
212 // Scope : public
213 // Creator : Eric Keiter, 9233.
214 // Creation Date : 7/12/01
215 //-----------------------------------------------------------------------------
216 void N_TIA_TIAParams::printParams(std::ostream &os, int analysis)
217 {
218  os << "\n" << std::endl;
219  os << Xyce::section_divider << std::endl;
220  os << "\n***** Time Integration solver options:\n" << std::endl;
221 
222  if (analysis == Xyce::Nonlinear::TRANSIENT)
223  {
224  os << "\tAnalysis:\t\t\tTRANSIENT" << std::endl
225  << "\tInitial Time (sec):\t\t" << initialTime << std::endl
226  << "\tFinal Time (sec):\t\t" << finalTime << std::endl
227  << "\tStarting Time Step(sec):\t" << userSpecified_startingTimeStep << std::endl
228  << "\tRestart Time Step Scale:\t" << restartTimeStepScale << std::endl
229  << "\tError Analysis option:\t" << errorAnalysisOption << std::endl
230  << "\ttStart (initial outputTime):\t" << tStart << std::endl;
231 
232  switch (integrationMethod)
233  {
235  os << "\tTime Integration method:\tBACKWARD EULER" << std::endl;
236  break;
237 
239  os << "\tTime Integration method:\tBACKWARD DIFFERENTIATION ORDER 2" << std::endl;
240  break;
241 
243  os << "\tTime Integration method:\tBACKWARD DIFFERENTIATION ORDER 15" << std::endl;
244  break;
245 
246  case TIAMethod_GEAR_12:
247  os << "\tTime Integration method:\tGEAR 12" << std::endl;
248  break;
249 
250  case TIAMethod_ONESTEP:
251  os << "\tTime Integration method:\tONESTEP" << std::endl;
252  break;
253 
255  os << "\tTime Integration method:\tTRAPEZOIDAL" << std::endl;
256  break;
257 
259  os << "\tTime Integration method:\tVARIABLE THETA" << std::endl;
260  break;
261 
263  os << "\tTime Integration method:\tA-CONTRACTIVE order 2" << std::endl;
264  break;
265  }
266 
267  os << (constantStepSize ? "\tUsing Constant Step Size" : "\tUsing Variable Step Size") << std::endl
268  << (useDeviceTimeStepMax ? "\tUsing Device specified maximum stepsize" : "\tNOT using Device specified maximum stepsize") << std::endl
269  << (fastTests ? "\tTime integration FastTests is ON" : "\tTime integration FastTests is OFF") << std::endl
270  << (nlNearConvFlag ? "\tNL Near Convergence Flag is ON" : "\tNL Near Convergence Flag is OFF") << std::endl
271  << (passNLStall ? "\tNL Pass Non-linear Stalls is ON" : "\tNL Pass Non-linear Stalls is OFF") << std::endl;
272  }
273  else
274  {
275  os << "\tAnalysis:\t\t\tDC SWEEP" << std::endl
276  <<"\tTotal DC Sweep Steps:\t\t" << sweepSteps << std::endl;
277 
278  }
279 
280  os << "\tabsErrorTol:\t\t\t" << absErrorTol << std::endl
281  << "\trelErrorTol:\t\t\t" << relErrorTol << std::endl
282  << "\texitTime:\t\t\t" << exitTime << std::endl
283  << "\texitStep:\t\t\t" << exitStep << std::endl
284  << "\tdebugLevel:\t\t\t" << debugLevel << std::endl
285  << "\tMaximum Order:\t\t\t" << maxOrder << std::endl
286  << "\tMinimum Order:\t\t\t" << minOrder << std::endl
287  << "\tInterpolated Output Flag:\t\t " << (interpOutputFlag ? "true": "false") << std::endl
288  << "\tConductance Test Flag:\t\t" << (condTestFlag ? "true": "false") << std::endl;
289 
290  if (condTestDeviceNames.empty())
291  {
292  os <<
293  "\tConductance Test Device Name List is:\t\tEMPTY" << std::endl;
294  }
295  else
296  {
297  os << "\tConductance Test Device Name List contains: " << std::endl;
298  for (std::list< std::string >::iterator it = condTestDeviceNames.begin(); it != condTestDeviceNames.end(); ++it)
299  {
300  os << " \"" << *it << "\"";
301  }
302  }
303  os << Xyce::section_divider << std::endl;
304 }
305 
306 //-----------------------------------------------------------------------------
307 // Function : N_TIA_TIAParams::operator=
308 // Purpose : "=" operator.
309 // Special Notes :
310 // Scope : public
311 // Creator : Eric R. Keiter, SNL, Computational Sciences
312 // Creation Date : 12/17/05
313 //-----------------------------------------------------------------------------
315 {
316  commandLine = right.commandLine;
317 
318  tStart = right.tStart;
319  initialTime = right.initialTime;
320  finalTime = right.finalTime;
321  pauseTime = right.pauseTime;
324  maxTimeStep = right.maxTimeStep;
328  exitTime = right.exitTime;
333  NOOP = right.NOOP;
334  resume = right.resume;
335  bpEnable = right.bpEnable;
338  sweepSteps = right.sweepSteps;
339  solutionSize = right.solutionSize;
340  stateSize = right.stateSize;
343  lastDCOPStep = right.lastDCOPStep;
344  exitStep = right.exitStep;
345  relErrorTol = right.relErrorTol;
346  absErrorTol = right.absErrorTol;
349  debugLevel = right.debugLevel;
352  jacLimitFlag = right.jacLimitFlag;
353  jacLimit = right.jacLimit;
354  maxOrder = right.maxOrder;
355  minOrder = right.minOrder;
356  freqs = right.freqs;
357  freqGiven = right.freqGiven;
359  condTestFlag = right.condTestFlag;
362  passNLStall = right.passNLStall;
363  fastTests = right.fastTests;
364  voltZeroTol = right.voltZeroTol;
365  currZeroTol = right.currZeroTol;
366 
367  return *this;
368 }
369 
370