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

Multiple udf in fluent

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 13, 2022, 02:23
Default Multiple udf in fluent
  #1
New Member
 
HASS NAS
Join Date: Nov 2022
Posts: 1
Rep Power: 0
hassnas is on a distinguished road
Hi, I am using fluent for 2D transient simulation of oscillating flexible foil. I had used both mentioned UDF below. It works fine when it was used separately. but it didnot work when cg motion udf were used for pitching and grid_motion for deformation of foil.
Question is how it can be used for pitching as well as deformation of airfoil.
UDF is attached below..

#include "udf.h"
#include "dynamesh_tools.h"
DEFINE_CG_MOTION(airfoil,dt,vel,omega,time,dtime)
{
Thread *t = DT_THREAD(dt);
face_t f;
real pi = 3.141592654;
real freq = 1;
real daft = 0;
real w = 2*pi*freq;
real a = 5*(pi/180);
/*reset velocities*/
NV_S(vel,=,0.0);
NV_S(omega,=,0.0);
if (!Data_Valid_P())
return;

#if !RP_HOST
daft = -a*w*cos(w*time);
omega[2] = daft;
#endif
}


#include "udf.h"
#include "unsteady.h"
#include "dynamesh_tools.h"
#include "math.h"

#define l 1
#define k 2
#define frequency 1
#define amplitude 0.1

DEFINE_GRID_MOTION(deformation,domain,dt,time,dtim e)
{
Thread * t = DT_THREAD(dt);
face_t f;
Node * v;
int n;
double x, y, y_ref_previous, y_ref;
SET_DEFORMING_THREAD_FLAG(THREAD_T0(t));
begin_f_loop(f,t)
{
f_node_loop(f,t,n)
{
v = F_NODE(f,t,n);
if (NODE_POS_NEED_UPDATE(v))
{
NODE_POS_UPDATED(v);
x = NODE_X(v);
y_ref_previous = -amplitude*(x/l)*(x/l)*sin(2*3.142*frequency*(PREVIOUS_TIME));
y_ref = -amplitude*(x/l)*(x/l)*sin(2*3.142*frequency*(CURRENT_TIME));
if (NODE_Y(v) > y_ref_previous)
{
NODE_Y(v) = y_ref + fabs(NODE_Y(v)-y_ref_previous);
}
else
if (NODE_Y(v) < y_ref_previous)
{
NODE_Y(v) = y_ref - fabs(NODE_Y(v)-y_ref_previous);
}
else
{
NODE_Y(v) = y_ref;
}
}
}
}
end_f_loop(f,t);
}
hassnas is offline   Reply With Quote

Old   December 13, 2022, 07:41
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
put as a header
Code:
#include "udf.h"
#include "unsteady.h"
#include "dynamesh_tools.h"
#include "math.h"

#define l 1
#define k 2
#define frequency 1
#define amplitude 0.1
instead of
Code:
#include "udf.h"
#include "dynamesh_tools.h"
compile codee and read log to avoid these kind of questions
__________________
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
Compiling UDF in FLuent ekha FLUENT 6 July 3, 2019 03:02
udf for multiple reaction alihosseini63 Fluent UDF and Scheme Programming 0 July 4, 2013 18:37
fluent udf problem: write specific data for every iteration in a file. nnvoro Fluent UDF and Scheme Programming 1 May 27, 2013 15:26
How at add multiple udf in fluent? Amir1 Fluent UDF and Scheme Programming 1 April 14, 2013 06:00
fluent UDF external library lapack problem Rick FLUENT 0 May 7, 2008 10:16


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