CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   trying to simulate the compression stroke inside cylinder, using UDF for injection (

mayur November 17, 2009 05:24

trying to simulate the compression stroke inside cylinder, using UDF for injection
Dear Sir/Madam

I am trying to simulate the compression stroke inside the cylinder. I need to specify a UDF for Injection from 310 degrees to 340 Degrees. I have to activate my inlet during this period.

Can you please guide me in writing an UDF. I have no experience in Programming :(

Thank you

dmoroian November 25, 2009 07:57

Check this post:

raoudha November 25, 2009 08:59

dear dmoroian
i'm simulating slug flow with phase change (boiling heat transfer) in vertical tube and i need also to specify a UDF for mass and heat transfer between gas and liquid phases, would please help me

dmoroian November 25, 2009 09:11

Hi Raoudha,
Your topic is difficult, and I don't have much experience with it (mass transfer between phases). As a general answer you have to use DEFINE_SOURCE macro.

raoudha November 25, 2009 09:21

thank you dmoroian

raoudha November 27, 2009 11:56

hello dmoroian
i'm trying to understand how using udf for boiling flow (horizontal boiling flow) but when compiling (define-> udf->compiled) an error msg is shown: the system cannot find the path specified (the boiling.c file was saved in the same directory)

"(system "copy C:\Fluent.Inc\fluent6.2.16\src\makefile_nt.udf libudf\ntx86\2ddp\makefile") 1 fichier(s) copi‚(s).
(chdir "libudf")()
(chdir "ntx86\2ddp")()
'nmake' n'est pas reconnu en tant que commande interne
ou externe, un programme ex‚cutable ou un fichier de commandes.
'nmake' n'est pas reconnu en tant que commande interne
ou externe, un programme ex‚cutable ou un fichier de commandes.

what shall i do
thank in advance

dmoroian November 28, 2009 05:59

You need a compiler

'nmake' n'est pas reconnu en tant que commande interne
Hi Raoudha,
From the message you posted above I suspect that you don't have a compiler installed on your machine.


raoudha November 28, 2009 06:35

hi dragos
i have installed c++ but the same msg is chown,
shall i use an other compiler?


dmoroian November 28, 2009 12:46

I have never used fluent+udf on Windows, but Microsoft Visual C++ should be enough. Do you have it installed?


raoudha November 28, 2009 13:20

yes i have installed Microsoft Visual C++2008 express edition
and no change :-((

raoudha November 28, 2009 14:51

finally this problem is solved, i had to open fluent from Visual Studio command prompt
thank for help

sabbasi_mr December 2, 2009 01:23

some times the the nmake problem is solved, but other problems exist. It is better to counteract all problem at once:
Run the Vcvars32.bat file in the ..\BIN directory found in the installed directory under ..\MSDEV or ..\DevStudio\VC of your installed visual c++ directory. This file contains the environment variables required to run build tools from a command prompt.
After that run the fluent from this command prompt......

raoudha December 2, 2009 06:47

hello Saeed
i'll try to do it

famangs December 15, 2013 09:04

UDF rotation for a VAWT
1 Attachment(s)
i want to do a simulation of a vawt using UDF with "Fluent" but i have some problem. I want that the blades move only with the wind velocity.
When i use a dynamic mesh, i have the message" negative volume" in "unsteady solver" but in "steady" i have solution.

Someone can help me. i send also the picture of my study

my udf:
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())
/* get the thread pointer for which this motion is defined */
t = DT_THREAD(dt);
/* compute pressure force on body by looping through all faces */
force = 0.0;
force += F_P(f,t) * NV_MAG(A);
/* compute change in velocity, i.e., dv = F * dt / mass
velocity update using explicit Euler formula */
dv = dtime * force / 50.0;
v_prev += dv;
Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev,
/* set x-component of velocity */
vel[0] = v_prev;

dmoroian December 15, 2013 12:46

You need to study more
Hello Famangs,
I don't know what a "vawt" is, so I looked at your picture, and it seems that you have a rotating part and a static part separated by an interface. I presume that you want to move only the rotor by rotating it around an axis. The rotation will be given by a resultant pressure force.
According to my view, these are the errors that you made:
1. The force should be vectorial not scalar. The summation you do, should be accurate only for a plannar surface.
2. You need to modify angular velocity (omega), not translational velocity, otherwise your rotating part will go out of its axis.

These errors are mostly conceptual, so I would advise you to ask for help from your supervisor, or study more.

famangs December 16, 2013 05:30

Hello, dmoroian,
thanks for your reply, it's the first time that i use the udf. I have a lot of difficulty with it. VAWT means vertical axis wind turbine

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