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

UDF, using DEFINE_ADJUST to change a boundary condition

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 6, 2000, 11:11
Default UDF, using DEFINE_ADJUST to change a boundary condition
  #1
Jonas Larsson
Guest
 
Posts: n/a
I'm computing a highly swirling 2D axisymmetric flow. The geometry is very complicated and during startup it is impossible to avoid getting backflow in a couple of the pressure outlets. When this happens the backflow will have zero swirl when it comes into the domain. This is very bad since all fluid in the domain has a very high swirl and the result is exploding turbulence and a higly viscous pocket of backflow that never dissapears, even if you set vacuum on the pressure outlet.

In order to solve this I'm trying to write a UDF to specify a backflow swirl on pressure outlets. I think that it should be possible to use the DEFINE_ADJUST function to do this. However, I have not got any examples of a similar usage of this function and the documentation isn't very helpful. What I'd like to do is simply to speicify the swirl velocity in the cells next to backflow-regions on pressure outlets. Anyone have any examples of how DEFINE_ADJUST is used? I'd appreciate any hints.
  Reply With Quote

Old   March 7, 2000, 01:40
Default Re: UDF, using DEFINE_ADJUST to change a boundary condition
  #2
Greg Perkins
Guest
 
Posts: n/a
Here's two possibilities:-

1.

Presumably you know the spatial position of the cells that you wish to fix the velocity in. In this case, you can use C_CENTROID within a thread & cell loop to find out the location of the current cell, and then if its in the region you're interested in set the fixed velocity otherwise do nothing.

Within the DEFINE_ADJUST function I'd adapt the UDF example 5.5 (p84) of the December 1998 Fluent UDF manual on Solution Initization to do what I've described above.

2.

Use DEFINE_SOURCE function which modifies the appropriate transport eqn to fix the velocities of the cells you're interested in. In the UDF manual see example 5.2.3 . I've used something like this before with no problems. This might be better than 1.

Regards

Greg
  Reply With Quote

Old   March 8, 2000, 18:47
Default Re: UDF, using DEFINE_ADJUST to change a boundary condition
  #3
Andrew Ooi
Guest
 
Posts: n/a
I am just wondering if you have tried to obtain an initial solution by first setting the swirl component to zero. Then slowly increase the swirl at the inlet (and getting a converged solution each time) to the desired value.
  Reply With Quote

Old   March 9, 2000, 03:42
Default Re: UDF, using DEFINE_ADJUST to change a boundary condition
  #4
Jonas Larsson
Guest
 
Posts: n/a
Yes, I've tried to ramp things up slowly. This helps and you can avoid problems in some outlets by doing like this. However, if you just happen to get one-single cell with back-flow once you have the full swirl up then you have to start all over again ... so it isn't very practical. Somehow specifying a back-flow swirl would help a lot.
  Reply With Quote

Old   March 21, 2000, 19:51
Default Re: UDF, using DEFINE_ADJUST to change a boundary condition
  #5
Sung-Eun Kim
Guest
 
Posts: n/a
Jonas, Honestly, I can't hide my skepticism about what you're trying to do. But in the spirit of "customer's always right", here's a little piece of code you can try. It's obviously a silly example (5 % of the swirl at adjacent interior cell). And I'm not quite sure whether this will work or not, because it seems the swirl is updated on the boundary before the derivative calculation, with 0 for pressure outlet.

DEFINE_ADJUST(set_nonzero_swirl, domain) { Thread *t; face_t f; real whatever_swirl;

if (!Data_Valid_P())

return; /* error check*/

thread_loop_f (t,domain)

switch (THREAD_TYPE(t))

{

case THREAD_F_WALL:

case THREAD_F_VINLET:

case THREAD_F_INTERIOR:

break;

case THREAD_F_POUTLET:

{

begin_f_loop (f, t)

{

c0 = F_C0(f, t); /* adjacent interior cell */

t0 = t->t0; /* adjacent interior thread */

whatever_swirl = C_WSWIRL(c0,t0)*0.05;

if (F_FLUX(f,t) < 0.0) /* if backflow occurs */

F_STORAGE_R(f,t,SV_W) = whatever_swirl;

}

end_f_loop (f, t)

} }
  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 setting wall boundary condition with a DEFINE_PROFILE NLao FLUENT 3 September 2, 2019 01:33
UDF for 3rd Kind Boundary Condition Ismail FLUENT 2 October 26, 2015 02:57
UDF for inhomogenous Neumann boundary condition akhilesh Fluent UDF and Scheme Programming 3 December 24, 2012 12:14
inlet velocity boundary condition murali CFX 5 August 3, 2012 09:56
UDF hook on the WALL boundary condition Luke FLUENT 0 June 7, 2006 12:54


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