krober10nd / SeismicMesh

2D/3D serial and parallel triangular mesh generation tool for finite element methods.
https://seismicmesh.readthedocs.io/
GNU General Public License v3.0
123 stars 32 forks source link

dz, dx, and dy should be float #229

Open Yuri-Albuquerque opened 2 years ago

Yuri-Albuquerque commented 2 years ago

https://github.com/krober10nd/SeismicMesh/blob/03839c15276bc10f4d7cefc01a9c6efa3ba986e9/SeismicMesh/sizing/mesh_size_function.py#L479

Hi, @krober10nd I think dz, dx, dy needs to be float. Using int() is causing a division by zero in _build_domain_pad function, when some of the widths (in x, z, or y directions) are smaller than nx, nz, or ny.

krober10nd commented 2 years ago

Hey Yuri, thanks. Could you post some code they causes the error you mention? I think I understand but would be nice to have a minimum failing example.

Yuri-Albuquerque commented 2 years ago

I'm trying to generate the sizing function from a simple segy file whose data is an array of 1200 x 1200 using a bbox of 1000x1000 (probably this is my mistake). I was expecting a better resolution with a bbox smaller than the array data and indeed I got the sizing function but without padding the domain.

## Generates a sizing function from segy file
fname_guess = immersed_disk_guess.segy
bbox=(-1000.0, 0.0, 0.0, 1000.0)
ef_guess = SeismicMesh.sizing.get_sizing_function_from_segy(fname_guess, bbox,
    dt=0.001,
    wl = 10,
    freq = 2,
    hmin = 7.62,
    units = "m-s",
    domain_pad=100.0,
    pad_style="edge",
)

Below is the image of the data of this simple segy file (I can send it to you through email if you want). It is just an array of 1200X1200 with values of 4500 inside the ellipse and 1200 outside. 1_a_segy_ellipse

krober10nd commented 2 years ago

I see. Yea the problem is the width/height divided by the number of points in the two dimensions is below 1. You're right that this should improve the location of the level set in the velocity model.

I would just remove the type casts to int for the dx and dz and see what happens.

I won't be able to do this for a couple more days but please feel free to try it and run the tests and your example. Then submit a pull request from your fork, if you want.

krober10nd commented 2 years ago

@Yuri-Albuquerque please try this again with the latest commit on master.