Skip to content
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

ExtrudedMesh does not inherit _base_mesh if made from modified coordinates #2993

Open
ksagiyam opened this issue Jun 19, 2023 · 0 comments
Open

Comments

@ksagiyam
Copy link
Contributor

@tommbendall and @jshipton found that ExtrudedMesh does not inherit _base_mesh if made from modified coordinates. The following is Tom's MFE:

from firedrake import (PeriodicIntervalMesh, ExtrudedMesh, VectorFunctionSpace,
                       SpatialCoordinate, cos, pi, as_vector, Function, Mesh,
                       FunctionSpace, CheckpointFile)
import numpy as np


# Mesh parameters
L, H = 1000.0, 1000.0
nlayers, ncolumns = 10, 10
mountain_height = 10.0
# Make regular extruded mesh
base_mesh = PeriodicIntervalMesh(ncolumns, L)
flat_mesh = ExtrudedMesh(base_mesh, layers=nlayers, layer_height=H/nlayers)
print(flat_mesh._base_mesh)
Vc = VectorFunctionSpace(flat_mesh, "DG", 2)
x, z = SpatialCoordinate(flat_mesh)
# Expression to describe a mountain -- just do simple cos wave
xc = L / 2
new_z = z + mountain_height*cos(2*pi*(x-xc)/L)
# Make new mesh
new_coords_expr = as_vector([x, new_z])
new_coords = Function(Vc).interpolate(new_coords_expr)
mesh = Mesh(new_coords)
print(mesh._base_mesh)

prints:

<Mesh #5>
<firedrake.mesh.MeshTopology object at 0x7f9807cd4040>

We get MeshTopology in the second output as the flat_mesh._base_mesh (a MeshGeometry) was not inherited by the new mesh.

I think we do not need to store _base_mesh in ExtrudedMeshes in the first place, while we should store "base mesh topology" in ExtrudedMeshTopology (as we do now). When we make an ExtrudedMesh, we make new arbitrary coordinates anyway in the extruded space, and I think coordinates of the base mesh is in general not very useful once coordinates of the extruded mesh are computed.

firedrakeproject/gusto#381
firedrakeproject/gusto#380

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants