Loading...
Searching...
No Matches
zalesak.h

The Zalesak slotted disk benchmark – the exact solution.

The Zalesak slotted disk benchmark – the exact solution

struct u {
point operator() (const point& x) const {
return point(-0.5*(x[1]-yc), 0.5*(x[0]-xc));
}
static Float period() {
Float pi = acos (Float(-1));
return 4*pi;
}
u() {}
protected:
static constexpr Float
xc = 0.5, // rotation center
yc = 0.5;
};
struct phi_exact {
Float operator() (const point& x) const {
Float xm = xc + cos(0.5*t)*(x[0]-xc) + sin(0.5*t)*(x[1]-yc);
Float ym = yc - sin(0.5*t)*(x[0]-xc) + cos(0.5*t)*(x[1]-yc);
Float d0 = sqrt((xm-x0)*(xm-x0) + (ym-y0)*(ym-y0)) - r;
if (d0 >= 0) {
Float d2 = sqrt(sqr(xm-x2) + sqr(ym-y2));
Float d3 = sqrt(sqr(xm-x3) + sqr(ym-y3));
if (fabs(xm-x0) < w/2 && ym < y2) {
return min(d2,d3);
} else {
return min(d2,min(d3,d0));
}
}
else {
if (ym < y4) {
if (xm < x2) {
Float d1 = xm - x2;
return max(d0,d1);
} else if (xm > x3) {
Float d1 = x3 - xm;
return max(d0,d1);
} else {
Float d1 = xm - x2;
Float d2 = x3 - xm;
Float d3 = y4 - ym;
return min(d1,min(d2,d3));
}
} else {
Float d1 = sqrt(sqr(xm-x4) + sqr(ym-y4));
Float d2 = sqrt(sqr(xm-x5) + sqr(ym-y5));
if (xm < x2) {
return max(d0,-d1);
} else if (xm > x3) {
return max (d0,-d2);
} else {
Float d3 = y4 - ym;
return max(d3,d0);
}
}
}
}
phi_exact (Float t1);
Float perimeter() const {
Float pi = acos(Float(-1));
Float d24 = sqrt(sqr(x4-x2) + sqr(y4-y2));
Float d45 = w;
Float d53 = d24;
Float theta = asin(0.5*w/r);
Float arc32 = (2*pi - theta)*r;
return d24 + d45 + d53 + arc32;
}
protected:
Float t, x2, y2, x3, y3, x4, y4, x5, y5;
static constexpr Float
xc = 0.5, // rotation center
yc = 0.5,
x0 = 0.50, // circle center
y0 = 0.75,
r = 0.15, // circle radius
w = 0.05, // slot width
l = 0.25; // slot length
};
inline
phi_exact::phi_exact (Float t1)
: t (t1),
x2 (x0 - w/2),
y2 (y0 - sqrt(r*r - (w/2)*(w/2))),
x3 (x0 + w/2),
y3 (y2),
x4 (x2),
y4 (y0 + l - r),
x5 (x3),
y5 (y4)
{}
struct phi0 {
Float operator() (const point& x) const { return _phi(x); }
phi0() : _phi(0) {}
phi_exact _phi;
};
Float
see the Float page for the full documentation
point
see the point page for the full documentation
phi0
Definition leveque.h:37
phi0::phi0
phi0()
Definition zalesak.h:116
phi0::_phi
phi_exact _phi
Definition zalesak.h:117
phi0::operator()
Float operator()(const point &x) const
Definition leveque.h:38
phi_exact
Definition transport_dg2.h:30
phi_exact::x4
Float x4
Definition zalesak.h:92
phi_exact::x0
static constexpr Float x0
Definition zalesak.h:96
phi_exact::y5
Float y5
Definition zalesak.h:92
phi_exact::r
static constexpr Float r
Definition zalesak.h:98
phi_exact::y0
static constexpr Float y0
Definition zalesak.h:97
phi_exact::y4
Float y4
Definition zalesak.h:92
phi_exact::phi_exact
phi_exact(Float w1)
Definition transport_dg2.h:32
phi_exact::t
Float t
Definition zalesak.h:92
phi_exact::xc
static constexpr Float xc
Definition zalesak.h:94
phi_exact::x2
Float x2
Definition zalesak.h:92
phi_exact::x3
Float x3
Definition zalesak.h:92
phi_exact::w
Float w
Definition transport_dg2.h:33
phi_exact::yc
static constexpr Float yc
Definition zalesak.h:95
phi_exact::perimeter
Float perimeter() const
Definition zalesak.h:82
phi_exact::x5
Float x5
Definition zalesak.h:92
phi_exact::operator()
Float operator()(const point &x) const
Definition transport_dg2.h:31
phi_exact::y2
Float y2
Definition zalesak.h:92
phi_exact::l
static constexpr Float l
Definition zalesak.h:100
phi_exact::y3
Float y3
Definition zalesak.h:92
u
Definition leveque.h:25
u::operator()
point operator()(const point &x) const
Definition leveque.h:26
u::xc
static constexpr Float xc
Definition zalesak.h:36
u::period
static Float period()
Definition leveque.h:32
u::u
u()
Definition zalesak.h:33
u::yc
static constexpr Float yc
Definition zalesak.h:37
u::pi
Float pi
Definition leveque.h:34