Advanced Multi-Physics (AMP)
On-Line Documentation
ImplicitIntegrator.h
Go to the documentation of this file.
1#ifndef included_AMP_ImplicitIntegrator
2#define included_AMP_ImplicitIntegrator
3
4#include <string>
5
6#include "AMP/time_integrators/TimeIntegrator.h"
7#include "AMP/time_integrators/TimeIntegratorParameters.h"
8#include "AMP/time_integrators/TimeOperator.h"
9#include "AMP/vectors/Scalar.h"
10
11// Forward declares
12namespace AMP {
13class Database;
14}
15namespace AMP::Solver {
16class SolverStrategy;
17}
18
19namespace AMP::TimeIntegrator {
20
92{
93public:
112 std::shared_ptr<AMP::TimeIntegrator::TimeIntegratorParameters> prm );
113
115
116 // The following are not implemented:
118 void operator=( const ImplicitIntegrator & ) = delete;
119
124
129 void initialize( void );
130
135 void reset( void );
136
142 void reset(
143 std::shared_ptr<const AMP::TimeIntegrator::TimeIntegratorParameters> parameters ) override;
144
148 void registerOperator( std::shared_ptr<AMP::Operator::Operator> op ) override;
149
175 int advanceSolution( const double dt,
176 const bool first_step,
177 std::shared_ptr<AMP::LinearAlgebra::Vector> in,
178 std::shared_ptr<AMP::LinearAlgebra::Vector> out ) override;
179
188 bool checkNewSolution( void ) override;
189
197 void updateSolution( void ) override;
198
208 virtual double getNextDt( const bool good_solution ) override;
209
215 bool stepsRemaining() const override { return d_integrator_step < d_max_integrator_steps; }
216
220 virtual void printClassData( std::ostream &os ) const;
221
225 const std::string &getObjectName() const { return d_object_name; }
226
227 std::shared_ptr<AMP::Solver::SolverStrategy> getSolver( void ) { return d_solver; }
228 void resetSolver( std::shared_ptr<AMP::Solver::SolverStrategy> solver = nullptr )
229 {
231 }
232
234
236 void printStatistics( std::ostream &os = AMP::pout ) override;
237
239 // and nonlinear function for correct solution of the implicit problem
240 // each timestep. The first vector is for solution scaling, the second for function
241 void setComponentScalings( std::shared_ptr<AMP::LinearAlgebra::Vector> s,
242 std::shared_ptr<AMP::LinearAlgebra::Vector> f );
243
244 void setTimeScalingFunction( std::function<void( AMP::Scalar )> fnPtr )
245 {
247 }
248
250 std::function<void( std::shared_ptr<AMP::LinearAlgebra::Vector>,
251 std::shared_ptr<AMP::LinearAlgebra::Vector> )> fnPtr )
252 {
254 }
255
256 virtual std::shared_ptr<AMP::LinearAlgebra::Vector> getTimeHistorySourceTerm()
257 {
258 return nullptr;
259 };
260
261protected:
272 virtual void setInitialGuess( const bool first_step,
273 const double current_time,
274 const double current_dt,
275 const double old_dt );
276
277 virtual void setTimeHistoryScalings() {}
278
279 /*
280 * Pointers to implicit equation and solver strategy objects and patch
281 * hierarchy. The strategies provide nonlinear equation and solver
282 * routines for treating the nonlinear problem on the hierarchy.
283 */
284 std::shared_ptr<AMP::Solver::SolverStrategy> d_solver = nullptr;
285
286 std::shared_ptr<AMP::LinearAlgebra::Vector> d_solution_scaling;
287 std::shared_ptr<AMP::LinearAlgebra::Vector> d_function_scaling;
288
289 /*
290 * Data members representing integrator times, time increments,
291 * and step count information.
292 */
293
296
297 bool d_first_step = true;
298
300
303
306 virtual int
308 const bool first_step,
309 std::shared_ptr<AMP::LinearAlgebra::Vector> in,
310 std::shared_ptr<AMP::LinearAlgebra::Vector> out );
311
312 void createSolver( void );
313
316
318 std::function<void( std::shared_ptr<AMP::LinearAlgebra::Vector>,
319 std::shared_ptr<AMP::LinearAlgebra::Vector> )>
321
322public: // Write/read restart data
329
335 void writeRestart( int64_t fid ) const override;
336
344
345private:
349
353
355 virtual double integratorSpecificGetNextDt( const bool good_solution,
356 const int solver_retcode );
357
360 virtual void integratorSpecificInitialize( void );
361};
362
363} // namespace AMP::TimeIntegrator
364
365#endif
Class to manage reading/writing restart data.
Scalar is a class used to store a scalar variable that may be different types/precision.
Definition Scalar.h:21
Manage implicit time integration.
std::shared_ptr< AMP::Solver::SolverStrategy > d_solver
void reset(std::shared_ptr< const AMP::TimeIntegrator::TimeIntegratorParameters > parameters) override
void registerChildObjects(AMP::IO::RestartManager *manager) const override
Register any child objects.
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 entire patch hierarchy through the specified time increment.
virtual std::shared_ptr< AMP::LinearAlgebra::Vector > getTimeHistorySourceTerm()
virtual void integratorSpecificInitialize(void)
virtual int integratorSpecificAdvanceSolution(const double dt, const bool first_step, std::shared_ptr< AMP::LinearAlgebra::Vector > in, std::shared_ptr< AMP::LinearAlgebra::Vector > out)
std::shared_ptr< AMP::Solver::SolverStrategy > getSolver(void)
virtual double integratorSpecificGetNextDt(const bool good_solution, const int solver_retcode)
allows for specialization of getNextDt for classes of time integrators
void setComponentScalingFunction(std::function< void(std::shared_ptr< AMP::LinearAlgebra::Vector >, std::shared_ptr< AMP::LinearAlgebra::Vector >)> fnPtr)
virtual void printClassData(std::ostream &os) const
void setTimeScalingFunction(std::function< void(AMP::Scalar)> fnPtr)
virtual void setInitialGuess(const bool first_step, const double current_time, const double current_dt, const double old_dt)
bool d_user_managed_time_operator
user manages time operator
virtual double getNextDt(const bool good_solution) override
std::shared_ptr< AMP::LinearAlgebra::Vector > d_function_scaling
ImplicitIntegrator(std::shared_ptr< AMP::TimeIntegrator::TimeIntegratorParameters > prm)
void resetSolver(std::shared_ptr< AMP::Solver::SolverStrategy > solver=nullptr)
std::function< void(std::shared_ptr< AMP::LinearAlgebra::Vector >, std::shared_ptr< AMP::LinearAlgebra::Vector >)> d_fComponentScalingFnPtr
registered callback function to set multiphysics component scalings
ImplicitIntegrator(int64_t fid, AMP::IO::RestartManager *manager)
Read restart data to file.
void printStatistics(std::ostream &os=AMP::pout) override
print the statistics on the solver
void writeRestart(int64_t fid) const override
Write restart data to file.
virtual bool integratorSpecificCheckNewSolution(const int solver_retcode)
void setComponentScalings(std::shared_ptr< AMP::LinearAlgebra::Vector > s, std::shared_ptr< AMP::LinearAlgebra::Vector > f)
for multiphysics problems it may be necessary to scale the solution
ImplicitIntegrator(const ImplicitIntegrator &)=delete
std::shared_ptr< AMP::LinearAlgebra::Vector > d_solution_scaling
virtual void integratorSpecificUpdateSolution(double time)
bool d_time_history_initialized
whether it is the first step
const std::string & getObjectName() const
void operator=(const ImplicitIntegrator &)=delete
std::function< void(AMP::Scalar)> d_fTimeScalingFnPtr
registered callback function to set gamma, typically when the user needs to know gamma
void registerOperator(std::shared_ptr< AMP::Operator::Operator > op) override
Abstract base class for time integration.
std::shared_ptr< AMP::TimeIntegrator::TimeIntegrator > shared_ptr
Convience typedef.
virtual void initialize(std::shared_ptr< TimeIntegratorParameters > parameters)
Initialize state of time integrator.
std::ostream pout



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