Simple mesh generation for regional FESOM2 setups.
Originally created by Sergey Kirillov.
Video with process of defining regions and looking at the result can be found under the link below:
Create new conda
environment from requirements.yml
by executing:
conda env create -f requirements.yml
and activate it
conda activate fmesh
You have to download bathymetry and coastlines. This can be done by executing:
./download_data.sh
You have to configure your future mesh in the configure.yaml
and then run:
python fmesh.py
in the fmesh
directory.
The process of mesh creation is split into several steps, that you can configure. In general you define the base resolution (ether constant, or increasing towards poles) and perform refinement on some regions of the basis mesh.
The main step is defining your base resolution. There are two options here:
- constant resolution (
do_mercator_refinement: false
) - resolution changing with latitude (
do_mercator_refinement: true
)
For the resolution changing with latitude you can define the latitude where resolution become constant ( norhtern_boundary
, southern_boundary
) and the value of constant resolution (norhtern_lowest_resolution
, southern_lowest_resolution
).
To turn it on you have to set do_refine_along_coastlines: true
. You can control:
min_resolution
resolution at the coast.max_distance
distance from the coast, where resolution is set back to base resolution. So the resolution will change frommin_resolution
at the coast to base mesh resolution atmax_distance
.min_length
minimum length of the coastline to be considered. For example if it set to 200, the island with 200 km coastline will not be considered.averaging
the smothing lenghth of the coastline.
Regions are defined in .kml files, that contain two paths for inner region (where the resolution will be set to constant resolution
value) and outer region, where resolution will be set to the base resolution. In the area between the paths resolution will be linearly changing from resolution
value to base resolution.
The easiest way to create paths is to use Goole Earth, and path tool. The paths should not be closed, this will be done automatically by fmesh
.
Additional parameters for each region:
precision
each section of polygon will by splitted inprecision
nuber of times, to make linear interpolation more precise.order
If True, fist polygon is internal and second is external. I False, then other way round.
For convinience you can set vertical levels in your resulting aux3d.out
file with levels
parameter.
The fmesh
also saves .vtk file, with resulting mesh, that can be opened in ParaView: