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

grid_motion UDF for cylindrical expansion

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 15, 2019, 09:09
Default grid_motion UDF for cylindrical expansion
  #1
New Member
 
Ángel Cifuentes González
Join Date: Mar 2019
Posts: 1
Rep Power: 0
ACif95 is on a distinguished road
Hello everyone! I'm begginner on the field of UDFs and i am trying to program a cylindrical expansion. The problem is that i don't know how to save the initial coordinates for the mesh cells to add a displacement on each time step without taking into account the displacement of the latest time step. As i show in the next UDF, if i use NV_VS(N_COORD(v),=,N_COORD(v),'+','disp') it will accumulate the displacement of each time step and it will not move as i would like.

#include "udf.h"
#include "dynamesh_tools.h"

#define Dext 0.06
#define Dint 0.02
#define h 0.4

DEFINE_GRID_MOTION(case13d,domain,dt,time,dtime)
{
face_t f;
Thread *tf=DT_THREAD(dt);
int n;
Node *v;
real A[ND_ND];
real NV_VEC(axis);
real Mag;
real disp;
real z;
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));
begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
F_AREA(A,f,tf);
Mag=NV_MAG(A);
A[0]=A[0]/Mag;
A[1]=A[1]/Mag;
A[2]=A[2]/Mag;
NV_D(axis,=,A[0],A[1],A[2]);
v=F_NODE(f,tf,n);
z=NODE_Z(v);
disp= Dext/10*sin(M_PI*(CURRENT_TIME-z/2))*sin(2*z/h*M_PI);
/*disp=D/100*sin(M_PI*(CURRENT_TIME));*/
if (NODE_POS_NEED_UPDATE(v))
{
NODE_POS_UPDATED(v);
NV_V_VS(NODE_COORD(v), =, NODE_COORD(v), +, axis,*,disp);
}
}

}
end_f_loop(f,tf);
}

Could anyone help me about this?

Regards
ACif95 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 for one dimensional linear motion based on force maccheese Fluent UDF and Scheme Programming 2 September 1, 2019 03:18
Save output of udf in another udf! JuanJoMex FLUENT 0 February 8, 2018 13:43
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 01:53
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


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