CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS

Volume average of a scalar?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By billwangard

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 4, 2011, 13:26
Default Volume average of a scalar?
  #1
New Member
 
Carl
Join Date: Mar 2009
Location: United Kingdom
Posts: 13
Rep Power: 17
mecarlg is on a distinguished road
Hello,

Can anybody help me with this please? I have a flow field with one volume and I want to calculate the volume averaged scalar concentration in a sub-volume.

It is easy to do for the whole volume (report->volume integrals) but how do you create a sub-volume not part of the mesh file? You can only create points, lines and surfaces in the Fluent GUI, any tricks for creating a volume?

I have released the scalar from a sub-volume using a UDF but I'm having difficulty calculating the scalar concentration in other sub-volumes. I do have other models with the volumes decomposed already but its not very efficient if you need to know a volume average somewhere else.

Any help is much appreciated.

Carlos.
mecarlg is offline   Reply With Quote

Old   January 21, 2011, 14:18
Default
  #2
Member
 
Nikolopoulos Aristeidis
Join Date: Jan 2011
Location: Athens, Greece
Posts: 62
Rep Power: 15
Nikolopoulos is on a distinguished road
There is not a simple solution to your problem.

However I do this:
- Define a User defined memory (UDM, under fluent-> define->user-defined-> Memory).
- Define as a user Field function the variable you want to average
- Patch UDM to zero for the whom volume
- Define your sub-volume in the Fluent-> Adapt-> Iso-Value or Region or Volume
- Patch the User Field function to the UDM for Registers to Patch -> (Name of volume)

Now your UDM stores the variable inside the defined volume and Zeros in the other places.

Now a Sum in the whole volume will give you the SUM in the sub-volume.
With a few calculations you can get average values.


I hope this helped.
The other way is to do it via UDF
Nikolopoulos is offline   Reply With Quote

Old   January 25, 2011, 16:25
Default Sub Volumes
  #3
New Member
 
Bill Wangard
Join Date: Jan 2011
Posts: 21
Rep Power: 0
billwangard is on a distinguished road
If your subvolume is a hex, sphere, or cylinder, you can use the adaption tool to create registers to mark the cells of your subvolume.

This is done under the Adapt->Region menu. Combine registers of spheres and cylinders to get complex shapes --- if necessary.

Once you define your registers, do NOT adapt them. Instead, go to the Grid->Separate->Cells menu.

Use the adaption register to separate the volume using the adaption register. This will split off the cells and create the sub-volume.

You can simply go to your Report->Volume integrals menu now and integrate your quantity on the newly created sub volume.

You can merge the volumes back together if necessary.

Regards,
Bill Wangard, Ph.D.
President
Engrana LLC
847-424-2486
soheil_r7 and asgaris like this.
billwangard is offline   Reply With Quote

Old   January 26, 2011, 02:30
Default
  #4
Member
 
Nikolopoulos Aristeidis
Join Date: Jan 2011
Location: Athens, Greece
Posts: 62
Rep Power: 15
Nikolopoulos is on a distinguished road
Nice billwangard!!!!!

I didn't know that!
Nikolopoulos is offline   Reply With Quote

Old   September 3, 2018, 13:50
Default
  #5
New Member
 
Lisa
Join Date: Apr 2017
Location: USA
Posts: 19
Rep Power: 9
cfd_worker99 is on a distinguished road
Hi Nikolopoulos,
Thank you for the description. Like Carlos, I am also looking into dividing a solid domain into multiple sub-volumes (between say radius 1m to 2m and 1m<z<2m) in order to get volume average temperatures. Can this be done through a UDF? I found this UDF, however, how can you help me limit the domian to a radii limits and z limits.
/************************************************** ********************
UDF to calculate temperature field function and store in
user-defined memory. Also print min, max, avg temperatures.
************************************************** *********************/
#include "udf.h"
DEFINE_ON_DEMAND(on_demand_calc)
{
Domain *d; /* declare domain pointer since it is not passed as an
argument to the DEFINE macro */
real tavg = 0.;
real tmax = 0.;
real tmin = 0.;
real temp,volume,vol_tot;
Thread *t;
cell_t c;
d = Get_Domain(1); /* Get the domain using ANSYS FLUENT utility */
/* Loop over all cell threads in the domain */
thread_loop_c(t,d)
{
/* Compute max, min, volume-averaged temperature */
/* Loop over all cells */
begin_c_loop(c,t)
{
volume = C_VOLUME(c,t); /* get cell volume */
temp = C_T(c,t); /* get cell temperature */
if (temp < tmin || tmin == 0.) tmin = temp;
if (temp > tmax || tmax == 0.) tmax = temp;
vol_tot += volume;
tavg += temp*volume;
}
end_c_loop(c,t)
tavg /= vol_tot;
printf("\n Tmin = %g Tmax = %g Tavg = %g\n",tmin,tmax,tavg);
/* Compute temperature function and store in user-defined memory*/
/*(location index 0) */
begin_c_loop(c,t)
{s
temp = C_T(c,t);
C_UDMI(c,t,0) = (temp-tmin)/(tmax-tmin);
}
end_c_loop(c,t)
}
}SS
cfd_worker99 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
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 14:06
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 15:11
On the damBreak4phaseFine cases paean OpenFOAM Running, Solving & CFD 0 November 14, 2008 22:14
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


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