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

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By amin.z
  • 1 Post By `e`
  • 1 Post By amin.z

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 12, 2015, 13:09
Default Grid motion
  #1
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 15
amin.z is on a distinguished road
Hi,

I need your help to solve my problem,
I'm working on flow around a vibrating cantilever, It has been clamped from its bottom and its top is free, it performs a sinusoidal bending and generates the flow around itself,
I've found a sample code in fluent UDF Manual but I've some problems with solver setups,
I think I should use grid_motion macro, but I have no idea about its circumstances,
Should I use "deforming" option in dynamic mesh settings?
There are some other vague tabs for me too,

So could anyone help me?

Last edited by amin.z; August 13, 2015 at 04:14.
amin.z is offline   Reply With Quote

Old   August 18, 2015, 08:26
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Is the vibrating cantilever coupled with the flow or is the cantilever's position predetermined? Either way, use the DEFINE_GRID_MOTION UDF to apply motion to the boundaries on a node-by-node basis. Start with using the "smoothing" method (the mesh connectivity remains the same and the internal nodes are moved according to either a spring or diffusion option), apply the above UDF to the cantilever sides (deforming segments) and define the top of the cantilever as stationary (no deformation).
`e` is offline   Reply With Quote

Old   August 18, 2015, 10:50
Default
  #3
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 15
amin.z is on a distinguished road
Thanks for your reply,
the cantilever movement doesn't depend on the fluid flow, it is controlled by piezoelectric method, so its forced motion generates the flow around it,

I'll post the code in next reply,
but in your opinion, Should I use "deforming" option in dynamic mesh setup? or "user define" tab?
amin.z is offline   Reply With Quote

Old   August 18, 2015, 10:53
Default
  #4
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 15
amin.z is on a distinguished road
I've found this code:

/************************************************** ********
node motion based on simple beam deflection equation
compiled UDF
************************************************** ********/
#include "udf.h"
DEFINE_GRID_MOTION(beam,domain,dt,time,dtime)
{
Thread *tf = DT_THREAD(dt);
face_t f;
Node *v;
real NV_VEC(omega), NV_VEC(axis), NV_VEC(dx);
real NV_VEC(origin), NV_VEC(rvec);
real sign;
int n;
/* set deforming flag on adjacent cell zone */
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));
sign = -5.0 * sin (26.178 * time);
Message ("time = %f, omega = %f\n", time, sign);
NV_S(omega, =, 0.0);
NV_D(axis, =, 0.0, 1.0, 0.0);
NV_D(origin, =, 0.0, 0.0, 0.152);
begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
v = F_NODE(f,tf,n);
/* update node if x position is greater than 0.02
and that the current node has not been previously
visited when looping through previous faces */
if (NODE_X(v) > 0.020 && NODE_POS_NEED_UPDATE (v))
{
/* indicate that node position has been update
so that it’s not updated more than once */
NODE_POS_UPDATED(v);
omega[1] = sign * pow (NODE_X(v)/0.230, 0.5);
NV_VV(rvec, =, NODE_COORD(v), -, origin);
NV_CROSS(dx, omega, rvec);
NV_S(dx, *=, dtime);
NV_V(NODE_COORD(v), +=, dx);
}
}
}
end_f_loop(f,tf);
}
Far likes this.
amin.z is offline   Reply With Quote

Old   August 18, 2015, 21:29
Default
  #5
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
I recommend using the smoothing mesh method with the diffusion option. If the surrounding mesh cannot handle the large deformations (results in a poor mesh quality), then enable remeshing.

There are three dynamic mesh zones you need to specify:
-left side of cantilever: type: User-Defined and use the DEFINE_GRID_MOTION UDF
-right side of cantilever: similar to above but with different coordinates in the UDF (offset by the width of the cantilever)
-top of cantilever: type: stationary

The UDF you have posted looks like a good start; although you probably need to modify the equations to reflect your cantilever motion and specific case.
`e` is offline   Reply With Quote

Old   August 21, 2015, 08:29
Default
  #6
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 15
amin.z is on a distinguished road
Thank you dear friend for your help,

I tried to do your tips by I faced to famous and terrible error! Compiling error!
I did a few changes and tried to set it up as the way you said but fluent said:
"The UDF library you are trying to load (libudf) is not compiled for 2d on the current platform (win64)."

I tried some methods for solving the issue but no succeed! the udf works with first grid but for new grid it makes error, it drives me crazy

Based on your experiences, What should I do?
amin.z is offline   Reply With Quote

Old   August 21, 2015, 09:44
Default
  #7
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Have a read of my compiling process for Fluent UDFs with an existing library loaded.
`e` is offline   Reply With Quote

Old   August 22, 2015, 12:21
Default
  #8
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 15
amin.z is on a distinguished road
I read it and tried your instruction, but the problem still exists,
I checked with previous grid and new UDF and also used the UNLOAD method,
and also used a new grid in another case and data,
But the problem is not resolved,
I use visual studio 2015,
Is there any tips?
Thanks for your kindness support
amin.z is offline   Reply With Quote

Old   August 22, 2015, 18:37
Default
  #9
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Could you post the new and old grids (I assume a "grid" is a DEFINE_GRID_MOTION UDF)? Is your case 2-D or 3-D?
`e` is offline   Reply With Quote

Old   August 23, 2015, 02:44
Default
  #10
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 15
amin.z is on a distinguished road
uh, actually "GRID" is a new mesh, I changed some parameters and chose the names as you said, but when I try to compile the same UDF for new mesh fluent said the compiling error,

The domain is 2D,
amin.z is offline   Reply With Quote

Old   August 23, 2015, 08:05
Default
  #11
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
If it's the same UDF that was working earlier, then the problem is how Fluent is loading the UDF. First, the dynamic mesh modifies the node points and these cannot be restored without reloading the case file. Second, I've found it most reliable to fully import the case file after modifying the UDF.
amin.z likes this.
`e` is offline   Reply With Quote

Old   August 27, 2015, 12:08
Default
  #12
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 15
amin.z is on a distinguished road
Such a great idea,
It works
Thanks a lot dear friend.
amin.z is offline   Reply With Quote

Old   August 27, 2015, 13:51
Default
  #13
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 15
amin.z is on a distinguished road
could you please take a look at the code again?
There is a strange issue,
I was able to compile the code using the method you recommended,
Then I tried to run the model but the domain is completely stationary!
however I guess based on the code, the domain should be 2D and also the beam must be on X direction, but I tried other directions and also 3D domain, but there wasn't any success!
So what do you think of that? In your idea is it okay?
I've also attached the page of the UDF Manual which I'm using its code.
Thanks for your kindness support,
Attached Files
File Type: pdf ANSYS Fluent UDF Manual.pdf (41.8 KB, 38 views)
amin.z is offline   Reply With Quote

Old   August 27, 2015, 20:17
Default
  #14
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
The code they have provided works for 2-D (and should generally work for 3-D). Let's take a step back and consider how the dynamic mesh operates. The UDF you've applied on the beam moves the nodes on said beam, and also the surrounding cell zone via:

Code:
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));
In 2-D, the surrounding cell zone is the face. However in 3-D, the surrounding cell zone is the interior zone. If the beam extends to the sides of the domain then these sides must also be set to deforming. If that's confusing, post your mesh and cell zones so we can see how you've setup your mesh.

If you're still having problems, try changing either the direction or the 2-D to 3-D transform (not both at once) to determine the cause.
`e` is offline   Reply With Quote

Old   August 28, 2015, 17:31
Default
  #15
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 15
amin.z is on a distinguished road
I've attached the mesh and have shown the name of the beam sides,
I use "user-define" tab for this wall but none wall moves,
I had also rotated the mesh 90 degrees but it's still stationary,
Also size of the domain is :
{X (m): -0.025m , 0.025}
{Y (m): 0 , 0.03}
Attached Images
File Type: jpg mesh.jpg (98.0 KB, 71 views)
File Type: jpg mesh2.jpg (100.7 KB, 64 views)
amin.z is offline   Reply With Quote

Old   August 28, 2015, 19:33
Default
  #16
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
I assume you've modified the UDF posted above for your case (we don't know the code that's causing your errors at the moment). Have you had success with using the UDF above (from the examples in the UDF manual)?

Your simulation is 2-D and therefore the issue I raised above won't be applicable (only for 3-D cases).
`e` is offline   Reply With Quote

Old   August 30, 2015, 05:00
Default
  #17
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 15
amin.z is on a distinguished road
Not yet, It's still stationary

Could you please take a look at my files?
If you give me your email address I'll present the files to you,
Thanks
amin.z is offline   Reply With Quote

Old   September 1, 2015, 07:39
Default
  #18
New Member
 
Join Date: Sep 2014
Posts: 6
Rep Power: 12
shadiparsa is on a distinguished road
Hi
I have seen your thread and it was great, I have been working on a similar problem too. I have a question, how did you make the mesh? In my case have make a geometry file then in the Ansys Mesh I did the meshing.
Would you please let me know how you did the meshing?
shadiparsa is offline   Reply With Quote

Old   September 1, 2015, 07:47
Default
  #19
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 15
amin.z is on a distinguished road
Quote:
Originally Posted by shadiparsa View Post
Hi
I have seen your thread and it was great, I have been working on a similar problem too. I have a question, how did you make the mesh? In my case have make a geometry file then in the Ansys Mesh I did the meshing.
Would you please let me know how you did the meshing?
I'm using ANSYS Meshing, too.
shadiparsa likes this.
amin.z 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
Mesh Conversion : structured to unstructured shreyasr ANSYS 8 April 8, 2019 08:03
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
Help me with the grid motion of udf yuanyeyzygo Fluent UDF and Scheme Programming 0 May 13, 2012 14:49
MapFields to New Grid For Extreme Grid Deformations due to Body Motion albcem OpenFOAM 0 May 5, 2009 15:17
Convergence moving mesh lr103476 OpenFOAM Running, Solving & CFD 30 November 19, 2007 15:09


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