Greetings,
I am trying to compute electrostatic calculations on a mesh containing 170135 vertices and 973248 cells, I am getting an error:
WARNING: user expression has not supplied value_shape method or an element. Assuming scalar element.
Solving linear variational problem.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
UMFPACK V5.7.8 (Nov 9, 2018): ERROR: out of memory
Traceback (most recent call last):
File "Python3.py", line 58, in <module>
fn.solve(a == L, u, bcs)
File "/home/tadask/anaconda3/envs/fenicsproject/lib/python3.8/site-packages/dolfin/fem/solving.py", line 220, in solve
_solve_varproblem(*args, **kwargs)
File "/home/tadask/anaconda3/envs/fenicsproject/lib/python3.8/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 /home/conda/feedstock_root/build_artifacts/fenics-pkgs_1575559212425/work/dolfin/dolfin/la/PETScKrylovSolver.cpp.
*** Process: 0
***
*** DOLFIN version: 2019.1.0
*** Git changeset: 77c758717da1cb8017bf95109363bb1a91a4f8e5
*** -------------------------------------------------------------------------
Here is the code I am using:
import fenics as fn
import numpy as np
epsilon_0 = 8.85e-12
mesh = fn.Mesh('Smaller_mesh.xml')
subdomains = fn.MeshFunction("size_t", mesh, 'Smaller_mesh_physical_region.xml')
boundaries = fn.MeshFunction('size_t', mesh, 'Smaller_mesh_facet_region.xml')
dx = fn.Measure('dx', domain=mesh, subdomain_data=subdomains)
V0 = fn.FunctionSpace(mesh, 'DG', 0)
V = fn.FunctionSpace(mesh, 'P', 1)
class permittivity(fn.UserExpression):
def __init__(self, markers, **kwargs):
self.markers = markers
super().__init__(**kwargs)
def eval_cell(self, values, x, cell):
if self.markers[cell.index] == 1:
values[0] = 5
elif self.markers[cell.index] == 4:
values[0] = 6
elif self.markers[cell.index] == 5:
values[0] = 10
elif self.markers[cell.index] == 5:
values[0] = 5
else:
values[0] = 1
eps = permittivity(subdomains, degree=1)
top = fn.DirichletBC(V, fn.Constant(0), boundaries, 3)
bottom = fn.DirichletBC(V, fn.Constant(3000), boundaries, 1)
bcs =[top, bottom]
permitivity = fn.project(eps, V0)
epsfile = fn.File('output6/e_eps.pvd')
epsfile << permitivity
u = fn.TrialFunction(V)
v = fn.TestFunction(V)
a = fn.dot(fn.grad(u), fn.grad(v)) * eps * fn.dx
L = fn.Constant(0) * v * fn.dx
u = fn.Function(V)
fn.solve(a == L, u, bcs)
electric_field = fn.project(-fn.grad(u))
potentialFile = fn.File('output6/potential.pvd')
potentialFile << u
e_fieldfile = fn.File('output6/e_field.pvd')
e_fieldfile << electric_field
Is there a way to overcome this issue?
Best wishes,
Ted