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

UDF Rotation

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 16, 2011, 08:51
Default UDF Rotation
  #1
New Member
 
Hans Johans
Join Date: Apr 2011
Posts: 6
Rep Power: 15
lepetitmort is on a distinguished road
I want to rotate a object and I am using a UDF.
The user manual says that I should use the variable omega, but using this code:


DEFINE_CG_MOTION(....)
{
omega[1]=30;
}


I get a horizontal movement (or maybe a rotation with a very big circle, so that it looks like a horizontal movement)

Can somebody see my prob?
what does the X in variable[X] exactly mean?
lepetitmort is offline   Reply With Quote

Old   April 16, 2011, 14:03
Default
  #2
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
omega[0] : x-component
omega[1] : y-component
omega[2] : z-component
Amir is offline   Reply With Quote

Old   April 16, 2011, 14:18
Default
  #3
New Member
 
Hans Johans
Join Date: Apr 2011
Posts: 6
Rep Power: 15
lepetitmort is on a distinguished road
THX a lot! First Problem is solved.

But how can I decide around which point my object rotate? Center of Gravity maybe?
lepetitmort is offline   Reply With Quote

Old   April 16, 2011, 16:02
Default
  #4
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
I think so. you can see your grid motion in (solve->grid motion) to make sure about that before running.
I've used DEFINE_GRID_MOTION before, if you can't handle that with DEFINE_CG_MOTION, try this general macro.
lepetitmort likes this.
Amir is offline   Reply With Quote

Old   April 16, 2011, 17:15
Default
  #5
New Member
 
Hans Johans
Join Date: Apr 2011
Posts: 6
Rep Power: 15
lepetitmort is on a distinguished road
Thx I will try this
lepetitmort is offline   Reply With Quote

Old   June 19, 2011, 13:24
Default
  #6
Member
 
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15
AlbertoP is on a distinguished road
Hi Amir,

I'm trying to create a sinusoidal motion of a circular grid that contains the airfoil (pitching). And the circular grid (quad) is inside a tri-grid supposed to remain static.

Reading on cfd-online I have not figured out yet if I need to use DEFINE_CG_MOTION or DEFINE_GRID_MOTION...

- Please can you explain what you know about that?

- Must the node at the interface (between rotating quad-mesh and static tri-mesh) be merged or not?

- What setting on Fluent about dynamic mesh? I mean, smoothing, layering, remeshing, or nothing?

- Could you kindly show me the "general macro" you mentioned above, I would really appreciate your help.


Many thanks!
Kind regards,

Alberto
AlbertoP is offline   Reply With Quote

Old   June 19, 2011, 15:21
Default
  #7
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Quote:
Originally Posted by AlbertoP View Post
Hi Amir,

I'm trying to create a sinusoidal motion of a circular grid that contains the airfoil (pitching). And the circular grid (quad) is inside a tri-grid supposed to remain static.

Reading on cfd-online I have not figured out yet if I need to use DEFINE_CG_MOTION or DEFINE_GRID_MOTION...

- Please can you explain what you know about that?

- Must the node at the interface (between rotating quad-mesh and static tri-mesh) be merged or not?

- What setting on Fluent about dynamic mesh? I mean, smoothing, layering, remeshing, or nothing?

- Could you kindly show me the "general macro" you mentioned above, I would really appreciate your help.


Many thanks!
Kind regards,

Alberto
Hi Alberto,
According to the UDF manual, DEFINE_CG_MOTION can be used for solid body motion; on the other hand, DEFINE_GRID_MOTION is more general, even you can define specific functions for each node.
For your case, I propose you to use DEFINE_CG_MOTION without any additional setting, and for this purpose, you have to use interfaces (non-conformal mesh) between to different zones in order to let them slide on each other.
You can also use general macro, i.e. DEFINE_GRID_MOTION to rotate inner zone sinusoidally with the same setting with the previous one, but here, you have to define a rotation matrix instead which is not recommended for your case.

Regards,

Amir
Amir is offline   Reply With Quote

Old   June 25, 2011, 17:42
Default
  #8
Member
 
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15
AlbertoP is on a distinguished road
Thank you Amir for your quick reply.

After have facing the problem of compiling the UDF since I didn't have VC++ installed...now I have the negative volume problem.

Specifying, when I go for a Mesh Motion Preview on Fluent, I got this error message: "Update-Dynamic-Mesh failed. Negative cell volume detected".

Any idea please?
Many thanks.
Kind regards,

Alberto
AlbertoP is offline   Reply With Quote

Old   June 26, 2011, 01:32
Default
  #9
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Quote:
Originally Posted by AlbertoP View Post
Thank you Amir for your quick reply.

After have facing the problem of compiling the UDF since I didn't have VC++ installed...now I have the negative volume problem.

Specifying, when I go for a Mesh Motion Preview on Fluent, I got this error message: "Update-Dynamic-Mesh failed. Negative cell volume detected".

Any idea please?
Many thanks.
Kind regards,

Alberto
Hi,
did you create interfaces in order to let them slide on each other?
Amir is offline   Reply With Quote

Old   June 26, 2011, 20:00
Default
  #10
Member
 
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15
AlbertoP is on a distinguished road
Hi,

yes I did everything you wrote on your first message... Thanks...
AlbertoP is offline   Reply With Quote

Old   June 28, 2011, 10:49
Default
  #11
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Quote:
Originally Posted by AlbertoP View Post
Hi,

yes I did everything you wrote on your first message... Thanks...
Hi,
Did you hook it to appropriate zones (interior and interface) and are you sure about UDF correctness?
Amir is offline   Reply With Quote

Old   June 28, 2011, 18:41
Default
  #12
Member
 
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15
AlbertoP is on a distinguished road
Hi,

yes the UDF is correct, but maybe I did wrong in hooking it: my idea was to hook it to the wall (airfoil) which makes rotate the inner mesh (free to rotate as interfaced and not conforming).
But.. you said that I need to hook to the interface or to the inner mesh? In this case it would be a grid_motion instead of a cg_motion (referring to a body)...am I wrong?

So, please, can you clarify this point..so I will not bother you again..
Many thanks again...

Alberto
AlbertoP is offline   Reply With Quote

Old   June 29, 2011, 08:36
Default
  #13
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Quote:
Originally Posted by AlbertoP View Post
Hi,

yes the UDF is correct, but maybe I did wrong in hooking it: my idea was to hook it to the wall (airfoil) which makes rotate the inner mesh (free to rotate as interfaced and not conforming).
But.. you said that I need to hook to the interface or to the inner mesh? In this case it would be a grid_motion instead of a cg_motion (referring to a body)...am I wrong?

So, please, can you clarify this point..so I will not bother you again..
Many thanks again...

Alberto
Dear Alberto,
you have to hook it over everything in inner part (walls-interiors-one of the interfaces) except fluid zone and this not depend on your macro.

Regards,

Amir
Amir is offline   Reply With Quote

Old   July 4, 2011, 19:14
Default
  #14
Member
 
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15
AlbertoP is on a distinguished road
Dear Amir,

very sorry to bother you again...but I cannot solve my problem.

As you can see in the images below, the profile moves, while the mesh around it remains steady, so that's why I got negative volumes error. So maybe the UDF is not so correct like I thought, or I am wrong whit some settings.

Now, to avoid further waste of time...I'll copy my UDF and my settings, so you will be able to figure out what is wrong, I hope...

UDF:

#include <stdio.h>
#include <math.h>
#include "udf.h"

DEFINE_CG_MOTION(airfoil_pitch, dt, vel, omega, time, dtime)
{
real pitchampl, pitchdispl, omg, pi, count;

pi = 3.14159265;


/* reset velocities */
NV_S (vel, =, 0.0);
NV_S (omega, =, 0.0);

/* motion */
pitchampl = 2 * pi / 180; /* angular pitch amplitude */
omg = 2 * pi * 20; /* angular frequency */
pitchdispl = pitchampl * sin(omg * time); /* resultant displacement */

omega[2] = pitchampl * omg * cos(omg * time);
}

------

Now my principal settings:

- CELL ZONE CONDITIONS: all the mesh set as steady.
- MESH INTERFACES: without any option settings.
- DYNAMIC MESH: activated, with the UDF hooked over the airfoil and over the interface that belongs to the inner mesh (supposed to oscillate). I don't have anything more inside of it. And no other options or methods like you said.

-----

To make a disgression...what about the two walls automatically generated after the interface creation? Are them supposed to remain walls or do I have to change them?

Resuming, the problem is that the inner grid is not made in motion. Can you understand why?

Many thanks again for your availability.
Regards,

Alberto


AlbertoP is offline   Reply With Quote

Old   July 4, 2011, 19:17
Default
  #15
Member
 
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15
AlbertoP is on a distinguished road
ps: if you need the entire case file I can send it by e-mail... Thanks!
AlbertoP is offline   Reply With Quote

Old   July 4, 2011, 20:52
Default
  #16
New Member
 
mecamor
Join Date: Jul 2011
Posts: 23
Rep Power: 14
mecamor is on a distinguished road
hello I wanted to see the shock wave generated by a piston. My problem I can not even move my piston with moving wall. thank you for helping me
mecamor is offline   Reply With Quote

Old   July 5, 2011, 02:12
Default
  #17
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Quote:
Originally Posted by AlbertoP View Post
ps: if you need the entire case file I can send it by e-mail... Thanks!
Dear Alberto,
It seems that your settings are correct and I don't think that the problem origins from walls created over interfaces. I have 2 suggestions:
1) to make sure about your UDF, hook it to the whole domain and check whether it works or not.
2) after you have changed dynamic mesh settings, it's better to write your case and read it again and then see grid motion panel.
if you don't have any progress, send it to my E-mail.

Amir
Amir is offline   Reply With Quote

Old   July 5, 2011, 02:16
Default
  #18
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Quote:
Originally Posted by mecamor View Post
hello I wanted to see the shock wave generated by a piston. My problem I can not even move my piston with moving wall. thank you for helping me
Hi,
if you use moving wall, you have just set a boundary condition over that and it wouldn't move. To achieve you purpose, you have to use dynamic mesh instead which as I know, there is special kind for moving piston in cylinder.

Regards,

Amir
Amir is offline   Reply With Quote

Old   July 5, 2011, 08:29
Default
  #19
New Member
 
mecamor
Join Date: Jul 2011
Posts: 23
Rep Power: 14
mecamor is on a distinguished road
hello
I use moving wall ... but it does not move. I work unsteady. piston speed is 10m / s
mecamor is offline   Reply With Quote

Old   July 5, 2011, 08:42
Default
  #20
New Member
 
mecamor
Join Date: Jul 2011
Posts: 23
Rep Power: 14
mecamor is on a distinguished road
how I should set conditions to limit the piston with moving wall so that the piston moves
mecamor 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
UDF for solid body rotation araz Fluent UDF and Scheme Programming 1 January 13, 2016 02:46
UDF CG_MOTION rotation dynamic mesh Mads FLUENT 2 April 15, 2014 03:30
UDF to change Rotation Speed in a MRF simulation Mike FLUENT 3 September 27, 2011 06:46
UDF for a sinusoidal rotation of an airfoil Lorenzo FLUENT 2 October 10, 2008 10:37
UDF for CG rotation araz FLUENT 0 January 2, 2005 01:12


All times are GMT -4. The time now is 18:22.