Template Class PoissonSolver

Inheritance Relationships

Base Type

  • public dealii::EnableObserverPointer

Class Documentation

template<int dim, int spacedim = dim>
class PoissonSolver : public dealii::EnableObserverPointer

Distributed finite-element solver for a scalar Poisson problem.

The solver follows the standard deal.II step-6 lifecycle: make_grid(), setup_fe(), setup_system(), assemble_system(), solve(), output_results(), and optional refine_grid() are orchestrated by run(). It owns one scalar finite-element space, one assembled stiffness matrix, and one distributed solution vector.

The template parameters describe the mesh dimension and its embedding: PoissonSolver<1>, PoissonSolver<1, 2>, PoissonSolver<1, 3>, PoissonSolver<2>, PoissonSolver<2, 3>, and PoissonSolver<3> are the supported combinations. Embedded meshes use the geometric Jacobians supplied by deal.II, so the same class also provides a Laplace&#8212;Beltrami discretization.

The triangulation backend is selected by PoissonParameters::triangulation_type. The usual distributed backend is used by default for dimensions 2 and 3. The fully distributed backend can be selected for any supported pair and is forced for dim == 1, where deal.II does not provide a distributed 1D triangulation. Fully distributed meshes are constructed from a serial mesh and are not currently refined after construction; use one initial mesh with that backend.

Public Types

using VectorType = LA::MPI::Vector

Public Functions

explicit PoissonSolver(const PoissonParameters<dim, spacedim> &par)
void make_grid()
void setup_fe()
void setup_system()
void assemble_system()
void solve()
void output_results() const
void output_results(unsigned int output_cycle) const

Write output for an explicitly selected refinement cycle.

void refine_grid()
void run()
dealii::types::global_dof_index n_dofs() const

Return the global number of degrees of freedom.

double solution_l2_norm() const

Return the global L2 norm of the most recently computed solution.

bool solution_is_finite() const

Return whether the most recently computed solution has a finite norm.

const dealii::parallel::TriangulationBase<dim, spacedim> &triangulation() const

Return the triangulation used by this problem.

const dealii::DoFHandler<dim, spacedim> &dof_handler() const

Return the finite-element DoFHandler used by this problem.

const dealii::AffineConstraints<double> &constraints() const

Return the homogeneous and inhomogeneous algebraic constraints.

const LA::MPI::SparseMatrix &system_matrix() const

Return the assembled Poisson operator without mutable access.

const VectorType &system_rhs() const

Return the assembled right-hand side without mutable access.

const dealii::IndexSet &locally_owned_dofs() const

Return the locally owned algebraic degrees of freedom.

const dealii::IndexSet &locally_relevant_dofs() const

Return the locally relevant algebraic degrees of freedom.

const VectorType &solution() const

Return the current locally owned solution vector.

void set_solution(const VectorType &new_solution)

Replace the algebraic state computed by an external solver.

Constraints are distributed and the ghosted state used by output and error routines is refreshed, so a coupled algebraic solver can hand its result back to an otherwise independent Poisson problem.