# dynamic meshing UDF motion coding issue!

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

 April 11, 2014, 12:42 dynamic meshing UDF motion coding issue! #1 New Member   Lisa Marfell Join Date: Nov 2013 Posts: 7 Rep Power: 3 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

 Tags code, define_geom, dynamic meshing, macro, udf

 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 moloykb Fluent UDF and Scheme Programming 1 February 13, 2013 00:06 lequi7 Fluent UDF and Scheme Programming 2 November 4, 2011 00:18 Alex FLUENT 0 March 22, 2006 18:40 phil FLUENT 0 September 15, 2004 05:42 Ryan FLUENT 6 April 29, 2004 09:29

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