Hi every one
The error of stokes problem with mini element has obsessed me. I have not fixed it. The error exists. When I run the code, the error appears:
evaluate_dof(s) for enriched element not implemented.
Could you give some suggestions? Any comments are appreciated.
Stokes.ufl code:
P1 = VectorElement("Lagrange", triangle, 1)
B = VectorElement("Bubble", triangle, 3)
Q = FiniteElement("Lagrange", triangle, 1)
MixElement = (P1 + B) * Q
f=Coefficient (P1)
(u, p) = TrialFunctions(MixElement)
(v, q) = TestFunctions(MixElement)
a=inner (grad(u), grad(v))*dx - p*div(v)*dx + q*div(u)*dx
L=inner(f,v)*dx
My main cpp:
#include <dolfin.h>
#include "Stokes.h"
using namespace dolfin;
class Source : public Expression
{
public:
Source() : Expression(2) {}
void eval(Array<double>& values, const Array<double>& x) const
{
values[0] = -20.0*x[1]*x[1]*x[1] +20.0 * (2*x[1]-1);
values[1] = -20.0*x[0]*x[0]*x[0] +20.0 * (2*x[0]-1);
}
};
// Exact solution velocity
class ExactSolutionVelocity : public Expression
{
public:
ExactSolutionVelocity() : Expression(2) {}
void eval(Array<double>& values, const Array<double>& x) const
{
values[0] = x[1]*x[1]*x[1]*x[1]*x[1];
values[1] = x[0]*x[0]*x[0]*x[0]*x[0];
}
};
// Exact solution pressure
class ExactSolutionPressure : public Expression
{
public:
void eval(Array<double>& values, const Array<double>& x) const
{
values[0] = 10.0*(2*x[0]-1) * (2*x[1]-1);
}
};
class DirichletBoundary : public SubDomain
{
bool inside(const Array<double>& x, bool on_boundary) const
{
return on_boundary;
}
};
int main()
{
int n=64;
UnitSquareMesh mesh(n,n);
Stokes:: FunctionSpace W(mesh);
SubSpace W0(W,0);
SubSpace W1(W,1);
DirichletBoundary boundary;
ExactSolutionVelocity u_boundary;
DirichletBC bc(W0, u_boundary, boundary);
Source f;
Stokes:: BilinearForm a(W,W);
Stokes:: LinearForm L(W);
L.f=f;
Function w(W);
solve(a==L, w, bc);
Function u = w[0];
Function p = w[1];
return 0;
}