From 97ee2203d9c52e30041fe19339f8b81eeec6a453 Mon Sep 17 00:00:00 2001 From: schrage Date: Thu, 7 Jan 1999 16:02:44 +0000 Subject: [PATCH] First (partly) browsable version of the tutorial for DEAL git-svn-id: https://svn.dealii.org/trunk@726 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/dealdoc.css | 5 + .../doc/tutorial/chapter-3.laplace/index.html | 92 ++++++++ .../doc/tutorial/chapter-3.laplace/main.html | 197 ++++++++++++++++++ deal.II/doc/validate | 3 + 4 files changed, 297 insertions(+) create mode 100644 deal.II/doc/dealdoc.css create mode 100644 deal.II/doc/tutorial/chapter-3.laplace/index.html create mode 100644 deal.II/doc/tutorial/chapter-3.laplace/main.html create mode 100755 deal.II/doc/validate diff --git a/deal.II/doc/dealdoc.css b/deal.II/doc/dealdoc.css new file mode 100644 index 0000000000..72976e20e3 --- /dev/null +++ b/deal.II/doc/dealdoc.css @@ -0,0 +1,5 @@ + +BODY {background-color: white; background-image: none} + diff --git a/deal.II/doc/tutorial/chapter-3.laplace/index.html b/deal.II/doc/tutorial/chapter-3.laplace/index.html new file mode 100644 index 0000000000..bc60a8f8ad --- /dev/null +++ b/deal.II/doc/tutorial/chapter-3.laplace/index.html @@ -0,0 +1,92 @@ + + + +The Laplace Problem + + + + + + +

The Laplace Problem

+

+We will start with a simple example for a differential equation to be solved +with DEAL: the Laplace problem. We will try to solve the +Laplace equation on a square where one of the four boundaries has a constant +and the other three zero potential.

+

+In order to solve this problem we will need to:

+ +

+

+

+This tutorial will accordingly be split into several chapters:

+
    +
  1. +Program structure +

    +where the overall design of the program and its classes are discussed

    +
  2. +
  3. +The main program +

    +where we take a look at how DEAL is used

    +
  4. +
  5. +The class Laplace +

    +where some of the details of the problem generation and solution are +discussed

    +
  6. +
  7. +Generating a +triangulation

    +

    +where a triangulation is generated and degrees of freedom are discussed

    +
  8. +
  9. +Assembling the problem +

    +where the matrices describing the problem and the boundary conditions are +built

    +
  10. +
  11. +Solving the problem +

    +where the problem is solved

    +
  12. +
+
+ +

+Back to the tutorial index

+
+
+Jan Schrage
+ + +

+Last modified: Tue 5 Jan 1999 +

+ + diff --git a/deal.II/doc/tutorial/chapter-3.laplace/main.html b/deal.II/doc/tutorial/chapter-3.laplace/main.html new file mode 100644 index 0000000000..e62d24984e --- /dev/null +++ b/deal.II/doc/tutorial/chapter-3.laplace/main.html @@ -0,0 +1,197 @@ + + + + DEAL tutorial: the Laplace problem + + + + + + + +

The Laplace Problem

+ +

Main Program: main.cc

+

+The main program has several functions: +

+ +
    +
  1. Inclusion of the necessary headers and variable + definitions. +
  2. +
  3. + Creation of a logfile and data logging. +
  4. +
  5. + Instantiation of the C++ class Laplace + dealing with the problem. +
  6. +
  7. Calling the Laplace methods for assemblage and solution of the + problem. +
  8. +
  9. + Writing out of the output data and termination. +
  10. +
+ +

+We shall look at this in detail now: +

+ +

Program Header and Definitions

+ +

+First the header files containing the Laplace class definition and +the function definition for our solution function are included: +

+ +
+
+#include "laplace.h"
+#include "functions.h"
+
+
+ +

+Next, we need some standard include files +

+ +
+
+#include <iostream.h&rt;
+#include <fstream.h&rt;
+#include <stdlib.h&rt;
+
+
+ +

+and some DEAL specific include files that enable us to do runtime logging and +nicely identify our program:

+
+
+#include <base/logstream.h&rt;
+#include <base/jobidentifier.h&rt;
+
+
+ +

+and some more stuff which will be discussed when appropriate: +

+ +
+
+ZeroFunction<2> zero;
+char fname[30];
+extern const char* funcversion;
+extern const char* laplaceversion;
+char versioninfo[500];
+
+const char* JobIdentifier::program_id() 
+{ 
+  sprintf(versioninfo,"%s\n%s", funcversion, laplaceversion);	    
+  return versioninfo;
+}
+
+
+

+Our main program starts here. It will take the initial number of global grid +refinements as its argument. That means that the number 3 as argument will +lead to the initial grid being globally refined three times, no questions +asked. +

+ +
+
+main(int argc, char** argv) 
+{
+
+
+ +

Data logging

+

+We want to log info about the program run to a file. Logfiles are streams, +which behave like stacks in several ways. How to make use of the stack concept +will be apparent later. +

+
+
+ofstream logfile("T");
+deallog.attach(logfile);
+
+
+ +

Instantiation of needed classes

+

+We need a solution function and an instance of the class dealing with the +Laplace problem: +

+ +
+
+PureTransportSolution exact;
+Laplace lap(exact);
+
+
+ +

+In addition we need to do some refinement (the command line argument was +previously stored in the variable firstgrid.Please note that every +log entry will now be preceeded by "Adaptive: " and that the stack height is +increased by one. Only entries with a stack height of two or less will we +written to the console. +

+

+deallog.push("Adaptive");
+deallog.depth_console(2);
+
+for (unsigned step = 0; step < 3 ; ++step)   
+{     
+  deallog << "Step " << step << endl;
+  if (!step) 
+     lap.remesh(firstgrid);
+  else
+  {
+     lap.remesh(1);
+  }
+
+ +

+Now we have our log entries preceded by "Primal" since we solve the primal problem, +our class assembles and solves the problem; the solution is exact (as defined above) +and the right hand side of the equation is zero (as defined above). If the right +hand side were not zero we would solve the Poisson equation instead. Afterwards +"Primal" is removed from all the following log entries. +

+

+  deallog.push("Primal"); 
+  lap.assemble_primal(exact, zero); 
+  lap.solve_primal();          
+  deallog.pop();
+
+

+Finally the solution is written to a file and the logfile is closed. +

+
+
+  sprintf(fname,"T%02d",step);    
+  lap.write_data(fname);   
+ }   
+ deallog.pop();   
+ deallog.detach();
+}
+
+
+

+Back to the tutorial index +

+
+
+ Jan Schrage
+

+Last modified: Wed 6 Jan 1999 +

+ + + diff --git a/deal.II/doc/validate b/deal.II/doc/validate new file mode 100755 index 0000000000..2199ba0a44 --- /dev/null +++ b/deal.II/doc/validate @@ -0,0 +1,3 @@ +#!/bin/sh +echo Validating $1 +cat $1 | sed -e 's/http:\/\/www.w3.org\/TR\/REC-html40\/strict.dtd//' -e 's/\"\"//' | nsgmls -s -m /opt/lib/sgml/pubtext/HTML4.soc -- 2.39.5