## Fluids

#### Which problem does this UDF correspond to?

• satri
Subscriber

In Ansys documentation section 7.8 Parallel UDF example there is an example of adjust function that is been parallelized. but it does not say what tpe of geometry it corresponds to? is there any specific example in the fluent tutorials to which this UDF is applicable? If so please let me know. My aim is to validate this with an example problem run it in serial get the area-weighted avg of pressure and then run it in parallel and compute the area-weighted avg. I am not sure which example should i try this on.

• Rob
Ansys Employee

I assume you mean this one?   https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/flu_udf/flu_udf_sec_using_udfs_parallel.html%23flu_udf_sec_parallel_example   It looks to be applied to a face, but I'd not recommend using an interior without adding some further checks that are also outlined in the manual.

The examples are there to show how to take various serial concepts (typically face and cell loops) and ensure they're run correctly in parallel. There are no example geometries as the UDF features are fairly advanced.

• DrAmine
Ansys Employee

You task can be done via Report Definition and Fluent Expressions.

• satri
Subscriber

Yes, I am referring to that link.

I understand udfs are fairly advanced.

But to understand what is going on when I parallelize,

I need to reference it with a standard example problem and analyze how the inclusion of '#RP_HOST' '#RP_NODE' and noninclusion of RP_HOST and RP_NODE makes a difference in total_area or total_force. Without examples, it is hard to understand as ansys documentation does not show any examples.

Based on looking at the UDF i understand that it is being used to compute the total pressure on a face zone.

So please tell me if this will work with this problem
1. I have a cylendrical pipe of diameter D = 0.02m, length L=0.4m which has a mass flow rate of Qdot = 0.01kg/s (water). (I am going to set this up as a 2d axis-symmetric problem). I will run a simple laminar simulation.For validation purpose)

a) I will evaluate the pressure drop computed with surface integrals area-weighted average from the GUI

b) I will use the UDF and compute total_force/total_area will these two numbers match?

Do you think this can be taken as a sample problem for this UDF or does this correspond to any other problem? (This is the confusion, for which problem does this UDF correspond to)

• Rob
Ansys Employee

The UDF example is to show how the parallel parts are put together. The face loops etc are covered earlier in the manual. Write the basic code and test on one core. Then look into adding the RP_HOST calls based on that part of the documentation. Then test by forcing a partition that cuts the surface(s) of interest: don't rely on Fluent's automatic method as it's intended to maximise efficiency gains.

If done correctly numbers will match. I'd not use a UDF to find pressure drop, that's what the reporting functions are for. Finding a surface pressure to do "something" is what UDFs are for.

• satri
Subscriber
I do not understand this statement.

Then test by forcing a partition that cuts the surface(s) of interest: don't rely on Fluent's automatic method as it's intended to maximise efficiency gains.

what do you mean by intended to maximize efficiency gains?

my question is, i will use the UDF in Section 7.8 on a simple fully developed laminar flow in a pipe problem as described above.
I will set int surface_thread_id=3; (in the second line of the udf printed, this is the thread ID of the inlet)
and when the second to last line is executed,

This one:
Message("Average pressure on Surface %d is %f (Pa)\n",surface_thread_id,(total_force/total_area));

will this print/display on the console the average pressure value which is equal to the area-weighted average of pressure (calculated from surface integrals)?

• DrAmine
Ansys Employee

We have UDF Training on the Ansys Learning Hub where all this is explained. If you do not parallelize general purpose DEFINE Macros like DEFINE_ADJUST or DEFINE_ON_DEMAND you might end up counting things more than once and for that reason global reduction is assessed. Moreover calculation should be done on Nodes as only Nodes have mesh. Sometimes you require to pass the information between Nodes and Host and that is done syncronization. In the example that where the ID of thread zone you want to calcualte the average pressure is passed. The example in the Customization manual is detailed example to get averaged pressure  and force on a boundary. It does also show which issues can arise if parallelloizing is not done (I think the UDF can be simplified but has been there for a while now). If you want to test the UDF just create a dummy example, like duct flow, and then proceed with the creation of the schme variable to store the ID of the boundary you want to evaluate pressure/force on, as described in the example.

Question: What is your goal? Perhaps built-in reports and Fluent Expression Language are enough.

• Rob
Ansys Employee

When we parallelise the model we split the load over two (or more) nodes. If we split with equal cells that's likely to give a good speed up. Now, for a pipe, if we split across the axis the partition has fewest cells: if we split along the axis the partition has most cells. The former results in less data transfer between nodes so is most efficient.

However, to test your code you want the partition to cut the boundary of interest. Otherwise it's not a very good test. Hence using the manual partition and reviewing the options other than Metis.