CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

How to check value at every cell when applied udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 22, 2023, 14:25
Default How to check value at every cell when applied udf
  #1
Member
 
Chhotelal
Join Date: Jun 2023
Posts: 31
Rep Power: 3
Chhotelal1234 is on a distinguished road
Can I check our UDF line by line in fluent whether is it correct or not?
Can I get the value at every iteration whatever equation add in the UDF so that we can easily check it either our UDF is working properly or not?
Can I add the breaks in particular line in UDF. So that we can check it?
Chhotelal1234 is offline   Reply With Quote

Old   July 23, 2023, 10:06
Default
  #2
Member
 
Odisha
Join Date: Jan 2020
Posts: 59
Rep Power: 6
Siba11 is on a distinguished road
'Yes' to all three of your questions.
The fluent compiler checks your UDF line by line and displays any errors present in it.
You can print whatever value you want using the 'Message' statement.
And yes, you can insert 'break' commands wherever you want. It's a good programming practice when you're trying to debug your code.
Siba11 is offline   Reply With Quote

Old   July 23, 2023, 10:49
Default
  #3
Member
 
Chhotelal
Join Date: Jun 2023
Posts: 31
Rep Power: 3
Chhotelal1234 is on a distinguished road
Thank you for your reply. but the break command could not be used in the UDF reason is that the UDF code is called from the solver, and it operates within a specific context set by the solver. Using break to exit a loop would disrupt the solver's control flow and could lead to unexpected behavior or crashes.
There are any method to check the UDF code?
Chhotelal1234 is offline   Reply With Quote

Old   July 23, 2023, 20:49
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
1. You may print into console variables to check which part of code works well. Message() macro
2. You may hook fluent.exe process from visual studio (for windows) and debug regularly
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   July 24, 2023, 01:50
Default
  #5
Member
 
Chhotelal
Join Date: Jun 2023
Posts: 31
Rep Power: 3
Chhotelal1234 is on a distinguished road
Dear AlexanderZ,
Could you please describe the second option how can I use it. and give a example.
Chhotelal1234 is offline   Reply With Quote

Old   July 25, 2023, 20:55
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
The simplest way to debug Fluent UDF
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A UDF to calculate energy per a cell and then returns new CO2 content in a cell. visitor Fluent UDF and Scheme Programming 54 April 11, 2021 23:29
UDF in case with DPM modle POSTHU Fluent UDF and Scheme Programming 0 March 3, 2021 08:21
Fluent UDF wrong number of cells in parallel - correct in serial dralexpe Fluent UDF and Scheme Programming 7 May 17, 2018 09:26
how to comliled UDF on one of two fluid cell zones lshwanbb Fluent UDF and Scheme Programming 0 December 16, 2017 21:41
Cells with t below lower limit Purushothama Siemens 2 May 31, 2010 22:58


All times are GMT -4. The time now is 17:40.