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

Question about F_UDMI

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

Like Tree1Likes
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 13, 2017, 08:48
Default Question about F_UDMI
  #1
New Member
 
Join Date: Nov 2016
Posts: 6
Rep Power: 7
dylpeng is on a distinguished road
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)
}
dylpeng is offline   Reply With Quote

Old   February 13, 2017, 10:53
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 24
pakk will become famous soon enough
First comment: initialize your variables.

Code:
real Q_3D_desc = 0;
If I read your code, I see that you first go through all faces to calculate the total flux through the surface. At the end of that loop, f points to the face that was last visited during this loop. Let's call this face f_final.

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 if-statement:
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)
}
dylpeng likes this.
pakk is offline   Reply With Quote

Old   February 13, 2017, 19:03
Default
  #3
New Member
 
Join Date: Nov 2016
Posts: 6
Rep Power: 7
dylpeng is on a distinguished road
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.
dylpeng is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
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


All times are GMT -4. The time now is 19:41.