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

UDF code for variable viscosity in y-direction

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By ComputerGuy

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 16, 2016, 21:11
Default UDF code for variable viscosity in y-direction
  #1
New Member
 
shayan
Join Date: Jul 2012
Location: Australia
Posts: 27
Rep Power: 14
shayan_mv is on a distinguished road
Hi,

I am dealing with a multi phase problem ; a 2D domain filled with air as the primary phase and a fluid flow with variable viscosity in y-direction moving in x-direction on the bottom wall as the secondary phase.

Wondering if you could help with a UDF code by which I can define a function that varies the viscosity values in y-direction?

Thanks

Shayan
shayan_mv is offline   Reply With Quote

Old   August 21, 2016, 22:16
Default How about this
  #2
Senior Member
 
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 192
Rep Power: 16
ComputerGuy is on a distinguished road
What about something like this, hooked to the viscosity of whatever phase in your simulation you're trying to change?

Code:
DEFINE_PROPERTY(cell_viscosity, c, t)
{
  real mu;
  real x[ND_ND];
  real Y_coord;
  C_CENTROID(x,c,t);
  Y_coord=x[1];
  mu= /*YOUR FUNCTION OF VISCOSITY HERE */
  return mu;
}
Can you elaborate why the viscosity would be spatially dependent? Is it because you don't want to simulate the effects of one phase diffusing into another and affecting the viscosity?

ComputerGuy
soheil_r7 likes this.
ComputerGuy is offline   Reply With Quote

Old   August 23, 2016, 06:17
Default
  #3
New Member
 
shayan
Join Date: Jul 2012
Location: Australia
Posts: 27
Rep Power: 14
shayan_mv is on a distinguished road
Thanks a lot for the code;it was really helpful. I did some minor changes to get what I want, but there's still an issue:

#include "udf.h"

DEFINE_PROPERTY(cell_viscosity, c, t)
{
real mu;
real x[ND_ND];
real Y_coord;
C_CENTROID(x,c,t);
Y_coord=x[1];

if(Y_coord<=/ H) /*H: thickness of the secondary phase)*/
mu=(a*Y_coord)+A; /*viscosity profile & a and b are constants*/
else
mu=A;
return mu;
}

Well, I'm actually dealing with two layers of fluids with various viscosities. Instead of defining the 3rd phase, I decided to change the viscosity in y-direction! nevertheless, there's also a variation in "mu" in y-dir for each layer.

Assuming "A(@Y_coord=0 or wall)"<=mu<="B(@ Y_coord=H or interface)", I couldn't get the B value for the viscosity at the interface, and its contour shows me a less value. Like, B=5.7 Pa.S instead of 6! Is there any chance to fix this issue??

Cheers
shayan_mv is offline   Reply With Quote

Reply

Tags
udf;fluent;viscosity


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
Difficulty with UDF code for HEAT FLUX etudiant_IITB Fluent UDF and Scheme Programming 1 December 7, 2015 08:07
something wrong when compiling udf, however the code is correct when interpreting richard ben Fluent UDF and Scheme Programming 7 May 11, 2013 07:36
viscosity in UDF! denhan FLUENT 0 April 6, 2007 01:12
subgrid turbulent viscosity for UDF in LES David TAIEB FLUENT 0 April 2, 2007 08:27
Please help me run UDF code for source Suga FLUENT 1 February 3, 2006 03:40


All times are GMT -4. The time now is 20:55.