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.121 $
42 //
43 // Revision Date : $Date: 2014/02/24 23:49:27 $
44 //
45 // Current Owner : $Author: tvrusso $
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 ----------
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  doubleDCOPAll(false),
134  exitTime(0.0),
135  exitStep(-1),
136 #ifdef Xyce_DEBUG_TIME
137  debugLevel(1),
138 #else
139  debugLevel(0),
140 #endif
141  bpEnable(true),
142  restartTimeStepScale(0.005),
143 // nlNearConvFlag(true),
144  nlNearConvFlag(false),
145  nlSmallUpdateFlag(true),
146  jacLimitFlag(false),
147  jacLimit(1.0e+17),
148  maxOrder(5),
149  minOrder(1),
150 // freq(0.0),
151 // freq2(0.0),
152 // freq2Given(false),
153  freqGiven(false),
154  type("DEC"),
155  np(10.0),
156  fStart(1.0),
157  fStop(1.0),
158  ROMsize(-1),
159  morMethod("PRIMA"),
160  morSaveRedSys(false),
161  morCompOrigTF(false),
162  morCompRedTF(false),
163  morCompType("DEC"),
164  morCompNP(10),
165  morCompFStart(1.0),
166  morCompFStop(1.0),
167  morExpPoint(0.0),
168  morScaleFactor(1.0),
169  morScaleType(0),
170  morScaleFactor1(0.01),
171  morSparsificationType(0),
172  outputInterpMPDE(true),
173  interpOutputFlag(true),
174  condTestFlag(false),
175  saveTimeStepsFlag(false),
176  passNLStall(false),
177  minTimeStepRecoveryCounter(0),
178  fastTests(false),
179  voltZeroTol(1.0e-6),
180  currZeroTol(1.0e-6),
181  historyTrackingDepth(25)
182 {
183  scalarTolerances = true;
184 
185  freqs.clear();
186 #ifdef Xyce_DEBUG_TIME
187  // override default debug level based on command line options
188  if ( commandLine->argExists( "-tdl" ) )
189  {
190  debugLevel = atoi( commandLine->getArgumentValue( "-tdl" ).c_str() );
191  }
192 #endif
193 }
194 
195 //-----------------------------------------------------------------------------
196 // Function : N_TIA_TIAParams::N_TIA_TIAParams
197 // Purpose : destructor
198 // Special Notes :
199 // Scope : public
200 // Creator : Buddy Watts, SNL
201 // Creation Date : 6/01/00
202 //-----------------------------------------------------------------------------
203 
205 {
206 
207 }
208 
209 //-----------------------------------------------------------------------------
210 // Function : N_TIA_TIAParams::printParams
211 // Purpose :
212 // Special Notes :
213 // Scope : public
214 // Creator : Eric Keiter, 9233.
215 // Creation Date : 7/12/01
216 //-----------------------------------------------------------------------------
217 void N_TIA_TIAParams::printParams(std::ostream &os, int analysis)
218 {
219  os << "\n" << std::endl;
220  os << Xyce::section_divider << std::endl;
221  os << "\n***** Time Integration solver options:\n" << std::endl;
222 
223  if (analysis == TRANSIENT)
224  {
225  os << "\tAnalysis:\t\t\tTRANSIENT" << std::endl
226  << "\tInitial Time (sec):\t\t" << initialTime << std::endl
227  << "\tFinal Time (sec):\t\t" << finalTime << std::endl
228  << "\tStarting Time Step(sec):\t" << userSpecified_startingTimeStep << std::endl
229  << "\tRestart Time Step Scale:\t" << restartTimeStepScale << std::endl
230  << "\tError Analysis option:\t" << errorAnalysisOption << std::endl
231  << "\ttStart (initial outputTime):\t" << tStart << std::endl;
232 
233  switch (integrationMethod)
234  {
236  os << "\tTime Integration method:\tBACKWARD EULER" << std::endl;
237  break;
238 
240  os << "\tTime Integration method:\tBACKWARD DIFFERENTIATION ORDER 2" << std::endl;
241  break;
242 
244  os << "\tTime Integration method:\tBACKWARD DIFFERENTIATION ORDER 15" << std::endl;
245  break;
246 
247  case TIAMethod_GEAR_12:
248  os << "\tTime Integration method:\tGEAR 12" << std::endl;
249  break;
250 
251  case TIAMethod_ONESTEP:
252  os << "\tTime Integration method:\tONESTEP" << std::endl;
253  break;
254 
256  os << "\tTime Integration method:\tTRAPEZOIDAL" << std::endl;
257  break;
258 
260  os << "\tTime Integration method:\tVARIABLE THETA" << std::endl;
261  break;
262 
264  os << "\tTime Integration method:\tA-CONTRACTIVE order 2" << std::endl;
265  break;
266  }
267 
268  os << (constantStepSize ? "\tUsing Constant Step Size" : "\tUsing Variable Step Size") << std::endl
269  << (useDeviceTimeStepMax ? "\tUsing Device specified maximum stepsize" : "\tNOT using Device specified maximum stepsize") << std::endl
270  << (fastTests ? "\tTime integration FastTests is ON" : "\tTime integration FastTests is OFF") << std::endl
271  << (nlNearConvFlag ? "\tNL Near Convergence Flag is ON" : "\tNL Near Convergence Flag is OFF") << std::endl
272  << (passNLStall ? "\tNL Pass Non-linear Stalls is ON" : "\tNL Pass Non-linear Stalls is OFF") << std::endl;
273  }
274  else
275  {
276  os << "\tAnalysis:\t\t\tDC SWEEP" << std::endl
277  <<"\tTotal DC Sweep Steps:\t\t" << sweepSteps << std::endl;
278 
279  }
280 
281  os << "\tabsErrorTol:\t\t\t" << absErrorTol << std::endl
282  << "\trelErrorTol:\t\t\t" << relErrorTol << std::endl
283  << "\texitTime:\t\t\t" << exitTime << std::endl
284  << "\texitStep:\t\t\t" << exitStep << std::endl
285  << "\tdebugLevel:\t\t\t" << debugLevel << std::endl
286  << "\tMaximum Order:\t\t\t" << maxOrder << std::endl
287  << "\tMinimum Order:\t\t\t" << minOrder << std::endl
288  << "\tInterpolated Output Flag:\t\t " << (interpOutputFlag ? "true": "false") << std::endl
289  << "\tConductance Test Flag:\t\t" << (condTestFlag ? "true": "false") << std::endl;
290 
291  if (condTestDeviceNames.empty())
292  {
293  os <<
294  "\tConductance Test Device Name List is:\t\tEMPTY" << std::endl;
295  }
296  else
297  {
298  os << "\tConductance Test Device Name List contains: " << std::endl;
299  for (std::list< std::string >::iterator it = condTestDeviceNames.begin(); it != condTestDeviceNames.end(); ++it)
300  {
301  os << " \"" << *it << "\"";
302  }
303  }
304  os << Xyce::section_divider << std::endl;
305 }
306 
307 //-----------------------------------------------------------------------------
308 // Function : N_TIA_TIAParams::operator=
309 // Purpose : "=" operator.
310 // Special Notes :
311 // Scope : public
312 // Creator : Eric R. Keiter, SNL, Computational Sciences
313 // Creation Date : 12/17/05
314 //-----------------------------------------------------------------------------
316 {
317  commandLine = right.commandLine;
318 
319  tStart = right.tStart;
320  initialTime = right.initialTime;
321  finalTime = right.finalTime;
322  pauseTime = right.pauseTime;
325  maxTimeStep = right.maxTimeStep;
329  exitTime = right.exitTime;
334  NOOP = right.NOOP;
335  resume = right.resume;
336  bpEnable = right.bpEnable;
339  sweepSteps = right.sweepSteps;
340  solutionSize = right.solutionSize;
341  stateSize = right.stateSize;
344  lastDCOPStep = right.lastDCOPStep;
345  exitStep = right.exitStep;
347  relErrorTol = right.relErrorTol;
348  absErrorTol = right.absErrorTol;
351  debugLevel = right.debugLevel;
354  jacLimitFlag = right.jacLimitFlag;
355  jacLimit = right.jacLimit;
356  maxOrder = right.maxOrder;
357  minOrder = right.minOrder;
358  freqs = right.freqs;
359  freqGiven = right.freqGiven;
361  condTestFlag = right.condTestFlag;
364  passNLStall = right.passNLStall;
365  fastTests = right.fastTests;
366  voltZeroTol = right.voltZeroTol;
367  currZeroTol = right.currZeroTol;
368 
369  return *this;
370 }
371 
372