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

Bc udf

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 6, 2015, 03:19
Default Bc udf
  #1
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 10
hwet is on a distinguished road
Trying to find particle We number at the walls to determine if it is collected or not when it comes in contact with the wall.
The critical Weber number values are currently imaginary but will be replaced later on based on my experimental results.

1) In my UDF if the critical We numbers (you will currently see in the 'if' statements ) are changed so that particles should be reflected based on the approximate values of the We number of the particle i calculated, the particle trajectories are reported to be 'incomplete' instead of reflecting them.
2)If the We number determines they are collected, the UDF works but trying to see the actual values it calculates I found out they make no sense at all.
3) I use the actual value of water surface tension, if I use DPM(SURFTEN) it says particle property not found.
4) Lastly shouldn't particle vel magnitude be available in the particle data, why do I need to calculate it instead?
My UDF is copied below could you tell where the trouble is. also there is a part from a similar UDF example in the UDF manual, which I do not understand could someone explain please what is the difference in the way I am calculating the velocity magnitude and how is it calculated in the manual. Hope i make sense.
Thanks a ton

FROM UDF MANUAL
(
vmag = MAX(NV_MAG(rel_vel),DPM_SMALL);
rel_dot_n = MAX(NV_DOT(rel_vel,normal),DPM_SMALL);
weber_in = P_RHO(p) * SQR(rel_dot_n) * P_DIAM(p) /
MAX(DPM_SURFTEN(p), DPM_SMALL);
)

(MY UDF)

#include "udf.h"
#include "surf.h"
#include "random.h"
DEFINE_DPM_BC(drop_col_wet_scrubber, particle_data, thread_face, f_index, f_normal, dim)
{
real vsqr;
real vmag;
real collision_weber_number;
int i, idim=dim;

for (i=0; i<idim;i++)
{
vsqr = P_VEL(particle_data)[i]*P_VEL(particle_data)[i];
vmag = sqrt(vsqr);
}
printf("the velocity magnitude is: %g\n", vmag);
{
collision_weber_number=(P_RHO(particle_data) * P_DIAM(particle_data) * vmag) /0.072;
}

/*printf("the collision weber number is: %g\n", collision_weber_number); */

if (collision_weber_number <=4) /*critical weber number*/
{return PATH_END;
}
else if (collision_weber_number > 4)
{return PATH_ACTIVE;
}
else if (collision_weber_number >=10)
{return PATH_END;
}
}
hwet is offline   Reply With Quote

Old   April 6, 2015, 04:21
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 15
`e` is on a distinguished road
1) add a trailing period to your critical Weber number to ensure the if condition is evaluating this number as a real data type. If the particle is returned from the boundary (with PATH_ACTIVE) then the particle is still sitting at the previous location with the same trajectory (velocity components). I'm not surprised these particles would be incomplete (the same boundary condition would be read until the maximum number of particles steps was reached). Have a read of this post on how to reflect your particle from the boundary.

2) use Message0(); instead of printf(); for printing text to the screen. What precise values are being reported and which values are you expecting?

3) according to Wikipedia, the Weber number is a function of the velocity squared (not linear which you've coded). You may need to use the DEFINE_PROPERTY macro for defining a surface tension value for your particle.

4) the velocity magnitude of particles can be calculated from its components and therefore having another variable for every particle velocity would be wasteful (in terms of memory). Your velocity calculation was simply taking the last dimension (either y or z depending if 2-D or 3-D, respectively) velocity component. Perhaps you meant to have "+=" instead of "=", and also initialise your variables. The method they have employed in the UDF manual was with vector macros, whereas you haven't, either way works.

I've modifed some parts of your code and made comments below:

Code:
#include "udf.h"

DEFINE_DPM_BC(drop_col_wet_scrubber, particle_data, thread_face, f_index, f_normal, dim)
{
	real vsqr=0.;
	real vmag=0.;
	real collision_weber_number;
	int i, idim=dim;

	for (i=0; i<idim; i++)
	{ 
		vsqr += P_VEL(particle_data)[i]*P_VEL(particle_data)[i];
		vmag += sqrt(vsqr);
	} 
	
	Message0("the velocity magnitude is: %e\n", vmag);
	
	{
		collision_weber_number = (P_RHO(particle_data) * P_DIAM(particle_data) * vmag*vmag) / 0.072;
	}

	Message0("the collision weber number is: %e\n", collision_weber_number);

	if (collision_weber_number <= 4.) // critical weber number
		return PATH_END;
	else if (collision_weber_number > 4.)
		return PATH_ACTIVE;
	else if (collision_weber_number >=10.) // this line would never be executed?
		return PATH_END;
	else
		Message0("Something has gone terribly wrong...\n");
}
`e` is offline   Reply With Quote

Old   April 6, 2015, 05:04
Default
  #3
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 10
hwet is on a distinguished road
Thanks e, that was really helpful, i will try to implement your suggestions!
Thanks again
hwet 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
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 08:37
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF acasas CFD Freelancers 1 January 23, 2015 08:26
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 22:38
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03


All times are GMT -4. The time now is 13:35.