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

How to calculate cell area??

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 22, 2018, 06:15
Unhappy How to calculate cell area??
  #1
New Member
 
sat_fire's Avatar
 
Satyam
Join Date: Jun 2017
Posts: 7
Rep Power: 8
sat_fire is on a distinguished road
Hi Everyone,
I am writing UDF for Energy source term in axis-symmetric case which is varying for every cell in the zone thread.I need to multiply area of that cell to corresponding cell energy source term.
please tell me how can I find Area for each cell in axis symmetric case ?
sat_fire is offline   Reply With Quote

Old   September 9, 2021, 23:04
Default
  #2
New Member
 
Amitav tikadar
Join Date: Jul 2017
Location: Atlanta
Posts: 14
Rep Power: 8
ATIKADAR is on a distinguished road
Hi. I am just wondering did you figure out how to get each cell surface area? I also need to calculate each cell surface area to apply an energy source term.

TIA
ATIKADAR is offline   Reply With Quote

Old   September 13, 2021, 01:58
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
look for macro
Code:
 F_AREA(A,f,t);
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   September 14, 2021, 03:40
Default
  #4
New Member
 
Amitav tikadar
Join Date: Jul 2017
Location: Atlanta
Posts: 14
Rep Power: 8
ATIKADAR is on a distinguished road
Thanks for the reply.

I have tried F_AREA(A,f,t) to calculate each cell surface area inside DEFINE_SOURCE macro and got an error. It seems like DEFINE_SOURCE macro is for cell whereas F_AREA(A,f,t) is for face. Should I need to use any face loop inside DEFINE_SOURCE macro to get each cell surface area?

My intended source term is like = Surface_area_of_cell * T_cell / Cell_volume
ATIKADAR is offline   Reply With Quote

Old   September 14, 2021, 07:37
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
I have no idea, what exactly you need.
this code make a loop over faces of each boundary and calculates source according to your condition for the first row of cells adjusted to that boundaries

Code:
#include "udf.h"

DEFINE_ADJUST(my_adjust,d)
{
	cell_t c0;
	Thread *t,*t0;
	face_t f;
	real A[ND_ND],source;

	thread_loop_f(t,d)
	{
		begin_f_loop(f,t)
		{
			if (BOUNDARY_FACE_THREAD_P(t))
			{
				c0 = F_C0(f,t);
				t0 = THREAD_T0(t);
				F_AREA(A, f, t);
				source = A*C_T(c0,t0)/C_VOLUME(c0,t0);
				C_UDMI(c0,t0,0) = source;
			}
		}
		end_f_loop(f,t)
	}
}

DEFINE_SOURCE(my_source,c,t)
{
	return C_UDMI(c,t,0);
}
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   September 14, 2021, 13:59
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
It makes no sense to use the cell surface area in your source, because it is mesh dependent. Your source would depend on the mesh, a finer mesh gives a higher source.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   September 14, 2021, 14:09
Default
  #7
New Member
 
Amitav tikadar
Join Date: Jul 2017
Location: Atlanta
Posts: 14
Rep Power: 8
ATIKADAR is on a distinguished road
Thanks for raising an important question that I didn't consider before. My source term is spatial cell temperature dependent via 'Source = h * A * T' equation. Is there any way I can avoid cell surface area in the source term since temperature would be different in each cell?
ATIKADAR is offline   Reply With Quote

Old   September 14, 2021, 14:15
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Which psysical equation for source are you trying to model? The psysical equation should only have physical things, like temperature, material properties, physical lengths... Not mesh sizes, they are not physical.

(i don't understand your worry about different temperatures, there is nothing problematic about that.)
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   September 14, 2021, 14:25
Default
  #9
New Member
 
Amitav tikadar
Join Date: Jul 2017
Location: Atlanta
Posts: 14
Rep Power: 8
ATIKADAR is on a distinguished road
I am trying to model only the Energy equation. So, I should use the total surface area of the domain (that is a known geometrical parameter) instead of the cell surface area (which is a mesh-dependent quantity)?
ATIKADAR is offline   Reply With Quote

Old   September 15, 2021, 01:29
Default
  #10
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
That is not what I mean.

You have a source. Describe that source with a physical equation. Until you do that, I have no idea if and how the source relates to an area. There are millions of ways to define a source, I have no idea which source is present in your problem.

Source has units W/m3, so give me something that has units W/m3.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk 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
How to calculate free-surface area in a computational cell cfdstar Fluent UDF and Scheme Programming 6 July 12, 2018 13:24
How to get face or cell a area in a DEFINE_SOURCE? KiteKathy FLUENT 0 March 22, 2017 06:26
How to use "translation" in solidBodyMotionFunction in OpenFOAM rupesh_w OpenFOAM Running, Solving & CFD 5 August 16, 2016 04:27
Storing Surface Area of each cell in a file? Markus Alzon FLUENT 0 June 21, 2007 08:38
Warning 097- AB Siemens 6 November 15, 2004 04:41


All times are GMT -4. The time now is 11:01.