How to find adjacent cells to internal facets in the latest version of Dolfin


134
views
0
4 months ago by
Hi, I am trying to evaluate the derivatives of a computed potential function at the cells adjacent to an interface, and I have not been successful in getting the adjacent cell objects from a specific facet in the newest version of Dolfin. My plan is to evaluate the derivatives of the shape functions, just the same way as done in 

https://fenicsproject.org/qa/8394/how-to-evaluate-higher-derivative-of-a-function-at-a-point/

I want to do it this way because I think it would be much cheaper than projecting the gradient of the function in all the domain, as I am only interested in the values of the gradient at the interface.

Here is what I did:

mesh = Mesh("DMESH7.xml")
boundaries = MeshFunction("size_t", mesh, "DMESH7_facet_region.xml")
domains = MeshFunction("size_t", mesh, "DMESH7_physical_region.xml")

D = mesh.topology().dim()
mesh.init(D-1,D)
mesh.init(D)

cellsAbove = []
cellsBelow = []

for facet in SubsetIterator(boundaries,1):
    cells = facet.entities(D)
    for ce in cells:
        cell = Cell(mesh,ce)
        if (cell.midpoint()[1] < facet.midpoint()[1]):
            cellsBelow.append(ce)
        else:
            cellsAbove.append(ce)​

This is the error that I am getting

File "/opt/project/mainDEF3.py", line 53, in <module>
cell = Cell(mesh,ce)
TypeError: 'MeshEntity' object is not callable
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
[0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to find memory corruption errors
[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run
[0]PETSC ERROR: to get more information on the crash.
application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0
[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=59
:
system msg for write_line failure : Bad file descriptor



Thanks a lot!

Ximo.
Community: FEniCS Project
Please login to add an answer/comment or follow this question.

Similar posts:
Search »