This is a short tutorial explaining how the tool Tekigo helps you to control the
metric you will feed to your adaptation library (Usually MMG today) for a raw adaptation, equivalent to what you did with the
To make a mesh adaptation for less than 600 MCell yoThe u will need:
- a virtual environment with Tekigo installed. See details on Tekigo Nitrox Site.
- 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 solution on the same mesh. It can be averaged or instantaneous.
Prepare your tekigo script using this baseline.
import numpy as np from tekigo import (TekigoSolution, raw_adapt) tekigo_sol = TekigoSolution(mesh='default.mesh.h5', solution='default_inst.sol.h5', overwrite_dir=True, out_dir='./Results')
This is mixing together your mesh
default.mesh.h5 and solution
You also define here that the results will always be rewritten in a folder called
./Results. This dough is called the TekigoSolution object.
Then you declare that you will use the “Temperature” field as Quantity of Interest(QOI) for the TekigoSolution object. This allows you to specifically load this QOI:
tekigo_sol = TekigoSolution(.... only_sol_vars=['temperature'], ....) temp = tekigo_sol.load_current_solution()['temperature']
temp quantity is now a Numpy array of shape
nnode being the number of nodes in the mesh.
Now you can prepare your metric recipe using all your imagination. Just make sure that this metric comply to the following rules:
- The metric being the ratio
new edge/initial edgeit must positive and reasonable [0.5-4] : 0.5 is 8 times more cells, 4 is 64 times less cells.
- The metric is a numpy array of shape
- The metric is not including
The methods available in numpy can be explored from the NumPy Reference.
Here we could use a bold refinement zone where temperature is higher than 1200k.
metric_field = np.where(temp>1200, 0.6, 1)
… or prefer a coarsen refine softer version:
metric_field = np.where(temp>1200, 0.8, 1.2)
But usually it is nicer to provide an initial gradient using your QOI, such as
crit = np.array((temp - 800) / (1500 - 800)) crit = np.clip(met, 0, 1) metric_field = 0.8 + (1.-crit)*0.4
You can pass this metric and the tekigo solution to the function
and execute the script in your Tekigo Environment. The total recipe looks like:
import numpy as np from tekigo import (TekigoSolution, raw_adapt) tekigo_sol = TekigoSolution(mesh='default.mesh.h5', solution='default_inst.sol.h5', overwrite_dir=True, only_sol_vars=['temperature'], out_dir='./Results') temp = tekigo_sol.load_current_solution()['temperature'] crit = np.array((temp - 800) / (1500 - 800)) crit = np.clip(met, 0, 1) metric_field = 0.8 + (1.-crit)*0.4 raw_adapt(tekigo_sol, metric_field)
And this ends the easiest recipe with Tekigo.