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

Why are the derivatives of a UDS strange at boundaries?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 20, 2016, 07:39
Default Why are the derivatives of a UDS strange at boundaries?
  #1
New Member
 
Hugo
Join Date: Feb 2016
Posts: 3
Rep Power: 10
scien is on a distinguished road
Hi,
When I calculate the derivatives of a UDS, the result is very strange at boundaries. I used C_UDSI_G.
The values are correct inside the domain though.

I have tested this with a very simple case.
If I set the value of UDS as a constant, the derivative should be zero but at boundary it has some values.
Even though they are very small values, they can affect other calculations when they become denominator.

Why does this happen? Is there any solution for this?
scien is offline   Reply With Quote

Old   June 28, 2016, 05:35
Default
  #2
New Member
 
J. David
Join Date: May 2013
Posts: 10
Rep Power: 12
jc2006 is on a distinguished road
I have found the similar problem too. Maybe you can calculate the gradient by your code
jc2006 is offline   Reply With Quote

Old   June 28, 2016, 06:05
Default
  #3
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 12
Bruno Machado is on a distinguished road
This is a bug of Fluent. I contacted their support and it was reported to the programmers team. What you can do to decrease the effect of it is to set that if the cell is in the boundary, the gradient is equal to 0.

The following code is the one I used in my problem to set it as 0, might help you guys.

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);
	
anode_diffusion_shadow_id = RP_Get_Integer("fuel-cell/anode-diffusion-shadow-id");
cathode_diffusion_shadow_id = RP_Get_Integer("fuel-cell/cathode-diffusion-shadow-id");



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

/* Loop over all faces on wall */

t = Lookup_Thread(d,anode_diffusion_shadow_id);
	
	begin_f_loop(f,t)
	{
	c0 = F_C0(f, t);
	t0 = THREAD_T0(t);
	
		C_UDMI(c0,t0,elec_x) = 0.0;
		C_UDMI(c0,t0,elec_y) = 0.0;
		C_UDMI(c0,t0,elec_z) = 0.0;
	}
	end_f_loop(f,t)

	
t = Lookup_Thread(d,cathode_diffusion_shadow_id);

	begin_f_loop(f,t)
	{
	c1 = F_C1(f,t);
	t1 = THREAD_T1(t);
	
		C_UDMI(c1,t1,elec_x) = 0.0;
		C_UDMI(c1,t1,elec_y) = 0.0;
		C_UDMI(c1,t1,elec_z) = 0.0;
}
end_f_loop(f,t)
}
Bruno Machado is offline   Reply With Quote

Old   June 28, 2016, 08:10
Default
  #4
New Member
 
Hugo
Join Date: Feb 2016
Posts: 3
Rep Power: 10
scien is on a distinguished road
Thanks, David.
I would like to do it but I am not so good at programming.
Could you let me know it if you don't mind?

Also Thanks for your code, Machado. But I have to use the gradient on boundaries and I can't set it as 0.
Thanks anyway.
scien is offline   Reply With Quote

Old   June 28, 2016, 09:28
Default
  #5
New Member
 
J. David
Join Date: May 2013
Posts: 10
Rep Power: 12
jc2006 is on a distinguished road
Hi Machado
I think, maybe one can calculate the gradient of UDS by the information of the two adjacent cell on boundary. I find that you are modeling fuel cell, and I am doing the similar work too. Hope we can have more communication in the future
jc2006 is offline   Reply With Quote

Old   June 28, 2016, 09:34
Default
  #6
New Member
 
J. David
Join Date: May 2013
Posts: 10
Rep Power: 12
jc2006 is on a distinguished road
Hi Hugo
In my case, the gradient of UDS is directly calculated by (C_UDSI(c0,t0,i)-C_UDSI(c1,t1,i))/(X(1)-X(0))(take x-direction for example).
jc2006 is offline   Reply With Quote

Old   June 28, 2016, 09:48
Default
  #7
New Member
 
Hugo
Join Date: Feb 2016
Posts: 3
Rep Power: 10
scien is on a distinguished road
Hi David.
I will apply it though I am a little worried about how I can modify it on the boundary.
Thanks again.
scien 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
Strange temperature changes around boundaries zhouyulun FLUENT 0 June 30, 2014 08:18
Strange boundaries for k and epsilon henning OpenFOAM Running, Solving & CFD 4 January 7, 2009 03:54
Strange boundaries for k and epsilon henning OpenFOAM Running, Solving & CFD 0 December 16, 2008 09:42
UDS flux and boundaries Kasper Skriver FLUENT 0 April 18, 2006 09:36
UDS transport: strange results Ale FLUENT 1 November 6, 2003 07:28


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