dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #04221
a question about dolfin
Hi!
My name is Pablo De Nápoli, I work at the Department of Mathematics atBuenos
Aires University, Argentina.
I'm new to Dolfin, and I'm planning to use for some numerical experiments in
my research. I think it is a very interesting software specially for
the close to the
mathematical-thinking way of representing the PDEs in weak formulation.
However, in my opinion, it is somewhat difficult to understand the
internal structures
of Dolfin (and I think it would be very useful if you could improve
the documentation
in this aspect, since an accurate and complete documentation is esential to
make a program like this really useful)
For example, I have tried to create simple program for plotting a function
(by modifying the Poisson example in the tutorial). My idea is not to solve any
PDE, just plotting a well know function to see how it looks both in Paraview
and in Mayavi (and compare it with Dolfin's output for some other examples).
Here is the code of my program...
#include <dolfin.h>
using namespace dolfin;
int main()
{
class Myfunction : public Function
{
real eval(const Point& p, unsigned int i)
{
real x= p.x();
real y= p.y();
return (x+y);
}
};
UnitSquare mesh(16, 16);
Myfunction f;
f.attach(mesh);
File file("f.pvd");
file << f;
return 0;
}
The idea was to create a user-defined function and plot it
(restricted to the mesh)
This program didn't work as I got the message...
*** Error: No finite element associated with function (an none can be
attached). [UserFunction.cpp:110: element()]
Could you please explain me what is wrong in this program?
User-defined functions can't be plotted? (exported to files?)
By the way, I think that the code in section 4.3.2 Dolfin's manual
(User-defined functions) is not correct
for example Instead of
class Source : public Function
{
real eval(const Point& p, unsigned int i)
{
return x*y*sin(z / DOLFIN_PI);
}
};
(this form of the code didn't work for me)
it should be
class Source : public Function
{
real eval(const Point& p, unsigned int i)
{
return p.x()*p.y()*sin(p.z() / DOLFIN_PI);
}
};
and likewise in the other examples in that section....
thank you,
best regards,
Pablo De Nápoli
Follow ups