December 6, 2022 at 8:16 pmsatriSubscriber
How do i know what UDFs can be parallelized and why? I read the documentation and it does not tell me what udfs need to be parallelized.
I have the following udfs-
Define_profileDefine_sourceI look at some general parallel computing textbooks, and i cannot find any clear equivalency with ansys. What am i missing here?how can i achieve parallelization of UDFs?what do i need to read and understand please let me know.(What should I read to understand more about the parallelization of Ansys UDFs)These are the books i looked up. (Did I miss anything in these books? can anyone of you please suggest any reading that I need to do to get more insight into this? Parallelization process)Book1- Designing and Building Parallel Programs by Ian FosterBook2- Parallel Computer Architecture: A Hardware/Software Approach by David Culler et al., Morgan Kaufmann PublishersBook3- An Introduction to Parallel Computing: Design and Analysis of Algorithms (Ed. 2, Jan 2003) by Ananth Grama et al., Pearson Addison Wesley.Book4-The Sourcebook of Parallel Computing, Edited by Jack Dongarra, Ian Foster, Geoffrey Fox, William Gropp, Ken Kennedy, Linda Torczon, Andy White, October 2002, 760 pages, ISBN 1-55860-871-0, Morgan Kaufmann Publishers.(are there any examples of parallelizing adjust, a scalar update on ansys examples? )
December 7, 2022 at 12:24 pmRobAnsys Employee
It's not so much the main DEFINE sections that determine whether you need to parallelise the UDF but the loops and calls from within the code https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v221/en/flu_udf/flu_udf_sec_using_udfs_parallel.html It's generally a good idea to test UDFs on a simple system, and you can try running 1, 2 and 4 cores to see whether anything behaves differently when writing your code.
December 7, 2022 at 1:50 pmsatriSubscriber
I have a very simple model. I have seen that. you are referring to chapter 7 of the fluent udf manual. Are there any examples showing different features of parallelizing udf code, because everything there in the manual is the theory I don't see any example model in that manual (section 7.3.5 has one parallel udf example but i don't know where to find the model case file for that). Please let me know where i can find some examples in the manual.
Also if i am looking at any general parallel computing textbook what should i look for? to get some examples of what is going on in Ansys parallel. Can you please suggest any reference textbooks that will help me understand this? Because i am really lost. Is there any general textbook other than the documentation?
December 7, 2022 at 2:28 pmRobAnsys Employee
You don't need to worry too much about how Fluent does the parallel part, just that your code will call the correct bits when in parallel: look for the RP_NODE and RP_HOST calls for examples.
December 7, 2022 at 3:03 pmsatriSubscriber
I understand fluent does this in the background. But i want to know more about RP_NODE and RP_HOST i cannot find these commands anywhere in any general parallel programming textbooks.
As far as examples go how can i look for a specific command RP_HOST in a specific model example?
I see this on documentation but i cant find its corresponding case file to understand what is going on here
where can i find a case file for this
Example: Global Summation of Pressure on a Face Zone and its Area Average Computation?
December 7, 2022 at 4:44 pmRobAnsys Employee
There isn't a case file, the UDF examples are for you to add to your own models. Similarly, RP_HOST & RP_NODE are used in Fluent UDFs, so may be specific to Fluent.
December 7, 2022 at 5:22 pmsatriSubscriber
Ohh that is really sad to hear.
So what model is this udf written for if i have to do it myself? say I am a simple cylinder with free stream flow on it and if i compute area average of pressure on the cylinder wall with this udf and if i print put from the reports it should be the same?
I am trying to understand what is this udf written for.
Please let me know what exactly is the purpose of the udf (Example: Global Summation of Pressure on a Face Zone and its Area Average Computation) what kind of model will this work on, will this work on the model as mentioned above?
December 7, 2022 at 5:30 pmRobAnsys Employee
Bottom of the page here, https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v222/en/flu_udf/flu_udf_sec_using_udfs_parallel.html The purpose of the example is to show how and where you need to call HOST and NODE values.
If you just want the average pressure in your model use a Surface Integral: UDFs are not always simple and are generally specific to the required task.
December 14, 2022 at 11:08 pmsatriSubscriber
I understand that. Let me rephrase my question. Maybe asking about define adjust was too early at the moment.
Let me start with something even more basic
When i read the documentation this is what i see. We will have to parallelize the UDF when i encounter these situations
Now i have a UDF called scalar-update that deposits some number of particles in a cell zone. This is what i get when i do volume integral sum for serial case
This is what i get for the parallel case when i do volume integral of sum
you can see that both the answers are not equal
Now as far as my UDF goes I am looping over cell volume to deposit the mass in zone called part-filter.
Q1) Do i need to parallelize anything in this udf? this is the condition i have
if the particle thread(t) matches the cell zone thread(tm) increase udm-5.
Q2) If not then do i have to write an execute on demand to loop over the nodes of different nodes and sum up the udm-5 because the volume integral displayed on the console is wrong?
I am not sure where to begin. Please let me know.
December 15, 2022 at 11:32 amRobAnsys Employee
If you have a filter won't you deposit scalar (or UDM) based on the particles?
December 15, 2022 at 3:18 pmsatriSubscriber
Yes its based on the particles as the particles enter the filter thread it gets deposited on the filter depending on the conditions imposed.
This is the entry point of the particles now. my confusion is should i parallelise this. put
#endif /* RP_HOST */
please let me know. I am not able to find equivalent examples to make try this. and am not able to logically reason out what are scenarios that need to be parallelized and why.
December 15, 2022 at 3:45 pmRobAnsys Employee
You might want to start here https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v222/en/flu_udf/flu_udf_DPMDEFINE.html%23flu_udf_sec_define_dpm_erosion The particle is the cause of the source/blockage which is then mapped onto the UDM.
December 15, 2022 at 4:22 pmsatriSubscriber
No. The scalar update udf i have is working perfectly fine. The results from UDF match with all theoretical results, the only problem is it's extremely slow and i want to speed it up. that's why i am trying to parallelize. the erosion example does not help my cause. Is there any example like this that shows how parallelizing of UDF is done?
If not for the manual is there any other reference book maybe a textbook or something that explains how the udf's can be parallelized?
December 15, 2022 at 4:34 pmRobAnsys Employee
Just the manuals, have you checked that UDM 5 is different because of the result (ie flow/particles) or parallel?
December 15, 2022 at 4:46 pmsatriSubscriber
it's just the result of the volume integral of UDM5. The result that i have got in the serial case is the expected result when i use analytical equations to calculate the mass deposited it exactly matches the result from serial case. The only change that i did in the parallel case is increase the number of processor from 1 to 4. to see if my mass deposited matches. turns out it does not.
The reason is that the UDF needs to be parallelized.
When i start looking at what UDFs need to be parallelized the first question i encounter is- do i need to parallelize the scalar update udf? that leads me to my question where should i put # if RP_HOST? in scalar update UDF
December 15, 2022 at 5:19 pmRobAnsys Employee
That will depend on what you're doing to the scalar in the UDF.
December 15, 2022 at 5:58 pmsatriSubscriber
in simple terms, let's say I inject particles as soon as it enters the filter domain 50% gets deposited in the first cell and 25% gets deposited in the cell inside it and 12.5% in the next cell and 6.25% of particle mass in next cell inside and the remaining 6.25% of mass just gets penetrated and goes out. (To have a simplified view for understanding purposes, i am hypothetically describing it in extremely simple terms)
Let us assume this happens across the volume.
Once i finish deposition i compute the volume integral of the sum of the total mass in filter domain. So do i need to parallelize this scalar update?
December 16, 2022 at 9:39 amRobAnsys Employee
Probably not, but that'll depend on how you're handling the particle termination & scalar updates.
December 16, 2022 at 1:27 pmsatriSubscriber
Well, i don’t understand how. So do you mean to say that i don't need to parallelize this UDF?
Particle termination happens when the mass deposited is less than 0.00005*massInjected.
And as far as the scalar update goes this is how i update the mass deposited C_UDMI(c,t,Mass_Dep)+=(InjectedMass-PenetratedMass).
PenetratedMass = InjectedMass*Efficiency
that still does not explain the difference in volume integral.
January 3, 2023 at 11:54 amRobAnsys Employee
OK, so parcel hits a cell and loses some mass, more in the next cell etc. That is added to the cell UDM, so isn't a scalar as that will diffuse. Parcel is terminated at some fraction of the initial parcel mass, or of total injected mass?
- 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.
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
© 2023 Copyright ANSYS, Inc. All rights reserved.