12 #include "../../mfem.hpp"
23 double ring_radius = 0.2;
24 if (type == 1 || type == 2)
26 double dx = x(0) - 0.5,
31 double dz = x(2) - 0.5;
34 rv = rv > 0 ? pow(rv, 0.5) : 0;
35 return rv - ring_radius;
43 const int num_circ = 3;
44 double rad[num_circ] = {0.3, 0.15, 0.2};
45 double c[num_circ][2] = { {0.6, 0.6}, {0.3, 0.3}, {0.25, 0.75} };
47 const double xc = x(0), yc = x(1);
50 double r0 = (xc-c[0][0])*(xc-c[0][0]) + (yc-c[0][1])*(yc-c[0][1]);
51 r0 = (r0 > 0) ? std::sqrt(r0) : 0.0;
52 if (r0 <= 0.2) {
return -1.0; }
54 for (
int i = 0; i < num_circ; i++)
56 double r = (xc-c[i][0])*(xc-c[i][0]) + (yc-c[i][1])*(yc-c[i][1]);
57 r = (r > 0) ? std::sqrt(r) : 0.0;
58 if (r <= rad[i]) {
return 1.0; }
62 if (0.7 <= xc && xc <= 0.8 && 0.1 <= yc && yc <= 0.8) {
return 1.0; }
65 if (0.3 <= xc && xc <= 0.8 && 0.15 <= yc && yc <= 0.2) {
return 1.0; }
70 MFEM_ABORT(
" Function type not implement yet.");
90 if (dist >= 0.) {
return 1.; }
105 using VectorCoefficient::Eval;
114 if (type == 1 || type == 2)
117 for (
int i = 0; i <
dim; i++) {
p(i) = 0.5 - x(i); }
118 double length = p.
Norml2();
139 return pow(x(0), xy_p) + pow(x(1), xy_p);
144 return 1./(M_PI*M_PI)*std::sin(M_PI*x(0)*x(1));
157 double coeff = std::max(xy_p*(xy_p-1), 1.);
158 double expon = std::max(0., xy_p-2);
165 return -coeff*std::pow(x(0), expon) - coeff*std::pow(x(1), expon);
171 return std::sin(M_PI*x(0)*x(1))*(x(0)*x(0)+x(1)*x(1));
double rhs_fun_circle(const Vector &x)
f for the Poisson problem (-nabla^2 u = f).
Base class for vector Coefficients that optionally depend on time and space.
void SetSize(int s)
Resize the vector to size s.
double Norml2() const
Returns the l2 norm of the vector.
int Size() const
Returns the size of the vector.
double dirichlet_velocity_xy_exponent(const Vector &x)
double dirichlet_velocity_circle(const Vector &x)
Boundary conditions.
virtual void Eval(Vector &p, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
Distance vector to the zero level-set.
Level set coefficient - +1 inside the domain, -1 outside, 0 at the boundary.
Dist_Vector_Coefficient(int dim_, int type_)
double rhs_fun_xy_sinusoidal(const Vector &x)
double p(const Vector &x, double t)
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient in the element described by T at the point ip.
Dist_Level_Set_Coefficient(int type_)
double rhs_fun_xy_exponent(const Vector &x)
Class for integration point with weight.
double dirichlet_velocity_xy_sinusoidal(const Vector &x)
double dist_value(const Vector &x, const int type)