Difference between revisions of "Mesh generation"

From ccrmwiki
Jump to: navigation, search
(Baroclinic simulation)
Line 10: Line 10:
 
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 (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  
+
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.
  
Line 21: Line 21:
 
<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>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
Line 27: Line 27:
  
  
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_SELFE convergence property of SELFE].
+
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.
 
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.
Line 35: Line 35:
 
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).
 
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 SELFE requires some effort; read more [http://ccrm.vims.edu/w/index.php/Simulating_wetting_and_drying_with_SELFE here].
+
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.
 
'''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.
Line 43: Line 43:
 
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!
 
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. SELFE, 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)
+
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)
  
  
Line 53: Line 53:
 
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 may need to be accounted for during gridgen, especially if you use TVD scheme. 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). The Courant number condition for the transport equations is:
+
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/>
 
Cu=c*|u|*dtb/dx<1 <br/>
 
where c=1 for upwind and c<1 for TVD; dtb is the transport time step.
 
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 SELFE's TVD scheme.
+
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.

Revision as of 12:25, 18 December 2014

Grid generation tool

We recommend SMS for grid generation.

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.