|
[Sponsors] |
UDF for Initial Velocity Condition at Some Nodes |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 26, 2018, 19:01 |
UDF for Initial Velocity Condition at Some Nodes
|
#1 |
Member
Emre
Join Date: Nov 2015
Location: Izmir, Turkey
Posts: 97
Rep Power: 11 |
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) } } |
|
March 27, 2018, 11:24 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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, 16:38 |
|
#3 | |
Member
Emre
Join Date: Nov 2015
Location: Izmir, Turkey
Posts: 97
Rep Power: 11 |
Thank you for your attention.
Quote:
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, 11:02 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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, 19:06 |
|
#5 |
Member
Emre
Join Date: Nov 2015
Location: Izmir, Turkey
Posts: 97
Rep Power: 11 |
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, 04:38 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF setting wall boundary condition with a DEFINE_PROFILE | NLao | FLUENT | 3 | September 2, 2019 01:33 |
UDF fluent:Change boundary condition. determination inlet and outlet boundary in "t" | gzamiri@gmail.com | FLUENT | 0 | September 27, 2015 06:32 |
VELOCITY vs VELOCITY IN STN FRAME vs RELATIVE VELOCITY | everest20 | FLUENT | 1 | July 13, 2015 09:35 |
help with UDF for contact angle based on contact line velocity | gandesk | Fluent UDF and Scheme Programming | 14 | October 29, 2012 14:58 |
3D UDF Paraboilc Velocity Profile with max velocity | johnGo | Fluent UDF and Scheme Programming | 1 | January 4, 2011 22:45 |