-
Notifications
You must be signed in to change notification settings - Fork 81
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Point data in high order meshes #655
Comments
Actually I don't get the ValueError here... I get an XDMF of which
and which ParaView is happy to open and render. |
Ah, O. K., after updating meshio I do get the ValueError, which makes more sense, since, as you say, the lengths of the points and point-data don't match. |
General issue on serialization of meshes and solutions: #158 |
I'd guess you need to provide one value per |
If you use matching from skfem import *
from skfem.helpers import dot, grad
m = MeshTri2().init_circle()
e = ElementTriP2()
basis = CellBasis(m, e)
@BilinearForm
def laplace(u, v, _):
return dot(grad(u), grad(v))
@LinearForm
def rhs(v, _):
return 1.0 * v
A = asm(laplace, basis)
b = asm(rhs, basis)
A, b = enforce(A, b, D=basis.get_dofs())
x = solve(A, b)
m.save("hosave.vtk", point_data={'x': x}) If this is not the case, then it becomes more complicated. |
If your finite element space has higher order than P2, then L2-projection is well defined and you can use |
Otherwise, you can hack together something like this: from skfem import *
from skfem.helpers import dot, grad
m = MeshTri2().init_circle()
e = ElementTriP1()
basis = CellBasis(m, e, intorder=4)
@BilinearForm
def laplace(u, v, _):
return dot(grad(u), grad(v))
@LinearForm
def rhs(v, _):
return 1.0 * v
A = asm(laplace, basis)
b = asm(rhs, basis)
A, b = enforce(A, b, D=basis.get_dofs())
x = solve(A, b)
X = basis.interpolate(x).value
y = projection(lambda _: X, basis.with_element(ElementTriP2()), basis)
m.save("hosave.vtk", point_data={'y': y}) Maybe |
Actually, this seems to work also: from skfem import *
from skfem.helpers import dot, grad
m = MeshTri2().init_circle()
e = ElementTriP1()
basis = CellBasis(m, e, intorder=4)
@BilinearForm
def laplace(u, v, _):
return dot(grad(u), grad(v))
@LinearForm
def rhs(v, _):
return 1.0 * v
A = asm(laplace, basis)
b = asm(rhs, basis)
A, b = enforce(A, b, D=basis.get_dofs())
x = solve(A, b)
y = projection(x, basis.with_element(ElementTriP2()), basis)
m.save("hosave.vtk", point_data={'y': y}) I'm not sure what's going on. |
My bad I should have mentioned my system setup. Thanks for pointing me to the issue of serialization. I will take a look at it |
Interesting. Thanks. For projecting a vector field should I do it component-by-component? Because once I have the solution vector say of shape mesh.save("filename.xdmf", point_data = {"u": du_proj[projected_basis.nodal_dofs].T}) run into a similar issue? I am thinking out loud here -- haven't tested this yet. Will do so later today. |
I think these formats that support quadratic meshes expect one value per node. However, I think you can use projection with |
The global The problem I was solving is that of an incompressible shell radially stretched outwards and simply plotting the projected displacement seemed to suggest that something isn't correct. See
|
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
How would one go about saving
point_data
for a 10-noded tetrahedral mesh for instance? I have right now,basis.nodal_dofs
andbasis.edge_dofs
. I was using linear meshes up until now and hencebasis.nodal_dofs
sufficed even when having a high order approximation such as in #651raises
How would one go about incorporating
edge_dofs
in savingpoint_data
?The text was updated successfully, but these errors were encountered: