Xyce  6.1
N_TIA_WorkingIntegrationMethod.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-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_TIA_WorkingIntegrationMethod.h,v $
27 //
28 // Purpose : This file defines the classes for the time integration
29 // methods --- the "interface base class" along with the
30 // accompanying integration methods classes which can be
31 // used in the time integration algorithm.
32 //
33 // Special Notes :
34 //
35 // Creator : Buddy Watts
36 //
37 // Creation Date : 6/1/00
38 //
39 // Revision Information:
40 // ---------------------
41 //
42 // Revision Number: $Revision: 1.9.2.1 $
43 //
44 // Revision Date : $Date: 2015/04/02 18:20:18 $
45 //
46 // Current Owner : $Author: tvrusso $
47 //-----------------------------------------------------------------------------
48 
49 #ifndef Xyce_N_TIA_WorkingIntegrationMethods_h
50 #define Xyce_N_TIA_WorkingIntegrationMethods_h
51 
52 // ---------- Standard Includes ----------
53 #include <iostream>
54 #include <N_UTL_Math.h>
55 #include <list>
56 
57 // ---------- Xyce Includes ----------
58 #include <N_ANP_fwd.h>
59 #include <N_IO_fwd.h>
60 #include <N_TIA_fwd.h>
61 #include <N_LAS_fwd.h>
62 
63 #include <N_UTL_IndexPair.h>
64 
65 #include <N_UTL_Stats.h>
66 
67 namespace Xyce {
68 namespace TimeIntg {
69 
70 typedef TimeIntegrationMethod *(*Factory)(const TIAParams &tia_params, StepErrorControl &step_error_control, DataStore &data_store);
71 
73 
74 void registerFactory(int type, const char *name, Factory factory);
75 
76 template <class T>
77 inline
78 void
80 {
81  registerFactory(T::type, T::name, T::factory);
82 }
83 
84 
85 const char *getTimeIntegrationName(int type);
86 
87 TimeIntegrationMethod *createTimeIntegrationMethod(int type, const TIAParams & tia_params, StepErrorControl & step_error_control, DataStore & data_store);
88 
89 //-----------------------------------------------------------------------------
90 // Class : WorkingIntegrationMethod
91 // Purpose : This class provides a way for obtaining a specific
92 // working integration method and its associated data items.
93 // Special Notes :
94 // Creator : Buddy Watts, SNL
95 // Creation Date : 6/01/00
96 //-----------------------------------------------------------------------------
98 {
99 public:
100 // WorkingIntegrationMethod( );
101  WorkingIntegrationMethod(Stats::Stat parent_stat);
102 
103  virtual ~WorkingIntegrationMethod();
104 
105  // Method which creates a time-integration method.
107  int type,
108  const TIAParams & tia_params,
109  StepErrorControl & step_error_control,
110  DataStore & data_store);
111 
112  // accessors to the integration method object functions:
114 
115  double partialTimeDeriv() const;
116  void obtainPredictor();
117  void obtainPredictorDeriv();
118  void obtainCorrectorDeriv();
119  void updateDerivsBlock( const std::list<IndexPair> & solGIDList, const std::list<IndexPair> & staGIDList);
120 
121  int getOrder() const;
122  int getUsedOrder() const;
123  int getNumberOfSteps() const;
124  int getNscsco() const;
125  void getInitialQnorm (TwoLevelError & tle) const;
126  void getTwoLevelError(TwoLevelError & tle) const;
127  void setTwoLevelTimeInfo(const TimeIntInfo & tiInfo);
128  void updateCoeffs();
129  void rejectStepForHabanero ();
130  void initialize(const TIAParams &tia_params);
131  void completeStep(const TIAParams &tia_params);
132  void rejectStep(const TIAParams &tia_params);
133  double computeErrorEstimate() const;
134  void updateStateDeriv ();
135  void updateLeadCurrent ();
136  void updateLeadCurrentVec ();
137  void obtainResidual();
140  void obtainJacobian();
141  void applyJacobian(const Linear::Vector& input, Linear::Vector& result);
142 
144  Analysis::OutputMgrAdapter & outputManagerAdapter,
145  const double time,
146  Linear::Vector * solnVecPtr,
147  const std::vector<double> & fastTimes );
148 
150  Analysis::OutputMgrAdapter & outputManagerAdapter,
151  const double time,
152  Linear::Vector * solnVecPtr,
153  const std::vector<double> & fastTimes,
154  const int phiGID );
155 
156  bool printOutputSolution(
157  Analysis::OutputMgrAdapter & outputManagerAdapter,
158  const TIAParams & tia_params,
159  const double time,
160  Linear::Vector * solnVecPtr,
161  const bool doNotInterpolate,
162  const std::vector<double> & outputInterpolationTimes,
163  bool skipPrintLineOutput );
164 
165  bool saveOutputSolution(
166  Analysis::OutputMgrAdapter & outputManagerAdapter,
167  const TIAParams & tia_params,
168  Linear::Vector * solnVecPtr,
169  const double saveTime,
170  const bool doNotInterpolate);
171 
172 private:
173  TimeIntegrationMethod * timeIntegrationMethod_; ///< Pointer to the integration method.
175  double jacLimit;
176 
177  Stats::Stat timeIntegratorStat_;
178  Stats::Stat predictorStat_;
179  Stats::Stat completeStepStat_;
180  Stats::Stat rejectStepStat_;
181  Stats::Stat updateCoefStat_;
182  Stats::Stat residualStat_;
183  Stats::Stat jacobianStat_;
184  Stats::Stat initializeStat_;
185 
186  Stats::Stat updateLeadStat_;
187 };
188 
189 } // namespace TimeIntg
190 } // namespace Xyce
191 
192 #endif // Xyce_N_TIA_WorkingIntegrationMethods_h
Pure virtual class to augment a linear system.
void updateDerivsBlock(const std::list< IndexPair > &solGIDList, const std::list< IndexPair > &staGIDList)
TimeIntegrationMethod * timeIntegrationMethod_
Pointer to the integration method.
const char * getTimeIntegrationName(int type)
TimeIntegrationMethod * createTimeIntegrationMethod(int type, const TIAParams &tia_params, StepErrorControl &step_error_control, DataStore &data_store)
bool saveOutputSolution(Analysis::OutputMgrAdapter &outputManagerAdapter, const TIAParams &tia_params, Linear::Vector *solnVecPtr, const double saveTime, const bool doNotInterpolate)
void registerFactory(int type, const char *name, Factory factory)
bool printMPDEOutputSolution(Analysis::OutputMgrAdapter &outputManagerAdapter, const double time, Linear::Vector *solnVecPtr, const std::vector< double > &fastTimes)
TimeIntegrationMethod *(* Factory)(const TIAParams &tia_params, StepErrorControl &step_error_control, DataStore &data_store)
void createTimeIntegMethod(int type, const TIAParams &tia_params, StepErrorControl &step_error_control, DataStore &data_store)
void applyJacobian(const Linear::Vector &input, Linear::Vector &result)
bool printWaMPDEOutputSolution(Analysis::OutputMgrAdapter &outputManagerAdapter, const double time, Linear::Vector *solnVecPtr, const std::vector< double > &fastTimes, const int phiGID)
bool printOutputSolution(Analysis::OutputMgrAdapter &outputManagerAdapter, const TIAParams &tia_params, const double time, Linear::Vector *solnVecPtr, const bool doNotInterpolate, const std::vector< double > &outputInterpolationTimes, bool skipPrintLineOutput)