... | ... | @@ -77,6 +77,15 @@ 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 threshold(d,l0,l1,d0,d1):
|
|
|
if d < d0:
|
|
|
return l0
|
|
|
elif d < d1:
|
|
|
f = (d-d0)/(d1-d0)
|
|
|
return l0*(1-f) + l1 * f
|
|
|
else:
|
|
|
return l1
|
|
|
def fsize(x, y, z) :
|
|
|
h = bath.evaluate_geocentric(x,y,z)
|
|
|
h2 = min(1000,max(5, -h))
|
... | ... | @@ -87,22 +96,9 @@ def fsize(x, y, z) : |
|
|
|
|
|
d = distCoast.evaluate_geocentric(x,y,z)
|
|
|
# Fine
|
|
|
# l0 = 1000
|
|
|
# l1 = 10000
|
|
|
# d0 = 8000
|
|
|
# d1 = 50000
|
|
|
# s1 = threshold(1000,10000,8000,50000)
|
|
|
# Coarse
|
|
|
l0 = 5000
|
|
|
l1 = 15000
|
|
|
d0 = 10000
|
|
|
d1 = 50000
|
|
|
if d < d0 :
|
|
|
s1 = l0
|
|
|
elif d < d1 :
|
|
|
f = (d-d0)/(d1-d0)
|
|
|
s1 = l0*(1-f) + l1 * f
|
|
|
else :
|
|
|
s1 = l1
|
|
|
s1 = threshold(5000,15000,10000,50000)
|
|
|
return min(s0, s1)/R
|
|
|
```
|
|
|
|
... | ... | |