-
-
July 24, 2019 at 11:31 am
vani
SubscriberHi,
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
-
July 24, 2019 at 11:44 am
DrAmine
Ansys EmployeeIt 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)
-
July 24, 2019 at 4:29 pm
vani
SubscriberThank 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
-
July 24, 2019 at 4:48 pm
DrAmine
Ansys EmployeeI 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. -
July 25, 2019 at 9:03 am
vani
SubscriberHello,
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
-
July 25, 2019 at 10:48 am
Rob
Ansys EmployeeIf 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.
-
July 26, 2019 at 11:50 am
vani
SubscriberHello,
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
-
July 26, 2019 at 12:28 pm
DrAmine
Ansys EmployeeYou need to read the scheme file as journal under calculation activities and execute it every iteration or time step.
-
August 1, 2019 at 12:05 pm
vani
SubscriberHi,
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
-
August 1, 2019 at 12:21 pm
Rob
Ansys EmployeeIs 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?
-
August 1, 2019 at 4:00 pm
vani
SubscriberHi,
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.
-
- You must be logged in to reply to this topic.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
-
2688
-
2138
-
1355
-
1136
-
462
© 2023 Copyright ANSYS, Inc. All rights reserved.