Rheolef  7.2
an efficient C++ finite element environment
torus.icc
Go to the documentation of this file.
1 static const Float R = 1;
26 static const Float r = 0.6;
27 Float phi (const point& x) {
28  return sqr(sqrt(sqr(x[0])+sqr(x[1]))-sqr(R)) + sqr(x[2])-sqr(r);
29 }
31  Float& rho, Float& theta, Float& phi) {
32  static const Float pi = acos(Float(-1));
33  rho = sqrt(sqr(x[2]) + sqr(sqrt(sqr(x[0]) + sqr(x[1])) - sqr(R)));
34  phi = atan2(x[1], x[0]);
35  theta = atan2(x[2], sqrt(sqr(x[0]) + sqr(x[1])) - R);
36 }
37 struct u_exact {
38  Float operator() (const point& x) const {
39  Float rho, theta, phi;
40  get_torus_coordinates (x, rho, theta, phi);
41  return sin(3*phi)*cos(3*theta+phi);
42  }
43  u_exact (size_t d=3) {}
44 };
45 struct f {
46  Float operator() (const point& x) const {
47  Float rho, theta, phi;
48  get_torus_coordinates (x, rho, theta, phi);
49  Float fx = (9*sin(3*phi)*cos(3*theta+phi))/sqr(r)
50  - (-10*sin(3*phi)*cos(3*theta+phi) - 6*cos(3*phi)*sin(3*theta+phi))
51  /sqr(R + r*cos(theta))
52  - (3*sin(theta)*sin(3*phi)*sin(3*theta+phi))
53  /(r*(R + r*cos(theta)));
54  return fx;
55  }
56  f (size_t d=3) {}
57 };
see the Float page for the full documentation
see the point page for the full documentation
Definition: cavity_dg.h:29
size_t d
point operator()(const point &x) const
Definition: cavity_dg.h:30
f(size_t d=3)
Definition: torus.icc:56
Definition: phi.h:25
phi(Float n1=2, Float c1=1, Float r1=0)
Definition: phi.h:26
Float r
Definition: phi.h:54
point operator()(const point &x) const
u_exact(size_t d=3)
Definition: torus.icc:43
Float phi(const point &x)
Definition: torus.icc:27
void get_torus_coordinates(const point &x, Float &rho, Float &theta, Float &phi)
Definition: torus.icc:30