Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_TIA_NoTimeIntegration.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_TIA_NoTimeIntegration.h,v $
27 //
28 // Purpose : This file defines the classes for the "no time integration"
29 // method.
30 //
31 // Special Notes :
32 //
33 // Creator : Eric Keiter
34 //
35 // Creation Date : 7/21/00
36 //
37 // Revision Information:
38 // ---------------------
39 //
40 // Revision Number: $Revision: 1.34.2.1 $
41 //
42 // Revision Date : $Date: 2014/09/02 22:49:49 $
43 //
44 // Current Owner : $Author: erkeite $
45 //-----------------------------------------------------------------------------
46 
47 #ifndef Xyce_N_TIA_NO_TIME_INTEGRATION_H
48 #define Xyce_N_TIA_NO_TIME_INTEGRATION_H
49 
50 // ---------- Standard Includes ----------
51 #ifdef HAVE_CMATH
52 #include <cmath>
53 #else
54 #include <math.h>
55 #endif
56 
57 // ---------- Xyce Includes ----------
58 #include <N_TIA_fwd.h>
59 #include <N_TIA_DataStore.h>
60 
61 #define MATRIX_FAILSAFE 1
62 #define NUM_LIMIT 1.0e-20
63 
64 //-----------------------------------------------------------------------------
65 // Class : N_TIA_NoTimeIntegration
66 // Purpose : Class objects for use during DC analysis (applies only when
67 // all time derivatives are set to 0) (derived from
68 // N_TIA_TimeIntegrationMethod)
69 // Special Notes :
70 // Creator : Buddy Watts, SNL
71 // Creation Date : 6/01/00
72 //-----------------------------------------------------------------------------
74 {
75 public:
76 
77  // Destructor
79 
80  // Predict solution at next time point (No Integration).
82 
83  // Evaluate the predictor derivative formula (No Integration).
84  virtual void obtainPredictorDeriv() { }
85 
86  // Evaluate the corrector derivative formula (No Integration).
87  virtual void obtainCorrectorDeriv();
88 
89  // Compute an estimate of the error in the integration step (No Integration).
90  virtual void updateDerivsBlock(const std::list< index_pair > & solGIDList,
91  const std::list< index_pair > & staGIDList)
92  { }
93 
94 #ifdef MATRIX_FAILSAFE
95  virtual double partialTimeDeriv() { return NUM_LIMIT; }
96 
97 #else
98  virtual double partialTimeDeriv() { return 0.0; }
99 
100 #endif
101 
102  // Compute an estimate of the error in the integration step (No Integration).
103  virtual double computeErrorEstimate() { return 0.0; }
104 
105  // Interpolate solution approximation at prescribed time point (No
106  // Integration).
107  virtual bool interpolateSolution(double timepoint,
108  N_LAS_Vector * tmpSolVectorPtr, std::vector<N_LAS_Vector*> & historyVec )
109  {return false;};
110 
111  // Computes the step adjustment (No Integration).
112  virtual double computeExpoStepAdjust(double stepadjust) { return 0.0; }
113 
114  // Gets the time-integration order (No Integration).
115  virtual int getOrder() { return 0; }
116  virtual int getUsedOrder() { return 0; }
117 
118  virtual void getInitialQnorm (N_TIA_TwoLevelError & tle);
119  virtual void setupTwoLevelError(N_TIA_TwoLevelError & tle);
120 
121  // Time-integration factory.
123  N_TIA_StepErrorControl & secTmp ,
124  N_TIA_DataStore & dsTmp);
125 
126  // 03/08/04 erkeite: New functions necessary new-DAE:
127  // Evaluate residual for nonlinear solver
128  void obtainResidual();
129 
130  // obtain residuals for transient sensitivity analysis
131  virtual void obtainSensitivityResiduals();
132 
133  // obtain final derivatives w.r.t. time for transient sensitivity analysis
134  virtual void loadFinalSensitivityDerivatives() {return;}
135 
136  // Evaluate Jacobian for nonlinear solver
137  void obtainJacobian();
138 
139  // Apply Jacobian for nonlinear solver
140  void applyJacobian(const N_LAS_Vector& input, N_LAS_Vector& result);
141 
142 private:
143  // Copied from N_TIA_BackwardDifferentiation15.h
144  double alphas; // $\alpha_s$ fixed-leading coefficient of this BDF method
145 
146  // Constructor (private).
148  N_TIA_StepErrorControl & secTmp,
149  N_TIA_DataStore & dsTmp);
150 };
151 
152 //-----------------------------------------------------------------------------
153 // Function : N_TIA_NoTimeIntegration::factory
154 // Purpose :
155 // Special Notes :
156 // Scope : public
157 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
158 // Creation Date : 6/08/01
159 //-----------------------------------------------------------------------------
161  (N_TIA_TIAParams & tiaP,
162  N_TIA_StepErrorControl & secTmp ,
163  N_TIA_DataStore & dsTmp)
164 {
165  N_TIA_TimeIntegrationMethod * timPtr =
166  new N_TIA_NoTimeIntegration(tiaP,secTmp,dsTmp);
167  return timPtr;
168 }
169 
170 #endif // Xyce_N_TIA_NO_TIME_INTEGRATION_H