Well, it works awhile but stops at some point with an error: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/master/firedrake/lib/python2.7/site-packages/firedrake/solving.py", line 120, in solve _solve_varproblem(*args, **kwargs) File "/Users/master/firedrake/lib/python2.7/site-packages/firedrake/solving.py", line 145, in _solve_varproblem options_prefix=options_prefix) File "/Users/master/firedrake/lib/python2.7/site-packages/firedrake/variational_solver.py", line 232, in __init__ super(LinearVariationalSolver, self).__init__(*args, **kwargs) File "/Users/master/firedrake/lib/python2.7/site-packages/firedrake/variational_solver.py", line 118, in __init__ if ctx.is_mixed: File "/Users/master/firedrake/lib/python2.7/site-packages/firedrake/solving_utils.py", line 152, in is_mixed return self._jacs[-1]._M.sparsity.shape != (1, 1) File "/Users/master/firedrake/lib/python2.7/site-packages/firedrake/function.py", line 248, in __getattr__ return getattr(self._data, name) AttributeError: 'CoordinatelessFunction' object has no attribute '_M' On 17 December 2015 at 15:38, Lawrence Mitchell < lawrence.mitchell@imperial.ac.uk> wrote:
On 17/12/15 14:34, Angwenyi David wrote:
Dear all,
I have had an error while trying to solve the Helmholtz eqn on Icosahedral grids. The code used is:
from firedrake import * m = IcosahedralSphereMesh(radius=3, refinement_level=3) mesh = ExtrudedMesh(m, 5, layer_height=0.1, extrusion_type='radial') horiz_elt = FiniteElement("CG", triangle, 1) vert_elt = FiniteElement("CG", interval, 1) elt = OuterProductElement(horiz_elt, vert_elt) V = FunctionSpace(mesh, elt) u = TrialFunction(V) v = TestFunction(V) f = Function(V) f.interpolate(Expression("(2*x[0])+(sin(3*x[1]))+(cos(0.5*x[2]))"))
Coefficient(FunctionSpace(Mesh(OuterProductVectorElement(OuterProductElement(FiniteElement('Lagrange',
triangle, 1), FiniteElement('Lagrange', interval, 1), OuterProductCell(triangle, interval)), dim=3), 4), OuterProductElement(FiniteElement('Lagrange', triangle, 1), FiniteElement('Lagrange', interval, 1), OuterProductCell(triangle, interval))), 3)
a = (dot(grad(v), grad(u)) + v * u) * dx L = f * v * dx solve(a == L, u, solver_parameters={'ksp_type': 'cg'}) ...
RuntimeError: Expecting second argument to be a Coefficient
You need to redefine "u" to be a Function (or Coefficient) rather than a TrialFunction:
u = Function(V) solve(a == L, u, ...)
should work.
Cheers,
Lawrence
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake