/usr/include/libmesh/time_solver.h is in libmesh-dev 0.7.1-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | // $Id: time_solver.h 4279 2011-03-21 17:01:31Z roystgnr $
// The libMesh Finite Element Library.
// Copyright (C) 2002-2008 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef __time_solver_h__
#define __time_solver_h__
// C++ includes
// Local includes
#include "auto_ptr.h"
#include "libmesh_common.h"
#include "linear_solver.h"
#include "numeric_vector.h"
#include "reference_counted_object.h"
namespace libMesh
{
// Forward Declarations
class DiffContext;
class DiffSolver;
class DifferentiableSystem;
class ParameterVector;
class SystemNorm;
class TimeSolver;
/**
* This is a generic class that defines a solver to handle
* time integration of DifferentiableSystems.
*
* A user can define a solver by deriving from this class and
* implementing certain functions.
*
* 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 2006
*/
// ------------------------------------------------------------
// Solver class definition
class TimeSolver : public ReferenceCountedObject<TimeSolver>
{
public:
/**
* The type of system
*/
typedef DifferentiableSystem sys_type;
/**
* Constructor. Requires a reference to the system
* to be solved.
*/
TimeSolver (sys_type& s);
/**
* Destructor.
*/
virtual ~TimeSolver ();
/**
* The initialization function. This method is used to
* initialize internal data structures before a simulation begins.
*/
virtual void init ();
/**
* The reinitialization function. This method is used after
* changes in the mesh
*/
virtual void reinit ();
/**
* This method solves for the solution at the next timestep (or
* solves for a steady-state solution). Usually we will only need
* to solve one (non)linear system per timestep, but more complex
* subclasses may override this.
*/
virtual void solve ();
/**
* 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.
*/
virtual void advance_timestep ();
/**
* This method advances the adjoint solution to the previous
* timestep, after an adjoint_solve() has been performed. This will
* probably be done after every UnsteadySolver::adjoint_solve().
*/
virtual void adjoint_recede_timestep ();
/**
* This method uses the DifferentiableSystem's
* element_time_derivative() and element_constraint()
* to build a full residual on an element. What combination
* it uses will depend on the type of solver. See
* the subclasses for more details.
*/
virtual bool element_residual (bool request_jacobian,
DiffContext &) = 0;
/**
* This method uses the DifferentiableSystem's
* side_time_derivative() and side_constraint()
* to build a full residual on an element's side.
* What combination it uses will depend on the type
* of solver. See the subclasses for more details.
*/
virtual bool side_residual (bool request_jacobian,
DiffContext &) = 0;
/**
* This method is for subclasses or users to override
* to do arbitrary processing between timesteps
*/
virtual void before_timestep () {}
/**
* @returns a constant reference to the system we are solving.
*/
const sys_type & system () const { return _system; }
/**
* An implicit linear or nonlinear solver to use at each timestep.
*/
virtual AutoPtr<DiffSolver> &diff_solver() { return _diff_solver; }
/**
* An implicit linear solver to use for adjoint and sensitivity problems.
*/
virtual AutoPtr<LinearSolver<Number> > &linear_solver() { return _linear_solver; }
/**
* Print extra debugging information if quiet == false.
*/
bool quiet;
/**
* Computes the size of ||u^{n+1} - u^{n}|| in some norm.
*
* Note that, 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.
*/
virtual Real du(const SystemNorm& norm) const = 0;
/**
* Is this effectively a steady-state solver?
*/
virtual bool is_steady() const = 0;
/**
* 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
* that this has no effect for SteadySolvers. Note that 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.
*/
unsigned int reduce_deltat_on_diffsolver_failure;
protected:
/**
* An implicit linear or nonlinear solver to use at each timestep.
*/
AutoPtr<DiffSolver> _diff_solver;
/**
* An implicit linear solver to use for adjoint problems.
*/
AutoPtr<LinearSolver<Number> > _linear_solver;
/**
* @returns a writeable reference to the system we are solving.
*/
sys_type & system () { return _system; }
/**
* A reference to the system we are solving.
*/
sys_type& _system;
/**
* A bool that will be true the first time solve() is called,
* and false thereafter
*/
bool first_solve;
/**
* Serial vector of _system.get_vector("_old_nonlinear_solution")
*/
AutoPtr<NumericVector<Number> > old_local_nonlinear_solution;
};
} // namespace libMesh
#endif // #define __time_solver_h__
|