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

Trouble Saving Wall Shear using DEFINE_EXECUTE_AT_END

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

Like Tree2Likes
  • 1 Post By mali28

Reply
 
LinkBack Thread Tools Display Modes
Old   November 6, 2016, 12:59
Default Trouble Saving Wall Shear using DEFINE_EXECUTE_AT_END
  #1
New Member
 
Joshua
Join Date: Aug 2014
Posts: 10
Rep Power: 4
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
New Member
 
Joshua
Join Date: Aug 2014
Posts: 10
Rep Power: 4
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: 80
Rep Power: 7
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
New Member
 
Joshua
Join Date: Aug 2014
Posts: 10
Rep Power: 4
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.
jbo214 is offline   Reply With Quote

Reply

Thread Tools
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 On
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 11:23
Cannot achieve negative wall shear stress values in CFD Post (ANSYS) SAtkins CFX 3 August 3, 2016 14:27
Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation on Windows, Mac and other Unsupported Platforms 225 August 25, 2015 19:43
how to resolve high gradients of wall shear? Agad15 FLUENT 0 June 9, 2014 23:59
Multicomponent fluid Andrea CFX 2 October 11, 2004 05:12


All times are GMT -4. The time now is 06:19.