Difference between revisions of "Mesh generation"

From ccrmwiki
Jump to: navigation, search
(Grid generation tool)
 
(35 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Gridgen tool==
+
==Grid generation tool==
We recommend SMS [http://www.aquaveo.com/sms] for grid generation.
+
We recommend [http://www.aquaveo.com/sms SMS] for grid generation.
 +
Dr. Wood's MSc [http://ccrm.vims.edu/yinglong/wiki_files/Wood_MScThesis_2012-SMS-WMS-Chesapeake&DelawareBays-Grid.pdf thesis] serves as a good guide as well.
 +
 
 +
==Bathymetric Data==
 +
If you require 'approximate' bathymetry for your area, this can be obtained from the SRTM 15 and 30 meter data sets, available here:
 +
 
 +
http://topex.ucsd.edu/WWW_html/srtm30_plus.html
 +
 
 +
Regional specific bathymetry data at 30m resolution in an xyz format is available here:
 +
 
 +
http://topex.ucsd.edu/cgi-bin/get_srtm30.cgi
 +
 
 +
Note that this data is of variable quality and may be inaccurate for your region, so please check the quality of the data against available charts and preferentially use local data if available.
  
 
==Beware of CFL number==
 
==Beware of CFL number==
Line 10: Line 22:
 
must be <1 for given dx,dt in such models. Here h is the local water depth, and u is the flow velocity. Note that the sqrt() term is related to surface wave celerity.
 
must be <1 for given dx,dt in such models. Here h is the local water depth, and u is the flow velocity. Note that the sqrt() term is related to surface wave celerity.
  
Being an implicit model using Eulerian-Lagrangian method (ELM), SELFE has a somewhat opposite requirement: CFL>0.4. Therefore care must be taken in the grid generation  
+
Being an implicit model using Eulerian-Lagrangian method (ELM), SCHISM has a somewhat opposite requirement: CFL>0.4 (you may be able to get away with CFL>0.2 in some applications like tsunami). Therefore care must be taken in the grid generation  
 
process; otherwise numerical diffusion in ELM would ruin your results, which may manifest itself in the form of either noise or dissipation.
 
process; otherwise numerical diffusion in ELM would ruin your results, which may manifest itself in the form of either noise or dissipation.
  
With xmgredit5, you can very easily visualize CFL for the entire grid. Note, however, that CFL number is undefined when h<0. In these shallow regions, we should use |u| alone and neglect the wave celerity term (sqrt(g*h)). E.g., if we estimate |u| ~ 1m/s, with a time step of 100s, the max. dx in regions of h<0 should be 250m; with dt=50s, dx_max=125m.
+
With [http://ccrm.vims.edu/w/index.php/ACE_tools xmgredit5], you can very easily visualize CFL for the entire grid. Note, however, that CFL number is undefined when h<0. In these shallow regions, we should use |u| alone and neglect the wave celerity term (sqrt(g*h)). E.g., if we estimate |u| ~ 1m/s, with a time step of 100s, the max. dx in regions of h<0 should be 250m; with dt=50s, dx_max=125m.
 +
 
 +
 
  
 
'''Viz CFL number in xmgredit5'''
 
'''Viz CFL number in xmgredit5'''
 
<UL>
 
<UL>
<LI>xmgredit5 -belel -1.e-10 hgrid.gr3 (note: '-belel -1.e-10' is used mainly to increase precision for lat/lon grid)
+
<LI>xmgredit5 -belel -1.e-10 hgrid.gr3 (note: '-belel -1.e-10' is used mainly to increase precision for lat/lon grid. Note: if your hgrid.gr3 is in lat/lon, you need to first project it, as the grid size dx in lat/lon is not in meters)
 
<LI>since the CFL inside ACE is calculated without u, we should impose a min depth of 0.1 (so that sqrt(g*h)>=1m/s); you can do this by: <br />
 
<LI>since the CFL inside ACE is calculated without u, we should impose a min depth of 0.1 (so that sqrt(g*h)>=1m/s); you can do this by: <br />
Edit-->Edit over grid/regions-->Evaluate, and then in the dialogue box, type depth=max(depth,0.1). (Note that the Evaluate function is also very useful for generation of other .gr3 files needed by SELFE)
+
Edit-->Edit over grid/regions-->Evaluate, and then in the dialogue box, type depth=max(depth,0.1). (Note that the Evaluate function is also very useful for generation of other .gr3 files needed by SCHISM)
 
<LI>Special-->Dimensionless numbers, and then in the right half of the dialogue box, type in dt, Warning value (say 0.4), Unacceptable value (say 0.4) and depress 'Display filled' button. The color will appear in the main window, with red indicating good CFL, and green for bad CFL. You may also 'Display Courant number' but this may take a while to refresh, and so you may want to zoom into a small region first.
 
<LI>Special-->Dimensionless numbers, and then in the right half of the dialogue box, type in dt, Warning value (say 0.4), Unacceptable value (say 0.4) and depress 'Display filled' button. The color will appear in the main window, with red indicating good CFL, and green for bad CFL. You may also 'Display Courant number' but this may take a while to refresh, and so you may want to zoom into a small region first.
 
<LI>revise your grid accordingly
 
<LI>revise your grid accordingly
 
</UL>
 
</UL>
----
 
  
Remember, if you have to reduce the time step for some reason, you may have to refine grid because of CFL. It's wise to plan for a smallest dt you expect to use for a system, and design your grid according to this dt. This issue is closely related to the convergence property of SELFE, see: [http://www.stccmop.org/CORIE/modeling/selfe/faq.html#faq11_2]
 
  
==Baratropic simulation==
+
Remember, if you have to reduce the time step for some reason, you may have to refine grid because of CFL. It's wise to plan for a smallest dt you expect to use for a system, and design your grid according to this dt. This issue is closely related to the [http://ccrm.vims.edu/w/index.php/Convergence_study_with_SCHISM convergence property of SCHISM].
 +
 
 +
In tsunami simulations, dt has to be small due to small wavelength, and you can bypass the CFL condition by turning off advection in deeper depths as the advection is negligible there. You also need to make sure that each wavelength is resolved by at least 20 grid points.
 +
 
 +
==Grid near wetting and drying==
 +
 
 +
It's important to have the grid follow the initial shoreline. Reasonable grid transition should be done from shoreline to dryland. Use comaprable or finer grid resolution in the dryland that is expected to be wetted, and then transition to coarser resolution beyond (to account for rare inunation).
 +
 
 +
Simulating wetting and drying well with SCHISM requires some effort; read more [http://ccrm.vims.edu/w/index.php/Simulating_wetting_and_drying_with_SCHISM here].
 +
 
 +
'''IMPORTANT:''' in grid generation, make sure channels are resolved by at least 2 ''alway wet'' nodes, to allow flow to pass thru. Failure to do so may lead to noisy flow field.
 +
 
 +
==Barotropic simulation==
 +
 
 +
Grid quality requirement is relatively lax for barotropic simulations. Besides the considerations above, you mainly need to use appropriate resolution based on physics (e.g., generally coarser resolution in deeper depths and finer resolution for shallow depths). Remember: you are on unstructured grid territory, and so you are free to resolve features as you wish!
 +
 
 +
Another commonly asked question is the max. element skewness. SCHISM, in either barotropic or baroclinic configuration, can tolerate elements as skew as 20! (skewness is defined as the ratio between the max. side and the equivalent radius)
 +
 
 +
 
  
Grid quality requirement is relatively lax for barotropic simulations. Besides the CFL above, you mainly need to use appropriate resolution based on physics (e.g., coarser resolution in deeper depths and finer resolution for shallow depths). Remember: you are on unstructured grid territory, and so you are free to resolve features as you wish!
 
  
----
 
  
 
==Baroclinic simulation==
 
==Baroclinic simulation==
Line 37: Line 65:
 
The transport process is influenced by your choice of grid, and so grid for baroclinic simulations needs some attention. For example, the channels should be gridded as quasi-structured grid ('Patches' in SMS).<br />
 
The transport process is influenced by your choice of grid, and so grid for baroclinic simulations needs some attention. For example, the channels should be gridded as quasi-structured grid ('Patches' in SMS).<br />
  
The Courant number condition for transport should be accounted for during gridgen. In SELFE, the time steps used for momentum and transport can be different, with the latter being usually smaller (the model will automatically calculate the transport step for you and do sub-cycling). For upwind/TVD schemes, you should avoid accessively refining areas that expect high flow. This is particularly important for TVD. Fortunately, there are tools to help in identifying 'choke' regions. Here [[Media:SaltIntrusionwithSELFE-Oct2011.docx.ogg‎]] is a document on how to do a good salt intrusion study with SELFE's TVD scheme.
+
The Courant number condition for transport may need to be accounted for during gridgen, especially if you use TVD scheme. In SCHISM, the time steps used for momentum and transport can be different, with the latter being usually smaller (the model will automatically calculate the transport step for you and do sub-cycling). The Courant number condition for the transport equations is:
 +
 
 +
Cu=c*|u|*dtb/dx<1 <br/>
 +
where c=1 for upwind and c<1 for TVD; dtb is the transport time step.
 +
 
 +
Therefore especially for TVD schemes, you should avoid excessively refining areas that expect high flow. Fortunately, there are tools to help you identify 'choke' regions. Here is a [http://ccrm.vims.edu/yinglong/wiki_files/SaltIntrusionwithSELFE-Oct2011.pdf document] on how to do a good salt intrusion study with SCHISM's TVD scheme.

Latest revision as of 14:52, 22 April 2016

Grid generation tool

We recommend SMS for grid generation. Dr. Wood's MSc thesis serves as a good guide as well.

Bathymetric Data

If you require 'approximate' bathymetry for your area, this can be obtained from the SRTM 15 and 30 meter data sets, available here:

http://topex.ucsd.edu/WWW_html/srtm30_plus.html

Regional specific bathymetry data at 30m resolution in an xyz format is available here:

http://topex.ucsd.edu/cgi-bin/get_srtm30.cgi

Note that this data is of variable quality and may be inaccurate for your region, so please check the quality of the data against available charts and preferentially use local data if available.

Beware of CFL number

You may be familiar with the CFL restriction associated with explicit (mode-splitting) models; the CFL number, defined as

CFL=(|u|+sqrt(g*h))*dt/dx

must be <1 for given dx,dt in such models. Here h is the local water depth, and u is the flow velocity. Note that the sqrt() term is related to surface wave celerity.

Being an implicit model using Eulerian-Lagrangian method (ELM), SCHISM has a somewhat opposite requirement: CFL>0.4 (you may be able to get away with CFL>0.2 in some applications like tsunami). Therefore care must be taken in the grid generation process; otherwise numerical diffusion in ELM would ruin your results, which may manifest itself in the form of either noise or dissipation.

With xmgredit5, you can very easily visualize CFL for the entire grid. Note, however, that CFL number is undefined when h<0. In these shallow regions, we should use |u| alone and neglect the wave celerity term (sqrt(g*h)). E.g., if we estimate |u| ~ 1m/s, with a time step of 100s, the max. dx in regions of h<0 should be 250m; with dt=50s, dx_max=125m.


Viz CFL number in xmgredit5

  • xmgredit5 -belel -1.e-10 hgrid.gr3 (note: '-belel -1.e-10' is used mainly to increase precision for lat/lon grid. Note: if your hgrid.gr3 is in lat/lon, you need to first project it, as the grid size dx in lat/lon is not in meters)
  • since the CFL inside ACE is calculated without u, we should impose a min depth of 0.1 (so that sqrt(g*h)>=1m/s); you can do this by:
    Edit-->Edit over grid/regions-->Evaluate, and then in the dialogue box, type depth=max(depth,0.1). (Note that the Evaluate function is also very useful for generation of other .gr3 files needed by SCHISM)
  • Special-->Dimensionless numbers, and then in the right half of the dialogue box, type in dt, Warning value (say 0.4), Unacceptable value (say 0.4) and depress 'Display filled' button. The color will appear in the main window, with red indicating good CFL, and green for bad CFL. You may also 'Display Courant number' but this may take a while to refresh, and so you may want to zoom into a small region first.
  • revise your grid accordingly


Remember, if you have to reduce the time step for some reason, you may have to refine grid because of CFL. It's wise to plan for a smallest dt you expect to use for a system, and design your grid according to this dt. This issue is closely related to the convergence property of SCHISM.

In tsunami simulations, dt has to be small due to small wavelength, and you can bypass the CFL condition by turning off advection in deeper depths as the advection is negligible there. You also need to make sure that each wavelength is resolved by at least 20 grid points.

Grid near wetting and drying

It's important to have the grid follow the initial shoreline. Reasonable grid transition should be done from shoreline to dryland. Use comaprable or finer grid resolution in the dryland that is expected to be wetted, and then transition to coarser resolution beyond (to account for rare inunation).

Simulating wetting and drying well with SCHISM requires some effort; read more here.

IMPORTANT: in grid generation, make sure channels are resolved by at least 2 alway wet nodes, to allow flow to pass thru. Failure to do so may lead to noisy flow field.

Barotropic simulation

Grid quality requirement is relatively lax for barotropic simulations. Besides the considerations above, you mainly need to use appropriate resolution based on physics (e.g., generally coarser resolution in deeper depths and finer resolution for shallow depths). Remember: you are on unstructured grid territory, and so you are free to resolve features as you wish!

Another commonly asked question is the max. element skewness. SCHISM, in either barotropic or baroclinic configuration, can tolerate elements as skew as 20! (skewness is defined as the ratio between the max. side and the equivalent radius)



Baroclinic simulation

The transport process is influenced by your choice of grid, and so grid for baroclinic simulations needs some attention. For example, the channels should be gridded as quasi-structured grid ('Patches' in SMS).

The Courant number condition for transport may need to be accounted for during gridgen, especially if you use TVD scheme. In SCHISM, the time steps used for momentum and transport can be different, with the latter being usually smaller (the model will automatically calculate the transport step for you and do sub-cycling). The Courant number condition for the transport equations is:

Cu=c*|u|*dtb/dx<1
where c=1 for upwind and c<1 for TVD; dtb is the transport time step.

Therefore especially for TVD schemes, you should avoid excessively refining areas that expect high flow. Fortunately, there are tools to help you identify 'choke' regions. Here is a document on how to do a good salt intrusion study with SCHISM's TVD scheme.