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

Trouble Saving Wall Shear using DEFINE_EXECUTE_AT_END

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By mali28
  • 1 Post By jbo214

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 6, 2016, 12:59
Default Trouble Saving Wall Shear using DEFINE_EXECUTE_AT_END
  #1
Member
 
Joshua
Join Date: Aug 2014
Posts: 49
Rep Power: 12
jbo214 is on a distinguished road
I'm trying to access the wall shear stress values for a certain wall. I'm trying to replicate the method used by here (p.91) and here (p.2) .

My UDF right now is:

Code:
#include "udf.h"
#include "storage.h"

DEFINE_EXECUTE_AT_END(store_wall_shear)
{	
	FILE *fp = NULL;
	char filename[] = "shear.txt";
	double NV_VEC(Wall_Shear_Force);
	
	Domain *d;
	Thread *t;

	face_t f;
	cell_t c;

	d = Get_Domain(1); /* Domain ID integer is 1 for single phase flows*/
	t = Lookup_Thread(d,9); /* wall zone ID*/

	fp = fopen(filename,"a");
	Wall_Shear_Force[0] = F_STORAGE_R_N3V(f,t,SV_WALL_SHEAR)[0];

	fprintf(fp,"Test2 \n");
	fclose(fp);
}
The UDF compiles and hooks fine, however when I run the calculation I receive a segmentation fault.

Quote:
Error: received a fatal signal (Segmentation fault).
Error Object: #f
Since I received a segmentation fault, I must be trying to access a variable that wasn't available or stored. I tried forcing Fluent to keep all of the date by setting
Quote:
Keep temporary solver memory from being freed? [yes]
through the TUI.

Do I need to calculate the shear stress directly to be able to access it or is there another step I need to take to make it available?
jbo214 is offline   Reply With Quote

Old   November 6, 2016, 18:35
Default
  #2
Member
 
Joshua
Join Date: Aug 2014
Posts: 49
Rep Power: 12
jbo214 is on a distinguished road
From that link, am I correct in interpreting the following?

Wall_Shear_stress_X is Tau_xy
Wall_Shear_stress_Y is Tau_yz
Wall_Shear_stress_Z is Tau_zx
jbo214 is offline   Reply With Quote

Old   November 6, 2016, 18:53
Default
  #3
Member
 
Join Date: Jun 2011
Posts: 86
Rep Power: 15
mali28 is on a distinguished road
As far as I am aware:

Tx = [Nx*Mu*(2*Du/Dx)]+[Ny*Mu*(Du/Dy+Dv/Dx)]+[Nz*Mu*(Du/Dz+Dw/Dx)]

Ty = [Nx*Mu*(Dv/Dx+Du/Dy)]+[Ny*Mu*(2*Dv/Dy)]+[Nz*Mu*(Dv/Dz+Dw/Dy)]

Tz = [Nx*Mu*(Dw/Dx+Du/Dz)]+[Ny*Mu*(Dw/Dy+Dv/Dz)]+[Nz*Mu*(2*Dw/Dz)]

T = sqrt(Tx^2+Ty^2+Tz^2)

jbo214 likes this.
mali28 is offline   Reply With Quote

Old   November 7, 2016, 12:28
Default
  #4
Member
 
Joshua
Join Date: Aug 2014
Posts: 49
Rep Power: 12
jbo214 is on a distinguished road
I found this forum thread about using F_STORAGE.

I exported the shear stresses from the UDF and plotted them and compared to the shear stress plots provided by Fluent and they're the same.
letsroll likes this.
jbo214 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
different order for wall shear stress result in steady & unsteady simulatiom raminostadi FLUENT 0 October 1, 2016 12:23
Cannot achieve negative wall shear stress values in CFD Post (ANSYS) SAtkins CFX 3 August 3, 2016 15:27
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 20:43
how to resolve high gradients of wall shear? Agad15 FLUENT 0 June 10, 2014 00:59
Multicomponent fluid Andrea CFX 2 October 11, 2004 06:12


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