... | ... | @@ -77,15 +77,24 @@ Define a mesh size field. |
|
|
Here the resolution ranges from 1 to 10 km, linearly increasing with the distance to the coast. The mesh size should also depend on the bathymetry (here on the square root of the bathymetry).
|
|
|
|
|
|
```python
|
|
|
def fsize(x, y, z) :
|
|
|
ef fsize(x, y, z) :
|
|
|
h = bath.evaluate_geocentric(x,y,z)
|
|
|
h2 = min(1000,max(5, -h))
|
|
|
s0 = 750* h2**.5
|
|
|
# Fine
|
|
|
# s0 = 450* h2**.5
|
|
|
# Coarse
|
|
|
s0 = 2250*h2**.5
|
|
|
|
|
|
d = distCoast.evaluate_geocentric(x,y,z)
|
|
|
l0 = 1000
|
|
|
l1 = 10000
|
|
|
d0 = 8000
|
|
|
# Fine
|
|
|
# l0 = 1000
|
|
|
# l1 = 10000
|
|
|
# d0 = 8000
|
|
|
# d1 = 50000
|
|
|
# Coarse
|
|
|
l0 = 5000
|
|
|
l1 = 15000
|
|
|
d0 = 10000
|
|
|
d1 = 50000
|
|
|
if d < d0 :
|
|
|
s1 = l0
|
... | ... | @@ -115,7 +124,7 @@ Call the `slimPre.mesh_shp` to generate the mesh with the following arguments : |
|
|
- name of the dictionary with the "tags map"
|
|
|
|
|
|
```python
|
|
|
slimPre.mesh_shp(["./coast.shp"], -78 , 23, fsize, 1000/R, "bahamas.msh", "+proj=utm +ellps=WGS84 +zone=17 +north", physicals)
|
|
|
slimPre.mesh_shp(["./coast.shp"], -78 , 23, fsize, 1000/R, "bahamas.msh", "+proj=utm +ellps=WGS84 +zone=17-18 +north", physicals)
|
|
|
```
|
|
|
|
|
|
Exit properly
|
... | ... | @@ -132,4 +141,4 @@ slim mesh.py |
|
|
|
|
|
Open the resulting `bahamas.msh` file in GMSH, it should look like this picture.
|
|
|
|
|
|
![mesh](/uploads/bb8880d6b3ca41114e92cb3bc61cacda/mesh.png) |
|
|
\ No newline at end of file |
|
|
![mesh_bathymetry](/uploads/68c837d705cedc80d5a789b7715b9d5b/bahamas_tuto_bath.png) |
|
|
\ No newline at end of file |