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

y+ value at all cells in UDF

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By AlexanderZ
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 17, 2023, 11:47
Post y+ value at all cells in UDF
  #1
Member
 
thedal's Avatar
 
Thamilmani M
Join Date: Sep 2017
Location: IIT Bombay, Mumbai
Posts: 52
Rep Power: 9
thedal is on a distinguished road
Hi, Anyone knows how to get y+ value in each cell?

Fluent UDF macro, provides Wall yplus stored at the cell at the wall only! I need to extend to get the y+ at all cells. Any idea how to do that will be much appreciated.

I need to use that y+ value to calculate a scalar at each cell.

Thanks in Advance.
__________________
Always
Thedal
thedal is offline   Reply With Quote

Old   December 18, 2023, 01:29
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
what is y+ from your point of view?
thedal likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   December 21, 2023, 02:19
Default
  #3
Member
 
thedal's Avatar
 
Thamilmani M
Join Date: Sep 2017
Location: IIT Bombay, Mumbai
Posts: 52
Rep Power: 9
thedal is on a distinguished road
Thanks AlexanderZ,

y+ I am trying to implement is just non-dimensional distance from wall.

y+ = y * u_tau / nu

SV_WALL_YPLUS_UTAU() gives only the wall u_tau and even that, I cannot access in each cell. So if there is anyway I can access corresponding wall frictional velocity in each cell, let me know?

Or am I making any mistake in the understanding itself?
__________________
Always
Thedal
thedal is offline   Reply With Quote

Old   December 21, 2023, 08:01
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
from my point of view, y+ is characteristic of cell adjusted to wall
so I'm confused when you are asking to get value of y+ at the whole domain

its a distance from wall to the center of adjusted cell
so you may calculate it manually using C_CENTRIOD, F_CENTROID, F_C0, THREAD_T0 macros

ansys fluent customization manual

don't see SV_WALL_YPLUS_UTAU() in manual
thedal likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   December 22, 2023, 00:54
Default yPlus function
  #5
Member
 
thedal's Avatar
 
Thamilmani M
Join Date: Sep 2017
Location: IIT Bombay, Mumbai
Posts: 52
Rep Power: 9
thedal is on a distinguished road
Thanks for the response. I think that's how I am proceeding but facing some issues. I can see that in order to get cell characteristic adjusted to the wall. I need some wall properties to calculate, either wall shear stress or the u_tau directly.

I have y value, from C_WALL_DIST(c, t)

To get to the neighboring wall shear or u_tau, I think I need to access the wall face.

Below is the function I have written for y+ in that logic. Please help me where I am missing it. I am looping through all the threads to find the wall thread and then looping to all faces in that thread and try to match with one that is straight in the same axial location as the cell I need and then get the F_C0, THREAD_T0 from that. But I see that there are many cells that are empty. Let me know if you have any other procedure I could follow also.

You also mentioned not to look into SV_WALL_YPLUS_UTAU() in the manual. Any reason?

Thanks in advance.

// Domain is simply a 2D axisymmetric pipe
// X -> Axial Direction
// Y -> Radial Direction
real get_yplus(cell_t c, Thread *t)
{
// Variable Declaration
real cell[ND_ND], wall[ND_ND];
real result, nu_w, u_tau, x, error;
Domain *d;
Thread *t0, *t1;
cell_t c0;
face_t f;

// Axial Location of the cell centre.
C_CENTROID(cell, c, t);
x = cell[0];

d=Get_Domain(1);
// Looping through all threads in the domain.
thread_loop_f(t1,d)
{
if ((NNULLP(t1) && (THREAD_TYPE(t1) == THREAD_F_WALL)))
{
//Finding the wall thread
begin_f_loop(f,t1)
{
//Looping through all the faces in the that thread.
F_CENTROID(wall, f, t1);
error = fabs(wall[0] - x);
if (error <= 1e-6)
{
c0=F_C0(f,t1);
t0=THREAD_T0(t1);
u_tau = F_STORAGE_R(f, t1, SV_WALL_YPLUS_UTAU);
}
}
end_f_loop(f,t1)
}
}
nu_w = C_MU_L(c0, t0)/C_R(c0, t0);
result = (u_tau * fabs(C_WALL_DIST(c, t))) / nu_w;
return result;
}
__________________
Always
Thedal

Last edited by thedal; December 22, 2023 at 00:55. Reason: wrong line was there
thedal is offline   Reply With Quote

Old   December 22, 2023, 08:15
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Quote:
You also mentioned not to look into SV_WALL_YPLUS_UTAU() in the manual. Any reason?
I mean I don't know this function, you may use it, if it works

try something like that, I didn't compile could be typos
allocate user defined memories for C_UDMI(c0,t0,0) or F_UDMI(f,t,0)
Code:
#include "udf.h"

DEFINE_ON_DEMAND(get_yplus_demand)
{
real result, nu_w, u_tau;
Domain *d;
Thread *t0;
cell_t c0;
face_t f;
d=Get_Domain(1);
thread_loop_f(t,d)
{
if ((NNULLP(t) && (THREAD_TYPE(t) == THREAD_F_WALL)))
{
//Finding the wall thread
begin_f_loop(f,t)
{
//Looping through all the faces in the that thread.
c0=F_C0(f,t);
t0=THREAD_T0(t);
u_tau = F_STORAGE_R(f, t, SV_WALL_YPLUS_UTAU);
nu_w = C_MU_L(c0, t0)/C_R(c0, t0);
result = (u_tau * fabs(C_WALL_DIST(c0, t0))) / nu_w;
C_UDMI(c0,t0,0) = result; // values to check, supposed to have non zero values along at first cell row along the wall
// or this one F_UDMI(f,t,0) = result; // would be attached to wall, you may only plot this as a graph
}
end_f_loop(f,t)
}
}
}
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   December 24, 2023, 00:59
Default
  #7
Member
 
thedal's Avatar
 
Thamilmani M
Join Date: Sep 2017
Location: IIT Bombay, Mumbai
Posts: 52
Rep Power: 9
thedal is on a distinguished road
This is the problem here, the function SV_WALL_YPLUS_UTAU() has values only at wall threads, so the values if I did this ON_DEMAND() function only, the wall cells are occupied with y+ values, while all other cells are 0.

You have also placed the whole calculation inside the face loop which will identify wall thread faces so, the C_UDMI(c0, t0, 0) will have y+ values only in those cells where there are wall faces and zero otherwise. I am trying to eliminate to calculate y+ value in all cells which will not happen here.
__________________
Always
Thedal
thedal is offline   Reply With Quote

Reply

Tags
yplu


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
[snappyHexMesh] snappyHexMesh sticking point natty_king OpenFOAM Meshing & Mesh Conversion 11 February 20, 2024 10:12
flow over cylinder in openFoam saeed jamshidi OpenFOAM Pre-Processing 3 August 11, 2023 16:16
[snappyHexMesh] SnappyHexMesh running killed! Mark JIN OpenFOAM Meshing & Mesh Conversion 7 June 14, 2022 02:37
[ICEM] error analysis despaired student ANSYS Meshing & Geometry 7 June 27, 2012 12:57
killed "snappyHexMesh" parkh32 OpenFOAM Pre-Processing 2 April 8, 2012 18:12


All times are GMT -4. The time now is 14:59.