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

modify volume fraction

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 26, 2003, 22:11
Default modify volume fraction
  #1
kevin chu
Guest
 
Posts: n/a
Hi, Everyone,

In Eulerian-Eulerian multiphase model in Fluent, I want to modify the value of volume fraction of the primary or second phase while the solver is iterating.

Cloud someone tell me what should I do? Can I use UDF or any other ways?

The Macro C_VOF(c, pt[n])can get the value of volume fraction from the Fluent solver but I cannot modify the value and then return it to the solver. Is it?

The macro DEFINE_PROFILE can only set the value of volume fraction in boudary! It cannot set the value to the whole fluid domain! Is it?

Thank you very much for your kind reply in advance!

Best regards, kevin
  Reply With Quote

Old   October 27, 2003, 06:34
Default Re: modify volume fraction
  #2
ap
Guest
 
Posts: n/a
If you want to modify the volume fractions of your phases at every iteration, you can use DEFINE_ADJUST, calling it in the Functions Hooks panel.

To set values in the whole domain, you should use a loop.

Here's an example of the structure your function should have:


DEFINE_ADJUST(name, domain)
{
Thread **pt;
Thread *thread;

// Define here your variables

mp_thread_loop_c(thread, domain, pt)
{
cell_t cell;

begin_c_loop_int(cell, thread)
{
//Put here your commands
}
end_c_loop_int(cell, thread)
}
}


All macros in FLUENT can be used both to read and to write a value, so you can use C_VOF(cell,pt[n]) to change volume fractions as follows:

C_VOF(cell,pt[n]) = your value;

Hi

ap
  Reply With Quote

Old   October 27, 2003, 20:56
Default Re: modify volume fraction
  #3
kevin chu
Guest
 
Posts: n/a
Dear ap,

I really appreciate your help. But I still have some trouble:

1. It seems to me that I can only access the variales in the mixture-level domain but not the individual phase domain. In Fluent documentation, I read the following text: For multiphase flows, the domain pointer that is passed to the function by the solver is the mixture-level domain pointer. A DEFINE_ADJUST function does not return a value to the solver.

2. I have tried to use: DEFINE_EXCHANGE_PROPERTY(custom_drag, cell, mix_thread, s_col, f_col) #include "udf.h" #include "stdio.h"

#define pi 4.*atan(1.) #define diam2 3.e-4

DEFINE_EXCHANGE_PROPERTY(custom_drag, cell, mix_thread, s_col, f_col) {

...... p_vof=&C_VOF(cell, thread_g);

*p_vof=0.3;

/*C_VOF(cell, thread_g)=0.2;*/

}

fprintf(ofp,"%11.8lf\n", C_VOF(cell, thread_g)); fclose(ofp); return k_g_s; }

By using the macro above, I can write the drag coefficient, but I have not writen C_VOF(cell, thread_g). Maybe it is a wrong place to write. Do you think so?

Thank you very much,

Best Regards, kevin
  Reply With Quote

Old   November 11, 2003, 06:48
Default Re: modify volume fraction
  #4
ap
Guest
 
Posts: n/a
If your goal is to change the volume fraction of a phase during iteration, you can't use DEFINE_EXCHANGE_PROPERTY.

The easiest way is to use DEFINE_ADJUST as I showed you in my first answer:


DEFINE_ADJUST(name, domain)
{
Thread **pt;
Thread *thread;

// Define here your variables

mp_thread_loop_c(thread, domain, pt)
{
cell_t cell;

begin_c_loop_int(cell, thread)
{
//Put here your commands
C_VOF(cell, pt[0]) = your_value_for_primary_phase;
C_VOF(cell, pt[1]) = your_value_for_1st_sec_phase;
//...
}
end_c_loop_int(cell, thread)
}
}



In order to access the volume fraction of the first (primary) phase you have to use:

C_VOF(cell, pt[0])

If you have to access to the second phase, use

C_VOF(cell, pt[1])

So, in general use C_VOF(cell, pt[n]), where n = 0 for the primary phase, n=1 for the first secondary phase, n = 2 for the second secondary phase and so on.

FLUENT manual tells the macro DEFINE_ADJUST doesn't return a value to the solver. This doesn't mean you can't modify variables inside it, but just that DEFINE_ADJUST has been defined as a void function.

Hi

P.S. Sorry for the late answer.

ap
  Reply With Quote

Old   November 11, 2003, 19:23
Default Re: modify volume fraction
  #5
kevin
Guest
 
Posts: n/a
Hey, Dear ap,

I have tried with your valuable sugguestion. It works!

Thank you very much. I really highly appreciate your help.

kevin
  Reply With Quote

Old   November 12, 2003, 11:38
Default Re: modify volume fraction
  #6
ap
Guest
 
Posts: n/a
My pleasure, Kevin.

ap
  Reply With Quote

Old   April 19, 2011, 06:32
Exclamation Define_adjust
  #7
akm
New Member
 
Join Date: Jan 2010
Location: Netherlands
Posts: 28
Rep Power: 16
akm is on a distinguished road
hello ap.. please help me

as i understand define_adjust can be "used to adjust or modify FLUENT
variables that are not passed as arguments".
in my 3phase eularian simulation i am required to modify the volume fractions of the two secondary phases, keeping the volume of primary phase same.

i have done the calculation as required in define_execute_at_end, to compute how much do the volume fractions change and hence correctly computed the value of global variables 'vf1' and 'vfpr'.

my adjust macro:

Code:
DEFINE_ADJUST(mt,d)
{
  Thread *t;
  cell_t c;
  real volf1, volf2, volf3;
  real xc[ND_ND];

  if (counter == 1)
  {
    thread_loop_c(t,d)
    {
      begin_c_loop(c,t)
      {
         Thread *fr = THREAD_SUB_THREAD(t,1);  //1st secondary phase
	 Thread *to = THREAD_SUB_THREAD(t,2); //2nd secondary phase
	  volf1 = C_VOF(c,fr);
	  volf2 = C_VOF(c,to);
	  volf3 = 1-(volf1+volf2);  //primary phase volume frac.

	  if(volf1 > 0.01)
	  {
	    C_VOF(c,fr) = volf1 * vf1/vfpr;  //modifying the vol.fr. of 1st sec. phase
	    volf1 = C_VOF(c,fr);
	    C_VOF(c,to) = 1-(volf1+volf3);  //adjusting the vol. fr. of 2nd sec. phase, keeping the sum of volume fractions unity.
	    volf1 = C_VOF(c,fr);
	    volf2 = C_VOF(c,to);

	    C_CENTROID(xc,c,t);
	    Message("%g\t%g",xc[0],xc[1]);
	    Message("\t%g   %g\n",volf1,volf2);
	  }
      }
      end_c_loop(c,t)
    }	
  }

}
When the variables are printed from the udf, they do seem to get modified as required by the problem. But returning to solver at the end of iteration/timestep, the variables show no change when viewed as contours or even when accessed by define_execute_at_end macro.

What might be the problem in modifying the variables ??
Is there anything wrong in what i am trying to do? Please suggest an alternative.

Can anyone please help me..

Regards
akm is offline   Reply With Quote

Old   May 20, 2011, 04:35
Default
  #8
New Member
 
M. A.
Join Date: Jul 2010
Posts: 27
Rep Power: 16
motahar is on a distinguished road
Hi friends,
I'm simulating a tube with water flow.
The tube encounters boiling near the wall.
I intend to calculate 'void fraction versus enthalpy' along the channel.
Can you help me how to calculate void fraction?

I'm in an emergency condition.
Waiting for your comments!!!

Thanks Everybody
motahar is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 07:09
alphaEqn.H in twoPhaseEulerFoam cheng1988sjtu OpenFOAM Bugs 15 May 1, 2016 17:12
On the damBreak4phaseFine cases paean OpenFOAM Running, Solving & CFD 0 November 14, 2008 22:14
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


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