Rheolef  7.1
an efficient C++ finite element environment
zalesak.h
Go to the documentation of this file.
1 struct u {
26  point operator() (const point& x) const {
27  return point(-0.5*(x[1]-yc), 0.5*(x[0]-xc));
28  }
29  static Float period() {
30  Float pi = acos (Float(-1));
31  return 4*pi;
32  }
33  u() {}
34 protected:
35  static constexpr Float
36  xc = 0.5, // rotation center
37  yc = 0.5;
38 };
39 struct phi_exact {
40  Float operator() (const point& x) const {
41  Float xm = xc + cos(0.5*t)*(x[0]-xc) + sin(0.5*t)*(x[1]-yc);
42  Float ym = yc - sin(0.5*t)*(x[0]-xc) + cos(0.5*t)*(x[1]-yc);
43  Float d0 = sqrt((xm-x0)*(xm-x0) + (ym-y0)*(ym-y0)) - r;
44  if (d0 >= 0) {
45  Float d2 = sqrt(sqr(xm-x2) + sqr(ym-y2));
46  Float d3 = sqrt(sqr(xm-x3) + sqr(ym-y3));
47  if (fabs(xm-x0) < w/2 && ym < y2) {
48  return min(d2,d3);
49  } else {
50  return min(d2,min(d3,d0));
51  }
52  }
53  else {
54  if (ym < y4) {
55  if (xm < x2) {
56  Float d1 = xm - x2;
57  return max(d0,d1);
58  } else if (xm > x3) {
59  Float d1 = x3 - xm;
60  return max(d0,d1);
61  } else {
62  Float d1 = xm - x2;
63  Float d2 = x3 - xm;
64  Float d3 = y4 - ym;
65  return min(d1,min(d2,d3));
66  }
67  } else {
68  Float d1 = sqrt(sqr(xm-x4) + sqr(ym-y4));
69  Float d2 = sqrt(sqr(xm-x5) + sqr(ym-y5));
70  if (xm < x2) {
71  return max(d0,-d1);
72  } else if (xm > x3) {
73  return max (d0,-d2);
74  } else {
75  Float d3 = y4 - ym;
76  return max(d3,d0);
77  }
78  }
79  }
80  }
82  Float perimeter() const {
83  Float pi = acos(Float(-1));
84  Float d24 = sqrt(sqr(x4-x2) + sqr(y4-y2));
85  Float d45 = w;
86  Float d53 = d24;
87  Float theta = asin(0.5*w/r);
88  Float arc32 = (2*pi - theta)*r;
89  return d24 + d45 + d53 + arc32;
90  }
91 protected:
92  Float t, x2, y2, x3, y3, x4, y4, x5, y5;
93  static constexpr Float
94  xc = 0.5, // rotation center
95  yc = 0.5,
96  x0 = 0.50, // circle center
97  y0 = 0.75,
98  r = 0.15, // circle radius
99  w = 0.05, // slot width
100  l = 0.25; // slot length
101 };
102 inline
104  : t (t1),
105  x2 (x0 - w/2),
106  y2 (y0 - sqrt(r*r - (w/2)*(w/2))),
107  x3 (x0 + w/2),
108  y3 (y2),
109  x4 (x2),
110  y4 (y0 + l - r),
111  x5 (x3),
112  y5 (y4)
113 {}
114 struct phi0 {
115  Float operator() (const point& x) const { return _phi(x); }
116  phi0() : _phi(0) {}
118 };
phi_exact::xc
static constexpr Float xc
Definition: zalesak.h:94
u::operator()
point operator()(const point &x) const
Definition: leveque.h:26
phi_exact::phi_exact
phi_exact(Float w1)
Definition: transport_dg2.h:32
phi_exact::y3
Float y3
Definition: zalesak.h:92
phi_exact::y5
Float y5
Definition: zalesak.h:92
phi_exact::x3
Float x3
Definition: zalesak.h:92
u::xc
static constexpr Float xc
Definition: zalesak.h:36
u::pi
Float pi
Definition: leveque.h:34
phi_exact::x4
Float x4
Definition: zalesak.h:92
phi_exact::perimeter
Float perimeter() const
Definition: zalesak.h:82
phi0::operator()
Float operator()(const point &x) const
Definition: leveque.h:38
phi_exact
Definition: transport_dg2.h:30
u::u
u()
Definition: zalesak.h:33
u::period
static Float period()
Definition: zalesak.h:29
phi0::phi0
phi0()
Definition: zalesak.h:116
phi_exact::t
Float t
Definition: zalesak.h:92
phi_exact::operator()
Float operator()(const point &x) const
Definition: transport_dg2.h:31
phi0::_phi
phi_exact _phi
Definition: zalesak.h:117
phi0
Definition: leveque.h:37
phi_exact::y2
Float y2
Definition: zalesak.h:92
phi_exact::y0
static constexpr Float y0
Definition: zalesak.h:97
u
Definition: leveque.h:25
phi_exact::w
Float w
Definition: transport_dg2.h:33
Float
see the Float page for the full documentation
phi_exact::y4
Float y4
Definition: zalesak.h:92
point
see the point page for the full documentation
u::yc
static constexpr Float yc
Definition: zalesak.h:37
phi_exact::r
static constexpr Float r
Definition: zalesak.h:98
phi_exact::x5
Float x5
Definition: zalesak.h:92
phi_exact::x2
Float x2
Definition: zalesak.h:92
phi_exact::l
static constexpr Float l
Definition: zalesak.h:100
phi_exact::phi_exact
phi_exact(Float t1)
phi_exact::yc
static constexpr Float yc
Definition: zalesak.h:95
phi_exact::x0
static constexpr Float x0
Definition: zalesak.h:96