This is a short tutorial explaining how to use tool Tekigo to refine a mesh inside a Flame

Ingredients

To make a mesh adaptation you will need:

  • a virtual environment with Tekigo installed.
  • a mesh in h5 AVBP-Compatible format. Beware of starting from huge meshes, the adaptation will take a lot of time. You can fetch a light template mesh from our Gilgamesh repository.
  • a instantaneous solution on the same mesh with the combustion enabled.
  • an average solution on the same mesh with the combustion enabled.

The TekigoSolution object

Prepare your Tekigo script using this baseline

import numpy as np
from tekigo import (TekigoSolution,
                    raw_adapt,
                    approx_edge_from_vol_node)


# Lecture du maillage, 
# de la solution instantannee (sur laquelle se fera l'interp finale) 
# et de la sol moyenne (pour lire le HR moyen)
tekigo_sol = TekigoSolution(
    mesh='./silver_reloaded.mesh.h5',
    average_sol='./solut_average_SC_BFER_classique_t_89ms_to_131ms.h5',
    solution='./solut_00000131.h5',
    overwrite_dir=True,
    only_ave_vars=['HR'],
    only_sol_vars=['thick'],
    only_msh_vars=['volume'],
    out_dir='./Results_sol')

mesh = tekigo_sol.load_current_mesh()
solut = tekigo_sol.load_current_solution()

In this recipe, we use both the average solution and the instantaneous solutions.

Reading the quantities of interest

The quantities of interest are the following:

# Variables
log10hr = np.log10(np.clip(solut['HR'],0.1,None))
thick = solut['thick']
vol_node = mesh['volume']
  • log10hr, the Heat release of the average field is read using a log10(). This will be used as crude estimator of the flame position.
  • thick,the instantaneous thickening is used to evaluate the maximal thickening in use. In this case, this thickening is very high.
  • vol_node, the volume at node is used as a crude estimator of the edge.
Isolating the flame brush

The flame brush is considered for zones with an average Heat release higher than 10^8. The following computation set a field null below 10^8, equal to unity beyond 10^9.

flame_brush = np.array((log10hr - 8) / (9 - 8))
flame_brush = np.clip(flame_brush, 0, 1)

Computing the edges sizes

It is interesting to compute the edge sizes. The following lines show how to compute the minimal edge, then the typical edge found in the flame.

edge_size = approx_edge_from_vol_node(vol_node)
# average Delta_x iwhere the thickening is almost maximum
edge_in_flame = np.average(edge_size[thick > 0.9*thick_max])
print("minimal edge found" , edge_size.min())
print("edge found  in flame" , edge_in_flame)
Defining the metric

Here we simply want to adapt the mesh uniformly inside the flame zone to reduce the need of thickening.

thick_max = thick.max()
thick_tgt = 30.
metric_field = (
    flame_brush*(thick_tgt/thick_max)
    + (1.-flame_brush) * 1.0
)

The metric will naturally be one outside the flame brush, and thick_tgt/thick_max inside the flame brush. In the following image, the edge is divided by 3.

Asking for adaptation

The adaptation is called like this. We use the dry_run=True to avoid the actual mesh adaptation. This allow to run the script and observe the metric computed and the future edge on the initial mesh. Tekigo will also give a rough estimation of the future mesh is it was generated.

raw_adapt(tekigo_sol, metric_field, dry_run=True)

Important Note: The option dry_run=True is especially needed in this case because the user does not control directly the amount of refinement. If he is not cautious enough, an adaptation aiming for several billions of cells could be launched, and a lot of human time could be lost.

Like this post? Share on: TwitterFacebookEmail


Antoine Dauptain is a research scientist focused on computer science and engineering topics for HPC.

Keep Reading


Published

Category

Tutorials

Tags

Stay in Touch