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

« back to all changes in this revision

Viewing changes to nfem/ptst/neumann.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
 
///
2
 
/// This file is part of Rheolef.
3
 
///
4
 
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
5
 
///
6
 
/// Rheolef is free software; you can redistribute it and/or modify
7
 
/// it under the terms of the GNU General Public License as published by
8
 
/// the Free Software Foundation; either version 2 of the License, or
9
 
/// (at your option) any later version.
10
 
///
11
 
/// Rheolef is distributed in the hope that it will be useful,
12
 
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
/// GNU General Public License for more details.
15
 
///
16
 
/// You should have received a copy of the GNU General Public License
17
 
/// along with Rheolef; if not, write to the Free Software
18
 
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 
///
20
 
/// =========================================================================
21
 
#include "rheolef.h"
22
 
using namespace rheolef;
23
 
using namespace std;
24
 
size_t N;
25
 
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])); }
26
 
Float g (const point& x) { return -0.5/N; }
27
 
int main(int argc, char**argv) {
28
 
  environment parallel(argc, argv);
29
 
warning_macro ("neumann[1]");
30
 
  geo omega (argv[1]);
31
 
warning_macro ("neumann[2]");
32
 
  N = omega.dimension();
33
 
warning_macro ("neumann[3]");
34
 
  space Vh (omega, "P1");
35
 
warning_macro ("neumann[4]");
36
 
  field fh = interpolate(Vh, f);
37
 
warning_macro ("neumann[5]");
38
 
  field uh (Vh, 0.);
39
 
warning_macro ("neumann[6]");
40
 
  form m (Vh, Vh, "mass");
41
 
warning_macro ("neumann[7]");
42
 
  form a (Vh, Vh, "grad_grad");
43
 
warning_macro ("neumann[8]");
44
 
  form c = m+a;
45
 
warning_macro ("neumann[9]");
46
 
  size_t max_iter = 10000;
47
 
  Float tol = 1e-15;
48
 
warning_macro ("neumann[10]");
49
 
  int status = pcg (c.uu(), uh.u(), m.uu()*fh.u() + m.ub()*fh.b(), eye<Float>(), max_iter, tol, &pcerr);
50
 
warning_macro ("neumann[11]");
51
 
  pcout << uh;
52
 
warning_macro ("neumann[12]");
53
 
}