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

« back to all changes in this revision

Viewing changes to doc/pexamples/heat.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
#include "rheolef.h"
 
2
using namespace rheolef;
 
3
using namespace std;
 
4
int main (int argc, char **argv) {
 
5
  environment rheolef (argc, argv);
 
6
  geo omega (argv[1]);
 
7
  size_t n_max = (argc > 2) ? atoi(argv[2]) : 100;
 
8
  Float delta_t = 0.5/n_max;
 
9
  space Xh (omega, "P1");
 
10
  Xh.block ("boundary");
 
11
  form m (Xh, Xh, "mass");
 
12
  form a (Xh, Xh, "grad_grad");
 
13
  form c = m + delta_t*a;
 
14
  solver sc = ldlt (c.uu());
 
15
  field lh = riesz (Xh, 1);
 
16
  field uh (Xh, 0);
 
17
  branch event ("t","u");
 
18
  dout << event (0, uh);
 
19
  for (size_t n = 1; n <= n_max; n++) {
 
20
    field kh = m*uh + delta_t*lh;
 
21
    uh.set_u() = sc.solve (kh.u() - c.ub()*uh.b());
 
22
    dout << event (Float(n)*delta_t, uh);
 
23
  }
 
24
}