|
[Sponsors] |
Specifying Mesh Deformation & Rigid Body Motion on a Cell Zone Using UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 5, 2023, 08:02 |
Specifying Mesh Deformation & Rigid Body Motion on a Cell Zone Using UDF
|
#1 |
New Member
Join Date: Nov 2012
Posts: 16
Rep Power: 14 |
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...... |
|
July 5, 2023, 08:10 |
|
#2 |
New Member
Join Date: Nov 2012
Posts: 16
Rep Power: 14 |
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 } 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 08:28. Reason: Adding info |
|
July 11, 2023, 05:58 |
|
#3 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
it is good habit to COMPILE your code and read log
variables Code:
ramp_time ramp_timesteps;
__________________
best regards ****************************** press LIKE if this message was helpful |
|
July 11, 2023, 06:14 |
Compiling code
|
#4 |
New Member
Join Date: Nov 2012
Posts: 16
Rep Power: 14 |
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 |
|
Tags |
define grid motion, define_cg_motion, fluent - udf |
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 13:38 |
FFD shape deformation for 3D wing not changing the mesh | lwc24 | SU2 Shape Design | 5 | August 1, 2019 16:17 |
[Commercial meshers] Mesh conversion problem (fluent3DMeshToFoam) | Aadhavan | OpenFOAM Meshing & Mesh Conversion | 2 | March 8, 2018 02:47 |
[snappyHexMesh] No layers in a small gap | bobburnquist | OpenFOAM Meshing & Mesh Conversion | 6 | August 26, 2015 10:38 |
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) | cfdonline2mohsen | OpenFOAM | 3 | October 21, 2013 10:28 |