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

Specifying Mesh Deformation & Rigid Body Motion on a Cell Zone Using UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 5, 2023, 07:02
Default Specifying Mesh Deformation & Rigid Body Motion on a Cell Zone Using UDF
  #1
New Member
 
Join Date: Nov 2012
Posts: 16
Rep Power: 13
zx9cp is on a distinguished road
Hi all,

Really hoping someone can help with this.... I am trying to simulate a case in which I have a 2D flexible foil which deforms while simultaneously heaving up and down. I am using DEFINE_GRID_MOTION to specify the deformation of the foil and DEFINE_CG_MOTION to define the rigid body motion of the cell zone containing the foil.

The problem is that during preview of mesh motion, I can see the CG motion occurring as specified, I can also see the foil surface deforming as specified but the mesh within the cell zone containing the foil is not deforming (to accommodate foil mesh deformation) at all, it just undergoing the rigid body motion.

I have set the adjacent cell zone as deforming using the SET_DEFORMING_FLAG_THREAD macro as per the documentation but it doesn't seem to be having any effect. I have also followed the documentation in terms of setup using the GUI:

1. Defined the motion of rigid body zones.
2. Defined the motion of deforming part AFTER the rigid body motion is specified as 'User Specified'
3. Set the user specified motion to occur relative to the heaving cell zone which contains the foil.
4. Used the NODE_COORD_NEST macro within the DEFINE_GRID_MOTION macro to ensure the deformation occurs relative to the rigid body motion.

The attached image should clarify my cell zones. The circular region containing the foil and the adjacent rectangular region (both tri and quad elements) should heave up and down. this motion is working. The foil within the circular zone should deform relative to the CG motion of the circular zone. This deformation is also working. The tri elements within the circular zone are not deforming, hence I get inverted elements immediately when previewing mesh motion.

I'll attach my UDFs aswell in a sec! Thanks in advance for any help......
Attached Images
File Type: png Capture.PNG (86.1 KB, 9 views)
zx9cp is offline   Reply With Quote

Old   July 5, 2023, 07:10
Default
  #2
New Member
 
Join Date: Nov 2012
Posts: 16
Rep Power: 13
zx9cp is on a distinguished road
This is the DEFINE_CG_MOTION UDF used to specify the heave motion of the cell zone:


Code:
DEFINE_CG_MOTION(y_cog_motion, dt, vel, omega, time, dtime)
{
#if !RP_HOST /*Host excluded from computation*/

/*Calculation of linear velocity due to heave motion*/
vel[1] = 0.25*2*M_PI*1*cos(2*M_PI*1*time);

#endif
}
This is the DEFINE_GRID_MOTION UDF used to define the deformation of foil. Note that these macros are in separate .c files. Also note I have commented out the if(NODE_POS_NEED_UPDATE) macro, this seems to stop the functions from working at all as the dynamic mesh utility crashes immediately when I try to preview the motion. With this not-included I at least see 1 time-steps deformation!

Code:
#include "udf.h"
#include "dynamesh_tools.h"

DEFINE_GRID_MOTION(foil,domain,dt,time,dtime)
{
Thread *tf = DT_THREAD(dt);
face_t f;
Node *v;

/*Definition of inputs*/
real length = 1.85;
real fixed_length = 0.14717863;
real freq = 1;
real wav = 1.5;
real period = 1/freq;
real y_new;
real y_current;
real dY;
real dY_ramp;

real dX_FL;
real dY_FL;
real amp;
real start_pos;

#if !RP_HOST /*Host excluded from computation*/

		/* set deforming flag on adjacent cell zone */
		SET_DEFORMING_THREAD_FLAG (THREAD_T0(tf));
		
		/*Loop through faces on specified thread*/
		begin_f_loop(f,tf)
		{   
			/*Loop through nodes on faces on specified thread*/
				f_node_loop(f,tf,n)
			{	
					/*if(NODE_POS_NEED_UPDATE (v))
				{
				}*/	
					/*NODE_POS_UPDATED(v);*/
					v = F_NODE(f,tf,n);
					amp = 0.125*pow((NODE_X(v)-fixed_length),2);
			
					ramp_time = CURRENT_TIMESTEP*ramp_timesteps;
		
					y_new = amp*sin(2*M_PI*(((NODE_X(v)-fixed_length)/wav)-(time/period)));
					y_current = amp*sin(2*M_PI*(((NODE_X(v)-fixed_length)/wav)-(((time-dtime))/period)));
					dY = y_new-y_current;
					
					NV_D(NODE_COORD_NEST(v),=,0.0,dY,0.0);
			}
		}
	end_f_loop(f,tf);
		
#endif
}

Last edited by zx9cp; July 5, 2023 at 07:28. Reason: Adding info
zx9cp is offline   Reply With Quote

Old   July 11, 2023, 04:58
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
it is good habit to COMPILE your code and read log

variables
Code:
ramp_time
ramp_timesteps;
are not defined
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   July 11, 2023, 05:14
Default Compiling code
  #4
New Member
 
Join Date: Nov 2012
Posts: 16
Rep Power: 13
zx9cp is on a distinguished road
Hi Alexander,

Thanks for replying. Yes - those variables are actually leftover from a previous iteration of the function and are not used in the current version. I will remove them.

I have compiled the function but there are no warnings that yield any clues that might help me fix the issue.

I have searched the documentation and cant find any real detail on specifying deformation on top of rigid body motion - do you know if it is possible to achieve?

Thanks again
zx9cp is offline   Reply With Quote

Reply

Tags
define grid motion, define_cg_motion, fluent - 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
[snappyHexMesh] SnappyHexMesh/splitMeshRegion : region1 in zone "-1" GuiMagyar OpenFOAM Meshing & Mesh Conversion 3 August 4, 2023 12:38
FFD shape deformation for 3D wing not changing the mesh lwc24 SU2 Shape Design 5 August 1, 2019 15:17
[Commercial meshers] Mesh conversion problem (fluent3DMeshToFoam) Aadhavan OpenFOAM Meshing & Mesh Conversion 2 March 8, 2018 01:47
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) cfdonline2mohsen OpenFOAM 3 October 21, 2013 09:28


All times are GMT -4. The time now is 10:25.