Xyce  6.1
N_ANP_AC.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_AC.h,v $
27 //
28 // Purpose : AC 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.42.2.1 $
41 // Revision Date : $Date: 2015/04/02 18:20:06 $
42 // Current Owner : $Author: tvrusso $
43 //-----------------------------------------------------------------------------
44 
45 #ifndef Xyce_N_ANP_AC_h
46 #define Xyce_N_ANP_AC_h
47 
48 #include <N_ANP_fwd.h>
49 #include <N_UTL_fwd.h>
50 #include <N_LAS_fwd.h>
51 #include <N_TOP_fwd.h>
52 
53 #include <N_ANP_AnalysisBase.h>
54 #include <N_ANP_Factory.h>
55 #include <N_ANP_StepEvent.h>
56 #include <N_TIA_TIAParams.h>
57 #include <N_UTL_FixedQueue.h>
58 #include <N_UTL_Listener.h>
59 #include <N_UTL_OptionBlock.h>
60 
61 // ---------- Forward Declarations ----------
62 class Amesos_BaseSolver;
63 class Epetra_LinearProblem;
64 
65 namespace Xyce {
66 namespace Analysis {
67 
68 //-------------------------------------------------------------------------
69 // Class : AC
70 // Purpose : AC analysis class
71 // Special Notes :
72 // Creator : Ting Mei
73 // Creation Date : 05/24/11
74 //-------------------------------------------------------------------------
75 class AC: public AnalysisBase, public Util::ListenerAutoSubscribe<StepEvent>
76 {
77 public:
78  AC(
79  AnalysisManager & analysis_manager,
80  Linear::System & linear_system,
81  Nonlinear::Manager & nonlinear_manager,
82  Topo::Topology & topology);
83 
84  virtual ~AC();
85 
86  void notify(const StepEvent &event);
87 
88  void setTIAParams(const TimeIntg::TIAParams &tia_params) {
89  tiaParams_ = tia_params;
90  }
91 
93  return tiaParams_;
94  }
95 
97  return tiaParams_;
98  }
99 
100  bool setAnalysisParams(const Util::OptionBlock & paramsBlock);
101  bool setTimeIntegratorOptions(const Util::OptionBlock &option_block);
102 
103  bool getDCOPFlag() const;
104 
105  bool doRun();
106  bool doInit();
107  bool doLoopProcess();
109  bool doProcessFailedStep();
110  bool doFinish();
111  bool doHandlePredictor();
112 
113  void printStepHeader(std::ostream &os)
114  {}
115 
116  void printProgress(std::ostream &os)
117  {}
118 
119 private:
120  int setupSweepParam_();
121 
122  bool updateCurrentFreq_(int stepNumber);
123 
124  bool createLinearSystem_();
125 
127 
128  bool solveLinearSystem_();
129 
130 private:
133  Linear::System & linearSystem_;
135  Topo::Topology & topology_;
138 
139  Linear::Vector * bVecRealPtr;
140  Linear::Vector * bVecImagPtr;
141 
143 
144  std::vector<int> acSweepFailures_;
145 
146  bool stepFlag_;
147  std::string type_;
148  double np_;
149  double fStart_;
150  double fStop_;
151  double stepMult_;
152  double fstep_;
153 
154  double currentFreq_;
155 
156  Linear::Matrix * C_;
157  Linear::Matrix * G_;
158  Linear::BlockMatrix * ACMatrix_;
159  Linear::BlockVector * B_;
160  Linear::BlockVector * X_;
161 
162  Amesos_BaseSolver * blockSolver_;
163  Epetra_LinearProblem * blockProblem_;
164 
165  std::vector<double> objectiveVec_;
166  std::vector<double> dOdpVec_;
167  std::vector<double> dOdpAdjVec_;
168  std::vector<double> scaled_dOdpVec_;
169  std::vector<double> scaled_dOdpAdjVec_;
170 };
171 
172 bool registerACFactory(
173  const std::string & netlist_filename,
174  IO::PkgOptionsMgr & options_manager,
175  AnalysisManager & analysis_manager,
176  Linear::System & linear_system,
177  Nonlinear::Manager & nonlinear_manager,
178  Topo::Topology & topology);
179 
180 } // namespace Analysis
181 } // namespace Xyce
182 
183 #endif // Xyce_N_ANP_AC_h
bool doProcessSuccessfulStep()
Definition: N_ANP_AC.C:650
bool doHandlePredictor()
Definition: N_ANP_AC.C:728
bool getDCOPFlag() const
Definition: N_ANP_AC.C:263
bool createLinearSystem_()
Definition: N_ANP_AC.C:497
bool setAnalysisParams(const Util::OptionBlock &paramsBlock)
Definition: N_ANP_AC.C:218
bool doLoopProcess()
Definition: N_ANP_AC.C:380
Linear::Matrix * C_
Definition: N_ANP_AC.h:156
void setTIAParams(const TimeIntg::TIAParams &tia_params)
Definition: N_ANP_AC.h:88
Pure virtual class to augment a linear system.
TimeIntg::TIAParams tiaParams_
Definition: N_ANP_AC.h:137
TimeIntg::TIAParams & getTIAParams()
Definition: N_ANP_AC.h:96
unsigned int stepNumber
Time-integration step number counter.
bool doProcessFailedStep()
Definition: N_ANP_AC.C:681
double currentFreq_
Definition: N_ANP_AC.h:154
virtual ~AC()
Definition: N_ANP_AC.C:176
bool registerACFactory(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_AC.C:1017
std::vector< int > acSweepFailures_
Definition: N_ANP_AC.h:144
bool setTimeIntegratorOptions(const Util::OptionBlock &option_block)
Definition: N_ANP_AC.C:103
Linear::Vector * bVecRealPtr
Definition: N_ANP_AC.h:139
Linear::BlockVector * B_
Definition: N_ANP_AC.h:159
int setupSweepParam_()
Definition: N_ANP_AC.C:784
Topo::Topology & topology_
Definition: N_ANP_AC.h:135
std::vector< double > scaled_dOdpVec_
Definition: N_ANP_AC.h:168
std::string type_
Definition: N_ANP_AC.h:147
std::vector< double > dOdpAdjVec_
Definition: N_ANP_AC.h:167
Amesos_BaseSolver * blockSolver_
Definition: N_ANP_AC.h:162
Nonlinear::Manager & nonlinearManager_
Definition: N_ANP_AC.h:134
OutputMgrAdapter & outputManagerAdapter_
Definition: N_ANP_AC.h:136
AC(AnalysisManager &analysis_manager, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager, Topo::Topology &topology)
Definition: N_ANP_AC.C:134
const TimeIntg::TIAParams & getTIAParams() const
Definition: N_ANP_AC.h:92
bool updateCurrentFreq_(int stepNumber)
Definition: N_ANP_AC.C:749
std::vector< double > scaled_dOdpAdjVec_
Definition: N_ANP_AC.h:169
Linear::BlockVector * X_
Definition: N_ANP_AC.h:160
Linear::System & linearSystem_
Definition: N_ANP_AC.h:133
bool updateLinearSystemFreq_()
Definition: N_ANP_AC.C:579
Factory for creating analysis objects.
AnalysisManager & analysisManager_
Definition: N_ANP_AC.h:131
std::vector< double > objectiveVec_
Definition: N_ANP_AC.h:165
Linear::Vector * bVecImagPtr
Definition: N_ANP_AC.h:140
Linear::BlockMatrix * ACMatrix_
Definition: N_ANP_AC.h:158
void printProgress(std::ostream &os)
Definition: N_ANP_AC.h:116
std::vector< double > dOdpVec_
Definition: N_ANP_AC.h:166
bool solveLinearSystem_()
Definition: N_ANP_AC.C:619
void printStepHeader(std::ostream &os)
Definition: N_ANP_AC.h:113
Epetra_LinearProblem * blockProblem_
Definition: N_ANP_AC.h:163
void notify(const StepEvent &event)
Definition: N_ANP_AC.C:195
Loader::Loader & loader_
Definition: N_ANP_AC.h:132
Linear::Matrix * G_
Definition: N_ANP_AC.h:157