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

Compute/Extract cell wall distance

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 23, 2017, 08:05
Default Compute/Extract cell wall distance
  #1
New Member
 
G Ionut
Join Date: Sep 2016
Posts: 29
Rep Power: 10
Ionut G is on a distinguished road
Hi,

I want to determine the cell wall distance or to get its values from FLUENT Solver.
I need the cell wall distance to compute the yStar, and eventually to calculate the velocity (to use a custom wall function).

I tried to calculate the cell wall distance by identify the wall thread. The code that I used it is written below.
After I did a simulation I compared the values from of "Cell Wall Distance" variable from fluent with the ones that I compute "dist". I attached a the graph comparing the two variables.

1. What I did wrong in my code?
2. It is possible to get the values of the "Cell Wall Distance" from the solver so that I can use them in my udf? Like a macro or something like that?
3. Is this function "C_STORAGE_R(f,t,SV_WALL_YPLUS)" the yStar?

The geometry that I use is a 3D asymetric diffuser (Diffuser 1 from the article "Geometric sensitivity of three-dimensional separated by Erica M. Cherry" http://www.sciencedirect.com/science...42727X08000131).

Code:
DEFINE_ADJUST(ystar, d)
{
	d = Get_Domain(1);
	Thread *t_wall;
	Thread *t_adj;
	cell_t c_adj;
	face_t f;
	
	real f_cen[ND_ND], c_cen[ND_ND], dist;
	real k, y_star;
	
// Identify the wall cell thread	
	int wall_id = 11;
	t_wall = Lookup_Thread(d,wall_id);
	
	begin_f_loop(f,t_wall)
	{
// Identify the adjacent cells and thread to the wall
		c_adj = F_C0(f,t_wall);
		t_adj = THREAD_T0(t_wall);
		
// Extract Turbulent Kinetic Energy from solver
		k = C_K(c_adj,t_adj);
		
// Get the face and cell centroid near the wall
		F_CENTROID(f_cen,f,t_wall);
		C_CENTROID(c_cen,c_adj,t_adj);
		
// Compute the distance from the cell of first layer to the face on the wall		
		dist = sqrt(ND_SUM(pow(c_cen[0]-f_cen[0],2),pow(c_cen[1]-f_cen[1],2),pow(c_cen[2]-f_cen[2],2)));
		C_UDMI(c_adj,t_adj,2) = dist;

// Extract yStar
		C_UDMI(c_adj,t_adj,1) = C_STORAGE_R(f,t_wall,SV_WALL_YPLUS);
		
// Compute yStar		
     	y_star = (DENSITY*pow(CMU,(1./4.))*pow(k,(1./2.))*dist)/MU;
     	C_UDMI(c_adj,t_adj,0) = y_star;
     	//printf("dist: %d\n", dist);
	}
	end_f_loop(f,t_wall)
}
Thank you for support.
Attached Images
File Type: jpg Cell Wall Distance - Solver vs dist - UDF.jpg (86.6 KB, 24 views)
Ionut G is offline   Reply With Quote

Reply


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
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 12:04
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 37 July 20, 2020 06:38
Natural convection in a closed domain STILL NEEDING help! Yr0gErG FLUENT 4 December 2, 2019 01:04
yPlusRAS utility - value for wall distance aylalisa OpenFOAM Post-Processing 1 September 1, 2014 01:15
Bug in wall distance calculation david OpenFOAM Bugs 3 March 15, 2011 10:32


All times are GMT -4. The time now is 18:25.