Modify surface and volume databases

This treatment allows the user to modify the database at run-time. This could allow the user to modify the geometry on which perform the FWH treatment (by removing nodes, zones, etc). This can also be used to modify the physical variables in a more complex way than what it is allowed with the redim or equations keywords

For performance reasons, this modification is not done over the whole database at once, but one instant at a time during the FWH main execution loop. This reduces the memory footprint of the treatment as the whole database will not be uploaded into memory. This also allows to implement some additional performance optimizations.

The modification is done by using the functions provided by the user using the modify_surface and modify_volume keywords. These keywords require as value a function that accepts 3 arguments:

  1. base: An antares.Base with only one instant (the instant currently being processed).

  2. it: an integer containing the current iteration index starting from 0.

  3. user_defined_vars: a dictionary in which the user can store any variable to be re-used for future iterations.

A skeleton and usage of this function is shown below:

import antares

def modify_surface(base: antares.Base,
                   it: int,
                   user_defined_vars):

    # Modify base
    new_base = # ...

    # return modified base
    return new_base

treatment = antares.Treatment('fwh')
treatment['modify_surface'] = modify_surface
# .
# .
# .
treatment.execute()

Internally, the FWH treatment stores the geometric and the physical variables in different bases. If mesh_kinetics is either 'static' or 'rotating_reference_frame', the variable geometry is taken from the output of the modify_surface function at it=0. Trying to modify the geometric variables for it>0 will have no effect.

Warning

The treatment does not check that the modification applied to the base are consistent with what the treatment needs.

The user must ensure consistency between all the instants and the geometry. This is especially true when trying to remove nodes, cells or zones. They must be removed from each instant.