Auto grid
  • 02 Apr 2025
  • 5 Minutes to read

Auto grid


Article summary

The Auto Grid menu choice opens the Auto Grid tool. The Auto Grid tool creates a grid automatically based on the current scenario setup and a set of grid guidelines.

How it works

Auto Grid creates a grid by using a genetic algorithm to minimize an error value computed by a set of constraints, such as stretch factor or cell sizes in different regions, and the cell count. The constraints are generated from the scenario setup based on a set of rules, based on the FLACS Grid Guidelines for FLACS.

These rules can be found in the example file FLACS-CFD_24.2/doc/grid-guidelines-example.yml in the FLACS installation. It is possible to make a modified version of this file and have Auto Grid use it by setting the AUTOGRID_GUIDELINES_PATH environment variable to point to the modified file.

Note

The format and contents of this file may change in future versions of FLACS and any changes made may not be compatible.

Auto Grid regions

Box diagram showing total domain, ROI far field, ROI near field and Core domain regions for Auto Grid functionality.

Relationship between Auto Grid regions.

The rules for defining Auto Grid regions are defined in the following sections.

Total domain

The total domain should be:

  • 20% bigger than any other region.

  • 3 times core domain extent in each direction.

  • 2.5 panel lengths away from active panel in opening direction.

  • 1 panel length away from active panel in all other directions.

  • 5 times pool diameter from center of pools in horizontal direction.

  • from center of pools in vertical direction.

ROI far field

User defined, otherwise at least 20% bigger than ROI near field. Expanded if necessary to include monitor points, panels, and regions.

ROI near field

User defined, otherwise at least 20% bigger than core domains.

Core domains

Dust and gas clouds: Bounding box around cloud.

Point leak: Centered on leak. Size is expanded leak area in each direction.

Area leak: Centered on leak. Size is leak dimension in leak plane, largest leak dimension in leak direction.

Pool: Centered on pool. Horizontal extent = pool diameter. Vertical extent = height + where height is difference in Z when projecting pool on to geometry.

Limitations

  • It does not work with FLACS-Blast.

  • It does not consider custom gas clouds.

  • It does not include any guidelines related to geometry.

  • It is important to still conduct a manual QA of the grid and check porosities using the verify porosities tool.

  • The Auto Grid tool can produce a different result depending on whether you are running on Linux or Windows. This is due to differences in the implementation of libraries on said systems.

Auto Grid dialog window

Screenshot of the Auto Grid dialog window showing input fields including ROI near field, ROI far field and Max extent dimensions.

Auto Grid dialog window

Region of interest

The Auto Grid window has inputs for specifying region of interest (ROI) and the maximum extents of the generated grid. These have also default values computed based on the scenario or geometry.

The maximum extent can be set to be exact or a limit. For example if the geometry has a ground plane at Z=0, setting the Min value of the Max extent in Z direction to the limit 0.0 will make sure the grid is never below the ground, but is allowed to have the minimum bound above it.

Fixed gridlines

The Auto Grid window has lists of suggested fixed gridlines along each axis. These are based on surface of the geometry along this line. The lists can be sorted by surface area by clicking the header. It is recommended to have fixed gridlines where there are big walls and floors. It is also possible add user defined fixed grid lines. For user defined gridlines, the surface area will not be computed. Each fixed gridline creates a new constraint which can make the grid generation run slower.

Constraints list

The constraints list shows the constraints that will be applied to the generated grid, with the current deviation/error. This error value updates during generation of the grid.

Generating the grid

While generating the grid, a graph shows the current accumulated deviation from the constraints and the cell count in the grid. These will go down as the genetic algorithm computes a generation with an improved grid. It can also happen that the deviation goes slightly up if a grid with lower cell count is found, or vice versa. The grid generation will run slower when there are many constraints, for example caused by many active panels or many fixed gridlines.

Stop criteria

The stop criteria tab allows setting a limit when the grid is done. After stopping, it is possible to resume to try improving the grid for more generations.

Auto Grid configuration file

When the scenario in CASD is saved, the settings for Auto Grid will be saved in a file called autogrid.cfg. This contains the fixed gridlines selection and the region of interest defined. It can be loaded by the Auto Grid command line utility.

Auto Grid command line utility

The command line utility autogrid can be used to generate grids outside of CASD. To see a help text run with autogrid--help.

Auto Grid Python API

Auto Grid also has a Python API. See the FLACS Python API reference for more information about this.

Demonstration

Auto Grid tips

How do I set my core domains?

Just set your leaks, clouds or pools as usual prior to using Auto Grid. Auto Grid will detect these and create suitable core domains in line with the grid guidelines.

Do I still need to use the leak refinement wizard?

No, the leak refinement wizard is not required when using Auto Grid. Set the leaks, clouds or pools and then run the Auto Grid function to create a grid with refinement around them.

Will the Auto Grid tool identify pressure relief panels and monitor points?

Yes, Auto Grid will identify pressure relief panels and monitor points. By default the tool will attempt to fix gridlines to every pressure relief panel. With scenarios with a large number of panels, this may result in errors for some other constraints. Hence, it may be beneficial to create panels and monitor points after using Auto Grid and then snap these to the grid.

Do I need to set leaks, pools, gas or dust clouds before running Auto Grid?

Yes, you should set all leaks, pools and clouds prior to running Auto Grid so that suitable core domains can be created around these features.

Do I need to check the grid afterwards?

Yes, the Auto Grid tool uses algorithms to produce a grid with regions suitable for the defined constraints. The resultant grid should be manually checked to confirm that the grid is suitable and is within a reasonable error of the constraints. A manual check of geometry related grid guidelines should be conducted as these are not considered by the tool. Porosities should also be checked to ensure the geometry has been properly captured.

Will Auto Grid work for all scenarios?

Currently, the Auto Grid tool does not work for FLACS-Blast or scenarios with custom gas clouds. The tool also may not be appropriate or unable to keep error values low for scenarios with a large number of constraints.


Was this article helpful?