|
[Sponsors] |
July 11, 2013, 19:50 |
Complex UDF
|
#1 |
New Member
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13 |
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" DEFINE_PROFILE(unsteady_pressure, thread, position) { face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_PROFILE(f, thread, position) = -6250. + 6250.0*-sin(314.*t); } end_f_loop(f, thread) 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? Thank you for your help in advanced |
|
July 11, 2013, 22:22 |
|
#2 |
Senior Member
|
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, 20:26 |
|
#3 |
New Member
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13 |
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. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
I/O of a real value by "DEFINE_RW_FILE" (UDF) | Pietro Asinari | Fluent UDF and Scheme Programming | 1 | August 15, 2015 20:08 |
udf for multiple reaction | alihosseini63 | Fluent UDF and Scheme Programming | 0 | July 4, 2013 19:37 |
Help me to check my UDF | Liufeng_ustb | Fluent UDF and Scheme Programming | 2 | May 7, 2013 11:25 |
On demand UDF error | RS | FLUENT | 0 | May 10, 2007 13:54 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |