You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@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.
@tommbendall and @jshipton found that ExtrudedMesh does not inherit
_base_mesh
if made from modified coordinates. The following is Tom's MFE:prints:
We get
MeshTopology
in the second output as theflat_mesh._base_mesh
(aMeshGeometry
) was not inherited by the newmesh
.I think we do not need to store
_base_mesh
in ExtrudedMeshes in the first place, while we should store "base mesh topology" inExtrudedMeshTopology
(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
The text was updated successfully, but these errors were encountered: