Loading...
Searching...
No Matches
torus.icc

The torus benchmark – level set, right-hand-side and exact solution.

The torus benchmark – level set, right-hand-side and exact solution

static const Float R = 1;
static const Float r = 0.6;
Float phi (const point& x) {
return sqr(sqrt(sqr(x[0])+sqr(x[1]))-sqr(R)) + sqr(x[2])-sqr(r);
}
void get_torus_coordinates (const point& x,
Float& rho, Float& theta, Float& phi) {
static const Float pi = acos(Float(-1));
rho = sqrt(sqr(x[2]) + sqr(sqrt(sqr(x[0]) + sqr(x[1])) - sqr(R)));
phi = atan2(x[1], x[0]);
theta = atan2(x[2], sqrt(sqr(x[0]) + sqr(x[1])) - R);
}
struct u_exact {
Float operator() (const point& x) const {
Float rho, theta, phi;
get_torus_coordinates (x, rho, theta, phi);
return sin(3*phi)*cos(3*theta+phi);
}
u_exact (size_t d=3) {}
};
struct f {
Float operator() (const point& x) const {
Float rho, theta, phi;
get_torus_coordinates (x, rho, theta, phi);
Float fx = (9*sin(3*phi)*cos(3*theta+phi))/sqr(r)
- (-10*sin(3*phi)*cos(3*theta+phi) - 6*cos(3*phi)*sin(3*theta+phi))
/sqr(R + r*cos(theta))
- (3*sin(theta)*sin(3*phi)*sin(3*theta+phi))
/(r*(R + r*cos(theta)));
return fx;
}
f (size_t d=3) {}
};
Float
see the Float page for the full documentation
point
see the point page for the full documentation
f
Definition cavity_dg.h:29
f::d
size_t d
Definition cosinusprod_dirichlet.h:30
f::operator()
point operator()(const point &x) const
Definition cavity_dg.h:30
f::f
f()
Definition taylor.h:34
phi
Definition phi.h:25
phi::r
Float r
Definition phi.h:54
u_exact
Definition interpolate_RTk_polynom.icc:125
u_exact::d
size_t d
Definition interpolate_RTk_polynom.icc:145
u_exact::operator()
point operator()(const point &x) const
Definition interpolate_RTk_polynom.icc:126
get_torus_coordinates
void get_torus_coordinates(const point &x, Float &rho, Float &theta, Float &phi)
Definition torus.icc:30