### 'Circle' object is not callable

286

views

0

Hi,

I've been writing a program to try and model the deformation of annular membrane under a load and electric field.

When running the code I get the error " 'Circle' object is not callable "

My issue seems to come from the inner(P, f)*ds term.

Any help would be appreciated.

My code is:

I've been writing a program to try and model the deformation of annular membrane under a load and electric field.

When running the code I get the error " 'Circle' object is not callable "

My issue seems to come from the inner(P, f)*ds term.

Any help would be appreciated.

My code is:

```
import os
import sys
from dolfin import *
from mshr import *
import numpy as np
parameters.form_compiler.quadrature_degree = 4
parameters["form_compiler"]["representation"] = "uflacs"
args = [sys.argv[0]] + """
--petsc.snes_max_it 100
--petsc.snes_atol 1.0e-7
--petsc.snes_rtol 1.0e-7
--petsc.snes_monitor
--petsc.snes_converged_reason
--petsc.ksp_type preonly
--petsc.pc_type lu
--petsc.pc_factor_mat_solver_package mumps
""".split()
parameters.parse(args)
# controlled parameters
B = 20e-3 # outer radius in m
A = 7.5e-3 # inner radius in m
weight = 1.0
P = Constant((0.0, 0.0, -weight)) # Load
E = 0 # Electric Field
# define mesh and finite element(s)
outer = Circle(Point(0.0, 0.0), B, 25)
inner = Circle(Point(0.0, 0.0), A, 25)
annulus = outer - inner
mesh = generate_mesh(annulus, 50)
# define the function space
V = VectorFunctionSpace(mesh, 'Lagrange', 1, 3)
# functions
v = TestFunction(V)
u = TrialFunction(V)
# tensors and energy
Grad_X = as_tensor([[1, 0],
[0, 1],
[0, 0]])
F = Grad_X + grad(u)
C = F.T*F
i = tr(C)
j = det(C)
mu = 1.0
energy_density = (mu/2.0)*(i - 2.0) + (E/2)*j
# define boundary and boundary condtion
def boundary(x, on_boundary):
return bool(x[0]*x[0]+x[1]*x[1] >= B - DOLFIN_EPS and on_boundary)
u_initial = Constant((0.0, 0.0, 0.0))
bc = DirichletBC(V, u_initial, boundary)
# variational form and energy minimisation
f = Expression(("x[0], x[1], x[2]"), degree = 1) # current configuration
form = energy_density*dx - inner(P, f)*ds
deriv = derivative(form, u, v)
J = derivative(deriv, u, du) # jacobian
```

Community: FEniCS Project

### 1 Answer

4

You redefine the UFL function 'inner' to be a 'Circle' object, and then use it in your form, hence the error.

Oh, I see now thanks.

written
13 months ago by
BW

Please login to add an answer/comment or follow this question.