From: wolf
- The tutorial:
+ The tutorial:
for new users of the library. It explains the basic elements of
finite element programs based on the library, and provides small
example programs.
- Another chapter of the tutorial gives an overview of information
- classified by subject. This is more for reference than to learn
- about the library the first time.
@@ -73,7 +71,7 @@
- As for the tutorials, the API docs need to be generated first,
+ Just as for the tutorials, the API docs need to be generated first,
if you download deal.II. Please follow the
instructions in the
ReadMe file on how to do
diff --git a/deal.II/doc/navbar.html b/deal.II/doc/navbar.html
index 54899c31e1..a234aebaba 100644
--- a/deal.II/doc/navbar.html
+++ b/deal.II/doc/navbar.html
@@ -42,7 +42,7 @@
In this chapter we shall discuss
-The basic principles of using error estimates for adaptive refinement
-are rather simple. First, you get an error estimate for each cell.
-Second, each cell is refined according to this estimate, i.e. the
-cells with largest error estimate are refined and those with the least
-one are coarsened.
-
-The implementation of deal.II handles this principle
-exactly the same way: First, you call an error estimator that returns
-a vector containing the error estimates for each cell. Second,
-you pass this vector on to a function doing the refinement.
-
-What we have not told yet is that actually constructing an error
-estimator is nontrivial and in particular dependent on the equation
-you are presently solving. Since this is so, the library can not do it
-for you, but can only aid you in doing so.
-
-However, the library contains an error estimator for one equation, the
-Laplace equation, which is the standard equation in numerical
-analysis. Since it is so common, an error estimator for it was once
-implemented. It was later moved into the library, since besides being
-an estimator for Laplace's equation, it proved an almost universal
-tool if you want something to refine your grid based on local
-smoothness of your solution. This, in fact, is the principle from
-which the error estimator was constructed: it computes an
-approximation to the second derivative of the solution on each cell,
-and these values can then be used to control refinement of the grid
-for a wide class of equations. Almost all projects using
-deal.II have used this criterion in its early
-stages, to get a quick way to local mesh refinement, before
-problem-adapted error estimators were written for the particular
-equation later. Since the class has thus proven universal
-functionality, we will discuss it in this section and show how to use
-it to control mesh refinement.
-
-
-In deal.II there is exactly on standard error estimator:
-the error estimator by Kelly, Gago, Zienkiewicz and Babuska that
-tries to approximate the error per cell by integration of the jump of the
-gradient of the solution along the faces of each cell.
-In theory this error estimator has quite a number of limitations. These
-limitations as well as its implementation are described in
-
-the documentation for the class
-In order to use an error estimator you need the following information
-and objects respectively:
-
-The Kelly error estimator is then used the following way:
-
-All the functions for refinement (and coarsening) are contained
-within the
-Remember: In order to actually execute the refinement or coarsening
-you have to call
-
-
-There are two deal.II functions relevant for us at the moment:
-
-which does exactly what it says. This function accepts a number
-describing which part of the boundary we want to consider
-and the according function which shall be interpolated on that portion
-of the boundary. It returns a list of
-pairs of degrees of freedom numbers and values denoting the respective
-Dirichlet boundary values.
-
-This output is used by
-
-that inserts the proper boundary conditions into the system of equations.
-
-Example: We insert Dirichlet boundary conditions into
-a system of equations of the form
-You may have several different parts of the boundary which are
-identified by different boundary indicators. For example, this is
-commonly the case if you have inflow and outflow boundaries, or if
-your domain has inner boundaries, such as obstacles inside your
-domain. You may then want to associate different boundary functions
-with the different parts of the boundary, and you can do so by
-multiply calling
-
-
-On locally refined grids you get hanging nodes
-that need to be integrated into your problem matrix, and before that, into
-the matrix structure. Hanging nodes are
-constrained degrees of freedom; these constraints need to be taken into
-account when dealing with them.
-
-The deal.II class
-that has the ability to handle constraint matrices is called
-
-Example: We will create a
-constraint matrix for hanging nodes and condense the hanging nodes into our matrix structure. Below we show the includes,
-definitions and
-function calls needed. Be sure to use them in their appropriate places.
-Tutorials
diff --git a/deal.II/doc/tutorial/Makefile b/deal.II/doc/tutorial/Makefile
index 06ab483bf0..71a62e9b19 100644
--- a/deal.II/doc/tutorial/Makefile
+++ b/deal.II/doc/tutorial/Makefile
@@ -4,9 +4,7 @@ step-by-step:
cd chapter-2.step-by-step ; $(MAKE)
validate-xrefs:
- cd chapter-1.elements ; $(MAKE) validate-xrefs
cd chapter-2.step-by-step ; $(MAKE) validate-xrefs
- cd chapter-3.laplace ; $(MAKE) validate-xrefs
clean:
cd chapter-2.step-by-step ; $(MAKE) clean
diff --git a/deal.II/doc/tutorial/chapter-1.elements/Makefile b/deal.II/doc/tutorial/chapter-1.elements/Makefile
deleted file mode 100644
index 9d7bf2c49c..0000000000
--- a/deal.II/doc/tutorial/chapter-1.elements/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# $Id$
-
-
-# include paths and global variables
-include ../../../common/Make.global_options
-
-
-validate-xrefs:
- $(PERL) $D/doc/auto/scripts/validate-xrefs.pl *.html
-
-
-.PHONY: validate-xrefs
diff --git a/deal.II/doc/tutorial/chapter-1.elements/adaptivity.html b/deal.II/doc/tutorial/chapter-1.elements/adaptivity.html
deleted file mode 100644
index 7ad93c5a1e..0000000000
--- a/deal.II/doc/tutorial/chapter-1.elements/adaptivity.html
+++ /dev/null
@@ -1,242 +0,0 @@
-
-
-
-
-
-Error Estimate and Adaptivity
-
-
-
-
-
-How to use error estimates for adaptive refinement
-
-Error Estimators in deal.II
-
-KellyErrorEstimator
.
-In daily use, however, this error estimator has shown itself to behave
-rather like Hamlet: It is laden with theoretical woes and sorrows,
-but at the end of the day all practical problems are... gone.
-
-
-DoFHandler<dim> dof_handler
giving access to the degrees of
- freedom
- Quadrature<dim-1> quadrature
describing the
- quadrature rule to be used for integration on the cell faces
- FunctionMap neumann_bc
which denotes a mapping
- between a
- boundary indicator and the function denoting the boundary values on
- this part of the boundary, i.e. for each part of the boundary
- where Neumann boundary conditions hold (and its respective
- number) the function with the (inhomogeneous) Neumann values
- are given; in case you have homogeneous Neumann boundary
- values, the ZeroFunction
is the right function to
- be passed
- KellyErrorEstimator
class documentation).
-
-
-
-
- #include <numerics/error_estimator.h>
- dim
dimensions:
- KellyErrorEstimator<dim> error_estimate;
-
-
-
-
- void error_estimate::estimate (const DoFHandler<dim> &dof_handler,
- const Quadrature<dim-1> &quadrature,
- const FunctionMap &neumann_bc,
- const Vector<double> &solution,
- Vector<float> &error_per_cell,
- ... // coefficients, etc.
- );
-
- Adaptive Refinement
-
-Triangulation
class.
-Refinement and coarsening take place by first flagging the cells
-for coarsening or refinement using the functions described below
-and then actually executing the refinement using
-void execute_coarsening_and_refinement()
.
-There are several ways of refining or coarsening your grid using
-the output from an error estimator:
-
-
-
-
- void refine(const Vector<float> &error, const double
- threshold)
-
- void coarsen(const Vector<float> &error, const double
- threshold)
- top_fraction_of_cells
with
- the highest error, at the same time coarsen a certain fraction of
- cells bottom_fraction_of_cells
with the lowest error.
- void refine_and_coarsen_fixed_number(const Vector<number>
- &error, const double top_fraction_of_cells, const double
- bottom_fraction_of_cells)
-
- top_fraction
of the total error,
- at the same time coarsen a certain fraction of
- cells bottom_fraction
which make up only the
- bottom fraction.
- void refine_and_coarsen_fixed_fraction(const Vector<number>
- &error, const double top_fraction, const double
- bottom_fraction)
-
- void execute_coarsening_and_refinement()
.
-
-
-Example
-
-The following is a code snippet taken from some example programs:
-
-
-
-
-
-
- // use the Simpson rule for integration on the faces
- QSimpson
-
-
-
-
-
-
- Next Chapter:
-
-
- Back to this chapter's index
-
-
- Back to the tutorial index
-
-
-
-The deal.II group
-Boundary Conditions
-
-Setting boundary conditions
-
-
-
-
-void VectorTools::interpolate_boundary_values(...)
-
-
-
-
-void MatrixTools::apply_boundary_values(...)
-
-Au=f
. The vectors u
and
-f
and the matrix A
have already been initialized, likewise
-the handler for the degrees of freedom dof
and the corresponding finite
-element fe
.
-
-
- // this will hold the boundary value for
- // the degrees of freedom on the boundary
- // part with number '0'
-map<int,double> boundary_values;
- // and this is some user-defined function
- // describing the boundary values
-BoundaryFunction<dim> boundary_function;
- // interpolate the DoFs on boundary
- // portion '0':
-VectorTools<dim>::interpolate_boundary_values
- (dof_handler,
- 0, boundary_function,
- boundary_values);
-
- // set solution vector to the right size
-u.reinit(dof_handler.n_dofs());
- // we assume that the global matrix and
- // right hand side have already been
- // assembled.
-
- // now insert the boundary values into
- // the linear system of equations:
-MatrixTools<dim>::apply_boundary_values
- (boundary_values,
- A, u, f);
-
interpolate_boundary_values
with
-different boundary indicators (the '0'
above) and
-respective functions. Since the function does not clear the contents
-of the map, you may use it for each of this successive calls and pass
-only the final object to apply_boundary_values
.
-
-
-
-
-
-
-
-
-
- Next Chapter: Condensing the Hanging Nodes
-
-
- Back to this chapter's index
-
-
- Back to the tutorial index
-
-
-
-The deal.II group
-Condensing the Hanging Nodes
-
-ConstraintMatrix
. It provides all functions
-necessary to condense hanging nodes into a matrix structure.
-You will have to:
-
-
-
-void ConstraintMatrix::clear()
.
-void DoFTools::make_sparsity_pattern(const DoFHandler<dim> &,
- SparsityPattern &)
.
-void DoFHandler::make_constraint_matrix(ConstraintMatrix &)
.
-void
-ConstraintMatrix::close()
. Closing the object performs some
-sorting and reshuffling of data (but you need not care about what
-actually happens).
-This method is needed because you might wish to implement additional constraints
-(apart from those for the hanging nodes). This would have to be done before
-closing the object; therefore you can't have it closed automatically somewhere.
-ConstraintMatrix::condense(SparsityPattern &)
.
-
-
-
-You will later need to condense the matrix itself, and the right hand
-side vector, which is done by the following calls:
-
-#include <dofs/dof_handler.h>
-#include <lac/sparse_matrix.h>
-#include <dofs/dof_constraints.h>
-#include <dofs/dof_tools.h>
-
-const unsigned int dim=2; // Work in two dimensions, could also be three
-SparsityPattern sparsity_pattern;
-DoFHandler<dim> dof_handler;
-ConstraintMatrix hanging_nodes;
-
-hanging_nodes.clear();
-DoFTools::make_sparsity_pattern(dof_handler, sparsity_pattern);
-DoFTools::make_hanging_nodes_constraints(dof_handler, hanging_nodes);
-hanging_nodes.close();
-hanging_nodes.condense(matrix_structure);
-
-
-
-
-
-
-
-SparseMatrix
-Generalizations
-
-The ConstraintMatrix
is more general than only for use
-with hanging nodes. In fact, it is able to represent general
-constraints of the form
-
- Cx = 0
-
-where C
is a matrix and is represented by an object of
-type ConstraintMatrix
. Constraints due to hanging nodes
-are of this form, since for example using bilinear elements, the
-hanging node on the middle of a line equals the mean value of the two
-neighboring points, i.e. the entries of the respective row in the
-matrix are 1, -0.5, -0.5
. Since C
can be
-scaled arbitrarily, we can chose its diagonal elements to be one, and
-then only need to store the nondiagonal elements. The
-ConstraintMatrix
is specialized in storing these
-nondiagonal elements if there are only relatively few such elements
-per row (as is commonly the case for hanging nodes) and if the number
-of constraints itself is relatively low, i.e. much smaller than the
-total size of the matrix. In the latter case, most rows of the matrix
-contain only zeroes, and we only store those lines that constitute
-constraints, which are exactly the lines corresponding to hanging
-nodes.
-
-
-
-Some other constraints can be written in the same form as above, with
-a sparse matrix C
. In these cases, the
-ConstraintMatrix
can be used as well. For example, it has
-been used to perform computations on two grids at the same time, where
-the interpolation between the grids can be represented by some such
-matrix.
-
-
-
-
-
-
- Next Chapter: Solving the Problem - | -- Back to this chapter's index - | -- Back to the tutorial index - | -
- -
- - diff --git a/deal.II/doc/tutorial/chapter-1.elements/dofs.html b/deal.II/doc/tutorial/chapter-1.elements/dofs.html deleted file mode 100644 index 1ed47eccb4..0000000000 --- a/deal.II/doc/tutorial/chapter-1.elements/dofs.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - --Degrees of freedom - short DoFs - are needed to associate a numering -to the shape functions living on our triangulation. Using this -numbering, we can then interpret the discretized operator as a matrix, -where the matrix row and column numbers are identified with the DoF -numbers, and likewise the index of a vector denotes the number of the -respective degree of freedom. -
--For now we will only discuss how and when to number and renumber the -degrees of freedom. this needs to be done so deal.II -has a consistent numbering. -
- --Degrees of freedom must always be renumbered after the triangulation -has changed in any way, i.e. has been created or refined. -In particular the degrees of freedom must be distributed after the -triangulation has been created ! -Degrees of freedom -can but should not be renumbered at any other time. The reason is that -sparse matrix structures and constraint matrices - to name two examples - -rely on the numbering. If you -construct a sparse matrix structure and renumber your degrees of freedom -afterwards the structure will be invalid. -
- - - -
-The degrees of freedom are distributed on a triangulation using the function
-void DoFHandler<dim>::distribute_dofs(const FiniteElement<dim> &)
-The argument to distribute_dofs
is a finite element that describes
-how many degrees of freedom are located on vertices, lines etc.
-(FiniteElement
objects have much more functionality than only storing
-these numbers. Parts of this functionality are discussed in the chapter on
-matrix and vector
-generation.)
-distribute_dofs
works its way through the triangulation cell by
-cell, starting at the coarsest level, and numbers every degree of freedom that is not yet numbered.
-For non-multigrid algorithms it considers only active cells, i.e. cells
-without children.
-
-Example: We show the include files, definitions -and function calls needed. Be sure to use them in their appropriate places. -This example creates a hypercube and distributes the degrees of freedom. -The finite elements used are bilinear. -
-
-
-#include <grid/tria.h>
-#include <dofs/dof_handler.h>
-#include <grid/grid_generator.h>
-#include <fe/fe_lib.lagrange.h>
-
-// first build up the triangulation
-Triangulation<dim> triangulation;
-GridGenerator::hyper_cube (triangulation,-1,1);
-
-// you may want to refine the triangulation a bit here
-...
-
-// then associate a DoFHandler object with this triangulation...
-DoFHandler<dim> dof_handler (tria);
-
-// ...and distribute degrees of freedom for linear elements
-FEQ1<dim> fe;
-dof_handler.distribute_dofs(fe);
-
-
-
--For a number of solution algorithms this way of numbering is way below -optimal. In particular, as mentioned above, the degrees of freedom are -numbered starting on the active cells of coarser levels and going to -finer levels, but depending on how your triangulation was refined, the -order in which the cells are traversed will have no geometrical -pattern. Likewise, the distribution of DoF numbers will look mostly -random. -
-
-For some problems, it is better if the numbering of DoFs is roughly
-into a certain direction, for example from inflow to outflow in
-hyperbolic problems.
-To achieve a kind of numbering better suited to your problem the deal.II
-offers the class
-DoFRenumbering
with several functions implementing
-different ways of renumbering.
-The methods presently available are Cuthill-McKee and reverse
-Cuthill-McKee, and some other methods you will only want to ask for in
-more advanced applications. The first two algorithms are usually much
-better than the one used
-by distribute_dofs
, but neither is optimal (there is no algorithm
-that accomplishes optimal results within a reasonable amount of time).
-Both algorithms require a good point to start numbering from (for
-example one or more degrees of freedom on the inflow boundary) to
-achieve good results.
-
-The documentation of the DoFRenumbering
gives a good
-overview of how the methods mentioned above work, and how the
-functions performing the re-enumerations have to be called.
-
-
-
-
- Next Chapter: Hanging Nodes - | -- Back to this chapter's index - | -- Back to the tutorial index - | -
- -
- - diff --git a/deal.II/doc/tutorial/chapter-1.elements/grid_creation.html b/deal.II/doc/tutorial/chapter-1.elements/grid_creation.html deleted file mode 100644 index 4a7bfa4353..0000000000 --- a/deal.II/doc/tutorial/chapter-1.elements/grid_creation.html +++ /dev/null @@ -1,308 +0,0 @@ - - - --The numerics for which this library was written is always done on a grid. -Choosing the right kind of grid can be essential for solving your problem. -A grid should be chosen to fit your problem space in the best way possible. -This chapter describes coarse grids for the triangulation of your domain. -
--deal.II offers various ways to produce grids for -standard domains, such as -a hypercube, a hyperball -and a hyper_L. There may be more in the meantime (for -example I can now see a ring domain), and you may want to check out -the documentation of the GridGenerator class for this. -
-Furthermore it is possible to -read a triangulation from a ucd-file or -generate a custom grid from within a program. -
-We note before actually going to some code snippets that -a triangulation object must be empty before it is initialized with a -grid. However, you need not fear now, since the library will tell you -if you try to initialize a triangulation which is already initialized; -in general, the library will warn you about almost all errors you do, -since in the debug version there are very many checks. -
- -
-A hypercube can be created using the function
-void GridGenerator::hyper_cube(Triangulation<dim> &tria,const double left=0.,const double right=1.)
-The cube created is the tensor product of the left and right edges which
-default to 0 and 1, creating the unit hypercube. The hypercube will consist of
-exactly one cell. In two dimensions, this amounts to a unit square, in
-three, to a unit cube. In one dimension, you simply get a line.
-
- - | -
-Example - create the square [-1,-1]x[-1,1]: Below we show the includes, -definitions and -function calls needed. Be sure to use them in their appropriate places. -
-
-
-#include <grid/tria.h>
-#include <grid/grid_generator.h>
-
-const unsigned int dim=2; // Two dimensions; to create a cube set to dim=3
-Triangulation<dim> triangulation;
-
-GridGenerator::hyper_cube (triangulation, -1, 1);
-
-
-
-
-
-A hyperball can be created using the function
-void GridGenerator::hyper_ball(Triangulation<dim> &tria,const Point<dim> center=0.,const double radius=1.)
-This will create a hyperball of given centre and radius where the
-location of the centre defaults to the origin and the radius to
-unity. Note that the left figure is scaled a bit large, since the
-corner points of the outer square will later be the points on the
-circles surface in diagonal directions.
-
- - | -
-Example: Below we show the includes, -definitions and -function calls needed. Be sure to use them in their appropriate places. -This example will create a hyperball with unit radius centred on (1,0). -
-
-
-#include <grid/tria.h>
-#include <grid/grid_generator.h>
-#include <base/point.h>
-
-const unsigned int dim=2; // For example
-Triangulation<dim> triangulation;
-Point<dim> centre(1,0); // Taking (1,0) as the centre of the ball
-
-GridGenerator::hyper_ball (triangulation, centre, 1);
-
-
-
-
-As can be seen above, the unrefined ball (or circle) does not look
-very much like a ball (or circle). After several refinement
-steps, it looks much better, though. However, along the rays pointing
-outward in the initial grid, the cells ar distorted even in the fine
-grid and if you want to do high-accuracy computations on circles, you
-may want to use a better coarse grid than the one on the left.
-
-
-
-A hyper-L can be created using the function
-void GridGenerator::hyper_L(Triangulation<dim> &tria,const double left=-1.,const double right=1.)
-This will create a hyper-L consisting of 2dimension-1 cells.
-The hyper-L is created from the hypercube [left,right]dimension by taking
-away the hypercube [left+right/2,right]dimension.
-
-Use of the hyper-L:
-The hyper-L is mainly of use in testing grid refinement, error estimates etc.
-Boundary conditions of the form u=g
on the faces of the original
-hypercube and ∂nu=0
on the "inner" faces resulting
-from the smaller hypercube taken away are chosen, this will usually lead to
-a singular solution because of the reentrant corner; these singularities
-can be used to test the efficiency of error estimators.
-
- - | -
-Example: Below we show the includes, -definitions and -function calls needed. Be sure to use them in their appropriate places. -This example will create the default hyper-L. -
-
-
-#include <grid/tria.h>
-#include <grid/grid_generator.h>
-
-const unsigned int dim=2; // For example
-Triangulation<dim> triangulation;
-
-GridGenerator::hyper_L (triangulation, -1, 1);
-
-
-
-
-In many problems taken from real life you will find those grid types
-insufficient and you will need to create your own grid.
-This is possible: deal.II offers the possibility of
-reading a complete triangulation from a file in the ucd-format
-used by avs. A ucd-file can be read with the function
-void GridIn::read_ucd(istream&)
-
-Since the creation of input grids is probably not something you need to do on a
-daily basis, we will only very briefly describe the format of the
-input file. More information can be found in the documentation of the
-GridIn
class.
-
-Vertex numbering in input files:
-The vertex numbering must start at the vertex with the lowest number for lines
-and be counterclockwise for quads. Also, faces between adjacent cells
-must face in the same direction. This must be ensured by you, or by the
-grid construction algorithm. Otherwise some of your matrix elements
-may have the wrong sign (plus instead of minus or vice versa).
-A more detailed description of the problems
-encountered in two dimensions can be found in the
- GridIn
class description.
-
-Another way to build cutom grids is to use deal.II methods -for creating grid cells and their properties. This is done in the order -
GridGenerator
class use to produce the grids we have
-shown above.
-
--Example: Below we show the includes, -definitions and -function calls needed. Be sure to use them in their appropriate places. -This example will create a triangulation as shown in this figure. It will -work only in two dimensions. It creates three rectangular cells, the leftmost -boundary is a Neumann-boundary. -
-
-
-// First, create an array holding the (2-dimensional) vertices
-const Point<2> vertices[8] = { Point<2> (0,0),
- Point<2> (1,0),
- Point<2> (1,1),
- Point<2> (0,1),
- Point<2> (2,0),
- Point<2> (2,1),
- Point<2> (3,0),
- Point<2> (3,1) };
-
-// Next, create a two-dimensional array holding the information
-// on what cell consists of which vertices
-const int cell_vertices[3][4] = {{0, 1, 2, 3},
- {1, 4, 5, 2},
- {4, 6, 7, 5}};
-
-// Next, create a vector of type CellData<2> that holds the
-// cells
-vector<CellData<2> > cells (3, CellData<2>());
-
-// The information on the cells is copied into this vector and the
-// material is set to 0. This index can be used to distinguish cells
-// of different types.
-for (unsigned int i=0; i<3; ++i)
- {
- for (unsigned int j=0; j<4; ++j)
- cells[i].vertices[j] = cell_vertices[i][j];
- cells[i].material_id = 0;
- };
-
-// The Neumann boundary is set below:
-// Boundaries are parts of cells, therefore the class is called SubCellData
-// to distinguish them from cell data like vertices and material.
-SubCellData boundary_info;
-
-// We want to describe a line in 2d, which would be a cell in 1d,
-// which is why we can use the object for a 1d cell
-// (CellData<1>) for its description:
-boundary_info.boundary_lines.push_back (CellData<1>());
-
-// The boundary gets a material id of 1. The boundary id of lines in 2d
-// will be interpreted as the boundary id
-boundary_info.boundary_lines[0].material_id = 1;
-
-// The boundary is between vertices number 0 and 3
-boundary_info.boundary_lines[0].vertices[0] = 0;
-boundary_info.boundary_lines[0].vertices[1] = 3;
-
-// From this information the triangulation is created
-coarse_grid->create_triangulation (vector<Point<2> >(&vertices[0],
- &vertices[8]),
- cells, boundary_info);
-
-
-
-
-- Next chapter: Degrees of Freedom - | -- Back to this chapter's index - | -- Back to the tutorial index - | -
- -
- - - diff --git a/deal.II/doc/tutorial/chapter-1.elements/hanging_nodes.html b/deal.II/doc/tutorial/chapter-1.elements/hanging_nodes.html deleted file mode 100644 index 74e8173dd6..0000000000 --- a/deal.II/doc/tutorial/chapter-1.elements/hanging_nodes.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - --You get hanging nodes after some refinements. Hanging nodes are those that -are situated on the boundary of a larger active cell. The global function -is assumed -to be linear on the boundary of each active cell, therefore the value -of the hanging node must be adjusted accordingly. Newly created nodes that -are not situated on boundaries of larger active cells are not subject to this -constraint because there is no reason to assume that the global function -is linear on the boundary of a parent cell. -Hanging nodes -and the constraints they are subject to need to be -taken into account when generating your matrix structure. -This is further discussed in the chapters on -matrix structure and -condensing the hanging nodes. -
- -- - | -
-In order to get constraints for your hanging nodes you have to assume
-some function on the boundaries of your cells, as mentioned above.
-Take a linear function on the cell boundary between vertices 1 and 2
-with function values x1
and x2
. If you get
-a hanging node on this boundary during refinement it will be situated
-in the middle and therefore its value - the value of the function on
-the boundary at this point - will be x3 = 1/2 (x1+x2)
.
-The value x3
is therefore not a free degree of freedom,
-but it is bound by this constraining equation and we will have to take
-this into account.
-
-Assume a system Au=f
with u
being the solution
-vector with all the degrees of freedom of the finite elements, in particular
-base functions associated with hanging nodes, which are not true degrees of
-freedom of the system of equations.
-
-The constraint for hanging nodes now is that we must be able to calculate
-their value from the values of the surrounding nodes by interpolation.
-Let y
be a vector with entries corresponding to true degrees of
-freedom only. We must be able to write u
as
-u=Cy
-where C
, the constraint matrix is a square matrix containing the
-interpolation.
-
-Now we have to solve -
--- -- Au = f -
-with the constraint, that there is ay
satisfying -- u = Cy -
-From this we get -- CTACy = CTf -
-or, taking -- ~A := CTAC, b := CTf - ~A y = b. -
-
-It is not possible to generate ~A
directly, but
-we can generate A
and condense it to ~A
-using the constraints, solve the system and obtain u
by
-u=Cy
.
-
- Next Chapter: Matrix Structure - | -- Back to this chapter's index - | -- Back to the tutorial index - | -
- -
- - diff --git a/deal.II/doc/tutorial/chapter-1.elements/index.html b/deal.II/doc/tutorial/chapter-1.elements/index.html deleted file mode 100644 index 9cb4311b88..0000000000 --- a/deal.II/doc/tutorial/chapter-1.elements/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - --There are several kinds of matrices which we will deal with: -
-
-The full matrix is useful is we can assume that the we have mostly
-entries of non-zero value. Since we then store all entries, it
-consumes a lot of memory, much more than the other matrix types. It
-is initialized using FullMatrix::reinit(const unsigned int rows,
-const unsigned int cols)
.
-
-Example: We show the include files you need, -the definitions and the function calls. Make sure to use them in their -appropriate places. This example initializes two full matrices of doubles -with 100 rows and 50 columns in two different ways. -
-
-
-#include <dofs/dof_handler.h>
-#include <lac/full_matrix.h>
-
-FullMatrix<double> A;
-
-A.reinit(100,50);
-
-// or, alternatively (important for const objects):
-
-FullMatrix<double> B(100,50);
-
-
-
-
-
--A sparse matrix is a matrix with mostly zero elements. In other words, -it is possible to store this matrix efficiently, which can be important -for large systems of equations. Before generating a sparse matrix you -will have to generate a -sparse matrix structure -to initialize the sparse matrix with. This is simply due to the fact that -before you can generate a memory-efficient matrix for your special -problem you need information about the matrix structure, i.e. where -the matrix has non-zero entries. -
- - --Example: We show the include files you need, -the definitions and the function calls. Make sure to use them in their -appropriate places. This example initializes a sparse square matrix structure. -
-
-
-#include <dofs/dof_handler.h>
-#include <lac/sparse_matrix.h>
-
-
-const unsigned int dim=2; // For example
-SparsityPattern sparsity_pattern;
-SparseMatrix<double> sparse_matrix;
-DoFHandler<dim> dof_handler;
-
-// Your degrees of freedom must already be distributed
-
-sparsity_pattern.reinit (dof_handler.n_dofs(),
- dof_handler.n_dofs(),
- dof_handler.max_couplings_between_dofs());
-
-// If your grid is locally refined, condense the hanging nodes into the
-// structure.
-
-sparsity_pattern.compress();
-
-// initialize the actual matrix with the sparsity pattern
-sparse_matrix.reinit (sparsity_pattern);
-
-
-
-
-
-Vector operations are supplied by the class Vector
.
-The first and most important operation on a vector is its
-initialization using void Vector::reinit(const usigned int N,
-const bool fast=false)
, which resets the vector's size to
-N
and sets all elements to zero. If the second parameter
-fast
is set true, this means that the entries will not be
-cleared; this is useful if the vector is being assigned to immediately
-after, in which case an initialization with zeroes would be
-redundant. Note that this mode of use is rather uncommon and mostly
-only useful inside linear solvers where it is important to save as
-much computing time as possible.
-
-In addition to standard vector operations such as addition, multiplication with -a vector etc. deal.II provides several vector norms, too: -
- -Number Vector::l1_norm() const
Number Vector::l2_norm() const
Number Vector::infty_norm() const
-Example:Continuing the above example,
-we initialize the vector for the right hand side. Recall that the problem
-matrix is a sparse square matrix of size
-dof.n_dofs()2
.
-
-
-#include <lac/vector.h>
-
-Vector<double> f;
-
-f.reinit(dof.n_dofs());
-
-
-
-
-reinit
functions of
-all vector and matrix classes are implemented in a way to only allow
-the allocated memory to grow, since this reduces the number of times
-allocation and de-allocation has to happen, and in addition reduces
-memory fragmentation.
-
--One immediate consequence is that if you write -
-
-Vector<double> f;
-f.reinit(100);
-f.reinit(50);
-
-
-then the second reinit
will only have the effect of
-reducing the internal size of the vector, but the memory that is no
-more needed will not be released. Likewise, if you later write
-
-
-f.reinit(100);
-
-
-this will again only set the size of the vector to a different value,
-but since enough memory is still allocated, no re-allocation has to
-happen. Only if the required number of entries exceeds the memory
-already allocated, will there be a re-allocation.
-
-
-All matrix and vector classes in deal.II work this
-way, and in fact this is also the way the standard C++ container
-classes like vector
or map
work.
-However, this is not very useful if you use vectors or matrices
-as member variables, since at times they may not be used at all if
-your program works on other objects or you are in other parts of the
-object. You would then like to let the vectors and matrices sleep with
-no memory presently lying around unused. For this purpose, all
-matrices and vectors support a mode of their reinit
-function which frees all memory that is presently allocated: just call
-it with parameters such that the new size is zero. For example, the
-following lines will release all memory from their objects:
-
-
-f.reinit(0);
-full_matrix.reinit(0,0);
-sparse_matrix_struct.reinit (0,0);
-sparse_matrix.reinit (sparse_matrix_struct);
-
-
-Note that in the last line, you have to pass an empty sparsity pattern
-to the sparse matrix to tell it to release all of its memory.
-
-
-clear
function. These, however, work differently than
-might be expected from the analogous functions in the C++ standard
-library. There, clear
removes all data from the objects
-and resets it into a virgin state. In deal.II,
-clear
only resets the values of a metrix or vector to
-zero, but does not change the size and does no re-allocation
-either. This unfortunate name clash is due to historical reasons.
-
-
-- Next Chapter: Problem Matrix and RHS - | -- Back to this chapter's index - | -- Back to the tutorial index - | -
- -
- - diff --git a/deal.II/doc/tutorial/chapter-1.elements/matrix_structure.html b/deal.II/doc/tutorial/chapter-1.elements/matrix_structure.html deleted file mode 100644 index f0b7cddcfb..0000000000 --- a/deal.II/doc/tutorial/chapter-1.elements/matrix_structure.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - --Many of the matrices encountered when trying to solve systems of differential -equations consist mostly of zero entries. At the same time those matrices are -very large, and therefore storage is expensive in terms of memory. -deal.II attempts to resolve this problem by -providing means of generating memory efficient structures for sparse -matrices where only non-zero elements are stored. -
--To show only two example of matrices which are quite typical of finite -element discretizations of partial differential equations, we present -the following two graphics, in which each dot represents a non-zero -entry of the matrix: -
-- - -
--The first is a 300x300 matrix, the second has approximately 4000 rows -and columns. As can be seen, the vast majority of entries is zero, and -we can also guess that the proportion of zeroes is even growing as the -matrix size is increased (this is in fact so, but can not so clearly -be seen from the pictures, admittedly). The equation discretized to -yield these matrices is rather complex, so the number of non-zero -entries per row is quite large for finite element matrices. -Both matrices were derived after renumbering of the degrees of freedom -using the algorithm of Cuthill-McKee, which concentrates the entries -around the diagonal of the matrix. - - -
-Before you can build the appropriate matrices for your problem you -need to ascertain where the components of your matrix are non-zero -and generate a structure for storing the matrix accordingly. -This structure -is then used to actually initialize the matrix, i.e. -tell the matrix for which elements to allocate memory. -
- -
-The deal.II function initializing a standard sparse matrix
-structure is void SparsityPattern::reinit(const unsigned int m, const unsigned int n, const unsigned int max_per_row)
. It takes as its arguments
-the size of the matrix in question and the maximum number of non-zero elements
-in one row. This first sets up a blank sparsity pattern which,
-however, has as yet no information which entries are non-zero.
-
-Before going on with showing how to find out which elements are
-non-zero, we have to talk about how to find out about the maximum
-number of non-zero entries per row which we will need for our matrix.
-Since this number depends of the actual finite element used (higher
-order elements need more non-zero entries than linear elements, for
-example), of the equation under consideration, and of some properties
-of the triangulation on which we want to do our computations. Since
-all these factors can't be considered by the user all the time, there
-is a library function which does the necessary computations for you:
-unsigned int DoFHandler::max_couplings_between_dofs()
.
-We note that this function was written to cope with refined grids, and
-if you only have structured grids without local refinement and hanging
-nodes, the result of this function will overestimate the maximal
-number of non-zero entries per row.
-
-After having fixed the basic properties of the sparsity structure, we
-can tell it which entries actually are non-zero. This is again done
-using a library function,
-DoFTools::make_sparsity_pattern
. Then we have to take
-into account that constraints due to hanging nodes (see the previous
-chapter) add some more non-zero entries, which is again done using
-some library functions (see the example below). After this, we can
-instruct the sparsity pattern to throw out all unused elements
-(in those rows where the actual number of non-zero elements is less
-than the maximal number given to reinit
, we can discard
-the unused one to save some more memory). This is discussed in the
-next subsection.
-
-This matrix structure can then be used to serve as sparsity pattern to
-one or several matrices using
-void SparseMatrix::reinit(const SparsityPattern &sparsity)
.
-We note the distinction that the SparsityPattern
only
-stores the places of the non-zero elements, while the
-SparseMatrix
actually stores the values of these
-elements. The separation was made since often several matrices are
-needed with the same sparsity pattern, but different entry values;
-this way, we can save some memory space.
-
-Example: We show the include files you need, -the definitions and the function calls. Make sure to use them in their -appropriate places. This example initializes a sparse square matrix structure. -
-
-
-#include <dofs/dof_handler.h>
-#include <lac/sparse_matrix.h>
-#include <dofs/dof_tools.h>
-
-
-const unsigned int dim=2; // For example
-SparsityPattern sparsity_pattern;
-DoFHandler<dim> dof_handler;
-
-// set up a triangulation, refine it, associate the DoFHandler object
-// shown above to it, and distribute the degrees of freedom
-...
-
-// now fix the size of the matrix and the maximal number
-// of non-zero entries:
-sparsity_pattern.reinit (dof_handler.n_dofs(),
- dof_handler.n_dofs(),
- dof_handler.max_couplings_between_dofs());
-
-// tell the sparsity pattern which entries are non-zero:
-make_sparsity_pattern (dof_handler, sparsity_pattern);
-
-// Condense the hanging nodes into
-// the matrix structure, taking into account the constraints due to
-// the hanging nodes.
-// You can skip this part if your grid is not locally refined.
-ConstraintMatrix hanging_nodes;
-dof_handler.make_constraint_matrix(hanging_nodes);
-hanging_nodes.condense (sparsity_pattern);
-
-
-
-
-Sparse matrix structures can (and indeed must) be compressed before they are used
-in objects of the class SparseMatrix<>
that actually hold the matrix
-data. The reason for this is the way matrix structures and matrices are generated:
-
void SparsityPattern::compress()
.
-
-
-
-Example: Starting from the example above, we
-compress our matrix structure sparsity_pattern
.
-
-
-sparsity_pattern.compress();
-
-
-
-
-DoFTools::make_sparsity_pattern
and
-SparsityPattern::reinit
functions, which allow you to
-more flexibly determine the actual number of non-zero elements of all
-or individual rows. See the documentation of the respective classes
-for more information.
-
-
-
-- Next Chapter: Matrix and Vector Generation - | -- Back to this chapter's index - | -- Back to the tutorial index - | -
- -
- - - diff --git a/deal.II/doc/tutorial/chapter-1.elements/navbar.html b/deal.II/doc/tutorial/chapter-1.elements/navbar.html deleted file mode 100644 index 3fee673561..0000000000 --- a/deal.II/doc/tutorial/chapter-1.elements/navbar.html +++ /dev/null @@ -1,123 +0,0 @@ - - - --Table of contents -
-- Hanging Nodes -
-- Matrix Structure -
-- Postprocessing -
-- Parameter Input -
-- Back to the tutorial index -
- -- Back to the deal.II homepage -
- - -
-Grid and data output becomes a difficult thing as soon as flexibility
-in terms of different output formats and which parts of the data
-are actually written is required.
-Consequently, there is a bunch of classes in deal.II,
-every one dealing with a different aspect of the problem. You, the
-user, however, need to concern yourself only with two ouput classes:
-GridOut
and DataOut
handling the output of
-grid and data, respectively. In addition there is one class for
-each kind of output storing the parameters for this particular
-format. These parameters are common to both grid and data ouput
-and are used by both GridOut
and DataOut
.
-
-Since deal.II is fairly versatile when it comes -to graphics output we shall have to talk about the following topics -in depth: -
- -GridOut
and DataOut
- GridOut
and DataOut
- DataOut
- GridOut
-
-deal.II provides a class called DataOut
-dealing with the output of simulation data and a class called
-GridOut
handling the output of grid (triangulation) data.
-Both are fairly versatile and can handle a
-number of different data formats.
-
DataOut
graphics formats
-The graphics formats available in DataOut
are:
-
GridOut
graphics formats
-The graphics formats available in GridOut
are:
-
For each output format there is a class containing the -parameters that determine how the output will look. All these classes -have a sensible set of default parameters; you will only have -to bother about setting parameters yourself if your desires are -rather special. We shall commence with a brief description of -these classes and the most important parameters you can set. It is -also worthwhile to look at the online documentation to see whether -additional flags have been introduced in the meantime. -
- - --This class provides the settings for ucd output. The values in brackets -denote the default values. -
-bool write_preamble
(true):
- Determines whether to write a preamble containing creation
- date etc.
- -This class provides the settings for gnuplot output. At present it -is empty. -
- --This class provides the settings for EPS output. The values in brackets -denote the default values. -
- -unsigned int height_vector
(0):
- Number of the data vector to be used for generation of the height
- information. The number is determined by the order in which
- DataOut<dim>::add_data_vector
was called
- for the different vectors.
- unsigned int color_vector
(0):
- Number of the data vector to be used for colorizing cells.
- The number is determined by the order in which
- DataOut<dim>::add_data_vector
was called
- for the different vectors.
- SizeType sizetype
(width):
- Determines whether the width or the height is used to scale
- the output. Can be set to width or height.
- unsigned int size
(300):
- Size of the output in points. One point is 1/72 inch.
- double line_width
(0.5):
- Width of a line in points. One point is 1/72 inch.
- double azimut_angle
(60):
- Viewing angle with respect to the positive z-axis.
- double turn_angle
(30):
- We quote the class documentation:
- Angle by which the viewers position projected onto the
- x-y-plane is rotated around the z-axis, in positive sense when
- viewed from above. The unit are degrees, and zero
- equals a position above or below the negative y-axis.
-
- double z_scaling
(1):
- Factor by which the z-axis is stretched compared to the
- x- and y-axis.
- bool draw_mesh
(true):
- Determines whether the cell boundaries are drawn.
- bool draw_cells
(true): Determines whether the
- cells are drawn. If this flag is true and
- shade_cells
is false the cells are filled with white.
- bool shade_cells
(true):
- Determines whether to colour cells.
- ColorFunction color_function
(&default_color_function):
- Determines the function to use for colouring the cells. The default
- shifts the colours from black for the lowest values through the
- spectrum towards white.
- -This class provides the settings for PoVRay output. There are several -flags implemented presently, but we advise you to consult the online -documentation since they are rather special and you will probably have -to set them anyway, if you want high-quality output. -
- --This class provides the settings for General Mesh Viewer output. At present it -is empty. -
- - -DataOut
-What exactly it is you need to do in order to make use of the
-DataOut
-class is described in the table below. Note that data is written to an
-ostream
. That means you have to attach your ostream
-to a file if you want to use the data later on.
-
Step - | -What to do - | -Function call - | -
1. | -Use the correct include-file. - | -#include <numerics/data_out.h>
- |
-
2. | -Create an object of this class with the right dimension. - It takes no initialization parameters. - | -DataOut<dim> my_data_out;
- |
-
3. - | -Attach a DoFHandler
- object to your DataOut
- object. This DoFHandler
- is used to extract geometry
- data and the mapping between nodes and node values.
- |
-
- void DataOut<dim>::attach_dof_handler(const DoFHandler<dim> &)
-
- |
-
4. - | -Add data vectors to be written to a file. The second and third argument - are the name of the vector and its physical units. - | -
- void DataOut<dim>::add_data_vector(const Vector<double> &data,
- const string &name, const string &
- units="<dimensionless>")
-
- |
-
5. - | -Generate an ostream (and, normally, attach it to a file).
- |
-
- ofstream out("filename");
-
- |
-
6. - | -Write your data to this ofstream. The second parameter denotes the
- output format to be used. It must be one of { ucd, gnuplot,
- gnuplot_draft,
- povray_mesh, eps, gmv } .
- |
- void DataOut<dim>::write(ostream &out, const OutputFormat output_format)
- |
-
DataOut
data formats-The ucd data format is described in the AVS developer's guide. There -are a binary and a ASCII version of this format. deal.II -uses the ASCII ucd format. -
- --Only node based data can be written, higher order elements are written -with their node values, not with interior or line values. This is -due to limitations in the present format. In this implementation -it is not possible to give model data since this is not widely supported. -It is possible to give cell data. -
- -
-In order to write your data in ucd format you need to follow the
-steps described in the section on the usage of
-DataOut
.
-The data is written using void write(ostream &out,"ucd")
.
-
-The gnuplot data format is a pure ASCII format where each line is
-of the form
-x v1 v2 ...
-for one-dimensional data and
-x y v1 v2 ...
-for two-dimensional data.
-x
and y
denote the grid coordinates,
-vi
denote the vertex values.
-
-A somewhat more elaborate description can be found in the -Gnuplot User's Guide (Postscript) -
- -
-In order to view a one-dimensional plot you use
-
-plot "filename" using 1:x
-where x
denotes the number of the vertex you wish to plot.
-
-In order to view your grid in two dimensions you should use
-
-set data style lines
-and to finally see your results
-plot "filename"
-
-
-set data style lines
-plot "filename" using 1:2:x
-
-where again x
denotes the number of the vertex
-to be plotted.
-
The limitations of the gnuplot data format have been well described
-in the
-
-DataOutBase
class description:
-
-- --This format is somewhat restricted to coninuous data and to finite -elements of first order only. The reason for the first restriction is -that it takes nodal values and can therefore only work if a finite -element has degrees of freedom in the vertices of each cell. This is -not the case for discontinuous elements. The second restriction is -only a problem of quality of output: you actually can print quadratic -or higher order elements using this style, but you will only see the -contour of each cell with the bounding lines of each cell being -straight lines. You won't see the structure of the solution in the -interior of a cell nor on the lines bounding it. -
-
The limitations mentioned above can to some extent be remedied,
-and that is why there is also an option for high quality output.
-For how this is done, we quote (again) the
-
-DataOutBase
class description:
-
-- - --To remedy the abovementioned problems, the gnuplot "quality" format -was introduced. [...] gnuplot can handle tensor grids and -displays them quite nicely, -including hidden line removal. It can also handle more than one tensor grid, -then called a patch. The idea now is to describe each cell as a patch of -
-N x N
points (in 2D). -For linear elements,2 x 2
is sufficient, but for elements -of higher order you will want to use a higher number. The -write_gnuplot
-function writes the data in this format and -the argument it takes is the number of subintervals it divides each cell into, - i.e.N-1
. --This output routine also addresses the problem introduced with discontinuous -elements, since it takes its data locally from each cell and displays it as a -patch separately; it -therefore does not use continuity and gnuplot will also plot discontinuities -if there are any. -
-
-In order to write your data in gnuplot format you need to follow the
-steps described in the section on the usage of
-DataOut
.
-The data is written using
-
void write(ostream &out,"gnuplot_draft")
for the lower
- (draft) quality output.
-void write(ostream &out,"gnuplot")
for the high quality
- output.
-EPS output of deal.II data consists of the grid -and the cells. The cells can be left empty, printed white (which leads -to hidden-line removal) or colorized using a data vector. This format -does not support gradient shading, i.e. each cell has one color which -is taken from the value of the data in its centre. Coordinates -have at most five digits, and the EPS files do not have an explicit -bounding box, i.e. the bonding box is close to the graphics on -all four sides. EPS output can only be used for two-dimensional -data. -
- -EPS otput is performed by calling
-void DataOut<dim>::write_eps(ostream &out)
-
-PoVRay is a most comprehensive raytracer freely available at -http://www.povray.org. -This is also the place to start looking for more information -on its features. -
- -PoVRay output is accomplished by calling
-DataOut<dim>::write_povray(ostream &out)
-At present there is no more information available on PoVRay output
-in deal.II.
-
-The General Mesh Viewer can display data in both 2D, 3D and cuts through -data sets. More information on the gmv is available at - -http://www-xdiv.lanl.gov/XCM/gmv/GMVHome.html -At present the gmv cannot output postscript or EPS data. -
- -
-gmv output is accomplished by calling
-void DataOut<dim>::write_gmv(ostream &out)
-There is no more information available on the output format.
-
GridOut
-What exactly it is you need to do in order to make use of the
-GridOut
-class is described in the table below. Note that data is written to an
-ostream
. That means you have to attach your ostream
-to a file if you want to use the data later on.
-
-There are essentially two ways to use GridOut
: If you don't need
-to change any of the default parameters (which will be explained along with
-the graphics formats) you can use the class almost as if its methods
-were static. There is no need to create a GridOut
object
-in advance.
-
-The second method requires the creation of a GridOut
object
-to which parameters can be passed.
-
Step - | -What to do - | -Function call - | -
1. | -Use the correct include-file. - | -#include <grid/grid_out.h>
- |
-
2. - | -Generate an ostream (and, normally, attach it to a file).
- |
-
- ofstream out("filename");
-
- |
-
3. - | -Write your data to the ofstream by calling the appropriate
- write method giving your triangulation object and
- the output file type as parameters. output_format
- is one of {ucd,gnuplot, eps}.
- |
- void GridOut().write(const Triangulation<dim> & tria,ostream &out, const OutputFormat output_format) - |
-
Step - | -What to do - | -Function call - | -
1. | -Use the correct include-files. - | -#include <grid/grid_out.h> - #include <numerics/data_out_base.h>
- |
-
2. - | -Generate an ostream (and, normally, attach it to a file).
- |
-
- ofstream out("filename");
-
- |
-
3. - | -Generate a GridOut<dim> object.
- |
- GridOut<dim> my_grid_out; - |
-
4. - | -Set your parameters (in this example for ucd). - | -UcdFlags ucd_flags;
- |
-
5. - | -Write your data to the ostream by calling the appropriate
- write method giving your triangulation object and
- the output file type as parameters. output_format
- is one of {ucd,gnuplot, eps}.
- |
- void my_grid_out.write(const Triangulation<dim> & tria,ostream &out, const OutputFormat output_format) - |
-
GridOut
data formats-The ucd data format is described in the AVS developer's guide. There -are a binary and a ASCII version of this format. deal.II -uses the ASCII ucd format. -
- -
-The ucd data format is special because it can not only be written but
-also read by deal.II. I.e. you can use a triangulation
-written to a ucd-file as a starting triangulation for
-deal.II. In order to be able to reuse your triangulation
-you will need to explicitly write all of your boundary indicators that
-are not zero to the output file. Otherwise, upon reloading the triangulation,
-all your boundaries will be labelled with the default value, zero.
-There is a flag in the class UcdFlags
-controlling GridOut
with respect to whether
-boundary indicators are explicitly written:
-bool UcdFlags::write_preamble
. It defaults to true, i.e.
-boundary indicators are written by default and you can use the first,
-simpler method for writing ucd-files.
-
-Gnuplot output is performed by calling
-void write_gnuplot (const Triangulation<dim> &tria,
-ostream &out)
-It is controlled by the class GnuplotFlags
.
-
-In Gnuplot format the boundaries of each cell -are written as a sequence of lines to your output stream. -Output can be modified by the following flags: -
-GnuplotFlags::write_cell_numbers
:
- If this is set the (internal) number of each cell is written to the
- output file before the cell data.
- GnuplotFlags::write_level
: If this flag
- is set the refinement level of each cell is written as an
- additional column. This can be used to raise the cells according
- to their refinement level if a 2D-grid is plotted as 3D, or,
- alternatively, to plot only the cells within a given range of
- levels of refinement usingsplot [:][:][level1:level2] "filename"
- -Contrary to, e.g., EPS, you do not need to set a viewpoint. -
- -
-EPS output is performed using the parameters set forth in the class
-EpsFlags
. Grid output in the EPS format is always
-two-dimensional; 3D-grids are viewed from a given viewpoint
-without hidden-line removal.
-EPS output is performed by calling
-GridOut::write_eps (Triangulation& tria, ostream& output)
-
-Alternatively, you can use the general GridOut::write
method
-as explained in the part on the usage of the
-GridOut
class.
-
- Back to this chapter's index - | -- Back to the tutorial index - | -
- -
- - diff --git a/deal.II/doc/tutorial/chapter-1.elements/parameters.html b/deal.II/doc/tutorial/chapter-1.elements/parameters.html deleted file mode 100644 index 8c16cf94e7..0000000000 --- a/deal.II/doc/tutorial/chapter-1.elements/parameters.html +++ /dev/null @@ -1,381 +0,0 @@ - - - - - -
-When writing a numerical program you will usually wish to keep it flexible
-with regard to parameter settings and the like. Rewriting a program
-every time a parameter changes is ever so annoying.
-For this reason deal.II provides a class
-called ParameterHandler
. This class enables you to easily
-parse a parameter file and extract the values of the parameters.
-The names and allowed values of the parameters can be defined by you.
-
-The most simple way to using runtime parameters in your program is the following: -
- -Step - | -What to do - | -Function call - | -
1. | -Use the correct include-file. - | -#include <base/parameter_handler.h>
- |
-
2. | -Declare a parameter handler object. - | -ParameterHandler prm;
- |
-
3. | -Tell the parameter handler about the parameters, their types and their - default values. Here we get one parameter called - "My favourite booze", its default value is - "Stout" and we allow anything as its value. Note that - the parameter name may contain whitespace. - | -prm.declare_entry("My favourite booze",
- "Stout",Patterns::Anything());
-
- |
-
4. | -Generate a parameter file. Following the example above, we - set "My favourite booze" to "Ale". This - file will be called "parameters.in". - | -set My favourite booze = Ale
- |
-
5. | -Read the parameters from the file. - | -prm.read_input("parameters.in");
- |
-
6. | -Find the values of your parameters. - | -string booze = prm.get("My favourite booze");
- |
-
-The few steps outlined above are indeed the most simple case. What, now, if -you have a more complex set of parameters, grouped by purpose ? You could, -for example, wish to solve different equations and set parameters for each -of them. For this purpose you can introduce subsections into -your parameter set. -
- -
-Parameters declared in different subsections are distinct, although they
-may share the same name. Let us stay with the example of two equations
-for which you wish to set parameters: Zeldovich-equation
and
-Sunyaev-equation
. You want to be able to use different solvers,
-and thus both take a parameter called Solver
.
-The way to go is to declare two subsections called (preferably)
-Zeldovich-equation
and Sunyaev-equation
. Each of the two
-subsections contains a parameter called Solver
.
-
-Example:
-We declare subsections for two equations called
-Zeldovich-equation and Sunyaev-equation
-within a parameter handler.
-The allowed values for the parameter Solver
are
-CG
(default) and GMRES
. Afterwards
-we read the settings from a file called "parameters.in"
-and retrieve their values. The values are stored in the strings
-zeldovich_solver
and sunyaev_solver
.
-Please note that in order to stick to the essentials this example
-violates the
-
-recommended style for parameter declaration.
-
-
-// We declare a parameter handler
-
-ParameterHandler prm;
-
-// We declare the first subsection and its entry
-
-prm.enter_subsection("Zeldovich-equation")
-prm.declare_entry("Solver","CG",Patterns::Sequence("CG|GMRES"));
-prm.leave_subsection();
-
-// We declare the second subsection and its entry
-
-prm.enter_subsection("Sunyaev-equation")
-prm.declare_entry("Solver","CG",Patterns::Sequence("CG|GMRES"));
-prm.leave_subsection();
-
-// The input file is read
-
-prm.read_input("parameters.in"
-
-// We retrieve the parameters from the first subsection
-
-prm.enter_subsection("Zeldovich-equation")
-string zeldovich_solver = prm.get("Solver");
-prm.leave_subsection();
-
-// We retrieve the parameters from the second subsection
-
-prm.enter_subsection("Sunyaev-equation")
-string sunyaev_solver = prm.get("Solver");
-prm.leave_subsection();
-
-
-
-We continue this example with a sample parameter -file that tells the code to solve the Zeldovich equation using GMRES -and the Sunyaev equation using CG. -
- -
-
-subsection Zeldovich-equation
- set Solver = GMRES
-end
-
-subsection Sunyaev-equation
- set Solver = CG
-end
-
-
-
-
-There are, as we have seen, two methods within the
-ParameterHandler
class handling subsections:
-
-void ParameterHandler::enter_subsection(const string &subsection)
-
-and
-
-bool ParameterHandler::leave_subsection()
-
-Their names are telling. First you enter a subsection, then you declare
-(or retrieve)
-all the parameters for this subsection and finally you leave it.
-Subsections may be nested, i.e. you are at liberty to declare
-subsections within subsections within subsections...
-
-The parameter handler allows you to specify that any parameter
-be of a distinct type.
-Upon reading a file the value of this
-parameter is checked against the type and an exception is thrown
-if they do not match. An exception is also thrown if the default
-parameter does not match the specified type.
-Below we show a list of the types available. The first column
-gives an explanation, the second lists the corresponding C++ type
-and the third column shows how to use this type in deal.II.
-Parameter values may not contain linebreaks.
-deal.II always gets passed a pointer to a class
-handling that type. Those classes are defined in a structure
-called Patterns
. The include file to be used is the
-same as for the ParameterHandler
class.
-
Type - | -Correspondig C++ type - | -deal.II type - | -
Integer number. | -int
- |
- Patterns::Integer()
- |
-
Floating point number of double length. | -double
- |
- Patterns::Double()
- |
-
One member of a set. | -enum
- |
- Patterns::Sequence("element 1|element 2|...")
- |
-
An arbitrary string. | -string
- |
- Patterns::Anything()
- |
-
-Neither the names nor the values of entries may contain the
-following characters:
-\ { } |
-
-Besides, entries may not contain linebreaks, i.e. entries may not span -multiple lines. -
- --Leading and trailing whitespace is ignored and multiple whitespace is -condensed into one. Entry or subsection -declarations within your code should therefore -not contain multiple whitespace, which will not be recognized. -
- --You can obtain data from three different kinds of source: -
-istream
-It is possible to use different sources successively. Parameters -that are entered more than once will be overwritten, i.e. the -value encountered last of the parameter in question is used. -
- -
-Example:
-We read parameters successively
-from three different sources. This example was taken from
-the ParameterHandler
class documentation.
-
-
-ParameterHandler prm;
-...
-// declaration of entries
-...
-prm.read_input (cin); // read input from standard in,
-// or
-prm.read_input ("simulation.in");
-// or
-char *in = "set Time step size = 0.3 \n ...";
-prm.read_input (in);
-...
-
-
-
-
-You can, for example for logging purposes, write all the parameters
-your code knows about to an ostream
in a given format.
-The formats supported at present are text and LaTeX.
-The method handling this is called:
-
-ostream & ParameterHandler::print_parameters(ostream &out, const OutputStyle style)
-
-
-You can also write the parameters of a single subsection to an
-ostream
using
-
-void ParameterHandler::print_parameters_section (ostream &out,
- const OutputStyle style,
- const unsigned int indent_level);
-
-
-In both cases out
is the ostream
-the parameters are written to, style
is
-the output format, either
-text or LaTeX. In the case of subsections
-the indent_level
is the level of indentation.
-
- Back to this chapter's index - | -- Back to the tutorial index - | -
- -
- - diff --git a/deal.II/doc/tutorial/chapter-1.elements/postprocess.html b/deal.II/doc/tutorial/chapter-1.elements/postprocess.html deleted file mode 100644 index 9d9acd3565..0000000000 --- a/deal.II/doc/tutorial/chapter-1.elements/postprocess.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - --This section has unfortunately not yet been written. -
- - - -- Next Chapter: Error Estimation and Adaptivity - | -- Back to this chapter's index - | -- Back to the tutorial index - | -
- -
- - diff --git a/deal.II/doc/tutorial/chapter-1.elements/rhs.html b/deal.II/doc/tutorial/chapter-1.elements/rhs.html deleted file mode 100644 index ed8d86f1cf..0000000000 --- a/deal.II/doc/tutorial/chapter-1.elements/rhs.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - --Having talked a lot about the initialization of matrices and vectors -we shall now discuss how to fill them. You have to: -
--
- -
-Example: The two lines below calculate
-trial functions for the two-dimensional finite element fe
-and for its faces using Gaussian quadrature. The first line
-initializes an object for the trial and test functions of the
-finite element associated with the degree of freedom handler
-dof_handler
, telling it to update the values of the gradients and
-of the Jacobi determinant multiplied by a weight function given by the
-quadrature quadrature
whenever fe_values.reinit(fe)
-is called on a cell. The second line does the same for the faces of the finite
-element, telling it to update the JxW
values and the
-quadrature points.
-
-
-// Initialize the trial functions on the cell faces.
-FEValues<2> fe_values(fe, quadrature,
- UpdateFlags(update_values |
- update_gradients |
- update_JxW_values));
-FEFaceValues<2> fe_face_values (fe, face_quadrature,
- UpdateFlags(update_values |
- update_JxW_values |
- update_q_points));
-
-
-
--Integration of a problem is performed locally, i.e. you have to traverse all -the cells and integrate the problem on the cell. This implies that you need a local -matrix to store your results. This local matrix must then be inserted -into the global problem matrix. -
- --Example: Integration of the two-dimensional Laplace-problem: -Integration is done locally. Therefore we need appropriate definitions for -
-
-
- vector<int> dof_indices (fe.dofs_per_cell);
- Vector<double> element_vector (fe.dofs_per_cell);
-
- FullMatrix<double> element_matrix (fe.dofs_per_cell, fe.dofs_per_cell);
-
-
-
--Next we traverse all the cells and integrate the Laplace problem using the -discretized Laplace operator. quadrature is some quadrature -rule, for example a Gaussian rule. -
- -
-Within the loop over all cells, the outer loop traverses all the
-points of the quadrature quadrature
. The inner two loops
-traverse the degrees of freedom of the finite element fe
-where du
and dv
are the gradients of the
-trial and test functions at the present quadrature points.
-fe_values.JxW(k)
gives
-the Jacobi determinant multiplied by the weight of the quadrature
-point k
. Taken together the line
-
-element_matrix(i,j) += fevalues.JxW(k) * du * dv;
-
-
-gives the discretized Laplace operator.
-
-
-// Integrate the problem locally...
-vector<int> local_dof_indices (fe.dofs_per_cell);
-Vector<double> element_vector (fe.dofs_per_cell);
-FullMatrix<double> element_matrix (fe.dofs_per_cell);
-
- // traverse all cells
-for (DoFHandler<2>::active_cell_iterator cell = dof_handler.begin_active();
- cell != dof_handler.end(); ++cell)
-{
- // compute gradients and some other values
- // of the shape functions on this cell
- fe_values.reinit (cell);
- // set entries of local matrix and vector
- // to zero
- element_matrix.clear();
- element_vector.clear();
-
- // The loop over the quadrature points
- // starts here. In effect, the integration
- // is performed in this loop.
- for (unsigned q_point=0; q_point<quadrature.n_quadrature_points; ++q_point)
- for (unsigned i=0; i<fe.dofs_per_cell; ++i)
- {
- const Point<dim> dv = fe_values.shape_grad (i, q_point);
-
- for (unsigned j=0; j<fe.dofs_per_cell; ++j)
- {
- const Point<2> du = fe_values.shape_grad(j,q_point);
-
- // Perform the integration using
- // the weak form of the Laplace operator
- element_matrix(i,j) += fevalues.JxW(k) * du * dv;
- }
- }
-
- // get the global indices of the degrees
- // of freedom on the present cell
- cell->get_dof_indices (local_dof_indices);
- // and insert the local matrix
- // into the global one.
- for (unsigned i=0; i<fe.dofs_per_cell; ++i)
- for (unsigned j=0; j<fe.dofs_per_cell; ++j)
- A.add (local_indices[i], local_indices[j],
- element_matrix (i,j));
-}
-
-
-
-The right hand side vector is set up analogously, but obviously you
-only need one loop over the shape functions, since the right hand side
-is a linear form instead of a bilinear one.
-
-
-
-- Next Chapter: Boundary Conditions - | -- Back to this chapter's index - | -- Back to the tutorial index - | -
- -
- - - - diff --git a/deal.II/doc/tutorial/chapter-1.elements/solve.html b/deal.II/doc/tutorial/chapter-1.elements/solve.html deleted file mode 100644 index 369fcc3e63..0000000000 --- a/deal.II/doc/tutorial/chapter-1.elements/solve.html +++ /dev/null @@ -1,454 +0,0 @@ - - - - - --deal.II offers several solver classes: -
- -SolverBicgstab
, the Bicgstab algorithm
- by van der Worst
-SolverCG
, the preconditioned cg-algorithm
-SolverGMRES
, an implementation of the
- Restarted
- Preconditioned Direct Generalized Minimal Residual Method
-SolverRichardson
, the Richardson
- iteration method
--Besides the solver classes, there are several utility classes: -
SolverControl
to
-control the iterative solvers, i.e. to determine whether the iteration
-should be continued
-SolverSelector
, the use of which
-offers several advantages over solver selection by hand
-PreconditionSelector
that allows
-you to select a preconditioner
-
-All of the deal.II solvers have a structure
-AdditionalData
that is used to pass additional
-arguments to the solver. We discuss this structure only for those
-solvers that need it.
-
-Information on common solution methods can be found in any modern -textbook on finite elements, for example in Braess, Dietrich, Finite -Elements. The GMRES solver discussed below is rather -special, and if you are going to use it you probably know what -you are doing anyway. - -
-We will now begin with the discussion of the SolverControl
, the
-SolverSelector
-and the PreconditionSelector
classes, then discuss the solvers
-in more detail.
-
-The class SolverControl
is used by iterative solvers
-to determine whether to continue with the iteration. It takes two
-to three parameters: the maximum number of iterations and the criterium for
-abortion, usually the residual and a flag controlling whether to log the
-history (the value to be checked and the number of the iteration step).
-SolverControl
is initialized using
-SolverControl (const unsigned int n, const double tol, const bool log_history = false)
-
-
-Example:We initialize a solver control with -a maximum of 1000 iterations and a maximum residual of 1e-6. -
- -
-
-#include <lac/solver_control.h>
-
-SolverControl control(1000,1e-6);
-
-
-
-Thus, the iterative solver which with it shall be used will stop after
-either 1000 iterations are performed or the norm of the residual is
-below the given threshold.
-
-
-
-The SolverSelector
class is a wrapper for all the
-deal.II solver classes. By calling it with the
-right constructor you select your solver, and by calling its solve
-method you call the solve
method of the solver you selected.
-The advantage of this approach is that your solver is an argument
-to this class and - more important - an argument you can set in a
-parameter file. That means that if you want to change your solver, e.g.
-because a new one has been added you do not have to rewrite your program.
-
-The SolverSelector
is initialized using
-
-SolverSelector(const string solvername, SolverControl &control,
-VectorMemory<Vector> &mem)
-
-
-Example:We initialize a solver selector -that will call the cg-solver. The problem matrix is a sparse matrix of -doubles and the right hand side a vector of doubles. -
- -
-
-#include <lac/solver_control.h>
-#include <lac/solver_selector.h>
-#include <lac/sparse_matrix.h>
-#include <lac/vector.h>
-
-SolverControl control;
-VectorMemory<Vector<double> > mem;
-
-SolverSelector<SparseMatrix<double>, Vector<double> >
- solver_selector("cg", control, mem);
-
-
-
-
-
-Before firing up the solver of your choice you will need some kind of
-preconditioning. This is easiest selected by creating an instance of
-the PreconditionSelect
class with an appropriate choice of
-parameters. This can be done using PreconditionSelector(const string
-preconditioning, const typename Vector::value_type &omega=1.)
-where preconditioning
denotes the preconditioning method used
-and omega
is the damping parameter if the preconditioner
-you selected uses it.
-
-The preconditioning methods currently available using this class are -
-
-You can obtain a list of available methods by calling
-string PreconditionSelector::get_precondition_names()
.
-
-After having selected a preconditioner you will need to select a
-matrix used for preconditioning. Usually this will be the problem matrix
-A
of the problem Au=f
.
-The method to be called is void PreconditionSelector::use_matrix(const
-Matrix &M)
.
-
-Example:We initialize a Jacobi preconditioner
-with a damping parameter of 1. The matrix used for preconditioning
-is the matrix A
-of the problem Au=f
.
-
-
-#include <lac/precondition_selector.h>
-#include <dofs/dof_handler.h>
-#include <lac/full_matrix.h>
-
-FullMatrix<double> A(100,50);
-
-PreconditionSelector preconditioning("jacobi",1.);
-preconditioning.use_matrix(A);
-
-
-
-
-
-
-This class implements the Bicgstab algorithm by van der Worst.
-It is initialized by
-SolverBicgstab (SolverControl &cn, VectorMemory
.
-
-Example:We initialize a Bicgstab-solver for
-the problem Au=f
, using the solver control
-explained above. A
shall be a sparse matrix and the vectors
-u
and f
shall be vectors of doubles. Next,
-we solve the problem.
-
-
-// Include files for solver control, solver and preconditioner
-#include <lac/solver_control.h>
-#include <lac/solver_bicgstab.h>
-#include <lac/precondition_selector.h>
-
-// Include files for matrices and vectors
-#include <lac/sparse_matrix.h>
-#include <lac/vector.h>
-
-// Initialize the solver control and the solver
-
-SolverControl control(1000,1e-6);
-VectorMemory<Vector<double> > vectormem;
-SolverBicgstab<SparseMatrix<double>,Vector<double> > solver(control,vectormem);
-
-// Initialize the problem matrices. Well...they shouldn't only be
-// initialized but also contain the problem, so this is just an example
-// to get the definitions and types and everything right.
-
-SparseMatrix<double> A;
-Vector<double> u,f;
-
-// Generate a Jacobi preconditioner with the damping parameter 1
-PreconditionSelector<SparseMatrix<double>, Vector<double> > preconditioning("jacobi",1.);
-
-// Use the matrix of the linear equation system for preconditioning
-// (this is the usual case).
-preconditioning.use_matrix(A);
-
-solver.solve(A,u,f,preconditioning);
-
-
-
-
-This class implements the preconditioned cg-method.
-It is initialized by
-SolverCG (SolverControl &cn, VectorMemory
.
-
-Example:We initialize a CG-solver for
-the problem Au=f
, using the solver control
-explained above. A
shall be a sparse matrix and the vectors
-u
and f
shall be vectors of doubles. Next,
-we solve the problem.
-
-
-// Include files for solver control, solver and preconditioner
-#include <lac/solver_control.h>
-#include <lac/solver_bicgstab.h>
-#include <lac/precondition_selector.h>
-
-// Include files for matrices and vectors
-#include <lac/sparse_matrix.h>
-#include <lac/vector.h>
-
-// Initialize the solver control and the solver
-
-SolverControl control(1000,1e-6);
-VectorMemory<Vector<double> > vectormem;
-SolverCG<SparseMatrix<double>,Vector<double> > solver(control,vectormem);
-
-// Initialize the problem matrices. Well...they shouldn't only be
-// initialized but also contain the problem, so this is just an example
-// to get the definitions and types and everything right.
-
-SparseMatrix<double> A;
-Vector<double> u,f;
-
-// Generate a Jacobi preconditioner with the damping parameter 1
-PreconditionSelector<SparseMatrix<double>, Vector<double> > preconditioning("jacobi",1.);
-
-// Use the matrix of the linear equation system for preconditioning
-// (this is the usual case).
-preconditioning.use_matrix(A);
-
-solver.solve(A,u,f,preconditioning);
-
-
-
-This class implements the Restarted Preconditioned Direct Generalized
-Minimal Residual Method. The stopping criterion is the norm of the residual.
-It is initialized using
-SolverGMRES(SolverControl &cn, VectorMemory<Vector> &mem,
-const AdditionalData &data=Additionaldata())
-
-This constructor needs the maximum number of temporary vectors to be used.
-A number too small can seriously affect its performance, but a number
-too large will also increase the required computing time. This number is
-contained in the AdditionalData
structure with a default of 30.
-This solver is rather special, and for a detailed explanation you should
-take a look at the detailed description of the SolverGMRES
-class.
-
-Example:We initialize a GMRES-solver for
-the problem Au=f
, using the solver control
-explained above. A
shall be a sparse matrix and the vectors
-u
and f
shall be vectors of doubles.
-Next, we solve the problem. We use the default number of thirty temporary
-vectors.
-
-
-// Include files for solver control, solver and preconditioner
-#include <lac/solver_control.h>
-#include <lac/solver_gmres.h>
-#include <lac/precondition_selector.h>
-
-// Include files for matrices and vectors
-#include <lac/sparse_matrix.h>
-#include <lac/vector.h>
-
-// Initialize the solver control and the solver
-
-SolverControl control(1000,1e-6);
-VectorMemory<Vector<double> > vectormem;
-SolverGMRES<SparseMatrix<double>,Vector<double> > solver(control,vectormem);
-
-// Initialize the problem matrices. Well...they shouldn't only be
-// initialized but also contain the problem, so this is just an example
-// to get the definitions and types and everything right.
-
-SparseMatrix<double> A;
-Vector<double> u,f;
-
-// Generate a Jacobi preconditioner with the damping parameter 1
-PreconditionSelector<SparseMatrix<double>, Vector<double> > preconditioning("jacobi",1.);
-
-// Use the matrix of the linear equation system for preconditioning
-// (this is the usual case).
-preconditioning.use_matrix(A);
-
-solver.solve(A,u,f,preconditioning);
-
-
-
-
-
-This class implements the Richardson iteration method. The stopping criterion
-is the norm of the residual. It is initialized using
-SolverRichardson(SolverControl &cn, VectorMemory<Vector>
-&mem, const AdditionalData &data=Additionaldata())
-
-The additional data for this solver is the damping, with a default of 1.
-
-Example:We initialize a Richardson-solver for
-the problem Au=f
, using the solver control
-explained above. A
shall be a sparse matrix and the vectors
-u
and f
shall be vectors of doubles. Next,
-we solve the problem. We use the default damping parameter of 1.
-
-
-// Include files for solver control, solver and preconditioner
-#include <lac/solver_control.h>
-#include <lac/solver_richardson.h>
-#include <lac/precondition_selector.h>
-
-// Include files for matrices and vectors
-#include <lac/sparse_matrix.h>
-#include <lac/vector.h>
-
-// Initialize the solver control and the solver
-
-SolverControl control(1000,1e-6);
-VectorMemory<Vector<double> > vectormem;
-SolverRichardson<SparseMatrix<double>,Vector<double> > solver(control,vectormem);
-
-// Initialize the problem matrices. Well...they shouldn't only be
-// initialized but also contain the problem, so this is just an example
-// to get the definitions and types and everything right.
-
-SparseMatrix<double> A;
-Vector<double> u,f;
-
-// Generate a Jacobi preconditioner with the damping parameter 1
-PreconditionSelector<SparseMatrix<double>, Vector<double> > preconditioning("jacobi",1.);
-
-// Use the matrix of the linear equation system for preconditioning
-// (this is the usual case).
-preconditioning.use_matrix(A);
-
-solver.solve(A,u,f,preconditioning);
-
-
-
-
-- Next Chapter: Postprocessing - | -- Back to this chapter's index - | -- Back to the tutorial index - | -
- -
- - diff --git a/deal.II/doc/tutorial/chapter-1.elements/title.html b/deal.II/doc/tutorial/chapter-1.elements/title.html deleted file mode 100644 index 8b7984eda1..0000000000 --- a/deal.II/doc/tutorial/chapter-1.elements/title.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - --This part of the deal.II documentation will discuss -some building blocks of a finite element program. We will take a look at the general -structure of programs of this kind and at the various possibilities -in that respect offered by deal.II. The order of -the table of contents below reflects the order in which -you need to perform the tasks. Some things may be left out according to -your needs. The application in actual programs can be found in other -chapters of this tutorial. -
- -dealing with grid creation, grid input from a file and grid - refinement. - The various kinds of grid are also discussed. -
-where degrees of freedom are distributed and numbered.
-- Hanging Nodes -
-where locally refined grids are discussed.
-- Matrix Structure -
-where efficient structures for sparse matrices are discussed.
-- Matrix and Vector Generation -
-where the different kinds of matrices and vectors are discussed.
-- The Problem Matrix and the Right Hand Side -
-which shows how to implement a particular problem.
-which shows how to set boundary conditions in deal.II.
-- Condensing the Hanging Nodes -
-which shows how, when and why to condense hanging nodes.
-explaining the different solvers available and how to use them.
-- Postprocessing -
-where the data is postprocessed and stored and the error - is calculated. -
-- Error Estimate and Adaptivity -
-explaining how to use adaptive refinement with error estimates.
-- Parameter Input -
-explaining how to use a parameter file for configuring - your program. -
-explaining how to get output of your data, with an emphasis on - different graphic formats. -
-- Back to this chapter's index - | -- Back to the tutorial index - | -
- -
- - - - - - - diff --git a/deal.II/doc/tutorial/chapter-2.step-by-step/navbar.html b/deal.II/doc/tutorial/chapter-2.step-by-step/navbar.html index 370be4a69f..fc10c5610c 100644 --- a/deal.II/doc/tutorial/chapter-2.step-by-step/navbar.html +++ b/deal.II/doc/tutorial/chapter-2.step-by-step/navbar.html @@ -83,10 +83,6 @@- Back to the tutorial index -
- diff --git a/deal.II/doc/tutorial/chapter-2.step-by-step/toc.html b/deal.II/doc/tutorial/chapter-2.step-by-step/toc.html index 2cfcf3184c..73607e961a 100644 --- a/deal.II/doc/tutorial/chapter-2.step-by-step/toc.html +++ b/deal.II/doc/tutorial/chapter-2.step-by-step/toc.html @@ -153,14 +153,6 @@ At present, the following programs exist:- Back to the tutorial index - | -
-In order to assemble the matrices we basically need to: -
-
-First we generate a structure for the storage of a sparse n times n matrix
-where n is the number of the degrees of freedom.
-The parameter max_couplings_between_dofs()
returns the maximum
-number of couplings between degrees of freedom, i.e. the number of elements in the
-matrix and allows deal.II to generate the matrix structure more
-efficiently, which in effect is done in the next line of code.
-
-Afterwards a constraint matrix for the hanging nodes is created and they -are copied into the matrix structure. -
-
-
- matrix_structure.reinit(dof.n_dofs(),dof.n_dofs(),
- dof.max_couplings_between_dofs());
- dof.make_sparsity_pattern(matrix_structure);
- hanging_nodes.clear();
- dof.make_constraint_matrix(hanging_nodes);
- hanging_nodes.condense(matrix_structure);
-
-
-
-The problem is of the form Au=f, we generate the matrix A with the
-structure given by matrix_structure
:
-
-
- A.reinit(matrix_structure);
- f.reinit(dof.n_dofs());
-
-
-
-
-The two lines below calculate trial functions for the finite elements and
-for their faces using Gaussian quadrature. The first line calculates the trial
-function for the finite element associated with the degree of freedom dof
-updating the values of the gradients and of the Jacobi determinant multiplied by a
-weight function given by the quadrature qc
.
-
-
- FEValues<dim> fevalues(dof->get_fe(), qc, UpdateFlags(update_gradients |
- update_JxW_values));
- FEFaceValues<dim> ffvalues(dof->get_fe(), qf,
- UpdateFlags(update_JxW_values | update_q_points));
-
-
-
--Integration is done locally. Therefore we need appropriate definitions for -
-
-
- vector<int> indices(fe.total_dofs);
- dVector elvec(fe.total_dofs);
-
- dFMatrix elmat(fe.total_dofs);
-
-
-
-Next we traverse all the cells and integrate the Laplace problem using the
-discretized Laplace operator. qc is a
-Quadrature<dim>
.
-
-The outer loop traverses all the points of the quadrature qc
.
-The inner two loops traverse the degrees of freedom of the finite element
-fe
where du
and dv
are the gradients
-with respect to the quadrature points. fevalues.JxW(k)
gives
-the Jacobi determinant multiplied by the weight of the quadrature point
-k
. Taken together the line
-
-elmat(i,j) += fevalues.JxW(k) * du * dv;
-
-
-gives the discretized Laplace operator.
-
-
- for (DoFHandler<2>::active_cell_iterator c = dof.begin_active()
- ; c != dof.end() ; ++c)
- {
- fevalues.reinit(c, stb);
- elmat.clear();
- elvec.clear();
- c->get_dofindices(indices);
-
- for (unsigned k=0;k<qc.n_quadrature_points;++k)
- {
- for (unsigned i=0;i<fe.total_dofs;++i)
- {
- const Point<2> dv = fevalues.shape_grad(i,k);
-
- for (unsigned j=0;j<fe.total_dofs;++j)
- {
- const Point<2> du = fevalues.shape_grad(j,k);
-
- elmat(i,j) += fevalues.JxW(k)
- * du * dv
- ;
-
- }
- }
- }
-
-
-
-The insertion of the local matrix into the global one
-happens in the following piece of code (f
is the right hand
-vector of the problem, A
the problem matrix):
-
-
- for (unsigned i=0;i<fe.total_dofs;++i)
- {
- f(indices[i]) += elvec(i);
-
- for (unsigned j=0;j<fe.total_dofs;++j)
- {
- A.add(indices[i], indices[j], elmat(i,j));
- }
- }
-
-
-
--There are two deal.II functions relevant for us at the moment: -
-
-
-void VectorTools::interpolate_boundary_values(...)
-
-
--which does exactly what it says. This function accepts a list of pairs -of boundary indicators and the according functions and returns a list of -pairs of DoF numbers and values denoting the respective -Dirichlet boundary values. -
--This output is used by -
-
-
-void MatrixTools::apply_boundary_values(...)
-
-
--that inserts the proper boundary conditions into the system of equations: -
--
- map<int,double> boundary_values;
- DoFHandler<2>::FunctionMap dirichlet_bc;
- BoundaryFct bfct;
- dirichlet_bc[0]=&bfct;
- VectorTools<2>::interpolate_boundary_values(dof,dirichlet_bc,fe,boundary,boundary_values);
- u.reinit(f);
- MatrixTools<2>::apply_boundary_values(boundary_values,A,u,f);
-
--First, we need a few definitions: -
-boundary_values
maps DoF indices at the boundary computed by interpolate_boundary_values
to their respective values.
-dirichlet_bc
maps boundary indicators to boundary functions, supplied by us. All boundary indicators are zero by default, therefore the
-above statement maps the same function to all the boundaries. The boundary functions compute the boundary values.
-bfct
is a function returning cos(2*PI*x)*sin(2*PI*y)
-
, thereby supplying boundary values.
--This may seem a bit confusing. What actually happens is the following: -
-interpolate_boundary_values
takes the boundary functions
-bfct
, its relation to boundaries dirichlet_bc
and
-the triangulation dof, fe
and returns a
-mapping boundary_values
that maps values instead of functions
-to our boundaries. The function looks at all the boundaries. All we
-ever need to do is specify the initial triangulation.
-apply_boundary_values
subsequently takes that mapping and
-our system of equations Au=f and inserts the boundary values into
-the system of equations which can then be solved.
-- Back to this chapter's index - | -- Back to the tutorial index - | -
-Last modified: $Date$ -
-diff --git a/deal.II/doc/tutorial/chapter-3.laplace/Makefile b/deal.II/doc/tutorial/chapter-3.laplace/Makefile deleted file mode 100644 index 9d7bf2c49c..0000000000 --- a/deal.II/doc/tutorial/chapter-3.laplace/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $Id$ - - -# include paths and global variables -include ../../../common/Make.global_options - - -validate-xrefs: - $(PERL) $D/doc/auto/scripts/validate-xrefs.pl *.html - - -.PHONY: validate-xrefs diff --git a/deal.II/doc/tutorial/chapter-3.laplace/assemble.html b/deal.II/doc/tutorial/chapter-3.laplace/assemble.html deleted file mode 100644 index 504de98af3..0000000000 --- a/deal.II/doc/tutorial/chapter-3.laplace/assemble.html +++ /dev/null @@ -1,275 +0,0 @@ - - -
-
- - - - - - - -
-