Xyce  6.1
N_ANP_MixedSignalManager.C
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_MixedSignalManager.C,v $
27 // Purpose : This file contains the functions which define the time
28 // domain & integration algorithm classes.
29 // Special Notes :
30 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
31 // Creation Date : 01/24/08
32 //
33 // Revision Information:
34 // ---------------------
35 // Revision Number: $Revision: 1.5.2.1 $
36 // Revision Date : $Date: 2015/04/02 18:20:07 $
37 // Current Owner : $Author: tvrusso $
38 //-----------------------------------------------------------------------------
39 
40 #include <Xyce_config.h>
41 
43 #include <N_ANP_Transient.h>
44 #include <N_ERH_Message.h>
45 #include <N_LOA_Loader.h>
46 #include <N_NLS_Manager.h>
47 #include <N_TIA_StepErrorControl.h>
49 
50 namespace Xyce {
51 namespace Analysis {
52 
53 //-----------------------------------------------------------------------------
54 // Function : MixedSignalManager::provisionalStep
55 // Purpose : Used by mixed-signal.
56 // Special Notes :
57 // Scope : public
58 // Creator : Eric Keiter, SNL
59 // Creation Date : 03/04/2009
60 //-----------------------------------------------------------------------------
61 bool
63  const TimeIntg::TIAParams & tia_params,
64  Linear::System & linear_system,
65  Nonlinear::Manager & nonlinear_manager,
66  double maxTimeStep,
67  double & timeStep)
68 {
70  {
71  if (!getCreatorVector().empty()) {
72  mixedSignalAnalysisObject_ = dynamic_cast<Transient *>((*getCreatorVector().front()).create());
74  {
75  Report::UserError() << "Mixed signal requires transient analysis";
76  return false;
77  }
78  }
79  else
80  {
81  Report::DevelFatal().in("MixedSignalManager::provisionalStep") << "unknown type of analysis";
82  return false;
83  }
84 
86 
87  // Start the solvers timer.
88  getXyceTranTimer().resetStartTime();
90  }
91 
92  bool bsuccess = true;
93  bool dcopFlag = true;
94 
96  {
98  }
99 
100  // Now save time step info, in case this step gets rejected.
101 
102  if (!getStepErrorControl().isFinished())
103  {
104  bool stepSuccess = false;
105 
106  if (dcopFlag) // if dcop step, make one attempt.
107  {
109 
110  // only call finalize step here if we have failed.
111  if (!getStepErrorControl().stepAttemptStatus)
112  {
114  }
115  stepSuccess = getStepErrorControl().stepAttemptStatus;
116  }
117  else // else, if transient step, keep re-taking the step
118  // until it succeeds, or gets an unrecoverable failure,
119  // such as time-step-too-small.
120  {
121  bool recoverableFailureFlag=true;
122  while (!stepSuccess && recoverableFailureFlag)
123  {
125 
126  // Only call finalize step here if step has failed.
127  // If we succeed, we want to give Habanero the opportunity
128  // to reject the step, after this function (provisionalStep)
129  // exits.
130  if (!getStepErrorControl().stepAttemptStatus)
131  {
132  recoverableFailureFlag = mixedSignalAnalysisObject_->finalizeMixedSignalStep();
133  }
134  else
135  {
136  stepSuccess = true;
137  }
138  }
139  }
140  bsuccess = stepSuccess;
141  }
142 
143  // get the step information.
144  //
145  if (dcopFlag)
146  {
147  timeStep = 0.0;
148  }
149  else
150  {
152  }
153 
154  return bsuccess;
155 }
156 
157 //-----------------------------------------------------------------------------
158 // Function : MixedSignalManager::acceptMixedSignalProvisionalStep
159 // Purpose : Used by mixed-signal.
160 // Special Notes :
161 // Scope : public
162 // Creator : Eric Keiter, SNL
163 // Creation Date : 04/10/2009
164 //-----------------------------------------------------------------------------
166 {
168 }
169 
170 //-----------------------------------------------------------------------------
171 // Function : MixedSignalManager::rejectMixedSignalProvisionalStep
172 // Purpose : Used by mixed-signal.
173 // Special Notes :
174 // Scope : public
175 // Creator : Eric Keiter, SNL
176 // Creation Date : 04/10/2009
177 //-----------------------------------------------------------------------------
179  const TimeIntg::TIAParams & tia_params)
180 {
183 
184  bool dcopFlag = false;
186  {
188  }
189 
190  if (dcopFlag)
191  {
193  }
194 
195  else // Transient
196  {
199 
202  }
203 }
204 
205 } // namespace Analysis
206 } // namespace Xyce
Pure virtual class to augment a linear system.
virtual void stepFailure(Analysis::TwoLevelMode analysis)
Definition: N_LOA_Loader.h:286
void rejectMixedSignalProvisionalStep(const TimeIntg::TIAParams &tia_params)
unsigned int failedStepsAttempted_
Total number of failed time-integration steps.
TimeIntg::StepErrorControl & getStepErrorControl()
void setPrimaryAnalysisObject(AnalysisBase *primary)
bool mixedSignalStep(double maxTimeStepFromHabanero)
double initialTime
Beginning time for the time integrator (StepErrorControl, integrators access from StepErrorControl) ...
bool provisionalMixedSignalStep(const TimeIntg::TIAParams &tia_params, Linear::System &linear_system, Nonlinear::Manager &nonlinear_manager, double maxTimeStep, double &currTimeStep)
TimeIntg::WorkingIntegrationMethod & getWorkingIntegrationMethod()
bool updateBreakPoints(double initial_time)