Fluids

Fluids

Read Scheme File

    • Max4
      Subscriber

      Hi,


      I have write a Scheme file (see below) to change the boundary condition of inlet and outlet depending on time.


        (iif (> (rpgetvar' flow-time) 0.033) (
        (ti-menu-load-string "define/boundary-conditions/zone-type 5 wall")
        (ti-menu-load-string "define/boundary-conditions/zone-type 6 pressure-outlet ")
        (ti-menu-load-string "define/boundary-conditions pressure-outlet 6 yes no 0 no yes yes no no")

        (iif (> (rpgetvar' flow-time) 0.066) (
        (ti-menu-load-string "define/boundary-conditions/zone-type 5 mass-flow-inlet ")
        (ti-menu-load-string "define/boundary-conditions mass-flow-inlet 5 yes yes no 0.01 no 0 no yes")
        (ti-menu-load-string "define/boundary-conditions/zone-type 6 wall")


      The problem is, when I try to read this file, I obtain the following error:


         Error: eof inside list


         Error Object: (if (> current_time 0.066) ((ti-menu-load-string "define/boundary-conditions/zone-type 6 wall")))


      I have checked the folder name, direction, file name and there isn´t any problem with this.


      Should I define the current time ? If ys, how? The condition if (> current_time 0.033) is true at the same time as if (> current_time 0.066) . Is it a problem ?


       


      Regards,


      Maxime

    • Karthik R
      Administrator

      Hello,


      You do not have to define these. They are macros already present in Fluent. Also, try rpgetvar 'flowtime and not rpgetvar' flowtime. However, I do not think there is a different between using this or current_time (someone please correct me if I am wrong).


      Try to use the loop such that only one if statement is true. Based on your algorithm, two if statements can be true if t > 0.066. If I understand if condition, you need to have your algorithm such that only one statement is applicable for any given time.


      I hope this helps.


      Best Regards,


      Karthik


       

    • Max4
      Subscriber

      Hello,


      Thank you for your answer. I have just found this about the If-Statement for Scheme file:




      My Scheme is as follow:


      (if (> (rpgetvar 'flow-time) 0.033)
      (ti-menu-load-string "define/boundary-conditions/zone-type 5 wall")
      (ti-menu-load-string "define/boundary-conditions/zone-type 6 pressure-outlet ")
      (ti-menu-load-string "define/boundary-conditions pressure-outlet 6 yes no 0 no yes yes no no")
      )


      When I read this file I have this error, because I have 3 arguments instead of 2. It works when I just use the below scheme:


      (if (> (rpgetvar 'flow-time) 0.033)
      (ti-menu-load-string "define/boundary-conditions/zone-type 5 wall")


      May I use two If statements for the condition t > 0.033 ?


      Error: if syntax: Too many arguments


      Regards,


      Maxime

    • Karthik R
      Administrator

      Hi,


      Can you try the following?


      (if (.....)


         (begin


            (ti-menu-.....(.....))


            (ti-menu-......(.....))


            (ti-menu-......(....))


        )


      )


      Please let me know how this works.


      Thanks.


      Best,


      Karthik

    • Max4
      Subscriber

      I´ve done as you proposed (see below) and the reading of the .scm works. Thank you.


      (if (> (rpgetvar 'flow-time) 0.033)
       (
         (ti-menu-load-string "define/boundary-conditions/zone-type 5 wall")
         (ti-menu-load-string "define/boundary-conditions/zone-type 6 pressure-outlet ")
         (ti-menu-load-string "define/boundary-conditions pressure-outlet 6 yes no 0 no yes yes no no")
       
      )

      I read this for loading the .scm in order to use it, but I can´t find it.



       


      Regards,


      Maxime

    • Max4
      Subscriber

      Moreover, I find this in order to avoid the two true If-Statement :



       


      Maxime

    • DrAmine
      Ansys Employee

      No you need to read the scheme file as /file read-journal or just create procedures out of the scheme files and then just read the scheme file one and execute the procedure by just (procedure-name).

    • Max4
      Subscriber

      I have read the .scm with the TUI-Commands: /file read-journal xxx.scm and then I load it in Calculation Activities -> Execute Commands -> (load " xxx.scm") for each Time-Step.


      Thank you all for your answers.


      Regards,


      Maxime

    • DrAmine
      Ansys Employee

      Please set then this topic as solved and mark the answer which helped to resolve the question. Thanks.

    • Max4
      Subscriber

      Below, the Scheme file which I use to solve my problem with the If-Statement. If 'flow-time is 0.067 (delta t=0.001s in my case), then it calls only actions below ((> (rpgetvar 'flow-time) 0.066) and not actions from the following condition ((> (rpgetvar 'flow-time) 0.033).


      (cond
          ((> (rpgetvar 'flow-time) 0.066)
               (ti-menu-load-string "define/boundary-conditions/zone-type 5 velocity-inlet ")
               (ti-menu-load-string "define/boundary-conditions velocity-inlet 5 no no yes yes no 1 no 0")
               (ti-menu-load-string "define/boundary-conditions/zone-type 6 wall")
          )
          ((> (rpgetvar 'flow-time) 0.033)
               (ti-menu-load-string "define/boundary-conditions/zone-type 5 wall")
               (ti-menu-load-string "define/boundary-conditions/zone-type 6 pressure-outlet ")
               (ti-menu-load-string "define/boundary-conditions pressure-outlet 6 yes no 0 no yes yes no no")
          )
      )


      Then I read this file from the TUI-Commands (/file read-journal xxx.scm) and load it in the Execute Commands for each-time-step ( load "xxx.scm" ).


       


      Regards,


      Maxime

    • Vanesa
      Subscriber
      Hello,I am trying to simulate time varying boundary condition where after some time one of my wall should be changed as mass flow inlet with a certain amount of mass flow rate value. I went through the discussions on this forum and many other internet resources and even fluent documentation. Implementing UDF or using scheme file are the options one can use to define this time varying boundary condition was my conclusion. UDF needs strong programming skills and scheme documentation is rarely available.nI want to try scheme file for my simulation. I want to know how can we input other details of my changing boundary condition in the scheme file. Suppose my scheme file is:nn(condn   ((> (rpgetvar 'flow-time) 2.0)n        (ti-menu-load-string define/boundary-conditions/zone-type 6 wall)n        (ti-menu-load-string define/boundary-conditions wall 6 no no yes yes no 1 no 0)n        (ti-menu-load-string define/boundary-conditions/zone-type 6 mass flow-inlet)n   )n)n So now for this wall I want it to change to mass flow inlet after 2 secs in my simulation and I want to specify its details within this scheme file befoe the run (flow direction specification method/value of mass flow rate, etc.).nHow can I do it?nPlease help.nThank you.n
    • Rob
      Ansys Employee
      I'd also have a look at the Case Modification options, you may find you can trigger the mass flow bc at 2s using those. nRe the commands, click into the TUI panel and hit Enter. Typing in a menu label and hitting enter takes you to the sub menu, using q (Q) takes you back up a level. n
Viewing 11 reply threads
  • You must be logged in to reply to this topic.