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

UDF for square wave - not compiling

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 18, 2015, 17:56
Default UDF for square wave - not compiling
  #1
New Member
 
Sarah Garden
Join Date: Sep 2014
Posts: 10
Rep Power: 12
SarahG is on a distinguished road
Hello,

I have attempted to write a UDF, below, which needs to do as the comment in the header says. The model is an aerofoil with a small 'slot' where a 'pressure-outlet' boundary condition is designated.

When I tested it, it didn't compile; the error says 'XtGrabPointer failed'. I think there need to be three statements in the 'for'. Although I seem to remember reading that you can get by with only two statements, and neglect the last one, so long as you keep the semicolon for the first two. Can somebody please verify this??

Also, can anybody please hint as to a better way of structuring this? Perhaps different kinds of loops..

I am (obviously) a novice in C, I'm afraid, so any feedback will be much appreciated.

/* alpha cycles upwards then downwards in angle of attack between 3 and 8 degrees. A pressure ejection must begin at ~5 degrees while alpha is decreasing, and finish at ~3 degrees while still decreasing, like an on-off switch. This matches a half square wave with phase delay of -2pi/3*/

#include "udf.h"
#define PI 3.14159

DEFINE_PROFILE(blowing, thread, position)
{
face_t f;
begin_f_loop(f, thread)
{
real period = 12.08305;
real t = CURRENT_TIME;
real alpha;
int n=0;

for(alpha = (5.5+2.5*sin(0.52*t)); t<=(n+1)*period; )
{
if(t<=(n+1)*period)
{

if(((2*n+1)*(period/2)<=t<=(n+1)*period) && (5.0584>=alpha>=3.0392) )
{
F_PROFILE(f, thread, position) = 0.5;
}
else
{
F_PROFILE(f, thread, position) = 0;
}

}
else
{
n += 1; /*if t>(n+1)*period, increment integer counter by 1 before going further*/
}
/* still in the body of the for, so back to first if?- sarah does not understand*/
}


}
end_f_loop(f, thread)
}

Last edited by SarahG; December 19, 2015 at 17:10.
SarahG is offline   Reply With Quote

Old   December 21, 2015, 04:12
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Quote:
'XtGrabPointer failed'
This does not really look like a compiler error... Can you show exactly how this error is showing on your screen?
pakk 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
[waves2Foam] Waves2Foam Related Topics ngj OpenFOAM Community Contributions 660 August 20, 2018 13:39
Basic question regarding compiling a UDF A.Jalal Fluent UDF and Scheme Programming 2 August 6, 2015 14:57
UDF compiling problem in Flient 6.3 jeevan kumar FLUENT 2 February 25, 2009 01:43
error while compiling a udf rahul FLUENT 10 August 30, 2006 09:33
On Compiling a UDF David Chabot FLUENT 5 May 20, 2005 10:13


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