libMesh
Loading...
Searching...
No Matches
second_order_unsteady_solver.C
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 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
18#include "libmesh/second_order_unsteady_solver.h"
19
20#include "libmesh/diff_system.h"
21#include "libmesh/dof_map.h"
22#include "libmesh/numeric_vector.h"
23
24namespace libMesh
25{
27 : UnsteadySolver(s),
28 _old_local_solution_rate(NumericVector<Number>::build(s.comm())),
29 _old_local_solution_accel(NumericVector<Number>::build(s.comm()))
30{}
31
33
35{
37
38 _system.add_vector("_old_solution_rate");
39 _system.add_vector("_old_solution_accel");
40}
41
59
92
94{
95 libmesh_not_implemented();
96}
97
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
This class provides a specific system class.
Definition diff_system.h:57
const std::vector< dof_id_type > & get_send_list() const
Definition dof_map.h:533
dof_id_type n_dofs(const unsigned int vn) const
Definition dof_map.h:776
Base class for functors that can be evaluated at a point and (optionally) time.
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.
std::unique_ptr< NumericVector< Number > > _old_local_solution_rate
Serial vector of previous time step velocity .
Number old_solution_accel(const dof_id_type global_dof_number) const
virtual void reinit() override
The reinitialization function.
virtual void init_data() override
The data initialization function.
Number old_solution_rate(const dof_id_type global_dof_number) const
virtual void init() override
The initialization function.
std::unique_ptr< NumericVector< Number > > _old_local_solution_accel
Serial vector of previous time step acceleration .
virtual void retrieve_timestep() override
This method retrieves all the stored solutions at the current system.time.
void project_initial_rate(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr)
Specify non-zero initial velocity.
virtual ~SecondOrderUnsteadySolver()
Destructor.
void project_vector(NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, int is_adjoint=-1, std::optional< ConstElemRange > active_local_range=std::nullopt, std::optional< std::vector< unsigned int > > variable_numbers=std::nullopt) const
Projects arbitrary functions onto a vector of degree of freedom values for the current system.
dof_id_type n_dofs() const
Definition system.C:118
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition system.C:756
dof_id_type n_local_dofs() const
Definition system.C:155
const DofMap & get_dof_map() const
Definition system.h:2417
const NumericVector< Number > & get_vector(std::string_view vec_name) const
Definition system.C:931
sys_type & _system
A reference to the system we are solving.
This is a generic class that defines a solver to handle time integration of DifferentiableSystems.
virtual void init() override
The initialization function.
virtual void init_data() override
The data initialization function.
virtual void reinit() override
The reinitialization function.
The libMesh namespace provides an interface to certain functionality in the library.
uint8_t dof_id_type
Definition id_types.h:67