|
[Sponsors] |
February 27, 2020, 06:26 |
UDF for Eulerial multiphase
|
#1 |
New Member
Zhandos Baizhuma
Join Date: Nov 2019
Posts: 12
Rep Power: 6 |
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 |
|
February 27, 2020, 10:34 |
Udf
|
#2 |
Senior Member
|
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)
__________________
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. |
|
March 5, 2020, 08:23 |
|
#3 |
New Member
Zhandos Baizhuma
Join Date: Nov 2019
Posts: 12
Rep Power: 6 |
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; } } } |
|
March 5, 2020, 10:04 |
Define_source
|
#4 |
Senior Member
|
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;
__________________
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. |
|
|
|
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 |