diff --git a/src/coreComponents/physicsSolvers/multiphysics/CMakeLists.txt b/src/coreComponents/physicsSolvers/multiphysics/CMakeLists.txt index 2d3a5e031eb..82c1d57e4ee 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CMakeLists.txt +++ b/src/coreComponents/physicsSolvers/multiphysics/CMakeLists.txt @@ -31,6 +31,7 @@ set( multiPhysicsSolvers_headers MultiphasePoromechanics.hpp OneWayCoupledFractureFlowContactMechanics.hpp MultiphasePoromechanicsConformingFractures.hpp + MultiphasePoromechanicsConformingFracturesALM.hpp PhaseFieldFractureSolver.hpp PhaseFieldPoromechanicsSolver.hpp PoromechanicsInitialization.hpp @@ -72,6 +73,7 @@ set( multiPhysicsSolvers_sources MultiphasePoromechanics.cpp OneWayCoupledFractureFlowContactMechanics.cpp MultiphasePoromechanicsConformingFractures.cpp + MultiphasePoromechanicsConformingFracturesALM.cpp PhaseFieldFractureSolver.cpp PhaseFieldPoromechanicsSolver.cpp PoromechanicsInitialization.cpp diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp index 075df069e75..545ebfcfc43 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp @@ -29,6 +29,7 @@ #include "physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp" #include "physicsSolvers/solidMechanics/kernels/ImplicitSmallStrainQuasiStatic.hpp" #include "physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContact.hpp" +#include "physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.hpp" #include "physicsSolvers/multiphysics/poromechanicsKernels/PoromechanicsKernelsDispatchTypeList.hpp" #include "physicsSolvers/multiphysics/poromechanicsKernels/ThermoPoromechanicsKernelsDispatchTypeList.hpp" @@ -252,8 +253,10 @@ void MultiphasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::updateBulkDensity template class MultiphasePoromechanics<>; template class MultiphasePoromechanics< CompositionalMultiphaseBase, SolidMechanicsLagrangeContact >; +template class MultiphasePoromechanics< CompositionalMultiphaseBase, SolidMechanicsAugmentedLagrangianContact >; template class MultiphasePoromechanics< CompositionalMultiphaseReservoirAndWells<> >; template class MultiphasePoromechanics< CompositionalMultiphaseReservoirAndWells<>, SolidMechanicsLagrangeContact >; +template class MultiphasePoromechanics< CompositionalMultiphaseReservoirAndWells<>, SolidMechanicsAugmentedLagrangianContact >; namespace { diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsConformingFracturesALM.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsConformingFracturesALM.cpp new file mode 100644 index 00000000000..5dd8384048a --- /dev/null +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsConformingFracturesALM.cpp @@ -0,0 +1,198 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * 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 MultiphasePoromechanicsConformingFracturesALM.cpp + */ + +#include "MultiphasePoromechanicsConformingFracturesALM.hpp" + +#include "finiteVolume/FluxApproximationBase.hpp" + +namespace geos +{ + +using namespace constitutive; +using namespace dataRepository; +using namespace fields; + +template< typename FLOW_SOLVER > +MultiphasePoromechanicsConformingFracturesALM< FLOW_SOLVER >::MultiphasePoromechanicsConformingFracturesALM( const string & name, + Group * const parent ) + : Base( name, parent ) +{} + +template< typename FLOW_SOLVER > +void MultiphasePoromechanicsConformingFracturesALM< FLOW_SOLVER >::setupCoupling( DomainPartition const & domain, + DofManager & dofManager ) const +{ + GEOS_MARK_FUNCTION; + + GEOS_UNUSED_VAR( domain, dofManager ); + + GEOS_ERROR( "MultiphasePoromechanicsConformingFracturesALM does not support FullyImplicit coupling type." ); + +} + + +template< typename FLOW_SOLVER > +void MultiphasePoromechanicsConformingFracturesALM< FLOW_SOLVER >::setupSystem( DomainPartition & domain, + DofManager & dofManager, + CRSMatrix< real64, globalIndex > & localMatrix, + ParallelVector & rhs, + ParallelVector & solution, + bool const setSparsity ) +{ + + GEOS_MARK_FUNCTION; + + GEOS_UNUSED_VAR( domain, dofManager, localMatrix, rhs, solution, setSparsity ); + + GEOS_ERROR( "MultiphasePoromechanicsConformingFracturesALM does not support FullyImplicit coupling type." ); + +} + +template< typename FLOW_SOLVER > +void MultiphasePoromechanicsConformingFracturesALM< FLOW_SOLVER >::assembleSystem( real64 const time_n, + real64 const dt, + DomainPartition & domain, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) +{ + + GEOS_MARK_FUNCTION; + + GEOS_UNUSED_VAR( time_n, dt, domain, dofManager, localMatrix, localRhs ); + + GEOS_ERROR( "MultiphasePoromechanicsConformingFracturesALM does not support FullyImplicit coupling type." ); +} + +template< typename FLOW_SOLVER > +void MultiphasePoromechanicsConformingFracturesALM< FLOW_SOLVER >::assembleElementBasedContributions( real64 const time_n, + real64 const dt, + DomainPartition & domain, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) +{ + GEOS_MARK_FUNCTION; + + GEOS_UNUSED_VAR( time_n, dt, domain, dofManager, localMatrix, localRhs ); + + GEOS_ERROR( "MultiphasePoromechanicsConformingFracturesALM does not support FullyImplicit coupling type." ); + +} + +template< typename FLOW_SOLVER > +void MultiphasePoromechanicsConformingFracturesALM< FLOW_SOLVER >::assembleCouplingTerms( real64 const time_n, + real64 const dt, + DomainPartition const & domain, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) +{ + GEOS_MARK_FUNCTION; + GEOS_UNUSED_VAR( domain, dofManager, localMatrix, localRhs, time_n, dt ); + + GEOS_ERROR( "MultiphasePoromechanicsConformingFracturesALM does not support FullyImplicit coupling type." ); +} + +template< typename FLOW_SOLVER > +void MultiphasePoromechanicsConformingFracturesALM< FLOW_SOLVER >::updateState( DomainPartition & domain ) +{ + GEOS_MARK_FUNCTION; + GEOS_UNUSED_VAR( domain ); + GEOS_ERROR( "MultiphasePoromechanicsConformingFracturesALM does not support FullyImplicit coupling type." ); +} + +template< typename FLOW_SOLVER > +void MultiphasePoromechanicsConformingFracturesALM< FLOW_SOLVER >:: +setUpDflux_dApertureMatrix( DomainPartition & domain, + DofManager const & GEOS_UNUSED_PARAM( dofManager ), + CRSMatrix< real64, globalIndex > & localMatrix ) +{ + GEOS_UNUSED_VAR( domain, localMatrix ); + GEOS_ERROR( "MultiphasePoromechanicsConformingFracturesALM does not support FullyImplicit coupling type." ); +} + +template< typename FLOW_SOLVER > +void MultiphasePoromechanicsConformingFracturesALM< FLOW_SOLVER >:: +addTransmissibilityCouplingNNZ( DomainPartition const & domain, + DofManager const & dofManager, + arrayView1d< localIndex > const & rowLengths ) const +{ + GEOS_MARK_FUNCTION; + + GEOS_UNUSED_VAR( domain, dofManager, rowLengths ); + GEOS_ERROR( "MultiphasePoromechanicsConformingFracturesALM does not support FullyImplicit coupling type." ); + +} + +template< typename FLOW_SOLVER > +void MultiphasePoromechanicsConformingFracturesALM< FLOW_SOLVER >:: +addTransmissibilityCouplingPattern( DomainPartition const & domain, + DofManager const & dofManager, + SparsityPatternView< globalIndex > const & pattern ) const +{ + GEOS_MARK_FUNCTION; + + GEOS_UNUSED_VAR( domain, dofManager, pattern ); + GEOS_ERROR( "MultiphasePoromechanicsConformingFracturesALM does not support FullyImplicit coupling type." ); +} + +template< typename FLOW_SOLVER > +void MultiphasePoromechanicsConformingFracturesALM< FLOW_SOLVER >:: +assembleForceResidualDerivativeWrtPressure( string const & meshName, + MeshLevel const & mesh, + arrayView1d< string const > const & regionNames, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) +{ + GEOS_MARK_FUNCTION; + + GEOS_UNUSED_VAR( meshName, mesh, regionNames, dofManager, localMatrix, localRhs ); + GEOS_ERROR( "MultiphasePoromechanicsConformingFracturesALM does not support FullyImplicit coupling type." ); +} + +template< typename FLOW_SOLVER > +void MultiphasePoromechanicsConformingFracturesALM< FLOW_SOLVER >:: +assembleFluidMassResidualDerivativeWrtDisplacement( MeshLevel const & mesh, + arrayView1d< string const > const & regionNames, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & GEOS_UNUSED_PARAM( localRhs ) ) +{ + GEOS_MARK_FUNCTION; + + GEOS_UNUSED_VAR( mesh, regionNames, dofManager, localMatrix ); + GEOS_ERROR( "MultiphasePoromechanicsConformingFracturesALM does not support FullyImplicit coupling type." ); + +} + + +template class MultiphasePoromechanicsConformingFracturesALM<>; +template class MultiphasePoromechanicsConformingFracturesALM< CompositionalMultiphaseReservoirAndWells<> >; + +namespace +{ +typedef MultiphasePoromechanicsConformingFracturesALM< CompositionalMultiphaseReservoirAndWells<> > MultiphaseReservoirPoromechanicsConformingFracturesALM; +REGISTER_CATALOG_ENTRY( PhysicsSolverBase, MultiphaseReservoirPoromechanicsConformingFracturesALM, string const &, Group * const ) +typedef MultiphasePoromechanicsConformingFracturesALM<> MultiphasePoromechanicsConformingFracturesALM; +REGISTER_CATALOG_ENTRY( PhysicsSolverBase, MultiphasePoromechanicsConformingFracturesALM, string const &, Group * const ) +} + +} /* namespace geos */ diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsConformingFracturesALM.hpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsConformingFracturesALM.hpp new file mode 100644 index 00000000000..15dd659440b --- /dev/null +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsConformingFracturesALM.hpp @@ -0,0 +1,209 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * 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 MultiphasePoromechanicsConformingFracturesALM.hpp + */ + +#ifndef GEOS_PHYSICSSOLVERS_MULTIPHYSICS_MULTIPHASEPOROMECHANICSCONFORMINGFRACTURESALM_HPP_ +#define GEOS_PHYSICSSOLVERS_MULTIPHYSICS_MULTIPHASEPOROMECHANICSCONFORMINGFRACTURESALM_HPP_ + +#include "physicsSolvers/multiphysics/MultiphasePoromechanics.hpp" +#include "physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.hpp" + +namespace geos +{ + +template< typename FLOW_SOLVER = CompositionalMultiphaseBase > +class MultiphasePoromechanicsConformingFracturesALM : public MultiphasePoromechanics< FLOW_SOLVER, SolidMechanicsAugmentedLagrangianContact > +{ +public: + + using Base = MultiphasePoromechanics< FLOW_SOLVER, SolidMechanicsAugmentedLagrangianContact >; + using Base::m_solvers; + using Base::m_dofManager; + using Base::m_localMatrix; + using Base::m_rhs; + using Base::m_solution; + + /// String used to form the solverName used to register solvers in CoupledSolver + static string coupledSolverAttributePrefix() { return "poromechanicsConformingFracturesALM"; } + + /** + * @brief main constructor for MultiphasePoromechanicsConformingFracturesALM objects + * @param name the name of this instantiation of MultiphasePoromechanicsConformingFracturesALM in the repository + * @param parent the parent group of this instantiation of MultiphasePoromechanicsConformingFracturesALM + */ + MultiphasePoromechanicsConformingFracturesALM( const string & name, + dataRepository::Group * const parent ); + + /// Destructor for the class + ~MultiphasePoromechanicsConformingFracturesALM() override {} + + /** + * @brief name of the node manager in the object catalog + * @return string that contains the catalog name to generate a new MultiphasePoromechanicsConformingFracturesALM object through the + * object + * catalog. + */ + static string catalogName() + { + if constexpr ( std::is_same_v< FLOW_SOLVER, CompositionalMultiphaseBase > ) + { + return "MultiphasePoromechanicsConformingFracturesALM"; + } + else + { + return FLOW_SOLVER::catalogName() + "PoromechanicsConformingFracturesALM"; + } + } + + /** + * @copydoc PhysicsSolverBase::getCatalogName() + */ + string getCatalogName() const override { return catalogName(); } + + /** + * @defgroup Solver Interface Functions + * + * These functions provide the primary interface that is required for derived classes + */ + /**@{*/ + + virtual void setupCoupling( DomainPartition const & domain, + DofManager & dofManager ) const override final; + + virtual void setupSystem( DomainPartition & domain, + DofManager & dofManager, + CRSMatrix< real64, globalIndex > & localMatrix, + ParallelVector & rhs, + ParallelVector & solution, + bool const setSparsity = true ) override final; + + virtual void assembleSystem( real64 const time, + real64 const dt, + DomainPartition & domain, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) override final; + + virtual void updateState( DomainPartition & domain ) override final; + + virtual void setMGRStrategy() override final + { + if( this->m_linearSolverParameters.get().preconditionerType == LinearSolverParameters::PreconditionerType::mgr ) + GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}", this->getName(), this->getCatalogName())); + } + + /**@}*/ + +private: + + struct viewKeyStruct : public Base::viewKeyStruct + {}; + + static const localIndex m_maxFaceNodes=11; // Maximum number of nodes on a contact face + + /** + * @Brief assemble the element-based contributions + * @param time_n the current time + * @param dt the time step + * @param domain the physical domain object + * @param dofManager degree-of-freedom manager associated with the linear system + * @param localMatrix the local system matrix + * @param localRhs the local system right-hand side vector + */ + void assembleElementBasedContributions( real64 const time_n, + real64 const dt, + DomainPartition & domain, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ); + + virtual void assembleCouplingTerms( real64 const time_n, + real64 const dt, + DomainPartition const & domain, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) override final; + + void assembleForceResidualDerivativeWrtPressure( string const & meshName, + MeshLevel const & mesh, + arrayView1d< string const > const & regionNames, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ); + + void assembleFluidMassResidualDerivativeWrtDisplacement( MeshLevel const & mesh, + arrayView1d< string const > const & regionNames, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ); + + /** + * @Brief add the nnz induced by the flux-aperture coupling + * @param domain the physical domain object + * @param dofManager degree-of-freedom manager associated with the linear system + * @param rowLenghts the nnz in each row + */ + void addTransmissibilityCouplingNNZ( DomainPartition const & domain, + DofManager const & dofManager, + arrayView1d< localIndex > const & rowLengths ) const; + + /** + * @Brief add the sparsity pattern induced by the flux-aperture coupling + * @param domain the physical domain object + * @param dofManager degree-of-freedom manager associated with the linear system + * @param pattern the sparsity pattern + */ + void addTransmissibilityCouplingPattern( DomainPartition const & domain, + DofManager const & dofManager, + SparsityPatternView< globalIndex > const & pattern ) const; + + /** + * @brief Set up the Dflux_dApertureMatrix object + * + * @param domain + * @param dofManager + * @param localMatrix + */ + void setUpDflux_dApertureMatrix( DomainPartition & domain, + DofManager const & dofManager, + CRSMatrix< real64, globalIndex > & localMatrix ); + + std::unique_ptr< CRSMatrix< real64, localIndex > > & getRefDerivativeFluxResidual_dAperture() + { + return m_derivativeFluxResidual_dAperture; + } + + CRSMatrixView< real64, localIndex const > getDerivativeFluxResidual_dNormalJump() + { + return m_derivativeFluxResidual_dAperture->toViewConstSizes(); + } + + CRSMatrixView< real64 const, localIndex const > getDerivativeFluxResidual_dNormalJump() const + { + return m_derivativeFluxResidual_dAperture->toViewConst(); + } + + std::unique_ptr< CRSMatrix< real64, localIndex > > m_derivativeFluxResidual_dAperture; + + string const m_pressureKey = CompositionalMultiphaseBase::viewKeyStruct::elemDofFieldString(); + +}; + +} /* namespace geos */ + +#endif /* GEOS_PHYSICSSOLVERS_MULTIPHYSICS_MULTIPHASEPOROMECHANICSCONFORMINGFRACTURESALM_HPP_ */ diff --git a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp index e476c613cbb..288e282dae1 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp @@ -23,6 +23,7 @@ #include "physicsSolvers/solidMechanics/SolidMechanicsStatistics.hpp" #include "physicsSolvers/multiphysics/MultiphasePoromechanics.hpp" #include "physicsSolvers/multiphysics/MultiphasePoromechanicsConformingFractures.hpp" +#include "physicsSolvers/multiphysics/MultiphasePoromechanicsConformingFracturesALM.hpp" #include "physicsSolvers/multiphysics/SinglePhasePoromechanics.hpp" #include "physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp" #include "physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFracturesALM.hpp" @@ -139,9 +140,12 @@ namespace { typedef PoromechanicsInitialization< MultiphasePoromechanics<> > MultiphasePoromechanicsInitialization; typedef PoromechanicsInitialization< MultiphasePoromechanicsConformingFractures<> > MultiphasePoromechanicsConformingFracturesInitialization; +typedef PoromechanicsInitialization< MultiphasePoromechanicsConformingFracturesALM<> > MultiphasePoromechanicsConformingFracturesALMInitialization; typedef PoromechanicsInitialization< MultiphasePoromechanics< CompositionalMultiphaseReservoirAndWells<> > > MultiphaseReservoirPoromechanicsInitialization; typedef PoromechanicsInitialization< MultiphasePoromechanicsConformingFractures< CompositionalMultiphaseReservoirAndWells<> > > CompositionalMultiphaseReservoirPoromechanicsConformingFracturesInitialization; +typedef PoromechanicsInitialization< MultiphasePoromechanicsConformingFracturesALM< CompositionalMultiphaseReservoirAndWells<> > > + CompositionalMultiphaseReservoirPoromechanicsConformingFracturesALMInitialization; typedef PoromechanicsInitialization< SinglePhasePoromechanics<> > SinglePhasePoromechanicsInitialization; typedef PoromechanicsInitialization< SinglePhasePoromechanicsConformingFractures<> > SinglePhasePoromechanicsConformingFracturesInitialization; typedef PoromechanicsInitialization< SinglePhasePoromechanicsConformingFractures< SinglePhaseReservoirAndWells<> > > SinglePhaseReservoirPoromechanicsConformingFracturesInitialization; @@ -152,8 +156,10 @@ typedef PoromechanicsInitialization< SinglePhasePoromechanics< SinglePhaseReserv typedef PoromechanicsInitialization< HydrofractureSolver< SinglePhasePoromechanics<> > > HydrofractureInitialization; REGISTER_CATALOG_ENTRY( TaskBase, MultiphasePoromechanicsInitialization, string const &, Group * const ) REGISTER_CATALOG_ENTRY( TaskBase, MultiphasePoromechanicsConformingFracturesInitialization, string const &, Group * const ) +REGISTER_CATALOG_ENTRY( TaskBase, MultiphasePoromechanicsConformingFracturesALMInitialization, string const &, Group * const ) REGISTER_CATALOG_ENTRY( TaskBase, MultiphaseReservoirPoromechanicsInitialization, string const &, Group * const ) REGISTER_CATALOG_ENTRY( TaskBase, CompositionalMultiphaseReservoirPoromechanicsConformingFracturesInitialization, string const &, Group * const ) +REGISTER_CATALOG_ENTRY( TaskBase, CompositionalMultiphaseReservoirPoromechanicsConformingFracturesALMInitialization, string const &, Group * const ) REGISTER_CATALOG_ENTRY( TaskBase, SinglePhasePoromechanicsInitialization, string const &, Group * const ) REGISTER_CATALOG_ENTRY( TaskBase, SinglePhasePoromechanicsConformingFracturesInitialization, string const &, Group * const ) REGISTER_CATALOG_ENTRY( TaskBase, SinglePhaseReservoirPoromechanicsConformingFracturesInitialization, string const &, Group * const )