Mesh Independence Study

Christian Kongsgaard
2021-09-27

Mesh Resolutions
Mesh Resolutions

Mesh Independence Study

A mesh independence study is a method of investigating, whether the simulation results are independent of the underlying mesh or not. You do it by running a few simulations with different mesh resolution and checking if the results changes. This type of investigation is critical in CFD due to the mechanics of CFD simulations and the underlying mathematics.

How to run a mesh independence study on Compute

On Compute we make it easy to do a mesh independence study. You simply select the MeshIndependenceStudy in the CFD Solution component.

Select MeshIndependenceStudy in the CFD Solution component
Select MeshIndependenceStudy in the CFD Solution component

By default, Compute will create two other mesh resolutions, one that has a finer and one that has a coarser resolution that the initial case. That can however be overridden with an override to the CFD Solution component:

{
  "mesh_independence": {
    "cell_sizes": [
      4,
      8,
      12,
      16
    ]
  }
}

This will create a mesh independence study with base cell size of 4m, 8m, 12m and 16m respectively.

Probing for the MeshIndependenceStudy
Probing for the MeshIndependenceStudy

Evaluating the study

To evaluate the whether the results are dependent on the mesh resolution you will have to specify in which points that evaluation should take place. You can do that simply by connecting and creating a Probe task. If the Probe Points component detects that the upstream case is a MeshIndependenceStudy is will make sure that each of the mesh resolution task will get a probe task. It will also run a Probe Statistics task, that will run when all the Probe tasks are done. That Probe Statistics will calculate the mean square error (MSE), root mean square error (RMSE), standard deviation ( STD), minimum (MIN) and maximum (MAX) between the probes of each mesh resolution.

The result of the Probe Statistics task is a json file containing the fields described above. In the Mesh Independence Demo we read and format that file, so it is more readable in Grasshopper.

Probe Statistics
Probe Statistics

Running the best version

When you have inspected and evaluated the outcome of the mesh independence study you can then run the version of the study you like. Since we have already meshed the case as part of the mesh independence study, we can skip that part when we want to run the real case. We simply copy over the foam folder from the case version we would like.

Run a VWT as normal, but with a few additional overrides
Run a VWT as normal, but with a few additional overrides

{
  "keep_mesh": true,
  "copy_folder": {
    "source": "independence/mesh_1/foam",
    "destination": "foam"
  }
}

When "keep_mesh": true is selected then the components will not create an Action and Mesh task, as it assumes the mesh has already been create. This is true in this case, but we need to use the mesh from our mesh_1 case. We do that by copying the foam folder from independence/mesh_1 into the root level foam. That is done with the "copy_folder" command.

Demo

Try out our Grasshopper demo of this. You can download the script here or find it on the Tutorials page, where it is called Mesh Independence Study



Are you ready to start you journey with Compute?

Sign Up