# UDF for Initial Velocity Condition at Some Nodes

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Search this Thread Display Modes
 March 26, 2018, 18:01 UDF for Initial Velocity Condition at Some Nodes #1 Member   Emre Join Date: Nov 2015 Location: Izmir, Turkey Posts: 94 Rep Power: 6 Hello, I want to create a vortex in a simple 2d mesh that is constrained with wall boundary conditions. Here is what I mean: vorticity.PNG As you see, there are some nodes (actually cell centers) with proper u and v velocities for initial condition. At this point I have looked in UDF Manual, found DEFINE_INIT macro which is shown below: Code: ```#include "udf.h" DEFINE_INIT(my_init_func,d) { cell_t c; Thread *t; real xc[ND_ND]; /* loop over all cell threads in the domain */ thread_loop_c(t,d) { /* loop over all cells */ begin_c_loop_all(c,t) { C_CENTROID(xc,c,t); if (sqrt(ND_SUM(pow(xc[0] - 0.5,2.), pow(xc[1] - 0.5,2.), pow(xc[2] - 0.5,2.))) < 0.25) C_T(c,t) = 400.; else C_T(c,t) = 300.; } end_c_loop_all(c,t) } }``` How can I modify this for myself ? There are 4 initial velocities near the center of the square. Let say square is 1 m^2 and u = v = 0.15 m/s

 March 27, 2018, 10:24 #2 Senior Member   Join Date: Nov 2013 Posts: 1,451 Rep Power: 20 I don't understand what you are exactly asking... The answer to your literal question is "use a text editor, delete the text that you want to remove and add the text that you want to add, then recompile it and use it in the normal way". I am 99% sure this is not what you mean, but I don't like to guess at what it really is that you are asking.

March 27, 2018, 15:38
#3
Member

Emre
Join Date: Nov 2015
Location: Izmir, Turkey
Posts: 94
Rep Power: 6
Thank you for your attention.

Quote:
 I want to create a vortex in a simple 2d mesh that is constrained with wall boundary conditions.
Consider a square is filled with fluid. It is constrained with walls. There is no influx or efflux. It is inviscid flow. But there is a vortex in the middle of the geometric centre as initial condition. To create vortex, I assume 4 nodes have velocities.
vorticity - Copy.PNG
So how can I solve my case with this initial condition(Source term in Navier-Stokes Eq.) ? My guess is hooking UDF into Fluent. But how ? Manual didn't help me.

 March 28, 2018, 10:02 #4 Senior Member   Join Date: Nov 2013 Posts: 1,451 Rep Power: 20 Fluent tells you how to hook a UDF in Fluent... I guess your problem is that you don't know what to put in the UDF. Well, you started with a suitable example in the manual. This example changes temperature based on location. You want to change velocity based on location. So, change that. By the way: I think that if you do it this way, your final solution will be that the fluid is standing still, because all the initial kinetic energy will dissipate. So you will not see any vortex. You should take a step back and think about what it is that you want to simulate.

 March 28, 2018, 18:06 #5 Member   Emre Join Date: Nov 2015 Location: Izmir, Turkey Posts: 94 Rep Power: 6 Now I understand. But even it changes temperatures there is no velocity changing tutorial/example. Beside that my flow is inviscid. It is supposed to conserve its energy. Because there is no shear stress near the walls. Am I wrong?

 March 29, 2018, 03:38 #6 Senior Member   Join Date: Nov 2013 Posts: 1,451 Rep Power: 20 If it is inviscid, it might work, except for possibly some numerical dissipation. You found a tutorial for changing temperature, but you want to change velocity. Solution: change everything related to temperature to its corresponding velocity counterpart.

 Tags initial condition, udf, velocity, vortex, vortex creation

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 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 OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post NLao FLUENT 3 September 2, 2019 00:33 gzamiri@gmail.com FLUENT 0 September 27, 2015 05:32 everest20 FLUENT 1 July 13, 2015 08:35 gandesk Fluent UDF and Scheme Programming 14 October 29, 2012 13:58 johnGo Fluent UDF and Scheme Programming 1 January 4, 2011 21:45

All times are GMT -4. The time now is 20:33.

 Contact Us - CFD Online - Privacy Statement - Top