How can I find the eigenvalues of epsilon
?
W = VectorFunctionSpace(mesh, 'CG', 1)
u = TrialFunction(W)
def epsilon(u):
return sym(grad(u))
def e2p(u):
mateps = PETScMatrix()
assemble(epsilon(u), tensor=mateps)
eigensolver = SLEPcEigenSolver(mateps)
eigensolver.solve()
r0 = eigensolver.get_eigenvalue(0)
r1 = eigensolver.get_eigenvalue(1)
r0p = (r0 + abs(r0))/2.0
r1p = (r1 + abs(r1))/2.0
return r0p*r0p + r1p*r1p
The code above gives the following error:
Traceback (most recent call last):
File “PhaseField.py”, line 99, in
E_phi = (2.0PSIcllinner(grad(p),grad(q))+2.0*(PSIc+zetaH(uold,unew,H_old))inner(p,q)-2.0zetaH(uold,unew,H_old)*q)dx
File “PhaseField.py”, line 73, in H
return conditional(lt(psiold(uold),psinew(unew)),psinew(unew),H_old)
File “PhaseField.py”, line 71, in psiold
return (psi(v_old)-PSIc+abs(psi(v_old)-PSIc))/2.0
File “PhaseField.py”, line 67, in psi
mue2p(v_disp)
File “PhaseField.py”, line 52, in e2p
assemble(epsilon(u), tensor=mateps)
File “/usr/lib/petsc/lib/python3/dist-packages/dolfin/fem/assembling.py”, line 202, in assemble
dolfin_form = _create_dolfin_form(form, form_compiler_parameters)
File “/usr/lib/petsc/lib/python3/dist-packages/dolfin/fem/assembling.py”, line 64, in _create_dolfin_form
raise TypeError(“Invalid form type %s” % (type(form),))
TypeError: Invalid form type <class ‘ufl.tensoralgebra.Sym’>