Reduced Lagrange Multipliers
 
Loading...
Searching...
No Matches
reduced_poisson.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2024 by Luca Heltai
4//
5// This file is part of the reduced_lagrange_multipliers application, based on
6// the deal.II library.
7//
8// The reduced_lagrange_multipliers application is free software; you can use
9// it, redistribute it, and/or modify it under the terms of the Apache-2.0
10// License WITH LLVM-exception as published by the Free Software Foundation;
11// either version 3.0 of the License, or (at your option) any later version. The
12// full text of the license can be found in the file LICENSE.md at the top level
13// of the reduced_lagrange_multipliers distribution.
14//
15// ---------------------------------------------------------------------
16
17/* ---------------------------------------------------------------------
18 */
19#ifndef dealii_reduced_poisson_h
20#define dealii_reduced_poisson_h
21
25#include <deal.II/base/timer.h>
26
32// #define MATRIX_FREE_PATH
33
34#define FORCE_USE_OF_TRILINOS
35namespace LA
36{
37#if defined(DEAL_II_WITH_PETSC) && !defined(DEAL_II_PETSC_WITH_COMPLEX) && \
38 !(defined(DEAL_II_WITH_TRILINOS) && defined(FORCE_USE_OF_TRILINOS))
39 using namespace dealii::LinearAlgebraPETSc;
40# define USE_PETSC_LA
41#elif defined(DEAL_II_WITH_TRILINOS)
42 using namespace dealii::LinearAlgebraTrilinos;
43#else
44# error DEAL_II_WITH_PETSC or DEAL_II_WITH_TRILINOS required
45#endif
46} // namespace LA
52
56
60
62#include <deal.II/fe/fe_q.h>
67
72
84#include <deal.II/lac/vector.h>
85
87
88#ifdef MATRIX_FREE_PATH
90
97#endif
98
102
105
106#include <matrix_free_utils.h>
107
108#include "reduced_coupling.h"
109
110#ifdef DEAL_II_WITH_OPENCASCADE
111# include <TopoDS.hxx>
112#endif
113#include <cmath>
114#include <fstream>
115#include <iostream>
116#include <memory>
117
118
119template <int spacedim>
150
151
152
153template <int dim, int spacedim = dim>
155{
156public:
158 void
159 make_grid();
160 void
161 setup_fe();
162 void
163 setup_dofs();
164#ifndef MATRIX_FREE_PATH
165 void
167#else
168 void
169 assemble_rhs();
170#endif
171 void
172 run();
173
174 void
175 solve();
176
177 void
179
180 std::string
181 output_solution() const;
182
183 void
184 output_results() const;
185
186 void
187 print_parameters() const;
188
189private:
195 std::unique_ptr<FiniteElement<spacedim>> fe;
196
197 std::unique_ptr<Quadrature<spacedim>> quadrature;
198
200
202
203 std::vector<IndexSet> owned_dofs;
204 std::vector<IndexSet> relevant_dofs;
205
207
208 LA::MPI::SparseMatrix coupling_matrix;
209 LA::MPI::SparseMatrix coupling_matrix_transpose;
210 LA::MPI::SparseMatrix inclusion_matrix;
212#ifdef MATRIX_FREE_PATH
215 std::unique_ptr<CouplingOperator<spacedim, double, 1>> coupling_operator;
217 using LevelMatrixType = MatrixFreeOperators::LaplaceOperator<
218 spacedim,
219 -1,
220 -1,
221 1,
224 MGConstrainedDoFs mg_constrained_dofs;
225#else
226 LA::MPI::SparseMatrix stiffness_matrix;
227 using VectorType = LA::MPI::Vector;
228 using BlockVectorType = LA::MPI::BlockVector;
229#endif
230
234 std::vector<std::vector<BoundingBox<spacedim>>> global_bounding_boxes;
235 unsigned int cycle = 0;
236};
237
238
239#endif
ParameterAcceptor(const std::string &section_name="")
BlockVectorType system_rhs
std::unique_ptr< FiniteElement< spacedim > > fe
BlockVectorType locally_relevant_solution
LA::MPI::SparseMatrix coupling_matrix_transpose
MappingQ< spacedim > mapping
std::vector< IndexSet > relevant_dofs
LA::MPI::SparseMatrix inclusion_matrix
std::unique_ptr< Quadrature< spacedim > > quadrature
BlockVectorType solution
const ReducedPoissonParameters< spacedim > & par
std::vector< IndexSet > owned_dofs
parallel::distributed::Triangulation< spacedim > tria
AffineConstraints< double > constraints
ConditionalOStream pcout
unsigned int cycle
DoFHandler< spacedim > dh
LA::MPI::SparseMatrix coupling_matrix
MPI_Comm mpi_communicator
ReducedPoisson(const ReducedPoissonParameters< spacedim > &par)
std::vector< std::vector< BoundingBox< spacedim > > > global_bounding_boxes
void print_parameters() const
LA::MPI::Vector VectorType
LA::MPI::BlockVector BlockVectorType
void output_results() const
TimerOutput computing_timer
ReducedCoupling< 1, 2, spacedim, 1 > reduced_coupling
LA::MPI::SparseMatrix stiffness_matrix
void assemble_poisson_system()
std::string output_solution() const
ParameterAcceptorProxy< Functions::ParsedFunction< spacedim > > bc
ParsedConvergenceTable convergence_table
ReducedCouplingParameters< 1, 2, spacedim, 1 > reduced_coupling_parameters
std::list< types::boundary_id > dirichlet_ids
ParameterAcceptorProxy< ReductionControl > inner_control
ParameterAcceptorProxy< ReductionControl > outer_control
ParameterAcceptorProxy< Functions::ParsedFunction< spacedim > > rhs
EnableObserverPointer Subscriptor
Combines tensor product space and particle coupling for reduced Lagrange multipliers.
Parameter structure for configuring ReducedCoupling objects.