From d09e66d0eb823a379970cab031ed5faa11280405 Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Fri, 12 Sep 2014 11:27:49 -0500 Subject: [PATCH] Improve the documentation for step-52. --- doc/doxygen/tutorial/tutorial.h.in | 12 ++++++++ doc/news/changes.h | 5 ++++ examples/step-52/doc/intro.dox | 6 +++- examples/step-52/step-52.cc | 47 +++++++++++++++++------------- 4 files changed, 48 insertions(+), 22 deletions(-) diff --git a/doc/doxygen/tutorial/tutorial.h.in b/doc/doxygen/tutorial/tutorial.h.in index 9383cdd1e5..91965c1d3d 100644 --- a/doc/doxygen/tutorial/tutorial.h.in +++ b/doc/doxygen/tutorial/tutorial.h.in @@ -394,6 +394,12 @@ * * * + * step-52/td> + * Solving the time dependent neutron diffusion equation using + * Runge-Kutta methods. + * + * + * * step-53 * Describing the geometry of complex domains and curved boundaries. * @@ -971,5 +977,11 @@ * * step-33 * + * + * + * Time dependent neutron diffusion equation + * + * step-52 + * * */ diff --git a/doc/news/changes.h b/doc/news/changes.h index b1a6b04576..b5cadb98a3 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -97,6 +97,11 @@ inconvenience this causes.
    +
  1. New: The new tutorial program step-52 explains how to use the + new time stepping methods. +
    + (Bruno Turcksin, Damien Lebrun-Grandie, 2014/09/12) +
  2. New: The new tutorial program step-53 explains how to deal with complicated geometries.
    diff --git a/examples/step-52/doc/intro.dox b/examples/step-52/doc/intro.dox index 273e92ca9f..2998354dec 100644 --- a/examples/step-52/doc/intro.dox +++ b/examples/step-52/doc/intro.dox @@ -2,6 +2,10 @@ This program was contributed by Bruno Turcksin and Damien Lebrun-Grandie. +Note: In order to run this program, deal.II must be configured to use +the UMFPACK sparse direct solver. Refer to the ReadMe for instructions how to do this. +

    Introducion

    @@ -9,7 +13,7 @@ This program shows how to use Runge-Kutta methods to solve a time-dependent problem. It solves a small variation of the heat equation discussed first in step-26 but, since the purpose of this program is only to demonstrate using more advanced ways to interface with deal.II's time stepping algorithms, only -solves a simple problem on a uniformly refined mesh. +solves a simple problem on a uniformly refined mesh.

    Problem statement

    diff --git a/examples/step-52/step-52.cc b/examples/step-52/step-52.cc index d7308c9cd8..dc00b6421a 100644 --- a/examples/step-52/step-52.cc +++ b/examples/step-52/step-52.cc @@ -64,8 +64,16 @@ namespace Step52 // @sect3{Diffusion} - // Now, here comes the declaration of the main class. Most of the functions in - // this class are not new and have been explained in previous tutorials. + // The next piece is the declaration of the main class. Most of the functions in + // this class are not new and have been explained in previous tutorials. The + // only interesting functions are evaluate_diffusion and + // id_minus_tau_J_inverse. evaluate_diffusion evaluates the + // diffusion equation, $M^{-1}(f(t,y))$, at a given time, for a given $\tau$ + // and a given $y$. id_minus_tau_J_inverse evaluates + // $\left(I-\tau M^{-1} \frac{\partial f(t,y)}{\partial y}\right)^{-1}$ or + // equivalently $\left(M-\tau \frac{\partial f}{\partial y}\right)^{-1} M$ at + // a given time, for a given $\tau$ and $y$. This function is needed when an + // implicit method is used. class Diffusion { public: @@ -80,13 +88,8 @@ namespace Step52 double get_source(double time,const Point<2> &point) const; - // This function evaluates the diffusion equation $M^{-1}(f(t,y))$ at a given time and - // for a given y. Vector evaluate_diffusion(const double time, const Vector &y) const; - // Evaluate $\left(I-\tau M^{-1} \frac{\partial f(t,y)}{\partial y}\right)^{-1}$ or - // equivalently $\left(M-\tau \frac{\partial f}{\partial y}\right)^{-1} M$ at a given - // time, for a given $\tau$ and y. Vector id_minus_tau_J_inverse(const double time, const double tau, const Vector &y); @@ -96,7 +99,7 @@ namespace Step52 // The next three functions are the driver for the explicit methods, the // implicit methods, and the embedded explicit methods respectively. The // driver function for embedded explicit methods returns the number of - // steps executed since this number is adapted. + // steps executed. void explicit_method(TimeStepping::runge_kutta_method method, const unsigned int n_time_steps, const double initial_time, @@ -153,7 +156,7 @@ namespace Step52 // @sect5{Diffusion::setup_system} // Now, we create the constraint matrix and the sparsity pattern. Then, we - // initialize the matrices that we will use and the solution vector. + // initialize the matrices and the solution vector. void Diffusion::setup_system() { dof_handler.distribute_dofs(fe); @@ -255,7 +258,8 @@ namespace Step52 // @sect5{Diffusion:evaluate_diffusion} // - // Now, the weak form of the diffusion equation is evaluated at a given time t and for a given vector y. + // Now, the weak form of the diffusion equation is evaluated at a given + // time $t$ and for a given vector $y$. Vector Diffusion::evaluate_diffusion(const double time, const Vector &y) const { Vector tmp(dof_handler.n_dofs()); @@ -421,10 +425,11 @@ namespace Step52 // @sect5{Diffusion::explicit_method} - // This function is the driver for all the explicit method. It call - // evolve_one_time_step which performs one time step. evolve_one_time_step - // needs to evaluate $M^{-1}(f(t,y))$, i.e it needs evaluate_diffusion. - // Because evaluate_diffusion is a member function, it needs to be bind to + // This function is the driver for all the explicit method. It calls + // evolve_one_time_step which performs one time step. + // evolve_one_time_step needs to evaluate $M^{-1}(f(t,y))$, + // i.e, it needs evaluate_diffusion. Because + // evaluate_diffusion is a member function, it needs to be bind to // $this$. Finally, the solution is output every 10 time steps. void Diffusion::explicit_method(TimeStepping::runge_kutta_method method, const unsigned int n_time_steps, @@ -451,9 +456,9 @@ namespace Step52 // @sect5{Diffusion::implicit_method} - // This function is equivalent to explicit_method but for implicit methods. - // When using implicit methods, we need to evaluate $M^{-1}(f(t,y))$ and - // $\left(I-\tau M^{-1} \frac{\partial f(t,y)}{\partial y}\right)^{-1}$. + // This function is equivalent to explicit_method but for implicit + // methods. When using implicit methods, we need to evaluate $M^{-1}(f(t,y))$ + // and $\left(I-\tau M^{-1} \frac{\partial f(t,y)}{\partial y}\right)^{-1}$. void Diffusion::implicit_method(TimeStepping::runge_kutta_method method, const unsigned int n_time_steps, const double initial_time, @@ -494,7 +499,7 @@ namespace Step52 // Embedded methods use a guessed time step. If the error using this time step // is too large, the time step will be reduced. If the error is below the // threshold, a larger time step will be tried for the next time step. - // delta_t_guess is the guessed time step produced by the embedded method. + // delta_t_guess is the guessed time step produced by the embedded method. unsigned int Diffusion::embedded_explicit_method(TimeStepping::runge_kutta_method method, const unsigned int n_time_steps, const double initial_time, @@ -516,7 +521,7 @@ namespace Step52 unsigned int n_steps=0; while (timefinal_time) time_step = final_time-time; @@ -660,8 +665,8 @@ namespace Step52 // @sect3{The main() function} // -// The following main function is similar to previous examples as -// well, and need not be commented on. +// The following main function is similar to previous examples +// and need not be commented on. int main () { try -- 2.39.5