Fluids

Fluids

changing Boundary conditions periodically

    • vani
      Subscriber

      Hi,


       


      I have a question on changing boundary conditions to be implemented in FLUENT. There are couple of options to achieve this action like using scheme file with UDF or dynmanic mesh events, etc.


       


      Currently, I need to change my boundary conditions i.e.,the definitions of Inlet and Outlet peridically since I am simulating a Transient FSI problem. I am suppose to change the boundary type of inlet for instance from pressure-inlet to wall and similarly, pressure-outlet to wall at specific period of time.


       


      I have seen couple of examples as well as queries posted on this community where, discussion about changing boundaries using scheme file happened. 


      https://forum.ansys.com/forums/topic/read-scheme-file/


      As mentioned by Max4 in the above link, where he has written a similar scheme file to change the boundary conditions. 


      Could anyone tell me what does the syntax in red box mean ? I'm not able to understand "6 yes no 0 no yes yes no no". I have seen such kind of syntax commands in other codes written. I'm trying hard to find the meaning of the syntax and I could rarely find any proper fluent scheme language documentation.


       


      As mentioned in the link by max4, that this scheme file has to be read and loaded in the execute commands. So could anyone tell me how to load such a scheme file in Execute commands ?


       


      Best regards

    • DrAmine
      Ansys Employee

      It executes the TUI command for changing the boundary condition. You can test that on your side by just typing in the Fluent console


      /define/bc and then you will see several sub menus (as you press enter)

    • vani
      Subscriber

      Thank you for your reply, now I understand and also tested myself. But, another question is how can one load the above scheme file in execute commands.


       


      I have written a UDF file and a scheme file in order to implement the changing boundary conditions.


       


      UDF to queck the condition for time 


      #include "udf.h"


      #include


      DEFINE_EXECUTE_AT_END(chan)


      {


      #if !RP_NODE


             if(1/(4*RP_Get_Real("fr")) < RP_Get_Real("flow-time") && RP_Get_Real("flow-time") < 3/(4*RP_Get_Real("fr"))) 


              {


           RP_Set_Integer("cond", 1);


         }


      else


              {


           RP_Set_Integer("cond", 0);


         }


      #endif


      }


      Scheme file to implement the changing boundaries


      (define (boundary)


      (define cond (rpgetvar 'cond))


      (if (= cond 0) 


      (


      (ti-menu-load-string "define/boundary-conditions/zone-type 7 wall")


      (ti-menu-load-string "define/boundary-conditions wall 7 no no no no 0 no 0.5")


      (ti-menu-load-string "define/boundary-conditions/zone-type 6 pressure-inlet")


      ))


      (if (= cond 1) 


      (


      (ti-menu-load-string "define/boundary-conditions/zone-type 6 wall")


      (ti-menu-load-string "define/boundary-conditions wall 6 no no no no 0 no 0.5")


      (ti-menu-load-string "define/boundary-conditions/zone-type 7 pressure-outlet")


      ))


      )


      Here, fr =frequency, cond are both scheme variables defined in text user interface of fluent.


       


       


      Could you kindly, let me know if this approach would work for me to change my inlet and outlet boundary conditions. Are there any syntax errors in either of these files ?


       


       


      Thanking you 


       


      Best regards


       

    • DrAmine
      Ansys Employee
      I wont debug what you posted. But you need to define the to variable first. That can be done once . The rst of the scheme commands should be executed every time step or iteration as calculation activity where you read that journal. NB: scheme procedure ( i guess what you want to achieve) requires an input. keep it simple and do it as Max did.
    • vani
      Subscriber

      Hello,


       


      I get what you are saying. I defined the variable fr, cond in Fluent TUI using "rp-var-define".


       


      even if I follow what Max did, I am still unaware as how to load that scheme file in the Execute commands. 


       



       


      This is what max has written. How does one load this file in Execute commands.


       


      Best regards


       


       

    • Rob
      Ansys Employee

      If you look in the Calculation Activities there's an Execute Commands option. In there you can type in TUI commands, and activate these every some timesteps or iterations. 

    • vani
      Subscriber

      Hello,


       


      Thank you for the reply. Yes, I can type in TUI commands in the Execute commands box. But the problem is I have to check this condition: 1/(4*RP_Get_Real("fr")) < RP_Get_Real("flow-time") && RP_Get_Real("flow-time") < 3/(4*RP_Get_Real("fr")  (fr =frequency) to change boundary type of inlet and outlet since I am dealing with Sinusoidal input load (2 way FSI coupling). At certain period of this load: outlet should behave as pressure-outlet and at the rest of the other period of this load outlet should behave as a wall. Similarly, with the case of inlet. That is the reason why I have written UDF as well as scheme file. But for some reason, it is not working.


      Could you give any ideas as how to implement them.


      Best regards

    • DrAmine
      Ansys Employee

      You need to read the scheme file as journal under calculation activities and execute it every iteration or time step.

    • vani
      Subscriber

      Hi,


      Since last post taking into reference, I have another question. I want to change the boundary conditions in certain particular range of time for example in this time - 0.0375

       



       


      I have written a scheme file to implement above boundary conditions but unfortunately it is partially working right. (freq = frequency)


      Below is the code used:


      (cond


      ((> (rpgetvar 'flow-time) 0.0125)


              (ti-menu-load-string "define/boundary-conditions/zone-type 6 wall")


              (ti-menu-load-string "define/boundary-conditions/zone-type 7 pressure-outlet"))


      ((< (rpgetvar 'flow-time) 0.0375)


              (ti-menu-load-string "define/boundary-conditions/zone-type 6 wall")


              (ti-menu-load-string "define/boundary-conditions/zone-type 7 pressure-outlet"))


      ((> (rpgetvar 'flow-time) 0.0625)


              (ti-menu-load-string "define/boundary-conditions/zone-type 6 wall")


              (ti-menu-load-string "define/boundary-conditions/zone-type 7 pressure-outlet"))


      ((< (rpgetvar 'flow-time) 0.0875)


              (ti-menu-load-string "define/boundary-conditions/zone-type 6 wall")


              (ti-menu-load-string "define/boundary-conditions/zone-type 7 pressure-outlet"))


      (else


              (ti-menu-load-string "define/boundary-conditions/zone-type 7 wall")


              (ti-menu-load-string "define/boundary-conditions wall 7 no no no no 0 no 0.5")


              (ti-menu-load-string "define/boundary-conditions/zone-type 6 pressure-inlet")


              (ti-menu-load-string "define/boundary-conditions pressure-inlet 6 yes no 0 no 0 no yes no no yes 5 10")))


       


      What kind of operators can i use in the place of i.e. for example, something as  0.0375

       


      Best regards

    • Rob
      Ansys Employee

      Is there an AND command in Scheme?  Possibly && ?  Or can you use a sin function so sin(t) is positive or negative and set boundary conditions based on that? 

    • vani
      Subscriber

      Hi,


      Thank you for your reply. Yes there is an "and" command in Scheme which comes under the boolean functions. I made changes to the code using and and it is working totally fine now as I wanted.


      Below is the code which I used to solve the problem I mentioned above:


      (cond


      ((and (> (rpgetvar 'flow-time) 0.0125) (< (rpgetvar 'flow-time) 0.0375))


                    (ti-menu-load-string "define/boundary-conditions/zone-type 6 wall")


                    (ti-menu-load-string "define/boundary-conditions/zone-type 7 pressure-outlet"))


      ((and (> (rpgetvar 'flow-time) 0.0625) (< (rpgetvar 'flow-time) 0.0875))


                    (ti-menu-load-string "define/boundary-conditions/zone-type 6 wall")


                    (ti-menu-load-string "define/boundary-conditions/zone-type 7 pressure-outlet"))


      (else


              (ti-menu-load-string "define/boundary-conditions/zone-type 7 wall")


              (ti-menu-load-string "define/boundary-conditions wall 7 no no no no 0 no 0.5")


              (ti-menu-load-string "define/boundary-conditions/zone-type 6 pressure-inlet")


              (ti-menu-load-string "define/boundary-conditions pressure-inlet 6 yes no 0 no 0 no yes no no yes 5 10"))


      )


      ( http://willem.engen.nl/uni/fluent/documents/external/scheme-programmierung.pdf ) here is the link for the Scheme language (reference purpose) for anyone who wants to learn about it. 


       

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