libMesh
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | List of all members
libMesh::TwostepTimeSolver Class Reference

This class wraps another UnsteadySolver derived class, and compares the results of timestepping with deltat and timestepping with 2*deltat to adjust future timestep lengths. More...

#include <twostep_time_solver.h>

Inheritance diagram for libMesh::TwostepTimeSolver:
[legend]

Public Types

typedef AdaptiveTimeSolver Parent
 The parent class.
 
typedef DifferentiableSystem sys_type
 The type of system.
 

Public Member Functions

 TwostepTimeSolver (sys_type &s)
 Constructor.
 
 ~TwostepTimeSolver ()
 Destructor.
 
virtual void solve () override
 This method solves for the solution at the next timestep.
 
virtual std::pair< unsigned int, Realadjoint_solve (const QoISet &qoi_indices) override
 This method solves for the adjoint solution at the next adjoint timestep (or a steady state adjoint solve)
 
virtual void integrate_qoi_timestep () override
 A method to integrate the system::QoI functionals.
 
virtual void integrate_adjoint_sensitivity (const QoISet &qois, const ParameterVector &parameter_vector, SensitivityData &sensitivities) override
 A method to integrate the adjoint sensitivity w.r.t a given parameter vector.
 
virtual void integrate_adjoint_refinement_error_estimate (AdjointRefinementEstimator &adjoint_refinement_error_estimator, ErrorVector &QoI_elementwise_error) override
 A method to compute the adjoint refinement error estimate at the current timestep.
 
virtual void init () override
 The initialization function.
 
virtual void reinit () override
 The reinitialization function.
 
virtual void advance_timestep () override
 This method advances the solution to the next timestep, after a solve() has been performed.
 
virtual void adjoint_advance_timestep () override
 This method advances the adjoint solution to the previous timestep, after an adjoint_solve() has been performed.
 
virtual void retrieve_timestep () override
 This method retrieves all the stored solutions at the current system.time.
 
virtual Real last_completed_timestep_size () override
 Returns system.deltat if fixed timestep solver is used, the complete timestep size (sum of all substeps) if the adaptive time solver is used.
 
virtual Real error_order () const override
 This method is passed on to the core_time_solver.
 
virtual bool element_residual (bool get_jacobian, DiffContext &) override
 This method is passed on to the core_time_solver.
 
virtual bool side_residual (bool get_jacobian, DiffContext &) override
 This method is passed on to the core_time_solver.
 
virtual bool nonlocal_residual (bool get_jacobian, DiffContext &) override
 This method is passed on to the core_time_solver.
 
virtual std::unique_ptr< DiffSolver > & diff_solver () override
 An implicit linear or nonlinear solver to use at each timestep.
 
virtual std::unique_ptr< LinearSolver< Number > > & linear_solver () override
 An implicit linear solver to use for adjoint and sensitivity problems.
 
virtual unsigned int time_order () const override
 
virtual void init_adjoints () override
 Add adjoint vectors and old_adjoint_vectors as per the indices of QoISet.
 
virtual void init_data () override
 The data initialization function.
 
void update ()
 
Number old_nonlinear_solution (const dof_id_type global_dof_number) const
 
virtual Real du (const SystemNorm &norm) const override
 Computes the size of ||u^{n+1} - u^{n}|| in some norm.
 
virtual bool is_steady () const override
 This is not a steady-state solver.
 
void set_first_adjoint_step (bool first_adjoint_step_setting)
 A setter for the first_adjoint_step boolean.
 
void set_first_solve (bool first_solve_setting)
 
virtual void before_timestep ()
 This method is for subclasses or users to override to do arbitrary processing between timesteps.
 
const sys_typesystem () const
 
sys_typesystem ()
 
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.
 
SolutionHistoryget_solution_history ()
 A getter function that returns a reference to the solution history object owned by TimeSolver.
 
bool is_adjoint () const
 Accessor for querying whether we need to do a primal or adjoint solve.
 
void set_is_adjoint (bool _is_adjoint_value)
 Accessor for setting whether we need to do a primal or adjoint solve.
 

Static Public Member Functions

static std::string get_info ()
 Gets a string containing the reference information.
 
static void print_info (std::ostream &out_stream=libMesh::out)
 Prints the reference information, by default to libMesh::out.
 
static unsigned int n_objects ()
 Prints the number of outstanding (created, but not yet destroyed) objects.
 
static void enable_print_counter_info ()
 Methods to enable/disable the reference counter output from print_info().
 
static void disable_print_counter_info ()
 

Public Attributes

std::unique_ptr< UnsteadySolvercore_time_solver
 This object is used to take timesteps.
 
SystemNorm component_norm
 Error calculations are done in this norm, DISCRETE_L2 by default.
 
std::vector< float > component_scale
 If component_norms is non-empty, each variable's contribution to the error of a system will also be scaled by component_scale[var], unless component_scale is empty in which case all variables will be weighted equally.
 
Real target_tolerance
 This tolerance is the target relative error between an exact time integration and a single time step output, scaled by deltat.
 
Real upper_tolerance
 This tolerance is the maximum relative error between an exact time integration and a single time step output, scaled by deltat.
 
Real max_deltat
 Do not allow the adaptive time solver to select deltat > max_deltat.
 
Real min_deltat
 Do not allow the adaptive time solver to select deltat < min_deltat.
 
Real max_growth
 Do not allow the adaptive time solver to select a new deltat greater than max_growth times the old deltat.
 
Real completed_timestep_size
 The adaptive time solver's have two notions of deltat.
 
bool global_tolerance
 This flag, which is true by default, grows (shrinks) the timestep based on the expected global accuracy of the timestepping scheme.
 
std::shared_ptr< NumericVector< Number > > old_local_nonlinear_solution
 Serial vector of _system.get_vector("_old_nonlinear_solution") This is a shared_ptr so that it can be shared between different derived class instances, as in e.g.
 
bool quiet
 Print extra debugging information if quiet == false.
 
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 and let the DiffSolver repeat the latest failed solve with a reduced timestep.
 

Protected Types

typedef bool(DifferentiablePhysics::* ResFuncType) (bool, DiffContext &)
 Definitions of argument types for use in refactoring subclasses.
 
typedef void(DiffContext::* ReinitFuncType) (Real)
 
typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 Data structure to log the information.
 

Protected Member Functions

virtual Real calculate_norm (System &, NumericVector< Number > &)
 A helper function to calculate error norms.
 
void prepare_accel (DiffContext &context)
 If there are second order variables in the system, then we also prepare the accel for those variables so the user can treat them as such.
 
bool compute_second_order_eqns (bool compute_jacobian, DiffContext &c)
 If there are second order variables, then we need to compute their residual equations and corresponding Jacobian.
 
void increment_constructor_count (const std::string &name) noexcept
 Increments the construction counter.
 
void increment_destructor_count (const std::string &name) noexcept
 Increments the destruction counter.
 

Protected Attributes

bool first_solve
 A bool that will be true the first time solve() is called, and false thereafter.
 
bool first_adjoint_step
 A bool that will be true the first time adjoint_advance_timestep() is called, (when the primal solution is to be used to set adjoint boundary conditions) and false thereafter.
 
std::vector< std::unique_ptr< NumericVector< Number > > > old_adjoints
 A vector of pointers to vectors holding the adjoint solution at the last time step.
 
Real last_step_deltat
 We will need to move the system.time around to ensure that residuals are built with the right deltat and the right time.
 
Real next_step_deltat
 
std::unique_ptr< DiffSolver_diff_solver
 An implicit linear or nonlinear solver to use at each timestep.
 
std::unique_ptr< LinearSolver< Number > > _linear_solver
 An implicit linear solver to use for adjoint problems.
 
sys_type_system
 A reference to the system we are solving.
 
std::unique_ptr< SolutionHistorysolution_history
 A std::unique_ptr to a SolutionHistory object.
 
Real last_deltat
 The deltat for the last completed timestep before the current one.
 

Static Protected Attributes

static Counts _counts
 Actually holds the data.
 
static Threads::atomic< unsigned int_n_objects
 The number of objects.
 
static Threads::spin_mutex _mutex
 Mutual exclusion object to enable thread-safe reference counting.
 
static bool _enable_print_counter = true
 Flag to control whether reference count information is printed when print_info is called.
 

Private Attributes

bool _is_adjoint
 This boolean tells the TimeSolver whether we are solving a primal or adjoint problem.
 

Detailed Description

This class wraps another UnsteadySolver derived class, and compares the results of timestepping with deltat and timestepping with 2*deltat to adjust future timestep lengths.

Currently this class only works on fully coupled Systems

This class is part of the new DifferentiableSystem framework, which is still experimental. Users of this framework should beware of bugs and future API changes.

Author
Roy H. Stogner
Date
2007

Definition at line 50 of file twostep_time_solver.h.

Member Typedef Documentation

◆ Counts

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information.

The log is identified by the class name.

Definition at line 119 of file reference_counter.h.

◆ Parent

The parent class.

Definition at line 56 of file twostep_time_solver.h.

◆ ReinitFuncType

typedef void(DiffContext::* libMesh::TimeSolver::ReinitFuncType) (Real)
protectedinherited

Definition at line 327 of file time_solver.h.

◆ ResFuncType

typedef bool(DifferentiablePhysics::* libMesh::TimeSolver::ResFuncType) (bool, DiffContext &)
protectedinherited

Definitions of argument types for use in refactoring subclasses.

Definition at line 325 of file time_solver.h.

◆ sys_type

The type of system.

Definition at line 69 of file time_solver.h.

Constructor & Destructor Documentation

◆ TwostepTimeSolver()

libMesh::TwostepTimeSolver::TwostepTimeSolver ( sys_type s)
explicit

Constructor.

Requires a reference to the system to be solved.

Definition at line 40 of file twostep_time_solver.C.

42
43{
44 // We start with a reasonable time solver: implicit Euler
45 core_time_solver = std::make_unique<EulerSolver>(s);
46}
std::unique_ptr< UnsteadySolver > core_time_solver
This object is used to take timesteps.
AdaptiveTimeSolver(sys_type &s)
Constructor.

References libMesh::AdaptiveTimeSolver::core_time_solver.

◆ ~TwostepTimeSolver()

libMesh::TwostepTimeSolver::~TwostepTimeSolver ( )
default

Destructor.

Member Function Documentation

◆ adjoint_advance_timestep()

void libMesh::AdaptiveTimeSolver::adjoint_advance_timestep ( )
overridevirtualinherited

This method advances the adjoint solution to the previous timestep, after an adjoint_solve() has been performed.

This will be done before every UnsteadySolver::adjoint_solve().

Reimplemented from libMesh::UnsteadySolver.

Definition at line 126 of file adaptive_time_solver.C.

127{
128 // Store the computed full step adjoint solution for future use (sub steps are handled internally by the core time solver)
129 core_time_solver->get_solution_history().store(true, _system.time);
130
131 // For the first adjoint step ensure that we use the last primal timestep.
133 {
134 _system.deltat = dynamic_cast<DifferentiableSystem &>(_system).time_solver->TimeSolver::last_completed_timestep_size();
135 first_adjoint_step = false;
136 }
137
138 // Before moving to the next time instant, copy over the current adjoint solutions into _old_adjoint_solutions
139 for(auto i : make_range(_system.n_qois()))
140 {
141 std::string old_adjoint_solution_name = "_old_adjoint_solution";
142 old_adjoint_solution_name+= std::to_string(i);
143 NumericVector<Number> & old_adjoint_solution_i = _system.get_vector(old_adjoint_solution_name);
144 NumericVector<Number> & adjoint_solution_i = _system.get_adjoint_solution(i);
145 old_adjoint_solution_i = adjoint_solution_i;
146 }
147
149
150 // For the adaptive time solver, all SH operations
151 // are handled by the core_time_solver's SH object
152 // Retrieve the primal solution for the next adjoint calculation,
153 // by using the core time solver's solution history object.
154 core_time_solver->get_solution_history().retrieve(true, _system.time);
155
156 // We also need to tell the core time solver that the adjoint initial conditions have been set
157 core_time_solver->set_first_adjoint_step(false);
158
159 // Dont forget to localize the old_nonlinear_solution !
160 _system.get_vector("_old_nonlinear_solution").localize
163}
Real deltat
For time-dependent problems, this is the amount delta t to advance the solution in time.
const std::vector< dof_id_type > & get_send_list() const
Definition dof_map.h:533
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
Definition system.h:1677
const DofMap & get_dof_map() const
Definition system.h:2417
NumericVector< Number > & get_adjoint_solution(unsigned int i=0)
Definition system.C:1232
const NumericVector< Number > & get_vector(std::string_view vec_name) const
Definition system.C:931
sys_type & _system
A reference to the system we are solving.
bool first_adjoint_step
A bool that will be true the first time adjoint_advance_timestep() is called, (when the primal soluti...
std::shared_ptr< NumericVector< Number > > old_local_nonlinear_solution
Serial vector of _system.get_vector("_old_nonlinear_solution") This is a shared_ptr so that it can be...
template class LIBMESH_EXPORT NumericVector< Number >
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...
Definition int_range.h:176

References libMesh::TimeSolver::_system, libMesh::AdaptiveTimeSolver::core_time_solver, libMesh::DifferentiableSystem::deltat, libMesh::UnsteadySolver::first_adjoint_step, libMesh::System::get_adjoint_solution(), libMesh::System::get_dof_map(), libMesh::DofMap::get_send_list(), libMesh::System::get_vector(), libMesh::NumericVector< T >::localize(), libMesh::make_range(), libMesh::System::n_qois(), libMesh::UnsteadySolver::old_local_nonlinear_solution, and libMesh::System::time.

◆ adjoint_solve()

std::pair< unsigned int, Real > libMesh::TwostepTimeSolver::adjoint_solve ( const QoISet qoi_indices)
overridevirtual

This method solves for the adjoint solution at the next adjoint timestep (or a steady state adjoint solve)

Implements libMesh::AdaptiveTimeSolver.

Definition at line 298 of file twostep_time_solver.C.

299{
300 // Take the first adjoint 'half timestep'
301 core_time_solver->adjoint_solve(qoi_indices);
302
303 // We print the forward 'half solution' norms and we will do so for the adjoints if running in dbg.
304 #ifdef DEBUG
305 for(auto i : make_range(_system.n_qois()))
306 {
307 for(auto j : make_range(_system.n_vars()))
308 libMesh::out<<"||Z_"<<"("<<_system.time<<";"<<i<<","<<j<<")||_H1: "<<_system.calculate_norm(_system.get_adjoint_solution(i), j,H1)<<std::endl;
309 }
310 #endif
311
312 // Record the sub step deltat we used for the last adjoint solve.
314
315 // Adjoint advance the timestep
316 core_time_solver->adjoint_advance_timestep();
317
318 // We have to contend with the fact that the delta_t set by SolutionHistory will not be the
319 // delta_t for the adjoint solve. At time t_i, the adjoint solve uses the same delta_t
320 // as the primal solve, pulling the adjoint solution from t_i+1 to t_i.
321 // FSH however sets delta_t to the value which takes us from t_i to t_i-1.
322 // Therefore use the last_deltat for the solve and reset system delta_t after the solve.
323 Real temp_deltat = _system.deltat;
325
326 // The second half timestep
327 std::pair<unsigned int, Real> full_adjoint_output = core_time_solver->adjoint_solve(qoi_indices);
328
329 // Record the sub step deltat we used for the last adjoint solve and reset the system deltat to the
330 // value set by SolutionHistory.
332 _system.deltat = temp_deltat;
333
334 // Record the total size of the last timestep, for a 2StepTS, this is
335 // simply twice the deltat for each sub(half) step.
337
338 return full_adjoint_output;
339}
unsigned int n_vars
virtual Real calculate_norm(System &, NumericVector< Number > &)
A helper function to calculate error norms.
Real completed_timestep_size
The adaptive time solver's have two notions of deltat.
Real last_deltat
The deltat for the last completed timestep before the current one.
The libMesh namespace provides an interface to certain functionality in the library.
OStreamProxy out
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

References libMesh::TimeSolver::_system, libMesh::System::calculate_norm(), libMesh::AdaptiveTimeSolver::completed_timestep_size, libMesh::AdaptiveTimeSolver::core_time_solver, libMesh::DifferentiableSystem::deltat, libMesh::System::get_adjoint_solution(), libMesh::H1, libMesh::TimeSolver::last_deltat, libMesh::make_range(), libMesh::System::n_qois(), libMesh::System::n_vars(), libMesh::out, libMesh::Real, and libMesh::System::time.

◆ advance_timestep()

void libMesh::AdaptiveTimeSolver::advance_timestep ( )
overridevirtualinherited

This method advances the solution to the next timestep, after a solve() has been performed.

Often this will be done after every UnsteadySolver::solve(), but adaptive mesh refinement and/or adaptive time step selection may require some solve() steps to be repeated.

Reimplemented from libMesh::UnsteadySolver.

Definition at line 89 of file adaptive_time_solver.C.

90{
91 // The first access of advance_timestep happens via solve, not user code
92 // It is used here to store any initial conditions data
93 if (!first_solve)
94 {
96 }
97 else
98 {
99 // We are here because of a call to advance_timestep that happens
100 // via solve, the very first solve. All we are doing here is storing
101 // the initial condition. The actual solution computed via this solve
102 // will be stored when we call advance_timestep in the user's timestep loop
103 first_solve = false;
104 core_time_solver->set_first_solve(false);
105 }
106
107 // For the adaptive time solver, all SH operations
108 // are handled by the core_time_solver's SH object
109 // Sub solution storage is handled internally by the core time solver,
110 // but the 'full step' solution is stored here to maintain consistency
111 // with the fixed timestep scheme.
112 core_time_solver->get_solution_history().store(false, _system.time);
113
114 NumericVector<Number> & old_nonlinear_soln =
115 _system.get_vector("_old_nonlinear_solution");
116 NumericVector<Number> & nonlinear_solution =
117 *(_system.solution);
118
119 old_nonlinear_soln = nonlinear_solution;
120
121 old_nonlinear_soln.localize
124}
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition system.h:1655
bool first_solve
A bool that will be true the first time solve() is called, and false thereafter.

References libMesh::TimeSolver::_system, libMesh::AdaptiveTimeSolver::completed_timestep_size, libMesh::AdaptiveTimeSolver::core_time_solver, libMesh::UnsteadySolver::first_solve, libMesh::System::get_dof_map(), libMesh::DofMap::get_send_list(), libMesh::System::get_vector(), libMesh::NumericVector< T >::localize(), libMesh::UnsteadySolver::old_local_nonlinear_solution, libMesh::System::solution, and libMesh::System::time.

Referenced by solve().

◆ before_timestep()

virtual void libMesh::TimeSolver::before_timestep ( )
inlinevirtualinherited

This method is for subclasses or users to override to do arbitrary processing between timesteps.

Definition at line 205 of file time_solver.h.

205{}

◆ calculate_norm()

Real libMesh::AdaptiveTimeSolver::calculate_norm ( System s,
NumericVector< Number > &  v 
)
protectedvirtualinherited

A helper function to calculate error norms.

Definition at line 225 of file adaptive_time_solver.C.

227{
228 return s.calculate_norm(v, component_norm);
229}
SystemNorm component_norm
Error calculations are done in this norm, DISCRETE_L2 by default.

References libMesh::System::calculate_norm(), and libMesh::AdaptiveTimeSolver::component_norm.

Referenced by solve().

◆ compute_second_order_eqns()

bool libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns ( bool  compute_jacobian,
DiffContext c 
)
protectedinherited

If there are second order variables, then we need to compute their residual equations and corresponding Jacobian.

The residual equation will simply be \( \dot{u} - v = 0 \), where \( u \) is the second order variable add by the user and \( v \) is the variable added by the time-solver as the "velocity" variable.

Definition at line 33 of file first_order_unsteady_solver.C.

34{
35 FEMContext & context = cast_ref<FEMContext &>(c);
36
37 unsigned int n_qpoints = context.get_element_qrule().n_points();
38
39 for (auto var : make_range(context.n_vars()))
40 {
41 if (!this->_system.is_second_order_var(var))
42 continue;
43
44 unsigned int dot_var = this->_system.get_second_order_dot_var(var);
45
46 // We're assuming that the FE space for var and dot_var are the same
47 libmesh_assert( context.get_system().variable(var).type() ==
48 context.get_system().variable(dot_var).type() );
49
50 FEBase * elem_fe = nullptr;
51 context.get_element_fe( var, elem_fe );
52
53 const std::vector<Real> & JxW = elem_fe->get_JxW();
54
55 const std::vector<std::vector<Real>> & phi = elem_fe->get_phi();
56
57 const unsigned int n_dofs = cast_int<unsigned int>
58 (context.get_dof_indices(dot_var).size());
59
60 DenseSubVector<Number> & Fu = context.get_elem_residual(var);
61 DenseSubMatrix<Number> & Kuu = context.get_elem_jacobian( var, var );
62 DenseSubMatrix<Number> & Kuv = context.get_elem_jacobian( var, dot_var );
63
64 for (unsigned int qp = 0; qp != n_qpoints; ++qp)
65 {
66 Number udot, v;
67 context.interior_rate(var, qp, udot);
68 context.interior_value(dot_var, qp, v);
69
70 for (unsigned int i = 0; i < n_dofs; i++)
71 {
72 Fu(i) += JxW[qp]*(udot-v)*phi[i][qp];
73
75 {
76 Number rate_factor = JxW[qp]*context.get_elem_solution_rate_derivative()*phi[i][qp];
77 Number soln_factor = JxW[qp]*context.get_elem_solution_derivative()*phi[i][qp];
78
79 Kuu(i,i) += rate_factor*phi[i][qp];
80 Kuv(i,i) -= soln_factor*phi[i][qp];
81
82 for (unsigned int j = i+1; j < n_dofs; j++)
83 {
84 Kuu(i,j) += rate_factor*phi[j][qp];
85 Kuu(j,i) += rate_factor*phi[j][qp];
86
87 Kuv(i,j) -= soln_factor*phi[j][qp];
88 Kuv(j,i) -= soln_factor*phi[j][qp];
89 }
90 }
91 }
92 }
93 }
94
95 return compute_jacobian;
96}
bool is_second_order_var(unsigned int var) const
unsigned int get_second_order_dot_var(unsigned int var) const
For a given second order (in time) variable var, this method will return the index to the correspondi...
libmesh_assert(ctx)
FEGenericBase< Real > FEBase
void compute_jacobian(const NumericVector< Number > &, SparseMatrix< Number > &J, NonlinearImplicitSystem &system)
Definition assembly.C:315

References libMesh::TimeSolver::_system, compute_jacobian(), libMesh::DiffContext::get_dof_indices(), libMesh::DiffContext::get_elem_jacobian(), libMesh::DiffContext::get_elem_residual(), libMesh::DiffContext::get_elem_solution_derivative(), libMesh::DiffContext::get_elem_solution_rate_derivative(), libMesh::FEMContext::get_element_fe(), libMesh::FEMContext::get_element_qrule(), libMesh::FEAbstract::get_JxW(), libMesh::FEGenericBase< OutputType >::get_phi(), libMesh::DifferentiableSystem::get_second_order_dot_var(), libMesh::DiffContext::get_system(), libMesh::FEMContext::interior_rate(), libMesh::FEMContext::interior_value(), libMesh::DifferentiablePhysics::is_second_order_var(), libMesh::libmesh_assert(), libMesh::make_range(), libMesh::QBase::n_points(), libMesh::DiffContext::n_vars(), libMesh::Variable::type(), and libMesh::System::variable().

Referenced by libMesh::Euler2Solver::_general_residual(), libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::element_residual(), libMesh::EulerSolver::element_residual(), libMesh::Euler2Solver::nonlocal_residual(), and libMesh::EulerSolver::nonlocal_residual().

◆ diff_solver()

std::unique_ptr< DiffSolver > & libMesh::AdaptiveTimeSolver::diff_solver ( )
overridevirtualinherited

An implicit linear or nonlinear solver to use at each timestep.

Reimplemented from libMesh::TimeSolver.

Definition at line 211 of file adaptive_time_solver.C.

212{
213 return core_time_solver->diff_solver();
214}

References libMesh::AdaptiveTimeSolver::core_time_solver.

◆ disable_print_counter_info()

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 100 of file reference_counter.C.

101{
102 _enable_print_counter = false;
103 return;
104}
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called.

References libMesh::ReferenceCounter::_enable_print_counter.

◆ du()

Real libMesh::UnsteadySolver::du ( const SystemNorm norm) const
overridevirtualinherited

Computes the size of ||u^{n+1} - u^{n}|| in some norm.

Note
While you can always call this function, its result may or may not be very meaningful. For example, if you call this function right after calling advance_timestep() then you'll get a result of zero since old_nonlinear_solution is set equal to nonlinear_solution in this function.

Implements libMesh::TimeSolver.

Definition at line 348 of file unsteady_solver.C.

349{
350
351 std::unique_ptr<NumericVector<Number>> solution_copy =
352 _system.solution->clone();
353
354 solution_copy->add(-1., _system.get_vector("_old_nonlinear_solution"));
355
356 solution_copy->close();
357
358 return _system.calculate_norm(*solution_copy, norm);
359}
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
Definition system.C:1511

References libMesh::TimeSolver::_system, libMesh::System::calculate_norm(), libMesh::System::get_vector(), and libMesh::System::solution.

◆ element_residual()

bool libMesh::AdaptiveTimeSolver::element_residual ( bool  get_jacobian,
DiffContext context 
)
overridevirtualinherited

This method is passed on to the core_time_solver.

Implements libMesh::TimeSolver.

Definition at line 181 of file adaptive_time_solver.C.

183{
185
186 return core_time_solver->element_residual(request_jacobian, context);
187}

References libMesh::AdaptiveTimeSolver::core_time_solver, and libMesh::libmesh_assert().

◆ enable_print_counter_info()

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info().

Enabled by default.

Definition at line 94 of file reference_counter.C.

95{
97 return;
98}

References libMesh::ReferenceCounter::_enable_print_counter.

Referenced by libMesh::LibMeshInit::~LibMeshInit().

◆ error_order()

Real libMesh::AdaptiveTimeSolver::error_order ( ) const
overridevirtualinherited

This method is passed on to the core_time_solver.

Implements libMesh::UnsteadySolver.

Definition at line 172 of file adaptive_time_solver.C.

173{
175
176 return core_time_solver->error_order();
177}

References libMesh::AdaptiveTimeSolver::core_time_solver, and libMesh::libmesh_assert().

◆ get_info()

std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

48{
49#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50
51 std::ostringstream oss;
52
53 oss << '\n'
54 << " ---------------------------------------------------------------------------- \n"
55 << "| Reference count information |\n"
56 << " ---------------------------------------------------------------------------- \n";
57
58 for (const auto & [name, cd] : _counts)
59 oss << "| " << name << " reference count information:\n"
60 << "| Creations: " << cd.first << '\n'
61 << "| Destructions: " << cd.second << '\n';
62
63 oss << " ---------------------------------------------------------------------------- \n";
64
65 return oss.str();
66
67#else
68
69 return "";
70
71#endif
72}
static Counts _counts
Actually holds the data.
std::string name(const ElemQuality q)
This function returns a string containing some name for q.

References libMesh::ReferenceCounter::_counts.

Referenced by libMesh::ReferenceCounter::print_info().

◆ get_solution_history()

SolutionHistory & libMesh::TimeSolver::get_solution_history ( )
inherited

A getter function that returns a reference to the solution history object owned by TimeSolver.

Definition at line 124 of file time_solver.C.

125{
126 return *solution_history;
127}
std::unique_ptr< SolutionHistory > solution_history
A std::unique_ptr to a SolutionHistory object.

References libMesh::TimeSolver::solution_history.

Referenced by libMesh::AdaptiveTimeSolver::init().

◆ increment_constructor_count()

void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the construction counter.

Should be called in the constructor of any derived class that will be reference counted.

Definition at line 183 of file reference_counter.h.

184{
185 libmesh_try
186 {
187 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
188 std::pair<unsigned int, unsigned int> & p = _counts[name];
189 p.first++;
190 }
191 libmesh_catch (...)
192 {
193 auto stream = libMesh::err.get();
194 stream->exceptions(stream->goodbit); // stream must not throw
195 libMesh::err << "Encountered unrecoverable error while calling "
196 << "ReferenceCounter::increment_constructor_count() "
197 << "for a(n) " << name << " object." << std::endl;
198 std::terminate();
199 }
200}
streamT * get()
Rather than implement every ostream/ios/ios_base function, we'll be lazy and make esoteric uses go th...
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition threads.C:30
OStreamProxy err

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< T >::ReferenceCountedObject(), libMesh::ReferenceCountedObject< T >::ReferenceCountedObject(), and libMesh::ReferenceCountedObject< T >::ReferenceCountedObject().

◆ increment_destructor_count()

void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the destruction counter.

Should be called in the destructor of any derived class that will be reference counted.

Definition at line 207 of file reference_counter.h.

208{
209 libmesh_try
210 {
211 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
212 std::pair<unsigned int, unsigned int> & p = _counts[name];
213 p.second++;
214 }
215 libmesh_catch (...)
216 {
217 auto stream = libMesh::err.get();
218 stream->exceptions(stream->goodbit); // stream must not throw
219 libMesh::err << "Encountered unrecoverable error while calling "
220 << "ReferenceCounter::increment_destructor_count() "
221 << "for a(n) " << name << " object." << std::endl;
222 std::terminate();
223 }
224}

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< T >::~ReferenceCountedObject().

◆ init()

void libMesh::AdaptiveTimeSolver::init ( )
overridevirtualinherited

The initialization function.

This method is used to initialize internal data structures before a simulation begins.

Reimplemented from libMesh::UnsteadySolver.

Definition at line 54 of file adaptive_time_solver.C.

55{
57
58 // We override this because our core_time_solver is the one that
59 // needs to handle new vectors, diff_solver->init(), etc
60 core_time_solver->init();
61
62 // Set the core_time_solver's solution history object to be the same one as
63 // that for the outer adaptive time solver
64 core_time_solver->set_solution_history((this->get_solution_history()));
65
66 // Now that we have set the SolutionHistory object for the coretimesolver,
67 // we set the SolutionHistory type for the timesolver to be NoSolutionHistory
68 // All storage and retrieval will be handled by the coretimesolver directly.
69 NoSolutionHistory outersolver_solution_history;
70 this->set_solution_history(outersolver_solution_history);
71
72 // As an UnsteadySolver, we have an old_local_nonlinear_solution, but it
73 // isn't pointing to the right place - fix it
74 old_local_nonlinear_solution = core_time_solver->old_local_nonlinear_solution;
75}
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.
SolutionHistory & get_solution_history()
A getter function that returns a reference to the solution history object owned by TimeSolver.

References libMesh::AdaptiveTimeSolver::core_time_solver, libMesh::TimeSolver::get_solution_history(), libMesh::libmesh_assert(), libMesh::UnsteadySolver::old_local_nonlinear_solution, and libMesh::TimeSolver::set_solution_history().

◆ init_adjoints()

void libMesh::UnsteadySolver::init_adjoints ( )
overridevirtualinherited

Add adjoint vectors and old_adjoint_vectors as per the indices of QoISet.

Reimplemented from libMesh::TimeSolver.

Definition at line 68 of file unsteady_solver.C.

69{
71
72 // Add old adjoint solutions
73 // To keep the number of vectors consistent between the primal and adjoint
74 // time loops, we will also add the adjoint rhs vector during initialization
75 for(auto i : make_range(_system.n_qois()))
76 {
77 std::string old_adjoint_solution_name = "_old_adjoint_solution";
78 old_adjoint_solution_name+= std::to_string(i);
79 _system.add_vector(old_adjoint_solution_name, false, GHOSTED);
80
81 std::string adjoint_rhs_name = "adjoint_rhs";
82 adjoint_rhs_name+= std::to_string(i);
83 _system.add_vector(adjoint_rhs_name, false, GHOSTED);
84 }
85
86}
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.
Definition system.C:756
virtual void init_adjoints()
Initialize any adjoint related data structures, based on the number of qois.
Definition time_solver.C:83

References libMesh::TimeSolver::_system, libMesh::System::add_vector(), libMesh::GHOSTED, libMesh::TimeSolver::init_adjoints(), libMesh::make_range(), and libMesh::System::n_qois().

◆ init_data()

void libMesh::UnsteadySolver::init_data ( )
overridevirtualinherited

The data initialization function.

This method is used to initialize internal data structures after the underlying System has been initialized

Reimplemented from libMesh::TimeSolver.

Reimplemented in libMesh::SecondOrderUnsteadySolver.

Definition at line 89 of file unsteady_solver.C.

90{
92
93#ifdef LIBMESH_ENABLE_GHOSTED
96 GHOSTED);
97#else
99#endif
100}
dof_id_type n_dofs() const
Definition system.C:118
dof_id_type n_local_dofs() const
Definition system.C:155
virtual void init_data()
The data initialization function.
Definition time_solver.C:97

References libMesh::TimeSolver::_system, libMesh::System::get_dof_map(), libMesh::DofMap::get_send_list(), libMesh::GHOSTED, libMesh::TimeSolver::init_data(), libMesh::System::n_dofs(), libMesh::System::n_local_dofs(), libMesh::UnsteadySolver::old_local_nonlinear_solution, and libMesh::SERIAL.

Referenced by libMesh::SecondOrderUnsteadySolver::init_data().

◆ integrate_adjoint_refinement_error_estimate()

void libMesh::TwostepTimeSolver::integrate_adjoint_refinement_error_estimate ( AdjointRefinementEstimator adjoint_refinement_error_estimator,
ErrorVector QoI_elementwise_error 
)
overridevirtual

A method to compute the adjoint refinement error estimate at the current timestep.

int_{tstep_start}^{tstep_end} R(u^h,z) dt The user provides an initialized ARefEE object. Fills in an ErrorVector that contains the weighted sum of errors from all the QoIs and can be used to guide AMR. CURRENTLY ONLY SUPPORTED for Backward Euler.

Implements libMesh::AdaptiveTimeSolver.

Definition at line 400 of file twostep_time_solver.C.

401{
402 // We use a numerical integration scheme consistent with the theta used for the timesolver.
403
404 // Create first and second half error estimate vectors of the right size
405 std::vector<Number> qoi_error_estimates_first_half(_system.n_qois());
406 std::vector<Number> qoi_error_estimates_second_half(_system.n_qois());
407
408 // First half timestep
409 ErrorVector QoI_elementwise_error_first_half;
410
411 core_time_solver->integrate_adjoint_refinement_error_estimate(adjoint_refinement_error_estimator, QoI_elementwise_error_first_half);
412
413 // Also get the first 'half step' spatially integrated errors for all the QoIs in the QoI set
414 for (auto j : make_range(_system.n_qois()))
415 {
416 // Skip this QoI if not in the QoI Set
417 if (adjoint_refinement_error_estimator.qoi_set().has_index(j))
418 {
419 qoi_error_estimates_first_half[j] = _system.get_qoi_error_estimate_value(j);
420 }
421 }
422
423 // Second half timestep
424 ErrorVector QoI_elementwise_error_second_half;
425
426 core_time_solver->integrate_adjoint_refinement_error_estimate(adjoint_refinement_error_estimator, QoI_elementwise_error_second_half);
427
428 // Also get the second 'half step' spatially integrated errors for all the QoIs in the QoI set
429 for (auto j : make_range(_system.n_qois()))
430 {
431 // Skip this QoI if not in the QoI Set
432 if (adjoint_refinement_error_estimator.qoi_set().has_index(j))
433 {
434 qoi_error_estimates_second_half[j] = _system.get_qoi_error_estimate_value(j);
435 }
436 }
437
438 // Error contribution from this timestep
439 for (auto i : index_range(QoI_elementwise_error))
440 QoI_elementwise_error[i] = QoI_elementwise_error_first_half[i] + QoI_elementwise_error_second_half[i];
441
442 for (auto j : make_range(_system.n_qois()))
443 {
444 // Skip this QoI if not in the QoI Set
445 if (adjoint_refinement_error_estimator.qoi_set().has_index(j))
446 {
447 _system.set_qoi_error_estimate(j, qoi_error_estimates_first_half[j] + qoi_error_estimates_second_half[j]);
448 }
449 }
450}
unsigned int n_qois() const
Number of currently active quantities of interest.
Definition system.h:2562
void set_qoi_error_estimate(unsigned int qoi_index, Number qoi_error_estimate)
Definition system.C:2204
Number get_qoi_error_estimate_value(unsigned int qoi_index) const
Definition system.C:2211
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition int_range.h:153

References libMesh::TimeSolver::_system, libMesh::AdaptiveTimeSolver::core_time_solver, libMesh::System::get_qoi_error_estimate_value(), libMesh::QoISet::has_index(), libMesh::index_range(), libMesh::make_range(), libMesh::System::n_qois(), libMesh::AdjointRefinementEstimator::qoi_set(), and libMesh::System::set_qoi_error_estimate().

◆ integrate_adjoint_sensitivity()

void libMesh::TwostepTimeSolver::integrate_adjoint_sensitivity ( const QoISet qois,
const ParameterVector parameter_vector,
SensitivityData sensitivities 
)
overridevirtual

A method to integrate the adjoint sensitivity w.r.t a given parameter vector.

int_{tstep_start}^{tstep_end} dQ/dp dt = int_{tstep_start}^{tstep_end} (\partialQ / \partial p) - ( \partial R (u,z) / \partial p ) dt The midpoint rule is used to integrate each substep

Implements libMesh::AdaptiveTimeSolver.

Definition at line 377 of file twostep_time_solver.C.

378{
379 // We are using the trapezoidal rule to integrate each timestep, and then pooling the contributions here.
380 // (f(t_j) + f(t_j+1/2))/2 (t_j+1/2 - t_j) + (f(t_j+1/2) + f(t_j+1))/2 (t_j+1 - t_j+1/2)
381
382 // First half timestep
383 SensitivityData sensitivities_first_half(qois, _system, parameter_vector);
384
385 core_time_solver->integrate_adjoint_sensitivity(qois, parameter_vector, sensitivities_first_half);
386
387 // Second half timestep
388 SensitivityData sensitivities_second_half(qois, _system, parameter_vector);
389
390 core_time_solver->integrate_adjoint_sensitivity(qois, parameter_vector, sensitivities_second_half);
391
392 // Get the contributions for each sensitivity from this timestep
393 const auto pv_size = parameter_vector.size();
394 for (auto i : make_range(qois.size(_system)))
395 for (auto j : make_range(pv_size))
396 sensitivities[i][j] = sensitivities_first_half[i][j] + sensitivities_second_half[i][j];
397}

References libMesh::TimeSolver::_system, libMesh::AdaptiveTimeSolver::core_time_solver, libMesh::make_range(), libMesh::ParameterVector::size(), and libMesh::QoISet::size().

◆ integrate_qoi_timestep()

void libMesh::TwostepTimeSolver::integrate_qoi_timestep ( )
overridevirtual

A method to integrate the system::QoI functionals.

Implements libMesh::AdaptiveTimeSolver.

Definition at line 341 of file twostep_time_solver.C.

342{
343 // Vectors to hold qoi contributions from the first and second half timesteps
344 std::vector<Number> qois_first_half(_system.n_qois(), 0.0);
345 std::vector<Number> qois_second_half(_system.n_qois(), 0.0);
346
347 // First half contribution
348 core_time_solver->integrate_qoi_timestep();
349
350 for (auto j : make_range(_system.n_qois()))
351 {
352 qois_first_half[j] = _system.get_qoi_value(j);
353 }
354
355 // Second half contribution
356 core_time_solver->integrate_qoi_timestep();
357
358 for (auto j : make_range(_system.n_qois()))
359 {
360 qois_second_half[j] = _system.get_qoi_value(j);
361 }
362
363 // Zero out the system.qoi vector
364 for (auto j : make_range(_system.n_qois()))
365 {
366 _system.set_qoi(j, 0.0);
367 }
368
369 // Add the contributions from the two halftimesteps to get the full QoI
370 // contribution from this timestep
371 for (auto j : make_range(_system.n_qois()))
372 {
373 _system.set_qoi(j, qois_first_half[j] + qois_second_half[j]);
374 }
375}
void set_qoi(unsigned int qoi_index, Number qoi_value)
Definition system.C:2176
Number get_qoi_value(unsigned int qoi_index) const
Definition system.C:2184

References libMesh::TimeSolver::_system, libMesh::AdaptiveTimeSolver::core_time_solver, libMesh::System::get_qoi_value(), libMesh::make_range(), libMesh::System::n_qois(), and libMesh::System::set_qoi().

◆ is_adjoint()

bool libMesh::TimeSolver::is_adjoint ( ) const
inlineinherited

Accessor for querying whether we need to do a primal or adjoint solve.

Definition at line 277 of file time_solver.h.

278 { return _is_adjoint; }
bool _is_adjoint
This boolean tells the TimeSolver whether we are solving a primal or adjoint problem.

References libMesh::TimeSolver::_is_adjoint.

Referenced by libMesh::FEMSystem::build_context().

◆ is_steady()

virtual bool libMesh::UnsteadySolver::is_steady ( ) const
inlineoverridevirtualinherited

This is not a steady-state solver.

Implements libMesh::TimeSolver.

Definition at line 194 of file unsteady_solver.h.

194{ return false; }

◆ last_completed_timestep_size()

virtual Real libMesh::AdaptiveTimeSolver::last_completed_timestep_size ( )
inlineoverridevirtualinherited

Returns system.deltat if fixed timestep solver is used, the complete timestep size (sum of all substeps) if the adaptive time solver is used.

Returns the change in system.time, deltat, for the last timestep which was successfully completed. This only returns the outermost step size in the case of nested time solvers. If no time step has yet been successfully completed, then returns system.deltat.

Reimplemented from libMesh::TimeSolver.

Definition at line 91 of file adaptive_time_solver.h.

91{ return completed_timestep_size; };

References libMesh::AdaptiveTimeSolver::completed_timestep_size.

◆ linear_solver()

std::unique_ptr< LinearSolver< Number > > & libMesh::AdaptiveTimeSolver::linear_solver ( )
overridevirtualinherited

An implicit linear solver to use for adjoint and sensitivity problems.

Reimplemented from libMesh::TimeSolver.

Definition at line 218 of file adaptive_time_solver.C.

219{
220 return core_time_solver->linear_solver();
221}

References libMesh::AdaptiveTimeSolver::core_time_solver.

◆ n_objects()

static unsigned int libMesh::ReferenceCounter::n_objects ( )
inlinestaticinherited

Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 85 of file reference_counter.h.

86 { return _n_objects; }
static Threads::atomic< unsigned int > _n_objects
The number of objects.

References libMesh::ReferenceCounter::_n_objects.

Referenced by libMesh::LibMeshInit::~LibMeshInit().

◆ nonlocal_residual()

bool libMesh::AdaptiveTimeSolver::nonlocal_residual ( bool  get_jacobian,
DiffContext context 
)
overridevirtualinherited

This method is passed on to the core_time_solver.

Implements libMesh::TimeSolver.

Definition at line 201 of file adaptive_time_solver.C.

203{
205
206 return core_time_solver->nonlocal_residual(request_jacobian, context);
207}

References libMesh::AdaptiveTimeSolver::core_time_solver, and libMesh::libmesh_assert().

◆ old_nonlinear_solution()

Number libMesh::UnsteadySolver::old_nonlinear_solution ( const dof_id_type  global_dof_number) const
inherited
Returns
The old nonlinear solution for the specified global DOF.

Definition at line 337 of file unsteady_solver.C.

339{
340 libmesh_assert_less (global_dof_number, _system.get_dof_map().n_dofs());
341 libmesh_assert_less (global_dof_number, old_local_nonlinear_solution->size());
342
343 return (*old_local_nonlinear_solution)(global_dof_number);
344}
dof_id_type n_dofs(const unsigned int vn) const
Definition dof_map.h:776

References libMesh::TimeSolver::_system, libMesh::System::get_dof_map(), libMesh::DofMap::n_dofs(), and libMesh::UnsteadySolver::old_local_nonlinear_solution.

Referenced by libMesh::NewmarkSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::EulerSolver::_general_residual(), and libMesh::FEMPhysics::eulerian_residual().

◆ prepare_accel()

void libMesh::FirstOrderUnsteadySolver::prepare_accel ( DiffContext context)
protectedinherited

If there are second order variables in the system, then we also prepare the accel for those variables so the user can treat them as such.

Definition at line 26 of file first_order_unsteady_solver.C.

27{
28 context.get_elem_solution_accel() = context.get_elem_solution_rate();
29
30 context.elem_solution_accel_derivative = context.get_elem_solution_rate_derivative();
31}

References libMesh::DiffContext::elem_solution_accel_derivative, libMesh::DiffContext::get_elem_solution_accel(), libMesh::DiffContext::get_elem_solution_rate(), and libMesh::DiffContext::get_elem_solution_rate_derivative().

Referenced by libMesh::Euler2Solver::_general_residual(), and libMesh::EulerSolver::_general_residual().

◆ print_info()

void libMesh::ReferenceCounter::print_info ( std::ostream &  out_stream = libMesh::out)
staticinherited

Prints the reference information, by default to libMesh::out.

Definition at line 81 of file reference_counter.C.

82{
84 out_stream << ReferenceCounter::get_info();
85}
static std::string get_info()
Gets a string containing the reference information.

References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().

Referenced by libMesh::LibMeshInit::~LibMeshInit().

◆ reinit()

void libMesh::AdaptiveTimeSolver::reinit ( )
overridevirtualinherited

The reinitialization function.

This method is used to resize internal data vectors after a mesh change.

Reimplemented from libMesh::UnsteadySolver.

Definition at line 79 of file adaptive_time_solver.C.

80{
82
83 // We override this because our core_time_solver is the one that
84 // needs to handle new vectors, diff_solver->reinit(), etc
85 core_time_solver->reinit();
86}

References libMesh::AdaptiveTimeSolver::core_time_solver, and libMesh::libmesh_assert().

◆ retrieve_timestep()

void libMesh::AdaptiveTimeSolver::retrieve_timestep ( )
overridevirtualinherited

This method retrieves all the stored solutions at the current system.time.

Reimplemented from libMesh::UnsteadySolver.

Definition at line 165 of file adaptive_time_solver.C.

166{
167 // Ask the core time solver to retrieve all the stored vectors
168 // at the current time
169 core_time_solver->retrieve_timestep();
170}

References libMesh::AdaptiveTimeSolver::core_time_solver.

◆ set_first_adjoint_step()

void libMesh::UnsteadySolver::set_first_adjoint_step ( bool  first_adjoint_step_setting)
inlineinherited

A setter for the first_adjoint_step boolean.

Needed for nested time solvers.

Definition at line 199 of file unsteady_solver.h.

200 {
201 first_adjoint_step = first_adjoint_step_setting;
202 }

References libMesh::UnsteadySolver::first_adjoint_step.

◆ set_first_solve()

void libMesh::UnsteadySolver::set_first_solve ( bool  first_solve_setting)
inlineinherited

Definition at line 209 of file unsteady_solver.h.

210 {
211 first_solve = first_solve_setting;
212 }

References libMesh::UnsteadySolver::first_solve.

◆ set_is_adjoint()

void libMesh::TimeSolver::set_is_adjoint ( bool  _is_adjoint_value)
inlineinherited

Accessor for setting whether we need to do a primal or adjoint solve.

Definition at line 284 of file time_solver.h.

285 { _is_adjoint = _is_adjoint_value; }

References libMesh::TimeSolver::_is_adjoint.

Referenced by libMesh::DifferentiableSystem::adjoint_solve(), libMesh::FEMSystem::postprocess(), and libMesh::DifferentiableSystem::solve().

◆ set_solution_history()

void libMesh::TimeSolver::set_solution_history ( const SolutionHistory _solution_history)
inherited

A setter function users will employ if they need to do something other than save no solution history.

Definition at line 119 of file time_solver.C.

120{
121 solution_history = _solution_history.clone();
122}

References libMesh::SolutionHistory::clone(), and libMesh::TimeSolver::solution_history.

Referenced by libMesh::AdaptiveTimeSolver::init().

◆ side_residual()

bool libMesh::AdaptiveTimeSolver::side_residual ( bool  get_jacobian,
DiffContext context 
)
overridevirtualinherited

This method is passed on to the core_time_solver.

Implements libMesh::TimeSolver.

Definition at line 191 of file adaptive_time_solver.C.

193{
195
196 return core_time_solver->side_residual(request_jacobian, context);
197}

References libMesh::AdaptiveTimeSolver::core_time_solver, and libMesh::libmesh_assert().

◆ solve()

void libMesh::TwostepTimeSolver::solve ( )
overridevirtual

This method solves for the solution at the next timestep.

Usually we will only need to solve one (non)linear system per timestep, but more complex subclasses may override this.

Implements libMesh::AdaptiveTimeSolver.

Definition at line 54 of file twostep_time_solver.C.

55{
57
58 // All actual solution history operations are handled by the outer
59 // solver, so the outer solver has to call advance_timestep and
60 // call solution_history->store to store the initial conditions
61 if (first_solve)
62 {
64 first_solve = false;
65 }
66
67 // We may have to repeat timesteps entirely if our error is bad
68 // enough
69 bool max_tolerance_met = false;
70
71 // Calculating error values each time
72 Real single_norm(0.), double_norm(0.), error_norm(0.),
73 relative_error(0.);
74
75 // The loop below will change system time and deltat based on calculations.
76 // We will need to save these for calculating the deltat for the next timestep
77 // after the while loop has converged.
78 Real old_time;
79 Real old_deltat;
80
81 while (!max_tolerance_met)
82 {
83 // If we've been asked to reduce deltat if necessary, make sure
84 // the core timesolver does so
85 core_time_solver->reduce_deltat_on_diffsolver_failure =
87
88 if (!quiet)
89 {
90 libMesh::out << "\n === Computing adaptive timestep === "
91 << std::endl;
92 }
93
94 // Use the double-length timestep first (so the
95 // old_nonlinear_solution won't have to change)
96 core_time_solver->solve();
97
98 // Save a copy of the double-length nonlinear solution
99 // and the old nonlinear solution
100 std::unique_ptr<NumericVector<Number>> double_solution =
101 _system.solution->clone();
102 std::unique_ptr<NumericVector<Number>> old_solution =
103 _system.get_vector("_old_nonlinear_solution").clone();
104
105 double_norm = calculate_norm(_system, *double_solution);
106 if (!quiet)
107 {
108 libMesh::out << "Double norm = " << double_norm << std::endl;
109 }
110
111 // Then reset the initial guess for our single-length calcs
112 *(_system.solution) = _system.get_vector("_old_nonlinear_solution");
113
114 // Call two single-length timesteps
115 // Be sure that the core_time_solver does not change the
116 // timestep here. (This is unlikely because it just succeeded
117 // with a timestep twice as large!)
118 // FIXME: even if diffsolver failure is unlikely, we ought to
119 // do *something* if it happens
120 core_time_solver->reduce_deltat_on_diffsolver_failure = 0;
121
122 old_time = _system.time;
123 old_deltat = _system.deltat;
124 _system.deltat *= 0.5;
125
126 // Attempt the 'half timestep solve'
127 core_time_solver->solve();
128
129 // If we successfully completed the solve, let the time solver know the deltat used
130 this->last_deltat = _system.deltat;
131
132 // Increment system.time, and save the half solution to solution history
133 core_time_solver->advance_timestep();
134
135 core_time_solver->solve();
136
137 single_norm = calculate_norm(_system, *_system.solution);
138 if (!quiet)
139 {
140 libMesh::out << "Single norm = " << single_norm << std::endl;
141 }
142
143 // Reset the core_time_solver's reduce_deltat... value.
144 core_time_solver->reduce_deltat_on_diffsolver_failure =
146
147 // Find the relative error
148 *double_solution -= *(_system.solution);
149 error_norm = calculate_norm(_system, *double_solution);
150 relative_error = error_norm / old_deltat /
151 std::max(double_norm, single_norm);
152
153 // If the relative error makes no sense, we're done
154 if (!double_norm && !single_norm)
155 return;
156
157 if (!quiet)
158 {
159 libMesh::out << "Error norm = " << error_norm << std::endl;
160 libMesh::out << "Local relative error = "
161 << (error_norm /
162 std::max(double_norm, single_norm))
163 << std::endl;
164 libMesh::out << "Global relative error = "
165 << (error_norm / old_deltat /
166 std::max(double_norm, single_norm))
167 << std::endl;
168 libMesh::out << "old delta t = " << old_deltat << std::endl;
169 }
170
171 // If our upper tolerance is negative, that means we want to set
172 // it based on the first successful time step
173 if (this->upper_tolerance < 0)
174 this->upper_tolerance = -this->upper_tolerance * relative_error;
175
176 // If we haven't met our upper error tolerance, we'll have to
177 // repeat this timestep entirely
178 if (this->upper_tolerance && relative_error > this->upper_tolerance)
179 {
180 // If we are saving solution histories, the core time solver
181 // will save half solutions, and these solves can be attempted
182 // repeatedly. If we failed to meet the tolerance, erase the
183 // half solution from solution history.
184 core_time_solver->get_solution_history().erase(_system.time);
185
186 // We will be retrying this timestep with deltat/2, so restore
187 // all the necessary state.
188 // FIXME: this probably doesn't work with multistep methods
189 _system.get_vector("_old_nonlinear_solution") = *old_solution;
190 _system.time = old_time;
191 _system.deltat = old_deltat;
192
193 // Update to localize the old nonlinear solution
194 core_time_solver->update();
195
196 // Reset the initial guess for our next try
197 *(_system.solution) =
198 _system.get_vector("_old_nonlinear_solution");
199
200 // Chop delta t in half
201 _system.deltat /= 2.;
202
203 if (!quiet)
204 {
205 libMesh::out << "Failed to meet upper error tolerance"
206 << std::endl;
207 libMesh::out << "Retrying with delta t = "
208 << _system.deltat << std::endl;
209 }
210 }
211 else
212 max_tolerance_met = true;
213
214 }
215
216 // We ended up taking two half steps of size system.deltat to
217 // march our last time step.
218 this->last_deltat = _system.deltat;
220
221 // TimeSolver::solve methods should leave system.time unchanged
222 _system.time = old_time;
223
224 // Compare the relative error to the tolerance and adjust deltat
225 _system.deltat = old_deltat;
226
227 // If our target tolerance is negative, that means we want to set
228 // it based on the first successful time step
229 if (this->target_tolerance < 0)
230 this->target_tolerance = -this->target_tolerance * relative_error;
231
232 const Real global_shrink_or_growth_factor =
233 std::pow(this->target_tolerance / relative_error,
234 static_cast<Real>(1. / core_time_solver->error_order()));
235
236 const Real local_shrink_or_growth_factor =
237 std::pow(this->target_tolerance /
238 (error_norm/std::max(double_norm, single_norm)),
239 static_cast<Real>(1. / (core_time_solver->error_order()+1.)));
240
241 if (!quiet)
242 {
243 libMesh::out << "The global growth/shrink factor is: "
244 << global_shrink_or_growth_factor << std::endl;
245 libMesh::out << "The local growth/shrink factor is: "
246 << local_shrink_or_growth_factor << std::endl;
247 }
248
249 // The local s.o.g. factor is based on the expected **local**
250 // truncation error for the timestepping method, the global
251 // s.o.g. factor is based on the method's **global** truncation
252 // error. You can shrink/grow the timestep to attempt to satisfy
253 // either a global or local time-discretization error tolerance.
254
255 Real shrink_or_growth_factor =
256 this->global_tolerance ? global_shrink_or_growth_factor :
257 local_shrink_or_growth_factor;
258
259 if (this->max_growth && this->max_growth < shrink_or_growth_factor)
260 {
261 if (!quiet && this->global_tolerance)
262 {
263 libMesh::out << "delta t is constrained by max_growth" << std::endl;
264 }
265 shrink_or_growth_factor = this->max_growth;
266 }
267
268 _system.deltat *= shrink_or_growth_factor;
269
270 // Restrict deltat to max-allowable value if necessary
271 if ((this->max_deltat != 0.0) && (_system.deltat > this->max_deltat))
272 {
273 if (!quiet)
274 {
275 libMesh::out << "delta t is constrained by maximum-allowable delta t."
276 << std::endl;
277 }
278 _system.deltat = this->max_deltat;
279 }
280
281 // Restrict deltat to min-allowable value if necessary
282 if ((this->min_deltat != 0.0) && (_system.deltat < this->min_deltat))
283 {
284 if (!quiet)
285 {
286 libMesh::out << "delta t is constrained by minimum-allowable delta t."
287 << std::endl;
288 }
289 _system.deltat = this->min_deltat;
290 }
291
292 if (!quiet)
293 {
294 libMesh::out << "new delta t = " << _system.deltat << std::endl;
295 }
296}
Real min_deltat
Do not allow the adaptive time solver to select deltat < min_deltat.
Real upper_tolerance
This tolerance is the maximum relative error between an exact time integration and a single time step...
virtual void advance_timestep() override
This method advances the solution to the next timestep, after a solve() has been performed.
Real max_deltat
Do not allow the adaptive time solver to select deltat > max_deltat.
Real target_tolerance
This tolerance is the target relative error between an exact time integration and a single time step ...
bool global_tolerance
This flag, which is true by default, grows (shrinks) the timestep based on the expected global accura...
Real max_growth
Do not allow the adaptive time solver to select a new deltat greater than max_growth times the old de...
virtual std::unique_ptr< NumericVector< T > > clone() const =0
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 ...
bool quiet
Print extra debugging information if quiet == false.

References libMesh::TimeSolver::_system, libMesh::AdaptiveTimeSolver::advance_timestep(), libMesh::AdaptiveTimeSolver::calculate_norm(), libMesh::NumericVector< T >::clone(), libMesh::AdaptiveTimeSolver::completed_timestep_size, libMesh::AdaptiveTimeSolver::core_time_solver, libMesh::DifferentiableSystem::deltat, libMesh::UnsteadySolver::first_solve, libMesh::System::get_vector(), libMesh::AdaptiveTimeSolver::global_tolerance, libMesh::TimeSolver::last_deltat, libMesh::libmesh_assert(), libMesh::AdaptiveTimeSolver::max_deltat, libMesh::AdaptiveTimeSolver::max_growth, libMesh::AdaptiveTimeSolver::min_deltat, libMesh::out, libMesh::TimeSolver::quiet, libMesh::Real, libMesh::TimeSolver::reduce_deltat_on_diffsolver_failure, libMesh::System::solution, libMesh::AdaptiveTimeSolver::target_tolerance, libMesh::System::time, and libMesh::AdaptiveTimeSolver::upper_tolerance.

◆ system() [1/2]

sys_type & libMesh::TimeSolver::system ( )
inlineinherited
Returns
A writable reference to the system we are solving.

Definition at line 215 of file time_solver.h.

215{ return _system; }

References libMesh::TimeSolver::_system.

◆ system() [2/2]

const sys_type & libMesh::TimeSolver::system ( ) const
inlineinherited
Returns
A constant reference to the system we are solving.

Definition at line 210 of file time_solver.h.

210{ return _system; }

References libMesh::TimeSolver::_system.

Referenced by libMesh::TimeSolver::adjoint_solve(), libMesh::TimeSolver::reinit(), and libMesh::TimeSolver::solve().

◆ time_order()

virtual unsigned int libMesh::FirstOrderUnsteadySolver::time_order ( ) const
inlineoverridevirtualinherited
Returns
The maximum order of time derivatives for which the UnsteadySolver subclass is capable of handling.

For example, EulerSolver will have time_order() = 1 and NewmarkSolver will have time_order() = 2.

Implements libMesh::UnsteadySolver.

Definition at line 90 of file first_order_unsteady_solver.h.

91 { return 1; }

◆ update()

void libMesh::UnsteadySolver::update ( )
inherited

Member Data Documentation

◆ _counts

ReferenceCounter::Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

Actually holds the data.

Definition at line 124 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::get_info().

◆ _diff_solver

std::unique_ptr<DiffSolver> libMesh::TimeSolver::_diff_solver
protectedinherited

An implicit linear or nonlinear solver to use at each timestep.

Definition at line 302 of file time_solver.h.

Referenced by libMesh::NewmarkSolver::compute_initial_accel(), libMesh::TimeSolver::diff_solver(), and libMesh::UnsteadySolver::solve().

◆ _enable_print_counter

bool libMesh::ReferenceCounter::_enable_print_counter = true
staticprotectedinherited

Flag to control whether reference count information is printed when print_info is called.

Definition at line 143 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().

◆ _is_adjoint

bool libMesh::TimeSolver::_is_adjoint
privateinherited

This boolean tells the TimeSolver whether we are solving a primal or adjoint problem.

Definition at line 340 of file time_solver.h.

Referenced by libMesh::TimeSolver::is_adjoint(), and libMesh::TimeSolver::set_is_adjoint().

◆ _linear_solver

std::unique_ptr<LinearSolver<Number> > libMesh::TimeSolver::_linear_solver
protectedinherited

An implicit linear solver to use for adjoint problems.

Definition at line 307 of file time_solver.h.

Referenced by libMesh::TimeSolver::linear_solver(), and libMesh::TimeSolver::reinit().

◆ _mutex

Threads::spin_mutex libMesh::ReferenceCounter::_mutex
staticprotectedinherited

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 137 of file reference_counter.h.

◆ _n_objects

Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects
staticprotectedinherited

◆ _system

sys_type& libMesh::TimeSolver::_system
protectedinherited

A reference to the system we are solving.

Definition at line 312 of file time_solver.h.

Referenced by libMesh::NewmarkSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::EulerSolver::_general_residual(), libMesh::SteadySolver::_general_residual(), libMesh::AdaptiveTimeSolver::adjoint_advance_timestep(), libMesh::UnsteadySolver::adjoint_advance_timestep(), libMesh::TimeSolver::adjoint_solve(), adjoint_solve(), libMesh::UnsteadySolver::adjoint_solve(), libMesh::AdaptiveTimeSolver::advance_timestep(), libMesh::NewmarkSolver::advance_timestep(), libMesh::UnsteadySolver::advance_timestep(), libMesh::NewmarkSolver::compute_initial_accel(), libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), libMesh::UnsteadySolver::du(), libMesh::EigenTimeSolver::element_residual(), libMesh::Euler2Solver::element_residual(), libMesh::EulerSolver::element_residual(), libMesh::TimeSolver::init(), libMesh::EigenTimeSolver::init(), libMesh::SecondOrderUnsteadySolver::init(), libMesh::UnsteadySolver::init(), libMesh::TimeSolver::init_adjoints(), libMesh::UnsteadySolver::init_adjoints(), libMesh::TimeSolver::init_data(), libMesh::SecondOrderUnsteadySolver::init_data(), libMesh::UnsteadySolver::init_data(), libMesh::Euler2Solver::integrate_adjoint_refinement_error_estimate(), libMesh::EulerSolver::integrate_adjoint_refinement_error_estimate(), libMesh::SteadySolver::integrate_adjoint_refinement_error_estimate(), integrate_adjoint_refinement_error_estimate(), libMesh::SteadySolver::integrate_adjoint_sensitivity(), integrate_adjoint_sensitivity(), libMesh::UnsteadySolver::integrate_adjoint_sensitivity(), libMesh::Euler2Solver::integrate_qoi_timestep(), libMesh::EulerSolver::integrate_qoi_timestep(), libMesh::SteadySolver::integrate_qoi_timestep(), integrate_qoi_timestep(), libMesh::EigenTimeSolver::nonlocal_residual(), libMesh::Euler2Solver::nonlocal_residual(), libMesh::EulerSolver::nonlocal_residual(), libMesh::UnsteadySolver::old_nonlinear_solution(), libMesh::SecondOrderUnsteadySolver::old_solution_accel(), libMesh::SecondOrderUnsteadySolver::old_solution_rate(), libMesh::NewmarkSolver::project_initial_accel(), libMesh::SecondOrderUnsteadySolver::project_initial_rate(), libMesh::TimeSolver::reinit(), libMesh::SecondOrderUnsteadySolver::reinit(), libMesh::UnsteadySolver::reinit(), libMesh::UnsteadySolver::retrieve_timestep(), libMesh::EigenTimeSolver::side_residual(), libMesh::EigenTimeSolver::solve(), solve(), libMesh::UnsteadySolver::solve(), libMesh::TimeSolver::system(), libMesh::TimeSolver::system(), and libMesh::UnsteadySolver::update().

◆ completed_timestep_size

Real libMesh::AdaptiveTimeSolver::completed_timestep_size
inherited

The adaptive time solver's have two notions of deltat.

The deltat the solver ended up using for the completed timestep. And the deltat the solver determined would be workable for the coming timestep. The latter gets set as system.deltat. We need a variable to save the deltat used for the completed timestep.

Definition at line 205 of file adaptive_time_solver.h.

Referenced by adjoint_solve(), libMesh::AdaptiveTimeSolver::advance_timestep(), libMesh::AdaptiveTimeSolver::last_completed_timestep_size(), and solve().

◆ component_norm

SystemNorm libMesh::AdaptiveTimeSolver::component_norm
inherited

Error calculations are done in this norm, DISCRETE_L2 by default.

Definition at line 135 of file adaptive_time_solver.h.

Referenced by libMesh::AdaptiveTimeSolver::calculate_norm().

◆ component_scale

std::vector<float> libMesh::AdaptiveTimeSolver::component_scale
inherited

If component_norms is non-empty, each variable's contribution to the error of a system will also be scaled by component_scale[var], unless component_scale is empty in which case all variables will be weighted equally.

Definition at line 143 of file adaptive_time_solver.h.

◆ core_time_solver

std::unique_ptr<UnsteadySolver> libMesh::AdaptiveTimeSolver::core_time_solver
inherited

◆ first_adjoint_step

bool libMesh::UnsteadySolver::first_adjoint_step
protectedinherited

A bool that will be true the first time adjoint_advance_timestep() is called, (when the primal solution is to be used to set adjoint boundary conditions) and false thereafter.

Definition at line 226 of file unsteady_solver.h.

Referenced by libMesh::AdaptiveTimeSolver::adjoint_advance_timestep(), and libMesh::UnsteadySolver::set_first_adjoint_step().

◆ first_solve

bool libMesh::UnsteadySolver::first_solve
protectedinherited

◆ global_tolerance

bool libMesh::AdaptiveTimeSolver::global_tolerance
inherited

This flag, which is true by default, grows (shrinks) the timestep based on the expected global accuracy of the timestepping scheme.

Global in this sense means the cumulative final-time accuracy of the scheme. For example, the backward Euler scheme's truncation error is locally of order 2, so that after N timesteps of size deltat, the result is first-order accurate. If you set this to false, you can grow (shrink) your timestep based on the local accuracy rather than the global accuracy of the core TimeSolver.

Note
By setting this value to false you may fail to achieve the predicted convergence in time of the underlying method, however it may be possible to get more fine-grained control over step sizes as well.

Definition at line 222 of file adaptive_time_solver.h.

Referenced by solve().

◆ last_deltat

Real libMesh::TimeSolver::last_deltat
protectedinherited

The deltat for the last completed timestep before the current one.

Definition at line 332 of file time_solver.h.

Referenced by adjoint_solve(), libMesh::UnsteadySolver::adjoint_solve(), libMesh::TimeSolver::last_completed_timestep_size(), solve(), and libMesh::UnsteadySolver::solve().

◆ last_step_deltat

Real libMesh::UnsteadySolver::last_step_deltat
protectedinherited

We will need to move the system.time around to ensure that residuals are built with the right deltat and the right time.

Definition at line 237 of file unsteady_solver.h.

Referenced by libMesh::Euler2Solver::integrate_adjoint_refinement_error_estimate(), and libMesh::EulerSolver::integrate_adjoint_refinement_error_estimate().

◆ max_deltat

Real libMesh::AdaptiveTimeSolver::max_deltat
inherited

Do not allow the adaptive time solver to select deltat > max_deltat.

If you use the default max_deltat=0.0, then deltat is unlimited.

Definition at line 183 of file adaptive_time_solver.h.

Referenced by solve().

◆ max_growth

Real libMesh::AdaptiveTimeSolver::max_growth
inherited

Do not allow the adaptive time solver to select a new deltat greater than max_growth times the old deltat.

If you use the default max_growth=0.0, then the deltat growth is unlimited.

Definition at line 197 of file adaptive_time_solver.h.

Referenced by solve().

◆ min_deltat

Real libMesh::AdaptiveTimeSolver::min_deltat
inherited

Do not allow the adaptive time solver to select deltat < min_deltat.

The default value is 0.0.

Definition at line 189 of file adaptive_time_solver.h.

Referenced by solve().

◆ next_step_deltat

Real libMesh::UnsteadySolver::next_step_deltat
protectedinherited

◆ old_adjoints

std::vector< std::unique_ptr<NumericVector<Number> > > libMesh::UnsteadySolver::old_adjoints
protectedinherited

A vector of pointers to vectors holding the adjoint solution at the last time step.

Definition at line 231 of file unsteady_solver.h.

Referenced by libMesh::Euler2Solver::integrate_adjoint_refinement_error_estimate(), libMesh::EulerSolver::integrate_adjoint_refinement_error_estimate(), and libMesh::UnsteadySolver::UnsteadySolver().

◆ old_local_nonlinear_solution

std::shared_ptr<NumericVector<Number> > libMesh::UnsteadySolver::old_local_nonlinear_solution
inherited

◆ quiet

bool libMesh::TimeSolver::quiet
inherited

Print extra debugging information if quiet == false.

Definition at line 230 of file time_solver.h.

Referenced by libMesh::EigenTimeSolver::solve(), solve(), and libMesh::UnsteadySolver::solve().

◆ reduce_deltat_on_diffsolver_failure

unsigned int libMesh::TimeSolver::reduce_deltat_on_diffsolver_failure
inherited

This value (which defaults to zero) is the number of times the TimeSolver is allowed to halve deltat and let the DiffSolver repeat the latest failed solve with a reduced timestep.

Note
This has no effect for SteadySolvers.
You must set at least one of the DiffSolver flags "continue_after_max_iterations" or "continue_after_backtrack_failure" to allow the TimeSolver to retry the solve.

Definition at line 259 of file time_solver.h.

Referenced by solve(), and libMesh::UnsteadySolver::solve().

◆ solution_history

std::unique_ptr<SolutionHistory> libMesh::TimeSolver::solution_history
protectedinherited

◆ target_tolerance

Real libMesh::AdaptiveTimeSolver::target_tolerance
inherited

This tolerance is the target relative error between an exact time integration and a single time step output, scaled by deltat.

integrator, scaled by deltat. If the estimated error exceeds or undershoots the target error tolerance, future timesteps will be run with deltat shrunk or grown to compensate.

The default value is 1.0e-2; obviously users should select their own tolerance.

If a negative target_tolerance is specified, then its absolute value is used to scale the estimated error from the first simulation time step, and this becomes the target tolerance of all future time steps.

Definition at line 160 of file adaptive_time_solver.h.

Referenced by solve().

◆ upper_tolerance

Real libMesh::AdaptiveTimeSolver::upper_tolerance
inherited

This tolerance is the maximum relative error between an exact time integration and a single time step output, scaled by deltat.

If this error tolerance is exceeded by the estimated error of the current time step, that time step will be repeated with a smaller deltat.

If you use the default upper_tolerance=0.0, then the current time step will not be repeated regardless of estimated error.

If a negative upper_tolerance is specified, then its absolute value is used to scale the estimated error from the first simulation time step, and this becomes the upper tolerance of all future time steps.

Definition at line 177 of file adaptive_time_solver.h.

Referenced by solve().


The documentation for this class was generated from the following files: