CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Wave Generation via Flapping Wall UDF (https://www.cfd-online.com/Forums/fluent-udf/101178-wave-generation-via-flapping-wall-udf.html)

LenDawg0220 April 28, 2012 14:31

Wave Generation via Flapping Wall UDF
 
Hello All,

Long story short... I'm working on developing a 2D cfd model via fluent 13, that models surface waves interacting with various geometries lying on the free surface. The model consists of a tank, with wall boundary's at the front and end walls, the bottom, and a pressure outlet for the top. The trick is I need the model to be robust enough that the waves being developed reflect off the end wall, and combine with oncoming waves, and I need to run this until a standing wave develops in the tank.

I would like to accomplish this by generating the waves via a udf, which causes the front wall to oscillate like a hinged flap. Reading the udf manual, the DEFINE_CG_MOTION macro, appears to allow this to occur, however something I can't explain is occuring. When I preview the motion, the wall begins to move as intended, but when it attempts to pass back through the vertical plane, it changes direction and heads back in the direction in which it came. It's as if the sign on the angular velocity has suddenly changed, however I can confirm that hasn't. Before people ask, I've played with the phase angle to no avail, and it doesn't matter which direction the motion starts (ie. into the tank or out of the tank), it always changes direction unexpectedly.

I've included the UDF below. If anyone has any thoughts on this, or suggestions on other ways to accomplish my goal please comment. I welcome all suggestions.

#include"udf.h"
real pi, freq, phase, Ampdeg, Amprad, w, AVel;
DEFINE_CG_MOTION(wallmotion, dt, vel, omega, time, dtime)
{
NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
/* Defined Constants*/

pi = 3.141592654;
freq = .97;
Ampdeg = 11.195;
phase = 0;
/*Define Wall Motion via. Angular Velocity */
Amprad = Ampdeg*pi/180; /*Convert amplitude to radians */
w=2.0*pi*freq; /*angular freq in radians*/
AVel = Amprad*w*cos(w*time + phase);
omega[2] = AVel;
/*Assign AVel to omegaz */
Message("time:%f omegaz:%f \n", time, omega[2]);
}

Thanks for your time.

Len

LenDawg0220 April 29, 2012 14:30

Well I solved my problem rather unexpectedly. There appears to be a bug with in Fluent 13, because I have no other way to explain it. When I previewed the wall motion using the display zone motion option, it gave me the problem I listed above. When I used the preview mesh motion option though, the motion ran as expected.

Len

Patrick1 May 11, 2012 07:13

Quote:

Originally Posted by LenDawg0220 (Post 358356)
Well I solved my problem rather unexpectedly. There appears to be a bug with in Fluent 13, because I have no other way to explain it. When I previewed the wall motion using the display zone motion option, it gave me the problem I listed above. When I used the preview mesh motion option though, the motion ran as expected.

Len

Glad you fixed your problem. Was just wondering if you need a special mesh to use this CG_MOTION macro? How does it actually model the movement? Have no real questions just sounds like an interesting sim you're running there. Do the waves reflect properly?

LenDawg0220 June 11, 2012 10:08

Quote:

Originally Posted by Patrick1 (Post 360570)
Glad you fixed your problem. Was just wondering if you need a special mesh to use this CG_MOTION macro? How does it actually model the movement? Have no real questions just sounds like an interesting sim you're running there. Do the waves reflect properly?

Sorry for the delay in replying Patrick, I intended to respond right away but got sidetracked.

To answer your question, the only trick to using a moving mesh, that they don't jump right out and tell you is that the mesh has to be a tri grid, not an H-Grid for the smoothing function to work. If you don't use a tri grid, when you run the motion or the simulation the mesh will not deform and the simulation will fail as soon as the moving object crosses over into the next element (creates a negative volume).

Other than that my mesh is setup very much like the falling box example. I used ICEM to make a separate region around my moving flap, which has an H-grid that moves with the flap, and then created a region around that which is all a tri grid that I've allowed to deform. I subject both the flap and the H-grid region to the macro I wrote (I've since modified it slightly to account for the flap having a thickness and being hinged at the back instead of the middle, but its general function is the same).

As for the waves, I've successfully run several models up to the 1 min mark, and they are reflecting and creating a standing wave. However I've yet to compare the results to wave theory yet or results from a wave tank, so I don't really know how good my results are, but it's a start.

Len

siddanibhargav April 11, 2017 16:21

Hello LenDawg0220,
Can you please let me know how you had created the prism layer using ICEM in detail? I'm working on a similar project, but I'm carrying out 2D analysis. As I couldn't generate a prism layer, I had generated an inflation but had faced a problem in FLUENT solver (Negative Cell Volume).

I would be glad if anyone can give me some inputs.
Thanks in advance.

Usama.JM June 26, 2017 16:05

Help me please
How writing UDF for: w=A(t)*sin(n*pi*x/L)


Sent from my iPhone using CFD Online Forum mobile app


All times are GMT -4. The time now is 13:45.