< Back

Determining number of Cells in an Unblanked region

To determine the number of cells in an unblanked region, follow these steps:

  1. Define your region of interest by selecting Plot > Blanking > Value Blanking… to bring up the Value Blanking dialog to set your criteria. Anything that is blanked will be excluded in the following calculation.
  2. Once you have set your blanking criteria accordingly, generate the variable Cell Volume via the Analyze>Calculate Variables… menu and selecting it from the Calculate dialog that appears.
  3. Define a new variable from Data>Alter>Specify Equations… that is the inverse of the Cell Volume:
    {invCellVolume}=1/({Cell Volume})
  4. Select Analyze>Perform Integration… and perform a Scalar Integral on {invCellVolume} by Zones over Cells for your selected Zones, toggle Exclude Blanked Regions to be on and select Integrate. The resulting value will be the number of cells within the unblanked region defined earlier.

To accomplish the same via macro:

#!MC 1410
#This macro will output a scalar integration result as a text box that is the number of cells within a pre-defined unblanked region
$!VarSet |VOL_VAR| = (|NUMVARS| + 1)
$!VarSet |ZONE_P| = 0
INSTRUCTIONS = “Please enter Zone(s) to analyze. Separate multiple Zones with commas (,) or use hyphens (-) to select a group of Zones.”
COMMAND = ‘Calculate Function=\’CELLVOLUME\’ Normalization=\’None\’ ValueLocation=\’CellCentered\’ CalculateOnDemand=\’F\’ UseMorePointsForFEGradientCalculations=\’F\”
EQUATION = ‘v|VOL_VAR| = 1/{Cell Volume}’
COMMAND = ‘Integrate [|ZONE_P|] VariableOption=\’Scalar\’ XOrigin=0 YOrigin=0 ZOrigin=0 ScalarVar=|VOL_VAR| Absolute=\’F\’ ExcludeBlanked=\’T\’ XVariable=1 YVariable=2 ZVariable=3 IntegrateOver=\’Cells\’ IntegrateBy=\’Zones\’ IRange={MIN =1 MAX = 0 SKIP = 1} JRange={MIN =1 MAX = 0 SKIP = 1} KRange={MIN =1 MAX = 0 SKIP = 1} PlotResults=\’F\’ PlotAs=\’Result\’ TimeMin=0 TimeMax=0′
COMMAND = ‘AttachIntegrationResults’