In a general description of Tekigo a succinct overview of the Tekigo python tool was provided and some relevant terminology introduced. In this page we will focus on the capability of Tekigo in an illustrative sense without going into too much detail. It is intended as a complementary to the comprehensive tutorial pages (beginner, intermediate). After this short read, the reader will understand the possibilities Tekigo can offer and have a sense of how the workflow is structured.

read time: 7 min

Summary of the tool

Tekigo is

  • not a meshing tool
  • a python wrapper enabling the interface with an actual meshing tool for static mesh adaptation
  • currently linked to the MMG meshing tool through the intermediate of HIP

Fig.1 Interfacing sequence of Tekigo.

  • allows the user to define metrics used for adaptation

Fig.2 A simple example of adaptation based on a temperature field.

  • provides
    • two “operation modes”
      • raw adapt: a one time refinement
      • refine: a recursive refinement
    • the user with full control on the definition of their refinement metric(s) with some boundary conditions
    • an a priori estimation of the final mesh size without performing the refinement
      • the dry run mode

We will now go through the different options of Tekigo.

Note: The current developments of Tekigo are performed within the context of the AVBP CFD solver with its mesh and solution formats. However, it does not preclude the possibility for its use with other CFD solvers. On the contrary, through the intermediate of HIP, different mesh formats can be read in and written out which does limit the developments to the interfacing between Tekigo and HIP.

Using Tekigo

The trapped vortex setup

Similarly to Fig.2 , the examples will use a part of the trapped vortex setup which is illustrated below. It is a purely educational burner configuration. We will rely on the axi-symmetric character of the geometry. The results in following will be presented for a cut in the xy plane at the center of the latter geometry (z = 0).

Fig.3 The trapped vortex geometry.

The raw adapt mode

A first possibility with Tekigo is a one time refinement with a given metric which is achieved through the raw_adapt functionality.
The metric is

  • user defined and will control the refinement / coarsening
  • a value assigned to each node of the mesh, similar to a field variable
  • \(\in\) [0.5 - 4] with < 1 refine, =1 do nothing, > 1 coarsen
e.g. metric = np.where(temperature > 1200, 0.8, 1.2)
Fig.4 Example of metric definition and its impact on the “raw adapt” refinement.

Raw adapt requires

  • an initial mesh
  • an initial solution
  • a metric


  • an average solution

In practice:

import numpy as np
from tekigo import (TekigoSolution,
# create a tekigo solution with required fields
tekigo_sol = TekigoSolution(mesh='default.mesh.h5',
# create our metric
temp = tekigo_sol.load_current_solution()['temperature']
metric_field = np.where(temp>1200, 0.8, 1.2)
# perform the adaptation
raw_adapt(tekigo_sol, metric_field)
Fig.5 Example of a temperature based “raw adapt” refinement.

The (recursive) refine mode

Another possibility offered by Tekigo is the refine function which can1 run in a recursive manner. It comes in handy when we would like to exert some control on the final grid in the form of a maximum number of nodes for instance. The recusive loop will aim towards the mesh size bounded by the user defined parameters. The refine function takes in a criterion (or multiple criteria) instead of a metric. The criterion is

  • user defined and will control the refinement / coarsening indirectly, i.e. zones will be flagged for refinement / coarsening in a recursive sense following the criterion
  • a value assigned to each node of the mesh, similar to a field variable
  • \(\in\) [-1, 1] with
    • 0 : no adaptation
    • -1: max coarsening
    • 1: max refinement
  • is converted by HIP into a metric as shown in Fig.6 for a temperature based criterion
Fig.6 Example of criterion definition and its impact on the “refine” refinement.

Refine requires

  • an initial mesh
  • an initial solution
  • a criterion (or criteria)


  • an average solution
  • a maximum number of iterations
  • a maximum node number
  • a minimum edge size
  • enable coarsening
  • L2 criterion

Note1: If the maximum number of iterations is set to 1 its use is similar to the raw adapt mode but the underlying implementation methodology differs. It has still the advantage of handling multiple criteria without the need for the user to combine them.

In practice:

Single criterion

An example snippet for a single criterion, corresponding to the result in Fig.7, is given below. The implementation choices are such that the refine() function takes as argument a dictionary containing functions wherein the different criteria are defined. Tekigo “knows” it has to provide the dictionary input with the tekigo solution (ts_ in this example) as an argument.

import numpy as np
from tekigo import (TekigoSolution,
# create a tekigo solution with required fields
tekigo_sol = TekigoSolution(mesh='default.mesh.h5',

# create our criterion function
def temperature_criterion(ts_):                                                  
    temp = tekigo_sol.load_current_solution()['temperature']
    criterion = np.where(temp>1000,0.4,0)
    return criterion

# gather our criterion in a dictionary
def custom_criteria(ts_):
    """Funtion to wrap the criterions"""
    criteria = dict()
    criteria['temperature_crit'] = temperature_criterion(ts_)
    return criteria

# perform the adaptation
       dry_run = False,
Fig.7 Example of a temperature based “refine” refinement.
Multiple criteria

A very useful aspect of the refine mode is its ability to deal with multiple criteria at once. In the same manner as detailed in the Single criterion paragraph above, the criteria should be gathered as functions in the form of a dictionary. This is futher exemplified in Fig.8, illustrating the workflow for use of this capability.

Fig.8 The use of multiple criteria with “refine” refinement.

How do we get a “feel” of our refinement control : the dry run

The refinementy parameters might seem somewhat abstract, i.e. numbers between given ranges. It could becomes difficult to get a “feel” on how our metric or criterion (criteria) definition will impact or refinement. The dry_run functionality can greatly help in such situation. It is deactivated by default.

The dry run

  • is a boolean
    • True:
      • Tekigo rewrites a solution with the metric and future_edge_size fields AND estimate te future number of nodes
      • The above outputs are the best metrics to get a better grasp on the resulting refinement
    • False (default): Tekigo asks HIP to do re refinement
  • can be activated in both raw_adapt and refine mode
  • provides estimates from which the final refined solution can differ
  • does not ensure the refinement will succeed

Final comments

  • Tekigo will not prevent sudden changes in the metric provided. However, the meshing tool (MMG in this case) will put some bounds on the ratio between edges based on a maximum authorized gradient. There are some filters in Tekigo to smooth gradients that can occur (gather, scatter functionality) or even move them (dilate, erode functionality.)

  • The full control on the metric / criterion definition is left to the user. If the user ensures that these are as smooth as possible, the differences between the final and the intended result will be minimized.

  • At this point you have every bit of knowledge on the capability of Tekigo. Time to get started with the hands on (beginner, intermediate)


The development of Tekigo and its functionalities have been made possible through a collaborative effort within the COOP group. In particular the developments made by Théo Defontaine and Tamon Nakano which are duly acknowledged.

Like this post? Share on: TwitterFacebookEmail

Jimmy-John Hoste is a postdoctoral researcher in computer science engineering with a focus on CFD related topics.

Keep Reading





Stay in Touch