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

UDF and text commands

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 21, 2005, 21:23
Default UDF and text commands
  #1
David
Guest
 
Posts: n/a
Hi CFD community,

I have written a UDF for an unsteady (parabolic profile) inlet velocity. I am having problems assigning the UDF at the velocity inlet when using text commands although the UDF has been interpreted successfully (no problems encountered when using GUI).

Below I have copied part of the transcript file. Look closely to the definition of the velocity inlet condition. More precisely:

profile name [""] "square_wave"

data name [""] "square_wave"

where square_wave is the name of my UDF.

1) Am I doing something wrong? (See Transcript File below).

2) Are boundary profile files an option? Can they be used to specify time and position dependent profiles (such as a parabolic profile with time-varying bulk velocity)?

/*Partial Transcript File*/

> /define/user-defined/interpreted-functions UDF Source File Name [""] "c:libudfsquare_wave0.c"

CPP Command Name ["cpp"] "cpp"

virtual machine stack size [10000] 10000

display assembly code listing? [no] no

cpp -IC:\FLUENT.INC\fluent6.1.22/src -IC:\FLUENT.INC\fluent6.1.22/cortex/src -IC:\FLUENT.INC\fluent6.1.22/client/src -IC:\FLUENT.INC\fluent6.1.22/multiport/src -I. -DUDFCONFIG_H="" c:\libudf\square_wave0.c

/define/boundary-conditions/velocity-inlet (velocity_inlet.11)

zone id/name [velocity_inlet.11] 3

Velocity Specification Method: Magnitude and Direction [no] no

Velocity Specification Method: Components [no] yes

Reference Frame: Absolute [yes] yes

Use Profile for X-Velocity? [no] yes

profile name [""] "square_wave"

data name [""] "square_wave"

The UDF that I would like to use is as follows. But again I do not think the problem lies there has Fluent interprets it successfully:

#include "udf.h" DEFINE_PROFILE (square_wave,thread,position)

{ #define PI 3.14159 real x[ND_ND]; face_t f; real z,y,test; z=CURRENT_TIME;

if (z<0.30) test =0; else if (z<0.70) test=2*sin(2.5*PI*z-2.3562); else if (z<1.3) test=0;

else

test=0;

begin_f_loop(f, thread)

{ F_CENTROID(x,f,thread); y = x[1]; F_PROFILE(f,thread,position) = test - y*y/(.0065*.0065)*test; } end_f_loop(f, thread) }

Thanking your in advance for you time

David

  Reply With Quote

Old   March 24, 2005, 13:19
Default Re: UDF and text commands
  #2
david
Guest
 
Posts: n/a
Hi, I figured it out so no need to reply. To solve my problem I typed the following when prompted:

profile name [""] "udf"

data name [""] "square_wave"

Regards

  Reply With Quote

Old   June 24, 2022, 15:10
Default
  #3
New Member
 
Ahmed Abrar Shayor
Join Date: Sep 2020
Location: Bangladesh
Posts: 22
Rep Power: 6
Shayor is on a distinguished road
Send a message via Skype™ to Shayor
Hello david.It has been many years but if you could guide me I would be very grateful.How would I do the same thing except that read the time dependent values for the average/bulk velocity from a txt file?Could you give a UDF code for that?
Thank you very much.
Shayor is offline   Reply With Quote

Old   June 27, 2022, 00:10
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Quote:
Originally Posted by Shayor View Post
Hello david.It has been many years but if you could guide me I would be very grateful.How would I do the same thing except that read the time dependent values for the average/bulk velocity from a txt file?Could you give a UDF code for that?
Thank you very much.
Ansys Fluent Customization manual
look for DEFINE_PROFILE macro
Shayor likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ 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
UDF with output text file manu Fluent UDF and Scheme Programming 18 December 12, 2018 23:46
Suspend iterations from UDF masins Fluent UDF and Scheme Programming 0 May 20, 2011 05:25
my UDF can not calculation? happyrabbit FLUENT 0 October 21, 2010 09:59
fluent UDF external library lapack problem Rick FLUENT 0 May 7, 2008 11:16
UDF interpretation trough TUI David FLUENT 2 March 18, 2005 15:26


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