|
[Sponsors] |
April 16, 2011, 09:51 |
UDF Rotation
|
#1 |
New Member
Hans Johans
Join Date: Apr 2011
Posts: 6
Rep Power: 15 |
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? |
|
April 16, 2011, 15:18 |
|
#3 |
New Member
Hans Johans
Join Date: Apr 2011
Posts: 6
Rep Power: 15 |
THX a lot! First Problem is solved.
But how can I decide around which point my object rotate? Center of Gravity maybe? |
|
April 16, 2011, 17:02 |
|
#4 |
Senior Member
|
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. |
|
April 16, 2011, 18:15 |
|
#5 |
New Member
Hans Johans
Join Date: Apr 2011
Posts: 6
Rep Power: 15 |
Thx I will try this
|
|
June 19, 2011, 14:24 |
|
#6 |
Member
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15 |
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 |
|
June 19, 2011, 16:21 |
|
#7 | |
Senior Member
|
Quote:
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 |
||
June 25, 2011, 18:42 |
|
#8 |
Member
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15 |
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 |
|
June 26, 2011, 02:32 |
|
#9 | |
Senior Member
|
Quote:
did you create interfaces in order to let them slide on each other? |
||
June 26, 2011, 21:00 |
|
#10 |
Member
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15 |
Hi,
yes I did everything you wrote on your first message... Thanks... |
|
June 28, 2011, 11:49 |
|
#11 |
Senior Member
|
||
June 28, 2011, 19:41 |
|
#12 |
Member
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15 |
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 |
|
June 29, 2011, 09:36 |
|
#13 | |
Senior Member
|
Quote:
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 |
||
July 4, 2011, 20:14 |
|
#14 |
Member
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15 |
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 |
|
July 4, 2011, 20:17 |
|
#15 |
Member
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15 |
ps: if you need the entire case file I can send it by e-mail... Thanks!
|
|
July 4, 2011, 21:52 |
|
#16 |
New Member
mecamor
Join Date: Jul 2011
Posts: 23
Rep Power: 15 |
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
|
|
July 5, 2011, 03:12 |
|
#17 | |
Senior Member
|
Quote:
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 |
||
July 5, 2011, 03:16 |
|
#18 | |
Senior Member
|
Quote:
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 |
||
July 5, 2011, 09:29 |
|
#19 |
New Member
mecamor
Join Date: Jul 2011
Posts: 23
Rep Power: 15 |
hello
I use moving wall ... but it does not move. I work unsteady. piston speed is 10m / s |
|
July 5, 2011, 09:42 |
|
#20 |
New Member
mecamor
Join Date: Jul 2011
Posts: 23
Rep Power: 15 |
how I should set conditions to limit the piston with moving wall so that the piston moves
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for solid body rotation | araz | Fluent UDF and Scheme Programming | 1 | January 13, 2016 03:46 |
UDF CG_MOTION rotation dynamic mesh | Mads | FLUENT | 2 | April 15, 2014 04:30 |
UDF to change Rotation Speed in a MRF simulation | Mike | FLUENT | 3 | September 27, 2011 07:46 |
UDF for a sinusoidal rotation of an airfoil | Lorenzo | FLUENT | 2 | October 10, 2008 11:37 |
UDF for CG rotation | araz | FLUENT | 0 | January 2, 2005 02:12 |