18 #include "libmesh/time_solver.h" 20 #include "libmesh/diff_solver.h" 21 #include "libmesh/diff_system.h" 22 #include "libmesh/linear_solver.h" 23 #include "libmesh/no_solution_history.h" 25 #include "libmesh/adjoint_refinement_estimator.h" 26 #include "libmesh/error_vector.h" 38 reduce_deltat_on_diffsolver_failure (0),
43 last_deltat (s.deltat),
85 libmesh_assert_msg(
_system.
n_qois() != 0,
"System qois have to be initialized before initializing adjoints.");
90 std::string adjoint_solution_name =
"adjoint_solution";
91 adjoint_solution_name+= std::to_string(i);
138 return this->
_system.ImplicitSystem::adjoint_solve(qoi_indices);
143 libmesh_not_implemented();
148 libmesh_not_implemented();
151 #ifdef LIBMESH_ENABLE_AMR 156 libmesh_not_implemented();
158 #endif // LIBMESH_ENABLE_AMR virtual Real last_completed_timestep_size()
Returns system.deltat if fixed timestep solver is used, the complete timestep size (sum of all subste...
virtual void advance_timestep()
This method advances the solution to the next timestep, after a solve() has been performed.
Data structure for specifying which Parameters should be independent variables in a parameter sensiti...
static std::unique_ptr< LinearSolver< T > > build(const libMesh::Parallel::Communicator &comm_in, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a LinearSolver using the linear solver package specified by solver_package.
This class implements a "brute force" goal-oriented error estimator which computes an estimate of err...
virtual void init_data()
The data initialization function.
Data structure for specifying which Quantities of Interest should be calculated in an adjoint or a pa...
unsigned int n_qois() const
Number of currently active quantities of interest.
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
std::unique_ptr< SolutionHistory > solution_history
A std::unique_ptr to a SolutionHistory object.
virtual void reinit()
The reinitialization function.
const Parallel::Communicator & comm() const
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
virtual void integrate_adjoint_refinement_error_estimate(AdjointRefinementEstimator &adjoint_refinement_error_estimator, ErrorVector &QoI_elementwise_error)
A method to compute the adjoint refinement error estimate at the current timestep.
The libMesh namespace provides an interface to certain functionality in the library.
static std::unique_ptr< DiffSolver > build(sys_type &s)
Factory method.
virtual std::unique_ptr< SolutionHistory > clone() const =0
Cloning function for a std::unique_ptr, pure virtual, used in the setter function in time_solver...
virtual std::unique_ptr< DiffSolver > & diff_solver()
An implicit linear or nonlinear solver to use at each timestep.
A SolutionHistory class that enables the storage and retrieval of timesteps and (in the future) adapt...
const sys_type & system() const
This class provides a specific system class.
virtual void integrate_adjoint_sensitivity(const QoISet &qois, const ParameterVector ¶meter_vector, SensitivityData &sensitivities)
A method to integrate the adjoint sensitivity w.r.t a given parameter vector.
sys_type & _system
A reference to the system we are solving.
TimeSolver(sys_type &s)
Constructor.
'Save nothing' subclass of Solution History, this is the default.
Data structure for holding completed parameter sensitivity calculations.
virtual void init()
The initialization function.
virtual std::pair< unsigned int, Real > adjoint_solve(const QoISet &qoi_indices)
This method solves for the adjoint solution at the next adjoint timestep (or a steady state adjoint s...
virtual void retrieve_timestep()
This method retrieves all the stored solutions at the current system.time.
std::unique_ptr< LinearSolver< Number > > _linear_solver
An implicit linear solver to use for adjoint problems.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void set_solution_history(const SolutionHistory &_solution_history)
A setter function users will employ if they need to do something other than save no solution history...
virtual std::unique_ptr< LinearSolver< Number > > & linear_solver()
An implicit linear solver to use for adjoint and sensitivity problems.
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
virtual ~TimeSolver()
Destructor.
virtual void integrate_qoi_timestep()
A method to integrate the system::QoI functionals.
Real last_deltat
The deltat for the last completed timestep before the current one.
bool on_command_line(std::string arg)
virtual void adjoint_advance_timestep()
This method advances the adjoint solution to the previous timestep, after an adjoint_solve() has been...
const std::string & name() const
virtual void solve()
This method solves for the solution at the next timestep (or solves for a steady-state solution)...
virtual void init_adjoints()
Initialize any adjoint related data structures, based on the number of qois.
SolutionHistory & get_solution_history()
A getter function that returns a reference to the solution history object owned by TimeSolver...