Advanced Multi-Physics (AMP)
On-Line Documentation
IDATimeIntegrator.h
Go to the documentation of this file.
1#ifndef included_AMP_IDATimeIntegrator
2#define included_AMP_IDATimeIntegrator
3
4#include <string>
5
6
7#include "AMP/operators/LinearOperator.h"
8#include "AMP/time_integrators/TimeIntegrator.h"
9#include "AMP/time_integrators/sundials/IDATimeIntegratorParameters.h"
10#include "AMP/time_integrators/sundials/IDATimeOperator.h"
11#include "AMP/vectors/sundials/SundialsVector.h"
12
13#ifdef AMP_USE_SUNDIALS
14extern "C" {
15 #include "ida/ida.h"
16 #include "ida/ida_spgmr.h"
17 #include "sundials/sundials_nvector.h"
18 #include "sundials/sundials_types.h"
19}
20
21
22namespace AMP::TimeIntegrator {
23
24
39{
40public:
116 explicit IDATimeIntegrator( std::shared_ptr<TimeIntegratorParameters> parameters );
117
122
126 void initialize( std::shared_ptr<TimeIntegratorParameters> parameters ) override;
127
133 void reset( std::shared_ptr<const TimeIntegratorParameters> parameters ) override;
134
138 double getNextDt( const bool good_solution ) override;
139
143 void setInitialGuess( const bool first_step,
144 const double current_time,
145 const double current_dt,
146 const double old_dt );
147
148 int advanceSolution( const double dt,
149 const bool first_step,
150 std::shared_ptr<AMP::LinearAlgebra::Vector> in,
151 std::shared_ptr<AMP::LinearAlgebra::Vector> out ) override;
152
156 void updateSolution( void ) override;
157
158 void updateSourceTerm( void );
159
168 bool checkNewSolution( void ) override;
169
173 std::shared_ptr<IDATimeOperator> getIDATimeOperator() const; // BP, can go
174
178 std::shared_ptr<LinearTimeOperator> getLinearTimeOperator() const;
179
183 std::shared_ptr<AMP::LinearAlgebra::Vector> getResidualVector() const;
184
189
193 std::shared_ptr<AMP::LinearAlgebra::Vector> getSourceTerm() override;
194
198 inline std::shared_ptr<AMP::Solver::SolverStrategy> getPreconditioner( void )
199 {
200 return d_pNestedSolver;
201 }
202
206 inline void *getIDAMem( void ) { return d_ida_mem; }
207
208 std::string type() const override { return "IDATimeIntegrator"; }
209
213 std::shared_ptr<AMP::LinearAlgebra::Vector> d_residual;
214
215private:
220
222
226 void getFromInput( std::shared_ptr<AMP::Database> input_db ); // note that this was "protected"
227 // (and not virtual) in
228 // TimeIntegrator.h
229 // and BackwardEulerTimeIntegrator has own its implementation of getFromInput - overridden...?
230
231 // we definitely need this
232 void setupVectors( void );
233
235
237 N_Vector yy,
238 N_Vector yp,
239 N_Vector rr,
240 realtype cj,
241 void *user_data,
244 N_Vector tmp3 );
245
247 N_Vector yy,
248 N_Vector yp,
249 N_Vector rr,
252 realtype cj,
254 void *user_data,
255 N_Vector tmp );
256
258
261
263
264 // flag to decide whether to call the IDA consistent IC calculation (default=false)
266
267 // flag to decide whether to create the linear operator internally
269
270 // flag to use preconditioning
272
276
277 std::shared_ptr<IDATimeOperator> d_pIDATimeOperator; // BP, can go, but need to be careful
278 std::shared_ptr<LinearTimeOperator> d_pLinearTimeOperator;
279 std::shared_ptr<AMP::LinearAlgebra::Vector> d_solution_prime;
280
281 std::shared_ptr<AMP::Solver::SolverStrategy> d_pNestedSolver;
282};
283} // namespace AMP::TimeIntegrator
284
285#endif
286#endif
std::shared_ptr< AMP::LinearAlgebra::Vector > d_residual
std::shared_ptr< AMP::Solver::SolverStrategy > d_pNestedSolver
void reset(std::shared_ptr< const TimeIntegratorParameters > parameters) override
std::shared_ptr< LinearTimeOperator > getLinearTimeOperator() const
double getNextDt(const bool good_solution) override
std::shared_ptr< AMP::LinearAlgebra::Vector > d_solution_prime
static int IDAPrecSolve(realtype tt, N_Vector yy, N_Vector yp, N_Vector rr, N_Vector rvec, N_Vector zvec, realtype cj, realtype delta, void *user_data, N_Vector tmp)
std::shared_ptr< AMP::LinearAlgebra::Vector > getResidualVector() const
static int IDAResTrial(realtype tt, N_Vector yy, N_Vector yp, N_Vector rr, void *user_data)
void setInitialGuess(const bool first_step, const double current_time, const double current_dt, const double old_dt)
std::shared_ptr< IDATimeOperator > d_pIDATimeOperator
void getFromInput(std::shared_ptr< AMP::Database > input_db)
std::string type() const override
Return the name of the TimeIntegrator.
std::shared_ptr< LinearTimeOperator > d_pLinearTimeOperator
IDATimeIntegrator(std::shared_ptr< TimeIntegratorParameters > parameters)
std::shared_ptr< AMP::LinearAlgebra::Vector > getSourceTerm() override
std::shared_ptr< AMP::Solver::SolverStrategy > getPreconditioner(void)
void initialize(std::shared_ptr< TimeIntegratorParameters > parameters) override
static int IDAPrecSetup(realtype tt, N_Vector yy, N_Vector yp, N_Vector rr, realtype cj, void *user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3)
int advanceSolution(const double dt, const bool first_step, std::shared_ptr< AMP::LinearAlgebra::Vector > in, std::shared_ptr< AMP::LinearAlgebra::Vector > out) override
Integrate through the specified time increment.
std::shared_ptr< IDATimeOperator > getIDATimeOperator() const
Abstract base class for time integration.
std::shared_ptr< AMP::TimeIntegrator::TimeIntegrator > shared_ptr
Convience typedef.



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:41.
Comments on this page