From 4668d0e88655668ed0020954164cd345b25cd853 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Wed, 14 May 2025 11:55:05 +0200
Subject: [PATCH] ENH: extend GeoMesh interface to include boundary_size()
 static method

- can be used to pre-allocate space for internal+boundary field for
  flat addressing (issue #3364).

  For example:

      DynamicField<Type> fld
      (
          std::pair<label,label>
          (
              GeoMesh::size(mesh),
              GeoMesh::size(mesh)
            + (extra ? GeoMesh::boundary_size(mesh) : label(0))
          )
      );

ENH: base changes for GeometricField flags

- FieldBase 'localBoundaryConsistency_' and 'localBoundaryTolerance_'
  for central handling of local boundary consistency checks.

- FieldBase 'unifiedGeometricField' for future extensions to GeometricField
---
 etc/controlDict                               |  10 +-
 src/OpenFOAM/fields/Fields/Field/Field.C      |   2 +-
 src/OpenFOAM/fields/Fields/Field/Field.H      |  34 ++++++
 src/OpenFOAM/fields/Fields/Field/FieldBase.C  | 112 +++++++++++++++++-
 src/OpenFOAM/meshes/GeoMesh/GeoMesh.H         |   7 +-
 src/OpenFOAM/meshes/pointMesh/pointMesh.H     |  18 ++-
 src/finiteArea/areaMesh/areaFaMesh.H          |  31 ++++-
 src/finiteArea/edgeMesh/edgeFaMesh.H          |  33 ++++--
 src/finiteVolume/surfaceMesh/surfaceMesh.H    |  28 +++--
 src/finiteVolume/volMesh/volMesh.H            |  31 +++--
 src/meshTools/fields/volume/polyGeoMesh.H     |  24 +++-
 .../polySurface/fields/polySurfaceGeoMesh.H   |  22 +++-
 .../fields/polySurfacePointGeoMesh.H          |  22 +++-
 src/surfMesh/surfMesh/fields/surfGeoMesh.H    |  22 +++-
 .../surfMesh/fields/surfPointGeoMesh.H        |  22 +++-
 .../triSurface/fields/triSurfaceGeoMesh.H     |  22 +++-
 .../fields/triSurfacePointGeoMesh.H           |  22 +++-
 17 files changed, 388 insertions(+), 74 deletions(-)

diff --git a/etc/controlDict b/etc/controlDict
index 74d85e59017..639c712d7ab 100644
--- a/etc/controlDict
+++ b/etc/controlDict
@@ -1,7 +1,7 @@
 /*--------------------------------*- C++ -*----------------------------------*\
 | =========                 |                                                 |
 | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  v2412                                 |
+|  \\    /   O peration     | Version:  v2506                                 |
 |   \\  /    A nd           | Website:  www.openfoam.com                      |
 |    \\/     M anipulation  |                                                 |
 \*---------------------------------------------------------------------------*/
@@ -209,6 +209,14 @@ OptimisationSwitches
     pbufs.tuning    0;
 
 
+    // ==========
+    // Allocation
+    // ==========
+
+    // GeometricField with extra capacity for flattened boundary fields.
+    unifiedGeometricField   0;
+
+
     // =====
     // Other
     // =====
diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C
index 1dd8d1be9dc..b2dab6c05f0 100644
--- a/src/OpenFOAM/fields/Fields/Field/Field.C
+++ b/src/OpenFOAM/fields/Fields/Field/Field.C
@@ -236,7 +236,7 @@ void Foam::Field<Type>::assign(const entry& e, const label len)
             // Check lengths
             if (len >= 0 && len != lenRead)
             {
-                if (len < lenRead && allowConstructFromLargerSize)
+                if (len < lenRead && FieldBase::allowConstructFromLargerSize)
                 {
                     // Truncate the data
                     this->resize(len);
diff --git a/src/OpenFOAM/fields/Fields/Field/Field.H b/src/OpenFOAM/fields/Fields/Field/Field.H
index c49292a0663..744ac9fac1f 100644
--- a/src/OpenFOAM/fields/Fields/Field/Field.H
+++ b/src/OpenFOAM/fields/Fields/Field/Field.H
@@ -91,6 +91,40 @@ public:
         //  Mostly required for things like column mesh, for example.
         static bool allowConstructFromLargerSize;
 
+        //- GeometricField with extra capacity for flattened boundary fields.
+        //- Uses opt-switch "unifiedGeometricField"
+        static bool unifiedGeometricField;
+
+        //- Local boundary field consistency checks.
+        //- Uses opt-switch "localBoundaryConsistency"
+        static int localBoundaryConsistency_;
+
+        //- Tolerance for local boundary field consistency checks.
+        //- Uses opt-switch "localBoundaryConsistency::tolerance"
+        static scalar localBoundaryTolerance_;
+
+
+    // Static Member Functions
+
+        //- Warn about keyword changes for local boundary consistency checks.
+        //  The supplied dictionary corresponds to the optimisationSwitches
+        static void warnLocalBoundaryConsistencyCompat(const dictionary&);
+
+        //- Get flag for local boundary consistency checks.
+        static int localBoundaryConsistency() noexcept
+        {
+            return localBoundaryConsistency_;
+        }
+
+        //- Set flag for local boundary consistency checks.
+        //  \return the previous value
+        static int localBoundaryConsistency(int val) noexcept
+        {
+            int old(localBoundaryConsistency_);
+            localBoundaryConsistency_ = val;
+            return old;
+        }
+
 
     // Constructors
 
diff --git a/src/OpenFOAM/fields/Fields/Field/FieldBase.C b/src/OpenFOAM/fields/Fields/Field/FieldBase.C
index fdbbb1e94b9..4b08b2638a0 100644
--- a/src/OpenFOAM/fields/Fields/Field/FieldBase.C
+++ b/src/OpenFOAM/fields/Fields/Field/FieldBase.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2018-2022 OpenCFD Ltd.
+    Copyright (C) 2018-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -26,6 +26,10 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "Field.H"
+#include "debug.H"
+#include "dictionary.H"
+#include "error.H"
+#include "registerSwitch.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -33,5 +37,111 @@ const char* const Foam::FieldBase::typeName("Field");
 
 bool Foam::FieldBase::allowConstructFromLargerSize = false;
 
+bool Foam::FieldBase::unifiedGeometricField
+(
+    Foam::debug::optimisationSwitch("unifiedGeometricField", 0)
+);
+registerOptSwitch
+(
+    "unifiedGeometricField",
+    bool,
+    Foam::FieldBase::unifiedGeometricField
+);
+
+
+int Foam::FieldBase::localBoundaryConsistency_
+(
+    Foam::debug::optimisationSwitch("localBoundaryConsistency", 1)
+);
+registerOptSwitch
+(
+    "localConsistency",
+    int,
+    Foam::FieldBase::localBoundaryConsistency_
+);
+
+
+Foam::scalar Foam::FieldBase::localBoundaryTolerance_
+(
+    Foam::debug::floatOptimisationSwitch
+    (
+        "localBoundaryConsistency::tolerance", 0
+    )
+);
+registerOptSwitch
+(
+    "localBoundaryConsistency::tolerance",
+    Foam::scalar,
+    Foam::FieldBase::localBoundaryTolerance_
+);
+
+
+// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
+
+// This is a really ugly solution, but no obvious simpler method
+
+void Foam::FieldBase::warnLocalBoundaryConsistencyCompat
+(
+    const dictionary& dict
+)
+{
+    // New: localBoundaryConsistency
+    // Old:
+    // - localConsistency
+    // - point(Vector)Field::Boundary::localConsistency
+    // - point(Spherical|Symm)?TensorField::Boundary::localConsistency
+    // - (surface|vol)(Scalar|Vector)Field::Boundary::localConsistency
+    // - (surface|vol)(Spherical|Symm)?TensorField::Boundary::localConsistency
+
+    // New: localBoundaryConsistency::tolerance
+    // Old:
+    // - (vol|surface)(Scalar|Vector)Field::Boundary::tolerance
+    // - (vol|surface)(Spherical|Symm)?TensorField::Boundary::tolerance
+
+    {
+        constexpr int version(2412);
+
+        const word flagName("localBoundaryConsistency");
+        const word tolName("localBoundaryConsistency::tolerance");
+
+        // Warn: "using " kw -> flagName;
+        const auto emitWarning =
+            [=](const std::string& oldName, const std::string& newName)
+            {
+                if (error::master())
+                {
+                    std::cerr
+                        << "--> FOAM IOWarning :" << nl
+                        << "    Found [v" << version << "] '"
+                        << oldName.c_str() << "' entry instead of '"
+                        << newName.c_str() << "'" << nl
+                        << std::endl;
+                    error::warnAboutAge("keyword", version);
+                }
+            };
+
+        for (const entry& e : dict)
+        {
+            const auto& kw = e.keyword();
+
+            if (kw.contains("Field::Boundary::"))
+            {
+                if (kw.ends_with("Field::Boundary::localConsistency"))
+                {
+                    emitWarning(kw, flagName);
+                }
+                else if (kw.ends_with("Field::Boundary::tolerance"))
+                {
+                    emitWarning(kw, tolName);
+                }
+            }
+            else if (kw == "localConsistency")
+            {
+                emitWarning(kw, flagName);
+            }
+        }
+    }
+}
+
 
 // ************************************************************************* //
diff --git a/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H b/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H
index 21f0377d1f9..9845e9dd861 100644
--- a/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H
+++ b/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H
@@ -29,10 +29,13 @@ Class
 Description
     Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
 
+    Derived classes are typically expected to implement the static methods
+    size() and boundary_size().
+
 \*---------------------------------------------------------------------------*/
 
-#ifndef GeoMesh_H
-#define GeoMesh_H
+#ifndef Foam_GeoMesh_H
+#define Foam_GeoMesh_H
 
 #include "objectRegistry.H"
 
diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.H b/src/OpenFOAM/meshes/pointMesh/pointMesh.H
index 8aaeb4f698c..0634da54366 100644
--- a/src/OpenFOAM/meshes/pointMesh/pointMesh.H
+++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.H
@@ -121,15 +121,27 @@ public:
     ~pointMesh() = default;
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of points
+        //- The geometric (internal) size - number of mesh points.
+        //  Method name expected by GeoMesh interface
         static label size(const Mesh& mesh)
         {
             return mesh.GeoMesh<polyMesh>::mesh_.nPoints();
         }
 
-        //- Return size. Number of points
+        //- The geometric boundary size - not implemented.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const Mesh& mesh)
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(*this);
diff --git a/src/finiteArea/areaMesh/areaFaMesh.H b/src/finiteArea/areaMesh/areaFaMesh.H
index 039a574c7c1..35ceba46c84 100644
--- a/src/finiteArea/areaMesh/areaFaMesh.H
+++ b/src/finiteArea/areaMesh/areaFaMesh.H
@@ -36,8 +36,8 @@ Author
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef areaFaMesh_H
-#define areaFaMesh_H
+#ifndef Foam_areaFaMesh_H
+#define Foam_areaFaMesh_H
 
 #include "GeoMesh.H"
 #include "faMesh.H"
@@ -66,13 +66,32 @@ public:
         {}
 
 
+    // Static Functions
+
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
+        static label size(const faMesh& mesh) noexcept
+        {
+            return mesh.nFaces();
+        }
+
+        //- The geometric boundary size - number of boundary edges.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const faMesh& mesh) noexcept
+        {
+            return mesh.nBoundaryEdges();
+        }
+
+
     // Member Functions
 
-        //- Return size. Number of faces
-        static label size(const Mesh& mesh) { return mesh.nFaces(); }
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
+        label size() const noexcept
+        {
+            return size(mesh_);
+        }
 
-        //- Return size. Number of faces
-        label size() const { return size(mesh_); }
 
         //- Field of face centres
         const areaVectorField& C() const { return mesh_.areaCentres(); }
diff --git a/src/finiteArea/edgeMesh/edgeFaMesh.H b/src/finiteArea/edgeMesh/edgeFaMesh.H
index 214af6a9c74..e4a298a83db 100644
--- a/src/finiteArea/edgeMesh/edgeFaMesh.H
+++ b/src/finiteArea/edgeMesh/edgeFaMesh.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2016-2017 Wikki Ltd
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -36,8 +36,8 @@ Author
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef edgeFaMesh_H
-#define edgeFaMesh_H
+#ifndef Foam_edgeFaMesh_H
+#define Foam_edgeFaMesh_H
 
 #include "GeoMesh.H"
 #include "faMesh.H"
@@ -66,13 +66,32 @@ public:
         {}
 
 
+    // Static Functions
+
+        //- The geometric (internal) size - number of internal edges.
+        //  Method name expected by GeoMesh interface
+        static label size(const faMesh& mesh) noexcept
+        {
+            return mesh.nInternalEdges();
+        }
+
+        //- The geometric boundary size - number of boundary edges.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const faMesh& mesh) noexcept
+        {
+            return mesh.nBoundaryEdges();
+        }
+
+
     // Member Functions
 
-        //- Return size. Number of internal edges
-        static label size(const Mesh& mesh) { return mesh.nInternalEdges(); }
+        //- The geometric (internal) size - number of internal edges.
+        //  Method name expected by GeoMesh interface
+        label size() const noexcept
+        {
+            return size(mesh_);
+        }
 
-        //- Return size. Number of internal edges
-        label size() const { return size(mesh_); }
 
         //- Field of edge centres
         const edgeVectorField& C() const { return mesh_.edgeCentres(); }
diff --git a/src/finiteVolume/surfaceMesh/surfaceMesh.H b/src/finiteVolume/surfaceMesh/surfaceMesh.H
index b82d2ac9822..19399a0ba9e 100644
--- a/src/finiteVolume/surfaceMesh/surfaceMesh.H
+++ b/src/finiteVolume/surfaceMesh/surfaceMesh.H
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
+    Copyright (C) 2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -31,8 +32,8 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef surfaceMesh_H
-#define surfaceMesh_H
+#ifndef Foam_surfaceMesh_H
+#define Foam_surfaceMesh_H
 
 #include "GeoMesh.H"
 #include "fvMesh.H"
@@ -62,20 +63,33 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of internal faces
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of internal faces.
+        //  Method name expected by GeoMesh interface
+        static label size(const polyMesh& mesh) noexcept
         {
             return mesh.nInternalFaces();
         }
 
-        //- Return size. Number of internal faces
-        label size() const
+        //- The geometric boundary size - number of boundary faces.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const polyMesh& mesh) noexcept
+        {
+            return mesh.nBoundaryFaces();
+        }
+
+
+    // Member Functions
+
+        //- The geometric mesh size - number of internal faces.
+        //  Method name expected by GeoMesh interface
+        label size() const noexcept
         {
             return size(mesh_);
         }
 
+
         //- Field of face centres
         const surfaceVectorField& C() const
         {
diff --git a/src/finiteVolume/volMesh/volMesh.H b/src/finiteVolume/volMesh/volMesh.H
index cde07521f37..df014a7f7e0 100644
--- a/src/finiteVolume/volMesh/volMesh.H
+++ b/src/finiteVolume/volMesh/volMesh.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021,2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -32,13 +32,12 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef volMesh_H
-#define volMesh_H
+#ifndef Foam_volMesh_H
+#define Foam_volMesh_H
 
 #include "GeoMesh.H"
 #include "fvMesh.H"
 #include "primitiveMesh.H"
-#include <type_traits>
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -57,23 +56,35 @@ public:
 
     // Constructors
 
-        //- Construct from fvMesh
+        //- Construct from fvMesh reference
         explicit volMesh(const fvMesh& mesh)
         :
             GeoMesh<fvMesh>(mesh)
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of cells
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) mesh size - number of cells.
+        //  Method name expected by GeoMesh interface
+        static label size(const polyMesh& mesh) noexcept
         {
             return mesh.nCells();
         }
 
-        //- Return size. Number of cells
-        label size() const
+        //- The geometric boundary size - number of boundary faces.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const polyMesh& mesh) noexcept
+        {
+            return mesh.nBoundaryFaces();
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) mesh size - number of cells.
+        //  Method name expected by GeoMesh interface
+        label size() const noexcept
         {
             return size(mesh_);
         }
diff --git a/src/meshTools/fields/volume/polyGeoMesh.H b/src/meshTools/fields/volume/polyGeoMesh.H
index dd7e5c483a7..42c7213272a 100644
--- a/src/meshTools/fields/volume/polyGeoMesh.H
+++ b/src/meshTools/fields/volume/polyGeoMesh.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2018-2021 OpenCFD Ltd.
+    Copyright (C) 2018-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -61,16 +61,28 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of cells
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) mesh size - number of cells.
+        //  Method name expected by GeoMesh interface
+        static label size(const polyMesh& mesh) noexcept
         {
             return mesh.nCells();
         }
 
-        //- Return size. Number of cells
-        label size() const
+        //- The geometric boundary size - not used (internal fields only).
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const polyMesh& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) mesh size - number of cells.
+        //  Method name expected by GeoMesh interface
+        label size() const noexcept
         {
             return size(mesh_);
         }
diff --git a/src/surfMesh/polySurface/fields/polySurfaceGeoMesh.H b/src/surfMesh/polySurface/fields/polySurfaceGeoMesh.H
index 9adff973152..7cdc501d4d0 100644
--- a/src/surfMesh/polySurface/fields/polySurfaceGeoMesh.H
+++ b/src/surfMesh/polySurface/fields/polySurfaceGeoMesh.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019-2021 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -61,15 +61,27 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of faces
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
+        static label size(const polySurface& mesh)
         {
             return mesh.nFaces();
         }
 
-        //- Return size. Number of faces
+        //- The geometric boundary size - not used.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const polySurface& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(mesh_);
diff --git a/src/surfMesh/polySurface/fields/polySurfacePointGeoMesh.H b/src/surfMesh/polySurface/fields/polySurfacePointGeoMesh.H
index 8ccca1e11a3..d5cd53625e9 100644
--- a/src/surfMesh/polySurface/fields/polySurfacePointGeoMesh.H
+++ b/src/surfMesh/polySurface/fields/polySurfacePointGeoMesh.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019-2021 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -61,15 +61,27 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of points
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
+        static label size(const polySurface& mesh)
         {
             return mesh.nPoints();
         }
 
-        //- Return size. Number of points
+        //- The geometric boundary size - not used.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const polySurface& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(mesh_);
diff --git a/src/surfMesh/surfMesh/fields/surfGeoMesh.H b/src/surfMesh/surfMesh/fields/surfGeoMesh.H
index 4d4dd20d876..75e94b62dd3 100644
--- a/src/surfMesh/surfMesh/fields/surfGeoMesh.H
+++ b/src/surfMesh/surfMesh/fields/surfGeoMesh.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -62,15 +62,27 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of faces
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
+        static label size(const surfMesh& mesh)
         {
             return mesh.nFaces();
         }
 
-        //- Return size. Number of faces
+        //- The geometric boundary size - not used.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const surfMesh& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(mesh_);
diff --git a/src/surfMesh/surfMesh/fields/surfPointGeoMesh.H b/src/surfMesh/surfMesh/fields/surfPointGeoMesh.H
index 6a152d3fe72..6e00f61c3b0 100644
--- a/src/surfMesh/surfMesh/fields/surfPointGeoMesh.H
+++ b/src/surfMesh/surfMesh/fields/surfPointGeoMesh.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021,2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -64,15 +64,27 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of points
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
+        static label size(const surfMesh& mesh)
         {
             return mesh.nPoints();
         }
 
-        //- Return size. Number of points
+        //- The geometric boundary size - not used.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const surfMesh& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(mesh_);
diff --git a/src/surfMesh/triSurface/fields/triSurfaceGeoMesh.H b/src/surfMesh/triSurface/fields/triSurfaceGeoMesh.H
index e2688a39f10..9cfba9d3421 100644
--- a/src/surfMesh/triSurface/fields/triSurfaceGeoMesh.H
+++ b/src/surfMesh/triSurface/fields/triSurfaceGeoMesh.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021,2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -60,15 +60,27 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Numer of faces
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
+        static label size(const triSurface& mesh)
         {
             return mesh.size();
         }
 
-        //- Return size. Numer of faces
+        //- The geometric boundary size - not used.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const triSurface& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(mesh_);
diff --git a/src/surfMesh/triSurface/fields/triSurfacePointGeoMesh.H b/src/surfMesh/triSurface/fields/triSurfacePointGeoMesh.H
index 031ff5fb56b..5ffd6fa6898 100644
--- a/src/surfMesh/triSurface/fields/triSurfacePointGeoMesh.H
+++ b/src/surfMesh/triSurface/fields/triSurfacePointGeoMesh.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021,2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -60,15 +60,27 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of points
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
+        static label size(const triSurface& mesh)
         {
             return mesh.points().size();
         }
 
-        //- Return size. Number of points
+        //- The geometric boundary size - not applicable.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const triSurface& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(mesh_);
-- 
GitLab