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

Fixed velocity UDF not working

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 11, 2018, 04:30
Default Fixed velocity UDF not working
  #1
New Member
 
Enrique Pérez Heredia
Join Date: May 2018
Location: Madrid, Spain.
Posts: 16
Rep Power: 4
EnriqueP is on a distinguished road
Hello, I'm trying to simulate a fixed velocity fall of a body into a fluid, I am setting up the domain and introducing this UDF.

DEFINE_CG_MOTION(OW_fall, dt, vel, omega, time, dtime)
{
vel[1] = -5;
}

It is as simple as that but it does not work, when I start the simulation the body does not move at all and remains like that for any time.

Thank you in advance.

Enrique P.

__
__________________
Loading signature...
EnriqueP is offline   Reply With Quote

Old   June 11, 2018, 12:43
Default
  #2
Senior Member
 
Join Date: Sep 2017
Posts: 224
Rep Power: 8
obscureed is on a distinguished road
Hi Enrique,

Please could you sketch out how you have set up the Dynamic Mesh Zones? (I think you need a deforming cell zone plus a Rigid Body for the moving face zones. The Rigid Body is where you hook in the UDF.) Also describe the type of Dynamic Mesh that you have set up -- layering, smoothing, or whatever -- and summarise the settings there.

Thanks,
Ed
obscureed is offline   Reply With Quote

Old   June 12, 2018, 03:25
Default Thanks
  #3
New Member
 
Enrique Pérez Heredia
Join Date: May 2018
Location: Madrid, Spain.
Posts: 16
Rep Power: 4
EnriqueP is on a distinguished road
Hi Obscureed, thanks for the answer.

I have my rigid body which is a cylinder, surrounded by another zone made by an inflation which moves with the cylinder. I have layering and remeshing that work nice because I have already used them to study the free fall under gravity of the same cylinder.

I attach some images with the setting of the dynamic mesh.

Cylinder_6DOF.PNG

Cylinder_inflation.PNG

Remeshing.PNG

Smoothing.PNG
__________________
Loading signature...
EnriqueP is offline   Reply With Quote

Old   June 12, 2018, 05:57
Default
  #4
Senior Member
 
Join Date: Sep 2017
Posts: 224
Rep Power: 8
obscureed is on a distinguished road
Hi Enrique,

Thanks for those images. A couple of thoughts come to mind:

-- Is 6DOF what you want in this model? I think if you want to impose a fixed motion, 6DOF should be off. I am actually confused about how the motion is currently defined: the UDF, the specified velocity in the Dynamic Mesh Zones window, or 6DOF. I think you need a setup where the UDF is more clearly in control. You also want a setup where a UDF of type DEFINE_CG_MOTION is called for -- currently, your UDF of this type is hooked in where DEFINE_SDOF_PROPERTIES would be appropriate.

-- You seem to have given the same motion settings to the cylinder and to the fluid. (Although, as in my previous point, I am not entirely sure what those motion settings are.) So perhaps you would not expect to see relative motion. I think a correct setup would have the cylinder (boundary face zone) being given rigid-body motion, and the moving_fluid (surrounding cell zone) deforming without motion.

By the way, I would recommend following the example in the help files to set the other velocities to zero:
Code:
  /* reset velocities */
  NV_S(vel, =, 0.0);
  NV_S(omega, =, 0.0);
  if (!Data_Valid_P())
    return;
As usual, it is a good idea to save case and data files before you start simulating with new settings. Please tell us how it goes -- when you reach a working setup, please share it in images like the current ones.

Good luck!
Ed
obscureed is offline   Reply With Quote

Old   June 12, 2018, 06:12
Default
  #5
New Member
 
Enrique Pérez Heredia
Join Date: May 2018
Location: Madrid, Spain.
Posts: 16
Rep Power: 4
EnriqueP is on a distinguished road
Thank you again Obscureed

You are right, I don't reallt want 6DOF but I didn't know where to introduce the UDF function. I tried in the same way as the free fall simulation (I did the free fall case with DEFINE_SDOF_PROPERTIES and it works properly).

The "moving_fluid" zone that is in the simulation is only the portion of fluid with fixed mesh wich moves along with the body not the whole domain. Sorry about that, I should have uploaded an image of the mesh setup.

To be clear, the only motion that I want is the one of the cylinder falling at constant velocity (and the surrounding zone aswell). Where shall I hook up the DEFINE_CG_MOTION UDF?
__________________
Loading signature...
EnriqueP is offline   Reply With Quote

Old   June 13, 2018, 05:01
Default It worked
  #6
New Member
 
Enrique Pérez Heredia
Join Date: May 2018
Location: Madrid, Spain.
Posts: 16
Rep Power: 4
EnriqueP is on a distinguished road
Thansk for the help.
My error was to enable the 6DOF solver as obscureed pointed out I'm using the UDF in the help manual as you suggested and it is working fine. The setup is the one uploaded before but disabling the 6DOF solver.

Now I get to the point of obtaining results of pressures and forces. I'll update you or ask for more help.

Enrique P.
__
__________________
Loading signature...
EnriqueP is offline   Reply With Quote

Old   June 18, 2018, 07:09
Default
  #7
New Member
 
Enrique Pérez Heredia
Join Date: May 2018
Location: Madrid, Spain.
Posts: 16
Rep Power: 4
EnriqueP is on a distinguished road
Im having some trouble again trying to impose the movement in two directions.
My UDF is the following:

DEFINE_CG_MOTION(OW_fall, dt, vel, omega, time, dtime)
{
/* reset velocities */
NV_S(vel[0], =, 40.0);
NV_S(vel[1], =, -1.5);
NV_S(omega, =, 0.0);
if (!Data_Valid_P())
return;

}

I get an error of the type "error: subscripted value is neither array nor pointer". Apparently it is related with the definition of the array vel which I think is defined by default as a 3-d array.

Any suggestions?
Thnaks.
__________________
Loading signature...
EnriqueP is offline   Reply With Quote

Old   June 18, 2018, 07:10
Default
  #8
New Member
 
Enrique Pérez Heredia
Join Date: May 2018
Location: Madrid, Spain.
Posts: 16
Rep Power: 4
EnriqueP is on a distinguished road
Im having some trouble again trying to impose the movement in two directions.
My UDF is the following:

DEFINE_CG_MOTION(OW_fall, dt, vel, omega, time, dtime)
{
/* reset velocities */
NV_S(vel[0], =, 40.0);
NV_S(vel[1], =, -1.5);
NV_S(omega, =, 0.0);
if (!Data_Valid_P())
return;

}

I get an error of the type "error: subscripted value is neither array nor pointer". Apparently it is related with the definition of the array vel which I think is defined by default as a 3-d array.

Any suggestions?
Thnaks.
__________________
Loading signature...
EnriqueP is offline   Reply With Quote

Reply

Tags
body, fixed velocity, 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
Help with UDF to calculate the bubble velocity for 2 phase gas enass massoud Fluent UDF and Scheme Programming 0 October 18, 2016 07:11
Having trouble adapting serial UDF to work in parallel muyuntao Fluent UDF and Scheme Programming 1 November 10, 2015 14:42
How to define a fixed velocity for a given mass flow rate on inlet mqasimali FLUENT 2 April 12, 2013 18:24
DPM UDF particle position using the macro P_POS(p)[i] dm2747 FLUENT 0 April 17, 2009 02:29
Variables Definition in CFX Solver 5.6 R P CFX 2 October 26, 2004 03:13


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