~ubuntu-branches/ubuntu/saucy/rheolef/saucy

« back to all changes in this revision

Viewing changes to doc/pexamples/robin.cc

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Saramito
  • Date: 2011-03-23 11:14:26 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20110323111426-cjvhey7lxt6077ty
Tags: 5.93-1
* New upstream release (minor changes):
  - some extra warning message deleted in heap_allocator
  - graphic output with mayavi2 fixed
  - add doc refman in .info and .pdf format

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "rheolef.h"
 
2
using namespace rheolef;
 
3
using namespace std;
 
4
size_t N; 
 
5
Float u_ex (const point& x) { return 0.5*(x[0]*(1-x[0]) + x[1]*(1-x[1]) + x[2]*(1-x[2]))/Float(N); }
 
6
Float g    (const point& x) { return u_ex(x) - 0.5/N; }
 
7
int main(int argc, char**argv) {
 
8
  environment distributed(argc, argv);
 
9
  geo omega (argv[1]);
 
10
  Float prec = (argc > 2) ? atof(argv[2]) : 1e-10;
 
11
  N = omega.dimension();
 
12
  space Xh (omega, "P1");
 
13
  space Wh (omega["boundary"], "P1");
 
14
  form a  (Xh, Xh, "grad_grad");
 
15
  form ab (Xh, Xh, "mass", omega["boundary"]);
 
16
  a = a + ab;
 
17
  form m  (Xh, Xh, "mass");
 
18
  form mb (Wh, Xh, "mass") ;
 
19
  field fh (Xh, 1);
 
20
  field gh = interpolate(Wh, g);
 
21
  field uh (Xh);
 
22
  solver sa (a.uu);
 
23
  uh.u = sa.solve (m.uu*fh.u + m.ub*fh.b + mb.uu*gh.u + mb.ub*gh.b - a.ub*uh.b);
 
24
  dcout << uh;
 
25
}