We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Averages edge length for all edges of a cell
from dolfin import * import numpy as np mesh = UnitSquareMesh(10, 10) mesh.init(1) ALE.move(mesh, Expression(("x[0]", "cos(x[1])"),degree=1)) num_cells = mesh.num_cells() V = FunctionSpace(mesh, "DG", 0) u = Function(V) values = np.zeros(num_cells, dtype=np.float64) for cell in cells(mesh): edges = cell.entities(1) value = 0 for edge in edges: value += Edge(mesh, edge).length() values[cell.index()] = value / len(edges) u.vector().set_local(values) u.vector().apply("local") with XDMFFile("edge_length.xdmf") as xdmf: xdmf.write(u)
The text was updated successfully, but these errors were encountered:
With this funky deformation field the edge lengths are:
ALE.move(mesh, Expression(("x[0]", "0.3*x[1]*cos(2*x[0])"),degree=1))
Sorry, something went wrong.
No branches or pull requests
Averages edge length for all edges of a cell
The text was updated successfully, but these errors were encountered: