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

dynamic meshing UDF motion coding issue!

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 11, 2014, 12:42
Talking dynamic meshing UDF motion coding issue!
  #1
New Member
 
Lisa Marfell
Join Date: Nov 2013
Posts: 7
Rep Power: 12
lmarf88 is on a distinguished road
Hello!

I am trying to simulate a 2D moving piston to analyse the pressure flow field in a closed system. I currently have a rectangular mesh and am trying to write a Define_GEOM macro to define the motion of one moving boundary to simulate the movement piston.

I do not have much experience with coding, but have been looking at various tutorials and examples and have so far come up with the following code:


#include "udf.h"

DEFINE_GEOM(moving_boundary,domain,dt,position)

int position;
for (int position=0; position<=230.5; position++)
{
nextposition = position+1;
if (position<230.5)
{
nextposition = - 138399*position*position + 2716.6*position - 0.7678;
}
position = nextposition;
}


The code contains a simple sin function: y = -138399x^2 + 2716.6x - 0.7678 which should allow the piston to accelerate and decelerate. The code is designed to move the piston wall from position 0mm to position 230.5mm and then stop. So I want the position to increment at 1mm every iteration from 0mm to 230.5mm at a rate of the sin function shown.
I am getting a lot of errors with this though and was hoping someone might be able to help!

Originally I used this code: { position[1] = - 138399*position[0]*position[0] + 2716.6*position[0] - 0.7678; }
and managed to hook it to my model, however as there is no loop function, the wall only moves slightly once.

Any help would be massively appreciated.

Thanks!

Lisa
lmarf88 is offline   Reply With Quote

Reply

Tags
code, define_geom, dynamic meshing, macro, udf


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 dynamic mesh moloykb Fluent UDF and Scheme Programming 1 February 12, 2013 23:06
Fluent UDF Discontinuous Motion lequi7 Fluent UDF and Scheme Programming 2 November 3, 2011 23:18
UDF error CG Motion Alex FLUENT 0 March 22, 2006 17:40
UDF, dynamic mesh motion phil FLUENT 0 September 15, 2004 05:42
Problem related with UDF for dynamic mesh Ryan FLUENT 6 April 29, 2004 09:29


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