CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF and text commands (https://www.cfd-online.com/Forums/fluent/36101-udf-text-commands.html)

David March 21, 2005 20:23

UDF and text commands
 
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


david March 24, 2005 12:19

Re: UDF and text commands
 
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


Shayor June 24, 2022 14:10

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.

AlexanderZ June 26, 2022 23:10

Quote:

Originally Posted by Shayor (Post 830425)
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


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