Go to the documentation of this file.
19 #include "libmesh/diff_solver.h"
20 #include "libmesh/diff_system.h"
21 #include "libmesh/dof_map.h"
22 #include "libmesh/numeric_vector.h"
23 #include "libmesh/unsteady_solver.h"
34 first_adjoint_step (true)
59 #ifdef LIBMESH_ENABLE_GHOSTED
74 #ifdef LIBMESH_ENABLE_GHOSTED
107 bool backtracking_failed =
110 bool max_iterations =
113 if (backtracking_failed || max_iterations)
119 libMesh::out <<
"Newton backtracking failed. Trying with smaller timestep, dt="
125 bool backtracking_still_failed =
128 bool backtracking_max_iterations =
131 if (!backtracking_still_failed && !backtracking_max_iterations)
134 libMesh::out <<
"Reduced dt solve succeeded." << std::endl;
141 libMesh::out <<
"DiffSolver::solve() did not succeed after "
143 <<
" attempts." << std::endl;
144 libmesh_convergence_failure();
169 old_nonlinear_soln = nonlinear_solution;
230 std::unique_ptr<NumericVector<Number>> solution_copy =
235 solution_copy->close();
Real deltat
For time-dependent problems, this is the amount delta t to advance the solution in time.
virtual void reinit()
The reinitialization function.
virtual Real du(const SystemNorm &norm) const override
Computes the size of ||u^{n+1} - u^{n}|| in some norm.
unsigned int reduce_deltat_on_diffsolver_failure
This value (which defaults to zero) is the number of times the TimeSolver is allowed to halve deltat ...
virtual void reinit() override
The reinitialization function.
virtual void init()
The initialization function.
dof_id_type n_dofs() const
bool quiet
Print extra debugging information if quiet == false.
std::unique_ptr< DiffSolver > _diff_solver
An implicit linear or nonlinear solver to use at each timestep.
The libMesh namespace provides an interface to certain functionality in the library.
UnsteadySolver(sys_type &s)
Constructor.
The DiffSolver failed to find a descent direction by backtracking (See newton_solver....
This class provides a specific system class.
Number old_nonlinear_solution(const dof_id_type global_dof_number) const
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.
dof_id_type n_local_dofs() const
virtual void init_data() override
The data initialization function.
sys_type & _system
A reference to the system we are solving.
virtual void retrieve_timestep() override
This method retrieves all the stored solutions at the current system.time.
const std::vector< dof_id_type > & get_send_list() const
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
The DiffSolver reached the maximum allowed number of nonlinear iterations before satisfying any conve...
virtual void init_data()
The data initialization function.
bool first_solve
A bool that will be true the first time solve() is called, and false thereafter.
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
std::unique_ptr< NumericVector< Number > > old_local_nonlinear_solution
Serial vector of _system.get_vector("_old_nonlinear_solution")
virtual ~UnsteadySolver()
Destructor.
virtual void init() override
The initialization function.
virtual void advance_timestep() override
This method advances the solution to the next timestep, after a solve() has been performed.
MetaPhysicL::DualNumber< T, D > norm(const MetaPhysicL::DualNumber< T, D > &in)
This is a generic class that defines a solver to handle time integration of DifferentiableSystems.
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
This class defines a norm/seminorm to be applied to a NumericVector which contains coefficients in a ...
bool first_adjoint_step
A bool that will be true the first time adjoint_advance_timestep() is called, (when the primal soluti...
const DofMap & get_dof_map() const
dof_id_type n_dofs() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::unique_ptr< SolutionHistory > solution_history
A std::unique_ptr to a SolutionHistory object.
virtual void adjoint_advance_timestep() override
This method advances the adjoint solution to the previous timestep, after an adjoint_solve() has been...
const NumericVector< Number > & get_vector(const std::string &vec_name) const
virtual void solve() override
This method solves for the solution at the next timestep.