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

UDF to modify the value of a user defined scalar

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   December 11, 2000, 17:07
Default UDF to modify the value of a user defined scalar
  #1
Raja Banerjee
Guest
 
Posts: n/a
Hi, I have a two-phase flow between two parallel plates. I am using VOF model to simulate the flow. I have introduced a user defined scalar and trying to assign a value to the scalar at the interface. I am finding the interface by determining the cells which have the liquid volume fraction between 0 and 1. I am using DEFINE_ADJUST macro as I want it to be done every iteration. But it is not assigning the scalar value at the interface. I am provding here the code which I have written:

#include "udf.h" #include "sg_mphase.h"

DEFINE_ADJUST(vol_frac_find, domain) {

Thread *t=Lookup_Thread(domain,8);

cell_t c;

begin_c_loop(c,t)

{

if(C_VOF(c,t,1)>0. && C_VOF(c,t,1)<1.)

C_UDSI(c,t,0)=0.0228;

}

end_c_loop(c,t);

}

I would appreciate, if someone can point out my mistake.

The id that I have used in the Lookup_Thread function corresponds to the zone- default-interior in the boundary conditions dialog-box.

Thanks Raja Banerjee

  Reply With Quote

Old   December 11, 2000, 18:06
Default Re: UDF to modify the value of a user defined scal
  #2
Greg Perkins
Guest
 
Posts: n/a
Try

DEFINE_ADJUST(find_vof, domain) {

cell_t c;

Thread *thread;

thread_loop_c (thread, domain)

{

begin_c_loop (c, thread)

{

if(C_VOF(c,thread,1)>0. && C_VOF(c,thread,1)<1.)

C_UDSI(c,thread,0)=0.0228;

}

end_c_loop (c, thread)

}

}
  Reply With Quote

Old   December 12, 2000, 00:52
Default Re: UDF to modify the value of a user defined scal
  #3
Raja Banerjee
Guest
 
Posts: n/a
Thanks for your advice. But, the value that is being assigned is still not correct. The interface value seem to increase from zero to the maximum value as we go downstream. This should not happen because as can be seen from the code that the interface value is a constant and is not related to the distance in the downstream direction.

I would appreciate if have any suggestion for this behaviour. Raja
  Reply With Quote

Old   December 12, 2000, 01:14
Default Re: UDF to modify the value of a user defined scal
  #4
Greg Perkins
Guest
 
Posts: n/a
One point is - what are you doing with the scalar transport equation (0) which you use for assigning C_UDSI(c,t,0) = value ??

If you just want to use this as storage for this value you should turn off solution of the UDS from the GUI (see manual to deselect solving the eqn - I think its in solution - controls - etc.). Alternatively in Fluent 5.4 you can use a memory location C_UDMI(c,t,0) instead which is more efficient than using a scalar transport eqn as a storage location - see udf manual for 5.4.

Greg
  Reply With Quote

Old   December 12, 2000, 10:42
Default Re: UDF to modify the value of a user defined scal
  #5
Raja Banerjee
Guest
 
Posts: n/a
Well the idea of this whole excercise is that I am trying to determine the concentration of an evaporating liquid. As VOF does not support evaporation, I am introducing this scalar equation which is basically the species equation of the evaporating vapour. At the gas/liquid interface the mass fraction of the vapour corresponds to the saturated value, which is a function of vapour pressure. The diffusivity of the vapour inside the liquid is zero and a constant value in the gas phase.

Therefore the algorithm that I am trying to implement is:

1. Determine the interface i.e. 0<vol. frac <1 2. Assign saturated mass fraction at the interface, i.e C_UDSI(c,t,0) 3. Solve the scalar equation for the concentration profile over the liquid surface.

Therefore, I need to solve the scalar equation. Thanks Raja
  Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Two questions on Fluent UDF Steven Fluent UDF and Scheme Programming 4 September 20, 2013 16:30
OpenFOAM static build on Cray XT5 asaijo OpenFOAM Installation 9 April 6, 2011 12:21
solving passive scalar by user function in AVLFIRE huyp Main CFD Forum 0 September 4, 2008 10:21
User Defined Scalar (UDS) question (units) D FLUENT 0 March 1, 2006 20:04
User Scalar B/C Greg Perkins FLUENT 5 April 5, 2001 22:29


All times are GMT -4. The time now is 19:58.