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   July 5, 2011, 16:39
Default
  #21
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 23
Amir is on a distinguished road
Quote:
Originally Posted by mecamor View Post
how I should set conditions to limit the piston with moving wall so that the piston moves
As I said before, in moving wall method you have just set a boundary condition over that! if you want it to move, use dynamic mesh instead.
Amir is offline   Reply With Quote

Old   July 5, 2011, 16:45
Default
  #22
New Member
 
mecamor
Join Date: Jul 2011
Posts: 23
Rep Power: 15
mecamor is on a distinguished road
I modeled the cylinder come a rectangle. and also as a piston rectanble. I left a bit of space between the piston and the cylinder. bopundary conditon as I put Moving wall for the piston but still. I'm fluent again. Amir Please do you can give me more detail
thanks you
mecamor is offline   Reply With Quote

Old   July 5, 2011, 16:47
Default
  #23
New Member
 
mecamor
Join Date: Jul 2011
Posts: 23
Rep Power: 15
mecamor is on a distinguished road
Dera amir I put dynamic mesh for the piston or the fluid
mecamor is offline   Reply With Quote

Old   July 5, 2011, 16:54
Default
  #24
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 23
Amir is on a distinguished road
Quote:
Originally Posted by mecamor View Post
Dera amir I put dynamic mesh for the piston or the fluid
The easiest way for you is writing a UDF for the piston and hook to to the piston and with appropriate setting in dynamic mesh panel (smoothing & re-meshing) change the fluid zone cells. it's also better to take a look over manual.

Amir
Amir is offline   Reply With Quote

Old   July 6, 2011, 11:30
Default
  #25
New Member
 
mecamor
Join Date: Jul 2011
Posts: 23
Rep Power: 15
mecamor is on a distinguished road
Quote:
Originally Posted by Amir View Post
The easiest way for you is writing a UDF for the piston and hook to to the piston and with appropriate setting in dynamic mesh panel (smoothing & re-meshing) change the fluid zone cells. it's also better to take a look over manual.

Amir
Hi Amir
I wrote the UDF of the piston, but when compiling with C 13 or it Fluent There's an error in line 3. How I should do. thank you
Error: C:\Program Files\ANSYS Inc\v130\fluent\ntbin\win64\PISTON2.c: line 3: parse error.

How I should do. thank you
#include "udf.h"
#include "dynamesh_tools.h"
static real v_prev= 0.0;
DEFINE_CG_MOTION(piston, dt, vel, omega, time, dtime)
{
Thread *t;
face_t f;
real NV_VEC (A);
real force, dv;
/* reset velocities */
NV_S (vel, =, 0.0);
NV_S (omega, =, 0.0);
if (!Data_Valid_P ())
return;
/* get the thread pointer for which this motion is defined */
t = DT_THREAD ((Dynamic_Thread *)dt);
/* compute pressure force on body by looping through all faces */
force = 0.0;
begin_f_loop (f, t)
{
F_AREA (A, f, t);
force += F_P (f, t) * NV_MAG (A);
}
end_f_loop (f, t)
/* compute change in velocity, i.e., dv= F * dt/ mass;
velocity update using explicit eulerformula */
dv= dtime* force / 50.0;
v_prev+= dv;
CX_Message ("time = %f, x_vel= %f, force = %f\n", time, v_prev, force);
/* set x-component of velocity */
vel[0] = v_prev;
}
mecamor is offline   Reply With Quote

Old   July 6, 2011, 12:04
Default
  #26
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 23
Amir is on a distinguished road
Quote:
Originally Posted by mecamor View Post
Hi Amir
I wrote the UDF of the piston, but when compiling with C 13 or it Fluent There's an error in line 3. How I should do. thank you
Error: C:\Program Files\ANSYS Inc\v130\fluent\ntbin\win64\PISTON2.c: line 3: parse error.

How I should do. thank you
#include "udf.h"
#include "dynamesh_tools.h"
static real v_prev= 0.0;
DEFINE_CG_MOTION(piston, dt, vel, omega, time, dtime)
{
Thread *t;
face_t f;
real NV_VEC (A);
real force, dv;
/* reset velocities */
NV_S (vel, =, 0.0);
NV_S (omega, =, 0.0);
if (!Data_Valid_P ())
return;
/* get the thread pointer for which this motion is defined */
t = DT_THREAD ((Dynamic_Thread *)dt);
/* compute pressure force on body by looping through all faces */
force = 0.0;
begin_f_loop (f, t)
{
F_AREA (A, f, t);
force += F_P (f, t) * NV_MAG (A);
}
end_f_loop (f, t)
/* compute change in velocity, i.e., dv= F * dt/ mass;
velocity update using explicit eulerformula */
dv= dtime* force / 50.0;
v_prev+= dv;
CX_Message ("time = %f, x_vel= %f, force = %f\n", time, v_prev, force);
/* set x-component of velocity */
vel[0] = v_prev;
}
Hi,
It doesn't have any error while compiling; try VC++ instead.
Amir is offline   Reply With Quote

Old   July 6, 2011, 12:10
Default
  #27
New Member
 
mecamor
Join Date: Jul 2011
Posts: 23
Rep Power: 15
mecamor is on a distinguished road
Quote:
Originally Posted by Amir View Post
Hi,
It doesn't have any error while compiling; try VC++ instead.
Dear amir Whene I compil in fluent I have erro
mecamor is offline   Reply With Quote

Old   July 7, 2011, 07:44
Default
  #28
Member
 
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15
AlbertoP is on a distinguished road
Hi,

follow this: http://www.cfd-online.com/Wiki/Fluen...with_Fluent_13

You will find how to set Visual C++ to compile UDF, and how to open Fluent depending on the OS you have (32 or 64 bit).

Regards
AlbertoP is offline   Reply With Quote

Old   July 11, 2011, 07:37
Default
  #29
Member
 
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15
AlbertoP is on a distinguished road
Hi Amir,

sorry for my delay.
Just wanted to thank you for your support.
Now it's working...but you need to hook UDF only to the grid you want to move. Only in that way I don't get a negative volumes error.

Regards
Alberto
AlbertoP is offline   Reply With Quote

Old   July 11, 2011, 09:12
Default
  #30
New Member
 
mecamor
Join Date: Jul 2011
Posts: 23
Rep Power: 15
mecamor is on a distinguished road
hello
I work with windows 7. how to build the library udf. and when I compile my udf fluent that he lacks nmake.
mecamor is offline   Reply With Quote

Old   July 12, 2011, 13:27
Default
  #31
Member
 
Alberto Pellegrino
Join Date: Jan 2011
Posts: 32
Rep Power: 15
AlbertoP is on a distinguished road
Hi,

as I said above, you only need to follow the instructions given on that answer (http://www.cfd-online.com/Wiki/Fluen...with_Fluent_13). I had the same problem (lack of nmake). And I use Win 7 as well.

Mind to open Fluent from SDK command prompt.
regards
AlbertoP is offline   Reply With Quote

Old   November 1, 2012, 10:24
Default
  #32
Member
 
Vidit Sharma
Join Date: Aug 2012
Location: Delhi, India
Posts: 32
Rep Power: 14
Vidit Sharma is on a distinguished road
hi,

I am trying to move a 2d cylinder in y direction by using UDF:-
# include "udf.h"
# include "dynamesh_tools.h"
DEFINE_CG_MOTION(pump,dt,cg_vel,cg_omega,time,dtim e)
{
Thread *t;
real freq_t;
NV_S(cg_vel,=,0.0);

if(!Data_Valid_P())
return;
freq_t = 0.01;
t= DT_THREAD((Dynamic_Thread*)dt);
cg_vel[0] = 0.0;
cg_vel[1] = freq_t;

}

But I am having a problem while compiling it in Visual Studio Command Prompt. While executing nmake command to compile an error is appearing which is saying NMAKE : fatal error U1077: "sed" :return code '0X1'

can anybody tell how to eliminate this error????

Thank You

Regards

Vidit Sharma
Vidit Sharma is offline   Reply With Quote

Old   April 8, 2013, 03:19
Arrow UDF for GRID Rotation
  #33
Member
 
samrat himvanth nanduri
Join Date: May 2012
Posts: 30
Rep Power: 14
samcfd is on a distinguished road
Hi everyone,

I want some help regarding an issue i'm facing. I need to write a UDF for rotating an O Grid. To be precise we can rotate using GUI MESH - ROTATE and solve it. But i need to do the same using an UDF. For example i need to rotate the whole domain by 8 deg I give that value in the UDF and the grid gets rotated. Can some1 help me out regarding this.

Thanks in advance,
sam.
samcfd is offline   Reply With Quote

Old   December 3, 2014, 03:02
Default Shrikant
  #34
New Member
 
shrikant
Join Date: Mar 2014
Posts: 1
Rep Power: 0
shri.hade is on a distinguished road
Quote:
Originally Posted by Amir View Post
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
Hi Amir,
I am working on CFD analysis of a vertical axis wind turbine, in that i need to find RPM of a turbine using fluent.
for this i need to write a UDF but i am totaly unaware of the UDF concept will you please guide me how to write a UDF for this case
shri.hade is offline   Reply With Quote

Old   April 16, 2017, 17:41
Default
  #35
Senior Member
 
Have a nice time!
Join Date: Feb 2016
Location: mech.eng.ahmedmansour@gmail.com
Posts: 291
Rep Power: 11
Ahmed Saeed Mansour is on a distinguished road
Hello, I wanna write a code to make a variable inlet speed and variable rotating speed (based on the variable velocity) for a rotor in fluent..What should I do?
Thanks
Ahmed Saeed Mansour is offline   Reply With Quote

Old   July 30, 2018, 02:39
Default
  #36
New Member
 
Jaydee
Join Date: May 2017
Posts: 3
Rep Power: 9
Jawad Zakir is on a distinguished road
Quote:
Originally Posted by Amir View Post
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
I am facing the same kind of problem. how can i contact you over the email?
Jawad Zakir is offline   Reply With Quote

Old   October 6, 2020, 02:29
Default udf rotation
  #37
New Member
 
SadeghRaji
Join Date: Oct 2020
Posts: 1
Rep Power: 0
SadeghRaji is on a distinguished road
Hello every one!

I want to write a code that rotates a body in a room with the following specifications.

When the time is between this interval 👇

1 <t <2.57 seconds

The angular velocity (w) should be 👇👇

w = 1 (rad / s)

And When time is out of range. the angular velocity is zero.

And the body rotates 90 degrees.

Visual Studio is paired with Fluent and has no problems.

Now the problem is how do I write this code?
SadeghRaji is offline   Reply With Quote

Old   October 6, 2020, 04:50
Default
  #38
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Ansys Fluent Customization manual

look for DEFINE_ZONE_MOTION macro
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   October 15, 2020, 07:29
Default
  #39
Senior Member
 
Have a nice time!
Join Date: Feb 2016
Location: mech.eng.ahmedmansour@gmail.com
Posts: 291
Rep Power: 11
Ahmed Saeed Mansour is on a distinguished road
Quote:
Originally Posted by SadeghRaji View Post
Hello every one!

I want to write a code that rotates a body in a room with the following specifications.

When the time is between this interval 👇

1 <t <2.57 seconds

The angular velocity (w) should be 👇👇

w = 1 (rad / s)

And When time is out of range. the angular velocity is zero.

And the body rotates 90 degrees.

Visual Studio is paired with Fluent and has no problems.

Now the problem is how do I write this code?
Hello, check out this link:

https://www.researchgate.net/post/Ho...s_through_time

Also, I found that typing the code using else if not easy, I prepared three UDF files, each one contained one equation for each motion. At the required time, I stop the simulation and insert the other UDF until I reach the next required time and I insert the new UDF and it worked. However, you may find the other solutions better for your case.
Thanks
Ahmed Saeed Mansour 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 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


All times are GMT -4. The time now is 19:12.