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

question about writing an udf

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 13, 2005, 04:27
Default question about writing an udf
  #1
Denitiu Marian
Guest
 
Posts: n/a
I'm trying to write an udf, to simulate a periodic flow through a geometry composed of a center cilinder, and three pipes which all comunicate with the central cilinder. They are placed at 120 degrees apart from each other. At a certain time, through one of the pipes, I have fluid coming inside the geometry, and through the other two, the fluid is coming out. I'm not really interested about the time variation, but I want the principle of the thing explained to me.

Here is what I wrote. It is based ont the oscilating pressure udf, found on the Fluent documentation disk. /

#include "udf.h"

DEFINE_PROFILE(unsteady_pressure, thread, position) {

float t, pressure; face_t f; float x,M;

begin_f_loop(f, thread) {

t = RP_Get_Real("flow-time");

x=(t/1.5);

M=t-1.5*x;

if ((M>0) && (M<0.5)) {

pressure = (0.12*sin(1748.8*t)+0.737)*101325.0;

}

else M=0;

if ((M>0.5) && (M<1) {

pressure = (0.12*sin(1748.8*t)+0.737)*101325.0;

}

else M=0;

if ((M>1) && (M<1.5)) {

pressure = (0.12*sin(1748.8*t)+0.737)*101325.0;

}

else M=0; F_PROFILE(f, thread, position) = pressure; } end_f_loop(f, thread)

}

When I try to compile it, I receive: Error: c:\fluent.inc\pexit1.c: line 36: parse error. Error: c:\fluent.inc\pexit1.c: line 39: parse error. Error: c:\fluent.inc\pexit1.c: line 49: parse error.

Any ideas?
  Reply With Quote

Old   January 13, 2005, 06:19
Default Re: question about writing an udf
  #2
Andrew Garrard
Guest
 
Posts: n/a
You will never get to the second two if ... else statements. When M is assigned a value in then enters the first if else. if it is between 0 and 0.5 it changes pressure. if not M becomes 0. This means that it won't enterd the remaining two if else statements.

  Reply With Quote

Old   January 14, 2005, 07:28
Default Re: question about writing an udf
  #3
wanghong
Guest
 
Posts: n/a
try to put your udf on your computer table,perhaps "parse error" will not appear again.
  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
Writing UDF for DPM Cantstandit Fluent UDF and Scheme Programming 5 September 20, 2010 21:30
New to writing UDF Sandilya FLUENT 0 May 31, 2007 13:03
Question to UDF Claud FLUENT 1 April 10, 2007 18:02
A question about UDF owet.L FLUENT 4 December 20, 2005 04:19
A question about the dynamic mesh UDF Tango FLUENT 1 November 27, 2003 03:56


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