Some questions about BDM #3026
Replies: 2 comments
-
It should be u[0] not u.sub(0)
On 15 Jul 2023, at 19:56, Sean ***@***.***> wrote:
Hello everyone. I am tring to code the $((|u_{1}|^2 + |u_{2}^2|)^{3/2} u,v)$ by BDM element.
Here is my code
from firedrake import *
degree = 1
Nx = 2
Ny = Nx
mesh = UnitSquareMesh(Nx, Ny)
BDM =FunctionSpace(mesh, "BDM", degree)
u = Function(BDM)
v = Function(BDM)
cof=u.sub(0)**2 + u.sub(1)**2
a = inner(cof*u, v)*dx
Here is the error
Traceback (most recent call last):
File "/home/MyCode/test.py", line 9, in <module>
cof=u.sub(0)**2 + u.sub(1)**2
File "petsc4py/PETSc/Log.pyx", line 115, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "petsc4py/PETSc/Log.pyx", line 116, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "/home/firedrake/firedrake/src/firedrake/firedrake/function.py", line 342, in sub
return self._components[i]
IndexError: tuple index out of range
How to solve it?
—
Reply to this email directly, view it on GitHub<#3026>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABOSV4WX7AUOEDKS4GSX2QTXQLRW7ANCNFSM6AAAAAA2LOJW64>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Thanks a lot. It is my mistake. |
Beta Was this translation helpful? Give feedback.
-
Hello everyone. I am tring to code the$((|u_{1}|^2 + |u_{2}^2|)^{3/2} u,v)$ by BDM element.
Here is my code
Here is the error
How to solve it?
Beta Was this translation helpful? Give feedback.
All reactions