kinnala / scikit-fem

Simple finite element assemblers

Home Page:https://scikit-fem.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

doflocs for tri_p0 and tet_p0

jove1 opened this issue · comments

Shouldn't doflocs for p0 elements be in the center of gravity (average of vertices)?

diff --git a/skfem/element/element_tet/element_tet_p0.py b/skfem/element/element_tet/element_tet_p0.py
index 0efcbed8..6c83a0e0 100644
--- a/skfem/element/element_tet/element_tet_p0.py
+++ b/skfem/element/element_tet/element_tet_p0.py
@@ -10,7 +10,7 @@ class ElementTetP0(ElementH1):
     interior_dofs = 1
     maxdeg = 0
     dofnames = ['u']
-    doflocs = np.array([[.5, .5, .5]])
+    doflocs = np.array([[.25, .25, .25]])
     refdom = RefTet

     def lbasis(self, X, i):
diff --git a/skfem/element/element_tri/element_tri_p0.py b/skfem/element/element_tri/element_tri_p0.py
index 7516d256..4ed055f8 100644
--- a/skfem/element/element_tri/element_tri_p0.py
+++ b/skfem/element/element_tri/element_tri_p0.py
@@ -10,7 +10,7 @@ class ElementTriP0(ElementH1):
     interior_dofs = 1
     maxdeg = 0
     dofnames = ['u']
-    doflocs = np.array([[.5, .5]])
+    doflocs = np.array([[1/3, 1/3]])
     refdom = RefTri

     def lbasis(self, X, i):

Yes, thanks for the report. I have rarely used these P0 doflocs which may explain it going unnoticed.

You have a diff there, are you able to open PR?