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

Question about using Macro F_FLUX(f,t)

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

Like Tree2Likes
  • 1 Post By vinerm
  • 1 Post By vinerm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 25, 2020, 03:55
Default Question about using Macro F_FLUX(f,t)
  #1
New Member
 
Kaazem
Join Date: Jul 2018
Posts: 7
Rep Power: 3
Kaazem_RA is on a distinguished road
Hello everybody,
I want to implement an equation (governing equation of flow in porous media) which is very similar to Navier-Stokes equation, in ansys fluent. I have attached a photo of the equation. As can be seen from the photo i need to change the convective term. In fact the convective term is multiplied by a constant (1/phi^2 phi is porosity). I think the appropriate macro is F_FLUX(f,t) and i also wrote UDF to do that however after compiling the UDF i receive fatal signal (segmentation fault). Below is the UDF i have developed. It would be highly appreciate if anyone helps me to fix this problem.

#include "udf.h"
#include "mem.h"
#include "math.h"
DEFINE_ADJUST(set_convective_flux, d)
{
real porosity = 0.95;
Thread *t;
cell_t c;
face_t f;
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
thread_loop_f(t,d)
{
begin_f_loop(f,t)
{
F_FLUX(f,t) = F_FLUX(f,t)/(porosity*porosity);
}
end_f_loop(t, d)
}
}
end_c_loop(c,t)
}
}
Attached Images
File Type: png equation.png (5.0 KB, 3 views)
Kaazem_RA is offline   Reply With Quote

Old   June 25, 2020, 04:06
Default Loop
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,948
Blog Entries: 1
Rep Power: 31
vinerm will become famous soon enough
That's because you are using two loops. You don't need two outermost loops. Just thread_loop_f and begin_f_loop.

However, there are other problems with the code. You can looping over all the boundaries, while F_FLUX exists only for openings, such as, inlet, outlet, etc.
Kaazem_RA likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 25, 2020, 05:21
Default
  #3
New Member
 
Kaazem
Join Date: Jul 2018
Posts: 7
Rep Power: 3
Kaazem_RA is on a distinguished road
Quote:
Originally Posted by vinerm View Post
That's because you are using two loops. You don't need two outermost loops. Just thread_loop_f and begin_f_loop.

However, there are other problems with the code. You can looping over all the boundaries, while F_FLUX exists only for openings, such as, inlet, outlet, etc.
Thank you very much for your reply. I removed the outermost loops in the code and i successfully ran the simulation. You said that "F_FLUX(f,t) exists only for openings". It means that i do not correctly implement the equation. right? I think there is no other macro that returns convective flux through all faces (internal and external). Do you have any suggestion on implementing the equation?
Kaazem_RA is offline   Reply With Quote

Old   June 25, 2020, 05:54
Default F_flux
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,948
Blog Entries: 1
Rep Power: 31
vinerm will become famous soon enough
The function exists irrespective of the condition. What I meant is that the fluxes will have a non-zero value only for the openings. Of course, you wouldn't expect fluxes for the walls or symmetry. Periodic conditions on the other hand will have fluxes and so does the interior. But, it would still be better to call this function only on openings.
Kaazem_RA likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 25, 2020, 11:03
Default
  #5
New Member
 
Kaazem
Join Date: Jul 2018
Posts: 7
Rep Power: 3
Kaazem_RA is on a distinguished road
You're right. The fluxes will have a non-zero value only for the openings but i think convective flux of each internal face is not zero. That's why i loop over all faces(internal and external) to change convective flux to implement the equation. I guess this is the only way to manipulate convective terms of Navier-Stokes equations in ansys fluent.
Kaazem_RA 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
Macro Heat Exchanger not selecting (Please help!) zdeth FLUENT 2 September 11, 2012 13:52
Run macro for Multiple file furione STAR-CCM+ 6 November 28, 2011 14:54
Macro Problem!!! eRzBeNgEl STAR-CCM+ 3 August 9, 2011 02:04
Movie Macro in Tecplot TedBrogan Tecplot 2 February 4, 2011 10:59
Macro problem cfddummy Siemens 1 April 9, 2007 12:37


All times are GMT -4. The time now is 00:15.