~ubuntu-branches/ubuntu/wily/rheolef/wily

« back to all changes in this revision

Viewing changes to nfem/ptst/form_div_s_tst.cc

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito, Pierre Saramito, Sylvestre Ledru
  • Date: 2013-04-30 11:29:51 UTC
  • mfrom: (1.2.1) (11.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130430112951-g69nuqin77t75dek
Tags: 6.4-1
[ Pierre Saramito ]
* New upstream release 6.4 (major changes):
  - new powerful c++ expressions for FEM specifications
  - configure script improved (portability increased)
  - minor bug fixes
* control:
  - all architectures are considered (armel & armhf are back)
  - no more circular-dependency librheolef-dev <--> rheolef
* rules: add security compiler flags (hardening and -W,-l,relro)
* watch: include an updated version, thanks to B. Martens <bartm@debian.org>
* copyright: various file format fixes

[ Sylvestre Ledru ]
*  Standards-Version updated to 3.9.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
Float phi (const point& x) { return norm(x) - 1; }
7
7
 
8
8
// first test:
9
 
point normal (const point& x) { return x/norm(x); }; // normal in X on C(0,1) is vector OX:
 
9
point normal_exact (const point& x) { return x/norm(x); }; // normal in X on C(0,1) is vector OX:
10
10
// note: div_s(n) = d-1
11
11
 
12
12
// second test:
13
 
point u (const point& x) { 
 
13
point u_exact (const point& x) { 
14
14
       return point (x[0]*x[1], x[1]*x[2], (x[0] + x[1])*x[2]); 
15
15
}; 
16
16
// exact solution  
31
31
{
32
32
  space Xh  (omega, approx);
33
33
  space Xvh (omega, approx, "vector");
34
 
  form m (Xh,  Xh, "mass", qopt);
35
 
  form b (Xvh, Xh, "div",  qopt);
 
34
  trial p (Xh); test q (Xh);
 
35
  trial u (Xvh); test v (Xvh);
 
36
  form m = integrate (omega, p*q, qopt);
 
37
  form b = integrate (omega, div_s(u)*q, qopt);
36
38
 
37
39
  // compute div_uh = div_s(uh)
38
 
  field uh = test_normal ? interpolate(Xvh, normal) : interpolate (Xvh, u);
 
40
  field uh = test_normal ? interpolate(Xvh, normal_exact) : interpolate (Xvh, u_exact);
39
41
  field lh = b*uh;
40
42
  solver sm (m.uu());
41
43
  field div_uh (Xh);
68
70
  space Bh  (gh.band(), approx);
69
71
  Bh.block ("isolated");
70
72
  Bh.unblock ("zero");
71
 
  form m (Bh,  Bh, "mass", gh, qopt);
 
73
  trial p (Bh); test q (Bh);
 
74
  form m = integrate (gh, p*q, qopt);
72
75
 
73
76
  field phi_h_band = phi_h [gh.band()];
74
77
  vector<vec<Float> > c (gh.n_connected_component());
86
89
 
87
90
  // compute rhs div_uh = div_s(uh)
88
91
  space Bvh (gh.band(), approx, "vector");
89
 
  form b (Bvh, Bh, "div",  gh, qopt);
90
 
  field uh = test_normal ? interpolate(Bvh, normal) : interpolate (Bvh, u);
 
92
  trial u (Bvh); test v (Bvh);
 
93
  form b = integrate (gh, div_s(u)*q, qopt);
 
94
  field uh = test_normal ? interpolate(Bvh, normal_exact) : interpolate (Bvh, u_exact);
91
95
  field lh = b*uh;
92
96
  vector<Float>       z (gh.n_connected_component(), 0);
93
97
  vec<Float> F =   { lh.u(),    z    };