How to execute scheme commands by UDF

Valérie Gelbgras
Valérie Gelbgras Member, Employee Posts: 157
50 Answers 100 Likes 10 Comments Name Dropper
✭✭✭✭
edited June 2023 in Fluids

How to execute scheme commands by UDF

Tagged:

Answers

  • Valérie Gelbgras
    Valérie Gelbgras Member, Employee Posts: 157
    50 Answers 100 Likes 10 Comments Name Dropper
    ✭✭✭✭
    Answer ✓

    In the Fluent console, we can define a variable which contains the scheme command to execute. The value of this variable can be updated by UDF. Then the command can be applied with a calculation activity.

    To define the variable, type the following command in the Fluent console. In the example below, the variable is called 'mycommand'.

    (rp-var-define 'mycommand "" 'string #f)

    The value of the variable can be updated by UDF with the macro RP_Set_String. In the example below, the value of the variable is set to "/solve/set/time-step 2.5".

    #include "udf.h"
    DEFINE_ON_DEMAND(update_mycommand)
    {
        RP_Set_String("mycommand", "/solve/set/time-step 2.5");
        Message0("\n\n UDF DONE \n\n");
    }
    

    In the calculation activities, we can define an execute command with the command below.

    (ti-menu-load-string (%rpgetvar 'mycommand))