libMesh
Loading...
Searching...
No Matches
claw_system.h
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#ifndef CLAW_SYSTEM_H
19#define CLAW_SYSTEM_H
20
21// libMesh includes
22#include "libmesh/linear_implicit_system.h" // base class
23
24namespace libMesh
25{
26
37{
38public:
39
46
52 const std::string & name,
53 const unsigned int number);
54
58 virtual ~ClawSystem ();
59
64
68 virtual std::string system_type () const override;
69
73 static TemporalDiscretizationType string_to_enum(std::string string_type);
74 static std::string enum_to_string(TemporalDiscretizationType enum_type);
75
80 virtual void process_parameters_file (const std::string& parameters_filename);
81
86
92
97
108
112 void set_delta_t(Real delta_t_in);
114
118 void set_n_time_steps(unsigned int n_time_steps_in);
119 unsigned int get_n_time_steps();
120
125 void set_LxF_constant(Real LxF_constant_in);
127
133
137 void set_write_interval(unsigned int write_interval_in);
138 unsigned int get_write_interval();
139
143 void set_time(Real time_in);
144 Real get_time();
145
149 virtual void print_info();
150
155
159 virtual void init_data() override;
160
161private:
162
171
175 std::unique_ptr<SparseMatrix<Number>> _mass_matrix;
176
180 std::vector<std::unique_ptr<SparseMatrix<Number>>> _advection_matrices;
181
185 std::vector<std::unique_ptr<SparseMatrix<Number>>> _avg_matrices;
186
190 std::unique_ptr<SparseMatrix<Number>> _jump_matrix;
191
196 std::vector<std::unique_ptr<SparseMatrix<Number>>> _boundary_condition_matrices;
197
203
208
212 unsigned int _n_time_steps;
213
218
222 unsigned int _write_interval;
223
228};
229
230} // namespace libMesh
231
232#endif
unsigned int dim
This class encapsulates functionality that allows us to solve conservation laws.
Definition claw_system.h:37
virtual std::string system_type() const override
Definition claw_system.C:61
static TemporalDiscretizationType string_to_enum(std::string string_type)
Convert between string and enum for TemporalDiscretizationType.
Definition claw_system.C:67
void assemble_mass_matrix()
Helper functions called by assemble_all_matrices().
void solve_conservation_law()
Solve the conservation law.
Definition claw_system.C:95
std::vector< std::unique_ptr< SparseMatrix< Number > > > _avg_matrices
The "flux average" element boundary matrices.
void assemble_advection_matrices()
unsigned int get_n_time_steps()
LinearImplicitSystem Parent
The type of the parent.
Definition claw_system.h:63
TemporalDiscretizationType
Define an enumeration for temporal discretization types ForwardEuler = 1st-order Explicit Euler RK4 =...
Definition claw_system.h:45
void set_n_time_steps(unsigned int n_time_steps_in)
Set/get the number of time-steps.
Real _time
The current time in the conservation law solve.
unsigned int get_write_interval()
std::vector< std::unique_ptr< SparseMatrix< Number > > > _advection_matrices
The "advection" matrices.
virtual ~ClawSystem()
Destructor.
std::vector< std::unique_ptr< SparseMatrix< Number > > > _boundary_condition_matrices
The "boundary condition" matrices.
void set_temporal_discretization_type(TemporalDiscretizationType td_in)
Set/get the temporal discretization type.
TemporalDiscretizationType _temporal_discretization_type
String that defines the type of temporal discretization that we use.
void assemble_all_matrices()
Assemble the matrices we need to solve a conservation law.
void set_LxF_constant(Real LxF_constant_in)
Set/get the Lax-Friedrichs constant.
SparseMatrix< Number > & get_jump_matrix()
void set_write_interval(unsigned int write_interval_in)
Set/get write_interval.
std::unique_ptr< SparseMatrix< Number > > _mass_matrix
The mass matrix.
SparseMatrix< Number > & get_advection_matrix(unsigned int dim)
void assemble_boundary_condition_matrices()
void write_out_discretization_matrices()
Print discretization matrices to file in MATLAB-readable format.
void set_time(Real time_in)
Set/get the current time in the conservation law solve.
void assemble_avg_coupling_matrices()
SparseMatrix< Number > & get_boundary_condition_matrix(unsigned int dim)
SparseMatrix< Number > & get_mass_matrix()
Get a reference to one of the discretization matrices.
void assemble_jump_coupling_matrix()
Real _delta_t
The time step size.
static std::string enum_to_string(TemporalDiscretizationType enum_type)
Definition claw_system.C:80
unsigned int _n_time_steps
The number of time steps.
void set_delta_t(Real delta_t_in)
Set/get the time-step size.
SparseMatrix< Number > & get_avg_matrix(unsigned int dim)
virtual void process_parameters_file(const std::string &parameters_filename)
Set parameters for this system (e.g.
unsigned int _write_interval
The time step interval between writing out solutions.
Real _LxF_constant
The constant C in the Lax-Friedrichs flux.
virtual void assemble_claw_rhs(NumericVector< Number > &)=0
Assemble the right-hand side vector.
virtual void init_data() override
Initialize the system (e.g.
virtual void print_info()
Print out some info about the system's configuration.
std::unique_ptr< SparseMatrix< Number > > _jump_matrix
The "jump" element boundary matrix.
TemporalDiscretizationType get_temporal_discretization_type()
This is the EquationSystems class.
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
Generic sparse matrix.
const std::string & name() const
Definition system.h:2385
unsigned int number() const
Definition system.h:2393
The libMesh namespace provides an interface to certain functionality in the library.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real