project/interpolate crashes in parallell for overlapping meshes of different size

Bug #1047430 reported by Mikael Mortensen
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
DOLFIN
Confirmed
Undecided
Unassigned

Bug Description

 It seems like it's not possible to interpolate from one functionspace into another where the only difference between the two is the number of elements on each mesh. I suppose this is the same error as when trying to use eval(x) in parallel and the point x can only be on one processor and thus the other processes throws an error. I'm sure you're already aware of this, but I couldn't find a similar bug report and this is quite important for using gradually refined meshes in a turbulence benchmark I'm working on.

The following code works with a single processor, but fails in parallel

from dolfin import *
#parameters['allow_extrapolation'] = True # Helps but leads to very poor results

mesh = UnitSquare(4 4)
V = FunctionSpace(mesh, 'CG', 1)
u = interpolate(Expression("sin(2*pi*x[0]) * cos(2*pi*x[1])"), V)

mesh2 = UnitSquare(6, 6)
V2 = FunctionSpace(mesh2, 'CG', 1)
u2 = project(u, V2)

Error message:

mpirun -np 2 python test_interpolate.py
Process 0: Number of global vertices: 25
Process 0: Number of global cells: 32
Process 0: Partitioned mesh, edge cut is 4.
Process 1: Partitioned mesh, edge cut is 4.
Process 0: Number of global vertices: 49
Process 0: Number of global cells: 72
Process 1: Partitioned mesh, edge cut is 6.
Process 0: Partitioned mesh, edge cut is 6.
Traceback (most recent call last):
  File "test_interpolate.py", line 11, in <module>
    u2 = project(u, V2)
  File "/home/mikael/Fenics/dorsal/precise/unstable/lib/python2.7/site-packages/dolfin/fem/projection.py", line 104, in project
    form_compiler_parameters=form_compiler_parameters)
  File "/home/mikael/Fenics/dorsal/precise/unstable/lib/python2.7/site-packages/dolfin/fem/assembling.py", line 289, in assemble_system
Traceback (most recent call last):
  File "test_interpolate.py", line 11, in <module>
    u2 = project(u, V2)
  File "/home/mikael/Fenics/dorsal/precise/unstable/lib/python2.7/site-packages/dolfin/fem/projection.py", line 104, in project
    form_compiler_parameters=form_compiler_parameters)
  File "/home/mikael/Fenics/dorsal/precise/unstable/lib/python2.7/site-packages/dolfin/fem/assembling.py", line 289, in assemble_system
    finalize_tensor)
    finalize_tensor)
  File "/home/mikael/Fenics/dorsal/precise/unstable/lib/python2.7/site-packages/dolfin/cpp/fem.py", line 2324, in assemble_system
  File "/home/mikael/Fenics/dorsal/precise/unstable/lib/python2.7/site-packages/dolfin/cpp/fem.py", line 2324, in assemble_system
    return _fem.assemble_system(*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
***
*** https://answers.launchpad.net/dolfin
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to evaluate function at point.
*** Reason: The point is not inside the domain. Consider setting "allow_extrapolation" to allow extrapolation.
*** Where: This error was encountered inside Function.cpp.
*** Process: 1
*** -------------------------------------------------------------------------

Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 64, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
    from apport.report import Report
  File "/usr/lib/python2.7/dist-packages/apport/report.py", line 18, in <module>
    import problem_report
  File "/usr/lib/python2.7/dist-packages/problem_report.py", line 14, in <module>
    import zlib, base64, time, sys, gzip, struct, os
  File "/usr/lib/python2.7/gzip.py", line 10, in <module>
    import io
  File "/usr/lib/python2.7/io.py", line 63, in <module>
    from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,
ImportError: cannot import name DEFAULT_BUFFER_SIZE

Original exception was:
Traceback (most recent call last):
  File "test_interpolate.py", line 11, in <module>
    u2 = project(u, V2)
  File "/home/mikael/Fenics/dorsal/precise/unstable/lib/python2.7/site-packages/dolfin/fem/projection.py", line 104, in project
    form_compiler_parameters=form_compiler_parameters)
  File "/home/mikael/Fenics/dorsal/precise/unstable/lib/python2.7/site-packages/dolfin/fem/assembling.py", line 289, in assemble_system
    finalize_tensor)
  File "/home/mikael/Fenics/dorsal/precise/unstable/lib/python2.7/site-packages/dolfin/cpp/fem.py", line 2324, in assemble_system
    return _fem.assemble_system(*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
***
*** https://answers.launchpad.net/dolfin
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to evaluate function at point.
*** Reason: The point is not inside the domain. Consider setting "allow_extrapolation" to allow extrapolation.
*** Where: This error was encountered inside Function.cpp.
*** Process: 1
*** -------------------------------------------------------------------------

    return _fem.assemble_system(*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
***
*** https://answers.launchpad.net/dolfin
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to evaluate function at point.
*** Reason: The point is not inside the domain. Consider setting "allow_extrapolation" to allow extrapolation.
*** Where: This error was encountered inside Function.cpp.
*** Process: 0
*** -------------------------------------------------------------------------

Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 64, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
    from apport.report import Report
  File "/usr/lib/python2.7/dist-packages/apport/report.py", line 18, in <module>
    import problem_report
  File "/usr/lib/python2.7/dist-packages/problem_report.py", line 14, in <module>
    import zlib, base64, time, sys, gzip, struct, os
  File "/usr/lib/python2.7/gzip.py", line 10, in <module>
    import io
  File "/usr/lib/python2.7/io.py", line 63, in <module>
    from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,
ImportError: cannot import name DEFAULT_BUFFER_SIZE

Original exception was:
Traceback (most recent call last):
  File "test_interpolate.py", line 11, in <module>
    u2 = project(u, V2)
  File "/home/mikael/Fenics/dorsal/precise/unstable/lib/python2.7/site-packages/dolfin/fem/projection.py", line 104, in project
    form_compiler_parameters=form_compiler_parameters)
  File "/home/mikael/Fenics/dorsal/precise/unstable/lib/python2.7/site-packages/dolfin/fem/assembling.py", line 289, in assemble_system
    finalize_tensor)
  File "/home/mikael/Fenics/dorsal/precise/unstable/lib/python2.7/site-packages/dolfin/cpp/fem.py", line 2324, in assemble_system
    return _fem.assemble_system(*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
***
*** https://answers.launchpad.net/dolfin
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to evaluate function at point.
*** Reason: The point is not inside the domain. Consider setting "allow_extrapolation" to allow extrapolation.
*** Where: This error was encountered inside Function.cpp.
*** Process: 0
*** -------------------------------------------------------------------------

Revision history for this message
Jan Blechta (blechta) wrote :

I think the behaviour of parameters['allow_extrapolation']=True maybe requires a revision. My opinion is that it should allow only extrapolation out of a global mesh not outside a partition.

Current behaviour reflects practical point of view - when process does not know some value it extrapolates. But from mathematical point of view it should be guaranteed that user's program behaves consistently if run by 1 or more processes (at least in the case of a single-instruction code like in the bug description). Also like Mikael noted it computes rubbish when extrapolating between partitions.

Jan

Jan Blechta (blechta)
Changed in dolfin:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.