Fluids

Fluids

How to automate the calculation of 100+ combinations in fluent

    • sidjou
      Subscriber

      Hi Everyone,

      I want to automate the simulation of a plate moving normal to a fixed plate. I have one of these two parameters to vary from one calculation to another : the static distance between the 2 plates and the moving signal (amplitude, frequency). I'm wondering which method i have to use between the journal files and the design point.

      I have seen that using a motion profile requires me to create a case file for each combination that i want to investigate before defining the journal files. Since I have more than 100 combinations = 100+ cases files to generate, I want to avoid the use of the journal files if possible. Does the motion User-Defined Function enable the use of the design point instead of the journal files?

      I'm also investigating the use of expression at the boundary condition to define the motion of the plate. Does it possible to define the plate movement using fluent expressions and avoid motion udf/profil? If yes, does it allow to use a design points to change the amplitude, frequency from one calculation to another? Do you have any idea of how i can simplify this automation?

      p.s.: I have already run my model with a motion profile.

      Thanks in advance for your insights!

    • DrAmine
      Ansys Employee

      With motion profile UDF you are referring to DEFINE_CG_MOTION? In the UDF part you can access Input paramters and so if you can paramterize the input into the UDF you have already that part which you can steer without the need to write 100 of files and to use journal file for that. Regarding the other parameter: distance between the plates: Is it a parameter from the pre-processing? Are you using Fluent Workbench

      • sidjou
        Subscriber

        I am using Fluent Workbench. I'm not familiar with the definition of the motion of mesh zones with UDF. For my initial runs, i used a .PROF file to define the motion of the plate. Can you recommend me ressources that i can explore to parameterize the input and write the UDF, please? Does it need the use of the designpoints or how does the automation work with your parameterization and UDF idea? 
        In my pre-processing step, i define (manually) the distance between the plates in my model and run the mesh before updating that to fluent. But i want also to include the plates distance in my automation.

    • sidjou
      Subscriber

       

       

       

       

    • DrAmine
      Ansys Employee

      Can the motion be paramterized? 

      The distance parameter is straightforward and you need just to label that distance as parameter.

      • sidjou
        Subscriber

        I don't understand your question "can the motion be parameterized?" I need to parameterize the input amplitude and frequency to change the plate motion from one calculation to another. 

        To label the distance as parameter, I have to do that in UDF or in which tools?

        Please, any ressources that could be useful will be appreciated.

    • DrAmine
      Ansys Employee

      You understand my question: so if the motion has amplitude and frequency to be parameterized then you can provide these two as input paratmers in Fluent. On the UDF side you can access these two paramters to write your own DEFINE_CG_MOTION.

      You do not need to use UDF for the distance: that is a parameter which you will set in SpaceClaim or DesignModeler.

      Did you go though the standard Fluent tutorials?

      How to access Input Parameters defined in Ansys Fluent in a user defined function: Check the Customization Manual of Ansys Fluent.

      • sidjou
        Subscriber

        Thanks, i will go through the manual.

        For the automation part, do i need a specific tool to run each combination?:
        plate Distance | Amplitude | Frequency
        D1             A1              F1

        D2             A2              F2

    • DrAmine
      Ansys Employee

      No you just deploy the Workbench and create Design Points. You can then update all design points and rely there on Remote Solve Manager if you want to transfer to a queue or something or run locally.

      • sidjou
        Subscriber

        A scheme procedure is it mandatory when using input parameters with define_CG_motion, please?

    • DrAmine
      Ansys Employee

      No you just tell Fluent that you want to use the Input Parameter in UDF and then you can access that as mentioned in the Customization Manual.

      • sidjou
        Subscriber

        I'm not able to load the udf.library when using an input parameter. I report the compile console script at the end.

        Error: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).\n\nLe fichier sp�cifi� est introuvable.

        \n\nC:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_host\libudf.dll

        Error Object: #f


        I have registered the frequency as the input parameter in fluent. My UDF like :

        #include "udf.h"
        /*#define freq 100.0*/
        #define freq RP_Get_Input_Parameter(“real-1”)
        #define angular_freq 2.0*M_PI*freq
        #define amp 0.5

        DEFINE_CG_MOTION(plate, dt, cg_vel, cg_omega, time, dtime)
        {
            real disp;
         
          disp = amp*angular_freq*cos(angular_freq*time); /*displacement speed*/

          cg_vel [0] = 0.0;
          cg_vel [1] = 0.0;
          cg_vel [2] = disp;
         
          cg_omega [0] = 0.0;
          cg_omega [1] = 0.0;
          cg_omega [2] = 0.0;
        }
         
        Compiled console script:

        Copied C:\Users\...\TRIAL UDF\UDF\platetest_input.c to libudf\src

        (system "copy "C:\PROGRA~1\ANSYSI~1\v212\fluent"\fluent21.2.0\src\udf\sconstruct.udf "libudf\win64\3ddp_host\SConstruct" ")

        1 fichier(s) copi?(s).

        (system "copy "C:\PROGRA~1\ANSYSI~1\v212\fluent"\fluent21.2.0\src\udf\scons_default.bat "libudf\win64\3ddp_host\scons_test.bat" ")

        1 fichier(s) copi?(s).

        Creating user_nt.udf file for 3ddp_host ...

        (system "copy "C:\PROGRA~1\ANSYSI~1\v212\fluent"\fluent21.2.0\src\udf\makefile_nt.udf "libudf\win64\3ddp_host\makefile" ")

        1 fichier(s) copi?(s).

        (chdir "libudf")(chdir "win64\3ddp_host")

        C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_host>rem

        C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_host>rem Copyright 1987-2021 ANSYS, Inc. All Rights Reserved.

        C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_host>rem

        'cl.exe' n'est pas reconnu en tant que commande interne

        ou externe, un programme ex?cutable ou un fichier de commandes.

        'clang-cl' n'est pas reconnu en tant que commande interne

        ou externe, un programme ex?cutable ou un fichier de commandes.

        scons: Reading SConscript files ...

        scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

        File "C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_host\SConstruct", line 8, in

        scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

        File "C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_host\SConstruct", line 18, in

        Compiler used is "C:\PROGRA~1\ANSYSI~1\v212\fluent"\ntbin\clang\bin\clang-cl

        Linker used is "C:\PROGRA~1\ANSYSI~1\v212\fluent"\ntbin\clang\bin\lld-link

        scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

        File "C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_host\SConstruct", line 148, in

        Copy("C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_host\resolve.exe", "C:\PROGRA~1\ANSYSI~1\v212\fluent\ntbin\win64\resolve.exe")

        Copy("C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_host\platetest_input.c", "C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\src\platetest_input.c")

        UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 324: character maps to :

        File "C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_host\SConstruct", line 172:

        generate_udf_source(t,s,env)

        File "C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_host\SConstruct", line 87:

        for line in f:

        File "C:\PROGRA~1\ANSYSI~1\v212\fluent/../commonfiles/CPython/3_7/winx64/Release/python\lib\encodings\cp1252.py", line 23:

        return codecs.charmap_decode(input,self.errors,decoding_table)[0]

        (system "copy "C:\PROGRA~1\ANSYSI~1\v212\fluent"\fluent21.2.0\src\udf\sconstruct.udf "libudf\win64\3ddp_node\SConstruct" ")

        1 fichier(s) copi?(s).

        (system "copy "C:\PROGRA~1\ANSYSI~1\v212\fluent"\fluent21.2.0\src\udf\scons_default.bat "libudf\win64\3ddp_node\scons_test.bat" ")

        1 fichier(s) copi?(s).

        Creating user_nt.udf file for 3ddp_node ...

        (system "copy "C:\PROGRA~1\ANSYSI~1\v212\fluent"\fluent21.2.0\src\udf\makefile_nt.udf "libudf\win64\3ddp_node\makefile" ")

        1 fichier(s) copi?(s).

        (chdir "libudf")(chdir "win64\3ddp_node")

        C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node>rem

        C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node>rem Copyright 1987-2021 ANSYS, Inc. All Rights Reserved.

        C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node>rem

        'cl.exe' n'est pas reconnu en tant que commande interne

        ou externe, un programme ex?cutable ou un fichier de commandes.

        'clang-cl' n'est pas reconnu en tant que commande interne

        ou externe, un programme ex?cutable ou un fichier de commandes.

        scons: Reading SConscript files ...

        scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

        File "C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\SConstruct", line 8, in

        scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

        File "C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\SConstruct", line 18, in

        Compiler used is "C:\PROGRA~1\ANSYSI~1\v212\fluent"\ntbin\clang\bin\clang-cl

        Linker used is "C:\PROGRA~1\ANSYSI~1\v212\fluent"\ntbin\clang\bin\lld-link

        scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

        File "C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\SConstruct", line 148, in

        Copy("C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\resolve.exe", "C:\PROGRA~1\ANSYSI~1\v212\fluent\ntbin\win64\resolve.exe")

        Copy("C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\platetest_input.c", "C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\src\platetest_input.c")

        UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 324: character maps to :

        File "C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\SConstruct", line 172:

        generate_udf_source(t,s,env)

        File "C:\Users\...\TRIAL UDF\Trial UDF input_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\SConstruct", line 87:

        for line in f:

        File "C:\PROGRA~1\ANSYSI~1\v212\fluent/../commonfiles/CPython/3_7/winx64/Release/python\lib\encodings\cp1252.py", line 23:

        return codecs.charmap_decode(input,self.errors,decoding_table)[0]

        Done.

    • DrAmine
      Ansys Employee

      Please try first to compile outside of the Workbench and if possible with a more recent Fluent version. (also avoid having spaces in directory names, file names etc..)

    • DrAmine
      Ansys Employee

      No issues compling your UDF in 22R2 Standalone Ansys Fluent.

      • sidjou
        Subscriber

         

        I have upgraded my fluent version but i still have the same issue.Which version of Visual Studio do you have? Because i notice in the console lines that VS could be the cause of the issue, even though i already have it install. 

        ‘cl.exe’ n’est pas reconnu en tant que commande interne

        ou externe, un programme ex?cutable ou un fichier de commandes.

        ‘clang-cl’ n’est pas reconnu en tant que commande interne

        ou externe, un programme ex?cutable ou un fichier de commandes.

        scons: warning: No version of Visual Studio compiler found – C/C++ compilers most likely not set correctly

         

        Some people already faced this issue but there is no clear workaround.

    • DrAmine
      Ansys Employee

      I did not experience any issues using the built-in compiler in 22R2. Select that built-in compiler explicelty and try again.

      • sidjou
        Subscriber

        The same issue when using built-in compiler in 22R2. 

        (system "copy "C:\PROGRA~1\ANSYSI~1\v222\fluent"\fluent22.2.0\src\udf\sconstruct.udf "libudf\win64\3ddp_node\SConstruct" ")

        1 fichier(s) copi?(s).

        (system "copy "C:\PROGRA~1\ANSYSI~1\v222\fluent"\fluent22.2.0\src\udf\scons_test.bat "libudf\win64\3ddp_node\scons_test.bat" ")

        1 fichier(s) copi?(s).

        (chdir "libudf")(chdir "win64\3ddp_node")

        scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

        File "C:\...\FLUENT\TRIALUDFINPUT\TrialUDFinput_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\SConstruct", line 8, in

        scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

        File "C:\...\FLUENT\TRIALUDFINPUT\TrialUDFinput_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\SConstruct", line 18, in

        Compiler used is "C:\PROGRA~1\ANSYSI~1\v222\fluent"\ntbin\clang\bin\clang-cl

        Linker used is "C:\PROGRA~1\ANSYSI~1\v222\fluent"\ntbin\clang\bin\lld-link

        scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

        File "C:\...\FLUENT\TRIALUDFINPUT\TrialUDFinput_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\SConstruct", line 152, in

        Copy("C:\...\FLUENT\TRIALUDFINPUT\TrialUDFinput_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\resolve.exe", "C:\PROGRA~1\ANSYSI~1\v222\fluent\ntbin\win64\resolve.exe")

        Copy("C:\...\FLUENT\TRIALUDFINPUT\TrialUDFinput_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\platetestinput.c", "C:\...\FLUENT\TRIALUDFINPUT\TrialUDFinput_files\dp0\FLU-1\Fluent\libudf\src\platetestinput.c")

        UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 324: character maps to :

        File "C:\...\FLUENT\TRIALUDFINPUT\TrialUDFinput_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\SConstruct", line 176:

        generate_udf_source(t,s,env)

        File "C:\...\FLUENT\TRIALUDFINPUT\TrialUDFinput_files\dp0\FLU-1\Fluent\libudf\win64\3ddp_node\SConstruct", line 87:

        for line in f:

        File "C:\PROGRA~1\ANSYSI~1\v222\fluent/../commonfiles/CPython/3_7/winx64/Release/python\lib\encodings\cp1252.py", line 23:

        return codecs.charmap_decode(input,self.errors,decoding_table)[0]

        Done.

         

        When I click on LOAD

        m...: Opening library "C:\...\FLUENT\TRIALUDFINPUT\TrialUDFinput_files\dp0\FLU-1\Fluent\libudf"...

        ERROR: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).

        Le fichier sp�cifi� est introuvable.

        C:\\...\\FLUENT\\TRIALUDFINPUT\\TrialUDFinput_files\\dp0\\FLU-1\\Fluent\\libudf\\win64\\3ddp_host\\libudf.dll

        Done.

        • DrAmine
          Ansys Employee

          Let me check internally: same UDF on my side using Built-in compiler did work. Perhaps worth checking the format of the UDF.

    • DrAmine
      Ansys Employee

      You can attach the file you are trying to compile here to check its format or it is related to that at all.

      • sidjou
        Subscriber

        I am only able to attach an image not a file. So i copy paste my code from Notepad++

         

        #include "udf.h"
        #define freq RP_Get_Input_Parameter(“real-1”)
        #define angular_freq 2.0*M_PI*freq
        #define amp 0.5

        DEFINE_CG_MOTION(plate, dt, cg_vel, cg_omega, time, dtime)
        {
            real disp;
         
          disp = amp*angular_freq*cos(angular_freq*time); /*displacement speed*/

          cg_vel [0] = 0.0;
          cg_vel [1] = 0.0;
          cg_vel [2] = disp;
          
          cg_omega [0] = 0.0;
          cg_omega [1] = 0.0;
          cg_omega [2] = 0.0;
        }


        Thanks for your help!

    • DrAmine
      Ansys Employee

      That content I can compile as mentioned. Please verify that it has UTF-8 format. if it is case then a more in-depth check of your system / machine might be required.

    • DrAmine
      Ansys Employee

      Pass me your university mail adress to share with the version working for me.

      • sidjou
        Subscriber

        My file is in UTF-8 format as you can see in my screenshot.

         

      • sidjou
        Subscriber

         

         

         

    • DrAmine
      Ansys Employee

      I sent a message.

      • sidjou
        Subscriber

        Thank you Dr Amine! It is working now. 
        I have an another question, please. Is it possible to define an input parameter in fluent wich depend of a geometry parameter? For example, i want to define an input parameter amplitude which will be function of the distance between the 2 plate set in the geometry model.

        • DrAmine
          Ansys Employee

          Can you please tell me which setting did help on your side? (That button under Region Settings)?

        • sidjou
          Subscriber

          I didn't touch my region setting

          I just copy my code in a new Notepad++ file and rename it with no space and no underscore.

        • DrAmine
          Ansys Employee

          You can create an Input paramter derived from another parameter in the WB. Best to frist create an input parameter in Ansys Fluent. Then in the WB you say it is for example equal to Input Paramter 1. Now in Fluent with that input you can do whatever you want (you can use it to create inside expression etc..). Please test first in a dummy example if this works for you and your UDF.

    • sidjou
      Subscriber

       

      It works, Thanks!
      Please, how can i define the center of gravity and the cell height as input parameters, because it depends of the previous defined distance? I don’t see any option for that.

       

      • DrAmine
        Ansys Employee

        I think you cannot define any input paramters directly for these fields but you can derive the required input via Expression and everytime you are asked to give a value (in TUI for example) you let Ansys Fluent return the value of an Expression (Or RP variable etc..). 

Viewing 14 reply threads
  • You must be logged in to reply to this topic.