Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
zalesak.h
Go to the documentation of this file.
1
25struct 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() {}
34protected:
35 static constexpr Float
36 xc = 0.5, // rotation center
37 yc = 0.5;
38};
39struct 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 }
91protected:
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};
102inline
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{}
114struct phi0 {
115 Float operator() (const point& x) const { return _phi(x); }
116 phi0() : _phi(0) {}
118};
see the Float page for the full documentation
see the point page for the full documentation
Definition leveque.h:37
phi0()
Definition zalesak.h:116
phi_exact _phi
Definition zalesak.h:117
Float operator()(const point &x) const
Definition leveque.h:38
Float x4
Definition zalesak.h:92
static constexpr Float x0
Definition zalesak.h:96
Float y5
Definition zalesak.h:92
static constexpr Float r
Definition zalesak.h:98
phi_exact(Float t1)
static constexpr Float y0
Definition zalesak.h:97
Float y4
Definition zalesak.h:92
phi_exact(Float w1)
Float t
Definition zalesak.h:92
static constexpr Float xc
Definition zalesak.h:94
Float x2
Definition zalesak.h:92
Float x3
Definition zalesak.h:92
static constexpr Float yc
Definition zalesak.h:95
Float perimeter() const
Definition zalesak.h:82
Float x5
Definition zalesak.h:92
Float operator()(const point &x) const
Float y2
Definition zalesak.h:92
static constexpr Float l
Definition zalesak.h:100
Float y3
Definition zalesak.h:92
Definition leveque.h:25
point operator()(const point &x) const
Definition leveque.h:26
static constexpr Float xc
Definition zalesak.h:36
static Float period()
Definition zalesak.h:29
u()
Definition zalesak.h:33
static constexpr Float yc
Definition zalesak.h:37
Float pi
Definition leveque.h:34