Adaptive Poisson equation #844
-
I try to use adaptive method to solve poisson equation with quadratic (or cubic) element. I guess those elements are defined by using lbasis (phi and dphi),but the second derivatives of phi are not given. How to get the term Delta u_h of in interior residual. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Thanks, it is a good question. There are several options. However, I suggest you employ some finite element knowledge. Partial derivative of from skfem import *
mesh = MeshTri().refined(3)
basis = Basis(mesh, ElementTriP3())
grad_basis = basis.with_element(ElementVector(ElementDG(ElementTriP2())))
u = basis.project(lambda x: x[0] ** 3)
grad_u = grad_basis.project(basis.interpolate(u).grad)
@Functional
def residual(w):
(uxx, uxy), (uyx, uyy) = w['grad_u'].grad
return (uxx + uyy) ** 2
out = residual.elemental(grad_basis, grad_u=grad_u)
from skfem.visuals.matplotlib import *
plot(mesh, out, colorbar=True)
show() I hope it works out. |
Beta Was this translation helpful? Give feedback.
Thanks, it is a good question. There are several options. However, I suggest you employ some finite element knowledge.
Partial derivative of
ElementTriP<k>
isElementDG(ElementTriP<k-1>)
. So you could first find the derivative and then calculate the residual. This is an example: