pmgbergen / porepy

Python Simulation Tool for Fractured and Deformable Porous Media

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Numba error while exporting to paraview (trying to reproduce an example from an article)

mkondratyev85 opened this issue · comments

I'm trying to reproduce an example from an article "PorePy: an open-source software for simulation of multiphysicsprocesses" https://doi.org/10.1007/s10596-020-10002-5.

Here is the code given in the Fig 7.

import porepy as pp
import numpy as np
from scipy.sparse.linalg import spsolve

f1 = pp.Fracture(np.array([[0,1,1,0], [0,0,1,1], [0,0,0,0]]))
f2 = pp.Fracture(np.array([[0,0,0,0], [0,1,1,0], [0,0,1,1]]))
network = pp.FractureNetwork3d([f1, f2])

gb = network.mesh({'mesh_size_frac': 0.1,
                   'mesh_size_bond': 1,
                   'mesh_size_min': 0.01,
                   })

diffusion_discr = pp.Mpfa('flow')
accumulation_discr = pp.MassMatrix('flow')
for g, d in gb:
    pp.initialize_default_data(g, d, 'flow')
    d[pp.PRIMARY_VARIABLES] = {'p': {'cells': 1}}
    d[pp.DISCRETIZATION] = {'p': {'accumulation': accumulation_discr,
                                  'diffusion': diffusion_discr}}

for e, d in gb.edges():
    g_l, g_h = gb.nodes_of_edge(e)
    mg = d['mortar_grid']
    data = {'normal_diffusivity': 1}
    pp.initialize_data(mg, d, 'flow', data)
    d[pp.PRIMARY_VARIABLES] = {'mortar_flux': {'cells': 1}}
    interface_discr = pp.RobinCoupling(
            'flow',
            diffusion_discr,
            diffusion_discr)
    d[pp.COUPLING_DISCRETIZATION] = {
            'interface_flux': {
                g_h: ('p', 'diffusion'),
                g_l: ('p', 'diffusion'),
                e: ('mortar_flux', interface_discr)
                }
            }

assembler = pp.Assembler(gb)
assembler.discretize()
A, b = assembler.assemble_matrix_rhs()

p = spsolve(A, b)
assembler.distribute_variable(p)

paraview_exporter = pp.Exporter(gb, file_name= 'foo')
paraview_exporter.write_vtk('p')

On one of the last line when exporting to paraview I get the following error:

  File "/home/user/.local/lib/python3.8/site-packages/numba/core/byteflow.py", line 772, in op_CALL_FUNCTION_EX
    raise UnsupportedError(errmsg)
numba.core.errors.UnsupportedError: Failed in nopython mode pipeline (step: analyzing bytecode)
CALL_FUNCTION_EX with **kwargs not supported

What could it be?

Sounds like a compatibility issue with numba. Which version of numba, numpy and python do you have, and how updated is your PorePy install?

It's Ubuntu 19.10.
python 3.8.3
numba 0.50.1
numpy 1.19.5

Numba and Numpy were installed via pip

Thanks; I can reproduce the error. No idea what happened, but I will investigate, and give updates here.

@mkondratyev85 can you please pull latest version of PorePy (after #514 was merged) and then try?

It seems the error was introduced when we added some logging functionality a few weeks ago.

Thank you for help. It works now. I just had do change write_vtk to write_vtu on the last line.

Oh yead, that's another recent minor change to the code.

Thanks a lot for reporting this!

Resolved by #514