|
[Sponsors] |
May 18, 2018, 09:33 |
How to plot UDF variables in Ansys fluent?
|
#1 | |
New Member
Agar Haji
Join Date: May 2018
Posts: 3
Rep Power: 8 |
Hello everyone.
I am testing different drag correlations for non-spherical particles and have made this UDF and compiled it in Fluent. The problem i am facing now is, that i want to plot the drag coefficient for the particles and drag force calculated from the UDF. I have tried the user-defined memory but without any luck. The results i get are all zeros. Can anyone help me with this one. Maybe i need something in my UDF? Quote:
|
||
May 19, 2018, 20:48 |
|
#2 | |
Member
Bhargav Bharathan
Join Date: Jun 2015
Location: Montreal, Canada
Posts: 71
Rep Power: 11 |
Quote:
Firstly make sure you go to=> Parameters & Customization -> User Defined Memory -> Number of User-Defined Memory Location and select the no. of UDMs you need. Note that the UDM numbering starts from 0. So if you select 3 UDMs, their numbers would be 0, 1 and 2. In your UDF you need to then assign your variable to a specific UDM. It would go something like: F_UDMI(f,t,0)=drag_force; C_UDMI(c0,t0,0)=drag_force; Check out the below link: https://www.sharcnet.ca/Software/Flu...udf/node96.htm -B |
||
May 21, 2018, 08:44 |
|
#3 |
Senior Member
Join Date: Sep 2017
Posts: 246
Rep Power: 12 |
Hi Agarhaji,
As Bhargavbharathan points out, one option is to allocate User-Defined Memory (UDM) and save something in the cells containing the DPM parcels at any instant. This could be a single value for the latest parcel to pass through that cell, or you could (using more than one UDM) save average values. You could plot these by contour plots on section planes, etc. It would be a good idea to have a DEFINE_ON_DEMAND function to reset the UDM back to zero everywhere. You will need to be able to access the cell (as defined by a cell index and a cell-thread pointer) from inside the DPM-based UDF: you can use something like this: Code:
C_UDMI( TP_CELL(tp), TP_CELL_THREAD(tp), 0) = drag_force; Code:
#define CUDM_AV_DRAGCOEFF 0 #define CUDM_VISIT_COUNTER 1 C_UDMI( TP_CELL(tp), TP_CELL_THREAD(tp), CUDM_AV_DRAGCOEFF) *= C_UDMI( TP_CELL(tp), TP_CELL_THREAD(tp), CUDM_VISIT_COUNTER); C_UDMI( TP_CELL(tp), TP_CELL_THREAD(tp), CUDM_AV_DRAGCOEFF) += drag_force; C_UDMI( TP_CELL(tp), TP_CELL_THREAD(tp), CUDM_VISIT_COUNTER) += 1; C_UDMI( TP_CELL(tp), TP_CELL_THREAD(tp), CUDM_AV_DRAGCOEFF) /= C_UDMI( TP_CELL(tp), TP_CELL_THREAD(tp), CUDM_VISIT_COUNTER); An alternative approach, which I might prefer, would be to use particle-based user-defined memory -- the so-called "scalars" allocated in the UDF tab of the Discrete Phase Model. These are allocated to each parcel, and you can use them like other particle variables to colour the displayed tracks etc. They are numbered from 0 upwards, like cell-based UDM but completely separate. Code:
TP_USER_REAL(tp,i) = drag_force; Ed |
|
May 25, 2018, 05:07 |
It works
|
#4 |
New Member
Agar Haji
Join Date: May 2018
Posts: 3
Rep Power: 8 |
Hi again.
I tried to use the C_UDMI. I stored drag_force, C_D and it looks like this. C_UDMI( TP_CELL(tp), TP_CELL_THREAD(tp), 0) = drag_force; C_UDMI( TP_CELL(tp), TP_CELL_THREAD(tp), 1) = C_D; I can now choose in GRAPHICS, User-defined memory and plot the variables Thank you both ! Have a nice day. |
|
May 25, 2018, 05:41 |
|
#5 |
Senior Member
Join Date: Sep 2017
Posts: 246
Rep Power: 12 |
Great -- well done! To help others, please could you post your working UDF code? (And also tell us which version of Fluent it works in.) Thanks!
I would recommend the particle-based approach as a good alternative. Ed |
|
May 25, 2018, 10:19 |
Store variables in working UDF. Ansys Fluent 18.2
|
#6 | |
New Member
Agar Haji
Join Date: May 2018
Posts: 3
Rep Power: 8 |
Im running Ansys fluent 18.2
Compiling steps: Load Fluent --> User-defined functions --> Load UDF --> Build --> Load Mesh-->SET user-defined memory(in my case, 6.) -->Load UDF --> Write Case --> Close fluent and open again and now the UDF is compiled. For this UDF, I stored 6 variables. Quote:
- Agar Haji |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for ANSYS Fluent and Runge Kutta Method | cagri.metin.ege | Fluent UDF and Scheme Programming | 3 | January 24, 2020 04:46 |
Can you help me with a problem in ansys static structural solver? | sourabh.porwal | Structural Mechanics | 0 | March 27, 2016 18:07 |
Ansys SIG$ILL error | loth | ANSYS | 3 | December 24, 2015 06:31 |
The fluent stopped and errors with "Emergency: received SIGHUP signal" | yuyuxuan | FLUENT | 0 | December 3, 2013 23:56 |
UDF to record FLUENT solver variables... | mariachi | FLUENT | 1 | February 3, 2010 23:18 |