# Complex UDF

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

July 11, 2013, 18:50
Complex UDF
#1
New Member

N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 5
He there,

I have a questions regarding how to write this UDF. What i want is best explained in the pictures below first image is what i have. This is this UDF it incorperate the sine wave equation.

#include "udf.h"

{
face_t f;

real t = CURRENT_TIME;

{
F_PROFILE(f, thread, position) = -6250. + 6250.0*-sin(314.*t);
}

This UDF is does not actually do what i want. The second picture is what i am looking for the UDF to do. I want to run the full simulation for a second atleast if possible is there an easy way of doing this without having to write the code for each cycle of sin wave?

Attached Images
 what i have.png (13.6 KB, 9 views) what i want.png (9.1 KB, 8 views)

 July 11, 2013, 21:22 #2 Senior Member   Join Date: Aug 2011 Posts: 315 Rep Power: 13 The signal appear to be periodic so it is simple to implement. Code: ```#include "udf.h" #define TPER 0.02 #define PAMP 12000.0 DEFINE_PROFILE(unsteady_pressure, thread, position) { face_t f; real t = fmod(CURRENT_TIME, TPER); real p; if ( TPER/4. < t && t < 3*TPER/4.0 ) p = 0.0; else p = PAMP/2.0*(-1.0-sin(2.0*M_PI*t/TPER); begin_f_loop(f, thread) { F_PROFILE(f, thread, position) = p; } end_f_loop(f, thread)```

 July 14, 2013, 19:26 #3 New Member   N/A Join Date: Apr 2013 Posts: 18 Rep Power: 5 Thank you for your reply, yes the signal is periodic. Unfortunately that UDF code you gave me did not to be interpreted by fluent i get error with the Fmod. Also i am very confused about the coding i don't understand how it will work.

 July 14, 2013, 20:56 #4 Senior Member   Join Date: Aug 2011 Posts: 315 Rep Power: 13 In order to use "fmod" you have to include "math.h", which I think "udf.h" should have included that header. You should add a line Code: `#include `

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Pietro Asinari Fluent UDF and Scheme Programming 1 August 15, 2015 19:08 alihosseini63 Fluent UDF and Scheme Programming 0 July 4, 2013 18:37 Liufeng_ustb Fluent UDF and Scheme Programming 2 May 7, 2013 10:25 RS FLUENT 0 May 10, 2007 12:54 Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01

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