My Project
programmer's documentation
|
This is an example of cs_user_extra_operations which computes the vorticity field values over the whole domain.
First number of cells in the current sub-domain (or the whole domain for a sequential calculation) is retrieved. The number of cells with ghosts (i.e. including halo cells) is retrieved first, then the number of standard cells. The array that will host the velocity gradient values is finally declared, as a 3x3 real matrix array per cell.
The array hosting the gradient values has to be allocated consistantly with his type.
Then the gradient of the velocity is computed. This is done as follows, by calling the appropriate field operator:
The vorticity field has to be retrieved as follows below. Note that if it doesn't exist the pointer will be set to NULL (this is the behavior of the "_try" variant of the field accesser). The vorticity field can have been added through the GUI (menu postprocessing > additional user arrays) or in cs_user_model.
Finally the vorticity values are computed in each standard cell if the field "vorticity" has been well retrieved previously only. Notice the way the gradient values are accessed.
The array holding the gradient values has to be deallocated at the end.