
[Sponsors] 
February 13, 2017, 08:48 
Question about F_UDMI

#1 
New Member
Join Date: Nov 2016
Posts: 6
Rep Power: 7 
Hello all!
I'm back again... I have a question this time about F_UDMI. I'm trying to retrieve the values I've stored into the UDMI, which should be a constant across all the faces. I wonder if this implementation is ok. Does the F_UDMI have to be in the loop? Code:
DEFINE_PROFILE(desc_pressure_outlet,th,i) { face_t f; int t; real delta_P_DESC_1, P_DESC_1; real Q_3D_desc; t = N_TIME; begin_f_loop(f,th) { Q_3D_desc += F_FLUX(f,th); } end_f_loop(f, th) Q_3D_desc = Q_3D_desc / DENSITY; if (t == 0) { P_DESC_1 = Q_3D_desc * ( R_DESC + R_LBB + R_LBV ); P_DESC_R = Q_3D_desc * R_DESC; } else { P_DESC_1 = F_UDMI(f,th,4); delta_P_DESC_1 = DELTAT*diff_P_DESC_1(P_DESC_R); P_DESC_1 += delta_P_DESC_1; } begin_f_loop(f,th) { F_PROFILE(f,th,i) = P_DESC_1; } end_f_loop(f,th) } 

February 13, 2017, 10:53 

#2 
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 24 
First comment: initialize your variables.
Code:
real Q_3D_desc = 0; Then, if t>0, you read the UDMI value at face f_final. You don't know which face this is, Fluent decides this. And then, you calculate a pressure based on this face f_final, and apply it to all faces. This can only do something reasonable if the UDMI is the same for all faces, because then it does not matter which face Fluent chooses to visit last. You say that for you this is the case. Still, I would change it, because if six months from now you use this code again, and the UDMI can have more values, you will have a bug that is hard to detect. I think that the easiest way to fix this is to put the loop into the ifstatement: Code:
if (t == 0) { P_DESC_1 = Q_3D_desc * ( R_DESC + R_LBB + R_LBV ); P_DESC_R = Q_3D_desc * R_DESC; begin_f_loop(f,th) { F_PROFILE(f,th,i) = P_DESC_1; } end_f_loop(f,th) } else { delta_P_DESC_1 = DELTAT*diff_P_DESC_1(P_DESC_R); begin_f_loop(f,th) { P_DESC_1 = F_UDMI(f,th,4)+ delta_P_DESC_1; F_PROFILE(f,th,i) = P_DESC_1; } end_f_loop(f,th) } 

February 13, 2017, 19:03 

#3 
New Member
Join Date: Nov 2016
Posts: 6
Rep Power: 7 
Hi pakk!
Thank you for your help! I have another issue, would be great if I could get your ideas on how to implement this. As you can see in my udf, I have computed the flow for the outlet in DEFINE_PROFILE, but this works only for 1 outlet... I have another case where I need to compute the flow from two different outlets and sum them together. I'm not sure what's the best way. My idea is to use a DEFINE_ADJUST and some global variables. 

Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Question about symmetry in Autodesk Cfd 2016  ecto  Autodesk Simulation CFD  0  October 20, 2015 04:16 
small question about the functionalities of topological changes in OpenFoam  ngj  OpenFOAM Running, Solving & CFD  2  February 28, 2013 10:02 
Question Re Engineering Data Source  imnull  ANSYS  0  March 5, 2012 13:51 
internal field question  PitzDaily Case  atareen64  OpenFOAM Running, Solving & CFD  2  January 26, 2011 15:26 
Poisson Solver question  Suresh  Main CFD Forum  3  August 12, 2005 04:37 