/__w/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/common/abstract_assembler.hh Source File#

DiFfRG: /__w/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/common/abstract_assembler.hh Source File
DiFfRG
Discretization Framework for functional Renormalization Group flows
abstract_assembler.hh
Go to the documentation of this file.
1#pragma once
2
3// DiFfRG
6
7namespace DiFfRG
8{
9 using namespace dealii;
10
39 template <typename VectorType, typename SparseMatrixType, uint dim> class AbstractAssembler
40 {
41 public:
43
53 virtual void attach_data_output(DataOutput<dim, VectorType> &data_out, const VectorType &solution,
54 const VectorType &variables = VectorType(),
55 const VectorType &dt_solution = VectorType(),
56 const VectorType &residual = VectorType()) = 0;
57
62 virtual void reinit() = 0;
63
69 virtual void set_time(double t) = 0;
70
77
83 virtual IndexSet get_differential_indices() const = 0;
84
90 virtual void reinit_vector(VectorType &vector) const = 0;
91
97 virtual const SparseMatrixType &get_mass_matrix() const = 0;
98
103
112 virtual void residual_variables([[maybe_unused]] VectorType &residual, [[maybe_unused]] const VectorType &variables,
113 [[maybe_unused]] const VectorType &spatial_solution)
114 {
115 throw std::runtime_error("residual_variables() is not implemented by this assembler");
116 };
117
126 virtual void jacobian_variables([[maybe_unused]] FullMatrix<NumberType> &jacobian,
127 [[maybe_unused]] const VectorType &variables,
128 [[maybe_unused]] const VectorType &spatial_solution)
129 {
130 throw std::runtime_error("jacobian_variables() is not implemented by this assembler");
131 };
132
142 void mass(VectorType &mass, const VectorType &solution_global, NumberType weight)
143 {
144 this->mass(mass, solution_global, solution_global, weight);
145 }
146
157 virtual void mass(VectorType &mass, const VectorType &solution_global, const VectorType &solution_global_dot,
158 NumberType weight) = 0;
159
178 void residual(VectorType &residual, const VectorType &solution_global, NumberType weight, NumberType weight_mass,
179 const VectorType &variables = VectorType())
180 {
181 this->residual(residual, solution_global, weight, solution_global, weight_mass, variables);
182 }
183
203 virtual void residual(VectorType &residual, const VectorType &solution_global, NumberType weight,
204 const VectorType &solution_global_dot, NumberType weight_mass,
205 const VectorType &variables = VectorType()) = 0;
206
219 void jacobian_mass(SparseMatrixType &jacobian, const VectorType &solution_global, NumberType mass_weight = 1.)
220 {
221 this->jacobian_mass(jacobian, solution_global, solution_global, mass_weight, 0.);
222 }
223
239 virtual void jacobian_mass(SparseMatrixType &jacobian, const VectorType &solution_global,
240 const VectorType &solution_global_dot, NumberType alpha = 1., NumberType beta = 1.) = 0;
241
252 void jacobian(SparseMatrixType &jacobian, const VectorType &solution_global, NumberType weight,
253 NumberType mass_weight, const VectorType &variables = VectorType())
254 {
255 this->jacobian(jacobian, solution_global, weight, solution_global, mass_weight, mass_weight, variables);
256 }
257
268 virtual void jacobian(SparseMatrixType &jacobian, const VectorType &solution_global, NumberType weight,
269 const VectorType &solution_global_dot, NumberType alpha, NumberType beta,
270 const VectorType &variables = VectorType()) = 0;
272 };
273} // namespace DiFfRG
This is the general assembler interface for any kind of discretization. An assembler is responsible f...
Definition abstract_assembler.hh:40
void mass(VectorType &mass, const VectorType &solution_global, NumberType weight)
Calculates the mass for an ODE.
Definition abstract_assembler.hh:142
virtual void jacobian_variables(FullMatrix< NumberType > &jacobian, const VectorType &variables, const VectorType &spatial_solution)
When coupling the spatial discretization to additional variables, this function should calculate the ...
Definition abstract_assembler.hh:126
void jacobian_mass(SparseMatrixType &jacobian, const VectorType &solution_global, NumberType mass_weight=1.)
Calculates the jacobian of the mass function for an ODE.
Definition abstract_assembler.hh:219
virtual void reinit_vector(VectorType &vector) const =0
Reinitialize an arbitrary vector so that it has the correct size and structure.
void jacobian(SparseMatrixType &jacobian, const VectorType &solution_global, NumberType weight, NumberType mass_weight, const VectorType &variables=VectorType())
Calculates the jacobian of the residual function for an ODE.
Definition abstract_assembler.hh:252
virtual void jacobian_mass(SparseMatrixType &jacobian, const VectorType &solution_global, const VectorType &solution_global_dot, NumberType alpha=1., NumberType beta=1.)=0
Calculates the jacobian of the mass function for a DAE.
virtual void mass(VectorType &mass, const VectorType &solution_global, const VectorType &solution_global_dot, NumberType weight)=0
Calculates the mass for a DAE.
typename get_type::NumberType< VectorType > NumberType
Definition abstract_assembler.hh:42
void residual(VectorType &residual, const VectorType &solution_global, NumberType weight, NumberType weight_mass, const VectorType &variables=VectorType())
Calculates the residual for an ODE.
Definition abstract_assembler.hh:178
virtual void residual_variables(VectorType &residual, const VectorType &variables, const VectorType &spatial_solution)
When coupling the spatial discretization to additional variables, this function should calculate the ...
Definition abstract_assembler.hh:112
virtual void attach_data_output(DataOutput< dim, VectorType > &data_out, const VectorType &solution, const VectorType &variables=VectorType(), const VectorType &dt_solution=VectorType(), const VectorType &residual=VectorType())=0
Attach any data output to the DataOutput object provided. This can be used to extract additional data...
virtual IndexSet get_differential_indices() const =0
Obtain the dofs which contain time derivatives.
virtual void jacobian(SparseMatrixType &jacobian, const VectorType &solution_global, NumberType weight, const VectorType &solution_global_dot, NumberType alpha, NumberType beta, const VectorType &variables=VectorType())=0
Calculates the jacobian of the residual function for a DAE.
virtual void residual(VectorType &residual, const VectorType &solution_global, NumberType weight, const VectorType &solution_global_dot, NumberType weight_mass, const VectorType &variables=VectorType())=0
Calculates the residual for a DAE.
virtual void set_time(double t)=0
Set the current time. The assembler should usually just forward this to the numerical model.
virtual const SparseMatrixType & get_mass_matrix() const =0
Obtain the mass matrix.
virtual const get_type::SparsityPattern< SparseMatrixType > & get_sparsity_pattern_jacobian() const =0
Obtain the sparsity pattern of the jacobian matrix.
virtual void reinit()=0
Reinitialize the assembler. This is necessary if the mesh has changed, e.g. after a mesh refinement.
Class to manage writing to files. FEM functions are written to vtk files and other data is written to...
Definition data_output.hh:20
typename internal::_NumberType< VectorType >::value NumberType
Definition types.hh:86
typename internal::_SparsityPattern< SparseMatrixType >::value SparsityPattern
Definition types.hh:89
Definition complex_math.hh:10