|
[Sponsors] |
November 15, 2004, 11:31 |
Volume Fraction Gradient
|
#1 |
Guest
Posts: n/a
|
Hello all, Does any one have experience in using or writing an UDF for calculating volume fraction gradient. Any help in regards of calculating volume fraction gradient will be very much appreciated. Thanks.
|
|
November 16, 2004, 23:42 |
Re: Volume Fraction Gradient
|
#2 |
Guest
Posts: n/a
|
I never see vlolume fraction in Fluent UDF. Fluent has species mass fraction gradient vector and component; C_YI_G(c,t) and C_YI_G(c,t)[i] ,respectively. You can use it immidiately. Volume fraction is mass/density. Can you adapt them?
Hope I can help you, Bowling. |
|
November 17, 2004, 02:59 |
Re: Volume Fraction Gradient
|
#3 |
Guest
Posts: n/a
|
This is an example from the Fluent. Maybe it will help you.
UDF used to calculate gradient for post-processing User defined scaler (UDS) and user defined memory (UDM) are used. For any UDS, fluent will automatically calculate the gradient. So, We need to pass the variable to UDS, and fluent will caculate the gradient for you. UDM is used to save the results. Steps to take to make it work 1. Read in the converged case and data 2. Link the udf (Define->User Defined->Functions->Intepreted) 3. Hook adjust funtion (Define->User Defined->Function Hooks->Adjust Function) 4. Define UDM (Define->User Defined->Memory 1) 5. Define UDS (Define->User Defined->Scalars 1) 6. Turn off all equations (Solve->Controls->Solution) 7. Do one iterations 8. Execute store_gradient (Define->User Defined->Execute On Demand) # include "udf.h" # define domain_ID 2 DEFINE_ADJUST(adjust_gradient, domain) { Thread *t; cell_t c; face_t f; domain = Get_Domain(domain_ID); /* Fill UDS with the variable. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDSI(c,t,0) = C_VOF(c,t); } end_c_loop (c,t) } thread_loop_f (t,domain) { if (THREAD_STORAGE(t,SV_UDS_I(0))!=NULL) begin_f_loop (f,t) { F_UDSI(f,t,0) = F_VOF(f,t); } end_f_loop (f,t) } } DEFINE_ON_DEMAND(store_gradient) { Domain *domain; cell_t c; Thread *t; domain=Get_Domain(1); /* Fill the UDM with magnitude of gradient. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDMI(c,t,0) = NV_MAG(C_UDSI_G(c,t,0)); } end_c_loop (c,t) } } |
|
November 17, 2004, 15:49 |
Re: Volume Fraction Gradient
|
#4 |
Guest
Posts: n/a
|
Hello Karl, Thanks for ur message. I did use this and the whole problem is the gradient returns the value 0 and hence when u mutliply with any thing the whole term becomes 0. If u give me ur email id I can send u the code also for ur perusal. Bye bye
|
|
March 9, 2020, 17:10 |
|
#5 | |
Senior Member
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6 |
Quote:
how to get mass fraction gradients with storing commands in udf this is my code but not work. DEFINE_ADJUST(gradient, domain) { Thread *t; Thread **pt; cell_t c; Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,P_PHASE); real voidx, voidy, voidz=0.0; mp_thread_loop_c (t,domain,pt) { if (FLUID_THREAD_P(t) && n_udm > 0) { Thread *tp = pt[P_PHASE]; begin_c_loop (c,t) { C_UDMI(c,t,0) = C_YI_G(c,tp,0)[0]; } end_c_loop (c,t) } } } |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
gradient of species mass fraction | zhou | FLUENT | 1 | March 14, 2020 07:55 |
Volume fraction to mass fraction | Torsaki | CFX | 10 | March 10, 2018 03:41 |
VOF Volume fraction in Velocity inlet | aruelle | FLUENT | 1 | March 18, 2010 11:53 |
volume fraction, Mass fraction and Bulk Mass flow | Dr.jones | CFX | 1 | January 25, 2006 04:32 |
C_VOF_G for Volume fraction gradient | Fred | FLUENT | 3 | January 10, 2005 05:04 |