|
[Sponsors] |
How to use Fluent Scheme to change the boundary condition defined by UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 4, 2020, 14:24 |
How to use Fluent Scheme to change the boundary condition defined by UDF
|
#1 |
New Member
Ge
Join Date: Feb 2020
Posts: 8
Rep Power: 6 |
Hi all,
I know there are some discussion on how to use Fluent Scheme to change boundary condition and I followed their instructions and made it work. Now the only question I have is if I define the boundary condition using UDF (DEFINE_PROFILE()) then what the format of the scheme should be? The scheme file I wrote is as the following (define (changeboundary) (cond ((and (>= (rpgetvar 'flow-time) 0.001) (<= (rpgetvar 'flow-time) 0.002)) (ti-menu-load-string "define/boundary-conditions/zone-type 10 wall")) (else (ti-menu-load-string "define/boundary-conditions/zone-type 10 mass-flow-inlet") (ti-menu-load-string "define/boundary-conditions mass-flow-inlet 10 mass_flow y")) ) ) where "mass_flow" is my UDF name. I tried several times by executing the scheme file at each time step but it looks like Fluent did not recognize the UDF I used to define the boundary. |
|
February 4, 2020, 17:36 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Code:
(ti-menu-load-string "define/boundary-conditions mass-flow-inlet 10 \"mass_flow\" y"))
__________________
best regards ****************************** press LIKE if this message was helpful |
|
February 5, 2020, 04:39 |
Include full TUI command
|
#3 |
Senior Member
|
TUI commands are sequential, i.e., you cannot miss anything in between. Full TUI commands changes from case to case, depending upon which models are enabled. A RANS based model with flow, without any other model enabled would require
def bc mfi 10 y y y y "functionname::libraryname" n 0 n y n n y 3.7 5 This command assumes that the library is already loaded. If it is not, then you have to load the library using def user comp load "libraryName"
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 5, 2020, 10:22 |
|
#4 |
New Member
Ge
Join Date: Feb 2020
Posts: 8
Rep Power: 6 |
Hi AlexanderZ,
Thanks for the help! I checked through TUI and my issue has been solved. |
|
February 5, 2020, 10:25 |
|
#5 |
New Member
Ge
Join Date: Feb 2020
Posts: 8
Rep Power: 6 |
Hi vinerm,
Thank you so much for the help! I have solved this issue by using the correct TUI command as you mentioned. |
|
February 5, 2020, 12:30 |
|
#6 |
New Member
Ge
Join Date: Feb 2020
Posts: 8
Rep Power: 6 |
Dear AlexanderZ,
I have one more question. By looking up the TUI and answering all the questions, I found for my case the correct TUI commands should be ti-menu-load-string "define/boundary-conditions mass-flow-inlet 10 yes yes yes yes "udf" "mass_flow::libudf" no 0 no yes" However, when I typed "udf" in the console window to answer the question, there is no problem about it and Fluent can recognize what I typed. But when I wrote the TUI command into a scm file and execute the file at each time step during simulation, I always got an error as "Error: eval: unbound variable; Error Object :udf". I use ANSYS 16.0 and I am confused why Fluent can recognize "udf" in console window but can not do it in scm file. Could you please help me solve this issue, thank you in advance for your help! |
|
February 5, 2020, 12:35 |
|
#7 |
New Member
Ge
Join Date: Feb 2020
Posts: 8
Rep Power: 6 |
Dear vinerm,
I have one more question. By looking up the TUI and answering all the questions, I found for my case the correct TUI commands should be ti-menu-load-string "define/boundary-conditions mass-flow-inlet 10 yes yes yes yes "udf" "mass_flow::libudf" no 0 no yes" However, when I typed "udf" in the console window to answer the question, there is no problem about it and Fluent can recognize what I typed. But when I wrote the TUI command into a scm file and execute the file at each time step during simulation, I always got an error as "Error: eval: unbound variable; Error Object :udf". I use ANSYS 16.0 and I am confused why Fluent can recognize "udf" in console window but can not do it in scm file. Could you please help me solve this issue, thank you in advance for your help! |
|
February 6, 2020, 00:42 |
|
#8 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
use \" not "
__________________
best regards ****************************** press LIKE if this message was helpful Last edited by AlexanderZ; February 6, 2020 at 04:20. |
|
February 6, 2020, 04:04 |
Escape character
|
#9 |
Senior Member
|
It depends whether you are using TUI within a ti-menu-load-string command or not. Since there is already double-quote opening the command, you have to escape the second one. So, command has to be
(ti-menu... "udf" "mass_flow::libudf" ...) i.e., just use escape character before double quotes.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 6, 2020, 04:12 |
HTML issue
|
#10 |
Senior Member
|
Apparently, cfd-online is escaping is not displaying \ character before double-quotes. Use \ before every double quote and it will work.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 6, 2020, 10:50 |
|
#11 |
New Member
Ge
Join Date: Feb 2020
Posts: 8
Rep Power: 6 |
Hi vinerm and AlexanderZ,
Thank you so much for your help! After adding escape character before double quotes, the problem has been solved. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fluent change boundary condition type using Scheme syntax in journal file | lytemar | Fluent UDF and Scheme Programming | 4 | April 28, 2022 03:13 |
Centrifugal fan | j0hnny | CFX | 13 | October 1, 2019 14:55 |
Basic Nozzle-Expander Design | karmavatar | CFX | 20 | March 20, 2016 09:44 |
Problem in setting Boundary Condition | Madhatter92 | CFX | 12 | January 12, 2016 05:39 |
asking for Boundary condition in FLUENT | Destry | FLUENT | 0 | July 27, 2010 01:55 |