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

How do I access a specific phase thread in multiphase?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 16, 2016, 14:16
Default How do I access a specific phase thread in multiphase?
  #1
New Member
 
Elin
Join Date: Feb 2016
Posts: 3
Rep Power: 2
tengteng is on a distinguished road
Hi!

I'm trying to access my phase-1 in a multiphase simulation. As it's written now, I get segmentation error. And I have allocated extra memory, so my guess is that I'm doing something wrong when I try to get the phase thread. I would be very grateful if someone could tell me what I'm doing wrong. The code is the following:

#define fluid_zone_ID 2

DEFINE_SOURCE(Stirrer_Fx_source_to_mom_x_eqn, c_x, thread_x, dS, eqn)
{
real source_x = 0.0;
real current_time;
real f_0_magn,f_0_times_v,v_trav_wave;

int phase_index = 2; /* Phase id in fluent */
/* The row that I think is wrong!!!*/
Thread *melt_sub_thread = THREAD_SUB_THREAD(thread_x,phase_index);

current_time = CURRENT_TIME;


/* Force compensation in moving fluid is:
f_i = f_0_i*(1-(f_0*v)/(|f_0|*v_trav_wave)) =
f_0_i*(1-(sum(f_0_j*v_j))/(sqrt(sum(f_0_j^2))*(2*tau*f))) */

/* Magnitude of stirring force at zero velocity */
f_0_magn = sqrt(pow(C_UDMI(c_x,thread_x,FORCE_X_STORAGE),2.0) +pow(C_UDMI(c_x,thread_x,FORCE_Y_STORAGE),2.0)+pow (C_UDMI(c_x,thread_x,FORCE_Z_STORAGE),2.0));
/* Scalar product of stirring force and velocity, f_0*v */
f_0_times_v = C_UDMI(c_x,thread_x,FORCE_X_STORAGE)*C_U(c_x,melt_ sub_thread)+C_UDMI(c_x,thread_x,FORCE_Y_STORAGE)*C _V(c_x,melt_sub_thread)+C_UDMI(c_x,thread_x,FORCE_ Z_STORAGE)*C_W(c_x,melt_sub_thread);
/* Travelling wave speed */
v_trav_wave = 2.0*tau*freq;

/* Complete source term S [N/m^3] to momentum equation */
source_x = C_UDMI(c_x,thread_x,FORCE_X_STORAGE)*
(1.0-f_0_times_v/(f_0_magn*v_trav_wave));
/* Source term derivative wrt dependent variable, dS/du_i */
dS[eqn]= -pow(C_UDMI(c_x,thread_x,FORCE_X_STORAGE),2.0)/
(f_0_magn*v_trav_wave);


C_UDMI(c_x,thread_x,APPLIED_FORCE_X_STORAGE)=sourc e_x;
return source_x;
}

/Elin
tengteng is offline   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
Problems to loop one phase in multiphase using UDF(Solid+fluid zones, three phases) songpen1985 Fluent UDF and Scheme Programming 1 March 14, 2015 20:42
Simulating a Paper Filter in Multiphase: How to Make Impassable by Secondary Phase? VT_Bromley FLUENT 0 February 24, 2011 00:27
Two-Phase Buoyant Flow Issue Miguel Baritto CFX 4 August 31, 2006 12:02
Specific AV in Multiphase Jeff CFX 1 March 15, 2005 14:03
compressible two phase flow in CFX4.4 youngan CFX 0 July 1, 2003 23:32


All times are GMT -4. The time now is 23:12.