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

« back to all changes in this revision

Viewing changes to doc/pexamples/neumann.cc

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito
  • Date: 2012-04-06 09:12:21 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120406091221-m58me99p1nxqui49
Tags: 6.0-1
* New upstream release 6.0 (major changes):
  - massively distributed and parallel support
  - full FEM characteristic method (Lagrange-Gakerkin method) support
  - enhanced users documentation 
  - source code supports g++-4.7 (closes: #667356)
* debian/control: dependencies for MPI distributed solvers added
* debian/rules: build commands simplified
* debian/librheolef-dev.install: man1/* to man9/* added
* debian/changelog: package description rewritted (closes: #661689)

Show diffs side-by-side

added added

removed removed

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