A topoSetCellSource to select cells based on relation to a surface given by an external file.

surfaceToCell can select:

  • all cells inside/outside/cut by a surface
  • all cells inside/outside surface (useSurfaceOrientation, requires closed surface)
  • cells with centre nearer than XXX to surface
  • cells with centre nearer than XXX to surface and with normal at nearest point to centre and cell-corners differing by more than YYY (i.e. point of high curvature)


Operand Type Location
input triSurface $FOAM_CASE/constant/triSurface/<file>
output cellSet $FOAM_CASE/constant/polyMesh/sets/<set>


Example of the surfaceToCell topoSet by using actions sub-dictionary in system/topoSetDict file:

    // Mandatory (inherited) entries
    name        <name>;
    type        cellSet;
    action      <action>;

    // Mandatory entries
    source      surfaceToCell;
    file        <surfaceFileName>;
        (<p1x> <p1y> <p1z>)
        (<p2x> <p2y> <p2z>)
    includeCut      false;
    includeInside   false;
    includeOutside  true;
    nearDistance    0.5;
    curvature       1.0;

    // Optional entries
    useSurfaceOrientation false;
    fileType        stl;
    scale           2.0;


where the entries mean:

Property Description Type Required Default
name Name of cellSet word yes -
type Type name: cellSet word yes -
action Action applied on cells - see below word yes -
source Source name: surfaceToCell word yes -
file The surface "filename" word yes -
outsidePoints List of points that define outside of the surface vectorList yes -
includeCut Flag to include cut cells bool yes -
includeInside Flag to include inside cells bool yes -
includeOutside Flag to include outside cells bool yes -
useSurfaceOrientation Flag to use inherently the orientation of the surface bool no false
nearDistance Near distance to the surface scalar yes -
curvature Surface curvature scalar yes -
fileType The format of the surface file word no ""
scale Surface scaling factor scalar no -1

Options for the action entry:

new      | Create a new cellSet from selected cells
add      | Add selected cells into this cellSet
subtract | Remove selected cells from this cellSet

Further information


Source code:


  • Introduced in version 1.5

Would you like to suggest an improvement to this page? Create an issue

Copyright © 2020 OpenCFD Ltd.

Licensed under the Creative Commons License BY-NC-ND Creative Commons License