// @sect3{Include files}
-#include <deal.II/base/quadrature_lib.h>
-#include <deal.II/base/logstream.h>
#include <deal.II/base/function.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/quadrature_lib.h>
#include <deal.II/base/utilities.h>
-#include <deal.II/lac/block_vector.h>
-#include <deal.II/lac/full_matrix.h>
-#include <deal.II/lac/block_sparse_matrix.h>
-#include <deal.II/lac/block_sparsity_pattern.h>
-#include <deal.II/lac/solver_cg.h>
-#include <deal.II/lac/precondition.h>
-#include <deal.II/lac/affine_constraints.h>
-#include <deal.II/lac/dynamic_sparsity_pattern.h>
-#include <deal.II/lac/solver_gmres.h>
-
-#include <deal.II/grid/tria.h>
-#include <deal.II/grid/grid_generator.h>
-#include <deal.II/grid/tria_accessor.h>
-#include <deal.II/grid/tria_iterator.h>
-#include <deal.II/grid/grid_tools.h>
-#include <deal.II/grid/grid_refinement.h>
-
+#include <deal.II/dofs/dof_accessor.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/dofs/dof_renumbering.h>
-#include <deal.II/dofs/dof_accessor.h>
#include <deal.II/dofs/dof_tools.h>
#include <deal.II/fe/fe_q.h>
#include <deal.II/fe/fe_system.h>
#include <deal.II/fe/fe_values.h>
-#include <deal.II/numerics/vector_tools.h>
-#include <deal.II/numerics/matrix_tools.h>
-#include <deal.II/numerics/data_out.h>
-#include <deal.II/numerics/error_estimator.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/grid/grid_refinement.h>
+#include <deal.II/grid/grid_tools.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/lac/affine_constraints.h>
+#include <deal.II/lac/block_sparse_matrix.h>
+#include <deal.II/lac/block_sparsity_pattern.h>
+#include <deal.II/lac/block_vector.h>
+#include <deal.II/lac/dynamic_sparsity_pattern.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/precondition.h>
+#include <deal.II/lac/solver_cg.h>
+#include <deal.II/lac/solver_gmres.h>
#include <deal.II/lac/sparse_direct.h>
-
#include <deal.II/lac/sparse_ilu.h>
-#include <deal.II/grid/grid_out.h>
+
+#include <deal.II/numerics/data_out.h>
+#include <deal.II/numerics/error_estimator.h>
+#include <deal.II/numerics/matrix_tools.h>
+#include <deal.II/numerics/vector_tools.h>
// We need to include the following file to do timings:
#include <deal.II/base/timer.h>
// This includes the files necessary for us to use geometric Multigrid
-#include <deal.II/multigrid/multigrid.h>
-#include <deal.II/multigrid/mg_transfer.h>
-#include <deal.II/multigrid/mg_tools.h>
#include <deal.II/multigrid/mg_coarse.h>
-#include <deal.II/multigrid/mg_smoother.h>
#include <deal.II/multigrid/mg_matrix.h>
+#include <deal.II/multigrid/mg_smoother.h>
+#include <deal.II/multigrid/mg_tools.h>
+#include <deal.II/multigrid/mg_transfer.h>
+#include <deal.II/multigrid/multigrid.h>
-#include <iostream>
#include <fstream>
+#include <iostream>
namespace Step56
{
Solution()
: Function<dim>(dim + 1)
{}
- virtual double value(const Point<dim> & p,
- const unsigned int component = 0) const override;
+ virtual double
+ value(const Point<dim> &p, const unsigned int component = 0) const override;
virtual Tensor<1, dim>
gradient(const Point<dim> & p,
const unsigned int component = 0) const override;
};
template <>
- double Solution<2>::value(const Point<2> & p,
- const unsigned int component) const
+ double
+ Solution<2>::value(const Point<2> &p, const unsigned int component) const
{
Assert(component <= 2 + 1, ExcIndexRange(component, 0, 2 + 1));
}
template <>
- double Solution<3>::value(const Point<3> & p,
- const unsigned int component) const
+ double
+ Solution<3>::value(const Point<3> &p, const unsigned int component) const
{
Assert(component <= 3 + 1, ExcIndexRange(component, 0, 3 + 1));
// Note that for the gradient we need to return a Tensor<1,dim>
template <>
- Tensor<1, 2> Solution<2>::gradient(const Point<2> & p,
- const unsigned int component) const
+ Tensor<1, 2>
+ Solution<2>::gradient(const Point<2> &p, const unsigned int component) const
{
Assert(component <= 2, ExcIndexRange(component, 0, 2 + 1));
}
template <>
- Tensor<1, 3> Solution<3>::gradient(const Point<3> & p,
- const unsigned int component) const
+ Tensor<1, 3>
+ Solution<3>::gradient(const Point<3> &p, const unsigned int component) const
{
Assert(component <= 3, ExcIndexRange(component, 0, 3 + 1));
: Function<dim>(dim + 1)
{}
- virtual double value(const Point<dim> & p,
- const unsigned int component = 0) const override;
+ virtual double
+ value(const Point<dim> &p, const unsigned int component = 0) const override;
};
template <>
- double RightHandSide<2>::value(const Point<2> & p,
- const unsigned int component) const
+ double
+ RightHandSide<2>::value(const Point<2> &p, const unsigned int component) const
{
Assert(component <= 2, ExcIndexRange(component, 0, 2 + 1));
}
template <>
- double RightHandSide<3>::value(const Point<3> & p,
- const unsigned int component) const
+ double
+ RightHandSide<3>::value(const Point<3> &p, const unsigned int component) const
{
Assert(component <= 3, ExcIndexRange(component, 0, 3 + 1));
const PreconditionerSType & preconditioner_S,
const bool do_solve_A);
- void vmult(BlockVector<double> &dst, const BlockVector<double> &src) const;
+ void
+ vmult(BlockVector<double> &dst, const BlockVector<double> &src) const;
mutable unsigned int n_iterations_A;
mutable unsigned int n_iterations_S;
public:
StokesProblem(const unsigned int pressure_degree,
SolverType::type solver_type);
- void run();
+ void
+ run();
private:
- void setup_dofs();
- void assemble_system();
- void assemble_multigrid();
- void solve();
- void compute_errors();
- void output_results(const unsigned int refinement_cycle) const;
+ void
+ setup_dofs();
+ void
+ assemble_system();
+ void
+ assemble_multigrid();
+ void
+ solve();
+ void
+ compute_errors();
+ void
+ output_results(const unsigned int refinement_cycle) const;
const unsigned int pressure_degree;
SolverType::type solver_type;
// This function sets up the DoFHandler, matrices, vectors, and Multigrid
// structures (if needed).
template <int dim>
- void StokesProblem<dim>::setup_dofs()
+ void
+ StokesProblem<dim>::setup_dofs()
{
TimerOutput::Scope scope(computing_timer, "Setup");
// mass matrix in the (1,1) block (if needed) and move it out of this location
// at the end of this function.
template <int dim>
- void StokesProblem<dim>::assemble_system()
+ void
+ StokesProblem<dim>::assemble_system()
{
TimerOutput::Scope assemble(computing_timer, "Assemble");
system_matrix = 0;
// Here, like in step-16, we have a function that assembles the level
// and interface matrices necessary for the multigrid preconditioner.
template <int dim>
- void StokesProblem<dim>::assemble_multigrid()
+ void
+ StokesProblem<dim>::assemble_multigrid()
{
TimerOutput::Scope multigrid_specific(computing_timer,
"(Multigrid specific)");
// only the entire solve function, but we separately time the setup of the
// preconditioner as well as the solve itself.
template <int dim>
- void StokesProblem<dim>::solve()
+ void
+ StokesProblem<dim>::solve()
{
TimerOutput::Scope solve(computing_timer, "Solve");
constraints.set_zero(solution);
// This function computes the L2 and H1 errors of the solution. For this,
// we need to make sure the pressure has mean zero.
template <int dim>
- void StokesProblem<dim>::compute_errors()
+ void
+ StokesProblem<dim>::compute_errors()
{
// Compute the mean pressure $\frac{1}{\Omega} \int_{\Omega} p(x) dx $
// and then subtract it from each pressure coefficient. This will result
// generates the initial grid and calls the other functions in the
// respective order.
template <int dim>
- void StokesProblem<dim>::run()
+ void
+ StokesProblem<dim>::run()
{
GridGenerator::hyper_cube(triangulation);
triangulation.refine_global(2);
} // namespace Step56
// @sect3{The main function}
-int main()
+int
+main()
{
try
{
const int dim = 3;
// options for SolverType: UMFPACK FGMRES_ILU FGMRES_GMG
{
-
- StokesProblem<dim> flow_problem(degree, SolverType::FGMRES_GMG);
- flow_problem.run();
+ StokesProblem<dim> flow_problem(degree, SolverType::FGMRES_GMG);
+ flow_problem.run();
}
{
- StokesProblem<dim> flow_problem(degree, SolverType::FGMRES_ILU);
- flow_problem.run();
+ StokesProblem<dim> flow_problem(degree, SolverType::FGMRES_ILU);
+ flow_problem.run();
}
-
-
}
catch (std::exception &exc)
{
<< "Aborting!" << std::endl
<< "----------------------------------------------------"
- << std::endl;
+ << std::endl;
return 1;
}