From 0c79a66d653cd68d52f23b6b092e551cf8e4f78d Mon Sep 17 00:00:00 2001 From: kdrienCG Date: Fri, 27 Mar 2026 09:59:36 +0100 Subject: [PATCH 01/13] add FieldSpecificationABC abstract class --- .../fieldSpecification/CMakeLists.txt | 2 + .../FieldSpecificationABC.cpp | 36 +++++++ .../FieldSpecificationABC.hpp | 99 +++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 src/coreComponents/fieldSpecification/FieldSpecificationABC.cpp create mode 100644 src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp diff --git a/src/coreComponents/fieldSpecification/CMakeLists.txt b/src/coreComponents/fieldSpecification/CMakeLists.txt index 8dc6827d664..0795623b42c 100644 --- a/src/coreComponents/fieldSpecification/CMakeLists.txt +++ b/src/coreComponents/fieldSpecification/CMakeLists.txt @@ -25,6 +25,7 @@ Contains: set( fieldSpecification_headers DirichletBoundaryCondition.hpp EquilibriumInitialCondition.hpp + FieldSpecificationABC.hpp FieldSpecificationBase.hpp FieldSpecificationManager.hpp SourceFluxBoundaryCondition.hpp @@ -39,6 +40,7 @@ set( fieldSpecification_headers set( fieldSpecification_sources DirichletBoundaryCondition.cpp EquilibriumInitialCondition.cpp + FieldSpecificationABC.cpp FieldSpecificationBase.cpp FieldSpecificationManager.cpp SourceFluxBoundaryCondition.cpp diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationABC.cpp b/src/coreComponents/fieldSpecification/FieldSpecificationABC.cpp new file mode 100644 index 00000000000..4f4b3ba3da4 --- /dev/null +++ b/src/coreComponents/fieldSpecification/FieldSpecificationABC.cpp @@ -0,0 +1,36 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 TotalEnergies + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2023-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +#include "FieldSpecificationABC.hpp" + +namespace geos +{ +using namespace dataRepository; + +FieldSpecificationABC::FieldSpecificationABC( string const & name, Group * parent ): + Group( name, parent ) +{} + +FieldSpecificationABC::~FieldSpecificationABC() +{} + +FieldSpecificationABC::CatalogInterface::CatalogType & +FieldSpecificationABC::getCatalog() +{ + static FieldSpecificationABC::CatalogInterface::CatalogType catalog; + return catalog; +} + +} \ No newline at end of file diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp new file mode 100644 index 00000000000..12dc00580d2 --- /dev/null +++ b/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp @@ -0,0 +1,99 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 TotalEnergies + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2023-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file FieldSpecificationABC.hpp + */ + +#ifndef GEOS_FIELDSPECIFICATION_FIELDSPECIFICATIONABC_HPP +#define GEOS_FIELDSPECIFICATION_FIELDSPECIFICATIONABC_HPP + + +#include "common/DataTypes.hpp" +#include "dataRepository/Group.hpp" +#include "functions/FunctionBase.hpp" +#include "functions/FunctionManager.hpp" + +namespace geos +{ +class Function; + + +/** + * @class FieldSpecificationABC + */ +class FieldSpecificationABC : public dataRepository::Group +{ +public: + + /** + * @defgroup alias and functions to defined statically initialized catalog + * @{ + */ + + /** + * alias to define the catalog type for this abstract type + */ + using CatalogInterface = dataRepository::CatalogInterface< FieldSpecificationABC, + string const &, + dataRepository::Group * const >; + + /** + * @brief static function to return static catalog. + * @return the static catalog to create derived types through the static factory methods. + */ + static CatalogInterface::CatalogType & getCatalog(); + + /** + * @} + */ + + + /** + * @brief constructor + * @param name the name of the FieldSpecificationABC in the data repository + * @param parent the parent group of this group. + */ + FieldSpecificationABC( string const & name, dataRepository::Group * parent ); + + /** + * destructor + */ + virtual ~FieldSpecificationABC() override; + + + /// Deleted copy constructor + FieldSpecificationABC( FieldSpecificationABC const & ) = delete; + + /// Defaulted move constructor + FieldSpecificationABC( FieldSpecificationABC && ) = default; + + /// deleted copy assignment + FieldSpecificationABC & operator=( FieldSpecificationABC const & ) = delete; + + /// deleted move assignement + FieldSpecificationABC & operator=( FieldSpecificationABC && ) = delete; + + /** + * @brief View keys + */ + struct viewKeyStruct + {}; + +}; + +} + +#endif //GEOS_FIELDSPECIFICATION_FIELDSPECIFICATIONABC_HPP \ No newline at end of file From f234750b67c6e97ae5f0d7ea5e16f0edeb76f4d4 Mon Sep 17 00:00:00 2001 From: kdrienCG Date: Fri, 27 Mar 2026 10:01:31 +0100 Subject: [PATCH 02/13] Move FieldSpecificationBase catalog to FieldSpecificationABC --- .../AquiferBoundaryCondition.cpp | 2 +- .../DirichletBoundaryCondition.cpp | 2 +- .../EquilibriumInitialCondition.cpp | 2 +- .../FieldSpecificationBase.cpp | 11 ++------- .../FieldSpecificationBase.hpp | 24 ++----------------- .../FieldSpecificationManager.cpp | 7 +++--- .../PerfectlyMatchedLayer.cpp | 2 +- .../SourceFluxBoundaryCondition.cpp | 2 +- .../TractionBoundaryCondition.cpp | 2 +- 9 files changed, 14 insertions(+), 40 deletions(-) diff --git a/src/coreComponents/fieldSpecification/AquiferBoundaryCondition.cpp b/src/coreComponents/fieldSpecification/AquiferBoundaryCondition.cpp index 4a9c99a7b2f..01d10959ab7 100644 --- a/src/coreComponents/fieldSpecification/AquiferBoundaryCondition.cpp +++ b/src/coreComponents/fieldSpecification/AquiferBoundaryCondition.cpp @@ -300,7 +300,7 @@ AquiferBoundaryCondition::KernelWrapper AquiferBoundaryCondition::createKernelWr pressureInfluenceFunction.createKernelWrapper() ); } -REGISTER_CATALOG_ENTRY( FieldSpecificationBase, AquiferBoundaryCondition, string const &, Group * const ) +REGISTER_CATALOG_ENTRY( FieldSpecificationABC, AquiferBoundaryCondition, string const &, Group * const ) } /* namespace geos */ diff --git a/src/coreComponents/fieldSpecification/DirichletBoundaryCondition.cpp b/src/coreComponents/fieldSpecification/DirichletBoundaryCondition.cpp index 19a62d921dd..99cfd1bbe04 100644 --- a/src/coreComponents/fieldSpecification/DirichletBoundaryCondition.cpp +++ b/src/coreComponents/fieldSpecification/DirichletBoundaryCondition.cpp @@ -37,6 +37,6 @@ DirichletBoundaryCondition::~DirichletBoundaryCondition() -REGISTER_CATALOG_ENTRY( FieldSpecificationBase, DirichletBoundaryCondition, string const &, Group * const ) +REGISTER_CATALOG_ENTRY( FieldSpecificationABC, DirichletBoundaryCondition, string const &, Group * const ) } /* namespace geos */ diff --git a/src/coreComponents/fieldSpecification/EquilibriumInitialCondition.cpp b/src/coreComponents/fieldSpecification/EquilibriumInitialCondition.cpp index 6e0f1181e6e..2d1caf3a0d1 100644 --- a/src/coreComponents/fieldSpecification/EquilibriumInitialCondition.cpp +++ b/src/coreComponents/fieldSpecification/EquilibriumInitialCondition.cpp @@ -243,7 +243,7 @@ void EquilibriumInitialCondition::initializePreSubGroups() } } -REGISTER_CATALOG_ENTRY( FieldSpecificationBase, EquilibriumInitialCondition, string const &, Group * const ) +REGISTER_CATALOG_ENTRY( FieldSpecificationABC, EquilibriumInitialCondition, string const &, Group * const ) } /* namespace geos */ diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationBase.cpp b/src/coreComponents/fieldSpecification/FieldSpecificationBase.cpp index 94e78e7e06a..fbbbce616ee 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationBase.cpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationBase.cpp @@ -22,7 +22,7 @@ namespace geos using namespace dataRepository; FieldSpecificationBase::FieldSpecificationBase( string const & name, Group * parent ): - Group( name, parent ) + FieldSpecificationABC( name, parent ) { setInputFlags( InputFlags::OPTIONAL_NONUNIQUE ); @@ -102,13 +102,6 @@ FieldSpecificationBase::FieldSpecificationBase( string const & name, Group * par FieldSpecificationBase::~FieldSpecificationBase() {} -FieldSpecificationBase::CatalogInterface::CatalogType & -FieldSpecificationBase::getCatalog() -{ - static FieldSpecificationBase::CatalogInterface::CatalogType catalog; - return catalog; -} - void FieldSpecificationBase::setMeshObjectPath( Group const & meshBodies ) @@ -131,6 +124,6 @@ void FieldSpecificationBase::setMeshObjectPath( Group const & meshBodies ) -REGISTER_CATALOG_ENTRY( FieldSpecificationBase, FieldSpecificationBase, string const &, Group * const ) +REGISTER_CATALOG_ENTRY( FieldSpecificationABC, FieldSpecificationBase, string const &, Group * const ) } diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationBase.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationBase.hpp index 1905a4e5c36..41d9b895120 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationBase.hpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationBase.hpp @@ -31,6 +31,7 @@ #include "mesh/MeshObjectPath.hpp" #include "functions/FunctionManager.hpp" #include "common/GEOS_RAJA_Interface.hpp" +#include "FieldSpecificationABC.hpp" namespace geos { @@ -41,21 +42,10 @@ class Function; * @class FieldSpecificationBase * A class to hold values for and administer a single boundary condition */ -class FieldSpecificationBase : public dataRepository::Group +class FieldSpecificationBase : public FieldSpecificationABC { public: - /** - * @defgroup alias and functions to defined statically initialized catalog - * @{ - */ - - /** - * alias to define the catalog type for this base type - */ - using CatalogInterface = dataRepository::CatalogInterface< FieldSpecificationBase, - string const &, - dataRepository::Group * const >; /** * @enum SetErrorMode * @brief Indicate the error handling mode. @@ -67,12 +57,6 @@ class FieldSpecificationBase : public dataRepository::Group warning }; - /** - * @brief static function to return static catalog. - * @return the static catalog to create derived types through the static factory methods. - */ - static CatalogInterface::CatalogType & getCatalog(); - /** * @brief Static Factory Catalog Functions * @return the catalog name @@ -88,10 +72,6 @@ class FieldSpecificationBase : public dataRepository::Group return FieldSpecificationBase::catalogName(); } - /** - * @} - */ - /** * @brief constructor diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp index 6697c275715..9c0c5af7b5b 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp @@ -14,6 +14,7 @@ */ #include "FieldSpecificationManager.hpp" +#include "FieldSpecificationABC.hpp" #include "mesh/DomainPartition.hpp" #include "mesh/MeshBody.hpp" #include "mesh/MeshObjectPath.hpp" @@ -53,8 +54,8 @@ FieldSpecificationManager & FieldSpecificationManager::getInstance() Group * FieldSpecificationManager::createChild( string const & childKey, string const & childName ) { GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) ); - std::unique_ptr< FieldSpecificationBase > bc = - FieldSpecificationBase::CatalogInterface::factory( childKey, getDataContext(), childName, this ); + std::unique_ptr< FieldSpecificationABC > bc = + FieldSpecificationABC::CatalogInterface::factory( childKey, getDataContext(), childName, this ); return &this->registerGroup( childName, std::move( bc ) ); } @@ -62,7 +63,7 @@ Group * FieldSpecificationManager::createChild( string const & childKey, string void FieldSpecificationManager::expandObjectCatalogs() { // During schema generation, register one of each type derived from BoundaryConditionBase here - for( auto & catalogIter: FieldSpecificationBase::getCatalog()) + for( auto & catalogIter: FieldSpecificationABC::getCatalog()) { createChild( catalogIter.first, catalogIter.first ); } diff --git a/src/coreComponents/fieldSpecification/PerfectlyMatchedLayer.cpp b/src/coreComponents/fieldSpecification/PerfectlyMatchedLayer.cpp index 7e71480536c..1a946c97c23 100644 --- a/src/coreComponents/fieldSpecification/PerfectlyMatchedLayer.cpp +++ b/src/coreComponents/fieldSpecification/PerfectlyMatchedLayer.cpp @@ -121,6 +121,6 @@ void PerfectlyMatchedLayer::postInputInitialization() } -REGISTER_CATALOG_ENTRY( FieldSpecificationBase, PerfectlyMatchedLayer, string const &, Group * const ) +REGISTER_CATALOG_ENTRY( FieldSpecificationABC, PerfectlyMatchedLayer, string const &, Group * const ) } /* namespace geos */ diff --git a/src/coreComponents/fieldSpecification/SourceFluxBoundaryCondition.cpp b/src/coreComponents/fieldSpecification/SourceFluxBoundaryCondition.cpp index 8a05108fe9d..0aad1e3102d 100644 --- a/src/coreComponents/fieldSpecification/SourceFluxBoundaryCondition.cpp +++ b/src/coreComponents/fieldSpecification/SourceFluxBoundaryCondition.cpp @@ -43,6 +43,6 @@ SourceFluxBoundaryCondition::SourceFluxBoundaryCondition( string const & name, G FieldSpecificationBase::viewKeyStruct::functionNameString() ) ); } -REGISTER_CATALOG_ENTRY( FieldSpecificationBase, SourceFluxBoundaryCondition, string const &, Group * const ) +REGISTER_CATALOG_ENTRY( FieldSpecificationABC, SourceFluxBoundaryCondition, string const &, Group * const ) } /* namespace geos */ diff --git a/src/coreComponents/fieldSpecification/TractionBoundaryCondition.cpp b/src/coreComponents/fieldSpecification/TractionBoundaryCondition.cpp index 49392b016f0..a66dd9f4f8f 100644 --- a/src/coreComponents/fieldSpecification/TractionBoundaryCondition.cpp +++ b/src/coreComponents/fieldSpecification/TractionBoundaryCondition.cpp @@ -437,7 +437,7 @@ void TractionBoundaryCondition::reinitScaleSet( FaceManager const & faceManager, } ); } -REGISTER_CATALOG_ENTRY( FieldSpecificationBase, TractionBoundaryCondition, string const &, Group * const ) +REGISTER_CATALOG_ENTRY( FieldSpecificationABC, TractionBoundaryCondition, string const &, Group * const ) } /* namespace geos */ From cf11e8fd2f310ef838c9d05e5b872f97ecf32d66 Mon Sep 17 00:00:00 2001 From: kdrienCG Date: Tue, 31 Mar 2026 14:43:35 +0200 Subject: [PATCH 03/13] add PermeabilitySpecification --- .../fieldSpecification/CMakeLists.txt | 2 + .../PermeabilitySpecification.cpp | 73 ++++++++ .../PermeabilitySpecification.hpp | 170 ++++++++++++++++++ 3 files changed, 245 insertions(+) create mode 100644 src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp create mode 100644 src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp diff --git a/src/coreComponents/fieldSpecification/CMakeLists.txt b/src/coreComponents/fieldSpecification/CMakeLists.txt index 0795623b42c..e6b6c94495b 100644 --- a/src/coreComponents/fieldSpecification/CMakeLists.txt +++ b/src/coreComponents/fieldSpecification/CMakeLists.txt @@ -32,6 +32,7 @@ set( fieldSpecification_headers TractionBoundaryCondition.hpp AquiferBoundaryCondition.hpp PerfectlyMatchedLayer.hpp + PermeabilitySpecification.hpp ) # @@ -47,6 +48,7 @@ set( fieldSpecification_sources TractionBoundaryCondition.cpp AquiferBoundaryCondition.cpp PerfectlyMatchedLayer.cpp + PermeabilitySpecification.cpp ) set( dependencyList ${parallelDeps} mesh ) diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp b/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp new file mode 100644 index 00000000000..96ae605ffae --- /dev/null +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp @@ -0,0 +1,73 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 TotalEnergies + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2023-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +#include "PermeabilitySpecification.hpp" + +namespace geos +{ +using namespace dataRepository; + +PermeabilitySpecification::PermeabilitySpecification( string const & name, Group * parent ): + FieldSpecificationABC( name, parent ) +{ + setInputFlags( InputFlags::OPTIONAL_NONUNIQUE ); + + registerWrapper( viewKeyStruct::setNamesString(), &m_setNames ). + setRTTypeName( rtTypes::CustomTypes::groupNameRefArray ). + setInputFlag( InputFlags::REQUIRED ). + setSizedFromParent( 0 ). + setDescription( "Names of sets that the boundary condition is applied to.\n" + "A set can contain heterogeneous elements in the mesh (volumes, nodes, faces, edges).\n" + "A set can be be defined by a 'Geometry' component, or correspond to imported sets in case of an external mesh" ); + + registerWrapper( viewKeyStruct::regionNamesString(), &m_regionNames ). + setRTTypeName( rtTypes::CustomTypes::groupNameRefArray ). + setInputFlag( InputFlags::REQUIRED ). + setDescription( "" ); + + registerWrapper( viewKeyStruct::fieldNameString(), &m_fieldName ). + setRTTypeName( rtTypes::CustomTypes::groupNameRef ). + setInputFlag( InputFlags::OPTIONAL ). + setDescription( "Name of field that boundary condition is applied to.\n" + "A field can represent a physical variable. (pressure, temperature, global composition fraction of the fluid, ...)" ); + + registerWrapper( viewKeyStruct::functionNameString(), &m_functionName ). + setRTTypeName( rtTypes::CustomTypes::groupNameRef ). + setInputFlag( InputFlags::OPTIONAL ). + setDescription( "Name of function that specifies variation of the boundary condition." ); + + registerWrapper( viewKeyStruct::scalesString(), &m_scales ). + // setApplyDefaultValue( 0.0 ). + setInputFlag( InputFlags::REQUIRED ). + setDescription( "Apply a scaling factor for the value of the boundary condition." ); +} + + +PermeabilitySpecification::~PermeabilitySpecification() +{} + + +void PermeabilitySpecification::postInputInitialization() +{ + GEOS_THROW_IF( m_scales.size() != 3, + getWrapperDataContext( viewKeyStruct::scalesString() ) << + ": expected 3 components, got " << m_scales.size(), + InputError ); +} + + +REGISTER_CATALOG_ENTRY( FieldSpecificationABC, PermeabilitySpecification, string const &, Group * const ) + +} \ No newline at end of file diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp b/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp new file mode 100644 index 00000000000..6796db78a20 --- /dev/null +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp @@ -0,0 +1,170 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 TotalEnergies + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2023-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file PermeabilitySpecification.hpp + */ + +#ifndef GEOS_FIELDSPECIFICATION_PERMEABILITYSPECIFICATION_HPP +#define GEOS_FIELDSPECIFICATION_PERMEABILITYSPECIFICATION_HPP + + +#include "common/DataTypes.hpp" +#include "mesh/ObjectManagerBase.hpp" +#include "mesh/MeshObjectPath.hpp" +#include "FieldSpecificationABC.hpp" + +namespace geos +{ + +/** + * @class PermeabilitySpecification + */ +class PermeabilitySpecification : public FieldSpecificationABC +{ +public: + + /** + * @brief Static Factory Catalog Functions + * @return the catalog name + */ + static string catalogName() { return "PermeabilitySpecification"; } + + /** + * @brief return the catalog name + * @return the catalog name + */ + virtual const string getCatalogName() const + { + return PermeabilitySpecification::catalogName(); + } + + + /** + * @brief constructor + * @param name the name of the PermeabilitySpecification in the data repository + * @param parent the parent group of this group. + */ + PermeabilitySpecification( string const & name, dataRepository::Group * parent ); + + /** + * destructor + */ + virtual ~PermeabilitySpecification() override; + + + /// Deleted copy constructor + PermeabilitySpecification( PermeabilitySpecification const & ) = delete; + + /// Defaulted move constructor + PermeabilitySpecification( PermeabilitySpecification && ) = default; + + /// deleted copy assignment + PermeabilitySpecification & operator=( PermeabilitySpecification const & ) = delete; + + /// deleted move assignement + PermeabilitySpecification & operator=( PermeabilitySpecification && ) = delete; + + /** + * @brief View keys + */ + struct viewKeyStruct + { + /// @return The key for setName + constexpr static char const * setNamesString() { return "setNames"; } + /// @return The key for regionNames + constexpr static char const * regionNamesString() { return "regionNames"; } + /// @return The key for fieldName + constexpr static char const * fieldNameString() { return "fieldName"; } + /// @return The key for functionName + constexpr static char const * functionNameString() { return "functionName"; } + /// @return The key for scales + constexpr static char const * scalesString() { return "scales"; } + }; + + /** + * Accessor + * @return const reference to m_function + */ + string const & getFunctionName() const + { + return m_functionName; + } + + /** + * Accessor + * @return const reference to m_regionNames + */ + string_array const & getRegionNames() const + { + return m_regionNames; + } + + /** + * Accessor + * @return const reference to m_fieldName + */ + virtual const string & getFieldName() const + { + return m_fieldName; + } + + /** + * Accessor + * @return const reference to m_setNames + */ + string_array const & getSetNames() const + { + return m_setNames; + } + + /** + * Accessor + * @return const m_scales + */ + arrayView1d< real64 const > getScales() const + { + return m_scales; + } + + +protected: + + virtual void postInputInitialization() override; + +private: + + + /// the names of the sets that the boundary condition is applied to + string_array m_setNames; + + /// the names of the regions that the boundary condition is applied to + string_array m_regionNames; + + /// the name of the field the boundary condition is applied to or a key string to use for + /// determining whether or not to apply the boundary condition. + string m_fieldName; + + /// The name of the function used to generate values for application. + string m_functionName; + + /// The scale factors to use on the value of the boundary condition. + array1d< real64 > m_scales; + +}; + +} + +#endif //GEOS_FIELDSPECIFICATION_PERMEABILITYSPECIFICATION_HPP \ No newline at end of file From 35d9a46bf2d5a6dd864ac01ab57ab169527989a5 Mon Sep 17 00:00:00 2001 From: kdrienCG Date: Tue, 31 Mar 2026 14:53:00 +0200 Subject: [PATCH 04/13] add FieldSpecificationFactory interface --- .../fieldSpecification/CMakeLists.txt | 1 + .../FieldSpecificationFactory.hpp | 55 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/coreComponents/fieldSpecification/FieldSpecificationFactory.hpp diff --git a/src/coreComponents/fieldSpecification/CMakeLists.txt b/src/coreComponents/fieldSpecification/CMakeLists.txt index e6b6c94495b..28994da4d14 100644 --- a/src/coreComponents/fieldSpecification/CMakeLists.txt +++ b/src/coreComponents/fieldSpecification/CMakeLists.txt @@ -27,6 +27,7 @@ set( fieldSpecification_headers EquilibriumInitialCondition.hpp FieldSpecificationABC.hpp FieldSpecificationBase.hpp + FieldSpecificationFactory.hpp FieldSpecificationManager.hpp SourceFluxBoundaryCondition.hpp TractionBoundaryCondition.hpp diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationFactory.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationFactory.hpp new file mode 100644 index 00000000000..d77841afb7d --- /dev/null +++ b/src/coreComponents/fieldSpecification/FieldSpecificationFactory.hpp @@ -0,0 +1,55 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 TotalEnergies + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2023-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file FieldSpecificationFactory.hpp + */ + +#ifndef GEOS_FIELDSPECIFICATION_FIELDSPECIFICATIONFACTORY_HPP +#define GEOS_FIELDSPECIFICATION_FIELDSPECIFICATIONFACTORY_HPP + + +#include "common/DataTypes.hpp" +#include "dataRepository/Group.hpp" +#include "FieldSpecificationABC.hpp" + +namespace geos +{ + +/** + * @class FieldSpecificationFactory + */ +class FieldSpecificationFactory +{ +public: + + /// @brief Generate FieldSpecifications based on the given "higher-level" + /// specification + /// @param specification The higher-level specification used as a blueprint + /// to create FieldSpecification + /// @param manager The parent to store the created FieldSpecifications + virtual void generate( FieldSpecificationABC const & specification, + dataRepository::Group & manager ) const = 0; + + /// @return The key that represents the element this factory is about. + /// Purpose: link the factory to the specification it uses. + virtual string const getKey() const = 0; + +}; + +} + + +#endif //GEOS_FIELDSPECIFICATION_FIELDSPECIFICATIONFACTORY_HPP \ No newline at end of file From a5ddb585bb6244e8263498a8682d8b7ca76f2c3b Mon Sep 17 00:00:00 2001 From: kdrienCG Date: Tue, 31 Mar 2026 14:55:56 +0200 Subject: [PATCH 05/13] Add PermeabilitySpecificationFactory --- .../fieldSpecification/CMakeLists.txt | 2 + .../FieldSpecificationBase.hpp | 18 +++++ .../PermeabilitySpecificationFactory.cpp | 73 +++++++++++++++++++ .../PermeabilitySpecificationFactory.hpp | 54 ++++++++++++++ 4 files changed, 147 insertions(+) create mode 100644 src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp create mode 100644 src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp diff --git a/src/coreComponents/fieldSpecification/CMakeLists.txt b/src/coreComponents/fieldSpecification/CMakeLists.txt index 28994da4d14..a2cb7bec632 100644 --- a/src/coreComponents/fieldSpecification/CMakeLists.txt +++ b/src/coreComponents/fieldSpecification/CMakeLists.txt @@ -34,6 +34,7 @@ set( fieldSpecification_headers AquiferBoundaryCondition.hpp PerfectlyMatchedLayer.hpp PermeabilitySpecification.hpp + PermeabilitySpecificationFactory.hpp ) # @@ -50,6 +51,7 @@ set( fieldSpecification_sources AquiferBoundaryCondition.cpp PerfectlyMatchedLayer.cpp PermeabilitySpecification.cpp + PermeabilitySpecificationFactory.cpp ) set( dependencyList ${parallelDeps} mesh ) diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationBase.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationBase.hpp index 41d9b895120..909731e3e33 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationBase.hpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationBase.hpp @@ -504,6 +504,24 @@ class FieldSpecificationBase : public FieldSpecificationABC m_scale = scale; } + /** + * Mutator + * @param[in] component The component index + */ + void setComponent( int component ) + { + m_component = component; + } + + /** + * Mutator + * @param[in] functionName The name of the function + */ + void setFunctionName( string const & functionName ) + { + m_functionName = functionName; + } + /** * Mutator * @param[in] isInitialCondition Logical value to indicate if it is an initial condition diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp new file mode 100644 index 00000000000..eae986ea9ae --- /dev/null +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp @@ -0,0 +1,73 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 TotalEnergies + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2023-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file PermeabilitySpecificationFactory.cpp + */ + +#include "PermeabilitySpecificationFactory.hpp" +#include "common/DataTypes.hpp" +#include "dataRepository/Group.hpp" +#include "PermeabilitySpecification.hpp" +#include "FieldSpecificationABC.hpp" +#include "FieldSpecificationBase.hpp" + +namespace geos +{ + +/** + * @class PermeabilitySpecificationFactory + */ + +void PermeabilitySpecificationFactory::generate( FieldSpecificationABC const & spec, + dataRepository::Group & manager ) const +{ + auto ps = dynamic_cast< PermeabilitySpecification const * >( &spec ); + + stdArray< string, 3 > suffixes = {{ "_x", "_y", "_z" }}; + + arrayView1d< real64 const > scales = ps->getScales(); + + for ( string const & regionName : ps->getRegionNames() ) + { + string const objectPath = "ElementRegions/" + regionName; + + for ( int comp = 0; comp < 3; ++comp ) + { + string const childName = ps->getName() + "_" + regionName + suffixes[ comp ]; + + FieldSpecificationBase & fs = manager.registerGroup< FieldSpecificationBase >( childName ); + fs.setFieldName( ps->getFieldName() ); + fs.setObjectPath( objectPath ); + fs.setScale( scales[ comp ] ); + fs.initialCondition( true ); + fs.setComponent( comp ); + + for ( auto const & setName : ps->getSetNames() ) + { + fs.addSetName( setName ); + } + + if ( !ps->getFunctionName().empty() ) + { + fs.setFunctionName( ps->getFunctionName() ); + } + + } + } + +} + +} \ No newline at end of file diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp new file mode 100644 index 00000000000..653f2b85c22 --- /dev/null +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp @@ -0,0 +1,54 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 TotalEnergies + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2023-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file PermeabilitySpecificationFactory.hpp + */ + +#ifndef GEOS_FIELDSPECIFICATION_PERMEABILITYSPECIFICATIONFACTORY_HPP +#define GEOS_FIELDSPECIFICATION_PERMEABILITYSPECIFICATIONFACTORY_HPP + + +#include "common/DataTypes.hpp" +#include "dataRepository/Group.hpp" +#include "PermeabilitySpecification.hpp" +#include "FieldSpecificationABC.hpp" +#include "FieldSpecificationBase.hpp" +#include "FieldSpecificationFactory.hpp" + +namespace geos +{ + +/** + * @class PermeabilitySpecificationFactory + */ +class PermeabilitySpecificationFactory : public FieldSpecificationFactory +{ +public: + + /// @copydoc geos::FieldSpecificationFactory::generate() + void generate( FieldSpecificationABC const & spec, + dataRepository::Group & manager ) const; + + /// @copydoc geos::FieldSpecificationFactory::getKey() + string const getKey() const + { + return PermeabilitySpecification::catalogName(); + } +}; + +} + +#endif //GEOS_FIELDSPECIFICATION_PERMEABILITYSPECIFICATIONFACTORY_HPP \ No newline at end of file From 7098e09a49e2ee84c35abada6c26352a22b71f9d Mon Sep 17 00:00:00 2001 From: kdrienCG Date: Tue, 31 Mar 2026 15:01:14 +0200 Subject: [PATCH 06/13] Add specifications factory creation logic to FieldSpecificationManager Implement methods to add factories to the manager to handle the creation of FieldSpecificationBase object via higher-level specifications (like PermeabilitySpecification) --- .../FieldSpecificationABC.hpp | 6 ++++++ .../FieldSpecificationManager.cpp | 21 +++++++++++++++++++ .../FieldSpecificationManager.hpp | 13 ++++++++++++ 3 files changed, 40 insertions(+) diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp index 12dc00580d2..5ec287c3837 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp @@ -56,6 +56,12 @@ class FieldSpecificationABC : public dataRepository::Group */ static CatalogInterface::CatalogType & getCatalog(); + /** + * @brief return the catalog name + * @return the catalog name + */ + virtual const string getCatalogName() const = 0; + /** * @} */ diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp index 9c0c5af7b5b..5c3c54d035f 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp @@ -18,6 +18,9 @@ #include "mesh/DomainPartition.hpp" #include "mesh/MeshBody.hpp" #include "mesh/MeshObjectPath.hpp" +#include "PermeabilitySpecification.hpp" +#include "FieldSpecificationFactory.hpp" +#include "PermeabilitySpecificationFactory.hpp" namespace geos { @@ -35,6 +38,7 @@ FieldSpecificationManager::FieldSpecificationManager( string const & name, Group GEOS_ERROR_IF( m_instance != nullptr, "Only one FieldSpecificationManager can exist at a time." ); m_instance = this; + registerFactory( std::make_unique< PermeabilitySpecificationFactory >() ); } FieldSpecificationManager::~FieldSpecificationManager() @@ -69,6 +73,23 @@ void FieldSpecificationManager::expandObjectCatalogs() } } +void FieldSpecificationManager::registerFactory( std::unique_ptr< FieldSpecificationFactory > factory ) +{ + m_factories.emplace( factory->getKey(), std::move( factory ) ); +} + +void FieldSpecificationManager::postInputInitialization() +{ + forSubGroups< FieldSpecificationABC >( [&]( FieldSpecificationABC const & spec ) + { + auto it = m_factories.find( spec.getCatalogName() ); + if ( it != m_factories.end() ) + { + it->second->generate( spec, *this ); + } + } ); +} + void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) const { DomainPartition const & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp index b1d929e6561..459480a2ef4 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp @@ -21,6 +21,7 @@ #define GEOS_FIELDSPECIFICATION_FIELDSPECIFICATIONMANAGER_HPP_ #include "FieldSpecificationBase.hpp" +#include "FieldSpecificationFactory.hpp" #include "common/format/StringUtilities.hpp" #include "common/DataTypes.hpp" @@ -238,11 +239,23 @@ class FieldSpecificationManager : public dataRepository::Group m_isSurfaceGenerationCase = isSurfaceGenerationCase; } + void registerFactory( std::unique_ptr< FieldSpecificationFactory > factory ); + + +protected: + + virtual void postInputInitialization() override; + + private: + static FieldSpecificationManager * m_instance; + /// Indicate if the SurfaceGenerator element is present bool m_isSurfaceGenerationCase = false; + std::unordered_map< string, std::unique_ptr< FieldSpecificationFactory > > m_factories; + }; template< typename POLICY, typename LAMBDA > From dca1b4a80dc346f85bc390d80460535e63b6dfce Mon Sep 17 00:00:00 2001 From: kdrienCG Date: Tue, 7 Apr 2026 17:44:15 +0200 Subject: [PATCH 07/13] set description for scales wrapper --- .../fieldSpecification/PermeabilitySpecification.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp b/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp index 96ae605ffae..672dc816c82 100644 --- a/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp @@ -35,7 +35,7 @@ PermeabilitySpecification::PermeabilitySpecification( string const & name, Group registerWrapper( viewKeyStruct::regionNamesString(), &m_regionNames ). setRTTypeName( rtTypes::CustomTypes::groupNameRefArray ). setInputFlag( InputFlags::REQUIRED ). - setDescription( "" ); + setDescription( "Names of the regions that boundary condition is applied to." ); registerWrapper( viewKeyStruct::fieldNameString(), &m_fieldName ). setRTTypeName( rtTypes::CustomTypes::groupNameRef ). From 1efaccf1a93cf2858b97673be996cc0c3d3b76f7 Mon Sep 17 00:00:00 2001 From: kdrienCG Date: Tue, 7 Apr 2026 17:46:05 +0200 Subject: [PATCH 08/13] change type of m_scales to R1Tensor --- .../fieldSpecification/PermeabilitySpecification.cpp | 11 +++-------- .../fieldSpecification/PermeabilitySpecification.hpp | 4 ++-- .../PermeabilitySpecificationFactory.cpp | 2 +- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp b/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp index 672dc816c82..38bcb2b7943 100644 --- a/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp @@ -49,8 +49,8 @@ PermeabilitySpecification::PermeabilitySpecification( string const & name, Group setDescription( "Name of function that specifies variation of the boundary condition." ); registerWrapper( viewKeyStruct::scalesString(), &m_scales ). - // setApplyDefaultValue( 0.0 ). - setInputFlag( InputFlags::REQUIRED ). + setApplyDefaultValue( { 0.0, 0.0, 0.0 } ). + setInputFlag( InputFlags::OPTIONAL ). setDescription( "Apply a scaling factor for the value of the boundary condition." ); } @@ -60,12 +60,7 @@ PermeabilitySpecification::~PermeabilitySpecification() void PermeabilitySpecification::postInputInitialization() -{ - GEOS_THROW_IF( m_scales.size() != 3, - getWrapperDataContext( viewKeyStruct::scalesString() ) << - ": expected 3 components, got " << m_scales.size(), - InputError ); -} +{} REGISTER_CATALOG_ENTRY( FieldSpecificationABC, PermeabilitySpecification, string const &, Group * const ) diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp b/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp index 6796db78a20..eb2847ce887 100644 --- a/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp @@ -134,7 +134,7 @@ class PermeabilitySpecification : public FieldSpecificationABC * Accessor * @return const m_scales */ - arrayView1d< real64 const > getScales() const + R1Tensor getScales() const { return m_scales; } @@ -161,7 +161,7 @@ class PermeabilitySpecification : public FieldSpecificationABC string m_functionName; /// The scale factors to use on the value of the boundary condition. - array1d< real64 > m_scales; + R1Tensor m_scales; }; diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp index eae986ea9ae..7ea83372194 100644 --- a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp @@ -38,7 +38,7 @@ void PermeabilitySpecificationFactory::generate( FieldSpecificationABC const & s stdArray< string, 3 > suffixes = {{ "_x", "_y", "_z" }}; - arrayView1d< real64 const > scales = ps->getScales(); + R1Tensor scales = ps->getScales(); for ( string const & regionName : ps->getRegionNames() ) { From e40b8c945ec88eab64a515cdaf2fd97e8aca4973 Mon Sep 17 00:00:00 2001 From: kdrienCG Date: Wed, 8 Apr 2026 09:28:01 +0200 Subject: [PATCH 09/13] modify for loop type to integer --- .../fieldSpecification/PermeabilitySpecificationFactory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp index 7ea83372194..ee5574edf28 100644 --- a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp @@ -44,9 +44,9 @@ void PermeabilitySpecificationFactory::generate( FieldSpecificationABC const & s { string const objectPath = "ElementRegions/" + regionName; - for ( int comp = 0; comp < 3; ++comp ) + for ( integer comp = 0; comp < 3; ++comp ) { - string const childName = ps->getName() + "_" + regionName + suffixes[ comp ]; + string const childName = ps->getName() + "_" + regionName + suffixes[ comp ]; FieldSpecificationBase & fs = manager.registerGroup< FieldSpecificationBase >( childName ); fs.setFieldName( ps->getFieldName() ); From c736a7d6d249e5480f73c076f26e6648afff4c35 Mon Sep 17 00:00:00 2001 From: kdrienCG Date: Wed, 8 Apr 2026 09:38:44 +0200 Subject: [PATCH 10/13] add RST documentation for PermeabilitySpecification --- .../docs/FieldSpecification.rst | 2 + .../docs/PermeabilitySpecification.rst | 49 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/coreComponents/fieldSpecification/docs/PermeabilitySpecification.rst diff --git a/src/coreComponents/fieldSpecification/docs/FieldSpecification.rst b/src/coreComponents/fieldSpecification/docs/FieldSpecification.rst index 7752ed84863..b52ebee4449 100644 --- a/src/coreComponents/fieldSpecification/docs/FieldSpecification.rst +++ b/src/coreComponents/fieldSpecification/docs/FieldSpecification.rst @@ -9,4 +9,6 @@ Initial and Boundary Conditions EquilibriumInitialCondition AquiferBoundaryCondition + + PermeabilitySpecification diff --git a/src/coreComponents/fieldSpecification/docs/PermeabilitySpecification.rst b/src/coreComponents/fieldSpecification/docs/PermeabilitySpecification.rst new file mode 100644 index 00000000000..55f324f5c02 --- /dev/null +++ b/src/coreComponents/fieldSpecification/docs/PermeabilitySpecification.rst @@ -0,0 +1,49 @@ +.. _PermeabilitySpecification: + +#################################################### +Permeability specification +#################################################### + +Overview +====================== + +**PermeabilitySpecification** is an optional, higher-level XML tag that you can place in the **FieldSpecifications** block. +It describes a 3-axis permeability on one or more element regions. +After the input deck is read, GEOS expands each **PermeabilitySpecification** into several **FieldSpecification** objects (one per region and per axis) that the rest of the code already understands. + +This is convenient when you want the same **setNames**, **fieldName**, and other attributes for all three permeability components, instead of repeating three nearly identical **FieldSpecification**. + +Examples +=============== + +The following illustrates a **PermeabilitySpecification** for a single region. + +.. code-block:: xml + + + ... + + ... + + +The following illustrates a **PermeabilitySpecification** for multiple regions. + +.. code-block:: xml + + + ... + + ... + From 42f7c62f2b9b43d0fff0407fd39f27533dc52b60 Mon Sep 17 00:00:00 2001 From: kdrienCG Date: Fri, 10 Apr 2026 15:06:56 +0200 Subject: [PATCH 11/13] uncrustify --- .../fieldSpecification/FieldSpecificationABC.cpp | 2 +- .../fieldSpecification/FieldSpecificationABC.hpp | 2 +- .../fieldSpecification/FieldSpecificationBase.hpp | 2 +- .../fieldSpecification/FieldSpecificationFactory.hpp | 2 +- .../fieldSpecification/FieldSpecificationManager.cpp | 2 +- .../fieldSpecification/FieldSpecificationManager.hpp | 4 ++-- .../fieldSpecification/PermeabilitySpecification.cpp | 2 +- .../fieldSpecification/PermeabilitySpecification.hpp | 2 +- .../PermeabilitySpecificationFactory.cpp | 12 ++++++------ .../PermeabilitySpecificationFactory.hpp | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationABC.cpp b/src/coreComponents/fieldSpecification/FieldSpecificationABC.cpp index 4f4b3ba3da4..5d5a38d6704 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationABC.cpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationABC.cpp @@ -33,4 +33,4 @@ FieldSpecificationABC::getCatalog() return catalog; } -} \ No newline at end of file +} diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp index 5ec287c3837..3b413da7db4 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp @@ -102,4 +102,4 @@ class FieldSpecificationABC : public dataRepository::Group } -#endif //GEOS_FIELDSPECIFICATION_FIELDSPECIFICATIONABC_HPP \ No newline at end of file +#endif //GEOS_FIELDSPECIFICATION_FIELDSPECIFICATIONABC_HPP diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationBase.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationBase.hpp index 909731e3e33..6231bf2b1f2 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationBase.hpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationBase.hpp @@ -506,7 +506,7 @@ class FieldSpecificationBase : public FieldSpecificationABC /** * Mutator - * @param[in] component The component index + * @param[in] component The component index */ void setComponent( int component ) { diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationFactory.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationFactory.hpp index d77841afb7d..6e402463c75 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationFactory.hpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationFactory.hpp @@ -52,4 +52,4 @@ class FieldSpecificationFactory } -#endif //GEOS_FIELDSPECIFICATION_FIELDSPECIFICATIONFACTORY_HPP \ No newline at end of file +#endif //GEOS_FIELDSPECIFICATION_FIELDSPECIFICATIONFACTORY_HPP diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp index 5c3c54d035f..2fb9d7e90b1 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp @@ -83,7 +83,7 @@ void FieldSpecificationManager::postInputInitialization() forSubGroups< FieldSpecificationABC >( [&]( FieldSpecificationABC const & spec ) { auto it = m_factories.find( spec.getCatalogName() ); - if ( it != m_factories.end() ) + if( it != m_factories.end() ) { it->second->generate( spec, *this ); } diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp index 459480a2ef4..db43bc9d8bb 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp @@ -248,9 +248,9 @@ class FieldSpecificationManager : public dataRepository::Group private: - + static FieldSpecificationManager * m_instance; - + /// Indicate if the SurfaceGenerator element is present bool m_isSurfaceGenerationCase = false; diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp b/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp index 38bcb2b7943..22a5c6ec77f 100644 --- a/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecification.cpp @@ -65,4 +65,4 @@ void PermeabilitySpecification::postInputInitialization() REGISTER_CATALOG_ENTRY( FieldSpecificationABC, PermeabilitySpecification, string const &, Group * const ) -} \ No newline at end of file +} diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp b/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp index eb2847ce887..cbb51e7abc4 100644 --- a/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp @@ -167,4 +167,4 @@ class PermeabilitySpecification : public FieldSpecificationABC } -#endif //GEOS_FIELDSPECIFICATION_PERMEABILITYSPECIFICATION_HPP \ No newline at end of file +#endif //GEOS_FIELDSPECIFICATION_PERMEABILITYSPECIFICATION_HPP diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp index ee5574edf28..b50b2c67df4 100644 --- a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp @@ -34,17 +34,17 @@ namespace geos void PermeabilitySpecificationFactory::generate( FieldSpecificationABC const & spec, dataRepository::Group & manager ) const { - auto ps = dynamic_cast< PermeabilitySpecification const * >( &spec ); + auto ps = dynamic_cast< PermeabilitySpecification const * >( &spec ); stdArray< string, 3 > suffixes = {{ "_x", "_y", "_z" }}; R1Tensor scales = ps->getScales(); - for ( string const & regionName : ps->getRegionNames() ) + for( string const & regionName : ps->getRegionNames() ) { string const objectPath = "ElementRegions/" + regionName; - for ( integer comp = 0; comp < 3; ++comp ) + for( integer comp = 0; comp < 3; ++comp ) { string const childName = ps->getName() + "_" + regionName + suffixes[ comp ]; @@ -55,12 +55,12 @@ void PermeabilitySpecificationFactory::generate( FieldSpecificationABC const & s fs.initialCondition( true ); fs.setComponent( comp ); - for ( auto const & setName : ps->getSetNames() ) + for( auto const & setName : ps->getSetNames() ) { fs.addSetName( setName ); } - if ( !ps->getFunctionName().empty() ) + if( !ps->getFunctionName().empty() ) { fs.setFunctionName( ps->getFunctionName() ); } @@ -70,4 +70,4 @@ void PermeabilitySpecificationFactory::generate( FieldSpecificationABC const & s } -} \ No newline at end of file +} diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp index 653f2b85c22..612b86c1429 100644 --- a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp @@ -51,4 +51,4 @@ class PermeabilitySpecificationFactory : public FieldSpecificationFactory } -#endif //GEOS_FIELDSPECIFICATION_PERMEABILITYSPECIFICATIONFACTORY_HPP \ No newline at end of file +#endif //GEOS_FIELDSPECIFICATION_PERMEABILITYSPECIFICATIONFACTORY_HPP From 16f7e43a09c7f03908bdfce5599df22c8859d3ad Mon Sep 17 00:00:00 2001 From: kdrienCG Date: Tue, 14 Apr 2026 14:03:51 +0200 Subject: [PATCH 12/13] add missing documentation --- .../fieldSpecification/FieldSpecificationABC.hpp | 2 ++ .../fieldSpecification/FieldSpecificationFactory.hpp | 4 ++++ .../fieldSpecification/FieldSpecificationManager.hpp | 5 +++++ .../fieldSpecification/PermeabilitySpecification.hpp | 2 ++ .../fieldSpecification/PermeabilitySpecificationFactory.hpp | 3 +++ 5 files changed, 16 insertions(+) diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp index 3b413da7db4..9efab02e82f 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationABC.hpp @@ -33,6 +33,8 @@ class Function; /** * @class FieldSpecificationABC + * + * Abstract Base Class grouping multiple types of field specifications. */ class FieldSpecificationABC : public dataRepository::Group { diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationFactory.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationFactory.hpp index 6e402463c75..32fc2d8aa34 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationFactory.hpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationFactory.hpp @@ -30,6 +30,10 @@ namespace geos /** * @class FieldSpecificationFactory + * + * This class provides a way to create FieldSpecification objects using + * other type of specifications. One could think of those types of + * specification to blueprints or "high-level" specification */ class FieldSpecificationFactory { diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp index db43bc9d8bb..1ec2e387515 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp @@ -239,6 +239,11 @@ class FieldSpecificationManager : public dataRepository::Group m_isSurfaceGenerationCase = isSurfaceGenerationCase; } + /** + * @brief Register a factory in the manager to create FieldSpecification + * via "high-level" field specifications data + * @param factory The factory to add to the manager + */ void registerFactory( std::unique_ptr< FieldSpecificationFactory > factory ); diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp b/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp index cbb51e7abc4..86cd7bec59b 100644 --- a/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecification.hpp @@ -31,6 +31,8 @@ namespace geos /** * @class PermeabilitySpecification + * + * Data class representing a permeability field specification */ class PermeabilitySpecification : public FieldSpecificationABC { diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp index 612b86c1429..325cf0affa0 100644 --- a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp @@ -33,6 +33,9 @@ namespace geos /** * @class PermeabilitySpecificationFactory + * + * @copydoc geos::FieldSpecificationFactory + * Field specification factory implementation for the PermeabilitySpecification */ class PermeabilitySpecificationFactory : public FieldSpecificationFactory { From 74cda9c572ceff50c2e336790c75d58fd251a999 Mon Sep 17 00:00:00 2001 From: kdrienCG Date: Tue, 14 Apr 2026 14:04:33 +0200 Subject: [PATCH 13/13] fix parameter name Modify the specification parameter name in PermeabilitySpecificationFactory to match the parent class method definition (FieldSpecificationFactory) --- .../fieldSpecification/PermeabilitySpecificationFactory.cpp | 4 ++-- .../fieldSpecification/PermeabilitySpecificationFactory.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp index b50b2c67df4..d1791a03046 100644 --- a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.cpp @@ -31,10 +31,10 @@ namespace geos * @class PermeabilitySpecificationFactory */ -void PermeabilitySpecificationFactory::generate( FieldSpecificationABC const & spec, +void PermeabilitySpecificationFactory::generate( FieldSpecificationABC const & specification, dataRepository::Group & manager ) const { - auto ps = dynamic_cast< PermeabilitySpecification const * >( &spec ); + auto ps = dynamic_cast< PermeabilitySpecification const * >( &specification ); stdArray< string, 3 > suffixes = {{ "_x", "_y", "_z" }}; diff --git a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp index 325cf0affa0..d8f85b16fb3 100644 --- a/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp +++ b/src/coreComponents/fieldSpecification/PermeabilitySpecificationFactory.hpp @@ -42,7 +42,7 @@ class PermeabilitySpecificationFactory : public FieldSpecificationFactory public: /// @copydoc geos::FieldSpecificationFactory::generate() - void generate( FieldSpecificationABC const & spec, + void generate( FieldSpecificationABC const & specification, dataRepository::Group & manager ) const; /// @copydoc geos::FieldSpecificationFactory::getKey()