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

DEFINE_GRID_MOTION udf Problem

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By mperrin

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 28, 2023, 02:07
Question DEFINE_GRID_MOTION udf Problem
  #1
New Member
 
Haider Ali
Join Date: May 2023
Posts: 7
Rep Power: 2
charade_4eft is on a distinguished road
Hello Everyone,

I am working from past few weeks to understand the udf but I have reached dead end.

I am working on 2d Pipe (Rectangular in shape) which has inlet, outlet, upper wall and lower wall. I want to induce sinusoidal wave in both walls using udf. I have assigned udf to lower wall and works fine but issue is with upper wall. While simulating upper wall, I am facing ERROR: dynamic-mesh failed: negative mesh volume detected.

udf code is mentioned below:

#include"udf.h"

#define D 0.01
#define l 0.3
#define freq 1

DEFINE_GRID_MOTION(sinewave, domain, dt, time, dtime)
{
face_t f;
Thread *tf = DT_THREAD(dt);
int n;
Node *v;
real x;
real y;
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));

begin_f_loop(f, tf)
{
f_node_loop(f, tf, n)
{
v = F_NODE(f, tf, n);
if (NODE_POS_NEED_UPDATE(v))
{
NODE_POS_UPDATED(v);
x = NODE_X(v);
y = D/8.0*sin(x*M_PI/l*2)*sin(2*M_PI*freq*CURRENT_TIME);

NODE_Y(v) = y;

}
}
Update_Face_Metrics(f, tf);
}
end_f_loop(f,tf)
}

Do you have any clue how I can fix the issue
Looking forward to your answers.

Thanks!
charade_4eft is offline   Reply With Quote

Old   May 28, 2023, 07:08
Default
  #2
New Member
 
Mickael Perrin
Join Date: Dec 2020
Posts: 9
Rep Power: 5
mperrin is on a distinguished road
Hello charade_4eft,

I worked on exactly same project : double moving wall of a rectangular geometry so i can answer you :
'negative volume cell' is an error that occurs when the displacment send by your UDF is greater than mesh cell on the axis you moving.

Depending on the method used for your dynamic mesh (smoothing, layering or remeshing), i think you need to slow your timestep or reduce your mesh.

From what i understand of your UDF, you try to change the position of your node. Why do you do it this way ?

Regards,
Mickael
charade_4eft likes this.
mperrin is offline   Reply With Quote

Old   May 28, 2023, 12:17
Default
  #3
New Member
 
Haider Ali
Join Date: May 2023
Posts: 7
Rep Power: 2
charade_4eft is on a distinguished road
Hey Mickael,

The udf work perfectly fine with lower wall which lies on x-axis. I am facing negative mesh volume error when udf is assigned to upperwall which is 10 mm above the x-axis.

Btw I am beginner in udf... if you can give clue or suggest me another way.

Kind Regards.
charade_4eft is offline   Reply With Quote

Old   June 5, 2023, 13:42
Default
  #4
New Member
 
Mickael Perrin
Join Date: Dec 2020
Posts: 9
Rep Power: 5
mperrin is on a distinguished road
Hi,



Can you tell me more about your case ? Why did you choose to modify nodes positions instead of let fluent remesh itself ?


Just in case :
y = D/8.0*sin(x*M_PI/l*2)*sin(2*M_PI*freq*CURRENT_TIME);
In this line you use D/8 to define the new node position. Did you properly change D to (D+h), h being the distance between lower and upper wall ? If not, you will define lower and upper wall on the same node position, which could explain the negative cell error.


Regards
mperrin is offline   Reply With Quote

Old   June 11, 2023, 12:24
Default
  #5
New Member
 
Haider Ali
Join Date: May 2023
Posts: 7
Rep Power: 2
charade_4eft is on a distinguished road
Hi Mickael,

In my case, I am trying to induce sinusoidal motion in both walls to generate fluid flow.

y = D/8.0*sin(x*M_PI/l*2)*sin(2*M_PI*freq*CURRENT_TIME);

In above equation D/8 controls the amplitude of wave.
charade_4eft is offline   Reply With Quote

Old   June 12, 2023, 05:32
Default
  #6
New Member
 
Mickael Perrin
Join Date: Dec 2020
Posts: 9
Rep Power: 5
mperrin is on a distinguished road
Hi,

As i said, your udf change the nodes' position of the thread you assigned.
Since you have 2 wall, you need 2 different equations.

Exemple : at first timestep, both of the wall will get a movement of dy = 1mm. I don't know your geometry so i imagine the lower wall has y = 0 mm and upper wall got y = 10mm, so the difference is h = 10 mm.
Your equation give new position to the nodes. If you assigned the same udf to both the wall, the new y of lower and upper wall will be 1mm.
you need an equation that calculate : dy for the lower wall and dy + dh for upper wall.

It can look like this :

#include"udf.h"

#define D 0.01
#define l 0.3
#define freq 1
#define h 0.010 /* dy between lower and upper wall */

DEFINE_GRID_MOTION(sinewave_lower, domain, dt, time, dtime)
{
face_t f;
Thread *tf = DT_THREAD(dt);
int n;
Node *v;
real x;
real y;
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));

begin_f_loop(f, tf)
{
f_node_loop(f, tf, n)
{
v = F_NODE(f, tf, n);
if (NODE_POS_NEED_UPDATE(v))
{
NODE_POS_UPDATED(v);
x = NODE_X(v);
y = D/8.0*sin(x*M_PI/l*2)*sin(2*M_PI*freq*CURRENT_TIME);

NODE_Y(v) = y;

}
}
Update_Face_Metrics(f, tf);
}
end_f_loop(f,tf)
}

/* -------------------------------------------------------------------- */

DEFINE_GRID_MOTION(sinewave_upper, domain, dt, time, dtime)
{
face_t f;
Thread *tf = DT_THREAD(dt);
int n;
Node *v;
real x;
real y;
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));

begin_f_loop(f, tf)
{
f_node_loop(f, tf, n)
{
v = F_NODE(f, tf, n);
if (NODE_POS_NEED_UPDATE(v))
{
NODE_POS_UPDATED(v);
x = NODE_X(v);
y = h + D/8.0*sin(x*M_PI/l*2)*sin(2*M_PI*freq*CURRENT_TIME);

NODE_Y(v) = y;

}
}
Update_Face_Metrics(f, tf);
}
end_f_loop(f,tf)
}

If you use only 1 UDF as i understood, this should be helpful. In other case, please tell me more about your case.

Regards
mperrin is offline   Reply With Quote

Old   June 23, 2023, 00:49
Default
  #7
New Member
 
Haider Ali
Join Date: May 2023
Posts: 7
Rep Power: 2
charade_4eft is on a distinguished road
Hi Mickael,

I hope you are doing well. By adding height of wall in the equation, the negative mesh volume issue has been resolved.

Kind Regards.
charade_4eft is offline   Reply With Quote

Reply

Tags
define grid motion, dynamic-mesh, negative cell volume, udf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 07:05
Problem with DPM simulation with particles injection and EXECUTE_AT_THE_END UDF. Ari Fluent UDF and Scheme Programming 4 May 31, 2016 09:51
udf loading problem santu Fluent UDF and Scheme Programming 1 May 22, 2015 16:47
Vaporization pressure UDF property problem? lehoanganh07 Fluent UDF and Scheme Programming 1 September 13, 2014 11:59
Problem with my udf july Fluent UDF and Scheme Programming 3 June 20, 2010 07:56


All times are GMT -4. The time now is 06:44.