Skip to content

Get global mesh size #2547

Sep 4, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

It depends what you mean by "global mesh size". The following will compute the size of each cell and then give you the maximum. Is that what you are looking for?

P0 = FunctionSpace(mesh, "DG", 0)
hmax = project(CellSize(mesh), P0)
print(hmax.vector().gather().max())

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@PG20R
Comment options

@wence-
Comment options

Answer selected by PG20R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants