# UDF for Eulerial multiphase

 Register Blogs Members List Search Today's Posts Mark Forums Read

February 27, 2020, 06:26
UDF for Eulerial multiphase
#1
New Member

Zhandos Baizhuma
Join Date: Nov 2019
Posts: 11
Rep Power: 2
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
 Fig 1. Source terms.png (15.6 KB, 3 views) Fig 2. cell's faces.png (14.6 KB, 2 views) Fig 3. Procedure.png (145.5 KB, 3 views)
Attached Files
 sourceudf.c (1.1 KB, 4 views)

 February 27, 2020, 10:34 Udf #2 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,553 Blog Entries: 1 Rep Power: 28 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 on the Forum

 March 5, 2020, 08:23 #3 New Member   Zhandos Baizhuma Join Date: Nov 2019 Posts: 11 Rep Power: 2 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; } } }