This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Error: ufl.log.UFLException: Invalid subdomain_id. in project()

–2 votes

Hi,

i calculted the solution from the incompressible Navier-Stokes-Equation on a 2D-mesh and without time-dependencies.

When i use du1dx1 = project(nabla_grad(u)[0,0], Q, "gmres", prec)
with Q = FunctionSpace(mesh, "CG", 1) and prec = "amg" if has_krylov_solver_preconditioner("amg") else "default", i get the error:

ufl.log.UFLException: Invalid subdomain_id.

For the last calculations, it works fine.Now i only changed the mesh and get this error.
Earlier i used the PolygonalMeshGenerator and it was fine. Now i generate my own mesh:

mesh = Mesh()
editor = MeshEditor()
editor.open(mesh,2,2)
editor.init_vertices(len(Vertex_list))
editor.init_cells(len(Cell_list))

for i in range(len(Vertex_list)):
    editor.add_vertex(Vertex_list[i][0], Vertex_list[i][1], Vertex_list[i][2])

for j in range(len(Cell_list)):
    editor.add_cell(j, Cell_list[j][0], Cell_list[j][1], Cell_list[j][2])

editor.close()

I saved it to .xml and load it in another script. Did i need to initialize something on the mesh, before project?

Thx for help

asked Oct 30, 2014 by MrCoffeee FEniCS Novice (230 points)

Not sure why the votes go down.
When i only use du1dx1 = project(grad(u)[0,0], Q), then i get the following error:

-Calculate New Boundary
Solving linear system of size 492811 x 492811 (PETSc Krylov solver).
Traceback (most recent call last):
...
du1dx1 = project(grad(u)[0,0], Q)
File "/usr/lib/python2.7/dist-packages/dolfin/fem/projection.py", line 113, in project
cpp.la_solve(A, Pv.vector(), b, solver_type, preconditioner_type)
File "/usr/lib/python2.7/dist-packages/dolfin/cpp/la.py", line 3935, in la_solve
return _la.la_solve(*args)
RuntimeError:

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at


*** fenics@fenicsproject.org


*** Remember to include the error message listed below and, if possible,
*** include a minimal running example to reproduce the error.


*** -------------------------------------------------------------------------
*** Error: Unable to successfully call PETSc function 'KSPSolve'.
*** Reason: PETSc error code is: 73.
*** Where: This error was encountered inside /build/buildd/dolfin-1.4.0+dfsg/dolfin/la/PETScKrylovSolver.cpp.
*** Process: unknown


*** DOLFIN version: 1.4.0
*** Git changeset: unknown
*** -------------------------------------------------------------------------

After the print-command for -Calculate New Boundary, there is no more code before the project-command. So the output Solving linear system of size 492811 x 492811 (PETSc Krylov solver) indicates that the command at least starts.
I tried different solveroptions without success and i really cant find something usefull to fix it.

1 Answer

0 votes

You are seeing an error from UFL. Post complete working (but simple) code.

answered Nov 5, 2014 by Garth N. Wells FEniCS Expert (35,930 points)
...