Xyce  6.1
N_ANP_NOISE.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-NOISE04-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_NOISE.h,v $
27 //
28 // Purpose : NOISE 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 : Eric Keiter
34 //
35 // Creation Date : 01/11
36 //
37 // Revision Information:
38 // ---------------------
39 //
40 // Revision Number: $Revision: 1.9.2.1 $
41 // Revision Date : $Date: 2015/04/02 18:20:06 $
42 // Current Owner : $Author: tvrusso $
43 //-----------------------------------------------------------------------------
44 
45 #ifndef Xyce_N_ANP_NOISE_h
46 #define Xyce_N_ANP_NOISE_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 : NOISE
70 // Purpose : NOISE analysis class
71 // Special Notes :
72 // Creator : Eric Keiter
73 // Creation Date : 12/8/2014
74 //-------------------------------------------------------------------------
75 class NOISE: public AnalysisBase, public Util::ListenerAutoSubscribe<StepEvent>
76 {
77  public:
78  NOISE(
79  AnalysisManager & analysis_manager,
80  Linear::System & linear_system,
81  Nonlinear::Manager & nonlinear_manager,
82  Topo::Topology & topology);
83 
84  ~NOISE();
85 
86  void notify(const StepEvent &event);
87 
89  return tiaParams_;
90  }
91 
93  return tiaParams_;
94  }
95 
96  bool setAnalysisParams(const N_UTL_OptionBlock & paramsBlock);
97  bool setTimeIntegratorOptions(const Util::OptionBlock &option_block);
98 
99  bool getDCOPFlag() const;
100 
101  bool doRun();
102  bool doInit();
103  bool doLoopProcess();
105  bool doProcessFailedStep();
106  bool doFinish();
107  bool doHandlePredictor();
108 
109  void printStepHeader(std::ostream &os)
110  {}
111 
112  void printProgress(std::ostream &os)
113  {}
114 
115 private:
116  int setupSweepParam_();
117 
118  bool updateCurrentFreq_(int stepNumber);
119 
120  bool createACLinearSystem_();
121 
122  bool resetACLinearSystem_();
123 
124  bool solveACLinearSystem_();
125 
126  bool solveDirectNOISE_();
127 
129  bool solveAdjointNOISE_();
130  void setupAdjointRHS_();
131 
132  double noiseIntegral( double noizDens, double lnNdens, double lnNlstDens,
133  double delLnFreq, double delFreq, double lnFreq, double lnLastFreq);
134 
135  void processOutputNodes ();
136 
137  void hackTecplotOutput();
138 
139 private:
142  N_LAS_System & linearSystem_;
144  Topo::Topology & topology_;
147 
148  // AC B-vectors
149  N_LAS_Vector * bVecRealPtr;
150  N_LAS_Vector * bVecImagPtr;
151 
152  // NOISE B-vectors
153  N_LAS_Vector * bNoiseVecRealPtr;
154  N_LAS_Vector * bNoiseVecImagPtr;
155 
159  std::string outputNode1_;
160  std::string outputNode2_;
161  std::string specifiedSource_;
163 
164  std::vector<int> noiseSweepFailures_;
165 
166  bool stepFlag_;
167  std::string type_;
168  double np_;
169  double fStart_;
170  double fStop_;
171 
172  double stepMult_;
173  double fstep_;
176 
177  double delFreq_;
178  double lastFreq_;
179  double currentFreq_;
180  double lnFreq_;
181  double lnLastFreq_;
182  double delLnFreq_;
183 
184  double GainSqInv_;
185  double lnGainInv_;
186 
189 
192 
193  N_LAS_Matrix * C_;
194  N_LAS_Matrix * G_;
195  N_LAS_BlockMatrix * ACMatrix_;
196  N_LAS_BlockVector * B_;
197  N_LAS_BlockVector * X_;
198  N_LAS_BlockVector * saved_AC_X_;
199 
200  Amesos_BaseSolver * blockSolver_;
201  Epetra_LinearProblem * blockProblem_;
202 
203  std::vector<std::string> outputVarNames_;
204  std::vector<int> outputVarGIDs_;
205 
206  std::vector<Xyce::Analysis::NoiseData*> noiseDataVec_;
207 
208  std::vector<double> objectiveVec_;
209  std::vector<double> dOdpVec_;
210  std::vector<double> dOdpAdjVec_;
211  std::vector<double> scaled_dOdpVec_;
212  std::vector<double> scaled_dOdpAdjVec_;
213 };
214 
216  const std::string & netlist_filename,
217  IO::PkgOptionsMgr & options_manager,
218  AnalysisManager & analysis_manager,
219  Linear::System & linear_system,
220  Nonlinear::Manager & nonlinear_manager,
221  Topo::Topology & topology);
222 
223 } // namespace Analysis
224 } // namespace Xyce
225 
226 #endif // Xyce_N_ANP_NOISE_h
N_LAS_BlockVector * saved_AC_X_
Definition: N_ANP_NOISE.h:198
const TimeIntg::TIAParams & getTIAParams() const
Definition: N_ANP_NOISE.h:88
std::vector< double > dOdpVec_
Definition: N_ANP_NOISE.h:209
Nonlinear::Manager & nonlinearManager_
Definition: N_ANP_NOISE.h:143
std::vector< double > scaled_dOdpAdjVec_
Definition: N_ANP_NOISE.h:212
TimeIntg::TIAParams tiaParams_
Definition: N_ANP_NOISE.h:146
N_LAS_BlockMatrix * ACMatrix_
Definition: N_ANP_NOISE.h:195
Pure virtual class to augment a linear system.
unsigned int stepNumber
Time-integration step number counter.
NOISE(AnalysisManager &analysis_manager, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager, Topo::Topology &topology)
Definition: N_ANP_NOISE.C:172
bool registerNOISEFactory(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_NOISE.C:1781
Epetra_LinearProblem * blockProblem_
Definition: N_ANP_NOISE.h:201
N_LAS_Matrix * G_
Definition: N_ANP_NOISE.h:194
std::vector< double > objectiveVec_
Definition: N_ANP_NOISE.h:208
std::string specifiedSource_
Definition: N_ANP_NOISE.h:161
std::vector< int > noiseSweepFailures_
Definition: N_ANP_NOISE.h:164
AnalysisManager & analysisManager_
Definition: N_ANP_NOISE.h:140
TimeIntg::TIAParams & getTIAParams()
Definition: N_ANP_NOISE.h:92
N_LAS_BlockVector * X_
Definition: N_ANP_NOISE.h:197
bool getDCOPFlag() const
Definition: N_ANP_NOISE.C:375
N_LAS_System & linearSystem_
Definition: N_ANP_NOISE.h:142
bool updateCurrentFreq_(int stepNumber)
Definition: N_ANP_NOISE.C:1500
N_LAS_BlockVector * B_
Definition: N_ANP_NOISE.h:196
N_LAS_Vector * bVecImagPtr
Definition: N_ANP_NOISE.h:150
std::vector< Xyce::Analysis::NoiseData * > noiseDataVec_
Definition: N_ANP_NOISE.h:206
Loader::Loader & loader_
Definition: N_ANP_NOISE.h:141
N_LAS_Matrix * C_
Definition: N_ANP_NOISE.h:193
std::vector< double > scaled_dOdpVec_
Definition: N_ANP_NOISE.h:211
void notify(const StepEvent &event)
Definition: N_ANP_NOISE.C:267
bool setTimeIntegratorOptions(const Util::OptionBlock &option_block)
Definition: N_ANP_NOISE.C:130
Amesos_BaseSolver * blockSolver_
Definition: N_ANP_NOISE.h:200
Factory for creating analysis objects.
N_LAS_Vector * bVecRealPtr
Definition: N_ANP_NOISE.h:149
Topo::Topology & topology_
Definition: N_ANP_NOISE.h:144
bool setAnalysisParams(const N_UTL_OptionBlock &paramsBlock)
Definition: N_ANP_NOISE.C:291
std::vector< std::string > outputVarNames_
Definition: N_ANP_NOISE.h:203
void printProgress(std::ostream &os)
Definition: N_ANP_NOISE.h:112
std::string outputNode2_
Definition: N_ANP_NOISE.h:160
std::string outputNode1_
Definition: N_ANP_NOISE.h:159
N_LAS_Vector * bNoiseVecImagPtr
Definition: N_ANP_NOISE.h:154
std::vector< int > outputVarGIDs_
Definition: N_ANP_NOISE.h:204
OutputMgrAdapter & outputManagerAdapter_
Definition: N_ANP_NOISE.h:145
void printStepHeader(std::ostream &os)
Definition: N_ANP_NOISE.h:109
void resetAdjointNOISELinearSystem_()
Definition: N_ANP_NOISE.C:1103
double noiseIntegral(double noizDens, double lnNdens, double lnNlstDens, double delLnFreq, double delFreq, double lnFreq, double lnLastFreq)
Definition: N_ANP_NOISE.C:1363
std::vector< double > dOdpAdjVec_
Definition: N_ANP_NOISE.h:210
N_LAS_Vector * bNoiseVecRealPtr
Definition: N_ANP_NOISE.h:153