adaptive_time_solver.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
19 #include "libmesh/diff_system.h"
20 #include "libmesh/numeric_vector.h"
21 
22 namespace libMesh
23 {
24 
25 
26 
28  : UnsteadySolver(s),
29  core_time_solver(NULL),
30  target_tolerance(1.e-3), upper_tolerance(0.0),
31  max_deltat(0.),
32  min_deltat(0.),
33  max_growth(0.),
34  global_tolerance(true)
35 {
36  // the child class must populate core_time_solver
37  // with whatever actual time solver is to be used
38 
39  // As an UnsteadySolver, we have an old_local_nonlinear_solution, but we're
40  // going to drop it and use our core time solver's instead.
42 }
43 
44 
45 
47 {
48  // As an UnsteadySolver, we have an old_local_nonlinear_solution, but it
49  // is being managed by our core_time_solver. Make sure we don't delete
50  // it out from under them, in case the user wants to keep using the core
51  // solver after they're done with us.
53 }
54 
55 
56 
58 {
60 
61  // We override this because our core_time_solver is the one that
62  // needs to handle new vectors, diff_solver->init(), etc
63  core_time_solver->init();
64 
65  // As an UnsteadySolver, we have an old_local_nonlinear_solution, but it
66  // isn't pointing to the right place - fix it
67  //
68  // This leaves us with two AutoPtrs holding the same pointer - dangerous
69  // for future use. Replace with shared_ptr?
71  AutoPtr<NumericVector<Number> >(core_time_solver->old_local_nonlinear_solution.get());
72 }
73 
74 
75 
77 {
79 
80  // We override this because our core_time_solver is the one that
81  // needs to handle new vectors, diff_solver->reinit(), etc
82  core_time_solver->reinit();
83 }
84 
85 
87 {
88  NumericVector<Number> &old_nonlinear_soln =
89  _system.get_vector("_old_nonlinear_solution");
90  NumericVector<Number> &nonlinear_solution =
91  *(_system.solution);
92 // _system.get_vector("_nonlinear_solution");
93 
94  old_nonlinear_soln = nonlinear_solution;
95 
96  if (!first_solve)
98 }
99 
100 
101 
103 {
105 
106  return core_time_solver->error_order();
107 }
108 
109 
110 
111 bool AdaptiveTimeSolver::element_residual (bool request_jacobian,
112  DiffContext &context)
113 {
115 
116  return core_time_solver->element_residual(request_jacobian, context);
117 }
118 
119 
120 
121 bool AdaptiveTimeSolver::side_residual (bool request_jacobian,
122  DiffContext &context)
123 {
125 
126  return core_time_solver->side_residual(request_jacobian, context);
127 }
128 
129 
130 
132 {
133  return core_time_solver->diff_solver();
134 }
135 
136 
137 
140 {
141  return s.calculate_norm(v, component_norm);
142 }
143 
144 } // namespace libMesh

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:04 UTC

Hosted By:
SourceForge.net Logo