libMesh::TransientSystem< Base > Class Template Reference

Used for solving transient systems of equations. More...

#include <transient_system.h>

Inheritance diagram for libMesh::TransientSystem< Base >:

Public Types

typedef TransientSystem< Base > sys_type
 

Public Member Functions

 TransientSystem (EquationSystems &es, const std::string &name, const unsigned int number)
 
virtual ~TransientSystem ()
 
sys_typesystem ()
 
virtual void clear () libmesh_override
 
virtual void reinit () libmesh_override
 
virtual std::string system_type () const libmesh_override
 
Number old_solution (const dof_id_type global_dof_number) const
 
Number older_solution (const dof_id_type global_dof_number) const
 

Public Attributes

UniquePtr< NumericVector< Number > > old_local_solution
 
UniquePtr< NumericVector< Number > > older_local_solution
 

Protected Member Functions

virtual void init_data () libmesh_override
 
virtual void re_update () libmesh_override
 

Detailed Description

template<class Base>
class libMesh::TransientSystem< Base >

Used for solving transient systems of equations.

This class provides a specific system class. It aims at transient systems, offering nothing more than just the essentials needed to solve a system.

Note
Additional vectors/matrices can be added via parent class interfaces.
Author
Benjamin S. Kirk
Date
2004

Definition at line 51 of file transient_system.h.

Member Typedef Documentation

template<class Base>
typedef TransientSystem<Base> libMesh::TransientSystem< Base >::sys_type

The type of system.

Definition at line 71 of file transient_system.h.

Constructor & Destructor Documentation

template<class Base >
libMesh::TransientSystem< Base >::TransientSystem ( EquationSystems es,
const std::string &  name,
const unsigned int  number 
)

Constructor. Initializes required data structures.

Definition at line 39 of file transient_system.C.

References libMesh::GHOSTED, libMesh::TransientSystem< Base >::old_local_solution, libMesh::TransientSystem< Base >::older_local_solution, and libMesh::SERIAL.

41  :
42 
43  Base (es, name_in, number_in)
44 {
45 #ifdef LIBMESH_ENABLE_GHOSTED
47  UniquePtr<NumericVector<Number> >
48  (&(this->add_vector("_transient_old_local_solution", true, GHOSTED)));
50  UniquePtr<NumericVector<Number> >
51  (&(this->add_vector("_transient_older_local_solution", true, GHOSTED)));
52 #else
54  UniquePtr<NumericVector<Number> >
55  (&(this->add_vector("_transient_old_local_solution", true, SERIAL)));
57  UniquePtr<NumericVector<Number> >
58  (&(this->add_vector("_transient_older_local_solution", true, SERIAL)));
59 #endif
60 }
UniquePtr< NumericVector< Number > > old_local_solution
UniquePtr< NumericVector< Number > > older_local_solution
template<class Base >
libMesh::TransientSystem< Base >::~TransientSystem ( )
virtual

Destructor.

Definition at line 65 of file transient_system.C.

References libMesh::TransientSystem< Base >::clear(), libMesh::TransientSystem< Base >::old_local_solution, and libMesh::TransientSystem< Base >::older_local_solution.

66 {
67  this->clear();
68 
69  // We still have UniquePtrs for API compatibility, but
70  // now that we're System::add_vector()ing these, we can trust
71  // the base class to handle memory management
72  old_local_solution.release();
73  older_local_solution.release();
74 }
UniquePtr< NumericVector< Number > > old_local_solution
UniquePtr< NumericVector< Number > > older_local_solution
virtual void clear() libmesh_override

Member Function Documentation

template<class Base >
void libMesh::TransientSystem< Base >::clear ( )
virtual

Clear all the data structures associated with the system.

Reimplemented in libMesh::TransientRBConstruction.

Definition at line 79 of file transient_system.C.

References libMesh::TransientSystem< Base >::old_local_solution, and libMesh::TransientSystem< Base >::older_local_solution.

Referenced by libMesh::TransientSystem< RBConstruction >::system(), and libMesh::TransientSystem< Base >::~TransientSystem().

80 {
81  // clear the parent data
82  Base::clear();
83 
84  // the old & older local solutions
85  // are now deleted by System!
86  // old_local_solution->clear();
87  // older_local_solution->clear();
88 
89  // FIXME: This preserves maximum backwards compatibility,
90  // but is probably grossly unnecessary:
91  old_local_solution.release();
92  older_local_solution.release();
93 
95  UniquePtr<NumericVector<Number> >
96  (&(this->add_vector("_transient_old_local_solution")));
98  UniquePtr<NumericVector<Number> >
99  (&(this->add_vector("_transient_older_local_solution")));
100 }
UniquePtr< NumericVector< Number > > old_local_solution
UniquePtr< NumericVector< Number > > older_local_solution
template<class Base >
void libMesh::TransientSystem< Base >::init_data ( )
protectedvirtual

Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.

Definition at line 106 of file transient_system.C.

References libMesh::get_dof_map(), libMesh::GHOSTED, libMesh::TransientSystem< Base >::old_local_solution, libMesh::TransientSystem< Base >::older_local_solution, and libMesh::SERIAL.

107 {
108  // initialize parent data
109  Base::init_data();
110 
111  // Initialize the old & older solutions
112  // Using new ghosted vectors if enabled
113 #ifdef LIBMESH_ENABLE_GHOSTED
114  old_local_solution->init (this->n_dofs(), this->n_local_dofs(),
115  this->get_dof_map().get_send_list(), false,
116  GHOSTED);
117  older_local_solution->init (this->n_dofs(), this->n_local_dofs(),
118  this->get_dof_map().get_send_list(), false,
119  GHOSTED);
120 #else
121  old_local_solution->init (this->n_dofs(), false, SERIAL);
122  older_local_solution->init (this->n_dofs(), false, SERIAL);
123 #endif
124 }
UniquePtr< NumericVector< Number > > old_local_solution
UniquePtr< NumericVector< Number > > older_local_solution
sys get_dof_map()
template<class Base >
Number libMesh::TransientSystem< Base >::old_solution ( const dof_id_type  global_dof_number) const
Returns
The old solution (at the previous timestep) for the specified global DOF.

Definition at line 178 of file transient_system.C.

References libMesh::get_dof_map(), and libMesh::TransientSystem< Base >::old_local_solution.

Referenced by libMesh::TransientSystem< RBConstruction >::system().

179 {
180  // Check the sizes
181  libmesh_assert_less (global_dof_number, this->get_dof_map().n_dofs());
182  libmesh_assert_less (global_dof_number, old_local_solution->size());
183 
184  return (*old_local_solution)(global_dof_number);
185 }
UniquePtr< NumericVector< Number > > old_local_solution
sys get_dof_map()
template<class Base >
Number libMesh::TransientSystem< Base >::older_solution ( const dof_id_type  global_dof_number) const
Returns
The older solution (two timesteps ago) for the specified global DOF.

Definition at line 190 of file transient_system.C.

References libMesh::get_dof_map(), and libMesh::TransientSystem< Base >::older_local_solution.

Referenced by libMesh::TransientSystem< RBConstruction >::system().

191 {
192  // Check the sizes
193  libmesh_assert_less (global_dof_number, this->get_dof_map().n_dofs());
194  libmesh_assert_less (global_dof_number, older_local_solution->size());
195 
196  return (*older_local_solution)(global_dof_number);
197 }
UniquePtr< NumericVector< Number > > older_local_solution
sys get_dof_map()
template<class Base >
void libMesh::TransientSystem< Base >::re_update ( )
protectedvirtual

Re-update the local values when the mesh has changed. This method takes the data updated by update() and makes it up-to-date on the current mesh.

Definition at line 143 of file transient_system.C.

References libMesh::get_dof_map(), libMesh::TransientSystem< Base >::old_local_solution, and libMesh::TransientSystem< Base >::older_local_solution.

144 {
145  // re_update the parent system
146  Base::re_update ();
147 
148  const std::vector<dof_id_type> & send_list = this->get_dof_map().get_send_list ();
149 
150  const dof_id_type first_local_dof = Base::get_dof_map().first_dof();
151  const dof_id_type end_local_dof = Base::get_dof_map().end_dof();
152 
153  // Check sizes
154  libmesh_assert_greater_equal (end_local_dof, first_local_dof);
155  libmesh_assert_greater_equal (older_local_solution->size(), send_list.size());
156  libmesh_assert_greater_equal (old_local_solution->size(), send_list.size());
157 
158  // Even if we don't have to do anything ourselves, localize() may
159  // use parallel_only tools
160  // if (first_local_dof == end_local_dof)
161  // return;
162 
163  // Update the old & older solutions with the send_list,
164  // which may have changed since their last update.
165  older_local_solution->localize (first_local_dof,
166  end_local_dof-1,
167  send_list);
168 
169  old_local_solution->localize (first_local_dof,
170  end_local_dof-1,
171  send_list);
172 }
UniquePtr< NumericVector< Number > > old_local_solution
UniquePtr< NumericVector< Number > > older_local_solution
sys get_dof_map()
uint8_t dof_id_type
Definition: id_types.h:64
template<class Base >
void libMesh::TransientSystem< Base >::reinit ( )
virtual

Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be used.

Definition at line 129 of file transient_system.C.

Referenced by libMesh::TransientSystem< RBConstruction >::system().

130 {
131  // initialize parent data
132  Base::reinit();
133 
134  // Project the old & older vectors to the new mesh
135  // The System::reinit handles this now
136  // this->project_vector (*old_local_solution);
137  // this->project_vector (*older_local_solution);
138 }
template<class Base>
sys_type& libMesh::TransientSystem< Base >::system ( )
inline
Returns
A reference to *this.

Definition at line 76 of file transient_system.h.

76 { return *this; }
template<class Base >
std::string libMesh::TransientSystem< Base >::system_type ( ) const
inlinevirtual
Returns
"Transient" prepended to T::system_type(). Helps in identifying the system type in an equation system file.

Definition at line 165 of file transient_system.h.

Referenced by libMesh::TransientSystem< RBConstruction >::system().

166 {
167  std::string type = "Transient";
168  type += Base::system_type ();
169 
170  return type;
171 }

Member Data Documentation

template<class Base>
UniquePtr<NumericVector<Number> > libMesh::TransientSystem< Base >::old_local_solution

All the values I need to compute my contribution to the simulation at hand. Think of this as the current solution with any ghost values needed from other processors.

Definition at line 119 of file transient_system.h.

Referenced by libMesh::TransientSystem< Base >::clear(), libMesh::TransientSystem< Base >::init_data(), libMesh::TransientSystem< Base >::old_solution(), libMesh::TransientSystem< Base >::re_update(), libMesh::TransientSystem< Base >::TransientSystem(), and libMesh::TransientSystem< Base >::~TransientSystem().

template<class Base>
UniquePtr<NumericVector<Number> > libMesh::TransientSystem< Base >::older_local_solution

All the values I need to compute my contribution to the simulation at hand. Think of this as the current solution with any ghost values needed from other processors.

Definition at line 127 of file transient_system.h.

Referenced by libMesh::TransientSystem< Base >::clear(), libMesh::TransientSystem< Base >::init_data(), libMesh::TransientSystem< Base >::older_solution(), libMesh::TransientSystem< Base >::re_update(), libMesh::TransientSystem< Base >::TransientSystem(), and libMesh::TransientSystem< Base >::~TransientSystem().


The documentation for this class was generated from the following files: