CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [General] Bug? Chaining CellSize and IntegrateVariables filters leads to wrong integration (https://www.cfd-online.com/Forums/paraview/237806-bug-chaining-cellsize-integratevariables-filters-leads-wrong-integration.html)

Allan Olesen August 5, 2021 12:06

Bug? Chaining CellSize and IntegrateVariables filters leads to wrong integration
 
Hi, my first post here. I have a feeling that this is a bug, but I would like some input from more experienced Paraview users.

Basically, my problem is that the IntegrateVariables filter will sometimes ignore the DivideCellDataByVolume setting for a single value. Always only one value. Always the value, whose name is last in the alphabetic sort order. And only if there is a CellSize filter in the pipeline with area calculation enabled.

The image below shows the result of integrating three variables named DENSITY, result1 and result2, with DivideCellDataByVolume disabled. The integration result for the three variables is the same, as it should be, because the contents of all three variable arrays are the same. (DENSITY comes from my input file, and the two other variables are created with two Calculator filters, both referring to the DENSITY variable.)

https://i.ibb.co/6bBnN4T/05-08-2021-16-39-34.png

The next image shows the result of a similar integration, now with DivideCellDataByVolume enabled. And now, only the results for DENSITY and _result1 are correct, while the result for _result2 is unaffected by the DivideCellDataByVolume setting.

https://i.ibb.co/C87StWF/05-08-2021-16-40-13.png


After a lot of troubleshooting and experimentation, it looks like it will only happen in some very specific circumstances:
  1. This always happens to the variable, whose name is last in the alphabetic sort order. If I rename the two calculated variables to Cesult1 and Cesult2, they will be fine - but now the DENSITY variable will have the problem.
  2. This only happens if there is a CellSize filter in the pipeline. And the CellSize filter output does not need to be part of the calculation to trigger the problem.
  3. If I disable the Compute Area setting in the Cell Size filter, the problem goes away.
  4. If I then re-enable the Compute Area setting, the problem will not reappear (until when...?).

The full calculation pipeline is shown as a Python export below. The input file is a CFD case from Fluent, which I unfortunately can't share. This pipeline extracts one fluid block from an output with multiple blocks, slices through it to create a 2D object, calculates cell areas with the CellSize filter and then adds the Calculator and IntegrateVariables filters mentioned above.

Code:

# state file generated using paraview version 5.9.1

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# ----------------------------------------------------------------
# setup the data processing pipelines
# ----------------------------------------------------------------

# create a new 'VisItFluentReader'
reader = VisItFluentReader(registrationName='reader', FileName=['C:\\tmp\\haeundae_lp1\\2052192_haeundae_LP1_ad_ver03.cas'])
reader.MeshStatus = ['Mesh']
reader.CellArrayStatus = ['DENSITY']

# create a new 'Extract Block'
extractBlock1 = ExtractBlock(registrationName='ExtractBlock1', Input=reader)
extractBlock1.BlockIndices = [3]

# create a new 'Slice'
slice1 = Slice(registrationName='Slice1', Input=extractBlock1)
slice1.SliceType = 'Plane'
slice1.HyperTreeGridSlicer = 'Plane'
slice1.SliceOffsetValues = [0.0]

# init the 'Plane' selected for 'SliceType'
slice1.SliceType.Origin = [2.199999942444265, 5.349999904632568, 0.0]
slice1.SliceType.Normal = [0.0, 1.0, 0.0]

# init the 'Plane' selected for 'HyperTreeGridSlicer'
slice1.HyperTreeGridSlicer.Origin = [2.199999942444265, 5.349999904632568, 0.0]

# create a new 'Cell Size'
cellSize1 = CellSize(registrationName='CellSize1', Input=slice1)
cellSize1.ComputeVertexCount = 0
cellSize1.ComputeLength = 0
cellSize1.ComputeVolume = 0

# create a new 'Calculator'
calculator1 = Calculator(registrationName='Calculator1', Input=cellSize1)
calculator1.AttributeType = 'Cell Data'
calculator1.ResultArrayName = '_result1'
calculator1.Function = '1.0 * DENSITY'

# create a new 'Calculator'
calculator2 = Calculator(registrationName='Calculator2', Input=calculator1)
calculator2.AttributeType = 'Cell Data'
calculator2.ResultArrayName = 'result2'
calculator2.Function = '1.0 * DENSITY'

# create a new 'Integrate Variables'
integrateVariables_divide_disabled = IntegrateVariables(registrationName='IntegrateVariables_divide_disabled', Input=calculator2)

# create a new 'Integrate Variables'
integrateVariables_divide_enabled = IntegrateVariables(registrationName='IntegrateVariables_divide_enabled', Input=calculator2)
integrateVariables_divide_enabled.DivideCellDataByVolume = 1

# ----------------------------------------------------------------
# restore active source
SetActiveSource(integrateVariables_divide_disabled)
# ----------------------------------------------------------------


if __name__ == '__main__':
    # generate extracts
    SaveExtracts(ExtractsOutputDirectory='extracts')



All times are GMT -4. The time now is 07:13.