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

Summation of pressure over faces to obtain force

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 21, 2011, 12:53
Default Summation of pressure over faces to obtain force
  #1
New Member
 
Robert
Join Date: Apr 2011
Posts: 7
Rep Power: 14
Hypersonicflow is on a distinguished road
Hello,

I am trying to built a UDF that sums up the pressure at each face of a surface of a 3-D body. The code looks like:


/************************************************** *****************/
/* UDF to calculate pressure force and output to console */
/************************************************** *****************/
#include "udf.h"
#include "stdio.h"
#define forebody_tid 25 /* Zone ID of forebody*/
#define domain_zone 1
real Fpx;
real Fpy;
real NV_VEC(A);
real P_i;
Domain *domain;
face_t f; /*body surface */
Thread *t; /*body thread */
DEFINE_ADJUST(forces,domain)
{
domain = Get_Domain(domain_zone);
if (NULL == domain)
Message("Something wrong with your domain id!\n");
t= Lookup_Thread(domain,forebody_tid);
if (NULL == t || !BOUNDARY_FACE_THREAD_P(t))
Message("Something wrong with your face id!\n");
Fpx=0;
Fpy=0;
begin_f_loop(f,t)
{
F_AREA(A,f,t);
P_i = F_P(f,t);
Fpx+= P_i*A[0];
Fpy+= P_i*A[1];
}
end_f_loop(f,t)
Message("forces are: %f\n %f\n", Fpx, Fpy);
}



However, I get the following error:


Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: ()


The UDF works if I chose the e.g. the inlet or outlet zone for forebody_tid, but as soon as I choose a wall zone, the error occurs.
The line:

P_i = F_P(f,t);

is where the error occurs.


Has anyone an idea? I would really appreciate your help. Thanks,

Robert
Hypersonicflow is offline   Reply With Quote

Old   July 24, 2011, 13:42
Default
  #2
Senior Member
 
Micael
Join Date: Mar 2009
Location: Canada
Posts: 156
Rep Power: 18
Micael is on a distinguished road
Did you verify that the wall is exposed to fluid? I mean, may be you pick the shadow side exposed to solid? Your code looks fine to me. Why did you include stdio.h? It is already include by udf.h.
Micael is offline   Reply With Quote

Old   July 26, 2011, 05:25
Default
  #3
New Member
 
Robert
Join Date: Apr 2011
Posts: 7
Rep Power: 14
Hypersonicflow is on a distinguished road
Dear Micael,

thanks for your reply. Running the domain analysis, FLUENT shows:

Zone sizes on domain 1:
264640 hexahedral cells, zone 20.
784032 quadrilateral interior faces, zone 21.
6016 quadrilateral wall faces, zone 24.
768 quadrilateral wall faces, zone 25.
2752 quadrilateral pressure-outlet faces, zone 23.
10240 quadrilateral pressure-far-field faces, zone 22.
274565 nodes.

How do I figure out whether I am choosing the wetted side or the (shadow) side facing the solid?

If I display the surface pressure contours in the FLUENT interface, it works fine. However, I found that TECPLOT has some troubles displaying surface pressure from .cas and .dat files created by FLUENT 6.3. Maybe this problem is related to the error message that occurs when executing the UDF code?
Hypersonicflow is offline   Reply With Quote

Old   July 26, 2011, 13:58
Default
  #4
Senior Member
 
Micael
Join Date: Mar 2009
Location: Canada
Posts: 156
Rep Power: 18
Micael is on a distinguished road
Is the wall separating two zones? If no, there is no shadow side. If yes, there is one and you should see it (and its ID) in the boundary conditions panel.
Micael is offline   Reply With Quote

Old   August 11, 2011, 16:24
Default
  #5
Member
 
pranab_jha's Avatar
 
Pranab N Jha
Join Date: Nov 2009
Location: Houston, TX
Posts: 86
Rep Power: 16
pranab_jha is on a distinguished road
Do a domain = Get_Domain(1) in your udf. This will give you the fluid domain. Maybe this helps.
pranab_jha is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] SnappyHexMesh for internal Flow vishwa OpenFOAM Meshing & Mesh Conversion 24 June 27, 2016 09:54
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 07:27
Pulsatile pressure inlet with pressure outlet a.lynchy FLUENT 3 March 23, 2012 14:45
how does Fluent calculate the pressure and viscous force vector? Ralf Schmidt FLUENT 2 May 17, 2010 16:49
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 06:13


All times are GMT -4. The time now is 15:09.