RecursionError: maximum recursion depth exceeded

Respected sir,

I am running my code on jupyter notebook. The code is correct but when I make higher refine mesh, I am getting error of this type
RecursionError: maximum recursion depth exceeded
Can you please help me with this?

Thank you

I am using these modules. I have used Permiability also but the same error is occuring

#from future import print_function
#from fenics import *
from dolfin import *
from mshr import *
from math import *
import time
import numpy as np
import sympy as sym
import ufl
import matplotlib.pyplot as plt
import time
print ( time.ctime ( time.time() ) )
print ( ‘’ )
import math
from numpy import zeros

class Permeability(UserExpression): # UserExpression instead of Expression
def init(self, markers, **kwargs):
super().init(**kwargs) # This part is new!
self.markers = markers
def eval_cell(self, values, x, cell):
if self.markers[cell.index] == 0:
values[0] = 4pi1e-7 # vacuum
elif self.markers[cell.index] == 1:
values[0] = 1e-5 # iron (should really be 6.3e-3)
else:
values[0] = 1.26e-6 # copper

Please format your code using markdown syntax, i.e

```python
def test(x):
    return x
```

Please also make sure that the code reproduces the error.

Sir I am still getting the same error

/usr/lib/python3/dist-packages/ufl/exproperators.py in _sub(self, o)
232 if not isinstance(o, _valid_types):
233 return NotImplemented
→ 234 return Sum(self, -o)
235
236

/usr/lib/python3/dist-packages/ufl/exproperators.py in _neg(self)
294 # TODO: Add Negated class for this? Might simplify reductions in Add.
295 def _neg(self):
→ 296 return -1 * self
297
298

/usr/lib/python3/dist-packages/ufl/exproperators.py in _rmul(self, o)
201 return NotImplemented
202 o = as_ufl(o)
→ 203 return _mult(o, self)
204
205

/usr/lib/python3/dist-packages/ufl/exproperators.py in _mult(a, b)
127 if r1 == 0 and r2 == 0:
128 # Create scalar product
→ 129 p = Product(a, b)
130 ti = ()
131

/usr/lib/python3/dist-packages/ufl/algebra.py in new(cls, a, b)
139 # Type checking
140 # Make sure everything is scalar
→ 141 if a.ufl_shape or b.ufl_shape:
142 error("Product can only represent products of scalars, "
143 “got\n\t%s\nand\n\t%s” % (ufl_err_str(a), ufl_err_str(b)))

/usr/lib/python3/dist-packages/ufl/core/ufl_type.py in _inherited_ufl_shape(self)
211 if inherit_shape_from_operand is not None:
212 def _inherited_ufl_shape(self):
→ 213 return self.ufl_operands[inherit_shape_from_operand].ufl_shape
214 cls.ufl_shape = property(_inherited_ufl_shape)
215

… last 1 frames repeated, from the frame below …

/usr/lib/python3/dist-packages/ufl/core/ufl_type.py in _inherited_ufl_shape(self)
211 if inherit_shape_from_operand is not None:
212 def _inherited_ufl_shape(self):
→ 213 return self.ufl_operands[inherit_shape_from_operand].ufl_shape
214 cls.ufl_shape = property(_inherited_ufl_shape)
215

RecursionError: maximum recursion depth exceeded

I haven’t given you any pointers as to how to solve your problem yet. I am simply asking you to make sure that the forum post is properly formatted, and that the code you post can reproduce your error message.

1 Like

Yes sir, I have formatted the code. Now I am not getting that error.

If I increase the domain size I am getting

A directory with files to reproduce the jit build failure has been created.

Can you please help me with this?

You still haven’t formatted the code in markdown syntax or provided a minimal working example