second_order_unsteady_solver.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 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 
20 #include "libmesh/diff_system.h"
21 #include "libmesh/dof_map.h"
22 
23 namespace libMesh
24 {
26  : UnsteadySolver(s),
27  _old_local_solution_rate(NumericVector<Number>::build(s.comm())),
28  _old_local_solution_accel(NumericVector<Number>::build(s.comm()))
29 {}
30 
32 {}
33 
35 {
37 
38  _system.add_vector("_old_solution_rate");
39  _system.add_vector("_old_solution_accel");
40 }
41 
43 {
45 
46 #ifdef LIBMESH_ENABLE_GHOSTED
49  GHOSTED);
50 
53  GHOSTED);
54 #else
57 #endif
58 }
59 
61 {
63 
64 #ifdef LIBMESH_ENABLE_GHOSTED
67  GHOSTED);
68 
71  GHOSTED);
72 #else
75 #endif
76 
77  // localize the old solutions
79  _system.get_vector("_old_solution_rate");
80 
82  _system.get_vector("_old_solution_accel");
83 
84  old_solution_rate.localize
87 
88  old_solution_accel.localize
91 }
92 
94 {
95  libmesh_not_implemented();
96 }
97 
100 {
102  _system.get_vector("_old_solution_rate");
103 
105 }
106 
108  const
109 {
110  libmesh_assert_less (global_dof_number, _system.get_dof_map().n_dofs());
111  libmesh_assert_less (global_dof_number, _old_local_solution_rate->size());
112 
113  return (*_old_local_solution_rate)(global_dof_number);
114 }
115 
117  const
118 {
119  libmesh_assert_less (global_dof_number, _system.get_dof_map().n_dofs());
120  libmesh_assert_less (global_dof_number, _old_local_solution_accel->size());
121 
122  return (*_old_local_solution_accel)(global_dof_number);
123 }
124 
125 } // end namespace libMesh
virtual void reinit() override
Number old_solution_accel(const dof_id_type global_dof_number) const
virtual void init_data() override
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
Definition: diff_context.h:40
std::unique_ptr< NumericVector< Number > > _old_local_solution_accel
dof_id_type n_local_dofs() const
Definition: system.C:187
dof_id_type n_dofs() const
Definition: system.C:150
sys_type & _system
Definition: time_solver.h:258
dof_id_type n_dofs() const
Definition: dof_map.h:574
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Definition: system.C:661
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774
Number old_solution_rate(const dof_id_type global_dof_number) const
void project_vector(NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, int is_adjoint=-1) const
void project_initial_rate(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr)
std::unique_ptr< NumericVector< Number > > _old_local_solution_rate
virtual void init() override
const DofMap & get_dof_map() const
Definition: system.h:2049
const std::vector< dof_id_type > & get_send_list() const
Definition: dof_map.h:450
uint8_t dof_id_type
Definition: id_types.h:64