# Simcenter STAR-CCM+ How to calculate and visualize multiple Surface- or Mass Flow Averages using Histograms

2022-08-05T14:44:23.000-0400
Simcenter STAR-CCM+ Simcenter STAR-CCM+ Virtual Reality Teamcenter Share Simcenter Cloud HPC Simcenter STAR-CCM+ Viewer Simcenter STAR-CCM+ Application Specific Solutions

## Summary

You need to create distributions for surface averaged values and want to visualize the result? Check out this methodology! It gives you a way to create many mass flow average, surface standard deviation, volume average, minima and maximum at once.

## Details

 Attachments: SA_MFA_SSD_MIN_MAX.sim (40 MB)

This FAQ describes a methodology for cases where creating a surface average or mass flow average report for every entity is not practical.
Maybe you need to calculate the mass flow on many different surfaces, and you want to export the values as .csv file?
Or you want to plot the distribution of the mass flow summed up in one direction?

How to calculate and visualize multiple Sums using Histograms and Heatmaps

Background:
A Histogram splits the input into equally sized chunks, called bins.
The binning is defined by a Field Function (FF) in STAR-CCM+. The standard behavior would simply count the elements in each bin, analogous to the element count report. The elements counted could be cells or faces (... or particles).
for each bin: 1
In Simcenter STAR-CCM+ you have the option to add a weighting, though. This changes each bin into a sum of a field function (FF), just like the sum report.
for each bin: FF
To calculate the surface or mass flow average two sums must be calculated. One in the denominator and another in the numerator. We simply use two histogram tables to calculate each sum.
for each bin: Mass Flow Average (MFA) FF*mfn / ∑mfn ; Surface Average (SA): FF*An / ∑A; Volume Average (SA): FF*Vn / ∑Vn
Equivalently the surface standard deviation can be calculated using: sqrt(∑pow(FF - FFSA, 2)/ ∑An)

Example:
Let's take a mini example, the file is attached. A gas flow from left to right with some restriction holes. The pressure drop is our main concern. Therefore, we want to measure the sectional averaged total pressure.
A section plane with 100 multiples is created as shown below - these will be used to calculate the surface and mass flow average.

In the following plot you can see the total pressure distribution over the X-Position with various evaluations.
In small black squares the actual range on one plane sections is shown. Red and blue squares mark the maximum and minimum values. The surface and mass flow averaged total pressure distribution is shown in green and magenta respectively. At last, the surface standard deviation is shown in grey.

Below, a scene with the total pressure is shown. In the lower right-hand side, you can also find the vertical mass flow distribution on the plane marked in magenta.

How-To:
To create these distributions easily you want to copy some objects from the attached template.

1. First, create the part on which the calculation should be executed. You may use a plane section with multiples, as in the example.
2. Open the template as read only to not use a license.
3. Under 'Custom Trees' open the relevant tree for your application, this lists all the objects you need from top to bottom. Here is a list of the available evaluations:
•  MFA SA SSD sum  minMax VA
mass flow averagesurface averagesurface standard deviationsumminimum/ maximumvolume average
4. Copy the 'inputParts' filter and paste it into Tools > Filters in your simulation.
• Make sure the filter points to the part created in step 1.
5. Copy all the Field Functions at once into Tools > Field Functions.
• Make sure the descriptions of the binFunction and evalFunction point to the correct functions.
6. Copy all the Histogram Tables at once into Tools > Tables.
• Make sure the Tables are extracted before continuing. First extract the 'binned ...' table.
7. At last copy the plot into your simulation. This is only an example plot. You can use the histogram table in other plots. The table can be auto extracted and exported.
8. There is also the equally named field function which interpolates the table values and can be used in scenes and plots.

SummaryDetails

### Associated Components

Design Manager Electronics Cooling In-Cylinder (STAR-ICE) Job Manager Simcenter STAR-CCM+