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

UDF for Initial Velocity Condition at Some Nodes

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2018, 18:01
Question UDF for Initial Velocity Condition at Some Nodes
  #1
Member
 
Emre
Join Date: Nov 2015
Location: Izmir, Turkey
Posts: 97
Rep Power: 10
ordinary is on a distinguished road
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
ordinary is offline   Reply With Quote

Old   March 27, 2018, 10:24
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   March 27, 2018, 15:38
Default
  #3
Member
 
Emre
Join Date: Nov 2015
Location: Izmir, Turkey
Posts: 97
Rep Power: 10
ordinary is on a distinguished road
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.
ordinary is offline   Reply With Quote

Old   March 28, 2018, 10:02
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   March 28, 2018, 18:06
Default
  #5
Member
 
Emre
Join Date: Nov 2015
Location: Izmir, Turkey
Posts: 97
Rep Power: 10
ordinary is on a distinguished road
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?
ordinary is offline   Reply With Quote

Old   March 29, 2018, 03:38
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Reply

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


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 setting wall boundary condition with a DEFINE_PROFILE NLao FLUENT 3 September 2, 2019 00:33
UDF fluent:Change boundary condition. determination inlet and outlet boundary in "t" gzamiri@gmail.com FLUENT 0 September 27, 2015 05:32
VELOCITY vs VELOCITY IN STN FRAME vs RELATIVE VELOCITY everest20 FLUENT 1 July 13, 2015 08:35
help with UDF for contact angle based on contact line velocity gandesk Fluent UDF and Scheme Programming 14 October 29, 2012 13:58
3D UDF Paraboilc Velocity Profile with max velocity johnGo Fluent UDF and Scheme Programming 1 January 4, 2011 21:45


All times are GMT -4. The time now is 15:59.