# Error with bddc preconditioner

Dear,
I’m having problems using the “bddc” preconditioner for a mesh with many elements. It works correctly with a smaller number of elements, but when increasing it returns the following error:

in Assemble BilinearForm ‘biform_from_py’

part of the code:

h = 8
mesh = MakeStructured3DMesh(hexes=False, nx=h, ny=h, nz=h , mapping=lambda x, y, z: (0.3x, 0.3y, 0.3*z))
orderMesh = 1

refine=3
for i in range(refine):
mesh.Refine(2)

def dpole(loc,ng,n_pbo, pbo):

``````with TaskManager():
condense = False
precond="bddc"
# precond="local"
fes = VectorH1(mesh, order=orderMesh, dirichlet="bottom", complex=True)
u,v = fes.TnT()
fes.ndof
nz=fes.ndof
a = BilinearForm(fes, eliminate_internal=condense)
a += (InnerProduct(sigma(u), epsilon(v)) -rho * omega**2 * InnerProduct(u, v)) * dx
# compute auxiliaries problems
e11=[[1,0,0],[0,0,0],[0,0,0]]

htabR11=[]

for i in range(ng):
resR11= GridFunction(fes)

cx=loc[[i],[0]]
cy=loc[[i],[1]]
cz=loc[[i],[2]]

gdirX, gdirY, gdirZ = gdirac(cx,cy,cz)

sorX11 = ((e11[0][0]*gdirX+e11[0][1]*gdirY+e11[0][2]*gdirZ))
sorY11 = ((e11[1][0]*gdirX+e11[1][1]*gdirY+e11[1][2]*gdirZ))
sorZ11 = ((e11[2][0]*gdirX+e11[2][1]*gdirY+e11[2][2]*gdirZ))
force11 = CoefficientFunction((sorX11,sorY11,sorZ11))
del sorX11, sorY11, sorZ11

hR11 = LinearForm(force11*v*dx).Assemble()

del force11

c = Preconditioner(a, precond) # Register c to a BEFORE assembly
steps=[]

a.Assemble()
inv = CGSolver(a.mat, c.mat, maxsteps=1000)

resR11.vec.data = inv * hR11.vec
steps.append ( (fes.ndof, inv.GetSteps()) )
if fes.ndof < 15000:
Redraw()
htabR11.append(resR11.vec)
del resR11
``````

I’m lost in this error. Thanks for any help.
Best,
Andressa.

It’s easier to help if you provide a full reproducible example, my first guess would be that you are out of memory, but if you provide a minimal example we can have a look.

1 Like

Hi christopher, attached is a reproducible example.
Thanks!!

test_dpole.py (3.6 KB)

Hi, yes for 3 bisections I run out of my 96GB of RAM. If you run it on smth local, you are just out of memory.
Note that bddc is just a direct solve on lowest (p=1) elements, so you are using a direct inverse. Bddc just does something on higher order dofs.