From 18bdcab08c6d588610dbbc2f2337b15bbe01ea45 Mon Sep 17 00:00:00 2001 From: turcksin Date: Fri, 23 May 2014 16:58:46 +0000 Subject: [PATCH] Improve documentation for step-52. git-svn-id: https://svn.dealii.org/trunk@32975 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-52/doc/intro.dox | 17 +++++++++-------- deal.II/examples/step-52/step-52.cc | 13 ++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/deal.II/examples/step-52/doc/intro.dox b/deal.II/examples/step-52/doc/intro.dox index 58e4a1e7b1..9e8f9605f7 100644 --- a/deal.II/examples/step-52/doc/intro.dox +++ b/deal.II/examples/step-52/doc/intro.dox @@ -20,9 +20,10 @@ fissible and therefore, the neutron flux satisfies the following equation: @f} augmented by appropriate boundary conditions. Here, $v$ is the velocity of neutrons (for simplicity we assume it is equal to 1), $D$ is the diffusion coefficient, -$\Sigma_a$ is the absorption cross section, and $S$ is a source. Because we are only i -nterested in the time dependence, we assume that $D$ and $\Sigma_a$ are constant. We are looking -for a solution on a square domain $[0,b]\times[0,b]$ of the form: +$\Sigma_a$ is the absorption cross section, and $S$ is a source. Because we are +only interested in the time dependence, we assume that $D$ and $\Sigma_a$ are +constant. We are looking for a solution on a square domain $[0,b]\times[0,b]$ of +the form: @f{eqnarray*} \phi(x,t) = A\sin(\omega t)(bx-x^2). @f} @@ -70,7 +71,7 @@ deal.II can be divided in three categories:

Explicit Runge-Kutta

-These methods that include for forward Euler, third order Runge-Kutta, and +These methods that include forward Euler, third order Runge-Kutta, and fourth order Runge-Kutta, require a function to evaluate $M^{-1}f(t,y)$. These methods become unstable when the time step chosen is too large. @@ -81,9 +82,9 @@ estimate the error and decide if the time step needs to be refined or coarsen. Only embedded explicit methods have been implemented at the time of the writing.

Implicit Runge-Kutta

-These methods include backward Euler, implicit midpoint, Crank-Nicolson, and the +These methods include backward Euler, implicit midpoint, Crank-Nicolson, and a two stages SDIRK. These methods require to evaluate $M^{-1}f(t,y)$ and -$\left(I-\Delta t M^{-1} \frac{\partial f}{\partial y}\right)$ or equivalently +$\left(I-\Delta t M^{-1} \frac{\partial f}{\partial y}\right)^{-1}$ or equivalently $\left(M - \Delta t \frac{\partial f}{\partial y}\right)^{-1} M$. These methods are always stable. @@ -91,7 +92,7 @@ always stable. To use the Runge-Kutta methods, we need to be able to evaluate: @f{eqnarray*} f = \oint D b_i \frac{\partial b_j}{\partial n} d\boldsymbol{r} - \int D \nabla -b_i \nabla b_j \phi_j d\boldsymbol{r} -\int \Sigma_a b_i b_j \phi_j \phi_j +b_i \nabla b_j \phi_j d\boldsymbol{r} -\int \Sigma_a b_i b_j \phi_j d\boldsymbol{r} + \int b_j S d\boldsymbol{r} @f} and $\frac{\partial f}{\partial y}$. Because $f$ is linear in $y$ (or $\phi$ in @@ -102,7 +103,7 @@ To simplify the problem, the domain is two dimensional and the mesh is uniform (there is no need to adapt the mesh since we use quadratic finite elements and the exact solution is quadratic). Going from a two dimensional domain to a three dimensional domain is not very challenging. However if the -mesh must be adapted, it is important to note to remember to: +mesh must be adapted, it is important to remember to:
  1. project the solution to the new mesh when the mesh is changed. The mesh used should be the same at the beginning and at the end of the time step. diff --git a/deal.II/examples/step-52/step-52.cc b/deal.II/examples/step-52/step-52.cc index 84fc1a44f4..f75fa19b4c 100644 --- a/deal.II/examples/step-52/step-52.cc +++ b/deal.II/examples/step-52/step-52.cc @@ -110,7 +110,7 @@ namespace Step52 const double initial_time, const double final_time); - // Driver for the embedded explicit methods. Returns the number of steps + // Driver for the embedded explicit methods. This function returns the number of steps // executed. unsigned int embedded_explicit_method(TimeStepping::runge_kutta_method method, const unsigned int n_time_steps, @@ -145,8 +145,7 @@ namespace Step52 - // We choose quadratic finite elements so there are no spatial error and we - // initialize the parameters. + // We choose quadratic finite elements and we initialize the parameters. Diffusion::Diffusion() : fe_degree(2), @@ -205,8 +204,8 @@ namespace Step52 cell = dof_handler.begin_active(), endc = dof_handler.end(); - // Compute $-\int D \nabla b \cdot \nabla b - \int \Sigma_a b b $ and the mass matrix - // $\int b b$. + // Compute $-\int D \nabla b_i \cdot \nabla b_j d\boldsymbol{r} - \int \Sigma_a b_i b_j d\boldsymbol{r}$ + // and the mass matrix $\int b_i b_j d\boldsymbol{r}$. for (; cell!=endc; ++cell) { cell_matrix = 0.; @@ -266,7 +265,7 @@ namespace Step52 { Vector tmp(dof_handler.n_dofs()); tmp = 0.; - // Compute $tmp=system_matrix y$. + // Compute $tmp=system\_matrix\cdot y$. system_matrix.vmult(tmp,y); const QGauss<2> quadrature_formula(fe_degree+1); @@ -334,7 +333,7 @@ namespace Step52 // Compute $tmp=My$. mass_matrix.vmult(tmp,y); - // Compute $\left(M-\tau \frac{\partial f}{\partial y}\right)^{-1} tmp$. + // Compute $\left(M-\tau \frac{\partial f}{\partial y}\right)^{-1} tmp = \left(M-\tau \frac{\partial f}{\partial y}\right)^{-1} My$. inverse_mass_minus_tau_Jacobian.vmult(result,tmp); return result; -- 2.39.5