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

UDF for modifying density of mixture phase during the calculating process

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 11, 2016, 04:38
Default UDF for modifying density of mixture phase during the calculating process
  #1
New Member
 
Meng Liu
Join Date: Sep 2015
Posts: 14
Rep Power: 11
sola86 is on a distinguished road
I‘m dealing with a problem about multiphase flow. I want to modify the density of mixture phase during the calculating process. But the UDF doesn't work. Did anyone ever try to modify flow variables by UDF? Here is my UDF.

Code:
/* domain pointer that is passed by adjust function is mixture domain */ 
DEFINE_ADJUST(adjust_fcn,mixture_domain)
{
	int phase_domain_index;
	real rhoW, rhoV, VFv;
	cell_t cell;
	Thread *M_t; /*define mixture phase thread */
	Thread *w_t; /*define the primary phase thread */
	Thread *v_t; /*define the secondary phase thread */
	Domain *subdomain;
	
	/* loop over all subdomains (phases) in the superdomain (mixture) */
    sub_domain_loop(subdomain, mixture_domain, phase_domain_index)
    {
		if (DOMAIN_ID(subdomain) == 2)
      /* loop over all cell threads in the primary phase domain */
		thread_loop_c (w_t,subdomain)
		{
      /* loop over all cells in primary phase cell threads */
			begin_c_loop_all (cell,w_t)
			{
				rhoW=C_R(cell,w_t); /* density of water */
			}
			end_c_loop_all (cell,w_t)
		}
	  /* loop if secondary phase */
		else if (DOMAIN_ID(subdomain) == 3)
      /* loop over all cell threads in the secondary phase domain */
		thread_loop_c (v_t,subdomain)
		{
      /* loop over all cells in secondary phase cell threads */
			begin_c_loop_all (cell,v_t)
			{
      /* set volume fraction of vapor */
				VFv=C_VOF(cell,v_t);
				rhoV=C_R(cell,v_t); /* density of vapor */
			}
			end_c_loop_all (cell,v_t)
		}	
	}
	/* loop over all cell threads in the Mixture phase domain */
	thread_loop_c (M_t,mixture_domain)
	{
    /* loop over all cells in Mixture phase cell threads */
		begin_c_loop_all (cell,M_t)
		{
			C_R(cell,M_t)=VFv*rhoV+(1-VFv)*rhoW; /* density of mixture */
		}
		end_c_loop_all (cell,M_t)
	}
 }
sola86 is offline   Reply With Quote

Old   May 25, 2019, 06:50
Default
  #2
New Member
 
Join Date: May 2019
Posts: 1
Rep Power: 0
zahra-m is on a distinguished road
hi,
I want to consider in the mixture model ,the thermal conductivity depend on temperature, but I'm having trouble writing the code as well as applying it to the fluent. Is your problem solved? If possible, contact me via email.
faezeh0012.m@gmail.com
zahra-m is offline   Reply With Quote

Old   May 28, 2019, 10:24
Default
  #3
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 12
obscureed is on a distinguished road
Hi Zahra-M,


Maybe it's not obvious, but temperature-dependent conductivity is a *lot* easier than multiphase-dependent density. If you want a UDF for it, please go and look at DEFINE_PROPERTY.


In most instances (unless you will be tweaking the parameters repeatedly), I would recommend simply setting up a piecewise-linear list, instead of a UDF.


Oh, and sola86's approach (back in 2016) was not a recommended one. If you sneak user-defined values into the solution variables, the solver will either overwrite them or get confused, or both. To adjust the solution, tell Fluent how to adjust it, using user-defined properties and source terms.


Good luck!
Ed
obscureed 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
Mixture Model and operating density RodriguezFatz FLUENT 5 February 20, 2019 03:16
Volume fraction UDF in mixture model wawa Fluent UDF and Scheme Programming 4 April 3, 2013 13:14
Accessing phase volm fraction in UDF for a source term in mixture model aditya.pandare Fluent UDF and Scheme Programming 9 March 21, 2013 00:38
Gravity, UDF Source & Operating Density. HELP ME! Brian FLUENT 0 November 1, 2005 16:17
compressible two phase flow in CFX4.4 youngan CFX 0 July 2, 2003 00:32


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