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

Gradient 0 at the interface of two fluid zones

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 23, 2016, 07:52
Default Gradient 0 at the interface of two fluid zones
  #1
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Hello guys,

I will explain my problem first and subsequently ask you a question. I have 2 fluid zones, called zone 1 and 2. At the zone 1, I am solving the UDS-0. Nevertheless, this UDS-0 is not solved at the zone 2. The problem I face is that the one of my energy source terms (ohmic heating) considers the gradient of UDS-0 in its calculation. So at the interface, Fluent picks the value of UDS-0 at the cell in zone 1 and solves the gradient to the cell in zone 2 (which is 0 since this UDS is not solved there). Thus, it ends up giving me a value that has no physical meaning, leading to extremely high temperatures.

I wrote this piece of code to define the gradient at the interface as 0 and solve it everywhere else as it should be.

Code:
DEFINE_EXECUTE_AT_END(gradient_zero_boundary)
{
Domain *d;
face_t f;
cell_t c, c0, c1;
Thread *t, *t0, *ct, *t1; 
d = Get_Domain(1);


/* Initialise Cells */
thread_loop_c(ct, d)
{
	begin_c_loop(c,ct)
	{
		C_UDMI(c,ct,SOLID_PHASE_CURRENT_DENSITY_X) = C_UDSI_G(c,ct,ELEC_POT)[0];
		C_UDMI(c,ct,SOLID_PHASE_CURRENT_DENSITY_Y) = C_UDSI_G(c,ct,ELEC_POT)[1];
		C_UDMI(c,ct,SOLID_PHASE_CURRENT_DENSITY_Z) = C_UDSI_G(c,ct,ELEC_POT)[2];
	}
	end_c_loop(c,ct)
}

/* Loop over all faces on wall */

t = Lookup_Thread(d,33);
	
	begin_f_loop(f,t)
	{
	c0 = F_C0(f, t);
	t0 = THREAD_T0(t);
	
		C_UDMI(c0,t0,SOLID_PHASE_CURRENT_DENSITY_X) = 0.0;
		C_UDMI(c0,t0,SOLID_PHASE_CURRENT_DENSITY_Y) = 0.0;
		C_UDMI(c0,t0,SOLID_PHASE_CURRENT_DENSITY_Z) = 0.0;
	}
	end_f_loop(f,t)

	
t = Lookup_Thread(d,34);

	begin_f_loop(f,t)
	{
	c1 = F_C1(f,t);
	t1 = THREAD_T1(t);
	
		C_UDMI(c1,t1,SOLID_PHASE_CURRENT_DENSITY_X) = 0.0;
		C_UDMI(c1,t1,SOLID_PHASE_CURRENT_DENSITY_Y) = 0.0;
		C_UDMI(c1,t1,SOLID_PHASE_CURRENT_DENSITY_Z) = 0.0;
}
end_f_loop(f,t)
}
The problem is that since it is 2 fluid zones, there is no boundary condition between them (even after naming the surface of interest - remains as interior). Here comes my question. How can I identify the cells at the interface to define them as 0? In this piece of code, I tried to give the thread value of the zone, but it did not work. Any suggestions?

Thank you in advance for any helpful comment.
Bruno Machado is offline   Reply With Quote

Old   September 23, 2016, 08:35
Default
  #2
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Well, I found one way of doing it. The code works fine. Just had to name the interface I wanted to define the variable as 0 and input its ID in the code before provided.

I contacted Ansys in the past and they said this is a bug and they would correct it for the new versions. not sure they did it on 16/17 versions.
Bruno Machado is offline   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
Wind turbine simulation Saturn CFX 60 July 17, 2024 06:45
Coupled interface in between solid and fluid zones oozcan FLUENT 0 August 2, 2016 07:12
Overflow Error in Multiphase Modelling with Two Continuous Fluids ashtonJ CFX 6 August 11, 2014 15:32
Grid interface between zones of different size agustinvo FLUENT 2 July 24, 2013 10:21
how to use fluid fluid interface Beno CFX 0 July 13, 2005 15:08


All times are GMT -4. The time now is 22:08.