Xyce  6.1
N_ANP_MOR.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_ANP_MOR.h,v $
27 //
28 // Purpose : MOR analysis class
29 //
30 // Special Notes : Specify any "hidden" or subtle details of the class here.
31 // Portability details, error handling information, etc.
32 //
33 // Creator : Ting Mei
34 //
35 // Creation Date : 01/11
36 //
37 // Revision Information:
38 // ---------------------
39 //
40 // Revision Number: $Revision: 1.36.2.1 $
41 // Revision Date : $Date: 2015/04/02 18:20:06 $
42 // Current Owner : $Author: tvrusso $
43 //-----------------------------------------------------------------------------
44 
45 #ifndef Xyce_N_ANP_MOR_h
46 #define Xyce_N_ANP_MOR_h
47 
48 #include <Teuchos_RCP.hpp>
49 using Teuchos::RCP;
50 using Teuchos::rcp;
51 #include <Teuchos_SerialDenseMatrix.hpp>
52 
53 // ---------- Xyce Includes ----------
54 #include <N_ANP_fwd.h>
55 #include <N_UTL_fwd.h>
56 #include <N_LAS_fwd.h>
57 #include <N_TOP_fwd.h>
58 
59 #include <N_ANP_AnalysisBase.h>
60 #include <N_ANP_Factory.h>
61 #include <N_UTL_FixedQueue.h>
62 #include <N_UTL_OptionBlock.h>
63 
64 // ---------- Forward Declarations ----------
65 class Amesos_BaseSolver;
66 class Epetra_LinearProblem;
67 class Epetra_Map;
68 
69 namespace Xyce {
70 namespace Analysis {
71 
72 //-------------------------------------------------------------------------
73 // Class : MOR
74 // Purpose : MOR analysis class
75 // Special Notes :
76 // Creator : Ting Mei
77 // Creation Date : 05/24/11
78 //-------------------------------------------------------------------------
79 class MOR: public AnalysisBase
80 {
81 public:
82  MOR(
83  AnalysisManager & analysis_manager,
84  Nonlinear::Manager & nonlinear_manager,
85  Topo::Topology & topology);
86 
87  ~MOR();
88 
90  return tiaParams_;
91  }
92 
94  return tiaParams_;
95  }
96 
97  // Method to set MOR options
98  bool setMOROptions(const Util::OptionBlock & OB);
99 
100  bool setAnalysisParams(const Util::OptionBlock & paramsBlock);
101 
102  bool doRun();
103  bool doInit();
104  bool reduceSystem();
107 
108  bool processSuccessfulStep(bool origSys);
109 
110  virtual bool doProcessSuccessfulStep() { return true; }
111 
112  virtual bool doLoopProcess() { return true; }
113 
114  virtual bool doProcessFailedStep();
115  virtual bool doFinish();
116  virtual bool doHandlePredictor();
117 
118  bool getDCOPFlag() const
119  {
120  return true;
121  }
122 
123 private:
124  Parallel::Machine comm_;
125 
129  Topo::Topology & topology_;
131 
133 
134  int ROMsize_;
135  std::string morMethod_;
139  std::string morCompType_;
144  double morMaxFreq_;
145 
147  double morExpPoint_;
153  std::vector<std::string> subcircuitNames_;
154 
155  bool isPaused;
158 
159  std::list < int > morEvalFailures_;
160 
162  std::vector<std::string> portList_;
163 
164  double stepMult_;
165  double fStep_;
166  double currentFreq_;
167  double s0_;
168 
169  int setupSweepParam_();
170 
171  bool updateCurrentFreq_(int stepNumber);
172 
174  bool createRedLinearSystem_();
175 
178 
179  bool solveOrigLinearSystem_();
180  bool solveRedLinearSystem_();
181 
182  bool sparsifyRedSystem_();
183 
184  // Original system
185  RCP<Linear::Matrix> CPtr_;
186  RCP<Linear::Matrix> GPtr_;
187  RCP<Linear::Matrix> sCpG_MatrixPtr_;
188  RCP<Linear::MultiVector> RPtr_, BPtr_, VPtr_;
190 
191  // Original system, real-equivalent form
192  RCP<Linear::BlockMatrix> sCpG_REFMatrixPtr_;
193  RCP<Linear::BlockVector> REFBPtr_;
194  RCP<Linear::BlockVector> REFXPtr_; // Store solution from Amesos here.
195 
196  // Reduced system (dense)
197  Teuchos::SerialDenseMatrix<int, double> redC_;
198  Teuchos::SerialDenseMatrix<int, double> redG_;
199  Teuchos::SerialDenseMatrix<int, double> redB_;
200  Teuchos::SerialDenseMatrix<int, double> redL_; // redL_ != redB_
201 
202  // Reduced system (sparse)
203  RCP<Linear::Matrix> redCPtr_, redGPtr_;
204  RCP<Epetra_Map> redMapPtr_;
205 
206  // Reduced system, real-equivalent form (dense)
207  Teuchos::SerialDenseMatrix<int, double> sCpG_redMatrix_, sCpG_tmpMatrix_;
208  Teuchos::SerialDenseMatrix<int, double> ref_redB_;
209 
210  // Reduced system, real-equivalent form (sparse)
211  RCP<Linear::BlockMatrix> sCpG_ref_redMatrixPtr_;
212  RCP<Linear::BlockVector> ref_redBPtr_;
213  RCP<Linear::BlockVector> ref_redXPtr_; // Store solution from Amesos here.
214 
215  // Transfer functions
216  Teuchos::SerialDenseMatrix<int, std::complex<double> > origH_;
217  Teuchos::SerialDenseMatrix<int, std::complex<double> > redH_;
218 
219  // Original system solver objects
220  RCP<Amesos_BaseSolver> blockSolver_, origSolver_;
221  RCP<Epetra_LinearProblem> blockProblem_, origProblem_;
222 
223  // Reduced system solver objects (sparse)
224  RCP<Amesos_BaseSolver> blockRedSolver_;
225  RCP<Epetra_LinearProblem> blockRedProblem_;
226 };
227 
228 bool registerMORFactory(
229  const std::string & netlist_filename,
230  IO::PkgOptionsMgr & options_manager,
231  AnalysisManager & analysis_manager,
232  Linear::System & linear_system,
233  Nonlinear::Manager & nonlinear_manager,
234  Topo::Topology & topology);
235 
236 } // namespace Analysis
237 } // namespace Xyce
238 
239 #endif // Xyce_N_ANP_MOR_h
RCP< Linear::MultiVector > RPtr_
Definition: N_ANP_MOR.h:188
bool getDCOPFlag() const
Definition: N_ANP_MOR.h:118
Topo::Topology & topology_
Definition: N_ANP_MOR.h:129
double morScaleFactor_
Definition: N_ANP_MOR.h:148
Teuchos::SerialDenseMatrix< int, double > redB_
Definition: N_ANP_MOR.h:199
RCP< Epetra_LinearProblem > origProblem_
Definition: N_ANP_MOR.h:221
RCP< Epetra_LinearProblem > blockRedProblem_
Definition: N_ANP_MOR.h:225
RCP< Linear::BlockVector > ref_redBPtr_
Definition: N_ANP_MOR.h:212
virtual bool doProcessSuccessfulStep()
Definition: N_ANP_MOR.h:110
bool evalOrigTransferFunction()
Definition: N_ANP_MOR.C:1098
Pure virtual class to augment a linear system.
RCP< Linear::MultiVector > BPtr_
Definition: N_ANP_MOR.h:188
RCP< Linear::BlockMatrix > sCpG_REFMatrixPtr_
Definition: N_ANP_MOR.h:192
RCP< Linear::MultiVector > VPtr_
Definition: N_ANP_MOR.h:188
unsigned int stepNumber
Time-integration step number counter.
Nonlinear::Manager & nonlinearManager_
Definition: N_ANP_MOR.h:128
const TimeIntg::TIAParams & getTIAParams() const
Definition: N_ANP_MOR.h:89
std::vector< std::string > portList_
Definition: N_ANP_MOR.h:162
bool createOrigLinearSystem_()
Definition: N_ANP_MOR.C:1193
Teuchos::SerialDenseMatrix< int, std::complex< double > > origH_
Definition: N_ANP_MOR.h:216
RCP< Linear::BlockMatrix > sCpG_ref_redMatrixPtr_
Definition: N_ANP_MOR.h:211
RCP< Epetra_LinearProblem > blockProblem_
Definition: N_ANP_MOR.h:221
RCP< Amesos_BaseSolver > blockSolver_
Definition: N_ANP_MOR.h:220
Teuchos::SerialDenseMatrix< int, double > sCpG_redMatrix_
Definition: N_ANP_MOR.h:207
bool updateOrigLinearSystemFreq_()
Definition: N_ANP_MOR.C:1364
bool setAnalysisParams(const Util::OptionBlock &paramsBlock)
Definition: N_ANP_MOR.C:185
std::string morMethod_
Definition: N_ANP_MOR.h:135
RCP< Linear::BlockVector > REFXPtr_
Definition: N_ANP_MOR.h:194
AnalysisManager & analysisManager_
Definition: N_ANP_MOR.h:126
Teuchos::SerialDenseMatrix< int, double > sCpG_tmpMatrix_
Definition: N_ANP_MOR.h:207
RCP< Amesos_BaseSolver > origSolver_
Definition: N_ANP_MOR.h:220
Teuchos::SerialDenseMatrix< int, double > redG_
Definition: N_ANP_MOR.h:198
std::string morCompType_
Definition: N_ANP_MOR.h:139
std::vector< int > bMatEntriesVec_
Definition: N_ANP_MOR.h:189
RCP< Amesos_BaseSolver > blockRedSolver_
Definition: N_ANP_MOR.h:224
Teuchos::SerialDenseMatrix< int, std::complex< double > > redH_
Definition: N_ANP_MOR.h:217
TimeIntg::TIAParams & getTIAParams()
Definition: N_ANP_MOR.h:93
Teuchos::SerialDenseMatrix< int, double > redL_
Definition: N_ANP_MOR.h:200
MOR(AnalysisManager &analysis_manager, Nonlinear::Manager &nonlinear_manager, Topo::Topology &topology)
Definition: N_ANP_MOR.C:128
Parallel::Machine comm_
Definition: N_ANP_MOR.h:124
bool sparsifyRedSystem_()
Definition: N_ANP_MOR.C:1585
bool solveRedLinearSystem_()
Definition: N_ANP_MOR.C:1480
RCP< Linear::Matrix > redCPtr_
Definition: N_ANP_MOR.h:203
Teuchos::SerialDenseMatrix< int, double > redC_
Definition: N_ANP_MOR.h:197
Loader::Loader & loader_
Definition: N_ANP_MOR.h:127
RCP< Epetra_Map > redMapPtr_
Definition: N_ANP_MOR.h:204
virtual bool doLoopProcess()
Definition: N_ANP_MOR.h:112
RCP< Linear::BlockVector > REFBPtr_
Definition: N_ANP_MOR.h:193
RCP< Linear::BlockVector > ref_redXPtr_
Definition: N_ANP_MOR.h:213
bool createRedLinearSystem_()
Definition: N_ANP_MOR.C:1265
std::vector< int > bMatPosEntriesVec_
Definition: N_ANP_MOR.h:189
Factory for creating analysis objects.
bool setMOROptions(const Util::OptionBlock &OB)
Definition: N_ANP_MOR.C:214
virtual bool doProcessFailedStep()
Definition: N_ANP_MOR.C:1936
RCP< Linear::Matrix > redGPtr_
Definition: N_ANP_MOR.h:203
std::list< int > morEvalFailures_
Definition: N_ANP_MOR.h:159
RCP< Linear::Matrix > GPtr_
Definition: N_ANP_MOR.h:186
double morScaleFactor1_
Definition: N_ANP_MOR.h:150
std::vector< std::string > subcircuitNames_
Definition: N_ANP_MOR.h:153
bool registerMORFactory(const std::string &netlist_filename, IO::PkgOptionsMgr &options_manager, AnalysisManager &analysis_manager, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager, Topo::Topology &topology)
Definition: N_ANP_MOR.C:2260
bool evalRedTransferFunction()
Definition: N_ANP_MOR.C:1146
RCP< Linear::Matrix > sCpG_MatrixPtr_
Definition: N_ANP_MOR.h:187
bool updateCurrentFreq_(int stepNumber)
Definition: N_ANP_MOR.C:2001
Teuchos::SerialDenseMatrix< int, double > ref_redB_
Definition: N_ANP_MOR.h:208
RCP< Linear::Matrix > CPtr_
Definition: N_ANP_MOR.h:185
TimeIntg::TIAParams tiaParams_
Definition: N_ANP_MOR.h:132
OutputMgrAdapter & outputManagerAdapter_
Definition: N_ANP_MOR.h:130
bool solveOrigLinearSystem_()
Definition: N_ANP_MOR.C:1431
virtual bool doHandlePredictor()
Definition: N_ANP_MOR.C:1980
bool updateRedLinearSystemFreq_()
Definition: N_ANP_MOR.C:1388
virtual bool doFinish()
Definition: N_ANP_MOR.C:1956