Xyce  6.1
N_DEV_SolverState.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_DEV_SolverState.h,v $
27 //
28 // Purpose : This is a container class for solver information.
29 // It may occasionally contain stuff that isn't strictly
30 // pertaining to the solver state, but that is its primary
31 // intention.
32 //
33 // In general, stuff that goes into this class should
34 // be stuff needed by more than one device instance type.
35 //
36 // Special Notes :
37 //
38 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
39 //
40 // Creation Date : 02/28/00
41 //
42 // Revision Information:
43 // ---------------------
44 //
45 // Revision Number: $Revision: 1.86 $
46 //
47 // Revision Date : $Date: 2015/10/14 19:31:37 $
48 //
49 // Current Owner : $Author: tvrusso $
50 //-----------------------------------------------------------------------------
51 
52 
53 #ifndef Xyce_N_DEV_SolverState_h
54 #define Xyce_N_DEV_SolverState_h
55 
56 #include <map>
57 #include <string>
58 #include <vector>
59 
60 #include <N_ANP_fwd.h>
61 #include <N_UTL_fwd.h>
62 #include <N_DEV_fwd.h>
63 #include <N_PDS_fwd.h>
64 
65 #include <N_NLS_TwoLevelEnum.h>
66 #include <N_NLS_NonLinInfo.h>
67 
68 namespace Xyce {
69 namespace Device {
70 
71 struct Globals
72 {
74  std::vector<Util::Expression> global_expressions;
75  std::vector<std::string>global_exp_names;
76 };
77 
78 //-----------------------------------------------------------------------------
79 // Class : SolverState
80 // Purpose : Container for current solver data.
81 // Special Notes :
82 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
83 // Creation Date : 2/25/02
84 //-----------------------------------------------------------------------------
86 {
87  friend std::ostream& operator<<(std::ostream& os, const SolverState & ss);
88 
89 public:
90  SolverState();
91 
92  void initializeHomotopyBlockSize(int numBlocks);
93 
95  {
96  return const_cast<Globals &>(globals_);
97  }
98 
99 public:
100 
101  // Startup information
102  bool isPDESystem_; ///< true if circuit includes a PDE device
103 
104  // Time integrator information
105  double pdt_; ///< Previous delta time alpha/dt (Many devices)
106  int currentOrder_; ///< ROM
107  int usedOrder_; ///< ROM
108 
109  // Time step error control information
110  double currTimeStep_; ///< Region, BJT, Digital, ThermalResistor, ROM, Charon, Others
111  double lastTimeStep_; ///< BJT, Others
112  double currTime_; ///< DeviceEntity for expression time, breakpoints
113  ///< DeviceMgr for dependent parameters, breakpoints, extern device
114  ///< SourceData devices, ADC, DAC LTRA, TRA, Region, NumericalJacobian, RxnSet, Xygra, Digital
115  ///< 2D PDE, Diode PDE, Charon, Synapse, Neuron, Others
116  double finalTime_; ///< Analysis final time, SourceData devices
117  double startingTimeStep_; ///< SourceData devices
118  double bpTol_; ///< Break point tolerance, SourceData devices, Neuron devices
119 
120  // Mixed signal
121  double acceptedTime_; ///< DeviceMgr::acceptStep(), DAC (for habanero)
122 
123  // MPDE stuff
124  bool mpdeOnFlag_; ///< MPDE phase of MPDE problem (ie not initial condition)
125  double currFastTime_; ///< Source devices,
126 
127  bool blockAnalysisFlag_; ///< Source devices, BJTDW, This indicates an MPDE/HB run. This is true during both IC and MPDE/HB phase.
128 
129  // output flag:
130  bool doubleDCOPEnabled; // true if taking 2 DCOP steps for PDE sim.
131  int doubleDCOPStep; // 0 or 1. (first or second "double" DCOP).
132 
133  int timeStepNumber_; ///< Memristor, LTRA, TRA, testing if debug or jacobian for testing
134 
135  // The following "ltra*" data structures are used to track time history for
136  // the LTRA device. It requires an independent time history because
137  // it can be compacted if the user specifies that option. With no
138  // compaction ltraTimeStepNumber will be equal to timeStepNumber+1.
139  size_t ltraTimeIndex_; ///< LTRA, DeviceMgr::acceptStep()
140  size_t ltraTimeHistorySize_; ///< LTRA, this looks like c code array sizing
141  mutable bool ltraDoCompact_; ///< LTRA
142  std::vector<double> ltraTimePoints_; ///< LTRA
143 
148 
149  bool initTranFlag_; ///< RxnSet, TRA, LTRA, ACC, MOSFET, BJT, true only on very first(t=0) time step.
150  bool beginIntegrationFlag_; ///< BJT, true if 1st time step out of breakpoint (incl. t=0)
151 
152  bool dcopFlag; // true if we are in a DCOP calculation (sweep, tranop or OP)
153  bool inputOPFlag; // true if starting from a previous OP calculation
154 
155  bool transientFlag; // true if transient analysis(even during tranop)
156  bool dcsweepFlag; // true if DC Sweep or OP calculation.
157  bool tranopFlag; // true if in dcop phase of transient sim.
158  bool acopFlag; // true if in acop phase of ac sim.
159 
160  bool locaEnabledFlag; // true if LOCA is enabled for DCOP.
161 
164  bool initJctFlag_; ///< true if on the first newton step of the first dcop solve of the first .STEP iteration. BJT, JFET, Diode, MOSFET, SW, Extern
165 
166  bool initFixFlag; // true if DCOP solve, not first iteration *AND* any device not converged. Allows "OFF" to be applied.
167 
170 
172 
173  // Homotopy
174 
175  // PDE device BC homotopy/two-level newton
176  bool bjtArtParameterFlag_; ///< BJT homotopy variables (BJT Devices)
177  double pdeAlpha_; ///< PDEAlphaParam of ArtificialParameters
178 
179  bool PDEcontinuationFlag_; ///< PDE enable/disablePDSContinuation(), VsrcScaleParam, PDEBetaParam, PDEAlphaParam, Diode PDE Device, 2d PDE devices
180 
181  bool chargeHomotopy_; ///< 2d PDE Devices, ArtificialParameters
182  double chargeAlpha_; ///< 2d PDE Devices, ArtificialParameters
183 
184  // MOSFET homotopy variables
185  bool artParameterFlag_; ///< MOSFET Devices, ArtificialParameters
186  std::vector<double> gainScale_; ///< MOSFET Devices, ArtificialParameters
187  double nltermScale_; ///< MOSFET Devices, ArtificialParameters
188 
189  bool sizeParameterFlag_; ///< ArtificialParameters, not sure these are really used
190  double sizeScale_; ///< ArtificialParameters
191 
193 };
194 
195 bool setupSolverInfo(
196  SolverState & solver_state,
197  const Analysis::AnalysisManager & analysis_manager,
198  bool all_devices_converged,
199  const DeviceOptions & device_options,
200  const Nonlinear::NonLinInfo & nonlinear_info);
201 
202 } // namespace Device
203 } // namespace Xyce
204 
205 #endif
206 
std::vector< std::string > global_exp_names
bool chargeHomotopy_
2d PDE Devices, ArtificialParameters
Globals & getGlobals() const
bool bjtArtParameterFlag_
BJT homotopy variables (BJT Devices)
double pdt_
Previous delta time alpha/dt (Many devices)
double currTimeStep_
Region, BJT, Digital, ThermalResistor, ROM, Charon, Others.
bool initTranFlag_
RxnSet, TRA, LTRA, ACC, MOSFET, BJT, true only on very first(t=0) time step.
Pure virtual class to augment a linear system.
void initializeHomotopyBlockSize(int numBlocks)
double lastTimeStep_
BJT, Others.
std::vector< double > gainScale_
MOSFET Devices, ArtificialParameters.
double startingTimeStep_
SourceData devices.
double sizeScale_
ArtificialParameters.
size_t ltraTimeIndex_
LTRA, DeviceMgr::acceptStep()
std::vector< Util::Expression > global_expressions
Nonlinear::TwoLevelNewtonMode twoLevelNewtonCouplingMode
bool PDEcontinuationFlag_
PDE enable/disablePDSContinuation(), VsrcScaleParam, PDEBetaParam, PDEAlphaParam, Diode PDE Device...
double finalTime_
Analysis final time, SourceData devices.
bool blockAnalysisFlag_
Source devices, BJTDW, This indicates an MPDE/HB run. This is true during both IC and MPDE/HB phase...
bool sizeParameterFlag_
ArtificialParameters, not sure these are really used.
double pdeAlpha_
PDEAlphaParam of ArtificialParameters.
double bpTol_
Break point tolerance, SourceData devices, Neuron devices.
bool beginIntegrationFlag_
BJT, true if 1st time step out of breakpoint (incl. t=0)
bool setupSolverInfo(SolverState &solver_state, const Analysis::AnalysisManager &analysis_manager, bool all_devices_converged, const DeviceOptions &device_options, const Nonlinear::NonLinInfo &nonlinear_info)
int timeStepNumber_
Memristor, LTRA, TRA, testing if debug or jacobian for testing.
bool mpdeOnFlag_
MPDE phase of MPDE problem (ie not initial condition)
bool artParameterFlag_
MOSFET Devices, ArtificialParameters.
size_t ltraTimeHistorySize_
LTRA, this looks like c code array sizing.
unordered_map< std::string, double, HashNoCase, EqualNoCase > GlobalParameterMap
Definition: N_DEV_fwd.h:169
double nltermScale_
MOSFET Devices, ArtificialParameters.
friend std::ostream & operator<<(std::ostream &os, const SolverState &ss)
std::vector< double > ltraTimePoints_
LTRA.
bool isPDESystem_
true if circuit includes a PDE device
double acceptedTime_
DeviceMgr::acceptStep(), DAC (for habanero)
double chargeAlpha_
2d PDE Devices, ArtificialParameters
GlobalParameterMap global_params
double currTime_
DeviceEntity for expression time, breakpoints DeviceMgr for dependent parameters, breakpoints...
bool initJctFlag_
true if on the first newton step of the first dcop solve of the first .STEP iteration. BJT, JFET, Diode, MOSFET, SW, Extern
double currFastTime_
Source devices,.