/* to the file deal.II/doc/license.html for the text and */
/* further information on this license. */
- // These first include files have all
+ // @sect3{Include files}
+
+ // These first include files have all
// been treated in previous examples,
// so we won't explain what is in
// them again.
}
- // @sect3{The Laplace solver class}
+ // @sect3{The Helmholtz solver class}
// Then we need the class that does
// all the work. It is mostly the
// respective functions or variables
// below.
template <int dim>
-class LaplaceProblem
+class HelmholtzProblem
{
public:
// We will use this class in
// element and the refinement
// mode as parameter and stores
// them in local variables.
- LaplaceProblem (const FiniteElement<dim> &fe,
- const RefinementMode refinement_mode);
+ HelmholtzProblem (const FiniteElement<dim> &fe,
+ const RefinementMode refinement_mode);
// The following two functions
// are the same as in previous
// examples.
- ~LaplaceProblem ();
+ ~HelmholtzProblem ();
void run ();
// triangulation (which is empty at
// present, however).
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem (const FiniteElement<dim> &fe,
- const RefinementMode refinement_mode) :
+HelmholtzProblem<dim>::HelmholtzProblem (const FiniteElement<dim> &fe,
+ const RefinementMode refinement_mode) :
dof_handler (triangulation),
fe (&fe),
refinement_mode (refinement_mode)
template <int dim>
-LaplaceProblem<dim>::~LaplaceProblem ()
+HelmholtzProblem<dim>::~HelmholtzProblem ()
{
dof_handler.clear ();
}
// difference being the renumbering
// step.
template <int dim>
-void LaplaceProblem<dim>::setup_system ()
+void HelmholtzProblem<dim>::setup_system ()
{
dof_handler.distribute_dofs (*fe);
// Renumbering the degrees of
// changed anyway, so we comment on
// this function fairly extensively.
template <int dim>
-void LaplaceProblem<dim>::assemble_system ()
+void HelmholtzProblem<dim>::assemble_system ()
{
// First we need to define objects
// which will be used as quadrature
// Solving the system of equations is
// done in the same way as before.
template <int dim>
-void LaplaceProblem<dim>::solve ()
+void HelmholtzProblem<dim>::solve ()
{
SolverControl solver_control (1000, 1e-12);
SolverCG<> cg (solver_control);
// constructor, we do global or
// adaptive refinement.
template <int dim>
-void LaplaceProblem<dim>::refine_grid ()
+void HelmholtzProblem<dim>::refine_grid ()
{
switch (refinement_mode)
{
break;
};
- // In case of adaptive
- // refinement, we use the same
- // functions and classes as in
- // the previous example
- // program. Note that one
- // could treat Neumann
- // boundaries differently than
- // Dirichlet boundaries, and
- // one should in fact do so
- // here since we have Neumann
- // boundary conditions on part
- // of the boundaries, but
- // since we don't have a
- // function here that
- // describes the Neumann
- // values (we only construct
- // these values from the exact
- // solution when assembling
- // the matrix), we omit this
- // detail here.
+ // In case of adaptive
+ // refinement, we use the same
+ // functions and classes as in
+ // the previous example
+ // program. Note that one
+ // could treat Neumann
+ // boundaries differently than
+ // Dirichlet boundaries, and
+ // one should in fact do so
+ // here since we have Neumann
+ // boundary conditions on part
+ // of the boundaries, but
+ // since we don't have a
+ // function here that
+ // describes the Neumann
+ // values (we only construct
+ // these values from the exact
+ // solution when assembling
+ // the matrix), we omit this
+ // detail here.
case adaptive_refinement:
{
Vector<float> estimated_error_per_cell (triangulation.n_active_cells());
// convergence against the continuous
// solution in a nice format.
template <int dim>
-void LaplaceProblem<dim>::process_solution (const unsigned int cycle)
+void HelmholtzProblem<dim>::process_solution (const unsigned int cycle)
{
// In order to integrate the
// difference between computed
// linear system, solution, and
// post-processing.
template <int dim>
-void LaplaceProblem<dim>::run ()
+void HelmholtzProblem<dim>::run ()
{
for (unsigned int cycle=0; cycle<7; ++cycle)
{
break;
default:
- // The finite element is
- // neither Q1 nor Q2. This
- // should not have happened,
- // but maybe someone has tried
- // to change this in ``main'',
- // so it might happen. We catch
- // this case and throw an
- // exception, since we don't
- // know how to name the
- // respective output file
+ // The finite element is
+ // neither Q1 nor Q2. This
+ // should not have happened,
+ // but maybe someone has tried
+ // to change this in ``main'',
+ // so it might happen. We catch
+ // this case and throw an
+ // exception, since we don't
+ // know how to name the
+ // respective output file
Assert (false, ExcInternalError());
};
// order to destroy the
// respective objects (i.e. the
// finite element and the
- // LaplaceProblem object) at
+ // HelmholtzProblem object) at
// the end of the block and
// before we go to the next
// run.
<< std::endl;
FE_Q<dim> fe(1);
- LaplaceProblem<dim> laplace_problem_2d (fe, LaplaceProblem<dim>::adaptive_refinement);
- laplace_problem_2d.run ();
+ HelmholtzProblem<dim> helmholtz_problem_2d (fe, HelmholtzProblem<dim>::adaptive_refinement);
+ helmholtz_problem_2d.run ();
std::cout << std::endl;
};
<< std::endl;
FE_Q<dim> fe(1);
- LaplaceProblem<dim> laplace_problem_2d (fe, LaplaceProblem<dim>::global_refinement);
- laplace_problem_2d.run ();
+ HelmholtzProblem<dim> helmholtz_problem_2d (fe, HelmholtzProblem<dim>::global_refinement);
+ helmholtz_problem_2d.run ();
std::cout << std::endl;
};
<< std::endl;
FE_Q<dim> fe(2);
- LaplaceProblem<dim> laplace_problem_2d (fe, LaplaceProblem<dim>::global_refinement);
- laplace_problem_2d.run ();
+ HelmholtzProblem<dim> helmholtz_problem_2d (fe, HelmholtzProblem<dim>::global_refinement);
+ helmholtz_problem_2d.run ();
std::cout << std::endl;
};