View Issue Details

IDProjectCategoryView StatusLast Update
0003598OpenFOAMFeaturepublic2020-11-24 17:13
Reporterpeksa Assigned Tohenry  
Status resolvedResolutionfixed 
PlatformLinuxOSCentosOS Version7
Fixed in Versiondev 
Summary0003598: distanceSurface -based sampling not implementing zones
DescriptionI noticed that zoneKey_ is created in constructor of "distanceSurface.C" but it is not updated anywhere, yielding no action when "zone" keyword is used in sampledSurface dictionary entry.

I'd imagine one could implement the zoneKey_ treatment similar to other xSurface methods?

Best regards,

TagsNo tags attached.



2020-11-23 19:49

manager   ~0011745

> I'd imagine one could implement the zoneKey_ treatment similar to other xSurface methods?

Probably, have you tried?


2020-11-23 19:53

reporter   ~0011746

Not yet, just noticed this and decided to report first. I'll give it a go.


2020-11-23 21:17

manager   ~0011748

Do you need it?


2020-11-23 22:23

reporter   ~0011749

When using distanceSurface together with e.g. searchableCylinder object with an ambition to sample data only on the cylinder side, you will get the top / bottom cylinder discs included as well as expected from the searchableCylinder implementation, which biases e.g. areaAverage etc. functionObject results. I was hoping to achieve separation between top/bottom discs and side surface by defining cell-zones such that discs wouldn't be sampled.

Of course one option is to modify the searchable-objects but they seem more difficult and brittle pieces of code compared to zone modification.


2020-11-24 14:22

reporter   ~0011751


As an attachment you find an implementation for which I added zone-capability following the approach used in "sampledCuttingPlane" class. I tested it for my particular case at hand and it worked as intended.

Best regard,

distanceSurface.tar.gz (5,029 bytes)


2020-11-24 15:32

manager   ~0011754

One of the constructors is commented-out, is there a reason for that?


2020-11-24 16:32

manager   ~0011756

commit a00831687097d0c19d1ca431cfd7e68dee3fc265 (HEAD -> master, origin/master, origin/HEAD)
Author: Henry Weller <>
Date: Tue Nov 24 16:25:47 2020 +0000

    sampledSurface::distanceSurface: Added zone support using zoneKey
    combining functionality from sampledCuttingPlane and sampledPlane.
    Updated sampledCuttingPlane to use zoneKey.

I think it would be best if the zone sub-setting were abstracted so that it can be applied to the other sampledSurfaces, in particular sampledIsoSurface, without further code duplication.

I do not have any test cases setup for these changes, please let me know if they work correctly.


2020-11-24 16:57

manager   ~0011757

Even better would be to rewrite the iso-surface algorithm on which the sampledCuttingPlane and distanceSurface are based to operate directly on a cell-set to avoid the inefficient mesh sub-setting.


2020-11-24 17:03

reporter   ~0011758


Tested your implementation and it works as intended with my present case (unfortunately can't share it publicly).

Regarding the other constructor, I had left it commented by accident because didn't see it being used and wanted to minimize changes on my first implementation. I tested your implementation by adding the the second constructor as it was earlier, and expectedly, it still compiles and works as intended.

Thanks for the work!

Issue History

Date Modified Username Field Change
2020-11-23 19:30 peksa New Issue
2020-11-23 19:49 henry Note Added: 0011745
2020-11-23 19:53 peksa Note Added: 0011746
2020-11-23 21:17 henry Note Added: 0011748
2020-11-23 22:23 peksa Note Added: 0011749
2020-11-24 14:22 peksa File Added: distanceSurface.tar.gz
2020-11-24 14:22 peksa Note Added: 0011751
2020-11-24 15:32 henry Note Added: 0011754
2020-11-24 16:32 henry Note Added: 0011756
2020-11-24 16:57 henry Note Added: 0011757
2020-11-24 17:03 peksa Note Added: 0011758
2020-11-24 17:12 henry Assigned To => henry
2020-11-24 17:12 henry Status new => resolved
2020-11-24 17:12 henry Resolution open => fixed
2020-11-24 17:12 henry Fixed in Version => dev
2020-11-24 17:13 henry Category Bug => Feature