underworldcode / underworld2

underworld2: A parallel, particle-in-cell, finite element code for Geodynamics.
http://www.underworldcode.org/
Other
168 stars 58 forks source link

An issue when using trapezoid mesh #695

Open sadfa1 opened 4 months ago

sadfa1 commented 4 months ago

Hi, everyone, I'm trying to using the trapezoid mesh, but there are always error messages when I show the final result. By the way, almost everyone use rectangle mesh, is it because the non-rectangle mesh is not applicable in the underworld? Thanks a lot if anyone can help me!!!!

The code is shown as follow

Lx        = non_dimensionalise( 2e3 * u.kilometer)
Ly        = non_dimensionalise( 1e3 * u.kilometer)
gravity   = non_dimensionalise( 9.81 * u.meter / u.second**2)

resx=600
resy=300
mesh = uw.mesh.FeMesh_Cartesian( elementType = ("Q1/dQ0"), 
                                 elementRes  = (resx, resy), 
                                 minCoord    = (0., 0.), 
                                 maxCoord    = (Lx, Ly))

with mesh.deform_mesh():
    for index, coord in enumerate(mesh.data):
        mesh.data[index][0] = -0.5*mesh.data[index][0]*mesh.data[index][1]+mesh.data[index][0]

velocityField = mesh.add_variable(         nodeDofCount=2 )
pressureField = mesh.subMesh.add_variable( nodeDofCount=1 )
temperatureField = mesh.add_variable(         nodeDofCount=1 ) # required for AdvectionDiffusion (SUPG) method
temperatureDotField = mesh.add_variable(         nodeDofCount=1 ) # required for AdvectionDiffusion (SUPG) method
# initialise 

velocityField.data[:] = (0.,0.)
pressureField.data[:] = 0.
figMesh = vis.Figure(figsize=(800,400))
figMesh.append(vis.objects.Mesh(mesh))
#figMesh.append( vis.objects.Mesh(submesh, nodeNumbers=True, pointsize=10) )
figMesh.show()

The trapezoid mesh is shown here

ddc6dbe19a19e601bbb3c3baeb3c2e8e

The error messages are shown here

1715592826019
sadfa1 commented 4 months ago

@julesghub sir, I would be really thankful if you can help me!!!