dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #22802
[Bug 769324] Re: Overloading eval_cell fails in demo4.py
I seem to have fixed it. Replacing the subclass with the following
raises no problems and generates plots that are similar to the ones
given in the example. I have also attached the entire script. Sorry if
the formatting is not good, I am new to launchpad and I don't know if
there are special tags for code.
class BoundarySource(Expression):
def __init__(self, mesh):
self.mesh = mesh
def eval_data(self, values, data):
cell = Cell(self.mesh, data.cell().index())
n = cell.normal(data.facet())
x = data.x()
g = sin(5*x[0])
values[0] = g*n[0]
values[1] = g*n[1]
def value_shape(self):
return (2,)
def dim(self):
return 2
If this can be updated on the website then that would be great!
** Attachment added: "demo4.py"
https://bugs.launchpad.net/dolfin/+bug/769324/+attachment/2085560/+files/demo4.py
--
You received this bug notification because you are a member of DOLFIN
Team, which is subscribed to DOLFIN.
https://bugs.launchpad.net/bugs/769324
Title:
Overloading eval_cell fails in demo4.py
Status in DOLFIN:
New
Bug description:
When running demo4.py (which demonstrates the mixed formulation) I get
the following traceback:
Traceback (most recent call last):
File "demo4.py", line 50, in <module>
class BoundarySource(Expression):
File "/usr/lib/python2.6/dist-packages/dolfin/function/expression.py", line 221, in __new__
raise TypeError, "expected an overload 'eval' or 'eval_data' method"
TypeError: expected an overload 'eval' or 'eval_data' method
This is installed on Ubuntu 10.10. If you need any more information,
please let me know.
I learned about FEniCS recently at a conference and I am interested in
using it to solve a nonlinear problem which is best solved in the
mixed formulation, so this example is of particular importance to me.
References