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

« back to all changes in this revision

Viewing changes to doc/usrman/torus.h

  • 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
static const Float R = 1;
 
2
static const Float r = 0.6;
 
3
Float phi (const point& x) {
 
4
 return sqr(sqrt(sqr(x[0])+sqr(x[1]))-sqr(R)) + sqr(x[2])-sqr(r);
 
5
}
 
6
void get_torus_coordinates (const point& x, Float& rho, Float& theta, Float& phi) {
 
7
  //
 
8
  //       [ cos(phi) ]       [ cos(phi) cos(theta) ]
 
9
  // x = R [ sin(phi) ] + rho [ sin(phi) cos(theta) ]
 
10
  //       [   0      ]       [     sin(theta)      ]
 
11
  //
 
12
  static const Float pi = acos(Float(-1));
 
13
  // distance from the circle in the x-y-plane around 0 with radius R:
 
14
  rho = sqrt(sqr(x[2]) + sqr(sqrt(sqr(x[0]) + sqr(x[1])) - sqr(R)));
 
15
  // angle from positive x-axis to (x,y,0):
 
16
  phi = atan2(x[1], x[0]);
 
17
  // angle from positive (x,y,0)-direction to x:
 
18
  theta = atan2(x[2], sqrt(sqr(x[0]) + sqr(x[1])) - R);
 
19
}
 
20
// test case from OlsReuGra-2009:
 
21
// for Laplace operator:
 
22
//
 
23
//      -Laplacian_s(u) = f on Gamma
 
24
//
 
25
struct u : unary_function<point,Float> {
 
26
 Float operator() (const point& x) {
 
27
  Float rho, theta, phi;
 
28
  get_torus_coordinates (x, rho, theta, phi);
 
29
  return sin(3*phi)*cos(3*theta+phi);
 
30
 }
 
31
 u (size_t d=3) {}
 
32
};
 
33
struct f : unary_function<point,Float> {
 
34
 Float operator() (const point& x) {
 
35
  Float rho, theta, phi;
 
36
  get_torus_coordinates (x, rho, theta, phi);
 
37
  Float fx = (9*sin(3*phi)*cos(3*theta+phi))/sqr(r)
 
38
    - (-10*sin(3*phi)*cos(3*theta+phi) - 6*cos(3*phi)*sin(3*theta+phi))
 
39
      /sqr(R + r*cos(theta))
 
40
    - (3*sin(theta)*sin(3*phi)*sin(3*theta+phi))
 
41
      /(r*(R + r*cos(theta)));
 
42
  return fx;
 
43
 }
 
44
 f (size_t d=3) {}
 
45
};