diff_solver.h
Go to the documentation of this file.00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 #ifndef LIBMESH_DIFF_SOLVER_H 00021 #define LIBMESH_DIFF_SOLVER_H 00022 00023 // Local includes 00024 #include "libmesh/auto_ptr.h" 00025 #include "libmesh/libmesh_common.h" 00026 #include "libmesh/reference_counted_object.h" 00027 00028 // C++ includes 00029 #include <vector> 00030 00031 namespace libMesh 00032 { 00033 00034 // Forward Declarations 00035 class DiffSolver; 00036 class ImplicitSystem; 00037 class ParameterVector; 00038 00052 // ------------------------------------------------------------ 00053 // Solver class definition 00054 class DiffSolver : public ReferenceCountedObject<DiffSolver> 00055 { 00056 public: 00060 typedef ImplicitSystem sys_type; 00061 00066 DiffSolver (sys_type& s); 00067 00072 static AutoPtr<DiffSolver> build(sys_type& s); 00073 00077 virtual ~DiffSolver () {} 00078 00083 virtual void init (); 00084 00089 virtual void reinit (); 00090 00096 virtual unsigned int solve () = 0; 00097 00102 unsigned int total_outer_iterations() { return _outer_iterations; } 00103 00108 unsigned int total_inner_iterations() { return _inner_iterations; } 00109 00113 unsigned int solve_result() { return _solve_result; } 00114 00118 const sys_type & system () const { return _system; } 00119 00123 sys_type & system () { return _system; } 00124 00129 unsigned int max_linear_iterations; 00130 00137 unsigned int max_nonlinear_iterations; 00138 00143 bool quiet; 00144 00149 bool verbose; 00150 00155 bool continue_after_max_iterations; 00156 00161 bool continue_after_backtrack_failure; 00162 00172 Real absolute_residual_tolerance; 00173 Real relative_residual_tolerance; 00174 00184 Real absolute_step_tolerance; 00185 Real relative_step_tolerance; 00186 00191 Real initial_linear_tolerance; 00192 00196 Real minimum_linear_tolerance; 00197 00203 enum SolveResult { 00208 INVALID_SOLVE_RESULT = 0, 00209 00214 CONVERGED_NO_REASON = 1, 00215 00220 CONVERGED_ABSOLUTE_RESIDUAL = 2, 00221 00226 CONVERGED_RELATIVE_RESIDUAL = 4, 00227 00232 CONVERGED_ABSOLUTE_STEP = 8, 00233 00238 CONVERGED_RELATIVE_STEP = 16, 00239 00244 DIVERGED_NO_REASON = 32, 00245 00251 DIVERGED_MAX_NONLINEAR_ITERATIONS = 64, 00252 00257 DIVERGED_BACKTRACKING_FAILURE = 128 00258 }; 00259 00260 protected: 00261 00266 Real max_solution_norm; 00267 00273 Real max_residual_norm; 00274 00278 unsigned int _outer_iterations; 00279 00283 unsigned int _inner_iterations; 00284 00288 sys_type& _system; 00289 00296 unsigned int _solve_result; 00297 }; 00298 00299 00300 } // namespace libMesh 00301 00302 00303 #endif // LIBMESH_DIFF_SOLVER_H
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:46 UTC
Hosted By: