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

UDF for Eulerial multiphase

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By vinerm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 27, 2020, 06:26
Default UDF for Eulerial multiphase
  #1
New Member
 
Zhandos Baizhuma
Join Date: Nov 2019
Posts: 12
Rep Power: 6
zhandos_baizhuma is on a distinguished road
Dear all,

I am very amateur in UDF writing, so I need your help and advice on following problem:

I m trying to simulate airfoil icing using Eulerian method and UDF described in [1]. According to icing conditions, droplets must be absorbed by the airfoil wall. It is not normal wall boundary condition. Thus, I should include a source term on the airfoil surface.Fig 1 in attachment. for this purpose there are DEFINE_SOURCE macro. Question 1: How to write product of droplet velocity vector and face are vector?
I have attached my UDF, but it is not working well

DEFINE_SOURCE macro loops over all cells in domain. Fig2.
But in case of icing source terms shold be calculated only on faces describing airfoil walls with ID = 0. To find faces adjust to wall c_face_loop

Question 2. How to find such cells with face loop and if condition?

[1]: Pedersen, M. C. (2018). Modelling Icing on Structures for Wind Power Applications. Aalborg Universitetsforlag. Ph.d.-serien for Det Ingeniør- og Naturvidenskabelige Fakultet, Aalborg Universitet
Attached Images
File Type: png Fig 1. Source terms.png (15.6 KB, 19 views)
File Type: png Fig 2. cell's faces.png (14.6 KB, 16 views)
File Type: png Fig 3. Procedure.png (145.5 KB, 17 views)
Attached Files
File Type: c sourceudf.c (1.1 KB, 22 views)
zhandos_baizhuma is offline   Reply With Quote

Old   February 27, 2020, 10:34
Default Udf
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Your UDF is alright, except for one thing. You are trying to determine the area of a face by providing the ID of the cell. c refers to the cell index in

Code:
 F_AREA(A,c,t)
while a face index is required. However, a cell has at least 4 faces. You need to tell Fluent which face you want to refer to.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   March 5, 2020, 08:23
Default
  #3
New Member
 
Zhandos Baizhuma
Join Date: Nov 2019
Posts: 12
Rep Power: 6
zhandos_baizhuma is on a distinguished road
Thank you for your reply. I changed according your suggestion, did I understand you in the right way:

#include "udf.h"
#include "mem.h"

DEFINE_SOURCE(phase_cont,c,t,dS,eqn)
{
cell_t c;
thread *t;
face_t f;
Thread *tf;
int n;
real con, source;
real NV_VEC(v), NV_VEC(A);
int ro=1000;
NV_D(v, =, C_U(c,t), C_V(c,t), C_W(c,t));
con = NV_DOT(v,A);
c_face_loop(c,t,n)
{
f = C_FACE(c,t,n)
if (f == 0)
{
source = -con*ro*C_VOF(c,t);
dS[eqn] = 0;
return source;
}

else
{source = 0;
}

}
}
zhandos_baizhuma is offline   Reply With Quote

Old   March 5, 2020, 10:04
Default Define_source
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
There still are issues with the code. Here is the procedure that you have to follow

You have to write two UDFs. It will be very difficult to do it with just one.

First UDF should be of type DEFINE_ON_DEMAND or DEFINE_EXECUTE_ON_LOADING since it needs to be executed only once before the simulation starts. Within this UDF, setup a face loop using thread belonging to zone ID 0, which I assume is the ID of the icing wall. So, you fetch thread using

Thread *tf = Lookup_Thread(Get_Domain(1), 0);
face_t f;

Then use both of these in a face loop as

being_f_loop(f, tf)
{...}
end_...

Within this face loop, you fetch cell index and cell thread as

t = THREAD_T0(tf);
c = F_C0(f, tf);

Do note that both t and c must be declared outside the loop as Thread * and cell_t, just like tf and f above. Then within the loop, assign

C_UDMI(c, t, 0) = 1.0;

That means, before compiling and loading this UDF, you have to ensure that you have one UDM and it is initialized or patched with value 0.

The second UDF would be DEFINE_SOURCE. And now, this is extremely simple. You just mention in three lines

source = <whatever equation you want to use> * C_UDMI(c, t, 0);
ds[eqn] = ...;
return source;
Aj_45 likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm 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
Eulerian multiphase model for species trnasport: UDF for reaction rate harsh Main CFD Forum 3 June 12, 2017 02:24
Oddly diffuse results from UDF in multiphase (picture and udf) Jehosh Fluent UDF and Scheme Programming 2 February 11, 2016 04:53
udf for multiphase flow with real gas mixture sugumaran Fluent UDF and Scheme Programming 2 January 27, 2013 23:10
udf for multiphase flow with real gas mixture sugumaran ANSYS 0 July 30, 2010 11:38
multiphase udf Rashmi FLUENT 1 March 7, 2006 02:17


All times are GMT -4. The time now is 15:13.