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

FLUENT UDF for Parallelization

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 27, 2021, 12:38
Default FLUENT UDF for Parallelization
  #1
Member
 
Join Date: Jul 2020
Location: India
Posts: 63
Rep Power: 5
Cooper24 is on a distinguished road
I am new to writing UDFs and new to coding itself in general. I have written a UDF for adding some source terms in my model. I use 10 cores on my PC for FLUENT in parallel. My UDF compiles and the simulation is also running.
Today, I learnt about something called parallelization of UDF. As I understood, the UDF should be parallelized for using multiple cores by adding some special commands in the UDF. I do not have any special commands in my UDF related to parallelization or number of cores to be used. Is it that my simulation is still running in serial even after selecting 10 cores on Fluent startup? As I said that my UDF compiles without error and the simulation is also running. Do I need to make changes in my UDF?
Cooper24 is offline   Reply With Quote

Old   August 28, 2021, 04:22
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
It depends on the UDF.

If you are doing something that involves the complete domain (integrating, finding a maximum, something like that), you need to change something. But in that case you would also get clearly wrong results if you used the serial code in parallel.

If your UDF is writing to a file, you also need some changes.

But if you just set viscosity as function of local pressure and temperature, you don't really need to change anything.

By the way: typically 99.9% of the time is spent on the "normal" Fluent code to calculate pressures, velocities and temperatures for the next iteration. This code is parallelized by the Ansys programmers, who did it quite well. The <0.1% of time spent in your UDF code is not significant. It might be suboptimal for speed, but it does not matter. If your simulation takes two days to finish, you don't care about the 30 seconds you could gain by improving your UDF. So as long as you don't make your UDF incredibly inefficient, you're fine.
gauravkmr likes this.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   August 28, 2021, 05:32
Default
  #3
Member
 
Join Date: Jul 2020
Location: India
Posts: 63
Rep Power: 5
Cooper24 is on a distinguished road
Thanks for your reply. As you mentioned, I am not integrating any quantity or finding maxima-minima. I am just using the UDF to apply source terms and temperature dependent properties. So I hope I don't need to change anything.
Cooper24 is offline   Reply With Quote

Old   August 28, 2021, 07:33
Default
  #4
New Member
 
Gaurav Kumar
Join Date: Jan 2018
Location: Delhi
Posts: 17
Rep Power: 8
gauravkmr is on a distinguished road
I agreed with pakk, and as far as your question, you didn't need to parallelize your code.
gauravkmr is offline   Reply With Quote

Old   August 28, 2021, 09:58
Default
  #5
Member
 
Join Date: Jul 2020
Location: India
Posts: 63
Rep Power: 5
Cooper24 is on a distinguished road
Thanks a lot for clarifying.
Cooper24 is offline   Reply With Quote

Old   August 30, 2021, 00:19
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
manual says
Quote:
Some other types of operations that require parallelization of serial source code include the
following:
• Reading and Writing Files
• Global Reductions
• Global Sums
• Global Minimums and Maximums
• Global Logicals
• Certain Loops over Cells and Faces
• Displaying Messages on a Console
• Printing to a Host or Node Process
__________________
best regards


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

Old   August 30, 2021, 11:16
Default
  #7
Member
 
Join Date: Jul 2020
Location: India
Posts: 63
Rep Power: 5
Cooper24 is on a distinguished road
Thanks for your post. I am using loop over cells to add source terms but not sure whether I need parallelization.
Cooper24 is offline   Reply With Quote

Reply

Tags
udf parallelization


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
FLUENT UDF for parallelization Cooper24 FLUENT 0 August 27, 2021 11:55
Fluent UDF for moving laser heating of a solid block Cooper24 Fluent UDF and Scheme Programming 7 July 9, 2021 05:56
Problem running fluent with udf on batch tobi b. Fluent UDF and Scheme Programming 3 April 14, 2016 13:54
Running UDF with Supercomputer roi247 FLUENT 4 October 15, 2015 13:41
fluent UDF external library lapack problem Rick FLUENT 0 May 7, 2008 10:16


All times are GMT -4. The time now is 14:37.