... | @@ -17,13 +17,15 @@ First, you need to download QGIS and topographic (and bathymetry) data to define |
... | @@ -17,13 +17,15 @@ First, you need to download QGIS and topographic (and bathymetry) data to define |
|
|
|
|
|
## QGIS
|
|
## QGIS
|
|
|
|
|
|
The first step is to create a new shapefile (for example, `coast.shp`) with the coastlines and the open boundaries.
|
|
The first step is to create a new shapefile (for example, `coast.shp`) with the coastlines and the open boundaries. You should end up with something like this:
|
|
|
|
|
|
|
|
![qgis-printscreen](/uploads/b774e19ff82f4d0e28a282d9995a7c6d/qgis-printscreen.png)
|
|
|
|
|
|
- Open QGIS
|
|
- Open QGIS
|
|
- Import topography (and bathymetry) data (drag and drop the `lines.shp` from Open Street map and the `etopo.tif` into the qgis drawing area).
|
|
- Import topography (and bathymetry) data (drag and drop the `lines.shp` from Open Street map and the `etopo.tif` into the qgis drawing area).
|
|
- Select the entities in the area you want to mesh with a rectangle ![rect-select](/uploads/d75be8d994e117ce9419c35c4bafc155/rect-select.png) and copy them with *Ctrl+C*
|
|
- Select the entities in the area you want to mesh with a rectangle ![rect-select](/uploads/d75be8d994e117ce9419c35c4bafc155/rect-select.png) and copy them with *Ctrl+C*
|
|
- Delete the initial layer (right-click on it the layers list then choose *Delete*)
|
|
- Delete the initial layer (right-click on it the layers list then choose *Delete*)
|
|
- Create a new shapefile layer of type `line`. Use the menu *layer -> create new Shapefile layer* (If you are using a virtual machine, put it in the *slim-vm* shared directory.)
|
|
- Create a new shapefile layer of type `line`. Use the menu *layer -> create new Shapefile layer* (If you are using a virtual machine, save it in the *slim-vm* shared directory.)
|
|
- Select the new layer
|
|
- Select the new layer
|
|
- Enter the *edit mode* ![edit](/uploads/3c3afe1f36fc4ac58743b3e3aa930d95/edit.png) and paste the entities with *Ctrl+V*
|
|
- Enter the *edit mode* ![edit](/uploads/3c3afe1f36fc4ac58743b3e3aa930d95/edit.png) and paste the entities with *Ctrl+V*
|
|
- Add one (or more) lines ![entity](/uploads/6a86ca4b9f0504f9580c2538021acb2a/entity.png) in order to close the domain (Left-click to start adding the points of a line, right-click to end the line).
|
|
- Add one (or more) lines ![entity](/uploads/6a86ca4b9f0504f9580c2538021acb2a/entity.png) in order to close the domain (Left-click to start adding the points of a line, right-click to end the line).
|
... | @@ -31,11 +33,11 @@ The first step is to create a new shapefile (for example, `coast.shp`) with the |
... | @@ -31,11 +33,11 @@ The first step is to create a new shapefile (for example, `coast.shp`) with the |
|
- Save the project (If you are using a virtual machine, put it in the *slim-vm* shared directory.)
|
|
- Save the project (If you are using a virtual machine, put it in the *slim-vm* shared directory.)
|
|
|
|
|
|
Now add an *entity* field on each line to define a tag that will be use later to specify the boundary conditions.
|
|
Now add an *entity* field on each line to define a tag that will be use later to specify the boundary conditions.
|
|
- In edit mode, open table of attributes ![attr-field](/uploads/831cb5ac88fed104372113c22ab27484/attr-field.png)
|
|
- In *edit mode*, open table of attributes ![attr-field](/uploads/831cb5ac88fed104372113c22ab27484/attr-field.png)
|
|
- Add a column ![new-column](/uploads/cf8897fd6cfb6d7b272f4ed244cc8889/new-column.png), name it `entity` of type `integer`
|
|
- Add a column ![new-column](/uploads/cf8897fd6cfb6d7b272f4ed244cc8889/new-column.png), name it `entity` of type `integer`
|
|
- Give value `1` by default
|
|
- Give value `1` by default
|
|
- Select line(s) ![select](/uploads/e7ade47750c57be4bea219f949a479ef/select.png) and change entity. Give as many different integers as necessary to produce the mesh and run the model. Those integers will be converted into physical tags later on.
|
|
- Select each open boundary line ![select](/uploads/e7ade47750c57be4bea219f949a479ef/select.png) and change the value of its *entity* field. Give as many different integers as necessary to produce the mesh and run the model. Those integers will be converted into physical tags later on.
|
|
- Hint : note with their meaning (1 : coast).
|
|
- Hint : keep note of their meaning (1 : coast).
|
|
- Exit the *edit mode* and save the layer, then save the project
|
|
- Exit the *edit mode* and save the layer, then save the project
|
|
- Close QGIS
|
|
- Close QGIS
|
|
|
|
|
... | @@ -55,19 +57,21 @@ Give Earth radius |
... | @@ -55,19 +57,21 @@ Give Earth radius |
|
R=6371e3
|
|
R=6371e3
|
|
```
|
|
```
|
|
|
|
|
|
Get distance to tags "1" and "4" of a shapefile "coast.shp" (lines filled with points every 1000 meters)
|
|
Get distance to tags "1" and "4" of a shapefile "coast.shp" (lines filled with points every 1000 meters).
|
|
|
|
|
|
```python
|
|
```python
|
|
distCoast = slimPre.distance_shp("./coast.shp", 1000, [1,4])
|
|
distCoast = slimPre.distance_shp("./coast.shp", 1000, [1,4])
|
|
```
|
|
```
|
|
|
|
|
|
|
|
For more details, see the [SLIM python interface documentation] (http://slim.git-page.immc.ucl.ac.be/slim/slimPre.html#distance_shp)
|
|
|
|
|
|
Get bathymetry data
|
|
Get bathymetry data
|
|
|
|
|
|
```python
|
|
```python
|
|
bath = slimPre.geo_tiff('./etopo.tif')
|
|
bath = slimPre.geo_tiff('./etopo.tif')
|
|
```
|
|
```
|
|
|
|
|
|
Define a "mesh size map"
|
|
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 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.
|
|
|
|
|
... | @@ -88,13 +92,13 @@ Here the resolution ranges from 1 to 10 km, linearly increasing with the distanc |
... | @@ -88,13 +92,13 @@ Here the resolution ranges from 1 to 10 km, linearly increasing with the distanc |
|
return s1/R
|
|
return s1/R
|
|
```
|
|
```
|
|
|
|
|
|
Define a dictionary of the "tags map"
|
|
Use a python dictionary to associate the entity tags defined in QGIS with names.
|
|
|
|
|
|
```python
|
|
```python
|
|
physicals = {1:"coast", 2:"atlantic_north", 5:"atlantic_east", 3:"mexico", 4:"island"}
|
|
physicals = {1:"coast", 2:"atlantic_north", 5:"atlantic_east", 3:"mexico", 4:"island"}
|
|
```
|
|
```
|
|
|
|
|
|
Generate the mesh with the following arguments :
|
|
Call the `slimPre.mesh_shp` to generate the mesh with the following arguments :
|
|
|
|
|
|
- shapefile delimiting the domain
|
|
- shapefile delimiting the domain
|
|
- longitude of a point inside the domain
|
|
- longitude of a point inside the domain
|
... | | ... | |