Residual error for big mess (||r|| = 0.000000e+00)

Hi,

I have a problem with my program when it comes to big mesh.
I run the program below for permeability 1.3610**(-9) to 1.3610**(3), the error occurs only when the value is >= 1.36*10**(-1). Everything works fine for a small mesh. The mesh has been generated from Gmsh.

A small part of the program:

# Function spaces
V = VectorElement("Lagrange", mesh.ufl_cell(), 2)
Q = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
TH = V * Q
W = FunctionSpace(mesh, TH)

K_p = 1.36*10**(-1)
K_interface = 1.36*10**(-1) 
K_wall = 1.36*10**(-9) 
mu = 0.00496
(u, p) = TrialFunctions(W)
(v, q) = TestFunctions(W)
a = (2*mu*inner(epsilon(u), epsilon(v)) + div(v) * p + q * div(u)) * dx(mark["v_domain"]) \
    + ((mu/ K_p) * inner(u, v) + inner(grad(p), v) + q * div(u)) * dx(mark["p_domain"]) \
    + ((mu/ K_wall) * inner(u, v) + inner(grad(p), v) + q * div(u)) * dx(mark["wall_domain"]) \
    + ((mu/ K_interface) * inner(u, v) + inner(grad(p), v) + q * div(u)) * dx(mark["interface_domain"])
    + (p*inner(v,n_s))*ds(mark["v_domain"])
L = inner(f_p, v) * ds(mark["p_domain"]) + inner(f_v, v) * ds(mark["v_domain"])
w = Function(W)
solve(a == L, w, bcs)
(u, p) = w.split(True)

And the error:

Traceback (most recent call last):
  File "case_2_2d.py", line 143, in <module>
    solve(a==L, w, bcs)
  File "/cluster/shared/fenics/nobackup/install/fenics-2019.1.0-2020-02-19/lib/python3.6/site-packages/dolfin/fem/solving.py", line 220, in solve
    _solve_varproblem(*args, **kwargs)
  File "/cluster/shared/fenics/nobackup/install/fenics-2019.1.0-2020-02-19/lib/python3.6/site-packages/dolfin/fem/solving.py", line 247, in _solve_varproblem
    solver.solve()
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-support@googlegroups.com
***
*** 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: 76 (Error in external library).
*** Where:   This error was encountered inside /cluster/shared/fenics/nobackup/build/fenics-2019.1.0-2020-02-19/dolfin/dolfin/la/PETScKrylovSolver.cpp.
*** Process: 0
***
*** DOLFIN version: 2019.1.0
*** Git changeset:  86617f912d4035520fa988d6af07a19d6069d5ee
*** -------------------------------------------------------------------------

Thank you in advance.

This error usually means that you are running out of memory. Try using iterative solvers or mumps. See for instance: Solving PDEs in Minutes - <br> The FEniCS Tutorial Volume I

Thanks for the answer.

I’m running the program in an HPC, so memory should not be an issue.
I have tried with mumps, preconditioners and parallel but still the same error.

any other tips?

Other things that helps on the assembly side is to wrap all scalar values as Constants, as it saves you from recompiling every time you change a parameter. I would carefully monitor the memory usage of your program, and at least use mumps. Especially since it works on a smaller mesh. It might be that you are hitting umfpacks 4 GB limit: https://fenicsproject.org/qa/4177/reason-petsc-error-code-is-76/

I had a similar issue with same error output. The reason is my huge mesh (DOF>100M) has several zero volume elements. You can use below code to check

import fenics as fe
# load mesh to fe_mesh
vols = [cell.volume() for cell in fe.cells(fe_mesh)] # get volumes
vol_st = sorted(tuple(zip(vols, range(len(vols))))) # sort from smallest to largest
for ver in fe.vertices(fe.Cell(fe_mesh, vol_st[0][1])): # print out the smallest element
    print(ver.point()[:], end=', ')
print(vol_st[0])

Ming

1 Like