time_solver.C
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 #include "libmesh/diff_solver.h" 00019 #include "libmesh/diff_system.h" 00020 #include "libmesh/linear_solver.h" 00021 #include "libmesh/time_solver.h" 00022 #include "libmesh/no_solution_history.h" 00023 00024 namespace libMesh 00025 { 00026 00027 00028 00029 TimeSolver::TimeSolver (sys_type& s) 00030 : quiet (true), 00031 reduce_deltat_on_diffsolver_failure (0), 00032 _diff_solver (NULL), 00033 _linear_solver (NULL), 00034 _system (s), 00035 solution_history(new NoSolutionHistory()), // Default setting for solution_history 00036 _is_adjoint (false) 00037 { 00038 } 00039 00040 00041 00042 TimeSolver::~TimeSolver () 00043 { 00044 } 00045 00046 00047 00048 void TimeSolver::reinit () 00049 { 00050 libmesh_assert(_diff_solver.get()); 00051 libmesh_assert_equal_to (&(_diff_solver->system()), &(this->system())); 00052 _diff_solver->reinit(); 00053 00054 libmesh_assert(_linear_solver.get()); 00055 _linear_solver->clear(); 00056 _linear_solver->init(); 00057 } 00058 00059 00060 00061 void TimeSolver::init () 00062 { 00063 // If the user hasn't given us a solver to use, 00064 // just build a default solver 00065 if (_diff_solver.get() == NULL) 00066 _diff_solver = DiffSolver::build(_system); 00067 00068 if (_linear_solver.get() == NULL) 00069 _linear_solver = LinearSolver<Number>::build(); 00070 00071 _diff_solver->init(); 00072 _linear_solver->init(); 00073 } 00074 00075 00076 00077 void TimeSolver::init_data () 00078 { 00079 } 00080 00081 00082 00083 void TimeSolver::solve () 00084 { 00085 libmesh_assert(_diff_solver.get()); 00086 libmesh_assert_equal_to (&(_diff_solver->system()), &(this->system())); 00087 _diff_solver->solve(); 00088 } 00089 00090 00091 void TimeSolver::set_solution_history (const SolutionHistory & _solution_history) 00092 { 00093 solution_history = _solution_history.clone(); 00094 } 00095 00096 void TimeSolver::advance_timestep () 00097 { 00098 } 00099 00100 void TimeSolver::adjoint_advance_timestep () 00101 { 00102 } 00103 00104 void TimeSolver::retrieve_timestep () 00105 { 00106 } 00107 00108 } // namespace libMesh
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:49 UTC
Hosted By: