/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/FEM/assembler/dg.hh Source File#
|
DiFfRG
|
dg.hh
Go to the documentation of this file.
18 return named_tuple<std::tuple<T &...>, StringSet<"fe_functions", "extractors", "variables">>(std::tie(t...));
23 return named_tuple<std::tuple<T &...>, StringSet<"fe_functions", "fe_derivatives", "fe_hessians">>(
38 ScratchData(const Mapping<dim> &mapping, const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature,
166 template <typename Discretization_, typename Model_> class Assembler : public FEMAssembler<Discretization_, Model_>
189 virtual void reinit_vector(VectorType &vec) const override { vec.reinit(dof_handler.n_dofs()); }
204 MatrixCreator::create_mass_matrix(dof_handler, quadrature, mass_matrix, (Function<dim, NumberType> *)nullptr,
234 virtual const SparseMatrix<NumberType> &get_mass_matrix() const override { return mass_matrix; }
242 virtual void refinement_indicator(Vector<double> &indicator, const VectorType &solution_global) override
248 const auto cell_worker = [&](const Iterator &t_cell, Scratch &scratch_data, CopyData ©_data) {
275 const auto face_worker = [&](const Iterator &t_cell, const uint &f, const uint &sf, const Iterator &t_ncell,
329 update_values | update_gradients | update_quadrature_points | update_JxW_values | update_hessians;
330 const UpdateFlags interface_update_flags = update_values | update_gradients | update_quadrature_points |
333 Scratch scratch_data(mapping, fe, quadrature, quadrature_face, update_flags, interface_update_flags);
337 MeshWorker::mesh_loop(dof_handler.begin_active(), dof_handler.end(), cell_worker, copier, scratch_data,
341 virtual void mass(VectorType &mass, const VectorType &solution_global, const VectorType &solution_global_dot,
349 const auto cell_worker = [&](const Iterator &cell, Scratch &scratch_data, CopyData ©_data) {
387 MeshWorker::mesh_loop(dof_handler.begin_active(), dof_handler.end(), cell_worker, copier, scratch_data,
391 virtual void residual(VectorType &residual, const VectorType &solution_global, NumberType weight,
406 const auto cell_worker = [&](const Iterator &cell, Scratch &scratch_data, CopyData ©_data) {
445 const auto boundary_worker = [&](const Iterator &cell, const uint &face_no, Scratch &scratch_data,
473 scalar_product(numflux[component_i], normals[q_index])); // phi_i(x_q) * numflux(x_q, u_q) * n(x_q)
477 const auto face_worker = [&](const Iterator &cell, const uint &f, const uint &sf, const Iterator &ncell,
511 model.numflux(numflux, normals[q_index], x_q, fe_tie(solution_s[q_index], extracted_data, variables),
533 MeshWorker::AssembleFlags flags = MeshWorker::assemble_own_cells | MeshWorker::assemble_boundary_faces |
537 MeshWorker::mesh_loop(dof_handler.begin_active(), dof_handler.end(), cell_worker, copier, scratch_data,
542 virtual void jacobian_mass(SparseMatrix<NumberType> &jacobian, const VectorType &solution_global,
551 const auto cell_worker = [&](const Iterator &cell, Scratch &scratch_data, CopyData ©_data) {
596 MeshWorker::mesh_loop(dof_handler.begin_active(), dof_handler.end(), cell_worker, copier, scratch_data,
601 virtual void jacobian(SparseMatrix<NumberType> &jacobian, const VectorType &solution_global, NumberType weight,
618 const auto cell_worker = [&](const Iterator &cell, Scratch &scratch_data, CopyData ©_data) {
679 const auto boundary_worker = [&](const Iterator &cell, const uint &face_no, Scratch &scratch_data,
691 SimpleMatrix<Tensor<1, dim>, n_components, Components::count_extractors()> j_extr_boundary_numflux;
703 model.template jacobian_boundary_numflux_extr<1>(j_extr_boundary_numflux, normals[q_index], x_q,
711 weight * JxW[q_index] * fe_fv.shape_value_component(j, q_index, component_j) * // dx * phi_j(x_q)
727 const auto face_worker = [&](const Iterator &cell, const uint &f, const uint &sf, const Iterator &ncell,
763 array<SimpleMatrix<Tensor<1, dim>, n_components, Components::count_extractors()>, 2> j_extr_numflux;
806 FullMatrix<NumberType> extractor_dependence(cdf.joint_dof_indices.size(), extractor_dof_indices.size());
808 constraints.distribute_local_to_global(extractor_dependence, cdf.joint_dof_indices, extractor_dof_indices,
813 FullMatrix<NumberType> extractor_dependence(c.local_dof_indices.size(), extractor_dof_indices.size());
815 constraints.distribute_local_to_global(extractor_dependence, c.local_dof_indices, extractor_dof_indices,
822 MeshWorker::AssembleFlags flags = MeshWorker::assemble_own_cells | MeshWorker::assemble_boundary_faces |
826 MeshWorker::mesh_loop(dof_handler.begin_active(), dof_handler.end(), cell_worker, copier, scratch_data,
835 ss << " Reinit: " << average_time_reinit() * 1000 << "ms (" << num_reinits() << ")" << std::endl;
836 ss << " Residual: " << average_time_residual_assembly() * 1000 << "ms (" << num_residuals() << ")"
838 ss << " Jacobian: " << average_time_jacobian_assembly() * 1000 << "ms (" << num_jacobians() << ")"
The basic assembler that can be used for any standard DG scheme with flux and source.
Definition dg.hh:167
virtual void jacobian(SparseMatrix< NumberType > &jacobian, const VectorType &solution_global, NumberType weight, const VectorType &solution_global_dot, NumberType alpha, NumberType beta, const VectorType &variables=VectorType()) override
Definition dg.hh:601
SparsityPattern sparsity_pattern_mass
Definition dg.hh:885
virtual const SparsityPattern & get_sparsity_pattern_jacobian() const override
Obtain the sparsity pattern of the jacobian matrix.
Definition dg.hh:230
SparsityPattern sparsity_pattern_jacobian
Definition dg.hh:886
double average_time_residual_assembly()
Definition dg.hh:853
virtual void reinit() override
Reinitialize the assembler. This is necessary if the mesh has changed, e.g. after a mesh refinement.
Definition dg.hh:191
virtual void mass(VectorType &mass, const VectorType &solution_global, const VectorType &solution_global_dot, NumberType weight) override
Definition dg.hh:341
Assembler(Discretization &discretization, Model &model, const JSONValue &json)
Definition dg.hh:180
virtual void jacobian_mass(SparseMatrix< NumberType > &jacobian, const VectorType &solution_global, const VectorType &solution_global_dot, NumberType alpha=1., NumberType beta=1.) override
Definition dg.hh:542
virtual void rebuild_jacobian_sparsity() override
Definition dg.hh:218
virtual void refinement_indicator(Vector< double > &indicator, const VectorType &solution_global) override
refinement indicator for adaptivity. Calls the model's cell_indicator and face_indicator functions.
Definition dg.hh:242
virtual void residual(VectorType &residual, const VectorType &solution_global, NumberType weight, const VectorType &solution_global_dot, NumberType weight_mass, const VectorType &variables=VectorType()) override
Definition dg.hh:391
std::vector< types::global_dof_index > extractor_dof_indices
Definition common.hh:355
virtual const SparseMatrix< NumberType > & get_mass_matrix() const override
Obtain the mass matrix.
Definition dg.hh:234
virtual void reinit_vector(VectorType &vec) const override
Definition dg.hh:189
double average_time_jacobian_assembly()
Definition dg.hh:863
The basic assembler that can be used for any standard CG scheme with flux and source.
Definition common.hh:39
FullMatrix< NumberType > extractor_jacobian
Definition common.hh:351
void extract(std::array< NumberType, Components::count_extractors()> &data, const VectorType &solution_global, const VectorType &variables, bool search_EoM, bool set_EoM, bool postprocess) const
Definition common.hh:200
bool jacobian_extractors(FullMatrix< NumberType > &extractor_jacobian, const VectorType &solution_global, const VectorType &variables)
Definition common.hh:237
virtual void reinit() override
Reinitialize the assembler. This is necessary if the mesh has changed, e.g. after a mesh refinement.
Definition common.hh:108
std::vector< types::global_dof_index > extractor_dof_indices
Definition common.hh:355
Definition quadrature.hh:56
size_t size() const
A simple NxM-matrix class, which is used for cell-wise Jacobians.
Definition tuples.hh:156
Definition complex_math.hh:10
Definition dg.hh:151
std::array< uint, 2 > cell_indices
Definition dg.hh:152
std::array< double, 2 > values
Definition dg.hh:153
Definition dg.hh:150
std::vector< CopyFaceData_I > face_data
Definition dg.hh:155
Definition dg.hh:119
void reinit(const FEInterfaceValues< dim > &fe_iv, uint n_extractors)
Definition dg.hh:124
FullMatrix< NumberType > extractor_cell_jacobian
Definition dg.hh:121
FullMatrix< NumberType > cell_jacobian
Definition dg.hh:120
std::vector< types::global_dof_index > joint_dof_indices
Definition dg.hh:122
Definition dg.hh:118
FullMatrix< NumberType > cell_mass_jacobian
Definition dg.hh:135
std::vector< types::global_dof_index > local_dof_indices
Definition dg.hh:136
FullMatrix< NumberType > extractor_cell_jacobian
Definition dg.hh:134
FullMatrix< NumberType > cell_jacobian
Definition dg.hh:133
void reinit(const Iterator &cell, uint dofs_per_cell, uint n_extractors)
Definition dg.hh:139
std::vector< CopyDataFace_J > face_data
Definition dg.hh:137
Definition dg.hh:91
Vector< NumberType > cell_residual
Definition dg.hh:92
std::vector< types::global_dof_index > joint_dof_indices
Definition dg.hh:93
void reinit(const FEInterfaceValues< dim > &fe_iv)
Definition dg.hh:95
Definition dg.hh:90
std::vector< CopyDataFace_R > face_data
Definition dg.hh:105
void reinit(const Iterator &cell, uint dofs_per_cell)
Definition dg.hh:107
std::vector< types::global_dof_index > local_dof_indices
Definition dg.hh:104
Vector< NumberType > cell_residual
Definition dg.hh:102
Class to hold data for each assembly thread, i.e. FEValues for cells, interfaces, as well as pre-allo...
Definition dg.hh:33
array< std::vector< VectorType >, 2 > solution_interface
Definition dg.hh:85
typename Discretization::NumberType NumberType
Definition dg.hh:35
FEInterfaceValues< dim > fe_interface_values
Definition dg.hh:81
ScratchData(const ScratchData< Discretization > &scratch_data)
Definition dg.hh:57
std::vector< VectorType > solution_dot
Definition dg.hh:84
ScratchData(const Mapping< dim > &mapping, const FiniteElement< dim > &fe, const Quadrature< dim > &quadrature, const Quadrature< dim - 1 > &quadrature_face, const UpdateFlags update_flags=update_values|update_gradients|update_quadrature_points|update_JxW_values, const UpdateFlags interface_update_flags=update_values|update_gradients|update_quadrature_points|update_JxW_values|update_normal_vectors)
Definition dg.hh:38
Definition tuples.hh:34
A class to store a tuple with elements that can be accessed by name. The names are stored as FixedStr...
Definition tuples.hh:56
Generated by