Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-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_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.17 $
41 // Revision Date : $Date: 2014/07/16 17:32:40 $
42 // Current Owner : $Author: dgbaur $
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 
54 // ---------- Xyce Includes ----------
55 #include <N_ANP_fwd.h>
56 #include <N_UTL_fwd.h>
57 #include <N_LAS_fwd.h>
58 
59 #include <N_ANP_AnalysisBase.h>
60 #include <N_UTL_FixedQueue.h>
61 
62 // ---------- Forward Declarations ----------
63 class Amesos_BaseSolver;
64 class Epetra_LinearProblem;
65 
66 namespace Xyce {
67 namespace Analysis {
68 
69 //-------------------------------------------------------------------------
70 // Class : MOR
71 // Purpose : MOR analysis class
72 // Special Notes :
73 // Creator : Ting Mei
74 // Creation Date : 05/24/11
75 //-------------------------------------------------------------------------
76 class MOR: public AnalysisBase
77 {
78  public:
79  MOR( AnalysisManager &analysis_manager );
80 
81  ~MOR();
82 
83  bool setAnalysisParams(const N_UTL_OptionBlock & paramsBlock);
84 
85  bool run();
86  bool init();
87  bool reduceSystem();
90 
91  bool processSuccessfulStep(bool origSys);
92 
93  virtual bool processSuccessfulStep() { return true; }
94 
95  virtual bool loopProcess() { return true; }
96 
97  virtual bool processFailedStep();
98  virtual bool finish();
99  virtual bool handlePredictor();
100 
101  void setDCOPFlag(bool flag) { dcopFlag_ = flag; }
102  bool getDCOPFlag() { return dcopFlag_; }
103 
104  private:
105 
106  bool isPaused;
107  bool dcopFlag_; // true if this is a DCOP calculation.
110 
111  std::list < int > morEvalFailures_;
112  std::vector<std::string> portList_;
113 
114  double stepMult_;
115  double fStep_;
116  double currentFreq_;
117  double s0_;
118 
119  int setupSweepParam_();
120 
121  bool updateCurrentFreq_(int stepNumber);
122 
124  bool createRedLinearSystem_();
125 
128 
129  bool solveOrigLinearSystem_();
130  bool solveRedLinearSystem_();
131 
132  bool sparsifyRedSystem_();
133 
134  // Original system
135  RCP<N_LAS_Matrix> CPtr_;
136  RCP<N_LAS_Matrix> GPtr_;
137  RCP<N_LAS_Matrix> sCpG_MatrixPtr_;
138  RCP<N_LAS_Matrix> redCPtr_, redGPtr_;
139  RCP<N_LAS_MultiVector> RPtr_, BPtr_, VPtr_;
141 
142  // Original system, real-equivalent form
143  RCP<N_LAS_BlockMatrix> sCpG_REFMatrixPtr_;
144  RCP<N_LAS_BlockVector> REFBPtr_;
145  RCP<N_LAS_BlockVector> REFXPtr_; // Store solution from Amesos here.
146  //RCP<N_LAS_BlockVector> LPtr_;
147 
148  // Reduced system
149  Teuchos::SerialDenseMatrix<int, double> redC_;
150  Teuchos::SerialDenseMatrix<int, double> redG_;
151  Teuchos::SerialDenseMatrix<int, double> redB_;
152  Teuchos::SerialDenseMatrix<int, double> redL_; // redL_ != redB_
153 
154  // Reduced system, real-equivalent form
155  Teuchos::SerialDenseMatrix<int, double> sCpG_redMatrix_, sCpG_tmpMatrix_;
156  Teuchos::SerialDenseMatrix<int, double> ref_redB_;
157 
158  // Transfer functions
159  Teuchos::SerialDenseMatrix<int, std::complex<double> > origH_;
160  Teuchos::SerialDenseMatrix<int, std::complex<double> > redH_;
161 
162  // Original system solver objects
163  RCP<Amesos_BaseSolver> blockSolver_, origSolver_;
164  RCP<Epetra_LinearProblem> blockProblem_, origProblem_;
165 };
166 
167 } // namespace Analysis
168 } // namespace Xyce
169 
171 
172 #endif // Xyce_N_ANP_MOR_h