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

3d geometry with topography and fixed thin layer #733

Open
mariosgeo opened this issue Jun 10, 2024 · 5 comments
Open

3d geometry with topography and fixed thin layer #733

mariosgeo opened this issue Jun 10, 2024 · 5 comments
Assignees

Comments

@mariosgeo
Copy link

mariosgeo commented Jun 10, 2024

Problem description

I have 3d (xyz) electrodes on surface, where they define also a topography. What I want, is to make a layer (surface ?), just 10cm below each electrode. This is since all electrodes are placed on top brick layers within a city, and want to fix the resistivity to something high.

What I do,

  data=ert.load('ams_26_k_elev.pyg')

create a temporary array with the xy,elevations and subtract 10cm

 tmp=np.asarray(data.sensors())
 tmp[:,2]=tmp[:,2]-0.1

I will make a PLC for the 10cm

 plc2 = mt.createParaMeshPLC3D(tmp, paraDepth=0.1, paraMaxCellSize=0.01,
                         surfaceMeshQuality=34)

And a second PLC for the rest of the domain

 plc1 = mt.createParaMeshPLC3D(data, paraDepth=5, paraMaxCellSize=0.01,
                         surfaceMeshQuality=34)

Then add them

 plc=plc1+plc2

Add some nodes for accuracy

 for s in data.sensors():
       plc.createNode(s-[0.,0.,0.05], marker=-99)

And make a mesh

 mesh = mt.createMesh(plc, quality=1.3)

This returns the following error

  File ~\anaconda3\envs\pg\lib\site-packages\pygimli\meshtools\mesh.py:148 in createMesh
mesh = pg.meshtools.syscallTetgen(namePLC, quality, area,

  File ~\anaconda3\envs\pg\lib\site-packages\pygimli\meshtools\polytools.py:1902 in syscallTetgen
mesh = pg.meshtools.readTetgen(filebody + '-1')

  File ~\anaconda3\envs\pg\lib\site-packages\pygimli\meshtools\mesh.py:963 in readTetgen
with open(fName + '.node', 'r') as node_in:

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\marios\\AppData\\Local\\Temp\\tmpd4jcuffp-1.node'
@halbmy halbmy self-assigned this Jun 11, 2024
@halbmy
Copy link
Contributor

halbmy commented Jun 11, 2024

  1. There should be an example on 3D ERT, maybe with the slagdump 3D data (Günther et al., 2006) that I used in lack of your file. However, there is a notebook on https://github.com/gimli-org/notebooks/blob/main/ERT/3dtopo/slagdump3d.ipynb
  2. There should be a better error message if the mesh generation (tetgen is called in the background) fails, also hinting to look for intersections with tetgen -d, or an intersection check beforehand.
  3. In my case, surfaceMeshQuality=34 prevented building a correct mesh even from plc1, this is something to be looked at.
  4. Eventually, the mesh generation for plc2 being inside plc1 is never not sucessful as it creates (on the outside) plc2 faces that are subfaces of faces already created by plc1. So you should try to create only the upper surface with plc2 = createParaMeshSurface.

@mariosgeo
Copy link
Author

mariosgeo commented Jun 11, 2024

7th_iter.txt

The data file attached. And a demo script

data=ert.load('7th_iter.txt')
tmp=np.asarray(data.sensors())
tmp[:,2]=tmp[:,2]-0.2

plc1 = mt.createParaMeshPLC3D(data, paraDepth=5, paraMaxCellSize=0.1,
                         surfaceMeshQuality=34)

plc2=mt.createParaMeshSurface(tmp,surfaceMeshQuality=34,surfaceMeshArea=0.1)

plc=plc1+plc2

pg.show(plc)
mesh = mt.createMesh(plc, quality=1.3,switches='-d')
mesh.exportVTK('mesh3.vtk')

@mariosgeo
Copy link
Author

mariosgeo commented Jun 11, 2024

Edit. I am removing first and last electrodes, to avoid intersections.

ix=np.where((tmp[:,0]==0)
         |
         (tmp[:,0]==20)
         |
         (tmp[:,1]==0)
         |
         (tmp[:,1]==18)
         )[0]

tmp=np.delete(tmp,ix,axis=0)

And making sure that plc2 is not intersecting.

plc2=mt.createParaMeshSurface(tmp,surfaceMeshQuality=34,surfaceMeshArea=0.1,boundary=[0.1,0.1],paraBoundary=[0.01,0.01])

Still I get a different issue,

The input surface mesh contain self-intersections. Program stopped.

@mariosgeo
Copy link
Author

mariosgeo commented Jun 11, 2024

Edit 2:
If I place the surface bit deeper,

tmp[:,2]=tmp[:,2]-1.2

Then it creates the mesh. So I assume the intersection is on the "z-axis".

@halbmy
Copy link
Contributor

halbmy commented Jun 11, 2024

You can check intersections with tetgen -d polyfile (after exporting the plc with mt.exportPLC()).

I personally had problems already when using surfaceMeshQuality (there was a hole) but this might be due to my topo.

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

No branches or pull requests

2 participants