~ubuntu-branches/ubuntu/trusty/rheolef/trusty-proposed

« back to all changes in this revision

Viewing changes to doc/usrman/transmission.cc

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2010-06-12 09:08:59 UTC
  • Revision ID: james.westby@ubuntu.com-20100612090859-8gpm2gc7j3ab43et
Tags: upstream-5.89
ImportĀ upstreamĀ versionĀ 5.89

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "rheolef.h"
 
2
using namespace std;
 
3
 
 
4
const Float epsilon = 0.01;
 
5
 
 
6
int main(int argc, char**argv) {
 
7
    geo omega (argv[1]);
 
8
    space Vh (omega, "P1");
 
9
    if (omega.dimension() <= 2) {
 
10
      Vh.block ("left"); Vh.block ("right");
 
11
    } else {
 
12
      Vh.block ("back"); Vh.block ("front");
 
13
    }
 
14
    field uh (Vh);
 
15
    if (omega.dimension() <= 2)
 
16
      uh["left"] = uh["right"] = 0;
 
17
    else
 
18
      uh["back"] = uh["front"] = 0;
 
19
    field fh (Vh, 1);
 
20
 
 
21
    space Qh (omega, "P0", "vector");
 
22
    field eta (Qh);
 
23
    eta ["east"] = 1;
 
24
    eta ["west"] = epsilon;
 
25
    form_diag d (eta);
 
26
    form grad (Vh, Qh, "grad"); 
 
27
    form m    (Vh, Vh, "mass"); 
 
28
    form inv_m (Qh, Qh, "inv_mass"); 
 
29
    form a = trans(grad)*(inv_m*d)*grad;
 
30
    ssk<Float> fact = ldlt(a.uu);
 
31
    uh.u = fact.solve (m.uu*fh.u + m.ub*fh.b - a.ub*uh.b);
 
32
    cout << setprecision(numeric_limits<Float>::digits10)
 
33
         << catchmark("epsilon") << epsilon << endl
 
34
         << catchmark("u")       << uh;
 
35
    return 0;
 
36
}