From 14095fca3fa8d2b16f7494a736b095835bf08140 Mon Sep 17 00:00:00 2001 From: Matteo Frigo Date: Wed, 10 Jul 2024 08:47:20 -0700 Subject: [PATCH 01/41] Start of the implementation of slip and open modes for ALM --- .../physicsSolvers/contact/ContactFields.hpp | 2 +- .../contact/SolidMechanicsALMKernels.hpp | 34 +- ...lidMechanicsAugmentedLagrangianContact.cpp | 541 ++++++++++++++++-- ...lidMechanicsAugmentedLagrangianContact.hpp | 72 +++ 4 files changed, 583 insertions(+), 66 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/ContactFields.hpp b/src/coreComponents/physicsSolvers/contact/ContactFields.hpp index 748eb55f1d2..44048a9d886 100644 --- a/src/coreComponents/physicsSolvers/contact/ContactFields.hpp +++ b/src/coreComponents/physicsSolvers/contact/ContactFields.hpp @@ -52,7 +52,7 @@ struct FractureState DECLARE_FIELD( penalty, "penalty", array2d< real64 >, - 0, + 1.e5, LEVEL_0, WRITE_AND_READ, "Penalty coefficients" ); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp index 7c291b0f899..3c705d63352 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp @@ -79,7 +79,8 @@ class ALM : CRSMatrixView< real64, globalIndex const > const inputMatrix, arrayView1d< real64 > const inputRhs, real64 const inputDt, - arrayView1d< localIndex const > const & faceElementList ): + arrayView1d< localIndex const > const & faceElementList, + bool const isStickState ): Base( nodeManager, edgeManager, faceManager, @@ -94,7 +95,8 @@ class ALM : inputRhs, inputDt, faceElementList ), - m_traction( elementSubRegion.getField< fields::contact::traction >().toViewConst()) + m_traction( elementSubRegion.getField< fields::contact::traction >().toViewConst()), + m_isStickState( isStickState) {} //*************************************************************************** @@ -224,15 +226,31 @@ class ALM : // The minus sign is consistent with the sign of the Jacobian stack.localPenalty[0][0] = -m_penalty( k, 0 ); - stack.localPenalty[1][1] = -m_penalty( k, 1 ); - stack.localPenalty[2][2] = -m_penalty( k, 1 ); + if (m_isStickState) + { + stack.localPenalty[1][1] = -m_penalty( k, 1 ); + stack.localPenalty[2][2] = -m_penalty( k, 1 ); + } + else + { + stack.localPenalty[1][1] = 0.0; + stack.localPenalty[2][2] = 0.0; + } for( int i=0; i const m_traction; + bool const m_isStickState; + }; /// The factory used to construct the kernel. @@ -378,8 +398,8 @@ using ALMFactory = finiteElement::InterfaceKernelFactory< ALM, CRSMatrixView< real64, globalIndex const > const, arrayView1d< real64 > const, real64 const, - arrayView1d< localIndex const > const >; - + arrayView1d< localIndex const > const, + bool const >; /** * @brief A struct to compute rotation matrices diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index 7f73a773bda..f463715bea7 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -23,6 +23,9 @@ #include "physicsSolvers/contact/SolidMechanicsALMJumpUpdateKernels.hpp" #include "physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp" +#include "constitutive/ConstitutiveManager.hpp" +#include "constitutive/contact/ContactSelector.hpp" + namespace geos { @@ -113,6 +116,12 @@ void SolidMechanicsAugmentedLagrangianContact::registerDataOnMesh( dataRepositor setRegisteringObjects( this->getName()). setDescription( "An array that holds the sliding tolerance." ); + subRegion.registerWrapper< array2d< real64 > >( viewKeyStruct::dispJumpUpdPenaltyString() ). + setPlotLevel( PlotLevel::NOPLOT ). + setRegisteringObjects( this->getName()). + setDescription( "An array that stores the displacement jumps used to update the penalty coefficients." ). + reference().resizeDimension< 1 >( 3 ); + } ); } ); @@ -167,9 +176,12 @@ void SolidMechanicsAugmentedLagrangianContact::setupSystem( DomainPartition & do GEOS_MARK_FUNCTION; GEOS_UNUSED_VAR( setSparsity ); - // Create the list of interface elements that have same type. + // Create the lists of interface elements that have same type. createFaceTypeList( domain ); + // Create the lists of interface elements that have same type and same fracture state. + updateStickSlipList( domain ); + // Create the list of cell elements that they are enriched with bubble functions. createBubbleCellList( domain ); @@ -248,6 +260,21 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & elemsToFaces, rotationMatrix ); + + // Set the tollerances + computeTolerances( domain ); + + // Set array to update penalty coefficients + arrayView2d< real64 > const dispJumpUpdPenalty = + subRegion.getReference< array2d< real64 > >( viewKeyStruct::dispJumpUpdPenaltyString() ); + + arrayView1d< real64 const > const normalDisplacementTolerance = + subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalDisplacementToleranceString() ); + arrayView1d< real64 > const & slidingTolerance = + subRegion.getReference< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ); + arrayView1d< real64 const > const & normalTractionTolerance = + subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ); + arrayView2d< real64 > const penalty = subRegion.getField< fields::contact::penalty >().toView(); @@ -256,13 +283,21 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const k ) { penalty[k] [0] = 1.e+7; - penalty[k] [1] = 1.e+7; + //penalty[k] [1] = 1.e+6; + + //penalty[k] [0] = normalTractionTolerance[k]/(normalDisplacementTolerance[k]); + penalty[k] [1] = penalty[k] [0] / 10; + std::cout << "penalty: " << penalty[k][0] << " " << penalty[k][1] << " " + << "normalTol: " << normalDisplacementTolerance[k] << " " + << "slidingTol: " << slidingTolerance[k] << " " + << "tractionTol: " << normalTractionTolerance[k] << " " + << std::endl; + + LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); } ); } ); - // Set the tollerances - computeTolerances( domain ); } void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time, @@ -307,19 +342,52 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time string const & fractureRegionName = this->getUniqueFractureRegionName(); - forFiniteElementOnFractureSubRegions( meshName, [&] ( string const & finiteElementName, - arrayView1d< localIndex const > const & faceElementList ) + forFiniteElementOnStickFractureSubRegions( meshName, [&] ( string const & , + finiteElement::FiniteElementBase const & subRegionFE, + arrayView1d< localIndex const > const & faceElementList, + bool const isStickState ) { - finiteElement::FiniteElementBase & subRegionFE = *(m_faceTypeToFiniteElements[finiteElementName]); + //finiteElement::FiniteElementBase & subRegionFE = *(m_faceTypeToFiniteElements[finiteElementName]); + //bool isStickState = true; solidMechanicsALMKernels::ALMFactory kernelFactory( dispDofNumber, bubbleDofNumber, dofManager.rankOffset(), localMatrix, localRhs, dt, - faceElementList ); + faceElementList, + isStickState ); + + real64 maxTraction = finiteElement:: + interfaceBasedKernelApplication + < parallelDevicePolicy< >, + constitutive::NullModel >( mesh, + fractureRegionName, + faceElementList, + subRegionFE, + "", + kernelFactory ); + + GEOS_UNUSED_VAR( maxTraction ); + + } ); + + forFiniteElementOnSlipFractureSubRegions( meshName, [&] ( string const & , + finiteElement::FiniteElementBase const & subRegionFE, + arrayView1d< localIndex const > const & faceElementList, + bool const isStickState ) + { + + solidMechanicsALMKernels::ALMFactory kernelFactory( dispDofNumber, + bubbleDofNumber, + dofManager.rankOffset(), + localMatrix, + localRhs, + dt, + faceElementList, + isStickState ); real64 maxTraction = finiteElement:: interfaceBasedKernelApplication @@ -398,10 +466,15 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepComplete( real64 cons arrayView2d< real64 > const oldDispJump = subRegion.getField< contact::oldDispJump >(); arrayView2d< real64 > const deltaDispJump = subRegion.getField< contact::deltaDispJump >(); + arrayView1d< integer const > const fractureState = subRegion.getField< contact::fractureState >(); + arrayView1d< integer > const oldFractureState = subRegion.getField< contact::oldFractureState >(); + + forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const kfe ) { LvArray::tensorOps::fill< 3 >( deltaDispJump[kfe], 0.0 ); LvArray::tensorOps::copy< 3 >( oldDispJump[kfe], dispJump[kfe] ); + oldFractureState[kfe] = fractureState[kfe]; } ); } ); @@ -626,12 +699,16 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit FaceElementSubRegion & subRegion ) { + string const & contactRelationName = subRegion.template getReference< string >( viewKeyStruct::contactRelationNameString() ); + ContactBase const & contact = getConstitutiveModel< ContactBase >( subRegion, contactRelationName ); + arrayView1d< integer const > const & ghostRank = subRegion.ghostRank(); arrayView2d< real64 const > const traction = subRegion.getField< contact::traction >(); arrayView2d< real64 const > const dispJump = subRegion.getField< contact::dispJump >(); arrayView2d< real64 const > const deltaDispJump = subRegion.getField< contact::deltaDispJump >(); arrayView2d< real64 const > const penalty = subRegion.getField< contact::penalty >(); + arrayView1d< integer const > const fractureState = subRegion.getField< contact::fractureState >(); arrayView1d< real64 const > const normalDisplacementTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalDisplacementToleranceString() ); @@ -646,65 +723,116 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit // TODO: Create a Kernel to update Traction forAll< parallelHostPolicy >( subRegion.size(), - [ traction_new_v, traction, penalty, dispJump, deltaDispJump ] ( localIndex const kfe ) + [ traction_new_v, traction, penalty, + dispJump, deltaDispJump, fractureState ] ( localIndex const kfe ) { real64 eps_N = penalty[kfe][0]; real64 eps_T = penalty[kfe][1]; traction_new_v[kfe][0] = traction[kfe][0] + eps_N * dispJump[kfe][0]; - traction_new_v[kfe][1] = traction[kfe][1] + eps_T * deltaDispJump[kfe][1]; - traction_new_v[kfe][2] = traction[kfe][2] + eps_T * deltaDispJump[kfe][2]; + if (fractureState[kfe] == contact::FractureState::Stick) + { + traction_new_v[kfe][1] = traction[kfe][1] + eps_T * deltaDispJump[kfe][1]; + traction_new_v[kfe][2] = traction[kfe][2] + eps_T * deltaDispJump[kfe][2]; + } } ); - forAll< parallelHostPolicy >( subRegion.size(), - [ &condConv, ghostRank, traction_new_v, normalTractionTolerance, normalDisplacementTolerance, slidingTolerance, deltaDispJump, dispJump ] ( localIndex const kfe ) + + real64 const slidingCheckTolerance = m_slidingCheckTolerance; + constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { - if( ghostRank[kfe] < 0 ) + using ContactType = TYPEOFREF( castedContact ); + typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelWrapper(); + + bool printflag = true; + + forAll< parallelHostPolicy >( subRegion.size(), + [ &condConv, ghostRank, traction_new_v, + normalTractionTolerance, normalDisplacementTolerance, + slidingTolerance, deltaDispJump, dispJump, + fractureState, contactWrapper, slidingCheckTolerance, this, &printflag ] ( localIndex const kfe ) { - if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) - { - GEOS_ERROR( "Unsuported open mode! Only stick mode is supported with ALM" ); - } - else + if( ghostRank[kfe] < 0 ) { - real64 deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + pow( deltaDispJump[kfe][2], 2 )); - if( std::abs( dispJump[kfe][0] ) > normalDisplacementTolerance[kfe] ) + // Case 1: if it is open + if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) { - //GEOS_LOG_LEVEL(2, - //GEOS_FMT( " Element: {}, Stick mode and g_n > tol1 => compenetration, g_n: {:4.2e} tol1: {:4.2e}", - //kfe,std::abs(dispJump[kfe][0]), normalDisplacementTolerance[kfe] )) - condConv = false; + if (fractureState[kfe] != contact::FractureState::Open) + { + if (printflag) + { + GEOS_LOG_LEVEL(2, + GEOS_FMT(" Element: {}, Stick mode and g_n > tol1 => compenetration, g_n: {:4.2e} tol1: {:4.2e}\n", + kfe,std::abs(dispJump[kfe][0]), normalDisplacementTolerance[kfe] )); + printflag = false; + } + condConv = false; + } + traction_new_v[kfe][0] = 0.0; + traction_new_v[kfe][1] = 0.0; + traction_new_v[kfe][2] = 0.0; } - if( deltaDisp > slidingTolerance[kfe] ) + else { - //GEOS_LOG_LEVEL(2, - //GEOS_FMT( " Element: {}, Stick and dg_t > tol2, dg_t: {:4.2e} tol2: {:4.2e}", - //kfe, deltaDisp, slidingTolerance[kfe] )) - condConv = false; + // Case 2: compenetration + real64 deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + pow( deltaDispJump[kfe][2], 2 )); + if( std::abs( dispJump[kfe][0] ) > normalDisplacementTolerance[kfe] ) + { + if (printflag) + { + GEOS_LOG_LEVEL(2, + GEOS_FMT( " Element: {}, Stick mode and g_n > tol1 => compenetration, g_n: {:4.2e} tol1: {:4.2e}", + kfe,std::abs(dispJump[kfe][0]), normalDisplacementTolerance[kfe] )); + printflag = false; + } + condConv = false; + } + // Case 3: it is stick and dg is greater than 0 + if( fractureState[kfe] == contact::FractureState::Stick && + deltaDisp > slidingTolerance[kfe] ) + { + if (printflag) + { + GEOS_LOG_LEVEL(2, + GEOS_FMT( " Element: {}, Stick and dg_t > tol2, dg_t: {:4.2e} tol2: {:4.2e}", + kfe, deltaDisp, slidingTolerance[kfe] )) + printflag = false; + } + condConv = false; + } + + // Case 4: the elastic tangential traction is greater than the limit + real64 currentTau = sqrt( pow(traction_new_v[kfe][1], 2 ) + + pow(traction_new_v[kfe][2], 2 ) ); + + real64 dLimitTangentialTractionNorm_dTraction = 0.0; + real64 const limitTau = + contactWrapper.computeLimitTangentialTractionNorm( traction_new_v[kfe][0], + dLimitTangentialTractionNorm_dTraction ); + + //if( fractureState[kfe] == contact::FractureState::Stick && currentTau >= limitTau ) + //{ + // currentTau *= (1.0 - slidingCheckTolerance); + //} + //else if( fractureState[kfe] != contact::FractureState::Stick && currentTau <= limitTau ) + //{ + // currentTau *= (1.0 + slidingCheckTolerance); + //} + + if( currentTau > limitTau * (1.0 + slidingCheckTolerance) ) + { + if (printflag) + { + GEOS_LOG_LEVEL(2, + GEOS_FMT( " Element: {}, tau > tau_lim, tau: {:4.2e} tauLim: {:4.2e}", + kfe, currentTau, limitTau )) + printflag = false; + } + condConv = false; + } + } } - } - } ); - - } ); - } ); - - forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, - MeshLevel & mesh, - arrayView1d< string const > const & regionNames ) - { - ElementRegionManager & elemManager = mesh.getElemManager(); - - elemManager.forElementSubRegions< FaceElementSubRegion >( regionNames, [&]( localIndex const, - FaceElementSubRegion & subRegion ) - { - - arrayView2d< real64 > const traction_new_v = traction_new.toView(); - arrayView2d< real64 > const traction = subRegion.getField< contact::traction >(); - forAll< parallelHostPolicy >( subRegion.size(), [ traction, traction_new_v ] ( localIndex const kfe ) - { - traction[kfe][0] = traction_new_v( kfe, 0 ); - traction[kfe][1] = traction_new_v( kfe, 1 ); - traction[kfe][2] = traction_new_v( kfe, 2 ); + } ); } ); } ); } ); @@ -714,9 +842,6 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit hasConfigurationConverged = false; } - // Need to synchronize the fracture state due to the use will be made of in AssemblyStabilization - synchronizeFractureState( domain ); - // Compute if globally the fracture state has changed int hasConfigurationConvergedGlobally; MpiWrapper::allReduce( &hasConfigurationConverged, @@ -725,10 +850,310 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit MPI_LAND, MPI_COMM_GEOSX ); + if (hasConfigurationConvergedGlobally) + { + + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, + MeshLevel & mesh, + arrayView1d< string const > const & regionNames ) + { + ElementRegionManager & elemManager = mesh.getElemManager(); + + elemManager.forElementSubRegions< FaceElementSubRegion >( regionNames, [&]( localIndex const, + FaceElementSubRegion & subRegion ) + { + + arrayView1d< integer const > const & ghostRank = subRegion.ghostRank(); + + arrayView2d< real64 > const traction_new_v = traction_new.toView(); + arrayView2d< real64 > const traction = subRegion.getField< contact::traction >(); + + forAll< parallelHostPolicy >( subRegion.size(), [ ghostRank, + traction, traction_new_v ] ( localIndex const kfe ) + { + if( ghostRank[kfe] < 0 ) + { + traction[kfe][0] = traction_new_v( kfe, 0 ); + traction[kfe][1] = traction_new_v( kfe, 1 ); + traction[kfe][2] = traction_new_v( kfe, 2 ); + } + } ); + } ); + } ); + } + else + { + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, + MeshLevel & mesh, + arrayView1d< string const > const & regionNames ) + { + ElementRegionManager & elemManager = mesh.getElemManager(); + + elemManager.forElementSubRegions< FaceElementSubRegion >( regionNames, [&]( localIndex const, + FaceElementSubRegion & subRegion ) + { + + string const & contactRelationName = subRegion.template getReference< string >( viewKeyStruct::contactRelationNameString() ); + ContactBase const & contact = getConstitutiveModel< ContactBase >( subRegion, contactRelationName ); + + arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); + + arrayView2d< real64 > const traction_new_v = traction_new.toView(); + arrayView2d< real64 > const traction = subRegion.getField< contact::traction >(); + + arrayView1d< real64 const > const normalTractionTolerance = + subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ); + + arrayView1d< real64 const > const slidingTolerance = + subRegion.getReference< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ); + + arrayView2d< real64 > const penalty = subRegion.getField< fields::contact::penalty >().toView(); + + arrayView2d< real64 > const dispJumpUpdPenalty = + subRegion.getReference< array2d< real64 > >( viewKeyStruct::dispJumpUpdPenaltyString() ); + + arrayView1d< integer > const fractureState = subRegion.getField< contact::fractureState >(); + + arrayView2d< real64 const > const dispJump = subRegion.getField< contact::dispJump >(); + + arrayView2d< real64 const > const deltaDispJump = subRegion.getField< contact::deltaDispJump >(); + + forAll< parallelHostPolicy >( subRegion.size(), + [ traction_new_v, traction, penalty, dispJump, deltaDispJump ] ( localIndex const kfe ) + { + real64 eps_N = penalty[kfe][0]; + real64 eps_T = penalty[kfe][1]; + traction_new_v[kfe][0] = traction[kfe][0] + eps_N * dispJump[kfe][0]; + traction_new_v[kfe][1] = traction[kfe][1] + eps_T * deltaDispJump[kfe][1]; + traction_new_v[kfe][2] = traction[kfe][2] + eps_T * deltaDispJump[kfe][2]; + } ); + + real64 const slidingCheckTolerance = m_slidingCheckTolerance; + constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) + { + using ContactType = TYPEOFREF( castedContact ); + typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelWrapper(); + + forAll< parallelHostPolicy >( subRegion.size(), [ ghostRank, + contactWrapper, + normalTractionTolerance, slidingTolerance, + slidingCheckTolerance, + dispJumpUpdPenalty, penalty, + fractureState, + dispJump, deltaDispJump, + traction, traction_new_v ] ( localIndex const kfe ) + { + + if( ghostRank[kfe] < 0 ) + { + //integer const originalFractureState = fractureState[kfe]; + + // Case 1: if it is open + if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) + { + //GEOS_ERROR( "Unsuported open mode! Only stick mode is supported with ALM" ); + //std::cout << "Case 1 " << traction_new_v[kfe][0] << " " << normalTractionTolerance[kfe] << std::endl; + fractureState[kfe] = contact::FractureState::Open; + traction_new_v[kfe][0] = 0.0; + traction_new_v[kfe][1] = 0.0; + traction_new_v[kfe][2] = 0.0; + } + else + { + // Case 2: If the normal stress is zero, + // then the tangential stress is also zero. + if (std::abs(traction_new_v[kfe][0]) < 0.1*normalTractionTolerance[kfe]) + { + //std::cout << "Case 2 " << traction_new_v[kfe][0] << " " << normalTractionTolerance[kfe] << std::endl; + fractureState[kfe] = contact::FractureState::Open; + traction_new_v[kfe][0] = 0.0; + traction_new_v[kfe][1] = 0.0; + traction_new_v[kfe][2] = 0.0; + } + else + { + traction[kfe][0] = traction_new_v( kfe, 0 ); + // Update the penalty coefficient to accelerate the convergence + if (std::abs(dispJump[kfe][0]) > 0.25 * std::abs(dispJumpUpdPenalty[kfe][0])) + { + penalty[kfe][0] *= 10.0; + } + + real64 currentTau = sqrt( pow(traction_new_v[kfe][1], 2 ) + + pow(traction_new_v[kfe][2], 2 ) ); + + real64 dLimitTangentialTractionNorm_dTraction = 0.0; + real64 const limitTau = + contactWrapper.computeLimitTangentialTractionNorm( traction[kfe][0], + dLimitTangentialTractionNorm_dTraction ); + + real64 const LimitTangentialTractionNorm_TangentialTractionNorm = limitTau / currentTau; + + //if( originalFractureState == contact::FractureState::Stick && currentTau >= limitTau ) + //{ + // currentTau *= (1.0 - slidingCheckTolerance); + //} + //else if( originalFractureState != contact::FractureState::Stick && currentTau <= limitTau ) + //{ + // currentTau *= (1.0 + slidingCheckTolerance); + //} + + // Case 3: if it is slip + if( currentTau >= limitTau ) + { + //if( originalFractureState == contact::FractureState::Stick ) + //{ + // fractureState[kfe] = contact::FractureState::NewSlip; + //} + //else + //{ + fractureState[kfe] = contact::FractureState::Slip; + //} + + traction[kfe][1] = traction_new_v( kfe, 1 ) * LimitTangentialTractionNorm_TangentialTractionNorm; + traction[kfe][2] = traction_new_v( kfe, 2 ) * LimitTangentialTractionNorm_TangentialTractionNorm; + + //real64 currentTau_1 = sqrt( pow(traction[kfe][1], 2 ) + + // pow(traction[kfe][2], 2 ) ); + //std::cout << "currentTau_1: " << currentTau_1 << " limitTau: " << limitTau << std::endl; + } + // Case 4: if it is stick + else + { + fractureState[kfe] = contact::FractureState::Stick; + traction[kfe][1] = traction_new_v( kfe, 1 ); + traction[kfe][2] = traction_new_v( kfe, 2 ); + + // Update the penalty coefficient to accelerate the convergence + real64 const deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + + pow( deltaDispJump[kfe][2], 2 )); + real64 const deltaDispUpdPenalty = sqrt( pow( dispJumpUpdPenalty[kfe][1], 2 ) + + pow( dispJumpUpdPenalty[kfe][2], 2 )); + + if ( deltaDisp > 0.25 * deltaDispUpdPenalty) + { + //std::cout << kfe << " " << deltaDisp << " " << deltaDisp << " " << slidingTolerance[kfe] << " " << penalty[kfe][1]<< std::endl; + penalty[kfe][1] *= 10.0; + } + } + } + } + } + } ); + } ); + + forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const kfe ) + { + dispJumpUpdPenalty[kfe][0] = dispJump[kfe][0]; + dispJumpUpdPenalty[kfe][1] = deltaDispJump[kfe][1]; + dispJumpUpdPenalty[kfe][2] = deltaDispJump[kfe][2]; + } ); + } ); + } ); + } + + // Need to synchronize the fracture state due to the use will be made of in AssemblyStabilization + synchronizeFractureState( domain ); + + // Update lists of stick and slip elements + if (!hasConfigurationConvergedGlobally) + { + updateStickSlipList( domain ); + + } + return hasConfigurationConvergedGlobally; } +void SolidMechanicsAugmentedLagrangianContact::updateStickSlipList( DomainPartition const & domain ) +{ + + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const & meshName, + MeshLevel const & mesh, + arrayView1d< string const > const & ) + + { + + ElementRegionManager const & elemManager = mesh.getElemManager(); + SurfaceElementRegion const & region = elemManager.getRegion< SurfaceElementRegion >( getUniqueFractureRegionName() ); + FaceElementSubRegion const & subRegion = region.getUniqueSubRegion< FaceElementSubRegion >(); + + arrayView1d< integer const > const fractureState = subRegion.getField< contact::fractureState >(); + + forFiniteElementOnFractureSubRegions( meshName, [&] ( string const & finiteElementName, + arrayView1d< localIndex const > const & faceElementList ) + { + + array1d< localIndex > keys( subRegion.size()); + array1d< localIndex > vals( subRegion.size()); + array1d< localIndex > stickList; + array1d< localIndex > slipList; + RAJA::ReduceSum< ReducePolicy< parallelDevicePolicy<> >, localIndex > nStick_r( 0 ); + RAJA::ReduceSum< ReducePolicy< parallelDevicePolicy<> >, localIndex > nSlip_r( 0 ); + + arrayView1d< localIndex > const keys_v = keys.toView(); + arrayView1d< localIndex > const vals_v = vals.toView(); + forAll< parallelDevicePolicy<> >( faceElementList.size(), + [ nStick_r, nSlip_r, + fractureState, faceElementList, + keys_v, vals_v ] + GEOS_HOST_DEVICE ( localIndex const kfe ) + { + + localIndex const faceIndex = faceElementList[kfe]; + if( fractureState[faceIndex] == contact::FractureState::Stick ) + { + keys_v[kfe]=0; + vals_v[kfe]=kfe; + nStick_r += 1; + } + else if (( fractureState[faceIndex] == contact::FractureState::Slip ) || + (fractureState[faceIndex] == contact::FractureState::NewSlip)) + { + keys_v[kfe]=1; + vals_v[kfe]=kfe; + nSlip_r += 1; + } + + } ); + + localIndex nStick = static_cast< localIndex >(nStick_r.get()); + localIndex nSlip = static_cast< localIndex >(nSlip_r.get()); + + // Sort vals according to keys to ensure that + // elements of the same type are adjacent in the vals list. + // This arrangement allows for efficient copying into the container + // by leveraging parallelism. + RAJA::sort_pairs< parallelDevicePolicy<> >( keys_v, vals_v ); + + stickList.resize( nStick ); + slipList.resize( nSlip ); + arrayView1d< localIndex > const stickList_v = stickList.toView(); + arrayView1d< localIndex > const slipList_v = slipList.toView(); + + forAll< parallelDevicePolicy<> >( nStick, [stickList_v, vals_v] + GEOS_HOST_DEVICE ( localIndex const kfe ) + { + stickList_v[kfe] = vals_v[kfe]; + } ); + + forAll< parallelDevicePolicy<> >( nSlip, [slipList_v, vals_v, nStick] + GEOS_HOST_DEVICE ( localIndex const kfe ) + { + slipList_v[kfe] = vals_v[nStick+kfe]; + } ); + + this->m_faceTypesToFaceElementsStick[meshName][finiteElementName] = stickList; + this->m_faceTypesToFaceElementsSlip[meshName][finiteElementName] = slipList; + + std::cout << "nStick: " << nStick << std::endl; + std::cout << "nSlip: " << nSlip << std::endl; + } ); + } ); + +} + void SolidMechanicsAugmentedLagrangianContact::createFaceTypeList( DomainPartition const & domain ) { @@ -1329,9 +1754,9 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio LvArray::tensorOps::scale< 3, 3 >( rotatedInvStiffApprox, area ); // Finally, compute tolerances for the given fracture element - normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+8; + normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+7; slidingTolerance[kfe] = sqrt( rotatedInvStiffApprox[ 1 ][ 1 ] * rotatedInvStiffApprox[ 1 ][ 1 ] + - rotatedInvStiffApprox[ 2 ][ 2 ] * rotatedInvStiffApprox[ 2 ][ 2 ] ) * averageYoungModulus / 2.e+8; + rotatedInvStiffApprox[ 2 ][ 2 ] * rotatedInvStiffApprox[ 2 ][ 2 ] ) * averageYoungModulus / 2.e+7; normalTractionTolerance[kfe] = 1.0 / 2.0 * averageConstrainedModulus / averageBoxSize0 * normalDisplacementTolerance[kfe]; } } ); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp index 688837ac9fc..57143448668 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp @@ -112,6 +112,68 @@ class SolidMechanicsAugmentedLagrangianContact : public ContactSolverBase } + /** + * @brief Loop over the finite element type on the stick fracture subregions of meshName and apply callback. + * @tparam LAMBDA The callback function type + * @param meshName The mesh name. + * @param lambda The callback function. Take the finite element type name and + * the list of face element of the same type. + */ + template< typename LAMBDA > + void forFiniteElementOnStickFractureSubRegions( string const & meshName, LAMBDA && lambda ) const + { + + bool const isStickState = true; + + std::map< string, array1d< localIndex > > const & + faceTypesToFaceElements = m_faceTypesToFaceElementsStick.at( meshName ); + + for( const auto & [finiteElementName, faceElementList] : faceTypesToFaceElements ) + { + arrayView1d< localIndex const > const faceElemList = faceElementList.toViewConst(); + + finiteElement::FiniteElementBase const & subRegionFE = *(m_faceTypeToFiniteElements.at(finiteElementName)); + + lambda( finiteElementName, subRegionFE, faceElemList, isStickState ); + } + + } + + /** + * @brief Loop over the finite element type on the slip fracture subregions of meshName and apply callback. + * @tparam LAMBDA The callback function type + * @param meshName The mesh name. + * @param lambda The callback function. Take the finite element type name and + * the list of face element of the same type. + */ + template< typename LAMBDA > + void forFiniteElementOnSlipFractureSubRegions( string const & meshName, LAMBDA && lambda ) const + { + + bool const isStickState = false; + + std::map< string, array1d< localIndex > > const & + faceTypesToFaceElements = m_faceTypesToFaceElementsSlip.at( meshName ); + + for( const auto & [finiteElementName, faceElementList] : faceTypesToFaceElements ) + { + arrayView1d< localIndex const > const faceElemList = faceElementList.toViewConst(); + + finiteElement::FiniteElementBase const & subRegionFE = *(m_faceTypeToFiniteElements.at(finiteElementName)); + + lambda( finiteElementName, subRegionFE, faceElemList, isStickState ); + } + + } + + /** + * @brief Create the list of finite elements of the same type + * for each FaceElementSubRegion (Triangle or Quadrilateral) + * and of the same fracture state (Stick or Slip). + * @param domain The physical domain object + */ + void updateStickSlipList( DomainPartition const & domain ); + /** * @brief Create the list of finite elements of the same type * for each FaceElementSubRegion (Triangle or Quadrilateral). @@ -154,6 +216,12 @@ class SolidMechanicsAugmentedLagrangianContact : public ContactSolverBase /// Finite element type to face element index map std::map< string, std::map< string, array1d< localIndex > > > m_faceTypesToFaceElements; + /// Finite element type to face element index map (stick mode) + std::map< string, std::map< string, array1d< localIndex > > > m_faceTypesToFaceElementsStick; + + /// Finite element type to face element index map (slip mode) + std::map< string, std::map< string, array1d< localIndex > > > m_faceTypesToFaceElementsSlip; + /// Finite element type to finite element object map std::map< string, std::unique_ptr< geos::finiteElement::FiniteElementBase > > m_faceTypeToFiniteElements; @@ -165,8 +233,12 @@ class SolidMechanicsAugmentedLagrangianContact : public ContactSolverBase constexpr static char const * normalTractionToleranceString() { return "normalTractionTolerance"; } constexpr static char const * slidingToleranceString() { return "slidingTolerance"; } + + constexpr static char const * dispJumpUpdPenaltyString() { return "dispJumpUpdPenalty"; } }; + real64 const m_slidingCheckTolerance = 0.05; + }; } /* namespace geos */ From 37ff3d0a46018ca8443e2bd67aeeb4866ac9d228 Mon Sep 17 00:00:00 2001 From: Matteo Frigo Date: Tue, 16 Jul 2024 10:55:21 -0700 Subject: [PATCH 02/41] Debuging slip mode --- ...rlock-gcc10-ompi4.1.2-openblas0.3.10.cmake | 2 +- ...lidMechanicsAugmentedLagrangianContact.cpp | 31 ++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/host-configs/Stanford/sherlock-gcc10-ompi4.1.2-openblas0.3.10.cmake b/host-configs/Stanford/sherlock-gcc10-ompi4.1.2-openblas0.3.10.cmake index 2fb9add4657..0f1a8120e2e 100644 --- a/host-configs/Stanford/sherlock-gcc10-ompi4.1.2-openblas0.3.10.cmake +++ b/host-configs/Stanford/sherlock-gcc10-ompi4.1.2-openblas0.3.10.cmake @@ -40,5 +40,5 @@ set(LAPACK_LIBRARIES "${OPENBLAS_ROOT}/lib/libopenblas.so" CACHE STRING "") set(ENABLE_VALGRIND OFF CACHE BOOL "") set(ENABLE_CALIPER ON CACHE BOOL "") -set(GEOSX_TPL_DIR "$ENV{GEOSX_TPL_DIR}" CACHE PATH "" FORCE) +set(GEOSX_TPL_DIR "${GEOSX_TPL_DIR}" CACHE PATH "" FORCE) include(${CMAKE_CURRENT_LIST_DIR}/../tpls.cmake) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index f463715bea7..f2b061c3d0b 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -729,10 +729,12 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit real64 eps_N = penalty[kfe][0]; real64 eps_T = penalty[kfe][1]; traction_new_v[kfe][0] = traction[kfe][0] + eps_N * dispJump[kfe][0]; + traction_new_v[kfe][1] = traction[kfe][1]; + traction_new_v[kfe][2] = traction[kfe][2]; if (fractureState[kfe] == contact::FractureState::Stick) { - traction_new_v[kfe][1] = traction[kfe][1] + eps_T * deltaDispJump[kfe][1]; - traction_new_v[kfe][2] = traction[kfe][2] + eps_T * deltaDispJump[kfe][2]; + traction_new_v[kfe][1] += eps_T * deltaDispJump[kfe][1]; + traction_new_v[kfe][2] += eps_T * deltaDispJump[kfe][2]; } } ); @@ -761,8 +763,8 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit if (printflag) { GEOS_LOG_LEVEL(2, - GEOS_FMT(" Element: {}, Stick mode and g_n > tol1 => compenetration, g_n: {:4.2e} tol1: {:4.2e}\n", - kfe,std::abs(dispJump[kfe][0]), normalDisplacementTolerance[kfe] )); + GEOS_FMT(" Element: {}, traction_n > tol4 => open, traction_n: {:4.2e} tol4: {:4.2e}\n", + kfe,traction_new_v[kfe][0], normalTractionTolerance[kfe] )); printflag = false; } condConv = false; @@ -818,8 +820,10 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit // currentTau *= (1.0 + slidingCheckTolerance); //} - if( currentTau > limitTau * (1.0 + slidingCheckTolerance) ) + if( currentTau > (std::abs(limitTau) * (1.0 + slidingCheckTolerance)) ) { + //std::cout << currentTau << " " << limitTau << " " << (1.0 + slidingCheckTolerance) << std::endl; + if (printflag) { GEOS_LOG_LEVEL(2, @@ -947,7 +951,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit if( ghostRank[kfe] < 0 ) { //integer const originalFractureState = fractureState[kfe]; - + // Case 1: if it is open if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) { @@ -962,9 +966,10 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit { // Case 2: If the normal stress is zero, // then the tangential stress is also zero. - if (std::abs(traction_new_v[kfe][0]) < 0.1*normalTractionTolerance[kfe]) + //if (std::abs(traction_new_v[kfe][0]) < 0.001*normalTractionTolerance[kfe]) + if (std::abs(traction_new_v[kfe][0]) < 1.e-16*normalTractionTolerance[kfe]) { - //std::cout << "Case 2 " << traction_new_v[kfe][0] << " " << normalTractionTolerance[kfe] << std::endl; + std::cout << "Case 2 " << traction_new_v[kfe][0] << " " << normalTractionTolerance[kfe] << std::endl; fractureState[kfe] = contact::FractureState::Open; traction_new_v[kfe][0] = 0.0; traction_new_v[kfe][1] = 0.0; @@ -974,10 +979,12 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit { traction[kfe][0] = traction_new_v( kfe, 0 ); // Update the penalty coefficient to accelerate the convergence + /* if (std::abs(dispJump[kfe][0]) > 0.25 * std::abs(dispJumpUpdPenalty[kfe][0])) { penalty[kfe][0] *= 10.0; } + */ real64 currentTau = sqrt( pow(traction_new_v[kfe][1], 2 ) + pow(traction_new_v[kfe][2], 2 ) ); @@ -987,7 +994,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit contactWrapper.computeLimitTangentialTractionNorm( traction[kfe][0], dLimitTangentialTractionNorm_dTraction ); - real64 const LimitTangentialTractionNorm_TangentialTractionNorm = limitTau / currentTau; + real64 const LimitTangentialTractionNorm_TangentialTractionNorm = std::abs(limitTau) / currentTau; //if( originalFractureState == contact::FractureState::Stick && currentTau >= limitTau ) //{ @@ -999,7 +1006,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit //} // Case 3: if it is slip - if( currentTau >= limitTau ) + if( currentTau >= (std::abs(limitTau) * (1.0 + slidingCheckTolerance)) ) { //if( originalFractureState == contact::FractureState::Stick ) //{ @@ -1025,6 +1032,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit traction[kfe][2] = traction_new_v( kfe, 2 ); // Update the penalty coefficient to accelerate the convergence + /* real64 const deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + pow( deltaDispJump[kfe][2], 2 )); real64 const deltaDispUpdPenalty = sqrt( pow( dispJumpUpdPenalty[kfe][1], 2 ) + @@ -1035,6 +1043,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit //std::cout << kfe << " " << deltaDisp << " " << deltaDisp << " " << slidingTolerance[kfe] << " " << penalty[kfe][1]<< std::endl; penalty[kfe][1] *= 10.0; } + */ } } } @@ -1756,7 +1765,7 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio // Finally, compute tolerances for the given fracture element normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+7; slidingTolerance[kfe] = sqrt( rotatedInvStiffApprox[ 1 ][ 1 ] * rotatedInvStiffApprox[ 1 ][ 1 ] + - rotatedInvStiffApprox[ 2 ][ 2 ] * rotatedInvStiffApprox[ 2 ][ 2 ] ) * averageYoungModulus / 2.e+7; + rotatedInvStiffApprox[ 2 ][ 2 ] * rotatedInvStiffApprox[ 2 ][ 2 ] ) * averageYoungModulus / 2.e+6; normalTractionTolerance[kfe] = 1.0 / 2.0 * averageConstrainedModulus / averageBoxSize0 * normalDisplacementTolerance[kfe]; } } ); From bff56026a00379ea547e91092e8d9aaad9798e02 Mon Sep 17 00:00:00 2001 From: mfrigo Date: Wed, 17 Jul 2024 18:32:19 -0700 Subject: [PATCH 03/41] Adding a new inputFile for ALM and bug (bubble functions) fixed --- .../ALM_slipFault_base.xml | 112 ++++++++++++++++++ .../ALM_slipFault_vertical_smoke.xml | 110 +++++++++++++++++ .../elementFormulations/LagrangeBasis1.hpp | 16 +-- ...lidMechanicsAugmentedLagrangianContact.cpp | 39 ++++-- 4 files changed, 260 insertions(+), 17 deletions(-) create mode 100644 inputFiles/almContactMechanics/ALM_slipFault_base.xml create mode 100644 inputFiles/almContactMechanics/ALM_slipFault_vertical_smoke.xml diff --git a/inputFiles/almContactMechanics/ALM_slipFault_base.xml b/inputFiles/almContactMechanics/ALM_slipFault_base.xml new file mode 100644 index 00000000000..9a72a4919fa --- /dev/null +++ b/inputFiles/almContactMechanics/ALM_slipFault_base.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/almContactMechanics/ALM_slipFault_vertical_smoke.xml b/inputFiles/almContactMechanics/ALM_slipFault_vertical_smoke.xml new file mode 100644 index 00000000000..1e11f4bd806 --- /dev/null +++ b/inputFiles/almContactMechanics/ALM_slipFault_vertical_smoke.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/coreComponents/finiteElement/elementFormulations/LagrangeBasis1.hpp b/src/coreComponents/finiteElement/elementFormulations/LagrangeBasis1.hpp index 73871c9b511..d8c642d7d22 100644 --- a/src/coreComponents/finiteElement/elementFormulations/LagrangeBasis1.hpp +++ b/src/coreComponents/finiteElement/elementFormulations/LagrangeBasis1.hpp @@ -421,11 +421,11 @@ class LagrangeBasis1 { for( int a=0; a<2; ++a ) { - N[ a*5 ] = LagrangeBasis1::valueBubble( coords[0] ) * + N[ a*4+1 ] = LagrangeBasis1::valueBubble( coords[0] ) * LagrangeBasis1::valueBubble( coords[1] ) * LagrangeBasis1::value( a, coords[2] ); - N[ a*3+1 ] = LagrangeBasis1::valueBubble( coords[0] ) * + N[ a*4 ] = LagrangeBasis1::valueBubble( coords[0] ) * LagrangeBasis1::value( a, coords[1] ) * LagrangeBasis1::valueBubble( coords[2] ); @@ -449,23 +449,23 @@ class LagrangeBasis1 { for( int a=0; a<2; ++a ) { - dNdXi[ a*5 ][0] = LagrangeBasis1::gradientBubble( coords[0] ) * + dNdXi[ a*4+1 ][0] = LagrangeBasis1::gradientBubble( coords[0] ) * LagrangeBasis1::valueBubble( coords[1] ) * LagrangeBasis1::value( a, coords[2] ); - dNdXi[ a*5 ][1] = LagrangeBasis1::valueBubble( coords[0] ) * + dNdXi[ a*4+1 ][1] = LagrangeBasis1::valueBubble( coords[0] ) * LagrangeBasis1::gradientBubble( coords[1] ) * LagrangeBasis1::value( a, coords[2] ); - dNdXi[ a*5 ][2] = LagrangeBasis1::valueBubble( coords[0] ) * + dNdXi[ a*4+1 ][2] = LagrangeBasis1::valueBubble( coords[0] ) * LagrangeBasis1::valueBubble( coords[1] ) * LagrangeBasis1::gradient( a, coords[2] ); - dNdXi[ a*3+1 ][0] = LagrangeBasis1::gradientBubble( coords[0] ) * + dNdXi[ a*4 ][0] = LagrangeBasis1::gradientBubble( coords[0] ) * LagrangeBasis1::value( a, coords[1] ) * LagrangeBasis1::valueBubble( coords[2] ); - dNdXi[ a*3+1 ][1] = LagrangeBasis1::valueBubble( coords[0] ) * + dNdXi[ a*4 ][1] = LagrangeBasis1::valueBubble( coords[0] ) * LagrangeBasis1::gradient( a, coords[1] ) * LagrangeBasis1::valueBubble( coords[2] ); - dNdXi[ a*3+1 ][2] = LagrangeBasis1::valueBubble( coords[0] ) * + dNdXi[ a*4 ][2] = LagrangeBasis1::valueBubble( coords[0] ) * LagrangeBasis1::value( a, coords[1] ) * LagrangeBasis1::gradientBubble( coords[2] ); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index f2b061c3d0b..81fb4ba350b 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -283,7 +283,7 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const k ) { penalty[k] [0] = 1.e+7; - //penalty[k] [1] = 1.e+6; + //penalty[k] [1] = 1.e+7; //penalty[k] [0] = normalTractionTolerance[k]/(normalDisplacementTolerance[k]); penalty[k] [1] = penalty[k] [0] / 10; @@ -908,6 +908,9 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit arrayView1d< real64 const > const normalTractionTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ); + arrayView1d< real64 const > const normalDisplacementTolerance = + subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalDisplacementToleranceString() ); + arrayView1d< real64 const > const slidingTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ); @@ -941,6 +944,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit forAll< parallelHostPolicy >( subRegion.size(), [ ghostRank, contactWrapper, normalTractionTolerance, slidingTolerance, + normalDisplacementTolerance, slidingCheckTolerance, dispJumpUpdPenalty, penalty, fractureState, @@ -978,13 +982,20 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit else { traction[kfe][0] = traction_new_v( kfe, 0 ); + // Update the penalty coefficient to accelerate the convergence - /* - if (std::abs(dispJump[kfe][0]) > 0.25 * std::abs(dispJumpUpdPenalty[kfe][0])) + if ((std::abs(dispJump[kfe][0]) > normalDisplacementTolerance[kfe] ) && + (std::abs(dispJump[kfe][0]) > 0.25 * std::abs(dispJumpUpdPenalty[kfe][0]))) { penalty[kfe][0] *= 10.0; + + real64 const eps_N_lim = normalTractionTolerance[kfe]/normalDisplacementTolerance[kfe]; + if (penalty[kfe][0] > eps_N_lim ) + { + penalty[kfe][0] = eps_N_lim; + } + //std::cout << "Upd penalty_N: " << kfe << " " << penalty[kfe][0] << " " << eps_N_lim << std::endl; } - */ real64 currentTau = sqrt( pow(traction_new_v[kfe][1], 2 ) + pow(traction_new_v[kfe][2], 2 ) ); @@ -1032,18 +1043,26 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit traction[kfe][2] = traction_new_v( kfe, 2 ); // Update the penalty coefficient to accelerate the convergence - /* + real64 const deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + pow( deltaDispJump[kfe][2], 2 )); real64 const deltaDispUpdPenalty = sqrt( pow( dispJumpUpdPenalty[kfe][1], 2 ) + pow( dispJumpUpdPenalty[kfe][2], 2 )); - if ( deltaDisp > 0.25 * deltaDispUpdPenalty) + if (( deltaDisp > slidingTolerance[kfe] ) && + ( deltaDisp > 0.25 * deltaDispUpdPenalty)) { - //std::cout << kfe << " " << deltaDisp << " " << deltaDisp << " " << slidingTolerance[kfe] << " " << penalty[kfe][1]<< std::endl; penalty[kfe][1] *= 10.0; + + real64 const eps_T_lim = normalTractionTolerance[kfe]/(slidingTolerance[kfe]*10); + if (penalty[kfe][1] > eps_T_lim ) + { + penalty[kfe][1] = eps_T_lim; + } + //std::cout << "Upd penalty T: " << kfe << " " << deltaDisp << " " << slidingTolerance[kfe] << " " << penalty[kfe][1]<< std::endl; } - */ + + } } } @@ -1252,6 +1271,7 @@ void SolidMechanicsAugmentedLagrangianContact::createBubbleCellList( DomainParti SurfaceElementRegion const & region = elemManager.getRegion< SurfaceElementRegion >( getUniqueFractureRegionName() ); FaceElementSubRegion const & subRegion = region.getUniqueSubRegion< FaceElementSubRegion >(); + // Array to store face indexes array1d< localIndex > tmpSpace( 2*subRegion.size()); SortedArray< localIndex > faceIdList; @@ -1337,6 +1357,7 @@ void SolidMechanicsAugmentedLagrangianContact::createBubbleCellList( DomainParti forAll< parallelDevicePolicy<> >( nBubElems, [ bubbleElemsList_v, keys_v ] GEOS_HOST_DEVICE ( localIndex const k ) { bubbleElemsList_v[k] = keys_v[k]; + //std::cout << bubbleElemsList_v[k] << std::endl; } ); cellElementSubRegion.setBubbleElementsList( bubbleElemsList.toViewConst()); @@ -1765,7 +1786,7 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio // Finally, compute tolerances for the given fracture element normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+7; slidingTolerance[kfe] = sqrt( rotatedInvStiffApprox[ 1 ][ 1 ] * rotatedInvStiffApprox[ 1 ][ 1 ] + - rotatedInvStiffApprox[ 2 ][ 2 ] * rotatedInvStiffApprox[ 2 ][ 2 ] ) * averageYoungModulus / 2.e+6; + rotatedInvStiffApprox[ 2 ][ 2 ] * rotatedInvStiffApprox[ 2 ][ 2 ] ) * averageYoungModulus / 2.e+7; normalTractionTolerance[kfe] = 1.0 / 2.0 * averageConstrainedModulus / averageBoxSize0 * normalDisplacementTolerance[kfe]; } } ); From beff149c73575b067b7228338b80f66e6a9d5b40 Mon Sep 17 00:00:00 2001 From: mfrigo Date: Sun, 4 Aug 2024 19:57:36 -0700 Subject: [PATCH 04/41] Bug bubble functions gradient fixed --- .../elementFormulations/LagrangeBasis1.hpp | 3 +-- .../SolidMechanicsAugmentedLagrangianContact.cpp | 13 ++++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/coreComponents/finiteElement/elementFormulations/LagrangeBasis1.hpp b/src/coreComponents/finiteElement/elementFormulations/LagrangeBasis1.hpp index d8c642d7d22..30f714b0f66 100644 --- a/src/coreComponents/finiteElement/elementFormulations/LagrangeBasis1.hpp +++ b/src/coreComponents/finiteElement/elementFormulations/LagrangeBasis1.hpp @@ -175,8 +175,7 @@ class LagrangeBasis1 GEOS_FORCE_INLINE constexpr static real64 gradientBubble( const real64 xi ) { - GEOS_UNUSED_VAR( xi ); - return -0.5*xi; + return -2.0*xi; } /** diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index 81fb4ba350b..9050c41ee72 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -988,13 +988,15 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit (std::abs(dispJump[kfe][0]) > 0.25 * std::abs(dispJumpUpdPenalty[kfe][0]))) { penalty[kfe][0] *= 10.0; - + /* real64 const eps_N_lim = normalTractionTolerance[kfe]/normalDisplacementTolerance[kfe]; if (penalty[kfe][0] > eps_N_lim ) { penalty[kfe][0] = eps_N_lim; } - //std::cout << "Upd penalty_N: " << kfe << " " << penalty[kfe][0] << " " << eps_N_lim << std::endl; + */ + //std::cout << "Upd penalty_N: " << kfe << " " << penalty[kfe][0] << " ";// << eps_N_lim + //std::cout << std::endl; } real64 currentTau = sqrt( pow(traction_new_v[kfe][1], 2 ) + @@ -1054,11 +1056,13 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit { penalty[kfe][1] *= 10.0; + /* real64 const eps_T_lim = normalTractionTolerance[kfe]/(slidingTolerance[kfe]*10); if (penalty[kfe][1] > eps_T_lim ) { penalty[kfe][1] = eps_T_lim; } + */ //std::cout << "Upd penalty T: " << kfe << " " << deltaDisp << " " << slidingTolerance[kfe] << " " << penalty[kfe][1]<< std::endl; } @@ -1357,7 +1361,6 @@ void SolidMechanicsAugmentedLagrangianContact::createBubbleCellList( DomainParti forAll< parallelDevicePolicy<> >( nBubElems, [ bubbleElemsList_v, keys_v ] GEOS_HOST_DEVICE ( localIndex const k ) { bubbleElemsList_v[k] = keys_v[k]; - //std::cout << bubbleElemsList_v[k] << std::endl; } ); cellElementSubRegion.setBubbleElementsList( bubbleElemsList.toViewConst()); @@ -1784,9 +1787,9 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio LvArray::tensorOps::scale< 3, 3 >( rotatedInvStiffApprox, area ); // Finally, compute tolerances for the given fracture element - normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+7; + normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+8; slidingTolerance[kfe] = sqrt( rotatedInvStiffApprox[ 1 ][ 1 ] * rotatedInvStiffApprox[ 1 ][ 1 ] + - rotatedInvStiffApprox[ 2 ][ 2 ] * rotatedInvStiffApprox[ 2 ][ 2 ] ) * averageYoungModulus / 2.e+7; + rotatedInvStiffApprox[ 2 ][ 2 ] * rotatedInvStiffApprox[ 2 ][ 2 ] ) * averageYoungModulus / 2.e+8; normalTractionTolerance[kfe] = 1.0 / 2.0 * averageConstrainedModulus / averageBoxSize0 * normalDisplacementTolerance[kfe]; } } ); From 5f5bfa357a86bd16e2c556592187c4a530021c2d Mon Sep 17 00:00:00 2001 From: mfrigo Date: Tue, 6 Aug 2024 20:37:44 -0700 Subject: [PATCH 05/41] Updating automatic penalty setting --- ...lidMechanicsAugmentedLagrangianContact.cpp | 101 +++++++++++------- 1 file changed, 63 insertions(+), 38 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index 9050c41ee72..54932d35d2c 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -275,6 +275,9 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & arrayView1d< real64 const > const & normalTractionTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ); + arrayView1d< real64 const > const area = + subRegion.getElementArea().toViewConst(); + arrayView2d< real64 > const penalty = subRegion.getField< fields::contact::penalty >().toView(); @@ -282,15 +285,14 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & // TODO: This is only temporary. The setting of penalty will be adaptive in the final version. forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const k ) { - penalty[k] [0] = 1.e+7; - //penalty[k] [1] = 1.e+7; - //penalty[k] [0] = normalTractionTolerance[k]/(normalDisplacementTolerance[k]); - penalty[k] [1] = penalty[k] [0] / 10; + penalty[k] [0] = normalTractionTolerance[k]/(normalDisplacementTolerance[k]*area[k] ); + penalty[k] [1] = penalty[k][0] * 1.0e-01; std::cout << "penalty: " << penalty[k][0] << " " << penalty[k][1] << " " << "normalTol: " << normalDisplacementTolerance[k] << " " << "slidingTol: " << slidingTolerance[k] << " " << "tractionTol: " << normalTractionTolerance[k] << " " + << "area: " << area[k] << " " << std::endl; LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); @@ -717,6 +719,8 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit arrayView1d< real64 const > const & normalTractionTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ); + arrayView1d< real64 const > const area = subRegion.getElementArea().toViewConst(); + std::ptrdiff_t const sizes[ 2 ] = {subRegion.size(), 3}; traction_new.resize( 2, sizes ); arrayView2d< real64 > const traction_new_v = traction_new.toView(); @@ -750,7 +754,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit forAll< parallelHostPolicy >( subRegion.size(), [ &condConv, ghostRank, traction_new_v, normalTractionTolerance, normalDisplacementTolerance, - slidingTolerance, deltaDispJump, dispJump, + slidingTolerance, deltaDispJump, dispJump, area, fractureState, contactWrapper, slidingCheckTolerance, this, &printflag ] ( localIndex const kfe ) { if( ghostRank[kfe] < 0 ) @@ -777,26 +781,26 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit { // Case 2: compenetration real64 deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + pow( deltaDispJump[kfe][2], 2 )); - if( std::abs( dispJump[kfe][0] ) > normalDisplacementTolerance[kfe] ) + if( std::abs( dispJump[kfe][0]/area[kfe] ) > normalDisplacementTolerance[kfe] ) { if (printflag) { GEOS_LOG_LEVEL(2, GEOS_FMT( " Element: {}, Stick mode and g_n > tol1 => compenetration, g_n: {:4.2e} tol1: {:4.2e}", - kfe,std::abs(dispJump[kfe][0]), normalDisplacementTolerance[kfe] )); + kfe,std::abs(dispJump[kfe][0])/area[kfe], normalDisplacementTolerance[kfe] )); printflag = false; } condConv = false; } // Case 3: it is stick and dg is greater than 0 if( fractureState[kfe] == contact::FractureState::Stick && - deltaDisp > slidingTolerance[kfe] ) + deltaDisp/area[kfe] > slidingTolerance[kfe] ) { if (printflag) { GEOS_LOG_LEVEL(2, GEOS_FMT( " Element: {}, Stick and dg_t > tol2, dg_t: {:4.2e} tol2: {:4.2e}", - kfe, deltaDisp, slidingTolerance[kfe] )) + kfe, deltaDisp/area[kfe], slidingTolerance[kfe] )) printflag = false; } condConv = false; @@ -916,6 +920,8 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit arrayView2d< real64 > const penalty = subRegion.getField< fields::contact::penalty >().toView(); + arrayView1d< real64 const > const area = subRegion.getElementArea().toViewConst(); + arrayView2d< real64 > const dispJumpUpdPenalty = subRegion.getReference< array2d< real64 > >( viewKeyStruct::dispJumpUpdPenaltyString() ); @@ -947,9 +953,9 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit normalDisplacementTolerance, slidingCheckTolerance, dispJumpUpdPenalty, penalty, - fractureState, + fractureState, area, dispJump, deltaDispJump, - traction, traction_new_v ] ( localIndex const kfe ) + traction, traction_new_v, this ] ( localIndex const kfe ) { if( ghostRank[kfe] < 0 ) @@ -962,41 +968,60 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit //GEOS_ERROR( "Unsuported open mode! Only stick mode is supported with ALM" ); //std::cout << "Case 1 " << traction_new_v[kfe][0] << " " << normalTractionTolerance[kfe] << std::endl; fractureState[kfe] = contact::FractureState::Open; - traction_new_v[kfe][0] = 0.0; - traction_new_v[kfe][1] = 0.0; - traction_new_v[kfe][2] = 0.0; + traction[kfe][0] = 0.0; + traction[kfe][1] = 0.0; + traction[kfe][2] = 0.0; } else { // Case 2: If the normal stress is zero, // then the tangential stress is also zero. //if (std::abs(traction_new_v[kfe][0]) < 0.001*normalTractionTolerance[kfe]) - if (std::abs(traction_new_v[kfe][0]) < 1.e-16*normalTractionTolerance[kfe]) + if (std::abs(traction_new_v[kfe][0]) < normalTractionTolerance[kfe]) { - std::cout << "Case 2 " << traction_new_v[kfe][0] << " " << normalTractionTolerance[kfe] << std::endl; - fractureState[kfe] = contact::FractureState::Open; - traction_new_v[kfe][0] = 0.0; - traction_new_v[kfe][1] = 0.0; - traction_new_v[kfe][2] = 0.0; + + GEOS_LOG_LEVEL(2, + GEOS_FMT( "WARNING: The normal stress of element {} is lower than the tolerance, t_n: {:4.2e} tol: {:4.2e}", + kfe, traction_new_v[kfe][0], normalTractionTolerance[kfe] )) + fractureState[kfe] = contact::FractureState::Slip; + traction[kfe][0] = 0.0; + traction[kfe][1] = 0.0; + traction[kfe][2] = 0.0; + + // Update the penalty coefficient to accelerate the convergence + penalty[kfe][0] *= 10.0; + + real64 const eps_N_lim = 1.0e+4*normalTractionTolerance[kfe]/(normalDisplacementTolerance[kfe]*area[kfe]); + //real64 const eps_N_lim = 1.e+10; + if (penalty[kfe][0] > eps_N_lim ) + { + GEOS_LOG_LEVEL(2, + GEOS_FMT( " Element: {}, eps > eps_lim, eps: {:4.2e} epsLim: {:4.2e}", + kfe, penalty[kfe][0], eps_N_lim )) + + penalty[kfe][0] = eps_N_lim; + } } else { traction[kfe][0] = traction_new_v( kfe, 0 ); // Update the penalty coefficient to accelerate the convergence - if ((std::abs(dispJump[kfe][0]) > normalDisplacementTolerance[kfe] ) && + if ((std::abs(dispJump[kfe][0])/area[kfe] > normalDisplacementTolerance[kfe] ) && (std::abs(dispJump[kfe][0]) > 0.25 * std::abs(dispJumpUpdPenalty[kfe][0]))) { penalty[kfe][0] *= 10.0; - /* - real64 const eps_N_lim = normalTractionTolerance[kfe]/normalDisplacementTolerance[kfe]; + + real64 const eps_N_lim = 1.0e+4*normalTractionTolerance[kfe]/(normalDisplacementTolerance[kfe]*area[kfe]); if (penalty[kfe][0] > eps_N_lim ) { + GEOS_LOG_LEVEL(2, + GEOS_FMT( " Element: {}, eps > eps_lim, eps: {:4.2e} epsLim: {:4.2e}", + kfe, penalty[kfe][0], eps_N_lim )) + penalty[kfe][0] = eps_N_lim; } - */ - //std::cout << "Upd penalty_N: " << kfe << " " << penalty[kfe][0] << " ";// << eps_N_lim - //std::cout << std::endl; + } real64 currentTau = sqrt( pow(traction_new_v[kfe][1], 2 ) + @@ -1033,9 +1058,6 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit traction[kfe][1] = traction_new_v( kfe, 1 ) * LimitTangentialTractionNorm_TangentialTractionNorm; traction[kfe][2] = traction_new_v( kfe, 2 ) * LimitTangentialTractionNorm_TangentialTractionNorm; - //real64 currentTau_1 = sqrt( pow(traction[kfe][1], 2 ) + - // pow(traction[kfe][2], 2 ) ); - //std::cout << "currentTau_1: " << currentTau_1 << " limitTau: " << limitTau << std::endl; } // Case 4: if it is stick else @@ -1045,25 +1067,27 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit traction[kfe][2] = traction_new_v( kfe, 2 ); // Update the penalty coefficient to accelerate the convergence - real64 const deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + pow( deltaDispJump[kfe][2], 2 )); real64 const deltaDispUpdPenalty = sqrt( pow( dispJumpUpdPenalty[kfe][1], 2 ) + pow( dispJumpUpdPenalty[kfe][2], 2 )); - if (( deltaDisp > slidingTolerance[kfe] ) && + if (( deltaDisp/area[kfe] > slidingTolerance[kfe] ) && ( deltaDisp > 0.25 * deltaDispUpdPenalty)) { penalty[kfe][1] *= 10.0; - /* - real64 const eps_T_lim = normalTractionTolerance[kfe]/(slidingTolerance[kfe]*10); + + real64 const eps_T_lim = 1.0e+04 * normalTractionTolerance[kfe]/(slidingTolerance[kfe] * area[kfe] * 10 ); if (penalty[kfe][1] > eps_T_lim ) { + GEOS_LOG_LEVEL(2, + GEOS_FMT( " Element: {}, eps > eps_lim, eps: {:4.2e} epsLim: {:4.2e}", + kfe, penalty[kfe][1], eps_T_lim )) + penalty[kfe][1] = eps_T_lim; } - */ - //std::cout << "Upd penalty T: " << kfe << " " << deltaDisp << " " << slidingTolerance[kfe] << " " << penalty[kfe][1]<< std::endl; + } @@ -1788,9 +1812,10 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio // Finally, compute tolerances for the given fracture element normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+8; - slidingTolerance[kfe] = sqrt( rotatedInvStiffApprox[ 1 ][ 1 ] * rotatedInvStiffApprox[ 1 ][ 1 ] + - rotatedInvStiffApprox[ 2 ][ 2 ] * rotatedInvStiffApprox[ 2 ][ 2 ] ) * averageYoungModulus / 2.e+8; - normalTractionTolerance[kfe] = 1.0 / 2.0 * averageConstrainedModulus / averageBoxSize0 * normalDisplacementTolerance[kfe]; + slidingTolerance[kfe] = sqrt( pow(rotatedInvStiffApprox[ 1 ][ 1 ],2) + + pow(rotatedInvStiffApprox[ 2 ][ 2 ],2)) * averageYoungModulus / 2.e+8; + normalTractionTolerance[kfe] = (1.0 / 2.0) * (averageConstrainedModulus / averageBoxSize0) * + (normalDisplacementTolerance[kfe])*1.0e+01; } } ); } From 8fc501f38d761d45cd7537b7b29164e8ebb6c7db Mon Sep 17 00:00:00 2001 From: mfrigo Date: Wed, 7 Aug 2024 19:48:24 -0700 Subject: [PATCH 06/41] Fixed the MPI bug and started cleaning up the code --- ...lidMechanicsAugmentedLagrangianContact.cpp | 505 +++++++++--------- 1 file changed, 246 insertions(+), 259 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index 54932d35d2c..0352394b638 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -247,7 +247,7 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & SurfaceElementRegion & region = elemManager.getRegion< SurfaceElementRegion >( getUniqueFractureRegionName() ); FaceElementSubRegion & subRegion = region.getUniqueSubRegion< FaceElementSubRegion >(); - arrayView2d< real64 const > const & faceNormal = faceManager.faceNormal(); + arrayView2d< real64 const > const faceNormal = faceManager.faceNormal(); ArrayOfArraysView< localIndex const > const elemsToFaces = subRegion.faceList().toViewConst(); arrayView3d< real64 > const @@ -270,9 +270,9 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & arrayView1d< real64 const > const normalDisplacementTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalDisplacementToleranceString() ); - arrayView1d< real64 > const & slidingTolerance = + arrayView1d< real64 > const slidingTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ); - arrayView1d< real64 const > const & normalTractionTolerance = + arrayView1d< real64 const > const normalTractionTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ); arrayView1d< real64 const > const area = @@ -282,19 +282,20 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & penalty = subRegion.getField< fields::contact::penalty >().toView(); // Set the penalty coefficients - // TODO: This is only temporary. The setting of penalty will be adaptive in the final version. - forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const k ) + forAll< parallelDevicePolicy<> >( subRegion.size(), + [ penalty, normalTractionTolerance, + normalDisplacementTolerance, area, + dispJumpUpdPenalty ] + GEOS_HOST_DEVICE ( localIndex const k ) { - penalty[k] [0] = normalTractionTolerance[k]/(normalDisplacementTolerance[k]*area[k] ); penalty[k] [1] = penalty[k][0] * 1.0e-01; - std::cout << "penalty: " << penalty[k][0] << " " << penalty[k][1] << " " - << "normalTol: " << normalDisplacementTolerance[k] << " " - << "slidingTol: " << slidingTolerance[k] << " " - << "tractionTol: " << normalTractionTolerance[k] << " " - << "area: " << area[k] << " " - << std::endl; + //GEOS_LOG_LEVEL(2, + //GEOS_FMT(" Element: {} penalty: {:4.2e} nDispTol: {:4.2e} sliTol: {:4.2e} nTraTol: {:4.2e} area: {:4.2e}\n", + //k, penalty[k][0], normalDisplacementTolerance[k], + //slidingTolerance[k], normalTractionTolerance[k], area[k] )); + LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); } ); @@ -471,8 +472,11 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepComplete( real64 cons arrayView1d< integer const > const fractureState = subRegion.getField< contact::fractureState >(); arrayView1d< integer > const oldFractureState = subRegion.getField< contact::oldFractureState >(); - - forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const kfe ) + forAll< parallelDevicePolicy<> >( subRegion.size(), + [ deltaDispJump, + oldDispJump, dispJump, + oldFractureState, fractureState ] + GEOS_HOST_DEVICE ( localIndex const kfe ) { LvArray::tensorOps::fill< 3 >( deltaDispJump[kfe], 0.0 ); LvArray::tensorOps::copy< 3 >( oldDispJump[kfe], dispJump[kfe] ); @@ -515,7 +519,7 @@ real64 SolidMechanicsAugmentedLagrangianContact::calculateResidualNorm( real64 c SurfaceElementRegion const & region = elemManager.getRegion< SurfaceElementRegion >( getUniqueFractureRegionName() ); FaceElementSubRegion const & subRegion = region.getUniqueSubRegion< FaceElementSubRegion >(); - arrayView1d< integer const > const & ghostRank = subRegion.ghostRank(); + arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); ArrayOfArraysView< localIndex const > const elemsToFaces = subRegion.faceList().toViewConst(); @@ -704,7 +708,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit string const & contactRelationName = subRegion.template getReference< string >( viewKeyStruct::contactRelationNameString() ); ContactBase const & contact = getConstitutiveModel< ContactBase >( subRegion, contactRelationName ); - arrayView1d< integer const > const & ghostRank = subRegion.ghostRank(); + arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); arrayView2d< real64 const > const traction = subRegion.getField< contact::traction >(); arrayView2d< real64 const > const dispJump = subRegion.getField< contact::dispJump >(); @@ -725,8 +729,8 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit traction_new.resize( 2, sizes ); arrayView2d< real64 > const traction_new_v = traction_new.toView(); - // TODO: Create a Kernel to update Traction - forAll< parallelHostPolicy >( subRegion.size(), + // Update Traction + forAll< parallelDevicePolicy<> >( subRegion.size(), [ traction_new_v, traction, penalty, dispJump, deltaDispJump, fractureState ] ( localIndex const kfe ) { @@ -749,13 +753,11 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit using ContactType = TYPEOFREF( castedContact ); typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelWrapper(); - bool printflag = true; - forAll< parallelHostPolicy >( subRegion.size(), [ &condConv, ghostRank, traction_new_v, normalTractionTolerance, normalDisplacementTolerance, slidingTolerance, deltaDispJump, dispJump, area, - fractureState, contactWrapper, slidingCheckTolerance, this, &printflag ] ( localIndex const kfe ) + fractureState, contactWrapper, slidingCheckTolerance ] ( localIndex const kfe ) { if( ghostRank[kfe] < 0 ) { @@ -764,13 +766,13 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit { if (fractureState[kfe] != contact::FractureState::Open) { - if (printflag) - { - GEOS_LOG_LEVEL(2, - GEOS_FMT(" Element: {}, traction_n > tol4 => open, traction_n: {:4.2e} tol4: {:4.2e}\n", - kfe,traction_new_v[kfe][0], normalTractionTolerance[kfe] )); - printflag = false; - } + //if (printflag) + //{ + // GEOS_LOG_LEVEL(2, + // GEOS_FMT(" Element: {}, traction_n > tol4 => open, traction_n: {:4.2e} tol4: {:4.2e}\n", + // kfe,traction_new_v[kfe][0], normalTractionTolerance[kfe] )); + // printflag = false; + //} condConv = false; } traction_new_v[kfe][0] = 0.0; @@ -783,26 +785,26 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit real64 deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + pow( deltaDispJump[kfe][2], 2 )); if( std::abs( dispJump[kfe][0]/area[kfe] ) > normalDisplacementTolerance[kfe] ) { - if (printflag) - { - GEOS_LOG_LEVEL(2, - GEOS_FMT( " Element: {}, Stick mode and g_n > tol1 => compenetration, g_n: {:4.2e} tol1: {:4.2e}", - kfe,std::abs(dispJump[kfe][0])/area[kfe], normalDisplacementTolerance[kfe] )); - printflag = false; - } + //if (printflag) + //{ + // GEOS_LOG_LEVEL(2, + // GEOS_FMT( " Element: {}, Stick mode and g_n > tol1 => compenetration, g_n: {:4.2e} tol1: {:4.2e}", + // kfe,std::abs(dispJump[kfe][0])/area[kfe], normalDisplacementTolerance[kfe] )); + // printflag = false; + //} condConv = false; } // Case 3: it is stick and dg is greater than 0 if( fractureState[kfe] == contact::FractureState::Stick && deltaDisp/area[kfe] > slidingTolerance[kfe] ) { - if (printflag) - { - GEOS_LOG_LEVEL(2, - GEOS_FMT( " Element: {}, Stick and dg_t > tol2, dg_t: {:4.2e} tol2: {:4.2e}", - kfe, deltaDisp/area[kfe], slidingTolerance[kfe] )) - printflag = false; - } + //if (printflag) + //{ + // GEOS_LOG_LEVEL(2, + // GEOS_FMT( " Element: {}, Stick and dg_t > tol2, dg_t: {:4.2e} tol2: {:4.2e}", + // kfe, deltaDisp/area[kfe], slidingTolerance[kfe] )) + // printflag = false; + //} condConv = false; } @@ -826,15 +828,13 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit if( currentTau > (std::abs(limitTau) * (1.0 + slidingCheckTolerance)) ) { - //std::cout << currentTau << " " << limitTau << " " << (1.0 + slidingCheckTolerance) << std::endl; - - if (printflag) - { - GEOS_LOG_LEVEL(2, - GEOS_FMT( " Element: {}, tau > tau_lim, tau: {:4.2e} tauLim: {:4.2e}", - kfe, currentTau, limitTau )) - printflag = false; - } + //if (printflag) + //{ + // GEOS_LOG_LEVEL(2, + // GEOS_FMT( " Element: {}, tau > tau_lim, tau: {:4.2e} tauLim: {:4.2e}", + // kfe, currentTau, limitTau )) + // printflag = false; + //} condConv = false; } @@ -871,20 +871,14 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit FaceElementSubRegion & subRegion ) { - arrayView1d< integer const > const & ghostRank = subRegion.ghostRank(); - arrayView2d< real64 > const traction_new_v = traction_new.toView(); arrayView2d< real64 > const traction = subRegion.getField< contact::traction >(); - forAll< parallelHostPolicy >( subRegion.size(), [ ghostRank, - traction, traction_new_v ] ( localIndex const kfe ) + forAll< parallelDevicePolicy<> >( subRegion.size(), [ traction, traction_new_v ] ( localIndex const kfe ) { - if( ghostRank[kfe] < 0 ) - { - traction[kfe][0] = traction_new_v( kfe, 0 ); - traction[kfe][1] = traction_new_v( kfe, 1 ); - traction[kfe][2] = traction_new_v( kfe, 2 ); - } + traction[kfe][0] = traction_new_v( kfe, 0 ); + traction[kfe][1] = traction_new_v( kfe, 1 ); + traction[kfe][2] = traction_new_v( kfe, 2 ); } ); } ); } ); @@ -904,8 +898,6 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit string const & contactRelationName = subRegion.template getReference< string >( viewKeyStruct::contactRelationNameString() ); ContactBase const & contact = getConstitutiveModel< ContactBase >( subRegion, contactRelationName ); - arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); - arrayView2d< real64 > const traction_new_v = traction_new.toView(); arrayView2d< real64 > const traction = subRegion.getField< contact::traction >(); @@ -931,8 +923,9 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit arrayView2d< real64 const > const deltaDispJump = subRegion.getField< contact::deltaDispJump >(); - forAll< parallelHostPolicy >( subRegion.size(), - [ traction_new_v, traction, penalty, dispJump, deltaDispJump ] ( localIndex const kfe ) + forAll< parallelDevicePolicy<> >( subRegion.size(), + [ traction_new_v, traction, penalty, + dispJump, deltaDispJump ] ( localIndex const kfe ) { real64 eps_N = penalty[kfe][0]; real64 eps_T = penalty[kfe][1]; @@ -947,158 +940,152 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit using ContactType = TYPEOFREF( castedContact ); typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelWrapper(); - forAll< parallelHostPolicy >( subRegion.size(), [ ghostRank, - contactWrapper, + forAll< parallelHostPolicy >( subRegion.size(), [ contactWrapper, normalTractionTolerance, slidingTolerance, normalDisplacementTolerance, slidingCheckTolerance, dispJumpUpdPenalty, penalty, fractureState, area, dispJump, deltaDispJump, - traction, traction_new_v, this ] ( localIndex const kfe ) + traction, traction_new_v ] ( localIndex const kfe ) { - if( ghostRank[kfe] < 0 ) - { - //integer const originalFractureState = fractureState[kfe]; - // Case 1: if it is open - if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) + // Case 1: if it is open + if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) + { + fractureState[kfe] = contact::FractureState::Open; + traction[kfe][0] = 0.0; + traction[kfe][1] = 0.0; + traction[kfe][2] = 0.0; + } + else + { + // Case 2: If the normal stress is zero, + // then the tangential stress is also zero. + if (std::abs(traction_new_v[kfe][0]) < normalTractionTolerance[kfe]) { - //GEOS_ERROR( "Unsuported open mode! Only stick mode is supported with ALM" ); - //std::cout << "Case 1 " << traction_new_v[kfe][0] << " " << normalTractionTolerance[kfe] << std::endl; - fractureState[kfe] = contact::FractureState::Open; + + //GEOS_LOG_LEVEL(2, + //GEOS_FMT( "WARNING: The normal stress of element {} is lower than the tolerance, t_n: {:4.2e} tol: {:4.2e}", + //kfe, traction_new_v[kfe][0], normalTractionTolerance[kfe] )) + fractureState[kfe] = contact::FractureState::Slip; traction[kfe][0] = 0.0; traction[kfe][1] = 0.0; traction[kfe][2] = 0.0; + + // Update the penalty coefficient to accelerate the convergence + penalty[kfe][0] *= 10.0; + + real64 const eps_N_lim = 1.0e+4*normalTractionTolerance[kfe]/(normalDisplacementTolerance[kfe]*area[kfe]); + if (penalty[kfe][0] > eps_N_lim ) + { + //GEOS_LOG_LEVEL(2, + //GEOS_FMT( " Element: {}, eps > eps_lim, eps: {:4.2e} epsLim: {:4.2e}", + //kfe, penalty[kfe][0], eps_N_lim )) + + penalty[kfe][0] = eps_N_lim; + } } else { - // Case 2: If the normal stress is zero, - // then the tangential stress is also zero. - //if (std::abs(traction_new_v[kfe][0]) < 0.001*normalTractionTolerance[kfe]) - if (std::abs(traction_new_v[kfe][0]) < normalTractionTolerance[kfe]) - { - - GEOS_LOG_LEVEL(2, - GEOS_FMT( "WARNING: The normal stress of element {} is lower than the tolerance, t_n: {:4.2e} tol: {:4.2e}", - kfe, traction_new_v[kfe][0], normalTractionTolerance[kfe] )) - fractureState[kfe] = contact::FractureState::Slip; - traction[kfe][0] = 0.0; - traction[kfe][1] = 0.0; - traction[kfe][2] = 0.0; + traction[kfe][0] = traction_new_v( kfe, 0 ); - // Update the penalty coefficient to accelerate the convergence + // Update the penalty coefficient to accelerate the convergence + if ((std::abs(dispJump[kfe][0])/area[kfe] > normalDisplacementTolerance[kfe] ) && + (std::abs(dispJump[kfe][0]) > 0.25 * std::abs(dispJumpUpdPenalty[kfe][0]))) + { penalty[kfe][0] *= 10.0; real64 const eps_N_lim = 1.0e+4*normalTractionTolerance[kfe]/(normalDisplacementTolerance[kfe]*area[kfe]); - //real64 const eps_N_lim = 1.e+10; if (penalty[kfe][0] > eps_N_lim ) { - GEOS_LOG_LEVEL(2, - GEOS_FMT( " Element: {}, eps > eps_lim, eps: {:4.2e} epsLim: {:4.2e}", - kfe, penalty[kfe][0], eps_N_lim )) + //GEOS_LOG_LEVEL(2, + //GEOS_FMT( " Element: {}, eps > eps_lim, eps: {:4.2e} epsLim: {:4.2e}", + //kfe, penalty[kfe][0], eps_N_lim )) penalty[kfe][0] = eps_N_lim; } + } - else - { - traction[kfe][0] = traction_new_v( kfe, 0 ); - - // Update the penalty coefficient to accelerate the convergence - if ((std::abs(dispJump[kfe][0])/area[kfe] > normalDisplacementTolerance[kfe] ) && - (std::abs(dispJump[kfe][0]) > 0.25 * std::abs(dispJumpUpdPenalty[kfe][0]))) - { - penalty[kfe][0] *= 10.0; - - real64 const eps_N_lim = 1.0e+4*normalTractionTolerance[kfe]/(normalDisplacementTolerance[kfe]*area[kfe]); - if (penalty[kfe][0] > eps_N_lim ) - { - GEOS_LOG_LEVEL(2, - GEOS_FMT( " Element: {}, eps > eps_lim, eps: {:4.2e} epsLim: {:4.2e}", - kfe, penalty[kfe][0], eps_N_lim )) - - penalty[kfe][0] = eps_N_lim; - } - - } - real64 currentTau = sqrt( pow(traction_new_v[kfe][1], 2 ) + - pow(traction_new_v[kfe][2], 2 ) ); + real64 currentTau = sqrt( pow(traction_new_v[kfe][1], 2 ) + + pow(traction_new_v[kfe][2], 2 ) ); - real64 dLimitTangentialTractionNorm_dTraction = 0.0; - real64 const limitTau = - contactWrapper.computeLimitTangentialTractionNorm( traction[kfe][0], - dLimitTangentialTractionNorm_dTraction ); + real64 dLimitTangentialTractionNorm_dTraction = 0.0; + real64 const limitTau = + contactWrapper.computeLimitTangentialTractionNorm( traction[kfe][0], + dLimitTangentialTractionNorm_dTraction ); - real64 const LimitTangentialTractionNorm_TangentialTractionNorm = std::abs(limitTau) / currentTau; + real64 const LimitTangentialTractionNorm_TangentialTractionNorm = std::abs(limitTau) / currentTau; - //if( originalFractureState == contact::FractureState::Stick && currentTau >= limitTau ) + //if( originalFractureState == contact::FractureState::Stick && currentTau >= limitTau ) + //{ + // currentTau *= (1.0 - slidingCheckTolerance); + //} + //else if( originalFractureState != contact::FractureState::Stick && currentTau <= limitTau ) + //{ + // currentTau *= (1.0 + slidingCheckTolerance); + //} + + // Case 3: if it is slip + if( currentTau >= (std::abs(limitTau) * (1.0 + slidingCheckTolerance)) ) + { + //if( originalFractureState == contact::FractureState::Stick ) //{ - // currentTau *= (1.0 - slidingCheckTolerance); + // fractureState[kfe] = contact::FractureState::NewSlip; //} - //else if( originalFractureState != contact::FractureState::Stick && currentTau <= limitTau ) + //else //{ - // currentTau *= (1.0 + slidingCheckTolerance); + // fractureState[kfe] = contact::FractureState::Slip; //} + fractureState[kfe] = contact::FractureState::Slip; - // Case 3: if it is slip - if( currentTau >= (std::abs(limitTau) * (1.0 + slidingCheckTolerance)) ) - { - //if( originalFractureState == contact::FractureState::Stick ) - //{ - // fractureState[kfe] = contact::FractureState::NewSlip; - //} - //else - //{ - fractureState[kfe] = contact::FractureState::Slip; - //} - - traction[kfe][1] = traction_new_v( kfe, 1 ) * LimitTangentialTractionNorm_TangentialTractionNorm; - traction[kfe][2] = traction_new_v( kfe, 2 ) * LimitTangentialTractionNorm_TangentialTractionNorm; + traction[kfe][1] = traction_new_v( kfe, 1 ) * LimitTangentialTractionNorm_TangentialTractionNorm; + traction[kfe][2] = traction_new_v( kfe, 2 ) * LimitTangentialTractionNorm_TangentialTractionNorm; - } - // Case 4: if it is stick - else - { - fractureState[kfe] = contact::FractureState::Stick; - traction[kfe][1] = traction_new_v( kfe, 1 ); - traction[kfe][2] = traction_new_v( kfe, 2 ); + } + // Case 4: if it is stick + else + { + fractureState[kfe] = contact::FractureState::Stick; + traction[kfe][1] = traction_new_v( kfe, 1 ); + traction[kfe][2] = traction_new_v( kfe, 2 ); - // Update the penalty coefficient to accelerate the convergence - real64 const deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + - pow( deltaDispJump[kfe][2], 2 )); - real64 const deltaDispUpdPenalty = sqrt( pow( dispJumpUpdPenalty[kfe][1], 2 ) + - pow( dispJumpUpdPenalty[kfe][2], 2 )); + // Update the penalty coefficient to accelerate the convergence + real64 const deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + + pow( deltaDispJump[kfe][2], 2 )); + real64 const deltaDispUpdPenalty = sqrt( pow( dispJumpUpdPenalty[kfe][1], 2 ) + + pow( dispJumpUpdPenalty[kfe][2], 2 )); - if (( deltaDisp/area[kfe] > slidingTolerance[kfe] ) && - ( deltaDisp > 0.25 * deltaDispUpdPenalty)) + if (( deltaDisp/area[kfe] > slidingTolerance[kfe] ) && + ( deltaDisp > 0.25 * deltaDispUpdPenalty)) + { + penalty[kfe][1] *= 10.0; + + + real64 const eps_T_lim = 1.0e+04 * normalTractionTolerance[kfe]/(slidingTolerance[kfe] * area[kfe] * 10 ); + if (penalty[kfe][1] > eps_T_lim ) { - penalty[kfe][1] *= 10.0; - - - real64 const eps_T_lim = 1.0e+04 * normalTractionTolerance[kfe]/(slidingTolerance[kfe] * area[kfe] * 10 ); - if (penalty[kfe][1] > eps_T_lim ) - { - GEOS_LOG_LEVEL(2, - GEOS_FMT( " Element: {}, eps > eps_lim, eps: {:4.2e} epsLim: {:4.2e}", - kfe, penalty[kfe][1], eps_T_lim )) - - penalty[kfe][1] = eps_T_lim; - } - + //GEOS_LOG_LEVEL(2, + //GEOS_FMT( " Element: {}, eps > eps_lim, eps: {:4.2e} epsLim: {:4.2e}", + //kfe, penalty[kfe][1], eps_T_lim )) + + penalty[kfe][1] = eps_T_lim; } - } + + } - } - } + } + } } ); } ); - forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const kfe ) + forAll< parallelDevicePolicy<> >( subRegion.size(), [ dispJumpUpdPenalty, + dispJump, deltaDispJump] + GEOS_HOST_DEVICE ( localIndex const kfe ) { dispJumpUpdPenalty[kfe][0] = dispJump[kfe][0]; dispJumpUpdPenalty[kfe][1] = deltaDispJump[kfe][1]; @@ -1151,12 +1138,12 @@ void SolidMechanicsAugmentedLagrangianContact::updateStickSlipList( DomainPartit arrayView1d< localIndex > const keys_v = keys.toView(); arrayView1d< localIndex > const vals_v = vals.toView(); forAll< parallelDevicePolicy<> >( faceElementList.size(), - [ nStick_r, nSlip_r, + [ nStick_r, nSlip_r, fractureState, faceElementList, keys_v, vals_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) { - + localIndex const faceIndex = faceElementList[kfe]; if( fractureState[faceIndex] == contact::FractureState::Stick ) { @@ -1203,8 +1190,8 @@ void SolidMechanicsAugmentedLagrangianContact::updateStickSlipList( DomainPartit this->m_faceTypesToFaceElementsStick[meshName][finiteElementName] = stickList; this->m_faceTypesToFaceElementsSlip[meshName][finiteElementName] = slipList; - std::cout << "nStick: " << nStick << std::endl; - std::cout << "nSlip: " << nSlip << std::endl; + //GEOS_LOG_LEVEL(2, + //GEOS_FMT( "# stick elements: {}, # slip elements: {}", nStick, nSlip )) } ); } ); @@ -1236,7 +1223,9 @@ void SolidMechanicsAugmentedLagrangianContact::createFaceTypeList( DomainPartiti arrayView1d< localIndex > const vals_v = vals.toView(); // Determine the size of the lists and generate the vector keys and vals for parallel indexing into lists. // (With RAJA, parallelizing this operation seems the most viable approach.) - forAll< parallelDevicePolicy<> >( subRegion.size(), [ nTri_r, nQuad_r, faceToNodeMap, keys_v, vals_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) + forAll< parallelDevicePolicy<> >( subRegion.size(), + [ nTri_r, nQuad_r, faceToNodeMap, + keys_v, vals_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) { localIndex const numNodesPerFace = faceToNodeMap.sizeOfArray( kfe ); @@ -1689,16 +1678,16 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio // Get the "face to element" map (valid for the entire mesh) FaceManager::ElemMapType const & faceToElem = faceManager.toElementRelation(); - arrayView2d< localIndex const > const & faceToElemRegion = faceToElem.m_toElementRegion; - arrayView2d< localIndex const > const & faceToElemSubRegion = faceToElem.m_toElementSubRegion; - arrayView2d< localIndex const > const & faceToElemIndex = faceToElem.m_toElementIndex; + arrayView2d< localIndex const > const faceToElemRegion = faceToElem.m_toElementRegion; + arrayView2d< localIndex const > const faceToElemSubRegion = faceToElem.m_toElementSubRegion; + arrayView2d< localIndex const > const faceToElemIndex = faceToElem.m_toElementIndex; // Get the volume for all elements ElementRegionManager::ElementViewAccessor< arrayView1d< real64 const > > const elemVolume = elemManager.constructViewAccessor< array1d< real64 >, arrayView1d< real64 const > >( ElementSubRegionBase::viewKeyStruct::elementVolumeString() ); // Get the coordinates for all nodes - arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const & nodePosition = nodeManager.referencePosition(); + arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const nodePosition = nodeManager.referencePosition(); // Bulk modulus accessor ElementRegionManager::ElementViewAccessor< arrayView1d< real64 const > > const bulkModulus = @@ -1716,107 +1705,105 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio { if( subRegion.hasField< contact::traction >() ) { - arrayView1d< integer const > const & ghostRank = subRegion.ghostRank(); - arrayView1d< real64 const > const & faceArea = subRegion.getElementArea().toViewConst(); - arrayView3d< real64 const > const & faceRotationMatrix = subRegion.getField< fields::contact::rotationMatrix >().toView(); - ArrayOfArraysView< localIndex const > const & elemsToFaces = subRegion.faceList().toViewConst(); + arrayView1d< real64 const > const faceArea = subRegion.getElementArea().toViewConst(); + arrayView3d< real64 const > const faceRotationMatrix = subRegion.getField< fields::contact::rotationMatrix >().toView(); + ArrayOfArraysView< localIndex const > const elemsToFaces = subRegion.faceList().toViewConst(); - arrayView1d< real64 > const & normalTractionTolerance = + arrayView1d< real64 > const normalTractionTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ); - arrayView1d< real64 > const & normalDisplacementTolerance = + arrayView1d< real64 > const normalDisplacementTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalDisplacementToleranceString() ); - arrayView1d< real64 > const & slidingTolerance = + arrayView1d< real64 > const slidingTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ); forAll< parallelHostPolicy >( subRegion.size(), [=] ( localIndex const kfe ) { - if( ghostRank[kfe] < 0 ) + + real64 const area = faceArea[kfe]; + // approximation of the stiffness along coordinate directions + // ( first, second ) index -> ( element index, direction ) + // 1. T -> top (index 0), B -> bottom (index 1) + // 2. the coordinate direction (x, y, z) + real64 stiffDiagApprox[ 2 ][ 3 ]; + real64 averageYoungModulus = 0.0; + real64 averageConstrainedModulus = 0.0; + real64 averageBoxSize0 = 0.0; + + for( localIndex i = 0; i < elemsToFaces.sizeOfArray( kfe ); ++i ) { - real64 const area = faceArea[kfe]; - // approximation of the stiffness along coordinate directions - // ( first, second ) index -> ( element index, direction ) - // 1. T -> top (index 0), B -> bottom (index 1) - // 2. the coordinate direction (x, y, z) - real64 stiffDiagApprox[ 2 ][ 3 ]; - real64 averageYoungModulus = 0.0; - real64 averageConstrainedModulus = 0.0; - real64 averageBoxSize0 = 0.0; - - for( localIndex i = 0; i < elemsToFaces.sizeOfArray( kfe ); ++i ) - { - localIndex const faceIndex = elemsToFaces[kfe][i]; - localIndex const er = faceToElemRegion[faceIndex][0]; - localIndex const esr = faceToElemSubRegion[faceIndex][0]; - localIndex const ei = faceToElemIndex[faceIndex][0]; - - real64 const volume = elemVolume[er][esr][ei]; + localIndex const faceIndex = elemsToFaces[kfe][i]; + localIndex const er = faceToElemRegion[faceIndex][0]; + localIndex const esr = faceToElemSubRegion[faceIndex][0]; + localIndex const ei = faceToElemIndex[faceIndex][0]; - // Get the "element to node" map for the specific region/subregion - NodeMapViewType const & cellElemsToNodes = elemToNodeView[er][esr]; - localIndex const numNodesPerElem = cellElemsToNodes.size( 1 ); + real64 const volume = elemVolume[er][esr][ei]; - // Compute the box size - real64 maxSize[3]; - real64 minSize[3]; - for( localIndex j = 0; j < 3; ++j ) - { - maxSize[j] = nodePosition[cellElemsToNodes[ei][0]][j]; - minSize[j] = nodePosition[cellElemsToNodes[ei][0]][j]; - } - for( localIndex a = 1; a < numNodesPerElem; ++a ) - { - for( localIndex j = 0; j < 3; ++j ) - { - maxSize[j] = fmax( maxSize[j], nodePosition[cellElemsToNodes[ei][a]][j] ); - minSize[j] = fmin( minSize[j], nodePosition[cellElemsToNodes[ei][a]][j] ); - } - } - - real64 boxSize[3]; - for( localIndex j = 0; j < 3; ++j ) - { - boxSize[j] = maxSize[j] - minSize[j]; - } - - // Get linear elastic isotropic constitutive parameters for the element - real64 const K = bulkModulus[er][esr][ei]; - real64 const G = shearModulus[er][esr][ei]; - real64 const E = 9.0 * K * G / ( 3.0 * K + G ); - real64 const nu = ( 3.0 * K - 2.0 * G ) / ( 2.0 * ( 3.0 * K + G ) ); - real64 const M = K + 4.0 / 3.0 * G; + // Get the "element to node" map for the specific region/subregion + NodeMapViewType const & cellElemsToNodes = elemToNodeView[er][esr]; + localIndex const numNodesPerElem = cellElemsToNodes.size( 1 ); - // Combine E and nu to obtain a stiffness approximation (like it was an hexahedron) + // Compute the box size + real64 maxSize[3]; + real64 minSize[3]; + for( localIndex j = 0; j < 3; ++j ) + { + maxSize[j] = nodePosition[cellElemsToNodes[ei][0]][j]; + minSize[j] = nodePosition[cellElemsToNodes[ei][0]][j]; + } + for( localIndex a = 1; a < numNodesPerElem; ++a ) + { for( localIndex j = 0; j < 3; ++j ) { - stiffDiagApprox[ i ][ j ] = E / ( ( 1.0 + nu )*( 1.0 - 2.0*nu ) ) * 4.0 / 9.0 * ( 2.0 - 3.0 * nu ) * volume / ( boxSize[j]*boxSize[j] ); + maxSize[j] = fmax( maxSize[j], nodePosition[cellElemsToNodes[ei][a]][j] ); + minSize[j] = fmin( minSize[j], nodePosition[cellElemsToNodes[ei][a]][j] ); } + } - averageYoungModulus += 0.5*E; - averageConstrainedModulus += 0.5*M; - averageBoxSize0 += 0.5*boxSize[0]; + real64 boxSize[3]; + for( localIndex j = 0; j < 3; ++j ) + { + boxSize[j] = maxSize[j] - minSize[j]; } - // Average the stiffness and compute the inverse - real64 invStiffApprox[ 3 ][ 3 ] = { { 0 } }; + // Get linear elastic isotropic constitutive parameters for the element + real64 const K = bulkModulus[er][esr][ei]; + real64 const G = shearModulus[er][esr][ei]; + real64 const E = 9.0 * K * G / ( 3.0 * K + G ); + real64 const nu = ( 3.0 * K - 2.0 * G ) / ( 2.0 * ( 3.0 * K + G ) ); + real64 const M = K + 4.0 / 3.0 * G; + + // Combine E and nu to obtain a stiffness approximation (like it was an hexahedron) for( localIndex j = 0; j < 3; ++j ) { - invStiffApprox[ j ][ j ] = ( stiffDiagApprox[ 0 ][ j ] + stiffDiagApprox[ 1 ][ j ] ) / ( stiffDiagApprox[ 0 ][ j ] * stiffDiagApprox[ 1 ][ j ] ); + stiffDiagApprox[ i ][ j ] = E / ( ( 1.0 + nu )*( 1.0 - 2.0*nu ) ) * 4.0 / 9.0 * ( 2.0 - 3.0 * nu ) * volume / ( boxSize[j]*boxSize[j] ); } - // Rotate in the local reference system, computing R^T * (invK) * R - real64 temp[ 3 ][ 3 ]; - LvArray::tensorOps::Rij_eq_AkiBkj< 3, 3, 3 >( temp, faceRotationMatrix[ kfe ], invStiffApprox ); - real64 rotatedInvStiffApprox[ 3 ][ 3 ]; - LvArray::tensorOps::Rij_eq_AikBkj< 3, 3, 3 >( rotatedInvStiffApprox, temp, faceRotationMatrix[ kfe ] ); - LvArray::tensorOps::scale< 3, 3 >( rotatedInvStiffApprox, area ); - - // Finally, compute tolerances for the given fracture element - normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+8; - slidingTolerance[kfe] = sqrt( pow(rotatedInvStiffApprox[ 1 ][ 1 ],2) + - pow(rotatedInvStiffApprox[ 2 ][ 2 ],2)) * averageYoungModulus / 2.e+8; - normalTractionTolerance[kfe] = (1.0 / 2.0) * (averageConstrainedModulus / averageBoxSize0) * - (normalDisplacementTolerance[kfe])*1.0e+01; + averageYoungModulus += 0.5*E; + averageConstrainedModulus += 0.5*M; + averageBoxSize0 += 0.5*boxSize[0]; + } + + // Average the stiffness and compute the inverse + real64 invStiffApprox[ 3 ][ 3 ] = { { 0 } }; + for( localIndex j = 0; j < 3; ++j ) + { + invStiffApprox[ j ][ j ] = ( stiffDiagApprox[ 0 ][ j ] + stiffDiagApprox[ 1 ][ j ] ) / ( stiffDiagApprox[ 0 ][ j ] * stiffDiagApprox[ 1 ][ j ] ); } + + // Rotate in the local reference system, computing R^T * (invK) * R + real64 temp[ 3 ][ 3 ]; + LvArray::tensorOps::Rij_eq_AkiBkj< 3, 3, 3 >( temp, faceRotationMatrix[ kfe ], invStiffApprox ); + real64 rotatedInvStiffApprox[ 3 ][ 3 ]; + LvArray::tensorOps::Rij_eq_AikBkj< 3, 3, 3 >( rotatedInvStiffApprox, temp, faceRotationMatrix[ kfe ] ); + LvArray::tensorOps::scale< 3, 3 >( rotatedInvStiffApprox, area ); + + // Finally, compute tolerances for the given fracture element + normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+8; + slidingTolerance[kfe] = sqrt( pow(rotatedInvStiffApprox[ 1 ][ 1 ],2) + + pow(rotatedInvStiffApprox[ 2 ][ 2 ],2)) * averageYoungModulus / 2.e+8; + normalTractionTolerance[kfe] = (1.0 / 2.0) * (averageConstrainedModulus / averageBoxSize0) * + (normalDisplacementTolerance[kfe])*1.0e+01; + } ); } } ); From dee0997f780e7555bfeb8131dd46cc30add3d26c Mon Sep 17 00:00:00 2001 From: mfrigo Date: Thu, 8 Aug 2024 16:00:58 -0700 Subject: [PATCH 07/41] Adding initial stress contribution for bubble functions - updating lambda functions --- .../SolidMechanicsALMBubbleKernels.hpp | 15 +++++++++ ...lidMechanicsAugmentedLagrangianContact.cpp | 31 +++---------------- ...lidMechanicsAugmentedLagrangianContact.hpp | 5 ++- 3 files changed, 23 insertions(+), 28 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp index 5c3052a8ae7..c3355ce85af 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp @@ -329,6 +329,21 @@ class ALMBubbleKernels : LvArray::tensorOps::scaledAdd< nBubbleUdof, nUdof >( stack.localAbu, Abu_gauss, -detJ ); LvArray::tensorOps::scaledAdd< nUdof, nBubbleUdof >( stack.localAub, Aub_gauss, -detJ ); + // Compute the initial stress + real64 rb_gauss[nBubbleUdof]; + real64 strain[6] = {0}; + LvArray::tensorOps::Ri_eq_AijBj< 6, nUdof >( strain , strainMatrix, stack.uLocal ); + + real64 initStressLocal[ 6 ] = {0}; + LvArray::tensorOps::Ri_eq_AijBj< 6, 6 >( initStressLocal , stack.constitutiveStiffness, strain ); + for( localIndex c = 0; c < 6; ++c ) + { + initStressLocal[ c ] -= m_constitutiveUpdate.m_newStress( k, q, c ); + } + + LvArray::tensorOps::Ri_eq_AjiBj< nBubbleUdof, 6 >( rb_gauss, strainBubbleMatrix, initStressLocal ); + LvArray::tensorOps::scaledAdd< nBubbleUdof >( stack.localRb, rb_gauss, detJ ); + } GEOS_HOST_DEVICE diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index 0352394b638..c961f5eeb3b 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -155,14 +155,6 @@ void SolidMechanicsAugmentedLagrangianContact::setupDofs( DomainPartition const solidMechanics::totalBubbleDisplacement::key(), DofManager::Connector::Elem ); - // The dofManager can not create the connection due to the coupling - // between totalDisplacement and totalBubbleDisplacement - // These connection are created using the two functions - // addCouplingNumNonzeros and addCouplingSparsityPattern - // dofManager.addCoupling( solidMechanics::totalDisplacement::key(), - // solidMechanics::totalBubbleDisplacement::key(), - // DofManager::Connector::Elem); - } void SolidMechanicsAugmentedLagrangianContact::setupSystem( DomainPartition & domain, @@ -260,7 +252,6 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & elemsToFaces, rotationMatrix ); - // Set the tollerances computeTolerances( domain ); @@ -325,7 +316,6 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time //ParallelMatrix parallel_matrix; //parallel_matrix.create( localMatrix.toViewConst(), dofManager.numLocalDofs(), MPI_COMM_GEOSX ); //parallel_matrix.write("mech.mtx"); - //abort(); // Loop for assembling contributes from interface elements (Aut*eps^-1*Atu and Aub*eps^-1*Abu) forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const & meshName, @@ -351,9 +341,6 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time bool const isStickState ) { - //finiteElement::FiniteElementBase & subRegionFE = *(m_faceTypeToFiniteElements[finiteElementName]); - - //bool isStickState = true; solidMechanicsALMKernels::ALMFactory kernelFactory( dispDofNumber, bubbleDofNumber, dofManager.rankOffset(), @@ -628,12 +615,11 @@ void SolidMechanicsAugmentedLagrangianContact::applySystemSolution( DofManager c CRSMatrix< real64, globalIndex > const voidMatrix; array1d< real64 > const voidRhs; - forFiniteElementOnFractureSubRegions( meshName, [&] ( string const & finiteElementName, + forFiniteElementOnFractureSubRegions( meshName, [&] ( string const & , + finiteElement::FiniteElementBase const & subRegionFE, arrayView1d< localIndex const > const & faceElementList ) { - finiteElement::FiniteElementBase & subRegionFE = *(m_faceTypeToFiniteElements[finiteElementName]); - solidMechanicsALMKernels::ALMJumpUpdateFactory kernelFactory( dispDofNumber, bubbleDofNumber, dofManager.rankOffset(), @@ -691,8 +677,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit int hasConfigurationConverged = true; int condConv = true; - // TODO: This function's design is temporary and intended solely for testing the stick mode. - // In the final version the parallelHostPolicy will be substitute with the parallelDevicePolicy<>. + array2d< real64 > traction_new; forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, @@ -1031,14 +1016,6 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit // Case 3: if it is slip if( currentTau >= (std::abs(limitTau) * (1.0 + slidingCheckTolerance)) ) { - //if( originalFractureState == contact::FractureState::Stick ) - //{ - // fractureState[kfe] = contact::FractureState::NewSlip; - //} - //else - //{ - // fractureState[kfe] = contact::FractureState::Slip; - //} fractureState[kfe] = contact::FractureState::Slip; traction[kfe][1] = traction_new_v( kfe, 1 ) * LimitTangentialTractionNorm_TangentialTractionNorm; @@ -1125,6 +1102,7 @@ void SolidMechanicsAugmentedLagrangianContact::updateStickSlipList( DomainPartit arrayView1d< integer const > const fractureState = subRegion.getField< contact::fractureState >(); forFiniteElementOnFractureSubRegions( meshName, [&] ( string const & finiteElementName, + finiteElement::FiniteElementBase const & , arrayView1d< localIndex const > const & faceElementList ) { @@ -1663,7 +1641,6 @@ void SolidMechanicsAugmentedLagrangianContact::addCouplingSparsityPattern( Domai } -// TODO: Is it possible to define this method once? Similar to SolidMechanicsLagrangeContact void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartition & domain ) const { GEOS_MARK_FUNCTION; diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp index 57143448668..3a437834ee8 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp @@ -107,7 +107,10 @@ class SolidMechanicsAugmentedLagrangianContact : public ContactSolverBase for( const auto & [finiteElementName, faceElementList] : faceTypesToFaceElements ) { arrayView1d< localIndex const > const faceElemList = faceElementList.toViewConst(); - lambda( finiteElementName, faceElemList ); + + finiteElement::FiniteElementBase const & subRegionFE = *(m_faceTypeToFiniteElements.at(finiteElementName)); + + lambda( finiteElementName, subRegionFE, faceElemList ); } } From 216c0d0ddc5c017626ddd6644cba041fbd2ef218 Mon Sep 17 00:00:00 2001 From: mfrigo Date: Mon, 12 Aug 2024 18:13:28 -0700 Subject: [PATCH 08/41] Fixing update lists of stick-slip-open elements --- ...lidMechanicsAugmentedLagrangianContact.cpp | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index c961f5eeb3b..221cfc3ca18 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -275,8 +275,8 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & // Set the penalty coefficients forAll< parallelDevicePolicy<> >( subRegion.size(), [ penalty, normalTractionTolerance, - normalDisplacementTolerance, area, - dispJumpUpdPenalty ] + normalDisplacementTolerance, slidingTolerance, + area, dispJumpUpdPenalty ] GEOS_HOST_DEVICE ( localIndex const k ) { penalty[k] [0] = normalTractionTolerance[k]/(normalDisplacementTolerance[k]*area[k] ); @@ -731,7 +731,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit } } ); - + //bool printflag = true; real64 const slidingCheckTolerance = m_slidingCheckTolerance; constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { @@ -768,7 +768,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit { // Case 2: compenetration real64 deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + pow( deltaDispJump[kfe][2], 2 )); - if( std::abs( dispJump[kfe][0]/area[kfe] ) > normalDisplacementTolerance[kfe] ) + if (( std::abs( dispJump[kfe][0]/area[kfe] ) > normalDisplacementTolerance[kfe] ) && (fractureState[kfe] != contact::FractureState::Open)) { //if (printflag) //{ @@ -966,9 +966,8 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit if (penalty[kfe][0] > eps_N_lim ) { //GEOS_LOG_LEVEL(2, - //GEOS_FMT( " Element: {}, eps > eps_lim, eps: {:4.2e} epsLim: {:4.2e}", + //GEOS_FMT( " Element: {}, eps_N > eps_N_lim, eps: {:4.2e} epsLim: {:4.2e}", //kfe, penalty[kfe][0], eps_N_lim )) - penalty[kfe][0] = eps_N_lim; } } @@ -986,9 +985,8 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit if (penalty[kfe][0] > eps_N_lim ) { //GEOS_LOG_LEVEL(2, - //GEOS_FMT( " Element: {}, eps > eps_lim, eps: {:4.2e} epsLim: {:4.2e}", + //GEOS_FMT( " Element: {}, eps_N > eps_N_lim, eps: {:4.2e} epsLim: {:4.2e}", //kfe, penalty[kfe][0], eps_N_lim )) - penalty[kfe][0] = eps_N_lim; } @@ -1039,21 +1037,18 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit ( deltaDisp > 0.25 * deltaDispUpdPenalty)) { penalty[kfe][1] *= 10.0; - real64 const eps_T_lim = 1.0e+04 * normalTractionTolerance[kfe]/(slidingTolerance[kfe] * area[kfe] * 10 ); if (penalty[kfe][1] > eps_T_lim ) { //GEOS_LOG_LEVEL(2, - //GEOS_FMT( " Element: {}, eps > eps_lim, eps: {:4.2e} epsLim: {:4.2e}", + //GEOS_FMT( " Element: {}, eps_T > eps_T_lim, eps: {:4.2e} epsLim: {:4.2e}", //kfe, penalty[kfe][1], eps_T_lim )) - penalty[kfe][1] = eps_T_lim; } } - } } } @@ -1079,7 +1074,6 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit if (!hasConfigurationConvergedGlobally) { updateStickSlipList( domain ); - } return hasConfigurationConvergedGlobally; @@ -1126,16 +1120,20 @@ void SolidMechanicsAugmentedLagrangianContact::updateStickSlipList( DomainPartit if( fractureState[faceIndex] == contact::FractureState::Stick ) { keys_v[kfe]=0; - vals_v[kfe]=kfe; + vals_v[kfe]=faceIndex; nStick_r += 1; } else if (( fractureState[faceIndex] == contact::FractureState::Slip ) || (fractureState[faceIndex] == contact::FractureState::NewSlip)) { keys_v[kfe]=1; - vals_v[kfe]=kfe; + vals_v[kfe]=faceIndex; nSlip_r += 1; } + else + { + keys_v[kfe] = 2; + } } ); @@ -1168,8 +1166,8 @@ void SolidMechanicsAugmentedLagrangianContact::updateStickSlipList( DomainPartit this->m_faceTypesToFaceElementsStick[meshName][finiteElementName] = stickList; this->m_faceTypesToFaceElementsSlip[meshName][finiteElementName] = slipList; - //GEOS_LOG_LEVEL(2, - //GEOS_FMT( "# stick elements: {}, # slip elements: {}", nStick, nSlip )) + GEOS_LOG_LEVEL(2, + GEOS_FMT( "# stick elements: {}, # slip elements: {}", nStick, nSlip )) } ); } ); From 0a4121ad560810f9c9c91fa8d8b9577338188c2f Mon Sep 17 00:00:00 2001 From: mfrigo Date: Tue, 20 Aug 2024 19:38:37 -0700 Subject: [PATCH 09/41] Adding nested ALM --- .../constitutive/ConstitutivePassThru.hpp | 15 ++ .../constitutive/contact/CoulombContact.cpp | 2 +- .../constitutive/contact/CoulombContact.hpp | 2 +- .../contact/FrictionlessContact.cpp | 2 +- .../contact/FrictionlessContact.hpp | 2 +- .../contact/SolidMechanicsALMKernels.hpp | 151 ++++++++--- ...lidMechanicsAugmentedLagrangianContact.cpp | 235 ++++++++++-------- .../SolidMechanicsEmbeddedFractures.cpp | 4 +- .../contact/SolidMechanicsLagrangeContact.cpp | 4 +- .../multiphysics/HydrofractureSolver.cpp | 4 +- 10 files changed, 276 insertions(+), 145 deletions(-) diff --git a/src/coreComponents/constitutive/ConstitutivePassThru.hpp b/src/coreComponents/constitutive/ConstitutivePassThru.hpp index d2e22316b4a..4a0aa78fd8e 100644 --- a/src/coreComponents/constitutive/ConstitutivePassThru.hpp +++ b/src/coreComponents/constitutive/ConstitutivePassThru.hpp @@ -48,6 +48,7 @@ #include "permeability/ProppantPermeability.hpp" #include "permeability/SlipDependentPermeability.hpp" #include "permeability/WillisRichardsPermeability.hpp" +#include "contact/CoulombContact.hpp" namespace geos @@ -82,6 +83,20 @@ struct ConstitutivePassThru< ElasticIsotropic > } }; +/** + * Specialization for models that derive from ConstactCoulomb. + */ +template<> +struct ConstitutivePassThru< CoulombContact > +{ + template< typename LAMBDA > + static + void execute( ConstitutiveBase & constitutiveRelation, LAMBDA && lambda ) + { + ConstitutivePassThruHandler< CoulombContact >::execute( constitutiveRelation, + std::forward< LAMBDA >( lambda ) ); + } +}; /** * Specialization for models that derive from SolidBase. diff --git a/src/coreComponents/constitutive/contact/CoulombContact.cpp b/src/coreComponents/constitutive/contact/CoulombContact.cpp index 49d98a9244e..5ac7b44a551 100644 --- a/src/coreComponents/constitutive/contact/CoulombContact.cpp +++ b/src/coreComponents/constitutive/contact/CoulombContact.cpp @@ -68,7 +68,7 @@ void CoulombContact::allocateConstitutiveData( Group & parent, } -CoulombContactUpdates CoulombContact::createKernelWrapper() const +CoulombContactUpdates CoulombContact::createKernelUpdates() const { return CoulombContactUpdates( m_penaltyStiffness, m_shearStiffness, diff --git a/src/coreComponents/constitutive/contact/CoulombContact.hpp b/src/coreComponents/constitutive/contact/CoulombContact.hpp index 1d49dfa9e4e..2eb3b6b5fb7 100644 --- a/src/coreComponents/constitutive/contact/CoulombContact.hpp +++ b/src/coreComponents/constitutive/contact/CoulombContact.hpp @@ -162,7 +162,7 @@ class CoulombContact : public ContactBase * @brief Create an update kernel wrapper. * @return the wrapper */ - KernelWrapper createKernelWrapper() const; + KernelWrapper createKernelUpdates() const; protected: diff --git a/src/coreComponents/constitutive/contact/FrictionlessContact.cpp b/src/coreComponents/constitutive/contact/FrictionlessContact.cpp index 3e16b4e3e77..b597fd37b1c 100644 --- a/src/coreComponents/constitutive/contact/FrictionlessContact.cpp +++ b/src/coreComponents/constitutive/contact/FrictionlessContact.cpp @@ -40,7 +40,7 @@ void FrictionlessContact::allocateConstitutiveData( Group & parent, ContactBase::allocateConstitutiveData( parent, numConstitutivePointsPerParentIndex ); } -FrictionlessContactUpdates FrictionlessContact::createKernelWrapper() const +FrictionlessContactUpdates FrictionlessContact::createKernelUpdates() const { return FrictionlessContactUpdates( m_penaltyStiffness, m_shearStiffness, diff --git a/src/coreComponents/constitutive/contact/FrictionlessContact.hpp b/src/coreComponents/constitutive/contact/FrictionlessContact.hpp index 62e9a908402..cb3d380cf8d 100644 --- a/src/coreComponents/constitutive/contact/FrictionlessContact.hpp +++ b/src/coreComponents/constitutive/contact/FrictionlessContact.hpp @@ -133,7 +133,7 @@ class FrictionlessContact : public ContactBase * @brief Create an update kernel wrapper. * @return the wrapper */ - KernelWrapper createKernelWrapper() const; + KernelWrapper createKernelUpdates() const; /** * @struct Structure to hold scoped key names diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp index 3c705d63352..cdcb48f1b2c 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp @@ -51,6 +51,7 @@ class ALM : using Base::m_elemsToFaces; using Base::m_faceToNodes; using Base::m_finiteElementSpace; + using Base::m_constitutiveUpdate; using Base::m_dofNumber; using Base::m_bDofNumber; using Base::m_dofRankOffset; @@ -224,31 +225,11 @@ class ALM : } } - // The minus sign is consistent with the sign of the Jacobian - stack.localPenalty[0][0] = -m_penalty( k, 0 ); - if (m_isStickState) - { - stack.localPenalty[1][1] = -m_penalty( k, 1 ); - stack.localPenalty[2][2] = -m_penalty( k, 1 ); - } - else - { - stack.localPenalty[1][1] = 0.0; - stack.localPenalty[2][2] = 0.0; - } - for( int i=0; i zero) + { + tractionNew[0] = 0.0; + stack.localPenalty[0][0] = 0.0; + } + else + { + tractionNew[0] = stack.tLocal[0] + m_penalty(k, 0) * stack.dispJumpLocal[0]; + stack.localPenalty[0][0] = -m_penalty( k, 0 ); + } + + // Compute limit Tau + if (symmetric) + { + limitTau = m_constitutiveUpdate.computeLimitTangentialTractionNorm( m_traction(k, 0), + dLimitTangentialTractionNorm_dTraction ); + } + else + { + limitTau = m_constitutiveUpdate.computeLimitTangentialTractionNorm( tractionNew[0], + dLimitTangentialTractionNorm_dTraction ); + } + + if (tractionTrialNorm <= zero) + { + // It is needed for the first iteration (both t and u are equal to zero) + stack.localPenalty[1][1] = -m_penalty( k, 1); + stack.localPenalty[2][2] = -m_penalty( k, 1); + + tractionNew[1] = tractionTrial[1]; + tractionNew[2] = tractionTrial[2]; + } + else if (limitTau <= zero) + { + stack.localPenalty[1][1] = 0.0; + stack.localPenalty[2][2] = 0.0; + + tractionNew[1] = (symmetric) ? tractionTrial[1] : 0.0; + tractionNew[2] = (symmetric) ? tractionTrial[2] : 0.0; + } + + else + { + // Compute psi and dpsi + //real64 const psi = std::tanh( tractionTrialNorm/limitTau ); + //real64 const dpsi = 1.0-std::pow(psi,2); + real64 const psi = ( tractionTrialNorm > limitTau) ? 1.0 : tractionTrialNorm/limitTau; + real64 const dpsi = ( tractionTrialNorm > limitTau) ? 0.0 : 1.0; + + // Two symmetric 2x2 matrices + real64 dNormTTdgT[ 3 ]; + dNormTTdgT[ 0 ] = tractionTrial[ 1 ] * tractionTrial[ 1 ]; + dNormTTdgT[ 1 ] = tractionTrial[ 2 ] * tractionTrial[ 2 ]; + dNormTTdgT[ 2 ] = tractionTrial[ 1 ] * tractionTrial[ 2 ]; + + real64 dTdgT[ 3 ]; + dTdgT[ 0 ] = (tractionTrialNorm * tractionTrialNorm - dNormTTdgT[0]); + dTdgT[ 1 ] = (tractionTrialNorm * tractionTrialNorm - dNormTTdgT[1]); + dTdgT[ 2 ] = - dNormTTdgT[2]; + + LvArray::tensorOps::scale< 3 >( dNormTTdgT, 1. / std::pow(tractionTrialNorm, 2) ); + LvArray::tensorOps::scale< 3 >( dTdgT, 1. / std::pow( tractionTrialNorm, 3 ) ); + + // Compute dTdDispJump + stack.localPenalty[1][1] = -m_penalty( k, 1) * ( + dpsi * dNormTTdgT[0] + + psi * dTdgT[0] * limitTau ); + stack.localPenalty[2][2] = -m_penalty( k, 1) * ( + dpsi * dNormTTdgT[1] + + psi * dTdgT[1] * limitTau ); + stack.localPenalty[1][2] = -m_penalty( k, 1) * ( + dpsi * dNormTTdgT[2] + + psi * dTdgT[2] * limitTau ); + stack.localPenalty[2][1] = stack.localPenalty[1][2]; + + if (!symmetric) + { + // Nonsymetric term + //real64 const friction = m_constitutiveUpdate.frictionCoefficient(); + real64 const friction = (std::abs(tractionNew[0]) > zero) ? - limitTau / tractionNew[0] : 0.0; + stack.localPenalty[1][0] = -stack.localPenalty[0][0] * friction * + tractionTrial[1] * (psi/tractionTrialNorm - dpsi/limitTau); + stack.localPenalty[2][0] = -stack.localPenalty[0][0] * friction * + tractionTrial[2] * (psi/tractionTrialNorm - dpsi/limitTau); + } + + tensorOps::scale< 3 >( tractionTrial, (psi * limitTau)/tractionTrialNorm ); + tractionNew[1] = tractionTrial[1]; + tractionNew[2] = tractionTrial[2]; + } + + // transp(R) * Atu LvArray::tensorOps::Rij_eq_AkiBkj< 3, numUdofs, 3 >( matRRtAtu, stack.localRotationMatrix, stack.localAtu ); @@ -291,8 +377,8 @@ class ALM : stack.localAtb ); // Compute the traction contribute of the local residuals - LvArray::tensorOps::Ri_eq_AjiBj< numUdofs, 3 >( tractionR, matRRtAtu, stack.tLocal ); - LvArray::tensorOps::Ri_eq_AjiBj< numBdofs, 3 >( tractionRb, matRRtAtb, stack.tLocal ); + LvArray::tensorOps::Ri_eq_AjiBj< numUdofs, 3 >( tractionR, matRRtAtu, tractionNew ); + LvArray::tensorOps::Ri_eq_AjiBj< numBdofs, 3 >( tractionRb, matRRtAtb, tractionNew ); // D*RtAtu LvArray::tensorOps::Rij_eq_AikBkj< 3, numUdofs, 3 >( matDRtAtu, stack.localPenalty, @@ -324,18 +410,9 @@ class ALM : matRRtAtb ); // Compute the local residuals - LvArray::tensorOps::Ri_eq_AjiBj< numUdofs, 3 >( dispJumpR, matDRtAtu, stack.dispJumpLocal ); - LvArray::tensorOps::Ri_eq_AjiBj< numUdofs, 3 >( oldDispJumpR, matDRtAtu, stack.oldDispJumpLocal ); - LvArray::tensorOps::Ri_eq_AjiBj< numBdofs, 3 >( dispJumpRb, matDRtAtb, stack.dispJumpLocal ); - LvArray::tensorOps::Ri_eq_AjiBj< numBdofs, 3 >( oldDispJumpRb, matDRtAtb, stack.oldDispJumpLocal ); - LvArray::tensorOps::scaledAdd< numUdofs >( stack.localRu, tractionR, -1 ); - LvArray::tensorOps::scaledAdd< numUdofs >( stack.localRu, dispJumpR, 1 ); - LvArray::tensorOps::scaledAdd< numUdofs >( stack.localRu, oldDispJumpR, -1 ); LvArray::tensorOps::scaledAdd< numBdofs >( stack.localRb, tractionRb, -1 ); - LvArray::tensorOps::scaledAdd< numBdofs >( stack.localRb, dispJumpRb, 1 ); - LvArray::tensorOps::scaledAdd< numBdofs >( stack.localRb, oldDispJumpRb, -1 ); for( localIndex i=0; i < numUdofs; ++i ) { diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index 221cfc3ca18..3ccc8bcf3bf 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -261,7 +261,7 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & arrayView1d< real64 const > const normalDisplacementTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalDisplacementToleranceString() ); - arrayView1d< real64 > const slidingTolerance = + arrayView1d< real64 const > const slidingTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ); arrayView1d< real64 const > const normalTractionTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ); @@ -269,26 +269,22 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & arrayView1d< real64 const > const area = subRegion.getElementArea().toViewConst(); - arrayView2d< real64 > const + arrayView2d< real64 const > const penalty = subRegion.getField< fields::contact::penalty >().toView(); // Set the penalty coefficients forAll< parallelDevicePolicy<> >( subRegion.size(), [ penalty, normalTractionTolerance, normalDisplacementTolerance, slidingTolerance, - area, dispJumpUpdPenalty ] + area, dispJumpUpdPenalty, this ] GEOS_HOST_DEVICE ( localIndex const k ) { - penalty[k] [0] = normalTractionTolerance[k]/(normalDisplacementTolerance[k]*area[k] ); - penalty[k] [1] = penalty[k][0] * 1.0e-01; - - //GEOS_LOG_LEVEL(2, - //GEOS_FMT(" Element: {} penalty: {:4.2e} nDispTol: {:4.2e} sliTol: {:4.2e} nTraTol: {:4.2e} area: {:4.2e}\n", - //k, penalty[k][0], normalDisplacementTolerance[k], - //slidingTolerance[k], normalTractionTolerance[k], area[k] )); - LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); } ); + GEOS_LOG_LEVEL(2, + GEOS_FMT(" Element: {} penalty0: {:4.2e} penalty1: {:4.2e} nDispTol: {:4.2e} sliTol: {:4.2e} nTraTol: {:4.2e} area: {:4.2e}\n", + 0, penalty[0][0], penalty[0][0], normalDisplacementTolerance[0], + slidingTolerance[0], normalTractionTolerance[0], area[0] )); } ); @@ -353,11 +349,11 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time real64 maxTraction = finiteElement:: interfaceBasedKernelApplication < parallelDevicePolicy< >, - constitutive::NullModel >( mesh, + constitutive::CoulombContact >( mesh, fractureRegionName, faceElementList, subRegionFE, - "", + SolidMechanicsLagrangianFEM::viewKeyStruct::contactRelationNameString(), kernelFactory ); GEOS_UNUSED_VAR( maxTraction ); @@ -382,11 +378,11 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time real64 maxTraction = finiteElement:: interfaceBasedKernelApplication < parallelDevicePolicy< >, - constitutive::NullModel >( mesh, + constitutive::CoulombContact >( mesh, fractureRegionName, faceElementList, subRegionFE, - "", + SolidMechanicsLagrangianFEM::viewKeyStruct::contactRelationNameString(), kernelFactory ); GEOS_UNUSED_VAR( maxTraction ); @@ -715,49 +711,88 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit arrayView2d< real64 > const traction_new_v = traction_new.toView(); // Update Traction - forAll< parallelDevicePolicy<> >( subRegion.size(), - [ traction_new_v, traction, penalty, - dispJump, deltaDispJump, fractureState ] ( localIndex const kfe ) + constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { - real64 eps_N = penalty[kfe][0]; - real64 eps_T = penalty[kfe][1]; - traction_new_v[kfe][0] = traction[kfe][0] + eps_N * dispJump[kfe][0]; - traction_new_v[kfe][1] = traction[kfe][1]; - traction_new_v[kfe][2] = traction[kfe][2]; - if (fractureState[kfe] == contact::FractureState::Stick) + using ContactType = TYPEOFREF( castedContact ); + typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelUpdates(); + + forAll< parallelHostPolicy >( subRegion.size(), + [ traction_new_v, traction, + slidingTolerance, area, + dispJump, deltaDispJump, penalty, + fractureState, contactWrapper ] ( localIndex const kfe ) { - traction_new_v[kfe][1] += eps_T * deltaDispJump[kfe][1]; - traction_new_v[kfe][2] += eps_T * deltaDispJump[kfe][2]; - } + + real64 eps_N = penalty[kfe][0]; + real64 eps_T = penalty[kfe][1]; + traction_new_v[kfe][0] = traction[kfe][0] + eps_N * dispJump[kfe][0]; + traction_new_v[kfe][1] = traction[kfe][1] + eps_T * deltaDispJump[kfe][1]; + traction_new_v[kfe][2] = traction[kfe][2] + eps_T * deltaDispJump[kfe][2]; + + real64 const currentTau = std::sqrt( std::pow(traction_new_v[kfe][1], 2) + + std::pow(traction_new_v[kfe][2], 2)); + + real64 dLimitTangentialTractionNorm_dTraction = 0.0; + real64 const limitTau = + contactWrapper.computeLimitTangentialTractionNorm( traction_new_v[kfe][0], + dLimitTangentialTractionNorm_dTraction ); + + + // Compute psi + //real64 const psi = (limitTau < 1.e-10) ? 1.0 : std::tanh( currentTau/limitTau ); + real64 psi; + if (limitTau < 1.e-10) + { + psi = 1.0; + } + else + { + //psi = std::tanh(currentTau / limitTau); + psi = (currentTau > limitTau ) ? 1.0 : currentTau/limitTau; + } + + // Compute the new tangential traction + if (limitTau > 1.e-10 && currentTau > 1.e-10) + { + traction_new_v[kfe][1] *= limitTau * psi / currentTau; + traction_new_v[kfe][2] *= limitTau * psi / currentTau; + } + else + { + traction_new_v[kfe][1] *= 0.0; + traction_new_v[kfe][2] *= 0.0; + } + } ); } ); - //bool printflag = true; + bool printflag = true; real64 const slidingCheckTolerance = m_slidingCheckTolerance; constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { using ContactType = TYPEOFREF( castedContact ); - typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelWrapper(); + typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelUpdates(); forAll< parallelHostPolicy >( subRegion.size(), [ &condConv, ghostRank, traction_new_v, normalTractionTolerance, normalDisplacementTolerance, slidingTolerance, deltaDispJump, dispJump, area, - fractureState, contactWrapper, slidingCheckTolerance ] ( localIndex const kfe ) + fractureState, contactWrapper, slidingCheckTolerance, this, &printflag ] ( localIndex const kfe ) { if( ghostRank[kfe] < 0 ) { // Case 1: if it is open - if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) + //if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) + if( traction_new_v[kfe][0] > 0.0 ) { if (fractureState[kfe] != contact::FractureState::Open) { - //if (printflag) - //{ - // GEOS_LOG_LEVEL(2, - // GEOS_FMT(" Element: {}, traction_n > tol4 => open, traction_n: {:4.2e} tol4: {:4.2e}\n", - // kfe,traction_new_v[kfe][0], normalTractionTolerance[kfe] )); - // printflag = false; - //} + if (printflag) + { + GEOS_LOG_LEVEL(2, + GEOS_FMT(" Element: {}, traction_n > tol4 => open, traction_n: {:4.2e} tol4: {:4.2e}\n", + kfe,traction_new_v[kfe][0], normalTractionTolerance[kfe] )); + printflag = false; + } condConv = false; } traction_new_v[kfe][0] = 0.0; @@ -770,26 +805,26 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit real64 deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + pow( deltaDispJump[kfe][2], 2 )); if (( std::abs( dispJump[kfe][0]/area[kfe] ) > normalDisplacementTolerance[kfe] ) && (fractureState[kfe] != contact::FractureState::Open)) { - //if (printflag) - //{ - // GEOS_LOG_LEVEL(2, - // GEOS_FMT( " Element: {}, Stick mode and g_n > tol1 => compenetration, g_n: {:4.2e} tol1: {:4.2e}", - // kfe,std::abs(dispJump[kfe][0])/area[kfe], normalDisplacementTolerance[kfe] )); - // printflag = false; - //} + if (printflag) + { + GEOS_LOG_LEVEL(2, + GEOS_FMT( " Element: {}, Stick mode and g_n > tol1 => compenetration, g_n: {:4.2e} tol1: {:4.2e}", + kfe,std::abs(dispJump[kfe][0])/area[kfe], normalDisplacementTolerance[kfe] )); + printflag = false; + } condConv = false; } // Case 3: it is stick and dg is greater than 0 if( fractureState[kfe] == contact::FractureState::Stick && deltaDisp/area[kfe] > slidingTolerance[kfe] ) { - //if (printflag) - //{ - // GEOS_LOG_LEVEL(2, - // GEOS_FMT( " Element: {}, Stick and dg_t > tol2, dg_t: {:4.2e} tol2: {:4.2e}", - // kfe, deltaDisp/area[kfe], slidingTolerance[kfe] )) - // printflag = false; - //} + if (printflag) + { + GEOS_LOG_LEVEL(2, + GEOS_FMT( " Element: {}, Stick and dg_t > tol2, dg_t: {:4.2e} tol2: {:4.2e}", + kfe, deltaDisp/area[kfe], slidingTolerance[kfe] )) + printflag = false; + } condConv = false; } @@ -813,13 +848,13 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit if( currentTau > (std::abs(limitTau) * (1.0 + slidingCheckTolerance)) ) { - //if (printflag) - //{ - // GEOS_LOG_LEVEL(2, - // GEOS_FMT( " Element: {}, tau > tau_lim, tau: {:4.2e} tauLim: {:4.2e}", - // kfe, currentTau, limitTau )) - // printflag = false; - //} + if (printflag) + { + GEOS_LOG_LEVEL(2, + GEOS_FMT( " Element: {}, tau > tau_lim, tau: {:4.2e} tauLim: {:4.2e}", + kfe, currentTau, limitTau )) + printflag = false; + } condConv = false; } @@ -918,12 +953,12 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit traction_new_v[kfe][1] = traction[kfe][1] + eps_T * deltaDispJump[kfe][1]; traction_new_v[kfe][2] = traction[kfe][2] + eps_T * deltaDispJump[kfe][2]; } ); - + real64 const slidingCheckTolerance = m_slidingCheckTolerance; constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { using ContactType = TYPEOFREF( castedContact ); - typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelWrapper(); + typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelUpdates(); forAll< parallelHostPolicy >( subRegion.size(), [ contactWrapper, normalTractionTolerance, slidingTolerance, @@ -932,12 +967,13 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit dispJumpUpdPenalty, penalty, fractureState, area, dispJump, deltaDispJump, - traction, traction_new_v ] ( localIndex const kfe ) + traction, traction_new_v, this ] ( localIndex const kfe ) { // Case 1: if it is open - if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) + //if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) + if( traction_new_v[kfe][0] > 0.0 ) { fractureState[kfe] = contact::FractureState::Open; traction[kfe][0] = 0.0; @@ -960,15 +996,15 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit traction[kfe][2] = 0.0; // Update the penalty coefficient to accelerate the convergence - penalty[kfe][0] *= 10.0; + //penalty[kfe][0] *= 10.0; real64 const eps_N_lim = 1.0e+4*normalTractionTolerance[kfe]/(normalDisplacementTolerance[kfe]*area[kfe]); if (penalty[kfe][0] > eps_N_lim ) { - //GEOS_LOG_LEVEL(2, - //GEOS_FMT( " Element: {}, eps_N > eps_N_lim, eps: {:4.2e} epsLim: {:4.2e}", - //kfe, penalty[kfe][0], eps_N_lim )) - penalty[kfe][0] = eps_N_lim; + GEOS_LOG_LEVEL(2, + GEOS_FMT( " Element: {}, eps_N > eps_N_lim, eps: {:4.2e} epsLim: {:4.2e}", + kfe, penalty[kfe][0], eps_N_lim )) + //penalty[kfe][0] = eps_N_lim; } } else @@ -979,29 +1015,28 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit if ((std::abs(dispJump[kfe][0])/area[kfe] > normalDisplacementTolerance[kfe] ) && (std::abs(dispJump[kfe][0]) > 0.25 * std::abs(dispJumpUpdPenalty[kfe][0]))) { - penalty[kfe][0] *= 10.0; + //penalty[kfe][0] *= 10.0; real64 const eps_N_lim = 1.0e+4*normalTractionTolerance[kfe]/(normalDisplacementTolerance[kfe]*area[kfe]); if (penalty[kfe][0] > eps_N_lim ) { - //GEOS_LOG_LEVEL(2, - //GEOS_FMT( " Element: {}, eps_N > eps_N_lim, eps: {:4.2e} epsLim: {:4.2e}", - //kfe, penalty[kfe][0], eps_N_lim )) - penalty[kfe][0] = eps_N_lim; + GEOS_LOG_LEVEL(2, + GEOS_FMT( " Element: {}, eps_N > eps_N_lim, eps: {:4.2e} epsLim: {:4.2e}", + kfe, penalty[kfe][0], eps_N_lim )) + //penalty[kfe][0] = eps_N_lim; } - } - + real64 currentTau = sqrt( pow(traction_new_v[kfe][1], 2 ) + pow(traction_new_v[kfe][2], 2 ) ); - + real64 dLimitTangentialTractionNorm_dTraction = 0.0; real64 const limitTau = contactWrapper.computeLimitTangentialTractionNorm( traction[kfe][0], dLimitTangentialTractionNorm_dTraction ); + + real64 psi = currentTau / limitTau; - real64 const LimitTangentialTractionNorm_TangentialTractionNorm = std::abs(limitTau) / currentTau; - //if( originalFractureState == contact::FractureState::Stick && currentTau >= limitTau ) //{ // currentTau *= (1.0 - slidingCheckTolerance); @@ -1010,15 +1045,16 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit //{ // currentTau *= (1.0 + slidingCheckTolerance); //} - + // Case 3: if it is slip - if( currentTau >= (std::abs(limitTau) * (1.0 + slidingCheckTolerance)) ) + //if( currentTau >= (std::abs(limitTau) * (1.0 + slidingCheckTolerance)) ) + if( currentTau > limitTau ) { fractureState[kfe] = contact::FractureState::Slip; - - traction[kfe][1] = traction_new_v( kfe, 1 ) * LimitTangentialTractionNorm_TangentialTractionNorm; - traction[kfe][2] = traction_new_v( kfe, 2 ) * LimitTangentialTractionNorm_TangentialTractionNorm; - + + traction[kfe][1] = traction_new_v( kfe, 1 ) / psi; + traction[kfe][2] = traction_new_v( kfe, 2 ) / psi; + } // Case 4: if it is stick else @@ -1026,29 +1062,27 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit fractureState[kfe] = contact::FractureState::Stick; traction[kfe][1] = traction_new_v( kfe, 1 ); traction[kfe][2] = traction_new_v( kfe, 2 ); - + // Update the penalty coefficient to accelerate the convergence - real64 const deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + - pow( deltaDispJump[kfe][2], 2 )); real64 const deltaDispUpdPenalty = sqrt( pow( dispJumpUpdPenalty[kfe][1], 2 ) + pow( dispJumpUpdPenalty[kfe][2], 2 )); - + real64 const deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + + pow( deltaDispJump[kfe][2], 2 )); + if (( deltaDisp/area[kfe] > slidingTolerance[kfe] ) && ( deltaDisp > 0.25 * deltaDispUpdPenalty)) { - penalty[kfe][1] *= 10.0; - + //penalty[kfe][1] *= 10.0; + real64 const eps_T_lim = 1.0e+04 * normalTractionTolerance[kfe]/(slidingTolerance[kfe] * area[kfe] * 10 ); if (penalty[kfe][1] > eps_T_lim ) { - //GEOS_LOG_LEVEL(2, - //GEOS_FMT( " Element: {}, eps_T > eps_T_lim, eps: {:4.2e} epsLim: {:4.2e}", - //kfe, penalty[kfe][1], eps_T_lim )) + GEOS_LOG_LEVEL(2, + GEOS_FMT( " Element: {}, eps_T > eps_T_lim, eps: {:4.2e} epsLim: {:4.2e}", + kfe, penalty[kfe][1], eps_T_lim )) penalty[kfe][1] = eps_T_lim; } - } - } } } @@ -1691,6 +1725,9 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio arrayView1d< real64 > const slidingTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ); + arrayView2d< real64 > const + penalty = subRegion.getField< fields::contact::penalty >().toView(); + forAll< parallelHostPolicy >( subRegion.size(), [=] ( localIndex const kfe ) { @@ -1773,11 +1810,13 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio LvArray::tensorOps::scale< 3, 3 >( rotatedInvStiffApprox, area ); // Finally, compute tolerances for the given fracture element - normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+8; + normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+7; slidingTolerance[kfe] = sqrt( pow(rotatedInvStiffApprox[ 1 ][ 1 ],2) + - pow(rotatedInvStiffApprox[ 2 ][ 2 ],2)) * averageYoungModulus / 2.e+8; + pow(rotatedInvStiffApprox[ 2 ][ 2 ],2)) * averageYoungModulus / 2.e+6; normalTractionTolerance[kfe] = (1.0 / 2.0) * (averageConstrainedModulus / averageBoxSize0) * - (normalDisplacementTolerance[kfe])*1.0e+01; + (normalDisplacementTolerance[kfe]); + penalty[kfe][0] = 1e+01*averageConstrainedModulus/(averageBoxSize0*area); + penalty[kfe][1] = 1e-01*averageConstrainedModulus/(averageBoxSize0*area); } ); } diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp index 563a07119ed..8c07f64aad5 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp @@ -735,7 +735,7 @@ void SolidMechanicsEmbeddedFractures::updateState( DomainPartition & domain ) constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { using ContactType = TYPEOFREF( castedContact ); - typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelWrapper(); + typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelUpdates(); solidMechanicsEFEMKernels::StateUpdateKernel:: launch< parallelDevicePolicy<> >( subRegion.size(), @@ -770,7 +770,7 @@ bool SolidMechanicsEmbeddedFractures::updateConfiguration( DomainPartition & dom constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { using ContactType = TYPEOFREF( castedContact ); - typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelWrapper(); + typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelUpdates(); RAJA::ReduceMin< parallelHostReduce, integer > checkActiveSetSub( 1 ); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp index ef3b942a431..ffd21bd919c 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp @@ -1167,7 +1167,7 @@ void SolidMechanicsLagrangeContact:: constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { using ContactType = TYPEOFREF( castedContact ); - typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelWrapper(); + typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelUpdates(); forAll< parallelHostPolicy >( subRegion.size(), [=] ( localIndex const kfe ) { @@ -1889,7 +1889,7 @@ bool SolidMechanicsLagrangeContact::updateConfiguration( DomainPartition & domai constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { using ContactType = TYPEOFREF( castedContact ); - typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelWrapper(); + typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelUpdates(); forAll< parallelHostPolicy >( subRegion.size(), [=] ( localIndex const kfe ) { diff --git a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp index d761bd92327..a0f3b3a4138 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp @@ -317,7 +317,7 @@ void HydrofractureSolver< POROMECHANICS_SOLVER >::updateHydraulicApertureAndFrac constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { using ContactType = TYPEOFREF( castedContact ); - typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelWrapper(); + typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelUpdates(); auto const statistics = hydrofractureSolverKernels::DeformationUpdateKernel ::launch< parallelDevicePolicy<> >( subRegion.size(), @@ -828,7 +828,7 @@ assembleFluidMassResidualDerivativeWrtDisplacement( DomainPartition const & doma constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { using ContactType = TYPEOFREF( castedContact ); - typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelWrapper(); + typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelUpdates(); hydrofractureSolverKernels::FluidMassResidualDerivativeAssemblyKernel:: launch< parallelDevicePolicy<> >( subRegion.size(), From e2b3a71006a30b6a5c78345d302bf5b2662975ef Mon Sep 17 00:00:00 2001 From: mfrigo Date: Wed, 21 Aug 2024 17:30:40 -0700 Subject: [PATCH 10/41] Adding simultaneous and nested ALM - bug in the jacobian fixed - cleaning up the code --- .../physicsSolvers/CMakeLists.txt | 1 + .../contact/SolidMechanicsALMKernels.hpp | 58 +-- .../contact/SolidMechanicsALMKernelsBase.hpp | 41 ++ .../SolidMechanicsALMSimultaneousKernels.hpp | 449 ++++++++++++++++++ ...lidMechanicsAugmentedLagrangianContact.cpp | 427 +++++++++++------ ...lidMechanicsAugmentedLagrangianContact.hpp | 4 + 6 files changed, 774 insertions(+), 206 deletions(-) create mode 100644 src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp diff --git a/src/coreComponents/physicsSolvers/CMakeLists.txt b/src/coreComponents/physicsSolvers/CMakeLists.txt index 10cc92b20e3..8bfdea521c5 100644 --- a/src/coreComponents/physicsSolvers/CMakeLists.txt +++ b/src/coreComponents/physicsSolvers/CMakeLists.txt @@ -18,6 +18,7 @@ set( physicsSolvers_headers contact/SolidMechanicsAugmentedLagrangianContact.hpp contact/SolidMechanicsALMKernelsBase.hpp contact/SolidMechanicsALMKernels.hpp + contact/SolidMechanicsALMSimultaneousKernels.hpp contact/SolidMechanicsALMKernelsHelper.hpp contact/SolidMechanicsALMJumpUpdateKernels.hpp contact/SolidMechanicsALMBubbleKernels.hpp diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp index cdcb48f1b2c..93bceb2b7cb 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp @@ -81,7 +81,7 @@ class ALM : arrayView1d< real64 > const inputRhs, real64 const inputDt, arrayView1d< localIndex const > const & faceElementList, - bool const isStickState ): + bool const isSymmetric ): Base( nodeManager, edgeManager, faceManager, @@ -97,7 +97,7 @@ class ALM : inputDt, faceElementList ), m_traction( elementSubRegion.getField< fields::contact::traction >().toViewConst()), - m_isStickState( isStickState) + m_symmetric( isSymmetric) {} //*************************************************************************** @@ -249,7 +249,6 @@ class ALM : StackVariables & stack ) const { GEOS_UNUSED_VAR( k ); - constexpr bool symmetric = false; constexpr real64 zero = 1.e-10; constexpr int numUdofs = numNodesPerElem * 3 * 2; @@ -284,12 +283,12 @@ class ALM : } else { - tractionNew[0] = stack.tLocal[0] + m_penalty(k, 0) * stack.dispJumpLocal[0]; + tractionNew[0] = tractionTrial[0]; stack.localPenalty[0][0] = -m_penalty( k, 0 ); } // Compute limit Tau - if (symmetric) + if (m_symmetric) { limitTau = m_constitutiveUpdate.computeLimitTangentialTractionNorm( m_traction(k, 0), dLimitTangentialTractionNorm_dTraction ); @@ -314,8 +313,8 @@ class ALM : stack.localPenalty[1][1] = 0.0; stack.localPenalty[2][2] = 0.0; - tractionNew[1] = (symmetric) ? tractionTrial[1] : 0.0; - tractionNew[2] = (symmetric) ? tractionTrial[2] : 0.0; + tractionNew[1] = (m_symmetric) ? tractionTrial[1] : 0.0; + tractionNew[2] = (m_symmetric) ? tractionTrial[2] : 0.0; } else @@ -352,7 +351,7 @@ class ALM : psi * dTdgT[2] * limitTau ); stack.localPenalty[2][1] = stack.localPenalty[1][2]; - if (!symmetric) + if (!m_symmetric) { // Nonsymetric term //real64 const friction = m_constitutiveUpdate.frictionCoefficient(); @@ -463,7 +462,7 @@ class ALM : arrayView2d< real64 const > const m_traction; - bool const m_isStickState; + bool const m_symmetric; }; @@ -478,47 +477,6 @@ using ALMFactory = finiteElement::InterfaceKernelFactory< ALM, arrayView1d< localIndex const > const, bool const >; -/** - * @brief A struct to compute rotation matrices - */ -struct ComputeRotationMatricesKernel -{ - - /** - * @brief Launch the kernel function to comute rotation matrices - * @tparam POLICY the type of policy used in the kernel launch - * @param[in] size the size of the subregion - * @param[in] faceNormal the array of array containing the face to nodes map - * @param[in] elemsToFaces the array of array containing the element to faces map - * @param[out] rotationMatrix the array containing the rotation matrices - */ - template< typename POLICY > - static void - launch( localIndex const size, - arrayView2d< real64 const > const & faceNormal, - ArrayOfArraysView< localIndex const > const & elemsToFaces, - arrayView3d< real64 > const & rotationMatrix ) - { - - forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) - { - - localIndex const & f0 = elemsToFaces[k][0]; - localIndex const & f1 = elemsToFaces[k][1]; - - real64 Nbar[3]; - Nbar[0] = faceNormal[f0][0] - faceNormal[f1][0]; - Nbar[1] = faceNormal[f0][1] - faceNormal[f1][1]; - Nbar[2] = faceNormal[f0][2] - faceNormal[f1][2]; - - LvArray::tensorOps::normalize< 3 >( Nbar ); - computationalGeometry::RotationMatrix_3D( Nbar, rotationMatrix[k] ); - - } ); - } - -}; - } // namespace SolidMechanicsALMKernels } // namespace geos diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp index ab9c9fab0b9..658bfd0dd82 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp @@ -265,6 +265,47 @@ class ALMKernelsBase : }; +/** + * @brief A struct to compute rotation matrices + */ +struct ComputeRotationMatricesKernel +{ + + /** + * @brief Launch the kernel function to comute rotation matrices + * @tparam POLICY the type of policy used in the kernel launch + * @param[in] size the size of the subregion + * @param[in] faceNormal the array of array containing the face to nodes map + * @param[in] elemsToFaces the array of array containing the element to faces map + * @param[out] rotationMatrix the array containing the rotation matrices + */ + template< typename POLICY > + static void + launch( localIndex const size, + arrayView2d< real64 const > const & faceNormal, + ArrayOfArraysView< localIndex const > const & elemsToFaces, + arrayView3d< real64 > const & rotationMatrix ) + { + + forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) + { + + localIndex const & f0 = elemsToFaces[k][0]; + localIndex const & f1 = elemsToFaces[k][1]; + + real64 Nbar[3]; + Nbar[0] = faceNormal[f0][0] - faceNormal[f1][0]; + Nbar[1] = faceNormal[f0][1] - faceNormal[f1][1]; + Nbar[2] = faceNormal[f0][2] - faceNormal[f1][2]; + + LvArray::tensorOps::normalize< 3 >( Nbar ); + computationalGeometry::RotationMatrix_3D( Nbar, rotationMatrix[k] ); + + } ); + } + +}; + } // namespace SolidMechanicsALMKernels } // namespace geos diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp new file mode 100644 index 00000000000..9a1cfc2673f --- /dev/null +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp @@ -0,0 +1,449 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 Total, S.A + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file SolidMechanicsALMSimultaneousKernels.hpp + */ + +#ifndef GEOS_PHYSICSSOLVERS_CONTACT_SOLIDMECHANICSALMSIMULTANEOUSKERNELS_HPP_ +#define GEOS_PHYSICSSOLVERS_CONTACT_SOLIDMECHANICSALMSIMULTANEOUSKERNELS_HPP_ + +#include "SolidMechanicsALMKernelsBase.hpp" + +namespace geos +{ + +namespace solidMechanicsALMKernels +{ + +/** + * @copydoc geos::finiteElement::ImplicitKernelBase + */ +template< typename CONSTITUTIVE_TYPE, + typename FE_TYPE > +class ALMSimultaneous : + public ALMKernelsBase< CONSTITUTIVE_TYPE, + FE_TYPE > +{ +public: + /// Alias for the base class. + using Base = ALMKernelsBase< CONSTITUTIVE_TYPE, + FE_TYPE >; + + /// Maximum number of nodes per element, which is equal to the maxNumTestSupportPointPerElem and + /// maxNumTrialSupportPointPerElem by definition. + static constexpr int numNodesPerElem = Base::maxNumTestSupportPointsPerElem; + + /// Compile time value for the number of quadrature points per element. + static constexpr int numQuadraturePointsPerElem = FE_TYPE::numQuadraturePoints; + + using Base::m_elemsToFaces; + using Base::m_faceToNodes; + using Base::m_finiteElementSpace; + using Base::m_dofNumber; + using Base::m_bDofNumber; + using Base::m_dofRankOffset; + using Base::m_X; + using Base::m_rotationMatrix; + using Base::m_penalty; + using Base::m_dispJump; + using Base::m_oldDispJump; + using Base::m_matrix; + using Base::m_rhs; + + /** + * @brief Constructor + * @copydoc geos::finiteElement::InterfaceKernelBase::InterfaceKernelBase + */ + ALMSimultaneous( NodeManager const & nodeManager, + EdgeManager const & edgeManager, + FaceManager const & faceManager, + localIndex const targetRegionIndex, + FaceElementSubRegion & elementSubRegion, + FE_TYPE const & finiteElementSpace, + CONSTITUTIVE_TYPE & inputConstitutiveType, + arrayView1d< globalIndex const > const uDofNumber, + arrayView1d< globalIndex const > const bDofNumber, + globalIndex const rankOffset, + CRSMatrixView< real64, globalIndex const > const inputMatrix, + arrayView1d< real64 > const inputRhs, + real64 const inputDt, + arrayView1d< localIndex const > const & faceElementList ): + Base( nodeManager, + edgeManager, + faceManager, + targetRegionIndex, + elementSubRegion, + finiteElementSpace, + inputConstitutiveType, + uDofNumber, + bDofNumber, + rankOffset, + inputMatrix, + inputRhs, + inputDt, + faceElementList ), + m_traction( elementSubRegion.getField< fields::contact::traction >().toViewConst()) + {} + + //*************************************************************************** + + /** + * @copydoc finiteElement::KernelBase::StackVariables + */ + struct StackVariables : public Base::StackVariables + { + + /// The number of displacement dofs per element. + static constexpr int numUdofs = numNodesPerElem * 3 * 2; + + /// The number of lagrange multiplier dofs per element. + static constexpr int numTdofs = 3; + + /// The number of bubble dofs per element. + static constexpr int numBdofs = 3*2; + +public: + + GEOS_HOST_DEVICE + StackVariables(): + Base::StackVariables(), + dispEqnRowIndices{}, + dispColIndices{}, + bEqnRowIndices{}, + bColIndices{}, + localRu{}, + localRb{}, + localAutAtu{ {} }, + localAbtAtb{ {} }, + localAbtAtu{ {} }, + localAutAtb{ {} }, + tLocal{} + {} + + /// C-array storage for the element local row degrees of freedom. + globalIndex dispEqnRowIndices[numUdofs]; + + /// C-array storage for the element local column degrees of freedom. + globalIndex dispColIndices[numUdofs]; + + /// C-array storage for the element local row degrees of freedom. + globalIndex bEqnRowIndices[numBdofs]; + + /// C-array storage for the element local column degrees of freedom. + globalIndex bColIndices[numBdofs]; + + /// C-array storage for the element local Ru residual vector. + real64 localRu[numUdofs]; + + /// C-array storage for the element local Rb residual vector. + real64 localRb[numBdofs]; + + /// C-array storage for the element local AutAtu matrix. + real64 localAutAtu[numUdofs][numUdofs]; + + /// C-array storage for the element local AbtAtb matrix. + real64 localAbtAtb[numBdofs][numBdofs]; + + /// C-array storage for the element local AbtAtu matrix. + real64 localAbtAtu[numBdofs][numUdofs]; + + /// C-array storage for the element local AbtAtu matrix. + real64 localAutAtb[numUdofs][numBdofs]; + + /// Stack storage for the element local lagrange multiplier vector + real64 tLocal[numTdofs]; + + }; + + //*************************************************************************** + + //START_kernelLauncher + template< typename POLICY, + typename KERNEL_TYPE > + static + real64 + kernelLaunch( localIndex const numElems, + KERNEL_TYPE const & kernelComponent ) + { + return Base::template kernelLaunch< POLICY, KERNEL_TYPE >( numElems, kernelComponent ); + } + //END_kernelLauncher + + /** + * @brief Copy global values from primary field to a local stack array. + * @copydoc ::geos::finiteElement::InterfaceKernelBase::setup + */ + GEOS_HOST_DEVICE + inline + void setup( localIndex const k, + StackVariables & stack ) const + { + constexpr int shift = numNodesPerElem * 3; + + constexpr int numTdofs = 3; + + int permutation[numNodesPerElem]; + m_finiteElementSpace.getPermutation( permutation ); + + localIndex const kf0 = m_elemsToFaces[k][0]; + localIndex const kf1 = m_elemsToFaces[k][1]; + for( localIndex a=0; a( tractionNew, stack.tLocal, -1.0 ); + LvArray::tensorOps::Ri_add_AijBj< 3, 3 >( tractionNew, stack.localPenalty, dispJump ); + + // If normal tangential trial is positive (opening) + //if (tractionNew[ 0 ] < -zero) + //{ + // tractionNew[0] = 0.0; + // stack.localPenalty[0][0] = 0.0; + //} + + // transp(R) * Atu + LvArray::tensorOps::Rij_eq_AkiBkj< 3, numUdofs, 3 >( matRRtAtu, stack.localRotationMatrix, + stack.localAtu ); + // transp(R) * Atb + LvArray::tensorOps::Rij_eq_AkiBkj< 3, numBdofs, 3 >( matRRtAtb, stack.localRotationMatrix, + stack.localAtb ); + + // Compute the traction contribute of the local residuals + LvArray::tensorOps::Ri_eq_AjiBj< numUdofs, 3 >( tractionR, matRRtAtu, tractionNew ); + LvArray::tensorOps::Ri_eq_AjiBj< numBdofs, 3 >( tractionRb, matRRtAtb, tractionNew ); + + // D*RtAtu + LvArray::tensorOps::Rij_eq_AikBkj< 3, numUdofs, 3 >( matDRtAtu, stack.localPenalty, + matRRtAtu ); + // D*RtAtb + LvArray::tensorOps::Rij_eq_AikBkj< 3, numBdofs, 3 >( matDRtAtb, stack.localPenalty, + matRRtAtb ); + + // R*RtAtu + LvArray::tensorOps::Rij_eq_AikBkj< 3, numUdofs, 3 >( matRRtAtu, stack.localRotationMatrix, + matDRtAtu ); + // R*RtAtb + LvArray::tensorOps::Rij_eq_AikBkj< 3, numBdofs, 3 >( matRRtAtb, stack.localRotationMatrix, + matDRtAtb ); + + // transp(Atu)*RRtAtu + LvArray::tensorOps::Rij_eq_AkiBkj< numUdofs, numUdofs, 3 >( stack.localAutAtu, stack.localAtu, + matRRtAtu ); + // transp(Atb)*RRtAtb + LvArray::tensorOps::Rij_eq_AkiBkj< numBdofs, numBdofs, 3 >( stack.localAbtAtb, stack.localAtb, + matRRtAtb ); + + // transp(Atb)*RRtAtu + LvArray::tensorOps::Rij_eq_AkiBkj< numBdofs, numUdofs, 3 >( stack.localAbtAtu, stack.localAtb, + matRRtAtu ); + + // transp(Atu)*RRtAtb + LvArray::tensorOps::Rij_eq_AkiBkj< numUdofs, numBdofs, 3 >( stack.localAutAtb, stack.localAtu, + matRRtAtb ); + + // Compute the local residuals + //LvArray::tensorOps::Ri_eq_AjiBj< numUdofs, 3 >( dispJumpR, matDRtAtu, stack.dispJumpLocal ); + //LvArray::tensorOps::Ri_eq_AjiBj< numUdofs, 3 >( oldDispJumpR, matDRtAtu, stack.oldDispJumpLocal ); + //LvArray::tensorOps::Ri_eq_AjiBj< numBdofs, 3 >( dispJumpRb, matDRtAtb, stack.dispJumpLocal ); + //LvArray::tensorOps::Ri_eq_AjiBj< numBdofs, 3 >( oldDispJumpRb, matDRtAtb, stack.oldDispJumpLocal ); + + LvArray::tensorOps::scaledAdd< numUdofs >( stack.localRu, tractionR, 1 ); + //LvArray::tensorOps::scaledAdd< numUdofs >( stack.localRu, dispJumpR, 1 ); + //LvArray::tensorOps::scaledAdd< numUdofs >( stack.localRu, oldDispJumpR, -1 ); + + LvArray::tensorOps::scaledAdd< numBdofs >( stack.localRb, tractionRb, 1 ); + //LvArray::tensorOps::scaledAdd< numBdofs >( stack.localRb, dispJumpRb, 1 ); + //LvArray::tensorOps::scaledAdd< numBdofs >( stack.localRb, oldDispJumpRb, -1 ); + + for( localIndex i=0; i < numUdofs; ++i ) + { + localIndex const dof = LvArray::integerConversion< localIndex >( stack.dispEqnRowIndices[ i ] ); + + if( dof < 0 || dof >= m_matrix.numRows() ) continue; + + // Is it necessary? Each row should be indepenedent + RAJA::atomicAdd< parallelDeviceAtomic >( &m_rhs[dof], stack.localRu[i] ); + + // Fill in matrix + m_matrix.template addToRowBinarySearchUnsorted< parallelDeviceAtomic >( dof, + stack.dispColIndices, + stack.localAutAtu[i], + numUdofs ); + + m_matrix.template addToRowBinarySearchUnsorted< parallelDeviceAtomic >( dof, + stack.bColIndices, + stack.localAutAtb[i], + numBdofs ); + } + + for( localIndex i=0; i < numBdofs; ++i ) + { + localIndex const dof = LvArray::integerConversion< localIndex >( stack.bEqnRowIndices[ i ] ); + + if( dof < 0 || dof >= m_matrix.numRows() ) continue; + + // Is it necessary? Each row should be indepenedent + RAJA::atomicAdd< parallelDeviceAtomic >( &m_rhs[dof], stack.localRb[i] ); + + // Fill in matrix + m_matrix.template addToRowBinarySearchUnsorted< parallelDeviceAtomic >( dof, + stack.bColIndices, + stack.localAbtAtb[i], + numBdofs ); + + m_matrix.template addToRowBinarySearchUnsorted< parallelDeviceAtomic >( dof, + stack.dispColIndices, + stack.localAbtAtu[i], + numUdofs ); + } + + return 0.0; + } + +protected: + + arrayView2d< real64 const > const m_traction; +}; + +/// The factory used to construct the kernel. +using ALMSimultaneousFactory = finiteElement::InterfaceKernelFactory< ALMSimultaneous, + arrayView1d< globalIndex const > const, + arrayView1d< globalIndex const > const, + globalIndex const, + CRSMatrixView< real64, globalIndex const > const, + arrayView1d< real64 > const, + real64 const, + arrayView1d< localIndex const > const>; + +/** + * @brief A struct to compute the traction after nonlinear solve + */ +struct ComputeTractionSimultaneousKernel +{ + + /** + * @brief Launch the kernel function to comute rotation matrices + * @tparam POLICY the type of policy used in the kernel launch + * @param[in] size the size of the subregion + * @param[in] penalty the array containing the tangential penalty matrix + * @param[in] traction the array containing the current traction + * @param[in] dispJump the array containing the displacement jump + * @param[in] deltaDispJump the array containing the delta displacement jump + * @param[out] traction_new the array containing the new traction + */ + template< typename POLICY > + static void + launch( localIndex const size, + arrayView2d< real64 const > const & penalty, + arrayView2d< real64 const > const & traction, + arrayView2d< real64 const > const & dispJump, + arrayView2d< real64 const > const & deltaDispJump, + arrayView2d< real64 > const & traction_new ) + { + + forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const kfe ) + { + traction_new[kfe][0] = traction[kfe][0] + penalty[kfe][0] * dispJump[kfe][0]; + traction_new[kfe][1] = traction[kfe][1] + penalty[kfe][2] * deltaDispJump[kfe][1] + + penalty[kfe][4] * deltaDispJump[kfe][2]; + traction_new[kfe][2] = traction[kfe][2] + penalty[kfe][3] * deltaDispJump[kfe][2] + + penalty[kfe][4] * deltaDispJump[kfe][1]; + } ); + } + +}; + +} // namespace SolidMechanicsALMKernels + +} // namespace geos + + +#endif /* GEOS_PHYSICSSOLVERS_CONTACT_SOLIDMECHANICSALMKERNELS_HPP_ */ diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index 3ccc8bcf3bf..b93ff4b5751 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -20,6 +20,7 @@ #include "SolidMechanicsAugmentedLagrangianContact.hpp" #include "physicsSolvers/contact/SolidMechanicsALMKernels.hpp" +#include "physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp" #include "physicsSolvers/contact/SolidMechanicsALMJumpUpdateKernels.hpp" #include "physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp" @@ -99,7 +100,7 @@ void SolidMechanicsAugmentedLagrangianContact::registerDataOnMesh( dataRepositor // Register the displacement jump subRegion.registerField< contact::penalty >( this->getName() ). - reference().resizeDimension< 1 >( 2 ); + reference().resizeDimension< 1 >( 5 ); subRegion.registerWrapper< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ). setPlotLevel( PlotLevel::NOPLOT ). @@ -259,33 +260,41 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & arrayView2d< real64 > const dispJumpUpdPenalty = subRegion.getReference< array2d< real64 > >( viewKeyStruct::dispJumpUpdPenaltyString() ); - arrayView1d< real64 const > const normalDisplacementTolerance = - subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalDisplacementToleranceString() ); - arrayView1d< real64 const > const slidingTolerance = - subRegion.getReference< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ); - arrayView1d< real64 const > const normalTractionTolerance = - subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ); - - arrayView1d< real64 const > const area = - subRegion.getElementArea().toViewConst(); - - arrayView2d< real64 const > const + arrayView2d< real64 > const penalty = subRegion.getField< fields::contact::penalty >().toView(); + arrayView1d< integer const > const fractureState = subRegion.getField< contact::fractureState >(); - // Set the penalty coefficients - forAll< parallelDevicePolicy<> >( subRegion.size(), - [ penalty, normalTractionTolerance, - normalDisplacementTolerance, slidingTolerance, - area, dispJumpUpdPenalty, this ] - GEOS_HOST_DEVICE ( localIndex const k ) + if (m_simultaneous) { - LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); - } ); - GEOS_LOG_LEVEL(2, - GEOS_FMT(" Element: {} penalty0: {:4.2e} penalty1: {:4.2e} nDispTol: {:4.2e} sliTol: {:4.2e} nTraTol: {:4.2e} area: {:4.2e}\n", - 0, penalty[0][0], penalty[0][0], normalDisplacementTolerance[0], - slidingTolerance[0], normalTractionTolerance[0], area[0] )); - + // Set the penalty coefficients + forAll< parallelDevicePolicy<> >( subRegion.size(), + [ penalty, fractureState, dispJumpUpdPenalty ] + GEOS_HOST_DEVICE ( localIndex const k ) + { + if (fractureState[k] == contact::FractureState::Stick) + { + penalty[k][2] = penalty[k][1]; + penalty[k][3] = penalty[k][1]; + penalty[k][4] = 0.0; + } + else + { + penalty[k][2] = 0.0; + penalty[k][3] = 0.0; + penalty[k][4] = 0.0; + } + LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); + } ); + } + else + { + forAll< parallelDevicePolicy<> >( subRegion.size(), + [ dispJumpUpdPenalty ] + GEOS_HOST_DEVICE ( localIndex const k ) + { + LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); + } ); + } } ); } @@ -332,60 +341,110 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time string const & fractureRegionName = this->getUniqueFractureRegionName(); forFiniteElementOnStickFractureSubRegions( meshName, [&] ( string const & , - finiteElement::FiniteElementBase const & subRegionFE, - arrayView1d< localIndex const > const & faceElementList, - bool const isStickState ) + finiteElement::FiniteElementBase const & subRegionFE, + arrayView1d< localIndex const > const & faceElementList, + bool const ) { - solidMechanicsALMKernels::ALMFactory kernelFactory( dispDofNumber, - bubbleDofNumber, - dofManager.rankOffset(), - localMatrix, - localRhs, - dt, + if (m_simultaneous) + { + solidMechanicsALMKernels::ALMSimultaneousFactory kernelFactory( dispDofNumber, + bubbleDofNumber, + dofManager.rankOffset(), + localMatrix, + localRhs, + dt, + faceElementList ); + + real64 maxTraction = finiteElement:: + interfaceBasedKernelApplication + < parallelDevicePolicy< >, + constitutive::CoulombContact >( mesh, + fractureRegionName, faceElementList, - isStickState ); + subRegionFE, + SolidMechanicsLagrangianFEM::viewKeyStruct::contactRelationNameString(), + kernelFactory ); - real64 maxTraction = finiteElement:: - interfaceBasedKernelApplication - < parallelDevicePolicy< >, - constitutive::CoulombContact >( mesh, - fractureRegionName, - faceElementList, - subRegionFE, - SolidMechanicsLagrangianFEM::viewKeyStruct::contactRelationNameString(), - kernelFactory ); + GEOS_UNUSED_VAR( maxTraction ); + } + else + { + solidMechanicsALMKernels::ALMFactory kernelFactory( dispDofNumber, + bubbleDofNumber, + dofManager.rankOffset(), + localMatrix, + localRhs, + dt, + faceElementList, + m_symmetric ); + + real64 maxTraction = finiteElement:: + interfaceBasedKernelApplication + < parallelDevicePolicy< >, + constitutive::CoulombContact >( mesh, + fractureRegionName, + faceElementList, + subRegionFE, + SolidMechanicsLagrangianFEM::viewKeyStruct::contactRelationNameString(), + kernelFactory ); - GEOS_UNUSED_VAR( maxTraction ); + GEOS_UNUSED_VAR( maxTraction ); + } } ); forFiniteElementOnSlipFractureSubRegions( meshName, [&] ( string const & , finiteElement::FiniteElementBase const & subRegionFE, arrayView1d< localIndex const > const & faceElementList, - bool const isStickState ) + bool const ) { - solidMechanicsALMKernels::ALMFactory kernelFactory( dispDofNumber, - bubbleDofNumber, - dofManager.rankOffset(), - localMatrix, - localRhs, - dt, + if (m_simultaneous) + { + solidMechanicsALMKernels::ALMSimultaneousFactory kernelFactory( dispDofNumber, + bubbleDofNumber, + dofManager.rankOffset(), + localMatrix, + localRhs, + dt, + faceElementList ); + + real64 maxTraction = finiteElement:: + interfaceBasedKernelApplication + < parallelDevicePolicy< >, + constitutive::CoulombContact >( mesh, + fractureRegionName, faceElementList, - isStickState ); - - real64 maxTraction = finiteElement:: - interfaceBasedKernelApplication - < parallelDevicePolicy< >, - constitutive::CoulombContact >( mesh, - fractureRegionName, - faceElementList, - subRegionFE, - SolidMechanicsLagrangianFEM::viewKeyStruct::contactRelationNameString(), - kernelFactory ); + subRegionFE, + SolidMechanicsLagrangianFEM::viewKeyStruct::contactRelationNameString(), + kernelFactory ); + GEOS_UNUSED_VAR( maxTraction ); - GEOS_UNUSED_VAR( maxTraction ); + } + else + { + solidMechanicsALMKernels::ALMFactory kernelFactory( dispDofNumber, + bubbleDofNumber, + dofManager.rankOffset(), + localMatrix, + localRhs, + dt, + faceElementList, + m_symmetric); + + real64 maxTraction = finiteElement:: + interfaceBasedKernelApplication + < parallelDevicePolicy< >, + constitutive::CoulombContact >( mesh, + fractureRegionName, + faceElementList, + subRegionFE, + SolidMechanicsLagrangianFEM::viewKeyStruct::contactRelationNameString(), + kernelFactory ); + + GEOS_UNUSED_VAR( maxTraction ); + } } ); @@ -437,7 +496,6 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepComplete( real64 cons DomainPartition & domain ) { - SolidMechanicsLagrangianFEM::implicitStepComplete( time_n, dt, domain ); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, @@ -715,54 +773,64 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit { using ContactType = TYPEOFREF( castedContact ); typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelUpdates(); - - forAll< parallelHostPolicy >( subRegion.size(), - [ traction_new_v, traction, - slidingTolerance, area, - dispJump, deltaDispJump, penalty, - fractureState, contactWrapper ] ( localIndex const kfe ) - { - - real64 eps_N = penalty[kfe][0]; - real64 eps_T = penalty[kfe][1]; - traction_new_v[kfe][0] = traction[kfe][0] + eps_N * dispJump[kfe][0]; - traction_new_v[kfe][1] = traction[kfe][1] + eps_T * deltaDispJump[kfe][1]; - traction_new_v[kfe][2] = traction[kfe][2] + eps_T * deltaDispJump[kfe][2]; - real64 const currentTau = std::sqrt( std::pow(traction_new_v[kfe][1], 2) + - std::pow(traction_new_v[kfe][2], 2)); - - real64 dLimitTangentialTractionNorm_dTraction = 0.0; - real64 const limitTau = - contactWrapper.computeLimitTangentialTractionNorm( traction_new_v[kfe][0], - dLimitTangentialTractionNorm_dTraction ); - - - // Compute psi - //real64 const psi = (limitTau < 1.e-10) ? 1.0 : std::tanh( currentTau/limitTau ); - real64 psi; - if (limitTau < 1.e-10) - { - psi = 1.0; - } - else - { - //psi = std::tanh(currentTau / limitTau); - psi = (currentTau > limitTau ) ? 1.0 : currentTau/limitTau; - } - - // Compute the new tangential traction - if (limitTau > 1.e-10 && currentTau > 1.e-10) - { - traction_new_v[kfe][1] *= limitTau * psi / currentTau; - traction_new_v[kfe][2] *= limitTau * psi / currentTau; - } - else + if (m_simultaneous) + { + solidMechanicsALMKernels::ComputeTractionSimultaneousKernel:: + launch< parallelDevicePolicy<> >( subRegion.size(), + penalty, + traction, + dispJump, + deltaDispJump, + traction_new_v ); + } + else + { + forAll< parallelHostPolicy >( subRegion.size(), + [ traction_new_v, traction, + slidingTolerance, area, + dispJump, deltaDispJump, penalty, + fractureState, contactWrapper ] ( localIndex const kfe ) { - traction_new_v[kfe][1] *= 0.0; - traction_new_v[kfe][2] *= 0.0; - } - } ); + real64 eps_N = penalty[kfe][0]; + real64 eps_T = penalty[kfe][1]; + traction_new_v[kfe][0] = traction[kfe][0] + eps_N * dispJump[kfe][0]; + traction_new_v[kfe][1] = traction[kfe][1] + eps_T * deltaDispJump[kfe][1]; + traction_new_v[kfe][2] = traction[kfe][2] + eps_T * deltaDispJump[kfe][2]; + + real64 const currentTau = std::sqrt( std::pow(traction_new_v[kfe][1], 2) + + std::pow(traction_new_v[kfe][2], 2)); + + real64 dLimitTangentialTractionNorm_dTraction = 0.0; + real64 const limitTau = + contactWrapper.computeLimitTangentialTractionNorm( traction_new_v[kfe][0], + dLimitTangentialTractionNorm_dTraction ); + + // Compute psi + real64 psi; + if (limitTau < 1.e-10) + { + psi = 1.0; + } + else + { + //psi = std::tanh(currentTau / limitTau); + psi = (currentTau > limitTau ) ? 1.0 : currentTau/limitTau; + } + + // Compute the new tangential traction + if (limitTau > 1.e-10 && currentTau > 1.e-10) + { + traction_new_v[kfe][1] *= limitTau * psi / currentTau; + traction_new_v[kfe][2] *= limitTau * psi / currentTau; + } + else + { + traction_new_v[kfe][1] *= 0.0; + traction_new_v[kfe][2] *= 0.0; + } + } ); + } } ); bool printflag = true; @@ -781,8 +849,8 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit if( ghostRank[kfe] < 0 ) { // Case 1: if it is open - //if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) - if( traction_new_v[kfe][0] > 0.0 ) + if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) + //if( traction_new_v[kfe][0] > 0.0 ) { if (fractureState[kfe] != contact::FractureState::Open) { @@ -972,8 +1040,8 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit // Case 1: if it is open - //if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) - if( traction_new_v[kfe][0] > 0.0 ) + if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) + //if( traction_new_v[kfe][0] > 0.0 ) { fractureState[kfe] = contact::FractureState::Open; traction[kfe][0] = 0.0; @@ -998,34 +1066,34 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit // Update the penalty coefficient to accelerate the convergence //penalty[kfe][0] *= 10.0; - real64 const eps_N_lim = 1.0e+4*normalTractionTolerance[kfe]/(normalDisplacementTolerance[kfe]*area[kfe]); - if (penalty[kfe][0] > eps_N_lim ) - { - GEOS_LOG_LEVEL(2, - GEOS_FMT( " Element: {}, eps_N > eps_N_lim, eps: {:4.2e} epsLim: {:4.2e}", - kfe, penalty[kfe][0], eps_N_lim )) - //penalty[kfe][0] = eps_N_lim; - } + //real64 const eps_N_lim = 1.0e+4*normalTractionTolerance[kfe]/(normalDisplacementTolerance[kfe]*area[kfe]); + //if (penalty[kfe][0] > eps_N_lim ) + //{ + // GEOS_LOG_LEVEL(2, + // GEOS_FMT( " Element: {}, eps_N > eps_N_lim, eps: {:4.2e} epsLim: {:4.2e}", + // kfe, penalty[kfe][0], eps_N_lim )) + // //penalty[kfe][0] = eps_N_lim; + //} } else { traction[kfe][0] = traction_new_v( kfe, 0 ); // Update the penalty coefficient to accelerate the convergence - if ((std::abs(dispJump[kfe][0])/area[kfe] > normalDisplacementTolerance[kfe] ) && - (std::abs(dispJump[kfe][0]) > 0.25 * std::abs(dispJumpUpdPenalty[kfe][0]))) - { - //penalty[kfe][0] *= 10.0; - - real64 const eps_N_lim = 1.0e+4*normalTractionTolerance[kfe]/(normalDisplacementTolerance[kfe]*area[kfe]); - if (penalty[kfe][0] > eps_N_lim ) - { - GEOS_LOG_LEVEL(2, - GEOS_FMT( " Element: {}, eps_N > eps_N_lim, eps: {:4.2e} epsLim: {:4.2e}", - kfe, penalty[kfe][0], eps_N_lim )) - //penalty[kfe][0] = eps_N_lim; - } - } + //if ((std::abs(dispJump[kfe][0])/area[kfe] > normalDisplacementTolerance[kfe] ) && + // (std::abs(dispJump[kfe][0]) > 0.25 * std::abs(dispJumpUpdPenalty[kfe][0]))) + //{ + // //penalty[kfe][0] *= 10.0; + // + // real64 const eps_N_lim = 1.0e+4*normalTractionTolerance[kfe]/(normalDisplacementTolerance[kfe]*area[kfe]); + // if (penalty[kfe][0] > eps_N_lim ) + // { + // GEOS_LOG_LEVEL(2, + // GEOS_FMT( " Element: {}, eps_N > eps_N_lim, eps: {:4.2e} epsLim: {:4.2e}", + // kfe, penalty[kfe][0], eps_N_lim )) + // //penalty[kfe][0] = eps_N_lim; + // } + //} real64 currentTau = sqrt( pow(traction_new_v[kfe][1], 2 ) + pow(traction_new_v[kfe][2], 2 ) ); @@ -1051,6 +1119,44 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit if( currentTau > limitTau ) { fractureState[kfe] = contact::FractureState::Slip; + + if (currentTau <= 1.e-10) + { + // It is needed for the first iteration (both t and u are equal to zero) + penalty[kfe][2] = penalty[kfe][1]; + penalty[kfe][3] = penalty[kfe][1]; + penalty[kfe][4] = 0.0; + } + else if (limitTau <= 1.e-10) + { + penalty[kfe][2] = 0.0; + penalty[kfe][3] = 0.0; + penalty[kfe][4] = 0.0; + } + else + { + // Two symmetric 2x2 matrices + real64 dNormTTdgT[ 3 ]; + dNormTTdgT[ 0 ] = traction_new_v[ kfe ][ 1 ] * traction_new_v[ kfe ][ 1 ]; + dNormTTdgT[ 1 ] = traction_new_v[ kfe ][ 2 ] * traction_new_v[ kfe ][ 2 ]; + dNormTTdgT[ 2 ] = traction_new_v[ kfe ][ 1 ] * traction_new_v[ kfe ][ 2 ]; + + real64 dTdgT[ 3 ]; + dTdgT[ 0 ] = (currentTau * currentTau - dNormTTdgT[0]); + dTdgT[ 1 ] = (currentTau * currentTau - dNormTTdgT[1]); + dTdgT[ 2 ] = - dNormTTdgT[2]; + + LvArray::tensorOps::scale< 3 >( dNormTTdgT, 1. / std::pow(currentTau, 2) ); + LvArray::tensorOps::scale< 3 >( dTdgT, 1. / std::pow( currentTau, 3 ) ); + + // Compute dTdDispJump + penalty[kfe][2] = penalty[kfe][1] * dTdgT[0] * limitTau; + penalty[kfe][3] = penalty[kfe][1] * dTdgT[1] * limitTau; + penalty[kfe][4] = penalty[kfe][1] * dTdgT[2] * limitTau; + //penalty[kfe][2] = 0.0; + //penalty[kfe][3] = 0.0; + //penalty[kfe][4] = 0.0; + } traction[kfe][1] = traction_new_v( kfe, 1 ) / psi; traction[kfe][2] = traction_new_v( kfe, 2 ) / psi; @@ -1063,27 +1169,32 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit traction[kfe][1] = traction_new_v( kfe, 1 ); traction[kfe][2] = traction_new_v( kfe, 2 ); - // Update the penalty coefficient to accelerate the convergence - real64 const deltaDispUpdPenalty = sqrt( pow( dispJumpUpdPenalty[kfe][1], 2 ) + - pow( dispJumpUpdPenalty[kfe][2], 2 )); - real64 const deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + - pow( deltaDispJump[kfe][2], 2 )); + penalty[kfe][2] = penalty[kfe][1]; + penalty[kfe][3] = penalty[kfe][1]; + penalty[kfe][4] = 0.0; - if (( deltaDisp/area[kfe] > slidingTolerance[kfe] ) && - ( deltaDisp > 0.25 * deltaDispUpdPenalty)) - { - //penalty[kfe][1] *= 10.0; + // Update the penalty coefficient to accelerate the convergence + //real64 const deltaDispUpdPenalty = sqrt( pow( dispJumpUpdPenalty[kfe][1], 2 ) + + // pow( dispJumpUpdPenalty[kfe][2], 2 )); + //real64 const deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + + // pow( deltaDispJump[kfe][2], 2 )); + + //if (( deltaDisp/area[kfe] > slidingTolerance[kfe] ) && + // ( deltaDisp > 0.25 * deltaDispUpdPenalty)) + //{ + // //penalty[kfe][1] *= 10.0; - real64 const eps_T_lim = 1.0e+04 * normalTractionTolerance[kfe]/(slidingTolerance[kfe] * area[kfe] * 10 ); - if (penalty[kfe][1] > eps_T_lim ) - { - GEOS_LOG_LEVEL(2, - GEOS_FMT( " Element: {}, eps_T > eps_T_lim, eps: {:4.2e} epsLim: {:4.2e}", - kfe, penalty[kfe][1], eps_T_lim )) - penalty[kfe][1] = eps_T_lim; - } - } + // real64 const eps_T_lim = 1.0e+04 * normalTractionTolerance[kfe]/(slidingTolerance[kfe] * area[kfe] * 10 ); + // if (penalty[kfe][1] > eps_T_lim ) + // { + // GEOS_LOG_LEVEL(2, + // GEOS_FMT( " Element: {}, eps_T > eps_T_lim, eps: {:4.2e} epsLim: {:4.2e}", + // kfe, penalty[kfe][1], eps_T_lim )) + // penalty[kfe][1] = eps_T_lim; + // } + //} } + } } } ); @@ -1812,13 +1923,17 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio // Finally, compute tolerances for the given fracture element normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+7; slidingTolerance[kfe] = sqrt( pow(rotatedInvStiffApprox[ 1 ][ 1 ],2) + - pow(rotatedInvStiffApprox[ 2 ][ 2 ],2)) * averageYoungModulus / 2.e+6; + pow(rotatedInvStiffApprox[ 2 ][ 2 ],2)) * averageYoungModulus / 2.e+5; normalTractionTolerance[kfe] = (1.0 / 2.0) * (averageConstrainedModulus / averageBoxSize0) * (normalDisplacementTolerance[kfe]); penalty[kfe][0] = 1e+01*averageConstrainedModulus/(averageBoxSize0*area); penalty[kfe][1] = 1e-01*averageConstrainedModulus/(averageBoxSize0*area); } ); + //GEOS_LOG_LEVEL(2, + //GEOS_FMT(" Element: {} penalty0: {:4.2e} penalty1: {:4.2e} nDispTol: {:4.2e} sliTol: {:4.2e} nTraTol: {:4.2e} area: {:4.2e}\n", + //0, penalty[0][0], penalty[0][0], normalDisplacementTolerance[0], + //slidingTolerance[0], normalTractionTolerance[0], area[0] )); } } ); } ); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp index 3a437834ee8..2ec3dd66572 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp @@ -242,6 +242,10 @@ class SolidMechanicsAugmentedLagrangianContact : public ContactSolverBase real64 const m_slidingCheckTolerance = 0.05; + bool m_simultaneous = false; + + bool m_symmetric = false; + }; } /* namespace geos */ From 074a96e9084e4ab529b756bebe72db92d1229b41 Mon Sep 17 00:00:00 2001 From: mfrigo Date: Fri, 23 Aug 2024 19:43:27 -0700 Subject: [PATCH 11/41] Moving traction update and traction derivatives into contact consitutive model - adding convergence stats - cleaning the code --- .../constitutive/ConstitutivePassThru.hpp | 2 +- .../constitutive/contact/ContactBase.hpp | 62 +++- .../constitutive/contact/CoulombContact.hpp | 290 +++++++++++++++++- .../contact/FrictionlessContact.hpp | 8 +- .../contact/SolidMechanicsALMKernels.hpp | 53 +++- .../contact/SolidMechanicsALMKernelsBase.hpp | 59 ++++ .../SolidMechanicsALMSimultaneousKernels.hpp | 16 +- ...lidMechanicsAugmentedLagrangianContact.cpp | 151 ++++++++- ...lidMechanicsAugmentedLagrangianContact.hpp | 4 +- 9 files changed, 606 insertions(+), 39 deletions(-) diff --git a/src/coreComponents/constitutive/ConstitutivePassThru.hpp b/src/coreComponents/constitutive/ConstitutivePassThru.hpp index 4a0aa78fd8e..a503698ccc2 100644 --- a/src/coreComponents/constitutive/ConstitutivePassThru.hpp +++ b/src/coreComponents/constitutive/ConstitutivePassThru.hpp @@ -84,7 +84,7 @@ struct ConstitutivePassThru< ElasticIsotropic > }; /** - * Specialization for models that derive from ConstactCoulomb. + * Specialization for models that derive from ContactCoulomb. */ template<> struct ConstitutivePassThru< CoulombContact > diff --git a/src/coreComponents/constitutive/contact/ContactBase.hpp b/src/coreComponents/constitutive/contact/ContactBase.hpp index 98dc22b0af2..a41611d7f5c 100644 --- a/src/coreComponents/constitutive/contact/ContactBase.hpp +++ b/src/coreComponents/constitutive/contact/ContactBase.hpp @@ -103,8 +103,66 @@ class ContactBaseUpdates virtual void updateFractureState( localIndex const k, arraySlice1d< real64 const > const & dispJump, arraySlice1d< real64 const > const & tractionVector, - integer & fractureState ) const - { GEOS_UNUSED_VAR( k, dispJump, tractionVector, fractureState ); } + integer & fractureState, + bool useTraction = false ) const + { GEOS_UNUSED_VAR( k, dispJump, tractionVector, fractureState, useTraction ); } + + /** + * @brief Update the trial traction vector ( return mapping ) + * @param[in] oldDispJump the displacement jump of the previous time step + * @param[in] dispJump the displacement jump of the current time step + * @param[in] penalty the penalty coefficients + * @param[in] traction the traction vector + * @param[in] symmetric flag to compute only the symmetric part of dTraction_dDispJump + * @param[out] dTraction_dDispJump matrix containing the derivatives of traction over the displacement jump + * @param[out] tractionNew the new traction vector + */ + GEOS_HOST_DEVICE + inline + virtual void updateTraction( arraySlice1d< real64 const > const & oldDispJump, + arraySlice1d< real64 const > const & dispJump, + arraySlice1d< real64 const > const & penalty, + arraySlice1d< real64 const > const & traction, + bool const symmetric, + real64 ( & dTraction_dDispJump )[3][3], + real64 ( & tractionNew )[3] ) const + { GEOS_UNUSED_VAR( oldDispJump, dispJump, penalty, traction, symmetric, dTraction_dDispJump, tractionNew ); } + + /** + * @brief Update the traction vector only ( return mapping ) + * @param[in] dispJump the displacement jump of the current time step + * @param[in] deltaDispJump the delta displacement jump of the current time step + * @param[in] penalty the penalty coefficients + * @param[in] traction the traction vector + * @param[out] tractionNew the new traction vector + */ + GEOS_HOST_DEVICE + inline + virtual void updateTractionOnly( arraySlice1d< real64 const > const & dispJump, + arraySlice1d< real64 const > const & deltaDispJump, + arraySlice1d< real64 const > const & penalty, + arraySlice1d< real64 const > const & traction, + arraySlice1d< real64 > const & tractionNew ) const + { GEOS_UNUSED_VAR( dispJump, deltaDispJump, penalty, traction, tractionNew ); } + + /** + * @brief Check for the constraint satisfaction + * @param[in] dispJump the displacement jump of the current time step + * @param[in] deltaDispJump the delta displacement jump of the current time step + * @param[in] tractionVector the traction vector + * @param[in] fractureState the fracture check + * @param[in] tolerance the tolerance + * @param[out] condConv flag indicating the result of the check + */ + GEOS_HOST_DEVICE + inline + virtual void constraintCheck( arraySlice1d< real64 const > const & dispJump, + arraySlice1d< real64 const > const & deltaDispJump, + arraySlice1d< real64 > const & tractionVector, + integer const fractureState, + std::map const & tolerance, + integer & condConv ) const + { GEOS_UNUSED_VAR( dispJump, deltaDispJump, tractionVector, fractureState, tolerance, condConv ); } /** * @brief Update the traction with the pressure term diff --git a/src/coreComponents/constitutive/contact/CoulombContact.hpp b/src/coreComponents/constitutive/contact/CoulombContact.hpp index 2eb3b6b5fb7..c7922fd70ff 100644 --- a/src/coreComponents/constitutive/contact/CoulombContact.hpp +++ b/src/coreComponents/constitutive/contact/CoulombContact.hpp @@ -89,7 +89,35 @@ class CoulombContactUpdates : public ContactBaseUpdates virtual void updateFractureState( localIndex const k, arraySlice1d< real64 const > const & dispJump, arraySlice1d< real64 const > const & tractionVector, - integer & fractureState ) const override final; + integer & fractureState, + bool useTraction = false ) const override final; + + GEOS_HOST_DEVICE + inline + virtual void updateTraction( arraySlice1d< real64 const > const & oldDispJump, + arraySlice1d< real64 const > const & dispJump, + arraySlice1d< real64 const > const & penalty, + arraySlice1d< real64 const > const & traction, + bool const symmetric, + real64 ( & dTraction_dDispJump )[3][3], + real64 ( & tractionNew )[3] ) const override final; + + GEOS_HOST_DEVICE + inline + virtual void updateTractionOnly( arraySlice1d< real64 const > const & dispJump, + arraySlice1d< real64 const > const & deltaDispJump, + arraySlice1d< real64 const > const & penalty, + arraySlice1d< real64 const > const & traction, + arraySlice1d< real64 > const & tractionNew ) const override final; + +GEOS_HOST_DEVICE +inline +virtual void constraintCheck( arraySlice1d< real64 const > const & dispJump, + arraySlice1d< real64 const > const & deltaDispJump, + arraySlice1d< real64 > const & tractionVector, + integer const fractureState, + std::map const & tolerance, + integer & condConv ) const override final; private: @@ -293,17 +321,32 @@ GEOS_HOST_DEVICE inline void CoulombContactUpdates::updateFractureState( localIndex const k, arraySlice1d< real64 const > const & dispJump, arraySlice1d< real64 const > const & tractionVector, - integer & fractureState ) const + integer & fractureState, + bool useTraction ) const { using namespace fields::contact; - - if( dispJump[0] > -m_displacementJumpThreshold ) + + fractureState = FractureState::Stick; + if ( useTraction ) { - fractureState = FractureState::Open; - m_elasticSlip[k][0] = 0.0; - m_elasticSlip[k][1] = 0.0; + // TODO: Pass this tol as an argument (tractionThreshold) or define a new class member + constexpr real64 zero = 1.e-10; + if( tractionVector[0] >= zero ) + { + fractureState = FractureState::Open; + } } else + { + if( dispJump[0] > -m_displacementJumpThreshold ) + { + fractureState = FractureState::Open; + m_elasticSlip[k][0] = 0.0; + m_elasticSlip[k][1] = 0.0; + } + } + + if (!(fractureState == FractureState::Open) ) { real64 const tau[2] = { tractionVector[1], tractionVector[2] }; @@ -316,7 +359,238 @@ inline void CoulombContactUpdates::updateFractureState( localIndex const k, // Yield function (not necessary but makes it clearer) real64 const yield = tauNorm - limitTau; - fractureState = yield < 0 ? FractureState::Stick : FractureState::Slip; + fractureState = yield <= 0 ? FractureState::Stick : FractureState::Slip; + } +} + +GEOS_HOST_DEVICE +inline void CoulombContactUpdates::updateTraction( arraySlice1d< real64 const > const & oldDispJump, + arraySlice1d< real64 const > const & dispJump, + arraySlice1d< real64 const > const & penalty, + arraySlice1d< real64 const > const & traction, + bool const symmetric, + real64 ( & dTraction_dDispJump )[3][3], + real64 ( & tractionNew ) [3] ) const +{ + + // TODO: Pass this tol as an argument or define a new class member + constexpr real64 zero = 1.e-10; + real64 dLimitTangentialTractionNorm_dTraction = 0.0; + real64 limitTau = 0.0; + + // Compute the trial traction + real64 tractionTrial[ 3 ]; + tractionTrial[ 0 ] = traction[0] + penalty[0] * dispJump[0]; + tractionTrial[ 1 ] = traction[1] + penalty[1] * (dispJump[1] - oldDispJump[1]); + tractionTrial[ 2 ] = traction[2] + penalty[1] * (dispJump[2] - oldDispJump[2]); + + // Compute tangential trial traction norm + real64 const tau[2] = { tractionTrial[1], + tractionTrial[2] }; + real64 const tractionTrialNorm = LvArray::tensorOps::l2Norm< 2 >( tau ); + + // If normal tangential trial is positive (opening) + if (tractionTrial[ 0 ] > zero) + { + tractionNew[0] = 0.0; + dTraction_dDispJump[0][0] = 0.0; + } + else + { + tractionNew[0] = tractionTrial[0]; + dTraction_dDispJump[0][0] = -penalty[ 0 ]; + } + + // Compute limit Tau + if (symmetric) + { + limitTau = computeLimitTangentialTractionNorm( traction[0], + dLimitTangentialTractionNorm_dTraction ); + } + else + { + limitTau = computeLimitTangentialTractionNorm( tractionNew[0], + dLimitTangentialTractionNorm_dTraction ); + } + + if (tractionTrialNorm <= zero) + { + // It is needed for the first iteration (both t and u are equal to zero) + dTraction_dDispJump[1][1] = - penalty[1]; + dTraction_dDispJump[2][2] = - penalty[1]; + + tractionNew[1] = tractionTrial[1]; + tractionNew[2] = tractionTrial[2]; + } + else if (limitTau <= zero) + { + dTraction_dDispJump[1][1] = 0.0; + dTraction_dDispJump[2][2] = 0.0; + + tractionNew[1] = (symmetric) ? tractionTrial[1] : 0.0; + tractionNew[2] = (symmetric) ? tractionTrial[2] : 0.0; + } + else + { + // Compute psi and dpsi + //real64 const psi = std::tanh( tractionTrialNorm/limitTau ); + //real64 const dpsi = 1.0-std::pow(psi,2); + real64 const psi = ( tractionTrialNorm > limitTau) ? 1.0 : tractionTrialNorm/limitTau; + real64 const dpsi = ( tractionTrialNorm > limitTau) ? 0.0 : 1.0; + + // Two symmetric 2x2 matrices + real64 dNormTTdgT[ 3 ]; + dNormTTdgT[ 0 ] = tractionTrial[ 1 ] * tractionTrial[ 1 ]; + dNormTTdgT[ 1 ] = tractionTrial[ 2 ] * tractionTrial[ 2 ]; + dNormTTdgT[ 2 ] = tractionTrial[ 1 ] * tractionTrial[ 2 ]; + + real64 dTdgT[ 3 ]; + dTdgT[ 0 ] = (tractionTrialNorm * tractionTrialNorm - dNormTTdgT[0]); + dTdgT[ 1 ] = (tractionTrialNorm * tractionTrialNorm - dNormTTdgT[1]); + dTdgT[ 2 ] = - dNormTTdgT[2]; + + LvArray::tensorOps::scale< 3 >( dNormTTdgT, 1. / std::pow(tractionTrialNorm, 2) ); + LvArray::tensorOps::scale< 3 >( dTdgT, 1. / std::pow( tractionTrialNorm, 3 ) ); + + // Compute dTdDispJump + dTraction_dDispJump[1][1] = -penalty[1] * ( + dpsi * dNormTTdgT[0] + + psi * dTdgT[0] * limitTau ); + dTraction_dDispJump[2][2] = -penalty[1] * ( + dpsi * dNormTTdgT[1] + + psi * dTdgT[1] * limitTau ); + dTraction_dDispJump[1][2] = -penalty[1] * ( + dpsi * dNormTTdgT[2] + + psi * dTdgT[2] * limitTau ); + dTraction_dDispJump[2][1] = dTraction_dDispJump[1][2]; + + if (!symmetric) + { + // Nonsymetric term + dTraction_dDispJump[1][0] = -dTraction_dDispJump[0][0] * m_frictionCoefficient * + tractionTrial[1] * (psi/tractionTrialNorm - dpsi/limitTau); + dTraction_dDispJump[2][0] = -dTraction_dDispJump[0][0] * m_frictionCoefficient * + tractionTrial[2] * (psi/tractionTrialNorm - dpsi/limitTau); + } + + LvArray::tensorOps::scale< 3 >( tractionTrial, (psi * limitTau)/tractionTrialNorm ); + tractionNew[1] = tractionTrial[1]; + tractionNew[2] = tractionTrial[2]; + } + +} + +GEOS_HOST_DEVICE +inline void CoulombContactUpdates::updateTractionOnly( arraySlice1d< real64 const > const & dispJump, + arraySlice1d< real64 const > const & deltaDispJump, + arraySlice1d< real64 const > const & penalty, + arraySlice1d< real64 const > const & traction, + arraySlice1d< real64 > const & tractionNew ) const +{ + + // TODO: Pass this tol as an argument or define a new class member + constexpr real64 zero = 1.e-10; + + tractionNew[0] = traction[0] + penalty[0] * dispJump[0]; + tractionNew[1] = traction[1] + penalty[1] * deltaDispJump[1]; + tractionNew[2] = traction[2] + penalty[1] * deltaDispJump[2]; + + real64 const tau[2] = { tractionNew[1], + tractionNew[2] }; + real64 const currentTau = LvArray::tensorOps::l2Norm< 2 >( tau ); + + real64 dLimitTangentialTractionNorm_dTraction = 0.0; + real64 const limitTau = computeLimitTangentialTractionNorm( tractionNew[0], + dLimitTangentialTractionNorm_dTraction ); + + // Compute psi + real64 psi; + if (limitTau < zero) + { + psi = 1.0; + } + else + { + //psi = std::tanh(currentTau / limitTau); + psi = (currentTau > limitTau ) ? 1.0 : currentTau/limitTau; + } + + // Compute the new tangential traction + if (limitTau > zero && currentTau > zero) + { + tractionNew[1] *= limitTau * psi / currentTau; + tractionNew[2] *= limitTau * psi / currentTau; + } + else + { + tractionNew[1] *= 0.0; + tractionNew[2] *= 0.0; + } +} + +GEOS_HOST_DEVICE +inline void CoulombContactUpdates::constraintCheck( arraySlice1d< real64 const > const & dispJump, + arraySlice1d< real64 const > const & deltaDispJump, + arraySlice1d< real64 > const & tractionVector, + integer const fractureState, + std::map const & tolerance, + integer & condConv ) const +{ + + using namespace fields::contact; + + real64 const normalTractionTolerance = tolerance.at("normalTraction"); + real64 const normalDisplacementTolerance = tolerance.at("normalDisplacement"); + real64 const slidingTolerance = tolerance.at("sliding"); + real64 const slidingCheckTolerance = tolerance.at("slidingCheck"); + + // Compute the slip + real64 const deltaDisp[2] = { deltaDispJump[1], + deltaDispJump[2] }; + + real64 const deltaDispNorm = LvArray::tensorOps::l2Norm< 2 >( deltaDisp ); + + // Compute current Tau and limit Tau + real64 const tau[2] = { tractionVector[1], + tractionVector[2] }; + real64 const currentTau = LvArray::tensorOps::l2Norm< 2 >( tau ); + + real64 dLimitTangentialTractionNorm_dTraction = 0.0; + real64 const limitTau = computeLimitTangentialTractionNorm( tractionVector[0], + dLimitTangentialTractionNorm_dTraction ); + + condConv = 0; + // Case 1: if it is open + if( tractionVector[0] >= normalTractionTolerance ) + { + if (fractureState != FractureState::Open) + { + condConv = 1; + } + tractionVector[0] = 0.0; + tractionVector[1] = 0.0; + tractionVector[2] = 0.0; + } + else + { + // Case 2: compenetration + if (( std::abs( dispJump[0] ) > normalDisplacementTolerance ) && + (fractureState != FractureState::Open)) + { + condConv = 2; + } + // Case 3: it is stick and dg is greater than 0 + if( fractureState == FractureState::Stick && + deltaDispNorm > slidingTolerance ) + { + condConv = 3; + } + + // Case 4: the elastic tangential traction is greater than the limit + if( currentTau > (std::abs(limitTau) * (1.0 + slidingCheckTolerance)) ) + { + condConv = 4; + } } } diff --git a/src/coreComponents/constitutive/contact/FrictionlessContact.hpp b/src/coreComponents/constitutive/contact/FrictionlessContact.hpp index cb3d380cf8d..c4be659aa27 100644 --- a/src/coreComponents/constitutive/contact/FrictionlessContact.hpp +++ b/src/coreComponents/constitutive/contact/FrictionlessContact.hpp @@ -73,7 +73,8 @@ class FrictionlessContactUpdates : public ContactBaseUpdates virtual void updateFractureState( localIndex const k, arraySlice1d< real64 const > const & dispJump, arraySlice1d< real64 const > const & tractionVector, - integer & fractureState ) const override final; + integer & fractureState, + bool useTraction = false ) const override final; /** @@ -169,9 +170,10 @@ GEOS_HOST_DEVICE inline void FrictionlessContactUpdates::updateFractureState( localIndex const k, arraySlice1d< real64 const > const & dispJump, arraySlice1d< real64 const > const & tractionVector, - integer & fractureState ) const + integer & fractureState, + bool useTraction ) const { - GEOS_UNUSED_VAR( k, tractionVector ); + GEOS_UNUSED_VAR( k, tractionVector, useTraction ); using namespace fields::contact; fractureState = dispJump[0] > m_displacementJumpThreshold ? FractureState::Open : FractureState::Stick; } diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp index 93bceb2b7cb..793ee1385b5 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp @@ -249,7 +249,7 @@ class ALM : StackVariables & stack ) const { GEOS_UNUSED_VAR( k ); - constexpr real64 zero = 1.e-10; + //constexpr real64 zero = 1.e-10; constexpr int numUdofs = numNodesPerElem * 3 * 2; @@ -262,7 +262,17 @@ class ALM : real64 tractionRb[numBdofs]; real64 tractionNew[3]; - real64 dLimitTangentialTractionNorm_dTraction = 0.0; + + m_constitutiveUpdate.updateTraction( m_oldDispJump[k], + m_dispJump[k], + m_penalty[k], + m_traction[k], + m_symmetric, + stack.localPenalty, + tractionNew); + + + /*real64 dLimitTangentialTractionNorm_dTraction = 0.0; real64 limitTau = 0.0; // Compute the trial traction @@ -366,6 +376,7 @@ class ALM : tractionNew[1] = tractionTrial[1]; tractionNew[2] = tractionTrial[2]; } + */ // transp(R) * Atu @@ -477,6 +488,44 @@ using ALMFactory = finiteElement::InterfaceKernelFactory< ALM, arrayView1d< localIndex const > const, bool const >; +/** + * @brief A struct to compute the traction after nonlinear solve + */ +struct ComputeTractionKernel +{ + + /** + * @brief Launch the kernel function to compute the traction + * @tparam POLICY the type of policy used in the kernel launch + * @tparam CONTACT_WRAPPER the type of contact wrapper doing the fracture traction updates + * @param[in] size the size of the subregion + * @param[in] penalty the array containing the tangential penalty matrix + * @param[in] traction the array containing the current traction + * @param[in] dispJump the array containing the displacement jump + * @param[in] deltaDispJump the array containing the delta displacement jump + * @param[out] tractionNew the array containing the new traction + */ + template< typename POLICY, typename CONTACT_WRAPPER > + static void + launch( localIndex const size, + CONTACT_WRAPPER const & contactWrapper, + arrayView2d< real64 const > const & penalty, + arrayView2d< real64 const > const & traction, + arrayView2d< real64 const > const & dispJump, + arrayView2d< real64 const > const & deltaDispJump, + arrayView2d< real64 > const & tractionNew ) + { + + forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) + { + + contactWrapper.updateTractionOnly( dispJump[k], deltaDispJump[k], + penalty[k], traction[k], tractionNew[k] ); + + } ); + } +}; + } // namespace SolidMechanicsALMKernels } // namespace geos diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp index 658bfd0dd82..9bcc53ac523 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp @@ -306,6 +306,65 @@ struct ComputeRotationMatricesKernel }; +/** + * @brief A struct to check for constraint satisfaction + */ +struct ConstraintCheckKernel +{ + + /** + * @brief Launch the kernel function to check the constraint satisfaction + * @tparam POLICY the type of policy used in the kernel launch + * @tparam CONTACT_WRAPPER the type of contact wrapper doing the fracture traction updates + * @param[in] size the size of the subregion + * @param[in] traction the array containing the current traction + * @param[in] dispJump the array containing the displacement jump + * @param[in] deltaDispJump the array containing the delta displacement jump + * @param[in] fractureState the array containing the fracture state + * @param[out] condConv the array containing the convergence flag: + * 0: Constraint conditions satisfied + * 1: Open + * 2: Compenetration + * 3: Slip exceeds sliding tolerance + * 4: Shear stress exceeds tauLim + */ + template< typename POLICY, typename CONTACT_WRAPPER > + static void + launch( localIndex const size, + CONTACT_WRAPPER const & contactWrapper, + arrayView1d< integer const > const & ghostRank, + arrayView2d< real64 > const & traction, + arrayView2d< real64 const > const & dispJump, + arrayView2d< real64 const > const & deltaDispJump, + arrayView1d< real64 const > const & normalTractionTolerance, + arrayView1d< real64 const > const & normalDisplacementTolerance, + arrayView1d< real64 const > const & slidingTolerance, + real64 const slidingCheckTolerance, + arrayView1d< real64 const > const & area, + arrayView1d< integer const > const & fractureState, + arrayView1d< integer > const & condConv ) + { + + forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) + { + if( ghostRank[k] < 0 ) + { + std::map const tolerance = {{"normalTraction", normalTractionTolerance[k]}, + {"normalDisplacement", normalDisplacementTolerance[k]*area[k] }, + {"sliding", slidingTolerance[k]*area[k] }, + {"slidingCheck", slidingCheckTolerance }}; + contactWrapper.constraintCheck( dispJump[k], + deltaDispJump[k], + traction[k], + fractureState[k], + tolerance, + condConv[k] ); + } + + } ); + } +}; + } // namespace SolidMechanicsALMKernels } // namespace geos diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp index 9a1cfc2673f..4cff0918433 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp @@ -410,14 +410,14 @@ struct ComputeTractionSimultaneousKernel { /** - * @brief Launch the kernel function to comute rotation matrices + * @brief Launch the kernel function to comute traction * @tparam POLICY the type of policy used in the kernel launch * @param[in] size the size of the subregion * @param[in] penalty the array containing the tangential penalty matrix * @param[in] traction the array containing the current traction * @param[in] dispJump the array containing the displacement jump * @param[in] deltaDispJump the array containing the delta displacement jump - * @param[out] traction_new the array containing the new traction + * @param[out] tractionNew the array containing the new traction */ template< typename POLICY > static void @@ -426,16 +426,16 @@ struct ComputeTractionSimultaneousKernel arrayView2d< real64 const > const & traction, arrayView2d< real64 const > const & dispJump, arrayView2d< real64 const > const & deltaDispJump, - arrayView2d< real64 > const & traction_new ) + arrayView2d< real64 > const & tractionNew ) { forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const kfe ) { - traction_new[kfe][0] = traction[kfe][0] + penalty[kfe][0] * dispJump[kfe][0]; - traction_new[kfe][1] = traction[kfe][1] + penalty[kfe][2] * deltaDispJump[kfe][1] + - penalty[kfe][4] * deltaDispJump[kfe][2]; - traction_new[kfe][2] = traction[kfe][2] + penalty[kfe][3] * deltaDispJump[kfe][2] + - penalty[kfe][4] * deltaDispJump[kfe][1]; + tractionNew[kfe][0] = traction[kfe][0] + penalty[kfe][0] * dispJump[kfe][0]; + tractionNew[kfe][1] = traction[kfe][1] + penalty[kfe][2] * deltaDispJump[kfe][1] + + penalty[kfe][4] * deltaDispJump[kfe][2]; + tractionNew[kfe][2] = traction[kfe][2] + penalty[kfe][3] * deltaDispJump[kfe][2] + + penalty[kfe][4] * deltaDispJump[kfe][1]; } ); } diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index b93ff4b5751..981832f9b5a 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -367,6 +367,7 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time kernelFactory ); GEOS_UNUSED_VAR( maxTraction ); + } else { @@ -419,6 +420,7 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time subRegionFE, SolidMechanicsLagrangianFEM::viewKeyStruct::contactRelationNameString(), kernelFactory ); + GEOS_UNUSED_VAR( maxTraction ); } @@ -729,8 +731,11 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit { GEOS_MARK_FUNCTION; - int hasConfigurationConverged = true; - int condConv = true; + //int hasConfigurationConverged = true; + //int condConv_flag = true; + //int condConv = true; + array1d< int > condConv; + localIndex globalCondConv[5] = {0, 0, 0, 0, 0}; array2d< real64 > traction_new; @@ -768,7 +773,10 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit traction_new.resize( 2, sizes ); arrayView2d< real64 > const traction_new_v = traction_new.toView(); - // Update Traction + condConv.resize(subRegion.size()); + arrayView1d< int > const condConv_v = condConv.toView(); + + // Update the traction field based on the displacement results from the nonlinear solve constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { using ContactType = TYPEOFREF( castedContact ); @@ -786,7 +794,16 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit } else { - forAll< parallelHostPolicy >( subRegion.size(), + solidMechanicsALMKernels::ComputeTractionKernel:: + launch< parallelDevicePolicy<> >( subRegion.size(), + contactWrapper, + penalty, + traction, + dispJump, + deltaDispJump, + traction_new_v ); + + /*forAll< parallelHostPolicy >( subRegion.size(), [ traction_new_v, traction, slidingTolerance, area, dispJump, deltaDispJump, penalty, @@ -830,16 +847,98 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit traction_new_v[kfe][2] *= 0.0; } } ); + */ } } ); - bool printflag = true; + //bool printflag = true; real64 const slidingCheckTolerance = m_slidingCheckTolerance; constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { using ContactType = TYPEOFREF( castedContact ); typename ContactType::KernelWrapper contactWrapper = castedContact.createKernelUpdates(); + solidMechanicsALMKernels::ConstraintCheckKernel:: + launch< parallelDevicePolicy<> >( subRegion.size(), + contactWrapper, + ghostRank, + traction_new_v, + dispJump, + deltaDispJump, + normalTractionTolerance, + normalDisplacementTolerance, + slidingTolerance, + slidingCheckTolerance, + area, + fractureState, + condConv_v ); + //for (int i=0; i localSum[5] = + { RAJA::ReduceSum< parallelDeviceReduce, localIndex >(0), + RAJA::ReduceSum< parallelDeviceReduce, localIndex >(0), + RAJA::ReduceSum< parallelDeviceReduce, localIndex >(0), + RAJA::ReduceSum< parallelDeviceReduce, localIndex >(0), + RAJA::ReduceSum< parallelDeviceReduce, localIndex >(0) }; + forAll< parallelDevicePolicy<> >( subRegion.size(), [ localSum, ghostRank, condConv_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) + { + if( ghostRank[kfe] < 0 ) + { + localSum[condConv_v[kfe]] += 1; + } + } ); + + localIndex const localConvCond[5] = { static_cast< localIndex >( localSum[0].get()), + static_cast< localIndex >( localSum[1].get()), + static_cast< localIndex >( localSum[2].get()), + static_cast< localIndex >( localSum[3].get()), + static_cast< localIndex >( localSum[4].get()) }; + + int const rank = MpiWrapper::commRank( MPI_COMM_GEOSX ); + int const numRanks = MpiWrapper::commSize( MPI_COMM_GEOSX ); + array1d< localIndex > globalValues( numRanks * 5 ); + + // Everything is done on rank 0 + MpiWrapper::gather( localConvCond, + 5, + globalValues.data(), + 5, + 0, + MPI_COMM_GEOSX ); + + //if ( globalValues[1]!=0 || globalValues[2]!=0 || + // globalValues[3]!=0 || globalValues[4]!=0 ) + //{ + // condConv_flag = false; + //} + + if( rank==0 ) + { + for( int r=0; r( subRegion.size(), [ &condConv, ghostRank, traction_new_v, normalTractionTolerance, normalDisplacementTolerance, @@ -929,22 +1028,48 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit } } } ); + */ } ); } ); } ); - if( !condConv ) + /*localIndex totCondNotConv = 0; + for (int i=0; i<4; ++i) { - hasConfigurationConverged = false; + totCondNotConv+=globalCondConv[i+1]; + std::cout << "gCond: " << globalCondConv[i+1] << std::endl; } + std::cout << "totNotConv: " << totCondNotConv << std::endl; + + if ( globalCondConv[1]!=0 || globalCondConv[2]!=0 || + globalCondConv[3]!=0 || globalCondConv[4]!=0 ) + { + condConv_flag = false; + + } + */ + + localIndex totCondNotConv = 0; + for (int i=0; i<4; ++i) + { + totCondNotConv+=globalCondConv[i+1]; + } + + int hasConfigurationConvergedGlobally = (totCondNotConv == 0) ? true : false; + + + //if( !condConv_flag ) + //{ + // hasConfigurationConverged = false; + //} // Compute if globally the fracture state has changed - int hasConfigurationConvergedGlobally; - MpiWrapper::allReduce( &hasConfigurationConverged, - &hasConfigurationConvergedGlobally, - 1, - MPI_LAND, - MPI_COMM_GEOSX ); + //int hasConfigurationConvergedGlobally; + //MpiWrapper::allReduce( &hasConfigurationConverged, + // &hasConfigurationConvergedGlobally, + // 1, + // MPI_LAND, + // MPI_COMM_GEOSX ); if (hasConfigurationConvergedGlobally) { diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp index 2ec3dd66572..f67ca67e84d 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp @@ -242,9 +242,9 @@ class SolidMechanicsAugmentedLagrangianContact : public ContactSolverBase real64 const m_slidingCheckTolerance = 0.05; - bool m_simultaneous = false; + bool m_simultaneous = true; - bool m_symmetric = false; + bool m_symmetric = true; }; From 271431757c5da1ae08bd680e6f49b30adeaf64fe Mon Sep 17 00:00:00 2001 From: mfrigo Date: Fri, 30 Aug 2024 18:14:10 -0700 Subject: [PATCH 12/41] Moving the traction update into the friction model --- .../constitutive/contact/CoulombFriction.hpp | 28 +++++++++++++++---- .../constitutive/contact/FrictionBase.hpp | 7 +++-- .../contact/SolidMechanicsALMKernels.hpp | 5 +++- ...lidMechanicsAugmentedLagrangianContact.cpp | 7 +++-- 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/coreComponents/constitutive/contact/CoulombFriction.hpp b/src/coreComponents/constitutive/contact/CoulombFriction.hpp index afe8f068c87..08831695c45 100644 --- a/src/coreComponents/constitutive/contact/CoulombFriction.hpp +++ b/src/coreComponents/constitutive/contact/CoulombFriction.hpp @@ -97,8 +97,11 @@ class CoulombFrictionUpdates : public FrictionBaseUpdates arraySlice1d< real64 const > const & penalty, arraySlice1d< real64 const > const & traction, bool const symmetric, + bool const fixedLimitTau, real64 ( & dTraction_dDispJump )[3][3], - real64 ( & tractionNew )[3] ) const override final; + real64 ( & tractionNew )[3], + integer & fractureState ) const override final; + GEOS_HOST_DEVICE inline @@ -335,10 +338,14 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > arraySlice1d< real64 const > const & penalty, arraySlice1d< real64 const > const & traction, bool const symmetric, + bool const fixedLimitTau, real64 ( & dTraction_dDispJump )[3][3], - real64 ( & tractionNew ) [3] ) const + real64 ( & tractionNew ) [3], + integer & fractureState ) const { + using namespace fields::contact; + // TODO: Pass this tol as an argument or define a new class member constexpr real64 zero = 1.e-10; real64 dLimitTangentialTractionNorm_dTraction = 0.0; @@ -356,10 +363,12 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > real64 const tractionTrialNorm = LvArray::tensorOps::l2Norm< 2 >( tau ); // If normal tangential trial is positive (opening) + fractureState = FractureState::Stick; if (tractionTrial[ 0 ] > zero) { tractionNew[0] = 0.0; dTraction_dDispJump[0][0] = 0.0; + fractureState = FractureState::Open; } else { @@ -368,7 +377,7 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > } // Compute limit Tau - if (symmetric) + if (fixedLimitTau) { limitTau = computeLimitTangentialTractionNorm( traction[0], dLimitTangentialTractionNorm_dTraction ); @@ -387,14 +396,18 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > tractionNew[1] = tractionTrial[1]; tractionNew[2] = tractionTrial[2]; + + if ( fractureState != FractureState::Open ) fractureState = FractureState::Stick; } else if (limitTau <= zero) { dTraction_dDispJump[1][1] = 0.0; dTraction_dDispJump[2][2] = 0.0; - tractionNew[1] = (symmetric) ? tractionTrial[1] : 0.0; - tractionNew[2] = (symmetric) ? tractionTrial[2] : 0.0; + tractionNew[1] = (fixedLimitTau) ? tractionTrial[1] : 0.0; + tractionNew[2] = (fixedLimitTau) ? tractionTrial[2] : 0.0; + + if ( fractureState != FractureState::Open ) fractureState = FractureState::Slip; } else { @@ -404,6 +417,11 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > real64 const psi = ( tractionTrialNorm > limitTau) ? 1.0 : tractionTrialNorm/limitTau; real64 const dpsi = ( tractionTrialNorm > limitTau) ? 0.0 : 1.0; + if ( fractureState != FractureState::Open ) + { + fractureState = ( tractionTrialNorm > limitTau) ? FractureState::Slip : FractureState::Stick; + } + // Two symmetric 2x2 matrices real64 dNormTTdgT[ 3 ]; dNormTTdgT[ 0 ] = tractionTrial[ 1 ] * tractionTrial[ 1 ]; diff --git a/src/coreComponents/constitutive/contact/FrictionBase.hpp b/src/coreComponents/constitutive/contact/FrictionBase.hpp index 9e5c9b85ec5..55330d08a80 100644 --- a/src/coreComponents/constitutive/contact/FrictionBase.hpp +++ b/src/coreComponents/constitutive/contact/FrictionBase.hpp @@ -106,9 +106,12 @@ class FrictionBaseUpdates arraySlice1d< real64 const > const & penalty, arraySlice1d< real64 const > const & traction, bool const symmetric, + bool const fixedLimitTau, real64 ( & dTraction_dDispJump )[3][3], - real64 ( & tractionNew )[3] ) const - { GEOS_UNUSED_VAR( oldDispJump, dispJump, penalty, traction, symmetric, dTraction_dDispJump, tractionNew ); } + real64 ( & tractionNew )[3], + integer & fractureState ) const + { GEOS_UNUSED_VAR( oldDispJump, dispJump, penalty, traction, symmetric, fixedLimitTau, + dTraction_dDispJump, tractionNew, fractureState ); } /** * @brief Update the traction vector only ( return mapping ) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp index 9a20e009e29..05835e6f94f 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp @@ -264,13 +264,16 @@ class ALM : real64 tractionNew[3]; + integer fractureState; m_constitutiveUpdate.updateTraction( m_oldDispJump[k], m_dispJump[k], m_penalty[k], m_traction[k], m_symmetric, + m_symmetric, stack.localPenalty, - tractionNew); + tractionNew, + fractureState); /*real64 dLimitTangentialTractionNorm_dTraction = 0.0; diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index e5a76459ecd..3bdb4d368d0 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -1091,9 +1091,10 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit forAll< parallelDevicePolicy<> >( subRegion.size(), [ traction, traction_new_v ] ( localIndex const kfe ) { - traction[kfe][0] = traction_new_v( kfe, 0 ); - traction[kfe][1] = traction_new_v( kfe, 1 ); - traction[kfe][2] = traction_new_v( kfe, 2 ); + //traction[kfe][0] = traction_new_v( kfe, 0 ); + //traction[kfe][1] = traction_new_v( kfe, 1 ); + //traction[kfe][2] = traction_new_v( kfe, 2 ); + LvArray::tensorOps::copy< 3 >( traction[kfe], traction_new_v[kfe] ); } ); } ); } ); From c1f33d00ecb1e31ce6edc78dac0b3ccbc2a21252 Mon Sep 17 00:00:00 2001 From: mfrigo Date: Wed, 4 Sep 2024 16:46:43 -0700 Subject: [PATCH 13/41] Moved contact constitutive behavior from ALM to the friction law --- .../constitutive/contact/CoulombFriction.hpp | 14 ++-- .../constitutive/contact/FrictionBase.hpp | 7 ++ .../contact/SolidMechanicsALMKernels.hpp | 4 +- .../contact/SolidMechanicsALMKernelsBase.hpp | 77 +++++++++++++++++++ ...lidMechanicsAugmentedLagrangianContact.cpp | 56 +++++++++++--- ...lidMechanicsAugmentedLagrangianContact.hpp | 4 +- 6 files changed, 144 insertions(+), 18 deletions(-) diff --git a/src/coreComponents/constitutive/contact/CoulombFriction.hpp b/src/coreComponents/constitutive/contact/CoulombFriction.hpp index 08831695c45..6d842bf084e 100644 --- a/src/coreComponents/constitutive/contact/CoulombFriction.hpp +++ b/src/coreComponents/constitutive/contact/CoulombFriction.hpp @@ -98,6 +98,8 @@ class CoulombFrictionUpdates : public FrictionBaseUpdates arraySlice1d< real64 const > const & traction, bool const symmetric, bool const fixedLimitTau, + real64 const normalTractionTolerance, + real64 const tangentialTractionTolerance, real64 ( & dTraction_dDispJump )[3][3], real64 ( & tractionNew )[3], integer & fractureState ) const override final; @@ -339,6 +341,8 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > arraySlice1d< real64 const > const & traction, bool const symmetric, bool const fixedLimitTau, + real64 const normalTractionTolerance, + real64 const tangentialTractionTolerance, real64 ( & dTraction_dDispJump )[3][3], real64 ( & tractionNew ) [3], integer & fractureState ) const @@ -346,8 +350,6 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > using namespace fields::contact; - // TODO: Pass this tol as an argument or define a new class member - constexpr real64 zero = 1.e-10; real64 dLimitTangentialTractionNorm_dTraction = 0.0; real64 limitTau = 0.0; @@ -364,7 +366,7 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > // If normal tangential trial is positive (opening) fractureState = FractureState::Stick; - if (tractionTrial[ 0 ] > zero) + if (tractionTrial[ 0 ] > normalTractionTolerance) { tractionNew[0] = 0.0; dTraction_dDispJump[0][0] = 0.0; @@ -388,7 +390,7 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > dLimitTangentialTractionNorm_dTraction ); } - if (tractionTrialNorm <= zero) + if (tractionTrialNorm <= tangentialTractionTolerance) { // It is needed for the first iteration (both t and u are equal to zero) dTraction_dDispJump[1][1] = - penalty[1]; @@ -399,7 +401,7 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > if ( fractureState != FractureState::Open ) fractureState = FractureState::Stick; } - else if (limitTau <= zero) + else if (limitTau <= tangentialTractionTolerance) { dTraction_dDispJump[1][1] = 0.0; dTraction_dDispJump[2][2] = 0.0; @@ -473,7 +475,7 @@ inline void CoulombFrictionUpdates::updateTractionOnly( arraySlice1d< real64 con { // TODO: Pass this tol as an argument or define a new class member - constexpr real64 zero = 1.e-10; + constexpr real64 zero = std::numeric_limits< real64 >::epsilon(); tractionNew[0] = traction[0] + penalty[0] * dispJump[0]; tractionNew[1] = traction[1] + penalty[1] * deltaDispJump[1]; diff --git a/src/coreComponents/constitutive/contact/FrictionBase.hpp b/src/coreComponents/constitutive/contact/FrictionBase.hpp index 55330d08a80..2675dfaee67 100644 --- a/src/coreComponents/constitutive/contact/FrictionBase.hpp +++ b/src/coreComponents/constitutive/contact/FrictionBase.hpp @@ -96,8 +96,12 @@ class FrictionBaseUpdates * @param[in] penalty the penalty coefficients * @param[in] traction the traction vector * @param[in] symmetric flag to compute only the symmetric part of dTraction_dDispJump + * @param[in] fixedLimitTau flag to keep fixed the tangential stress + * @param[in] normalTractionTolerance normal traction tolerance (if tn > tol => fracture is open) + * @param[in] tangentialTractionTolerance tangential traction tolerance (if tau < tol => tau = 0) * @param[out] dTraction_dDispJump matrix containing the derivatives of traction over the displacement jump * @param[out] tractionNew the new traction vector + * @param[out] fractureState the fracture state */ GEOS_HOST_DEVICE inline @@ -107,10 +111,13 @@ class FrictionBaseUpdates arraySlice1d< real64 const > const & traction, bool const symmetric, bool const fixedLimitTau, + real64 const normalTractionTolerance, + real64 const tangentialTractionTolerance, real64 ( & dTraction_dDispJump )[3][3], real64 ( & tractionNew )[3], integer & fractureState ) const { GEOS_UNUSED_VAR( oldDispJump, dispJump, penalty, traction, symmetric, fixedLimitTau, + normalTractionTolerance, tangentialTractionTolerance, dTraction_dDispJump, tractionNew, fractureState ); } /** diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp index 05835e6f94f..5b0cd2c0a6e 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp @@ -250,7 +250,7 @@ class ALM : StackVariables & stack ) const { GEOS_UNUSED_VAR( k ); - //constexpr real64 zero = 1.e-10; + constexpr real64 zero = std::numeric_limits< real64 >::epsilon(); constexpr int numUdofs = numNodesPerElem * 3 * 2; @@ -271,6 +271,8 @@ class ALM : m_traction[k], m_symmetric, m_symmetric, + zero, + zero, stack.localPenalty, tractionNew, fractureState); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp index ffdd5522dc7..ff437a013bb 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp @@ -321,6 +321,11 @@ struct ConstraintCheckKernel * @param[in] traction the array containing the current traction * @param[in] dispJump the array containing the displacement jump * @param[in] deltaDispJump the array containing the delta displacement jump + * @param[in] normalTractionTolerance Check tolerance (normal traction) + * @param[in] normalDisplacementTolerance Check tolerance (compenetration) + * @param[in] slidingTolerance Check tolerance (sliding) + * @param[in] slidingCheckTolerance Check tolerance (if shear strass exceeds tauLim) + * @param[in] area interface element area * @param[in] fractureState the array containing the fracture state * @param[out] condConv the array containing the convergence flag: * 0: Constraint conditions satisfied @@ -366,6 +371,78 @@ struct ConstraintCheckKernel } }; +/** + * @brief A struct to check for constraint satisfaction + */ +struct UpdateStateKernel +{ + + /** + * @brief Launch the kernel function to check the constraint satisfaction + * @tparam POLICY the type of policy used in the kernel launch + * @tparam CONTACT_WRAPPER the type of contact wrapper doing the fracture traction updates + * @param[in] size the size of the subregion + * @param[in] oldDispJump the array containing the old displacement jump (previous time step) + * @param[in] dispJump the array containing the displacement jump + * @param[in] penalty the array containing the penalty coefficients + * @param[in] symmetric flag to compute symmetric penalty matrix + * @param[in] normalTractionTolerance Check tolerance (normal traction) + * @param[in] traction the array containing the current traction + * @param[in] fractureState the array containing the fracture state + */ + template< typename POLICY, typename CONTACT_WRAPPER > + static void + launch( localIndex const size, + CONTACT_WRAPPER const & contactWrapper, + arrayView2d< real64 const > const & oldDispJump, + arrayView2d< real64 const > const & dispJump, + arrayView2d< real64 > const & penalty, + bool const symmetric, + arrayView1d< real64 const > const & normalTractionTolerance, + arrayView2d< real64 > const & traction, + arrayView1d< integer > const & fractureState ) + + { + forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) + { + + constexpr real64 zero = 1.e-10; + + real64 localPenalty[3][3] = {}; + real64 localTractionNew[3] = {}; + contactWrapper.updateTraction( oldDispJump[k], + dispJump[k], + penalty[k], + traction[k], + symmetric, + false, + normalTractionTolerance[k], + zero, + localPenalty, + localTractionNew, + fractureState[k]); + + if (fractureState[k] == fields::contact::FractureState::Open) + { + + LvArray::tensorOps::fill< 3 >( localTractionNew, 0.0 ); + } + else if (std::abs(localTractionNew[ 0 ]) < normalTractionTolerance[k] ) + { + LvArray::tensorOps::fill< 3 >( localTractionNew, 0.0 ); + fractureState[k] = fields::contact::FractureState::Slip; + } + + LvArray::tensorOps::copy< 3 >( traction[k], localTractionNew ); + penalty[k][2] = -localPenalty[1][1]; + penalty[k][3] = -localPenalty[2][2]; + penalty[k][4] = -localPenalty[1][2]; + + } ); + } + +}; + } // namespace SolidMechanicsALMKernels } // namespace geos diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index 3bdb4d368d0..cc88de6e336 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -244,6 +244,9 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & arrayView2d< real64 const > const faceNormal = faceManager.faceNormal(); ArrayOfArraysView< localIndex const > const elemsToFaces = subRegion.faceList().toViewConst(); + arrayView2d< real64 > const incrBubbleDisp = + faceManager.getField< fields::solidMechanics::incrementalBubbleDisplacement >() ; + arrayView3d< real64 > const rotationMatrix = subRegion.getField< fields::contact::rotationMatrix >().toView(); @@ -284,18 +287,22 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & penalty[k][3] = 0.0; penalty[k][4] = 0.0; } - LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); + //LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); } ); } - else - { + //else + //{ forAll< parallelDevicePolicy<> >( subRegion.size(), - [ dispJumpUpdPenalty ] + [ dispJumpUpdPenalty, elemsToFaces, incrBubbleDisp ] GEOS_HOST_DEVICE ( localIndex const k ) { LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); + localIndex const kf0 = elemsToFaces[k][0]; + localIndex const kf1 = elemsToFaces[k][1]; + LvArray::tensorOps::fill< 3 >( incrBubbleDisp[kf0], 0.0 ); + LvArray::tensorOps::fill< 3 >( incrBubbleDisp[kf1], 0.0 ); } ); - } + //} } ); } @@ -1058,6 +1065,14 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit } int hasConfigurationConvergedGlobally = (totCondNotConv == 0) ? true : false; + + if( getLogLevel() >= 1 && logger::internal::rank==0 ) + { + std::cout << GEOS_FMT( " Number of element convergence condition:" + " conv: {:12} | open: {:12} | comp: {:12} | slip: {:12} | tau>: {:12}\n", + globalCondConv[0], globalCondConv[1], globalCondConv[2], + globalCondConv[3], globalCondConv[4] ); + } //if( !condConv_flag ) @@ -1137,25 +1152,47 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit arrayView2d< real64 const > const dispJump = subRegion.getField< contact::dispJump >(); + arrayView2d< real64 const > const oldDispJump = subRegion.getField< contact::oldDispJump >(); + arrayView2d< real64 const > const deltaDispJump = subRegion.getField< contact::deltaDispJump >(); +#define KERNEL_NEW YES +#ifndef KERNEL_NEW forAll< parallelDevicePolicy<> >( subRegion.size(), [ traction_new_v, traction, penalty, - dispJump, deltaDispJump ] ( localIndex const kfe ) + dispJump, oldDispJump, deltaDispJump ] ( localIndex const kfe ) { real64 eps_N = penalty[kfe][0]; real64 eps_T = penalty[kfe][1]; traction_new_v[kfe][0] = traction[kfe][0] + eps_N * dispJump[kfe][0]; traction_new_v[kfe][1] = traction[kfe][1] + eps_T * deltaDispJump[kfe][1]; traction_new_v[kfe][2] = traction[kfe][2] + eps_T * deltaDispJump[kfe][2]; + //traction_new_v[kfe][1] = traction[kfe][1] + eps_T * (dispJump[kfe][1] - oldDispJump[kfe][1] ); + //traction_new_v[kfe][2] = traction[kfe][2] + eps_T * (dispJump[kfe][2] - oldDispJump[kfe][2] ) ; } ); - real64 const slidingCheckTolerance = m_slidingCheckTolerance; +#endif + constitutiveUpdatePassThru( frictionLaw, [&] ( auto & castedFrictionLaw ) { using FrictionType = TYPEOFREF( castedFrictionLaw ); typename FrictionType::KernelWrapper frictionWrapper = castedFrictionLaw.createKernelUpdates(); - + + +#ifdef KERNEL_NEW + std::cout << "NEW KERNEL" << std::endl; + solidMechanicsALMKernels::UpdateStateKernel:: + launch< parallelDevicePolicy<> >( subRegion.size(), + frictionWrapper, + oldDispJump, + dispJump, + penalty, + m_symmetric, + normalTractionTolerance, + traction, + fractureState); +#else + forAll< parallelHostPolicy >( subRegion.size(), [ frictionWrapper, normalTractionTolerance, slidingTolerance, normalDisplacementTolerance, @@ -1325,7 +1362,8 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit } } - } ); + } ); +#endif } ); forAll< parallelDevicePolicy<> >( subRegion.size(), [ dispJumpUpdPenalty, diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp index 7c30a0366c5..d76f356d2ea 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp @@ -243,9 +243,9 @@ class SolidMechanicsAugmentedLagrangianContact : public ContactSolverBase real64 const m_slidingCheckTolerance = 0.05; - bool m_simultaneous = false; + bool m_simultaneous = true; - bool m_symmetric = false; + bool m_symmetric = true; }; From 469abdc160ce54d168af03c5172caf09ebb0c30c Mon Sep 17 00:00:00 2001 From: mfrigo Date: Wed, 4 Sep 2024 19:19:58 -0700 Subject: [PATCH 14/41] Cleaning up the PR --- .../constitutive/ConstitutivePassThru.hpp | 2 +- .../constitutive/contact/CoulombFriction.hpp | 126 ++-- .../constitutive/contact/FrictionBase.hpp | 20 +- .../elementFormulations/LagrangeBasis1.hpp | 32 +- .../SolidMechanicsALMBubbleKernels.hpp | 6 +- .../contact/SolidMechanicsALMKernels.hpp | 114 +-- .../contact/SolidMechanicsALMKernelsBase.hpp | 18 +- .../SolidMechanicsALMSimultaneousKernels.hpp | 31 +- ...lidMechanicsAugmentedLagrangianContact.cpp | 654 ++++-------------- ...lidMechanicsAugmentedLagrangianContact.hpp | 16 +- 10 files changed, 255 insertions(+), 764 deletions(-) diff --git a/src/coreComponents/constitutive/ConstitutivePassThru.hpp b/src/coreComponents/constitutive/ConstitutivePassThru.hpp index eb5aace7a74..decabffbb6a 100644 --- a/src/coreComponents/constitutive/ConstitutivePassThru.hpp +++ b/src/coreComponents/constitutive/ConstitutivePassThru.hpp @@ -95,7 +95,7 @@ struct ConstitutivePassThru< CoulombFriction > void execute( ConstitutiveBase & constitutiveRelation, LAMBDA && lambda ) { ConstitutivePassThruHandler< CoulombFriction >::execute( constitutiveRelation, - std::forward< LAMBDA >( lambda ) ); + std::forward< LAMBDA >( lambda ) ); } }; diff --git a/src/coreComponents/constitutive/contact/CoulombFriction.hpp b/src/coreComponents/constitutive/contact/CoulombFriction.hpp index 6d842bf084e..c1566a3b7bd 100644 --- a/src/coreComponents/constitutive/contact/CoulombFriction.hpp +++ b/src/coreComponents/constitutive/contact/CoulombFriction.hpp @@ -100,8 +100,8 @@ class CoulombFrictionUpdates : public FrictionBaseUpdates bool const fixedLimitTau, real64 const normalTractionTolerance, real64 const tangentialTractionTolerance, - real64 ( & dTraction_dDispJump )[3][3], - real64 ( & tractionNew )[3], + real64 ( &dTraction_dDispJump )[3][3], + real64 ( &tractionNew )[3], integer & fractureState ) const override final; @@ -113,14 +113,14 @@ class CoulombFrictionUpdates : public FrictionBaseUpdates arraySlice1d< real64 const > const & traction, arraySlice1d< real64 > const & tractionNew ) const override final; -GEOS_HOST_DEVICE -inline -virtual void constraintCheck( arraySlice1d< real64 const > const & dispJump, - arraySlice1d< real64 const > const & deltaDispJump, - arraySlice1d< real64 > const & tractionVector, - integer const fractureState, - std::map const & tolerance, - integer & condConv ) const override final; + GEOS_HOST_DEVICE + inline + virtual void constraintCheck( arraySlice1d< real64 const > const & dispJump, + arraySlice1d< real64 const > const & deltaDispJump, + arraySlice1d< real64 > const & tractionVector, + integer const fractureState, + std::map< std::string const, real64 const > const & tolerance, + integer & condConv ) const override final; private: /// The shear stiffness @@ -366,20 +366,20 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > // If normal tangential trial is positive (opening) fractureState = FractureState::Stick; - if (tractionTrial[ 0 ] > normalTractionTolerance) + if( tractionTrial[ 0 ] > normalTractionTolerance ) { tractionNew[0] = 0.0; dTraction_dDispJump[0][0] = 0.0; fractureState = FractureState::Open; } - else + else { tractionNew[0] = tractionTrial[0]; dTraction_dDispJump[0][0] = -penalty[ 0 ]; } // Compute limit Tau - if (fixedLimitTau) + if( fixedLimitTau ) { limitTau = computeLimitTangentialTractionNorm( traction[0], dLimitTangentialTractionNorm_dTraction ); @@ -390,18 +390,19 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > dLimitTangentialTractionNorm_dTraction ); } - if (tractionTrialNorm <= tangentialTractionTolerance) + if( tractionTrialNorm <= tangentialTractionTolerance ) { - // It is needed for the first iteration (both t and u are equal to zero) - dTraction_dDispJump[1][1] = - penalty[1]; - dTraction_dDispJump[2][2] = - penalty[1]; + // It is needed for the first iteration (both t and u are equal to zero) + dTraction_dDispJump[1][1] = -penalty[1]; + dTraction_dDispJump[2][2] = -penalty[1]; tractionNew[1] = tractionTrial[1]; tractionNew[2] = tractionTrial[2]; - if ( fractureState != FractureState::Open ) fractureState = FractureState::Stick; + if( fractureState != FractureState::Open ) + fractureState = FractureState::Stick; } - else if (limitTau <= tangentialTractionTolerance) + else if( limitTau <= tangentialTractionTolerance ) { dTraction_dDispJump[1][1] = 0.0; dTraction_dDispJump[2][2] = 0.0; @@ -409,7 +410,8 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > tractionNew[1] = (fixedLimitTau) ? tractionTrial[1] : 0.0; tractionNew[2] = (fixedLimitTau) ? tractionTrial[2] : 0.0; - if ( fractureState != FractureState::Open ) fractureState = FractureState::Slip; + if( fractureState != FractureState::Open ) + fractureState = FractureState::Slip; } else { @@ -419,7 +421,7 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > real64 const psi = ( tractionTrialNorm > limitTau) ? 1.0 : tractionTrialNorm/limitTau; real64 const dpsi = ( tractionTrialNorm > limitTau) ? 0.0 : 1.0; - if ( fractureState != FractureState::Open ) + if( fractureState != FractureState::Open ) { fractureState = ( tractionTrialNorm > limitTau) ? FractureState::Slip : FractureState::Stick; } @@ -429,34 +431,34 @@ inline void CoulombFrictionUpdates::updateTraction( arraySlice1d< real64 const > dNormTTdgT[ 0 ] = tractionTrial[ 1 ] * tractionTrial[ 1 ]; dNormTTdgT[ 1 ] = tractionTrial[ 2 ] * tractionTrial[ 2 ]; dNormTTdgT[ 2 ] = tractionTrial[ 1 ] * tractionTrial[ 2 ]; - + real64 dTdgT[ 3 ]; - dTdgT[ 0 ] = (tractionTrialNorm * tractionTrialNorm - dNormTTdgT[0]); + dTdgT[ 0 ] = (tractionTrialNorm * tractionTrialNorm - dNormTTdgT[0]); dTdgT[ 1 ] = (tractionTrialNorm * tractionTrialNorm - dNormTTdgT[1]); - dTdgT[ 2 ] = - dNormTTdgT[2]; - - LvArray::tensorOps::scale< 3 >( dNormTTdgT, 1. / std::pow(tractionTrialNorm, 2) ); + dTdgT[ 2 ] = -dNormTTdgT[2]; + + LvArray::tensorOps::scale< 3 >( dNormTTdgT, 1. / std::pow( tractionTrialNorm, 2 ) ); LvArray::tensorOps::scale< 3 >( dTdgT, 1. / std::pow( tractionTrialNorm, 3 ) ); // Compute dTdDispJump - dTraction_dDispJump[1][1] = -penalty[1] * ( - dpsi * dNormTTdgT[0] + - psi * dTdgT[0] * limitTau ); - dTraction_dDispJump[2][2] = -penalty[1] * ( - dpsi * dNormTTdgT[1] + - psi * dTdgT[1] * limitTau ); - dTraction_dDispJump[1][2] = -penalty[1] * ( - dpsi * dNormTTdgT[2] + - psi * dTdgT[2] * limitTau ); + dTraction_dDispJump[1][1] = -penalty[1] * ( + dpsi * dNormTTdgT[0] + + psi * dTdgT[0] * limitTau ); + dTraction_dDispJump[2][2] = -penalty[1] * ( + dpsi * dNormTTdgT[1] + + psi * dTdgT[1] * limitTau ); + dTraction_dDispJump[1][2] = -penalty[1] * ( + dpsi * dNormTTdgT[2] + + psi * dTdgT[2] * limitTau ); dTraction_dDispJump[2][1] = dTraction_dDispJump[1][2]; - - if (!symmetric) + + if( !symmetric ) { // Nonsymetric term - dTraction_dDispJump[1][0] = -dTraction_dDispJump[0][0] * m_frictionCoefficient * - tractionTrial[1] * (psi/tractionTrialNorm - dpsi/limitTau); - dTraction_dDispJump[2][0] = -dTraction_dDispJump[0][0] * m_frictionCoefficient * - tractionTrial[2] * (psi/tractionTrialNorm - dpsi/limitTau); + dTraction_dDispJump[1][0] = -dTraction_dDispJump[0][0] * m_frictionCoefficient * + tractionTrial[1] * (psi/tractionTrialNorm - dpsi/limitTau); + dTraction_dDispJump[2][0] = -dTraction_dDispJump[0][0] * m_frictionCoefficient * + tractionTrial[2] * (psi/tractionTrialNorm - dpsi/limitTau); } LvArray::tensorOps::scale< 3 >( tractionTrial, (psi * limitTau)/tractionTrialNorm ); @@ -484,30 +486,30 @@ inline void CoulombFrictionUpdates::updateTractionOnly( arraySlice1d< real64 con real64 const tau[2] = { tractionNew[1], tractionNew[2] }; real64 const currentTau = LvArray::tensorOps::l2Norm< 2 >( tau ); - + real64 dLimitTangentialTractionNorm_dTraction = 0.0; real64 const limitTau = computeLimitTangentialTractionNorm( tractionNew[0], dLimitTangentialTractionNorm_dTraction ); // Compute psi real64 psi; - if (limitTau < zero) + if( limitTau < zero ) { psi = 1.0; - } - else + } + else { //psi = std::tanh(currentTau / limitTau); psi = (currentTau > limitTau ) ? 1.0 : currentTau/limitTau; } - + // Compute the new tangential traction - if (limitTau > zero && currentTau > zero) + if( limitTau > zero && currentTau > zero ) { tractionNew[1] *= limitTau * psi / currentTau; tractionNew[2] *= limitTau * psi / currentTau; } - else + else { tractionNew[1] *= 0.0; tractionNew[2] *= 0.0; @@ -519,19 +521,19 @@ inline void CoulombFrictionUpdates::constraintCheck( arraySlice1d< real64 const arraySlice1d< real64 const > const & deltaDispJump, arraySlice1d< real64 > const & tractionVector, integer const fractureState, - std::map const & tolerance, + std::map< std::string const, real64 const > const & tolerance, integer & condConv ) const { using namespace fields::contact; - real64 const normalTractionTolerance = tolerance.at("normalTraction"); - real64 const normalDisplacementTolerance = tolerance.at("normalDisplacement"); - real64 const slidingTolerance = tolerance.at("sliding"); - real64 const slidingCheckTolerance = tolerance.at("slidingCheck"); + real64 const normalTractionTolerance = tolerance.at( "normalTraction" ); + real64 const normalDisplacementTolerance = tolerance.at( "normalDisplacement" ); + real64 const slidingTolerance = tolerance.at( "sliding" ); + real64 const slidingCheckTolerance = tolerance.at( "slidingCheck" ); // Compute the slip - real64 const deltaDisp[2] = { deltaDispJump[1], + real64 const deltaDisp[2] = { deltaDispJump[1], deltaDispJump[2] }; real64 const deltaDispNorm = LvArray::tensorOps::l2Norm< 2 >( deltaDisp ); @@ -540,16 +542,16 @@ inline void CoulombFrictionUpdates::constraintCheck( arraySlice1d< real64 const real64 const tau[2] = { tractionVector[1], tractionVector[2] }; real64 const currentTau = LvArray::tensorOps::l2Norm< 2 >( tau ); - + real64 dLimitTangentialTractionNorm_dTraction = 0.0; real64 const limitTau = computeLimitTangentialTractionNorm( tractionVector[0], dLimitTangentialTractionNorm_dTraction ); - condConv = 0; + condConv = 0; // Case 1: if it is open if( tractionVector[0] >= normalTractionTolerance ) { - if (fractureState != FractureState::Open) + if( fractureState != FractureState::Open ) { condConv = 1; } @@ -560,20 +562,20 @@ inline void CoulombFrictionUpdates::constraintCheck( arraySlice1d< real64 const else { // Case 2: compenetration - if (( std::abs( dispJump[0] ) > normalDisplacementTolerance ) && - (fractureState != FractureState::Open)) + if(( std::abs( dispJump[0] ) > normalDisplacementTolerance ) && + (fractureState != FractureState::Open)) { condConv = 2; } // Case 3: it is stick and dg is greater than 0 - if( fractureState == FractureState::Stick && + if( fractureState == FractureState::Stick && deltaDispNorm > slidingTolerance ) { condConv = 3; } - + // Case 4: the elastic tangential traction is greater than the limit - if( currentTau > (std::abs(limitTau) * (1.0 + slidingCheckTolerance)) ) + if( currentTau > (std::abs( limitTau ) * (1.0 + slidingCheckTolerance)) ) { condConv = 4; } diff --git a/src/coreComponents/constitutive/contact/FrictionBase.hpp b/src/coreComponents/constitutive/contact/FrictionBase.hpp index 2675dfaee67..1f80a55a88e 100644 --- a/src/coreComponents/constitutive/contact/FrictionBase.hpp +++ b/src/coreComponents/constitutive/contact/FrictionBase.hpp @@ -90,7 +90,7 @@ class FrictionBaseUpdates { GEOS_UNUSED_VAR( k, dispJump, tractionVector, fractureState ); } /** - * @brief Update the trial traction vector ( return mapping ) + * @brief Update the trial traction vector ( return mapping ) * @param[in] oldDispJump the displacement jump of the previous time step * @param[in] dispJump the displacement jump of the current time step * @param[in] penalty the penalty coefficients @@ -114,14 +114,16 @@ class FrictionBaseUpdates real64 const normalTractionTolerance, real64 const tangentialTractionTolerance, real64 ( & dTraction_dDispJump )[3][3], - real64 ( & tractionNew )[3], + real64 ( & tractionNew )[3], integer & fractureState ) const - { GEOS_UNUSED_VAR( oldDispJump, dispJump, penalty, traction, symmetric, fixedLimitTau, - normalTractionTolerance, tangentialTractionTolerance, - dTraction_dDispJump, tractionNew, fractureState ); } + { + GEOS_UNUSED_VAR( oldDispJump, dispJump, penalty, traction, symmetric, fixedLimitTau, + normalTractionTolerance, tangentialTractionTolerance, + dTraction_dDispJump, tractionNew, fractureState ); + } /** - * @brief Update the traction vector only ( return mapping ) + * @brief Update the traction vector only ( return mapping ) * @param[in] dispJump the displacement jump of the current time step * @param[in] deltaDispJump the delta displacement jump of the current time step * @param[in] penalty the penalty coefficients @@ -134,11 +136,11 @@ class FrictionBaseUpdates arraySlice1d< real64 const > const & deltaDispJump, arraySlice1d< real64 const > const & penalty, arraySlice1d< real64 const > const & traction, - arraySlice1d< real64 > const & tractionNew ) const + arraySlice1d< real64 > const & tractionNew ) const { GEOS_UNUSED_VAR( dispJump, deltaDispJump, penalty, traction, tractionNew ); } /** - * @brief Check for the constraint satisfaction + * @brief Check for the constraint satisfaction * @param[in] dispJump the displacement jump of the current time step * @param[in] deltaDispJump the delta displacement jump of the current time step * @param[in] tractionVector the traction vector @@ -152,7 +154,7 @@ class FrictionBaseUpdates arraySlice1d< real64 const > const & deltaDispJump, arraySlice1d< real64 > const & tractionVector, integer const fractureState, - std::map const & tolerance, + std::map< std::string const, real64 const > const & tolerance, integer & condConv ) const { GEOS_UNUSED_VAR( dispJump, deltaDispJump, tractionVector, fractureState, tolerance, condConv ); } diff --git a/src/coreComponents/finiteElement/elementFormulations/LagrangeBasis1.hpp b/src/coreComponents/finiteElement/elementFormulations/LagrangeBasis1.hpp index 8da0cbf903e..6e5ae70ac3d 100644 --- a/src/coreComponents/finiteElement/elementFormulations/LagrangeBasis1.hpp +++ b/src/coreComponents/finiteElement/elementFormulations/LagrangeBasis1.hpp @@ -422,12 +422,12 @@ class LagrangeBasis1 for( int a=0; a<2; ++a ) { N[ a*4+1 ] = LagrangeBasis1::valueBubble( coords[0] ) * - LagrangeBasis1::valueBubble( coords[1] ) * - LagrangeBasis1::value( a, coords[2] ); + LagrangeBasis1::valueBubble( coords[1] ) * + LagrangeBasis1::value( a, coords[2] ); N[ a*4 ] = LagrangeBasis1::valueBubble( coords[0] ) * - LagrangeBasis1::value( a, coords[1] ) * - LagrangeBasis1::valueBubble( coords[2] ); + LagrangeBasis1::value( a, coords[1] ) * + LagrangeBasis1::valueBubble( coords[2] ); N[ a+2 ] = LagrangeBasis1::value( a, coords[0] ) * LagrangeBasis1::valueBubble( coords[1] ) * @@ -450,24 +450,24 @@ class LagrangeBasis1 for( int a=0; a<2; ++a ) { dNdXi[ a*4+1 ][0] = LagrangeBasis1::gradientBubble( coords[0] ) * - LagrangeBasis1::valueBubble( coords[1] ) * - LagrangeBasis1::value( a, coords[2] ); + LagrangeBasis1::valueBubble( coords[1] ) * + LagrangeBasis1::value( a, coords[2] ); dNdXi[ a*4+1 ][1] = LagrangeBasis1::valueBubble( coords[0] ) * - LagrangeBasis1::gradientBubble( coords[1] ) * - LagrangeBasis1::value( a, coords[2] ); + LagrangeBasis1::gradientBubble( coords[1] ) * + LagrangeBasis1::value( a, coords[2] ); dNdXi[ a*4+1 ][2] = LagrangeBasis1::valueBubble( coords[0] ) * - LagrangeBasis1::valueBubble( coords[1] ) * - LagrangeBasis1::gradient( a, coords[2] ); + LagrangeBasis1::valueBubble( coords[1] ) * + LagrangeBasis1::gradient( a, coords[2] ); dNdXi[ a*4 ][0] = LagrangeBasis1::gradientBubble( coords[0] ) * - LagrangeBasis1::value( a, coords[1] ) * - LagrangeBasis1::valueBubble( coords[2] ); + LagrangeBasis1::value( a, coords[1] ) * + LagrangeBasis1::valueBubble( coords[2] ); dNdXi[ a*4 ][1] = LagrangeBasis1::valueBubble( coords[0] ) * - LagrangeBasis1::gradient( a, coords[1] ) * - LagrangeBasis1::valueBubble( coords[2] ); + LagrangeBasis1::gradient( a, coords[1] ) * + LagrangeBasis1::valueBubble( coords[2] ); dNdXi[ a*4 ][2] = LagrangeBasis1::valueBubble( coords[0] ) * - LagrangeBasis1::value( a, coords[1] ) * - LagrangeBasis1::gradientBubble( coords[2] ); + LagrangeBasis1::value( a, coords[1] ) * + LagrangeBasis1::gradientBubble( coords[2] ); dNdXi[ a+2 ][0] = LagrangeBasis1::gradient( a, coords[0] ) * LagrangeBasis1::valueBubble( coords[1] ) * diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp index 2b68a463076..3e624db831d 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp @@ -333,13 +333,13 @@ class ALMBubbleKernels : // Compute the initial stress real64 rb_gauss[nBubbleUdof]; real64 strain[6] = {0}; - LvArray::tensorOps::Ri_eq_AijBj< 6, nUdof >( strain , strainMatrix, stack.uLocal ); + LvArray::tensorOps::Ri_eq_AijBj< 6, nUdof >( strain, strainMatrix, stack.uLocal ); real64 initStressLocal[ 6 ] = {0}; - LvArray::tensorOps::Ri_eq_AijBj< 6, 6 >( initStressLocal , stack.constitutiveStiffness, strain ); + LvArray::tensorOps::Ri_eq_AijBj< 6, 6 >( initStressLocal, stack.constitutiveStiffness, strain ); for( localIndex c = 0; c < 6; ++c ) { - initStressLocal[ c ] -= m_constitutiveUpdate.m_newStress( k, q, c ); + initStressLocal[ c ] -= m_constitutiveUpdate.m_newStress( k, q, c ); } LvArray::tensorOps::Ri_eq_AjiBj< nBubbleUdof, 6 >( rb_gauss, strainBubbleMatrix, initStressLocal ); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp index 5b0cd2c0a6e..389d88a4de4 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp @@ -98,7 +98,7 @@ class ALM : inputDt, faceElementList ), m_traction( elementSubRegion.getField< fields::contact::traction >().toViewConst()), - m_symmetric( isSymmetric) + m_symmetric( isSymmetric ) {} //*************************************************************************** @@ -251,7 +251,7 @@ class ALM : { GEOS_UNUSED_VAR( k ); constexpr real64 zero = std::numeric_limits< real64 >::epsilon(); - + constexpr int numUdofs = numNodesPerElem * 3 * 2; constexpr int numBdofs = 3*2; @@ -275,115 +275,7 @@ class ALM : zero, stack.localPenalty, tractionNew, - fractureState); - - - /*real64 dLimitTangentialTractionNorm_dTraction = 0.0; - real64 limitTau = 0.0; - - // Compute the trial traction - real64 tractionTrial[ 3 ]; - tractionTrial[ 0 ] = stack.tLocal[0] + m_penalty(k, 0) * stack.dispJumpLocal[0]; - tractionTrial[ 1 ] = stack.tLocal[1] + m_penalty(k, 1) * (stack.dispJumpLocal[1] - stack.oldDispJumpLocal[1]); - tractionTrial[ 2 ] = stack.tLocal[2] + m_penalty(k, 1) * (stack.dispJumpLocal[2] - stack.oldDispJumpLocal[2]); - - // Compute tangential trial traction norm - real64 const tractionTrialNorm = std::sqrt( std::pow(tractionTrial[1], 2) + - std::pow(tractionTrial[2], 2)); - - // If normal tangential trial is positive (opening) - if (tractionTrial[ 0 ] > zero) - { - tractionNew[0] = 0.0; - stack.localPenalty[0][0] = 0.0; - } - else - { - tractionNew[0] = tractionTrial[0]; - stack.localPenalty[0][0] = -m_penalty( k, 0 ); - } - - // Compute limit Tau - if (m_symmetric) - { - limitTau = m_constitutiveUpdate.computeLimitTangentialTractionNorm( m_traction(k, 0), - dLimitTangentialTractionNorm_dTraction ); - } - else - { - limitTau = m_constitutiveUpdate.computeLimitTangentialTractionNorm( tractionNew[0], - dLimitTangentialTractionNorm_dTraction ); - } - - if (tractionTrialNorm <= zero) - { - // It is needed for the first iteration (both t and u are equal to zero) - stack.localPenalty[1][1] = -m_penalty( k, 1); - stack.localPenalty[2][2] = -m_penalty( k, 1); - - tractionNew[1] = tractionTrial[1]; - tractionNew[2] = tractionTrial[2]; - } - else if (limitTau <= zero) - { - stack.localPenalty[1][1] = 0.0; - stack.localPenalty[2][2] = 0.0; - - tractionNew[1] = (m_symmetric) ? tractionTrial[1] : 0.0; - tractionNew[2] = (m_symmetric) ? tractionTrial[2] : 0.0; - } - - else - { - // Compute psi and dpsi - //real64 const psi = std::tanh( tractionTrialNorm/limitTau ); - //real64 const dpsi = 1.0-std::pow(psi,2); - real64 const psi = ( tractionTrialNorm > limitTau) ? 1.0 : tractionTrialNorm/limitTau; - real64 const dpsi = ( tractionTrialNorm > limitTau) ? 0.0 : 1.0; - - // Two symmetric 2x2 matrices - real64 dNormTTdgT[ 3 ]; - dNormTTdgT[ 0 ] = tractionTrial[ 1 ] * tractionTrial[ 1 ]; - dNormTTdgT[ 1 ] = tractionTrial[ 2 ] * tractionTrial[ 2 ]; - dNormTTdgT[ 2 ] = tractionTrial[ 1 ] * tractionTrial[ 2 ]; - - real64 dTdgT[ 3 ]; - dTdgT[ 0 ] = (tractionTrialNorm * tractionTrialNorm - dNormTTdgT[0]); - dTdgT[ 1 ] = (tractionTrialNorm * tractionTrialNorm - dNormTTdgT[1]); - dTdgT[ 2 ] = - dNormTTdgT[2]; - - LvArray::tensorOps::scale< 3 >( dNormTTdgT, 1. / std::pow(tractionTrialNorm, 2) ); - LvArray::tensorOps::scale< 3 >( dTdgT, 1. / std::pow( tractionTrialNorm, 3 ) ); - - // Compute dTdDispJump - stack.localPenalty[1][1] = -m_penalty( k, 1) * ( - dpsi * dNormTTdgT[0] + - psi * dTdgT[0] * limitTau ); - stack.localPenalty[2][2] = -m_penalty( k, 1) * ( - dpsi * dNormTTdgT[1] + - psi * dTdgT[1] * limitTau ); - stack.localPenalty[1][2] = -m_penalty( k, 1) * ( - dpsi * dNormTTdgT[2] + - psi * dTdgT[2] * limitTau ); - stack.localPenalty[2][1] = stack.localPenalty[1][2]; - - if (!m_symmetric) - { - // Nonsymetric term - //real64 const friction = m_constitutiveUpdate.frictionCoefficient(); - real64 const friction = (std::abs(tractionNew[0]) > zero) ? - limitTau / tractionNew[0] : 0.0; - stack.localPenalty[1][0] = -stack.localPenalty[0][0] * friction * - tractionTrial[1] * (psi/tractionTrialNorm - dpsi/limitTau); - stack.localPenalty[2][0] = -stack.localPenalty[0][0] * friction * - tractionTrial[2] * (psi/tractionTrialNorm - dpsi/limitTau); - } - - tensorOps::scale< 3 >( tractionTrial, (psi * limitTau)/tractionTrialNorm ); - tractionNew[1] = tractionTrial[1]; - tractionNew[2] = tractionTrial[2]; - } - */ - + fractureState ); // transp(R) * Atu LvArray::tensorOps::Rij_eq_AkiBkj< 3, numUdofs, 3 >( matRRtAtu, stack.localRotationMatrix, diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp index ff437a013bb..880d93bb7be 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp @@ -355,10 +355,10 @@ struct ConstraintCheckKernel { if( ghostRank[k] < 0 ) { - std::map const tolerance = {{"normalTraction", normalTractionTolerance[k]}, - {"normalDisplacement", normalDisplacementTolerance[k]*area[k] }, - {"sliding", slidingTolerance[k]*area[k] }, - {"slidingCheck", slidingCheckTolerance }}; + std::map< std::string const, real64 const > const tolerance = {{"normalTraction", normalTractionTolerance[k]}, + {"normalDisplacement", normalDisplacementTolerance[k]*area[k] }, + {"sliding", slidingTolerance[k]*area[k] }, + {"slidingCheck", slidingCheckTolerance }}; contactWrapper.constraintCheck( dispJump[k], deltaDispJump[k], traction[k], @@ -385,7 +385,7 @@ struct UpdateStateKernel * @param[in] oldDispJump the array containing the old displacement jump (previous time step) * @param[in] dispJump the array containing the displacement jump * @param[in] penalty the array containing the penalty coefficients - * @param[in] symmetric flag to compute symmetric penalty matrix + * @param[in] symmetric flag to compute symmetric penalty matrix * @param[in] normalTractionTolerance Check tolerance (normal traction) * @param[in] traction the array containing the current traction * @param[in] fractureState the array containing the fracture state @@ -420,14 +420,14 @@ struct UpdateStateKernel zero, localPenalty, localTractionNew, - fractureState[k]); + fractureState[k] ); - if (fractureState[k] == fields::contact::FractureState::Open) + if( fractureState[k] == fields::contact::FractureState::Open ) { LvArray::tensorOps::fill< 3 >( localTractionNew, 0.0 ); } - else if (std::abs(localTractionNew[ 0 ]) < normalTractionTolerance[k] ) + else if( std::abs( localTractionNew[ 0 ] ) < normalTractionTolerance[k] ) { LvArray::tensorOps::fill< 3 >( localTractionNew, 0.0 ); fractureState[k] = fields::contact::FractureState::Slip; @@ -437,7 +437,7 @@ struct UpdateStateKernel penalty[k][2] = -localPenalty[1][1]; penalty[k][3] = -localPenalty[2][2]; penalty[k][4] = -localPenalty[1][2]; - + } ); } diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp index 4cff0918433..12c35c0a3f6 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp @@ -263,11 +263,7 @@ class ALMSimultaneous : real64 matRRtAtu[3][numUdofs], matDRtAtu[3][numUdofs]; real64 matRRtAtb[3][numBdofs], matDRtAtb[3][numBdofs]; - //real64 dispJumpR[numUdofs]; - //real64 oldDispJumpR[numUdofs]; real64 tractionR[numUdofs]; - //real64 dispJumpRb[numBdofs]; - //real64 oldDispJumpRb[numBdofs]; real64 tractionRb[numBdofs]; @@ -330,18 +326,9 @@ class ALMSimultaneous : matRRtAtb ); // Compute the local residuals - //LvArray::tensorOps::Ri_eq_AjiBj< numUdofs, 3 >( dispJumpR, matDRtAtu, stack.dispJumpLocal ); - //LvArray::tensorOps::Ri_eq_AjiBj< numUdofs, 3 >( oldDispJumpR, matDRtAtu, stack.oldDispJumpLocal ); - //LvArray::tensorOps::Ri_eq_AjiBj< numBdofs, 3 >( dispJumpRb, matDRtAtb, stack.dispJumpLocal ); - //LvArray::tensorOps::Ri_eq_AjiBj< numBdofs, 3 >( oldDispJumpRb, matDRtAtb, stack.oldDispJumpLocal ); - LvArray::tensorOps::scaledAdd< numUdofs >( stack.localRu, tractionR, 1 ); - //LvArray::tensorOps::scaledAdd< numUdofs >( stack.localRu, dispJumpR, 1 ); - //LvArray::tensorOps::scaledAdd< numUdofs >( stack.localRu, oldDispJumpR, -1 ); LvArray::tensorOps::scaledAdd< numBdofs >( stack.localRb, tractionRb, 1 ); - //LvArray::tensorOps::scaledAdd< numBdofs >( stack.localRb, dispJumpRb, 1 ); - //LvArray::tensorOps::scaledAdd< numBdofs >( stack.localRb, oldDispJumpRb, -1 ); for( localIndex i=0; i < numUdofs; ++i ) { @@ -395,13 +382,13 @@ class ALMSimultaneous : /// The factory used to construct the kernel. using ALMSimultaneousFactory = finiteElement::InterfaceKernelFactory< ALMSimultaneous, - arrayView1d< globalIndex const > const, - arrayView1d< globalIndex const > const, - globalIndex const, - CRSMatrixView< real64, globalIndex const > const, - arrayView1d< real64 > const, - real64 const, - arrayView1d< localIndex const > const>; + arrayView1d< globalIndex const > const, + arrayView1d< globalIndex const > const, + globalIndex const, + CRSMatrixView< real64, globalIndex const > const, + arrayView1d< real64 > const, + real64 const, + arrayView1d< localIndex const > const >; /** * @brief A struct to compute the traction after nonlinear solve @@ -433,9 +420,9 @@ struct ComputeTractionSimultaneousKernel { tractionNew[kfe][0] = traction[kfe][0] + penalty[kfe][0] * dispJump[kfe][0]; tractionNew[kfe][1] = traction[kfe][1] + penalty[kfe][2] * deltaDispJump[kfe][1] + - penalty[kfe][4] * deltaDispJump[kfe][2]; + penalty[kfe][4] * deltaDispJump[kfe][2]; tractionNew[kfe][2] = traction[kfe][2] + penalty[kfe][3] * deltaDispJump[kfe][2] + - penalty[kfe][4] * deltaDispJump[kfe][1]; + penalty[kfe][4] * deltaDispJump[kfe][1]; } ); } diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index cc88de6e336..5f68c13ebf5 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -245,7 +245,7 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & ArrayOfArraysView< localIndex const > const elemsToFaces = subRegion.faceList().toViewConst(); arrayView2d< real64 > const incrBubbleDisp = - faceManager.getField< fields::solidMechanics::incrementalBubbleDisplacement >() ; + faceManager.getField< fields::solidMechanics::incrementalBubbleDisplacement >(); arrayView3d< real64 > const rotationMatrix = subRegion.getField< fields::contact::rotationMatrix >().toView(); @@ -268,41 +268,38 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & penalty = subRegion.getField< fields::contact::penalty >().toView(); arrayView1d< integer const > const fractureState = subRegion.getField< contact::fractureState >(); - if (m_simultaneous) + if( m_simultaneous ) { // Set the penalty coefficients - forAll< parallelDevicePolicy<> >( subRegion.size(), - [ penalty, fractureState, dispJumpUpdPenalty ] + forAll< parallelDevicePolicy<> >( subRegion.size(), + [ penalty, fractureState, dispJumpUpdPenalty ] GEOS_HOST_DEVICE ( localIndex const k ) { - if (fractureState[k] == contact::FractureState::Stick) + if( fractureState[k] == contact::FractureState::Stick ) { penalty[k][2] = penalty[k][1]; penalty[k][3] = penalty[k][1]; penalty[k][4] = 0.0; - } - else + } + else { - penalty[k][2] = 0.0; + penalty[k][2] = 0.0; penalty[k][3] = 0.0; penalty[k][4] = 0.0; } - //LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); } ); } - //else - //{ - forAll< parallelDevicePolicy<> >( subRegion.size(), - [ dispJumpUpdPenalty, elemsToFaces, incrBubbleDisp ] - GEOS_HOST_DEVICE ( localIndex const k ) - { - LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); - localIndex const kf0 = elemsToFaces[k][0]; - localIndex const kf1 = elemsToFaces[k][1]; - LvArray::tensorOps::fill< 3 >( incrBubbleDisp[kf0], 0.0 ); - LvArray::tensorOps::fill< 3 >( incrBubbleDisp[kf1], 0.0 ); - } ); - //} + + forAll< parallelDevicePolicy<> >( subRegion.size(), + [ dispJumpUpdPenalty, elemsToFaces, incrBubbleDisp ] + GEOS_HOST_DEVICE ( localIndex const k ) + { + LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); + localIndex const kf0 = elemsToFaces[k][0]; + localIndex const kf1 = elemsToFaces[k][1]; + LvArray::tensorOps::fill< 3 >( incrBubbleDisp[kf0], 0.0 ); + LvArray::tensorOps::fill< 3 >( incrBubbleDisp[kf1], 0.0 ); + } ); } ); } @@ -348,13 +345,13 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time string const & fractureRegionName = this->getUniqueFractureRegionName(); - forFiniteElementOnStickFractureSubRegions( meshName, [&] ( string const & , - finiteElement::FiniteElementBase const & subRegionFE, - arrayView1d< localIndex const > const & faceElementList, - bool const ) + forFiniteElementOnStickFractureSubRegions( meshName, [&] ( string const &, + finiteElement::FiniteElementBase const & subRegionFE, + arrayView1d< localIndex const > const & faceElementList, + bool const ) { - if (m_simultaneous) + if( m_simultaneous ) { solidMechanicsALMKernels::ALMSimultaneousFactory kernelFactory( dispDofNumber, bubbleDofNumber, @@ -363,21 +360,21 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time localRhs, dt, faceElementList ); - + real64 maxTraction = finiteElement:: interfaceBasedKernelApplication < parallelDevicePolicy< >, constitutive::CoulombFriction >( mesh, - fractureRegionName, - faceElementList, - subRegionFE, - viewKeyStruct::frictionLawNameString(), - kernelFactory ); + fractureRegionName, + faceElementList, + subRegionFE, + viewKeyStruct::frictionLawNameString(), + kernelFactory ); GEOS_UNUSED_VAR( maxTraction ); } - else + else { solidMechanicsALMKernels::ALMFactory kernelFactory( dispDofNumber, bubbleDofNumber, @@ -387,52 +384,52 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time dt, faceElementList, m_symmetric ); - + real64 maxTraction = finiteElement:: interfaceBasedKernelApplication < parallelDevicePolicy< >, constitutive::CoulombFriction >( mesh, - fractureRegionName, - faceElementList, - subRegionFE, - viewKeyStruct::frictionLawNameString(), - kernelFactory ); + fractureRegionName, + faceElementList, + subRegionFE, + viewKeyStruct::frictionLawNameString(), + kernelFactory ); GEOS_UNUSED_VAR( maxTraction ); } } ); - forFiniteElementOnSlipFractureSubRegions( meshName, [&] ( string const & , + forFiniteElementOnSlipFractureSubRegions( meshName, [&] ( string const &, finiteElement::FiniteElementBase const & subRegionFE, arrayView1d< localIndex const > const & faceElementList, bool const ) { - if (m_simultaneous) + if( m_simultaneous ) { solidMechanicsALMKernels::ALMSimultaneousFactory kernelFactory( dispDofNumber, - bubbleDofNumber, - dofManager.rankOffset(), - localMatrix, - localRhs, - dt, - faceElementList ); - + bubbleDofNumber, + dofManager.rankOffset(), + localMatrix, + localRhs, + dt, + faceElementList ); + real64 maxTraction = finiteElement:: interfaceBasedKernelApplication < parallelDevicePolicy< >, constitutive::CoulombFriction >( mesh, - fractureRegionName, - faceElementList, - subRegionFE, - viewKeyStruct::frictionLawNameString(), - kernelFactory ); + fractureRegionName, + faceElementList, + subRegionFE, + viewKeyStruct::frictionLawNameString(), + kernelFactory ); GEOS_UNUSED_VAR( maxTraction ); } - else + else { solidMechanicsALMKernels::ALMFactory kernelFactory( dispDofNumber, bubbleDofNumber, @@ -441,18 +438,18 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time localRhs, dt, faceElementList, - m_symmetric); - + m_symmetric ); + real64 maxTraction = finiteElement:: interfaceBasedKernelApplication < parallelDevicePolicy< >, constitutive::CoulombFriction >( mesh, - fractureRegionName, - faceElementList, - subRegionFE, - viewKeyStruct::frictionLawNameString(), - kernelFactory ); - + fractureRegionName, + faceElementList, + subRegionFE, + viewKeyStruct::frictionLawNameString(), + kernelFactory ); + GEOS_UNUSED_VAR( maxTraction ); } @@ -523,10 +520,10 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepComplete( real64 cons arrayView1d< integer const > const fractureState = subRegion.getField< contact::fractureState >(); arrayView1d< integer > const oldFractureState = subRegion.getField< contact::oldFractureState >(); - forAll< parallelDevicePolicy<> >( subRegion.size(), - [ deltaDispJump, + forAll< parallelDevicePolicy<> >( subRegion.size(), + [ deltaDispJump, oldDispJump, dispJump, - oldFractureState, fractureState ] + oldFractureState, fractureState ] GEOS_HOST_DEVICE ( localIndex const kfe ) { LvArray::tensorOps::fill< 3 >( deltaDispJump[kfe], 0.0 ); @@ -679,7 +676,7 @@ void SolidMechanicsAugmentedLagrangianContact::applySystemSolution( DofManager c CRSMatrix< real64, globalIndex > const voidMatrix; array1d< real64 > const voidRhs; - forFiniteElementOnFractureSubRegions( meshName, [&] ( string const & , + forFiniteElementOnFractureSubRegions( meshName, [&] ( string const &, finiteElement::FiniteElementBase const & subRegionFE, arrayView1d< localIndex const > const & faceElementList ) { @@ -739,9 +736,6 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit { GEOS_MARK_FUNCTION; - //int hasConfigurationConverged = true; - //int condConv_flag = true; - //int condConv = true; array1d< int > condConv; localIndex globalCondConv[5] = {0, 0, 0, 0, 0}; @@ -781,7 +775,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit traction_new.resize( 2, sizes ); arrayView2d< real64 > const traction_new_v = traction_new.toView(); - condConv.resize(subRegion.size()); + condConv.resize( subRegion.size()); arrayView1d< int > const condConv_v = condConv.toView(); // Update the traction field based on the displacement results from the nonlinear solve @@ -790,7 +784,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit using FrictionType = TYPEOFREF( castedFrictionLaw ); typename FrictionType::KernelWrapper frictionWrapper = castedFrictionLaw.createKernelUpdates(); - if (m_simultaneous) + if( m_simultaneous ) { solidMechanicsALMKernels::ComputeTractionSimultaneousKernel:: launch< parallelDevicePolicy<> >( subRegion.size(), @@ -811,55 +805,9 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit deltaDispJump, traction_new_v ); - /*forAll< parallelHostPolicy >( subRegion.size(), - [ traction_new_v, traction, - slidingTolerance, area, - dispJump, deltaDispJump, penalty, - fractureState, contactWrapper ] ( localIndex const kfe ) - { - real64 eps_N = penalty[kfe][0]; - real64 eps_T = penalty[kfe][1]; - traction_new_v[kfe][0] = traction[kfe][0] + eps_N * dispJump[kfe][0]; - traction_new_v[kfe][1] = traction[kfe][1] + eps_T * deltaDispJump[kfe][1]; - traction_new_v[kfe][2] = traction[kfe][2] + eps_T * deltaDispJump[kfe][2]; - - real64 const currentTau = std::sqrt( std::pow(traction_new_v[kfe][1], 2) + - std::pow(traction_new_v[kfe][2], 2)); - - real64 dLimitTangentialTractionNorm_dTraction = 0.0; - real64 const limitTau = - contactWrapper.computeLimitTangentialTractionNorm( traction_new_v[kfe][0], - dLimitTangentialTractionNorm_dTraction ); - - // Compute psi - real64 psi; - if (limitTau < 1.e-10) - { - psi = 1.0; - } - else - { - //psi = std::tanh(currentTau / limitTau); - psi = (currentTau > limitTau ) ? 1.0 : currentTau/limitTau; - } - - // Compute the new tangential traction - if (limitTau > 1.e-10 && currentTau > 1.e-10) - { - traction_new_v[kfe][1] *= limitTau * psi / currentTau; - traction_new_v[kfe][2] *= limitTau * psi / currentTau; - } - else - { - traction_new_v[kfe][1] *= 0.0; - traction_new_v[kfe][2] *= 0.0; - } - } ); - */ - } + } } ); - //bool printflag = true; real64 const slidingCheckTolerance = m_slidingCheckTolerance; constitutiveUpdatePassThru( frictionLaw, [&] ( auto & castedFrictionLaw ) @@ -868,33 +816,26 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit typename FrictionType::KernelWrapper frictionWrapper = castedFrictionLaw.createKernelUpdates(); solidMechanicsALMKernels::ConstraintCheckKernel:: - launch< parallelDevicePolicy<> >( subRegion.size(), - frictionWrapper, - ghostRank, - traction_new_v, - dispJump, - deltaDispJump, - normalTractionTolerance, - normalDisplacementTolerance, - slidingTolerance, - slidingCheckTolerance, - area, - fractureState, - condConv_v ); - //for (int i=0; i >( subRegion.size(), + frictionWrapper, + ghostRank, + traction_new_v, + dispJump, + deltaDispJump, + normalTractionTolerance, + normalDisplacementTolerance, + slidingTolerance, + slidingCheckTolerance, + area, + fractureState, + condConv_v ); RAJA::ReduceSum< parallelDeviceReduce, localIndex > localSum[5] = - { RAJA::ReduceSum< parallelDeviceReduce, localIndex >(0), - RAJA::ReduceSum< parallelDeviceReduce, localIndex >(0), - RAJA::ReduceSum< parallelDeviceReduce, localIndex >(0), - RAJA::ReduceSum< parallelDeviceReduce, localIndex >(0), - RAJA::ReduceSum< parallelDeviceReduce, localIndex >(0) }; + { RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), + RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), + RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), + RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), + RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ) }; forAll< parallelDevicePolicy<> >( subRegion.size(), [ localSum, ghostRank, condConv_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) { if( ghostRank[kfe] < 0 ) @@ -903,11 +844,11 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit } } ); - localIndex const localConvCond[5] = { static_cast< localIndex >( localSum[0].get()), - static_cast< localIndex >( localSum[1].get()), - static_cast< localIndex >( localSum[2].get()), - static_cast< localIndex >( localSum[3].get()), - static_cast< localIndex >( localSum[4].get()) }; + localIndex const localConvCond[5] = { static_cast< localIndex >( localSum[0].get()), + static_cast< localIndex >( localSum[1].get()), + static_cast< localIndex >( localSum[2].get()), + static_cast< localIndex >( localSum[3].get()), + static_cast< localIndex >( localSum[4].get()) }; int const rank = MpiWrapper::commRank( MPI_COMM_GEOS ); int const numRanks = MpiWrapper::commSize( MPI_COMM_GEOS ); @@ -921,12 +862,6 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit 0, MPI_COMM_GEOS ); - //if ( globalValues[1]!=0 || globalValues[2]!=0 || - // globalValues[3]!=0 || globalValues[4]!=0 ) - //{ - // condConv_flag = false; - //} - if( rank==0 ) { for( int r=0; r( subRegion.size(), - [ &condConv, ghostRank, traction_new_v, - normalTractionTolerance, normalDisplacementTolerance, - slidingTolerance, deltaDispJump, dispJump, area, - fractureState, contactWrapper, slidingCheckTolerance, this, &printflag ] ( localIndex const kfe ) - { - if( ghostRank[kfe] < 0 ) - { - // Case 1: if it is open - if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) - //if( traction_new_v[kfe][0] > 0.0 ) - { - if (fractureState[kfe] != contact::FractureState::Open) - { - if (printflag) - { - GEOS_LOG_LEVEL(2, - GEOS_FMT(" Element: {}, traction_n > tol4 => open, traction_n: {:4.2e} tol4: {:4.2e}\n", - kfe,traction_new_v[kfe][0], normalTractionTolerance[kfe] )); - printflag = false; - } - condConv = false; - } - traction_new_v[kfe][0] = 0.0; - traction_new_v[kfe][1] = 0.0; - traction_new_v[kfe][2] = 0.0; - } - else - { - // Case 2: compenetration - real64 deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + pow( deltaDispJump[kfe][2], 2 )); - if (( std::abs( dispJump[kfe][0]/area[kfe] ) > normalDisplacementTolerance[kfe] ) && (fractureState[kfe] != contact::FractureState::Open)) - { - if (printflag) - { - GEOS_LOG_LEVEL(2, - GEOS_FMT( " Element: {}, Stick mode and g_n > tol1 => compenetration, g_n: {:4.2e} tol1: {:4.2e}", - kfe,std::abs(dispJump[kfe][0])/area[kfe], normalDisplacementTolerance[kfe] )); - printflag = false; - } - condConv = false; - } - // Case 3: it is stick and dg is greater than 0 - if( fractureState[kfe] == contact::FractureState::Stick && - deltaDisp/area[kfe] > slidingTolerance[kfe] ) - { - if (printflag) - { - GEOS_LOG_LEVEL(2, - GEOS_FMT( " Element: {}, Stick and dg_t > tol2, dg_t: {:4.2e} tol2: {:4.2e}", - kfe, deltaDisp/area[kfe], slidingTolerance[kfe] )) - printflag = false; - } - condConv = false; - } - - // Case 4: the elastic tangential traction is greater than the limit - real64 currentTau = sqrt( pow(traction_new_v[kfe][1], 2 ) + - pow(traction_new_v[kfe][2], 2 ) ); - - real64 dLimitTangentialTractionNorm_dTraction = 0.0; - real64 const limitTau = - contactWrapper.computeLimitTangentialTractionNorm( traction_new_v[kfe][0], - dLimitTangentialTractionNorm_dTraction ); - - //if( fractureState[kfe] == contact::FractureState::Stick && currentTau >= limitTau ) - //{ - // currentTau *= (1.0 - slidingCheckTolerance); - //} - //else if( fractureState[kfe] != contact::FractureState::Stick && currentTau <= limitTau ) - //{ - // currentTau *= (1.0 + slidingCheckTolerance); - //} - - if( currentTau > (std::abs(limitTau) * (1.0 + slidingCheckTolerance)) ) - { - if (printflag) - { - GEOS_LOG_LEVEL(2, - GEOS_FMT( " Element: {}, tau > tau_lim, tau: {:4.2e} tauLim: {:4.2e}", - kfe, currentTau, limitTau )) - printflag = false; - } - condConv = false; - } - - } - } - } ); - */ } ); } ); } ); - /*localIndex totCondNotConv = 0; - for (int i=0; i<4; ++i) - { - totCondNotConv+=globalCondConv[i+1]; - std::cout << "gCond: " << globalCondConv[i+1] << std::endl; - } - std::cout << "totNotConv: " << totCondNotConv << std::endl; - - if ( globalCondConv[1]!=0 || globalCondConv[2]!=0 || - globalCondConv[3]!=0 || globalCondConv[4]!=0 ) - { - condConv_flag = false; - - } - */ - localIndex totCondNotConv = 0; - for (int i=0; i<4; ++i) + for( int i=0; i<4; ++i ) { totCondNotConv+=globalCondConv[i+1]; } @@ -1068,27 +890,13 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit if( getLogLevel() >= 1 && logger::internal::rank==0 ) { - std::cout << GEOS_FMT( " Number of element convergence condition:" - " conv: {:12} | open: {:12} | comp: {:12} | slip: {:12} | tau>: {:12}\n", - globalCondConv[0], globalCondConv[1], globalCondConv[2], - globalCondConv[3], globalCondConv[4] ); + std::cout << GEOS_FMT( " ALM convergence summary:" + " converged: {:6} | stick & gn>0: {:6} | compenetration: {:6} | stick & gt>lim: {:6} | tau>tauLim: {:6}\n", + globalCondConv[0], globalCondConv[1], globalCondConv[2], + globalCondConv[3], globalCondConv[4] ); } - - - //if( !condConv_flag ) - //{ - // hasConfigurationConverged = false; - //} - - // Compute if globally the fracture state has changed - //int hasConfigurationConvergedGlobally; - //MpiWrapper::allReduce( &hasConfigurationConverged, - // &hasConfigurationConvergedGlobally, - // 1, - // MPI_LAND, - // MPI_COMM_GEOSX ); - - if (hasConfigurationConvergedGlobally) + + if( hasConfigurationConvergedGlobally ) { forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, @@ -1096,19 +904,16 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit arrayView1d< string const > const & regionNames ) { ElementRegionManager & elemManager = mesh.getElemManager(); - + elemManager.forElementSubRegions< FaceElementSubRegion >( regionNames, [&]( localIndex const, FaceElementSubRegion & subRegion ) { - + arrayView2d< real64 > const traction_new_v = traction_new.toView(); arrayView2d< real64 > const traction = subRegion.getField< contact::traction >(); - + forAll< parallelDevicePolicy<> >( subRegion.size(), [ traction, traction_new_v ] ( localIndex const kfe ) { - //traction[kfe][0] = traction_new_v( kfe, 0 ); - //traction[kfe][1] = traction_new_v( kfe, 1 ); - //traction[kfe][2] = traction_new_v( kfe, 2 ); LvArray::tensorOps::copy< 3 >( traction[kfe], traction_new_v[kfe] ); } ); } ); @@ -1121,17 +926,17 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit arrayView1d< string const > const & regionNames ) { ElementRegionManager & elemManager = mesh.getElemManager(); - + elemManager.forElementSubRegions< FaceElementSubRegion >( regionNames, [&]( localIndex const, FaceElementSubRegion & subRegion ) { - + string const & frictionLawName = subRegion.template getReference< string >( viewKeyStruct::frictionLawNameString() ); FrictionBase const & frictionLaw = getConstitutiveModel< FrictionBase >( subRegion, frictionLawName ); - + arrayView2d< real64 > const traction_new_v = traction_new.toView(); arrayView2d< real64 > const traction = subRegion.getField< contact::traction >(); - + arrayView1d< real64 const > const normalTractionTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ); @@ -1139,7 +944,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalDisplacementToleranceString() ); arrayView1d< real64 const > const slidingTolerance = - subRegion.getReference< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ); + subRegion.getReference< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ); arrayView2d< real64 > const penalty = subRegion.getField< fields::contact::penalty >().toView(); @@ -1147,40 +952,20 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit arrayView2d< real64 > const dispJumpUpdPenalty = subRegion.getReference< array2d< real64 > >( viewKeyStruct::dispJumpUpdPenaltyString() ); - + arrayView1d< integer > const fractureState = subRegion.getField< contact::fractureState >(); - + arrayView2d< real64 const > const dispJump = subRegion.getField< contact::dispJump >(); arrayView2d< real64 const > const oldDispJump = subRegion.getField< contact::oldDispJump >(); arrayView2d< real64 const > const deltaDispJump = subRegion.getField< contact::deltaDispJump >(); -#define KERNEL_NEW YES -#ifndef KERNEL_NEW - forAll< parallelDevicePolicy<> >( subRegion.size(), - [ traction_new_v, traction, penalty, - dispJump, oldDispJump, deltaDispJump ] ( localIndex const kfe ) - { - real64 eps_N = penalty[kfe][0]; - real64 eps_T = penalty[kfe][1]; - traction_new_v[kfe][0] = traction[kfe][0] + eps_N * dispJump[kfe][0]; - traction_new_v[kfe][1] = traction[kfe][1] + eps_T * deltaDispJump[kfe][1]; - traction_new_v[kfe][2] = traction[kfe][2] + eps_T * deltaDispJump[kfe][2]; - //traction_new_v[kfe][1] = traction[kfe][1] + eps_T * (dispJump[kfe][1] - oldDispJump[kfe][1] ); - //traction_new_v[kfe][2] = traction[kfe][2] + eps_T * (dispJump[kfe][2] - oldDispJump[kfe][2] ) ; - } ); - real64 const slidingCheckTolerance = m_slidingCheckTolerance; -#endif - constitutiveUpdatePassThru( frictionLaw, [&] ( auto & castedFrictionLaw ) { using FrictionType = TYPEOFREF( castedFrictionLaw ); typename FrictionType::KernelWrapper frictionWrapper = castedFrictionLaw.createKernelUpdates(); - -#ifdef KERNEL_NEW - std::cout << "NEW KERNEL" << std::endl; solidMechanicsALMKernels::UpdateStateKernel:: launch< parallelDevicePolicy<> >( subRegion.size(), frictionWrapper, @@ -1190,185 +975,12 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit m_symmetric, normalTractionTolerance, traction, - fractureState); -#else - - forAll< parallelHostPolicy >( subRegion.size(), [ frictionWrapper, - normalTractionTolerance, slidingTolerance, - normalDisplacementTolerance, - slidingCheckTolerance, - dispJumpUpdPenalty, penalty, - fractureState, area, - dispJump, deltaDispJump, - traction, traction_new_v, this ] ( localIndex const kfe ) - { - - - // Case 1: if it is open - if( traction_new_v[kfe][0] >= normalTractionTolerance[kfe] ) - //if( traction_new_v[kfe][0] > 0.0 ) - { - fractureState[kfe] = contact::FractureState::Open; - traction[kfe][0] = 0.0; - traction[kfe][1] = 0.0; - traction[kfe][2] = 0.0; - } - else - { - // Case 2: If the normal stress is zero, - // then the tangential stress is also zero. - if (std::abs(traction_new_v[kfe][0]) < normalTractionTolerance[kfe]) - { - - //GEOS_LOG_LEVEL(2, - //GEOS_FMT( "WARNING: The normal stress of element {} is lower than the tolerance, t_n: {:4.2e} tol: {:4.2e}", - //kfe, traction_new_v[kfe][0], normalTractionTolerance[kfe] )) - fractureState[kfe] = contact::FractureState::Slip; - traction[kfe][0] = 0.0; - traction[kfe][1] = 0.0; - traction[kfe][2] = 0.0; - - // Update the penalty coefficient to accelerate the convergence - //penalty[kfe][0] *= 10.0; - - //real64 const eps_N_lim = 1.0e+4*normalTractionTolerance[kfe]/(normalDisplacementTolerance[kfe]*area[kfe]); - //if (penalty[kfe][0] > eps_N_lim ) - //{ - // GEOS_LOG_LEVEL(2, - // GEOS_FMT( " Element: {}, eps_N > eps_N_lim, eps: {:4.2e} epsLim: {:4.2e}", - // kfe, penalty[kfe][0], eps_N_lim )) - // //penalty[kfe][0] = eps_N_lim; - //} - } - else - { - traction[kfe][0] = traction_new_v( kfe, 0 ); - - // Update the penalty coefficient to accelerate the convergence - //if ((std::abs(dispJump[kfe][0])/area[kfe] > normalDisplacementTolerance[kfe] ) && - // (std::abs(dispJump[kfe][0]) > 0.25 * std::abs(dispJumpUpdPenalty[kfe][0]))) - //{ - // //penalty[kfe][0] *= 10.0; - // - // real64 const eps_N_lim = 1.0e+4*normalTractionTolerance[kfe]/(normalDisplacementTolerance[kfe]*area[kfe]); - // if (penalty[kfe][0] > eps_N_lim ) - // { - // GEOS_LOG_LEVEL(2, - // GEOS_FMT( " Element: {}, eps_N > eps_N_lim, eps: {:4.2e} epsLim: {:4.2e}", - // kfe, penalty[kfe][0], eps_N_lim )) - // //penalty[kfe][0] = eps_N_lim; - // } - //} - - real64 currentTau = sqrt( pow(traction_new_v[kfe][1], 2 ) + - pow(traction_new_v[kfe][2], 2 ) ); - - real64 dLimitTangentialTractionNorm_dTraction = 0.0; - real64 const limitTau = - frictionWrapper.computeLimitTangentialTractionNorm( traction[kfe][0], - dLimitTangentialTractionNorm_dTraction ); - - real64 psi = currentTau / limitTau; - - //if( originalFractureState == contact::FractureState::Stick && currentTau >= limitTau ) - //{ - // currentTau *= (1.0 - slidingCheckTolerance); - //} - //else if( originalFractureState != contact::FractureState::Stick && currentTau <= limitTau ) - //{ - // currentTau *= (1.0 + slidingCheckTolerance); - //} - - // Case 3: if it is slip - //if( currentTau >= (std::abs(limitTau) * (1.0 + slidingCheckTolerance)) ) - if( currentTau > limitTau ) - { - fractureState[kfe] = contact::FractureState::Slip; - - if (currentTau <= 1.e-10) - { - // It is needed for the first iteration (both t and u are equal to zero) - penalty[kfe][2] = penalty[kfe][1]; - penalty[kfe][3] = penalty[kfe][1]; - penalty[kfe][4] = 0.0; - } - else if (limitTau <= 1.e-10) - { - penalty[kfe][2] = 0.0; - penalty[kfe][3] = 0.0; - penalty[kfe][4] = 0.0; - } - else - { - // Two symmetric 2x2 matrices - real64 dNormTTdgT[ 3 ]; - dNormTTdgT[ 0 ] = traction_new_v[ kfe ][ 1 ] * traction_new_v[ kfe ][ 1 ]; - dNormTTdgT[ 1 ] = traction_new_v[ kfe ][ 2 ] * traction_new_v[ kfe ][ 2 ]; - dNormTTdgT[ 2 ] = traction_new_v[ kfe ][ 1 ] * traction_new_v[ kfe ][ 2 ]; - - real64 dTdgT[ 3 ]; - dTdgT[ 0 ] = (currentTau * currentTau - dNormTTdgT[0]); - dTdgT[ 1 ] = (currentTau * currentTau - dNormTTdgT[1]); - dTdgT[ 2 ] = - dNormTTdgT[2]; - - LvArray::tensorOps::scale< 3 >( dNormTTdgT, 1. / std::pow(currentTau, 2) ); - LvArray::tensorOps::scale< 3 >( dTdgT, 1. / std::pow( currentTau, 3 ) ); - - // Compute dTdDispJump - penalty[kfe][2] = penalty[kfe][1] * dTdgT[0] * limitTau; - penalty[kfe][3] = penalty[kfe][1] * dTdgT[1] * limitTau; - penalty[kfe][4] = penalty[kfe][1] * dTdgT[2] * limitTau; - //penalty[kfe][2] = 0.0; - //penalty[kfe][3] = 0.0; - //penalty[kfe][4] = 0.0; - } - - traction[kfe][1] = traction_new_v( kfe, 1 ) / psi; - traction[kfe][2] = traction_new_v( kfe, 2 ) / psi; - - } - // Case 4: if it is stick - else - { - fractureState[kfe] = contact::FractureState::Stick; - traction[kfe][1] = traction_new_v( kfe, 1 ); - traction[kfe][2] = traction_new_v( kfe, 2 ); - - penalty[kfe][2] = penalty[kfe][1]; - penalty[kfe][3] = penalty[kfe][1]; - penalty[kfe][4] = 0.0; - - // Update the penalty coefficient to accelerate the convergence - //real64 const deltaDispUpdPenalty = sqrt( pow( dispJumpUpdPenalty[kfe][1], 2 ) + - // pow( dispJumpUpdPenalty[kfe][2], 2 )); - //real64 const deltaDisp = sqrt( pow( deltaDispJump[kfe][1], 2 ) + - // pow( deltaDispJump[kfe][2], 2 )); - - //if (( deltaDisp/area[kfe] > slidingTolerance[kfe] ) && - // ( deltaDisp > 0.25 * deltaDispUpdPenalty)) - //{ - // //penalty[kfe][1] *= 10.0; - - // real64 const eps_T_lim = 1.0e+04 * normalTractionTolerance[kfe]/(slidingTolerance[kfe] * area[kfe] * 10 ); - // if (penalty[kfe][1] > eps_T_lim ) - // { - // GEOS_LOG_LEVEL(2, - // GEOS_FMT( " Element: {}, eps_T > eps_T_lim, eps: {:4.2e} epsLim: {:4.2e}", - // kfe, penalty[kfe][1], eps_T_lim )) - // penalty[kfe][1] = eps_T_lim; - // } - //} - } - - } - } - } ); -#endif + fractureState ); } ); - forAll< parallelDevicePolicy<> >( subRegion.size(), [ dispJumpUpdPenalty, - dispJump, deltaDispJump] - GEOS_HOST_DEVICE ( localIndex const kfe ) + forAll< parallelDevicePolicy<> >( subRegion.size(), [ dispJumpUpdPenalty, + dispJump, deltaDispJump] + GEOS_HOST_DEVICE ( localIndex const kfe ) { dispJumpUpdPenalty[kfe][0] = dispJump[kfe][0]; dispJumpUpdPenalty[kfe][1] = deltaDispJump[kfe][1]; @@ -1382,7 +994,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit synchronizeFractureState( domain ); // Update lists of stick and slip elements - if (!hasConfigurationConvergedGlobally) + if( !hasConfigurationConvergedGlobally ) { updateStickSlipList( domain ); } @@ -1407,7 +1019,7 @@ void SolidMechanicsAugmentedLagrangianContact::updateStickSlipList( DomainPartit arrayView1d< integer const > const fractureState = subRegion.getField< contact::fractureState >(); forFiniteElementOnFractureSubRegions( meshName, [&] ( string const & finiteElementName, - finiteElement::FiniteElementBase const & , + finiteElement::FiniteElementBase const &, arrayView1d< localIndex const > const & faceElementList ) { @@ -1420,10 +1032,10 @@ void SolidMechanicsAugmentedLagrangianContact::updateStickSlipList( DomainPartit arrayView1d< localIndex > const keys_v = keys.toView(); arrayView1d< localIndex > const vals_v = vals.toView(); - forAll< parallelDevicePolicy<> >( faceElementList.size(), + forAll< parallelDevicePolicy<> >( faceElementList.size(), [ nStick_r, nSlip_r, - fractureState, faceElementList, - keys_v, vals_v ] + fractureState, faceElementList, + keys_v, vals_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) { @@ -1434,14 +1046,14 @@ void SolidMechanicsAugmentedLagrangianContact::updateStickSlipList( DomainPartit vals_v[kfe]=faceIndex; nStick_r += 1; } - else if (( fractureState[faceIndex] == contact::FractureState::Slip ) || - (fractureState[faceIndex] == contact::FractureState::NewSlip)) + else if(( fractureState[faceIndex] == contact::FractureState::Slip ) || + (fractureState[faceIndex] == contact::FractureState::NewSlip)) { keys_v[kfe]=1; vals_v[kfe]=faceIndex; nSlip_r += 1; } - else + else { keys_v[kfe] = 2; } @@ -1462,13 +1074,13 @@ void SolidMechanicsAugmentedLagrangianContact::updateStickSlipList( DomainPartit arrayView1d< localIndex > const stickList_v = stickList.toView(); arrayView1d< localIndex > const slipList_v = slipList.toView(); - forAll< parallelDevicePolicy<> >( nStick, [stickList_v, vals_v] + forAll< parallelDevicePolicy<> >( nStick, [stickList_v, vals_v] GEOS_HOST_DEVICE ( localIndex const kfe ) { stickList_v[kfe] = vals_v[kfe]; } ); - - forAll< parallelDevicePolicy<> >( nSlip, [slipList_v, vals_v, nStick] + + forAll< parallelDevicePolicy<> >( nSlip, [slipList_v, vals_v, nStick] GEOS_HOST_DEVICE ( localIndex const kfe ) { slipList_v[kfe] = vals_v[nStick+kfe]; @@ -1477,8 +1089,8 @@ void SolidMechanicsAugmentedLagrangianContact::updateStickSlipList( DomainPartit this->m_faceTypesToFaceElementsStick[meshName][finiteElementName] = stickList; this->m_faceTypesToFaceElementsSlip[meshName][finiteElementName] = slipList; - GEOS_LOG_LEVEL(2, - GEOS_FMT( "# stick elements: {}, # slip elements: {}", nStick, nSlip )) + GEOS_LOG_LEVEL( 2, + GEOS_FMT( "# stick elements: {}, # slip elements: {}", nStick, nSlip )) } ); } ); @@ -1510,7 +1122,7 @@ void SolidMechanicsAugmentedLagrangianContact::createFaceTypeList( DomainPartiti arrayView1d< localIndex > const vals_v = vals.toView(); // Determine the size of the lists and generate the vector keys and vals for parallel indexing into lists. // (With RAJA, parallelizing this operation seems the most viable approach.) - forAll< parallelDevicePolicy<> >( subRegion.size(), + forAll< parallelDevicePolicy<> >( subRegion.size(), [ nTri_r, nQuad_r, faceToNodeMap, keys_v, vals_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) { @@ -2003,11 +1615,11 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio subRegion.getReference< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ); arrayView2d< real64 > const - penalty = subRegion.getField< fields::contact::penalty >().toView(); + penalty = subRegion.getField< fields::contact::penalty >().toView(); forAll< parallelHostPolicy >( subRegion.size(), [=] ( localIndex const kfe ) { - + real64 const area = faceArea[kfe]; // approximation of the stiffness along coordinate directions // ( first, second ) index -> ( element index, direction ) @@ -2088,18 +1700,14 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio // Finally, compute tolerances for the given fracture element normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+7; - slidingTolerance[kfe] = sqrt( pow(rotatedInvStiffApprox[ 1 ][ 1 ],2) + - pow(rotatedInvStiffApprox[ 2 ][ 2 ],2)) * averageYoungModulus / 2.e+5; - normalTractionTolerance[kfe] = (1.0 / 2.0) * (averageConstrainedModulus / averageBoxSize0) * + slidingTolerance[kfe] = sqrt( pow( rotatedInvStiffApprox[ 1 ][ 1 ], 2 ) + + pow( rotatedInvStiffApprox[ 2 ][ 2 ], 2 )) * averageYoungModulus / 2.e+5; + normalTractionTolerance[kfe] = (1.0 / 2.0) * (averageConstrainedModulus / averageBoxSize0) * (normalDisplacementTolerance[kfe]); penalty[kfe][0] = 1e+01*averageConstrainedModulus/(averageBoxSize0*area); penalty[kfe][1] = 1e-01*averageConstrainedModulus/(averageBoxSize0*area); - + } ); - //GEOS_LOG_LEVEL(2, - //GEOS_FMT(" Element: {} penalty0: {:4.2e} penalty1: {:4.2e} nDispTol: {:4.2e} sliTol: {:4.2e} nTraTol: {:4.2e} area: {:4.2e}\n", - //0, penalty[0][0], penalty[0][0], normalDisplacementTolerance[0], - //slidingTolerance[0], normalTractionTolerance[0], area[0] )); } } ); } ); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp index d76f356d2ea..c66a259defe 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp @@ -109,7 +109,7 @@ class SolidMechanicsAugmentedLagrangianContact : public ContactSolverBase { arrayView1d< localIndex const > const faceElemList = faceElementList.toViewConst(); - finiteElement::FiniteElementBase const & subRegionFE = *(m_faceTypeToFiniteElements.at(finiteElementName)); + finiteElement::FiniteElementBase const & subRegionFE = *(m_faceTypeToFiniteElements.at( finiteElementName )); lambda( finiteElementName, subRegionFE, faceElemList ); } @@ -129,14 +129,14 @@ class SolidMechanicsAugmentedLagrangianContact : public ContactSolverBase bool const isStickState = true; - std::map< string, array1d< localIndex > > const & - faceTypesToFaceElements = m_faceTypesToFaceElementsStick.at( meshName ); + std::map< string, array1d< localIndex > > const & + faceTypesToFaceElements = m_faceTypesToFaceElementsStick.at( meshName ); for( const auto & [finiteElementName, faceElementList] : faceTypesToFaceElements ) { arrayView1d< localIndex const > const faceElemList = faceElementList.toViewConst(); - finiteElement::FiniteElementBase const & subRegionFE = *(m_faceTypeToFiniteElements.at(finiteElementName)); + finiteElement::FiniteElementBase const & subRegionFE = *(m_faceTypeToFiniteElements.at( finiteElementName )); lambda( finiteElementName, subRegionFE, faceElemList, isStickState ); } @@ -156,14 +156,14 @@ class SolidMechanicsAugmentedLagrangianContact : public ContactSolverBase bool const isStickState = false; - std::map< string, array1d< localIndex > > const & - faceTypesToFaceElements = m_faceTypesToFaceElementsSlip.at( meshName ); + std::map< string, array1d< localIndex > > const & + faceTypesToFaceElements = m_faceTypesToFaceElementsSlip.at( meshName ); for( const auto & [finiteElementName, faceElementList] : faceTypesToFaceElements ) { arrayView1d< localIndex const > const faceElemList = faceElementList.toViewConst(); - finiteElement::FiniteElementBase const & subRegionFE = *(m_faceTypeToFiniteElements.at(finiteElementName)); + finiteElement::FiniteElementBase const & subRegionFE = *(m_faceTypeToFiniteElements.at( finiteElementName )); lambda( finiteElementName, subRegionFE, faceElemList, isStickState ); } @@ -244,7 +244,7 @@ class SolidMechanicsAugmentedLagrangianContact : public ContactSolverBase real64 const m_slidingCheckTolerance = 0.05; bool m_simultaneous = true; - + bool m_symmetric = true; }; From 2ce5b2e479ffc41d9bf8ac8aa24225d1250bfa15 Mon Sep 17 00:00:00 2001 From: mfrigo Date: Thu, 5 Sep 2024 09:41:08 -0700 Subject: [PATCH 15/41] Merged develop --- .../SolidMechanicsAugmentedLagrangianContact.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index 5f68c13ebf5..02a6f1e2755 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -573,7 +573,10 @@ real64 SolidMechanicsAugmentedLagrangianContact::calculateResidualNorm( real64 c arrayView1d< globalIndex const > const bubbleDofNumber = faceManager.getReference< globalIndex_array >( bubbleDofKey ); - forAll< parallelDevicePolicy<> >( subRegion.size(), [ elemsToFaces, localRhs, localSum, bubbleDofNumber, rankOffset, ghostRank] GEOS_HOST_DEVICE ( localIndex const kfe ) + forAll< parallelDevicePolicy<> >( subRegion.size(), + [ elemsToFaces, localRhs, localSum, + bubbleDofNumber, rankOffset, ghostRank] + GEOS_HOST_DEVICE ( localIndex const kfe ) { if( ghostRank[kfe] < 0 ) @@ -934,22 +937,13 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit string const & frictionLawName = subRegion.template getReference< string >( viewKeyStruct::frictionLawNameString() ); FrictionBase const & frictionLaw = getConstitutiveModel< FrictionBase >( subRegion, frictionLawName ); - arrayView2d< real64 > const traction_new_v = traction_new.toView(); arrayView2d< real64 > const traction = subRegion.getField< contact::traction >(); arrayView1d< real64 const > const normalTractionTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ); - arrayView1d< real64 const > const normalDisplacementTolerance = - subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalDisplacementToleranceString() ); - - arrayView1d< real64 const > const slidingTolerance = - subRegion.getReference< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ); - arrayView2d< real64 > const penalty = subRegion.getField< fields::contact::penalty >().toView(); - arrayView1d< real64 const > const area = subRegion.getElementArea().toViewConst(); - arrayView2d< real64 > const dispJumpUpdPenalty = subRegion.getReference< array2d< real64 > >( viewKeyStruct::dispJumpUpdPenaltyString() ); From a6fc4b98cbbcc5553bfbb07ac6776afcecb12492 Mon Sep 17 00:00:00 2001 From: mfrigo Date: Thu, 5 Sep 2024 10:04:27 -0700 Subject: [PATCH 16/41] Added inputFiles for ALM --- .../ALM_slipFault_base.xml | 112 ----------- .../ALM_stickFault_base.xml | 115 ------------ inputFiles/almContactMechanics/alm.ats | 19 -- .../ALM_PassingCrack_smoke.xml | 55 ++++++ .../ALM_SimpleCubes_smoke.xml | 54 ++++++ .../ALM_SingleFracCompression_benchmark.xml | 77 ++++++++ .../ALM_SingleFracCompression_smoke.xml | 77 ++++++++ .../ALM_Sneddon_benchmark.xml | 67 +++++++ .../ALM_Sneddon_smoke.xml | 67 +++++++ .../ALM_TFrac_benchmark.xml | 78 ++++++++ .../ALM_TFrac_smoke.xml | 78 ++++++++ .../ALM_UnstructuredCrack_benchmark.xml | 58 ++++++ .../ALM_UnstructuredCrack_smoke.xml | 58 ++++++ .../ALM_slippingFault_horizontal_smoke.xml | 55 ++++++ .../ALM_slippingFault_vertical_smoke.xml | 55 ++++++ .../ContactMechanics_PassingCrack_smoke.xml | 95 ++++------ .../ContactMechanics_SimpleCubes_smoke.xml | 84 +++------ ...hanics_SingleFracCompression_benchmark.xml | 106 ++++------- ...tMechanics_SingleFracCompression_smoke.xml | 100 ++++------ ...=> ContactMechanics_Sneddon_benchmark.xml} | 30 +-- ...xml => ContactMechanics_Sneddon_smoke.xml} | 57 +++--- .../ContactMechanics_TFrac_benchmark.xml | 69 +++---- .../ContactMechanics_TFrac_smoke.xml | 33 +--- ...tMechanics_UnstructuredCrack_benchmark.xml | 97 +++------- ...ntactMechanics_UnstructuredCrack_smoke.xml | 97 +++------- .../ContactMechanics_slippingFault_base.xml | 111 ----------- ...chanics_slippingFault_horizontal_smoke.xml | 174 ++++++------------ ...Mechanics_slippingFault_vertical_smoke.xml | 147 ++++++--------- ...ngCrack_base.xml => PassingCrack_base.xml} | 27 +-- .../PassingCrack_smoke.xml | 58 ++++++ ...pleCubes_base.xml => SimpleCubes_base.xml} | 31 +--- .../SimpleCubes_smoke.xml | 54 ++++++ ...ase.xml => SingleFracCompression_base.xml} | 26 --- .../SingleFracCompression_benchmark.xml | 75 ++++++++ .../SingleFracCompression_smoke.xml | 75 ++++++++ .../SlippingFault_base.xml | 59 ++++++ .../SlippingFault_horizontal_smoke.xml} | 86 +++++---- .../SlippingFault_vertical_smoke.xml} | 53 +++--- ...actMechanics_base.xml => Sneddon_base.xml} | 7 +- .../Sneddon_benchmark.xml | 34 ++++ .../Sneddon_smoke.xml | 35 ++++ ...echanics_TFrac_base.xml => TFrac_base.xml} | 6 +- .../TFrac_benchmark.xml | 36 ++++ .../TFrac_smoke.xml | 42 +++++ ...ck_base.xml => UnstructuredCrack_base.xml} | 30 +-- .../UnstructuredCrack_benchmark.xml | 74 ++++++++ .../UnstructuredCrack_smoke.xml | 74 ++++++++ .../contactMechanics.ats | 41 ++++- 48 files changed, 1896 insertions(+), 1252 deletions(-) delete mode 100644 inputFiles/almContactMechanics/ALM_slipFault_base.xml delete mode 100644 inputFiles/almContactMechanics/ALM_stickFault_base.xml delete mode 100644 inputFiles/almContactMechanics/alm.ats create mode 100644 inputFiles/lagrangianContactMechanics/ALM_PassingCrack_smoke.xml create mode 100644 inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml create mode 100644 inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_benchmark.xml create mode 100644 inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_smoke.xml create mode 100644 inputFiles/lagrangianContactMechanics/ALM_Sneddon_benchmark.xml create mode 100644 inputFiles/lagrangianContactMechanics/ALM_Sneddon_smoke.xml create mode 100644 inputFiles/lagrangianContactMechanics/ALM_TFrac_benchmark.xml create mode 100644 inputFiles/lagrangianContactMechanics/ALM_TFrac_smoke.xml create mode 100644 inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_benchmark.xml create mode 100644 inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_smoke.xml create mode 100644 inputFiles/lagrangianContactMechanics/ALM_slippingFault_horizontal_smoke.xml create mode 100644 inputFiles/lagrangianContactMechanics/ALM_slippingFault_vertical_smoke.xml rename inputFiles/lagrangianContactMechanics/{Sneddon_contactMechanics_smoke.xml => ContactMechanics_Sneddon_benchmark.xml} (75%) mode change 100755 => 100644 rename inputFiles/lagrangianContactMechanics/{Sneddon_contactMechanics_benchmark.xml => ContactMechanics_Sneddon_smoke.xml} (58%) mode change 100755 => 100644 delete mode 100644 inputFiles/lagrangianContactMechanics/ContactMechanics_slippingFault_base.xml rename inputFiles/lagrangianContactMechanics/{ContactMechanics_PassingCrack_base.xml => PassingCrack_base.xml} (78%) create mode 100644 inputFiles/lagrangianContactMechanics/PassingCrack_smoke.xml rename inputFiles/lagrangianContactMechanics/{ContactMechanics_SimpleCubes_base.xml => SimpleCubes_base.xml} (80%) create mode 100644 inputFiles/lagrangianContactMechanics/SimpleCubes_smoke.xml rename inputFiles/lagrangianContactMechanics/{ContactMechanics_SingleFracCompression_base.xml => SingleFracCompression_base.xml} (81%) mode change 100755 => 100644 create mode 100644 inputFiles/lagrangianContactMechanics/SingleFracCompression_benchmark.xml create mode 100644 inputFiles/lagrangianContactMechanics/SingleFracCompression_smoke.xml create mode 100644 inputFiles/lagrangianContactMechanics/SlippingFault_base.xml rename inputFiles/{almContactMechanics/ALM_stickFault_vertical_smoke.xml => lagrangianContactMechanics/SlippingFault_horizontal_smoke.xml} (53%) rename inputFiles/{almContactMechanics/ALM_slipFault_vertical_smoke.xml => lagrangianContactMechanics/SlippingFault_vertical_smoke.xml} (75%) rename inputFiles/lagrangianContactMechanics/{Sneddon_contactMechanics_base.xml => Sneddon_base.xml} (96%) mode change 100755 => 100644 create mode 100644 inputFiles/lagrangianContactMechanics/Sneddon_benchmark.xml create mode 100644 inputFiles/lagrangianContactMechanics/Sneddon_smoke.xml rename inputFiles/lagrangianContactMechanics/{ContactMechanics_TFrac_base.xml => TFrac_base.xml} (97%) create mode 100644 inputFiles/lagrangianContactMechanics/TFrac_benchmark.xml create mode 100644 inputFiles/lagrangianContactMechanics/TFrac_smoke.xml rename inputFiles/lagrangianContactMechanics/{ContactMechanics_UnstructuredCrack_base.xml => UnstructuredCrack_base.xml} (79%) create mode 100644 inputFiles/lagrangianContactMechanics/UnstructuredCrack_benchmark.xml create mode 100644 inputFiles/lagrangianContactMechanics/UnstructuredCrack_smoke.xml diff --git a/inputFiles/almContactMechanics/ALM_slipFault_base.xml b/inputFiles/almContactMechanics/ALM_slipFault_base.xml deleted file mode 100644 index 9a72a4919fa..00000000000 --- a/inputFiles/almContactMechanics/ALM_slipFault_base.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/inputFiles/almContactMechanics/ALM_stickFault_base.xml b/inputFiles/almContactMechanics/ALM_stickFault_base.xml deleted file mode 100644 index 7a8c79aa7d8..00000000000 --- a/inputFiles/almContactMechanics/ALM_stickFault_base.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/inputFiles/almContactMechanics/alm.ats b/inputFiles/almContactMechanics/alm.ats deleted file mode 100644 index dc6417df533..00000000000 --- a/inputFiles/almContactMechanics/alm.ats +++ /dev/null @@ -1,19 +0,0 @@ -import os -from geos.ats.test_builder import TestDeck, RestartcheckParameters, generate_geos_tests - -restartcheck_params = {} -restartcheck_params["atol"] = 2.0E-4 -restartcheck_params["rtol"] = 1.0E-7 - -decks = [ - TestDeck( - name="ALM_stickFault_vertical_smoke", - description= - "Cube with a vertical fracture (structured grid)", - partitions=((1, 1, 1), (2, 2, 2)), - restart_step=1, - check_step=2, - restartcheck_params=RestartcheckParameters(**restartcheck_params)), -] - -generate_geos_tests(decks) diff --git a/inputFiles/lagrangianContactMechanics/ALM_PassingCrack_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_PassingCrack_smoke.xml new file mode 100644 index 00000000000..505c666da63 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/ALM_PassingCrack_smoke.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml new file mode 100644 index 00000000000..7b65d538238 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_benchmark.xml b/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_benchmark.xml new file mode 100644 index 00000000000..3dae566dbaf --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_benchmark.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_smoke.xml new file mode 100644 index 00000000000..67956c6d3b7 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_smoke.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ALM_Sneddon_benchmark.xml b/inputFiles/lagrangianContactMechanics/ALM_Sneddon_benchmark.xml new file mode 100644 index 00000000000..515940af232 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/ALM_Sneddon_benchmark.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ALM_Sneddon_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_Sneddon_smoke.xml new file mode 100644 index 00000000000..a8285f0d4e7 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/ALM_Sneddon_smoke.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ALM_TFrac_benchmark.xml b/inputFiles/lagrangianContactMechanics/ALM_TFrac_benchmark.xml new file mode 100644 index 00000000000..1f0c102f9f8 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/ALM_TFrac_benchmark.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ALM_TFrac_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_TFrac_smoke.xml new file mode 100644 index 00000000000..1c968176294 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/ALM_TFrac_smoke.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_benchmark.xml b/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_benchmark.xml new file mode 100644 index 00000000000..a49423d604a --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_benchmark.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_smoke.xml new file mode 100644 index 00000000000..00046625eb7 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_smoke.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ALM_slippingFault_horizontal_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_slippingFault_horizontal_smoke.xml new file mode 100644 index 00000000000..0d26fe657e6 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/ALM_slippingFault_horizontal_smoke.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ALM_slippingFault_vertical_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_slippingFault_vertical_smoke.xml new file mode 100644 index 00000000000..02701b7639c --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/ALM_slippingFault_vertical_smoke.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_PassingCrack_smoke.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_PassingCrack_smoke.xml index 4ba2c33f6d8..cccc821fc54 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_PassingCrack_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_PassingCrack_smoke.xml @@ -3,57 +3,35 @@ + name="./PassingCrack_smoke.xml"/> - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + @@ -61,26 +39,23 @@ name="preFracture" target="/Solvers/SurfaceGen"/> - - - + target="/Outputs/vtkOutput"/> + + diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_smoke.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_smoke.xml index 74ef1533500..cd29c971b9d 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_smoke.xml @@ -3,61 +3,40 @@ + name="./SimpleCubes_smoke.xml"/> - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - @@ -74,14 +53,11 @@ targetExactTimestep="0" target="/Outputs/restartOutput"/> - + target="/Outputs/vtkOutput"/> diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_benchmark.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_benchmark.xml index 3dd01d27524..4bd3864871f 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_benchmark.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_benchmark.xml @@ -3,74 +3,41 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -81,7 +48,6 @@ @@ -90,6 +56,12 @@ timeFrequency="1" targetExactTimestep="0" target="/Outputs/vtkOutput"/> + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/Sneddon_contactMechanics_smoke.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_Sneddon_benchmark.xml old mode 100755 new mode 100644 similarity index 75% rename from inputFiles/lagrangianContactMechanics/Sneddon_contactMechanics_smoke.xml rename to inputFiles/lagrangianContactMechanics/ContactMechanics_Sneddon_benchmark.xml index e7962f070c1..cefdf59664b --- a/inputFiles/lagrangianContactMechanics/Sneddon_contactMechanics_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_Sneddon_benchmark.xml @@ -3,7 +3,7 @@ + name="./Sneddon_benchmark.xml"/> - - - - - - - + + + + + + name="./Sneddon_smoke.xml"/> - + - - - + - - - - - + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_benchmark.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_benchmark.xml index 83e9561f2c4..028262a170d 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_benchmark.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_benchmark.xml @@ -2,7 +2,7 @@ - + + targetRegions="{ Region, Fracture }"> + newtonTol="1.0e-8" + logLevel="2" + maxNumConfigurationAttempts="10" + newtonMaxIter="10" + lineSearchAction="Require" + lineSearchMaxCuts="2" + maxTimeStepCuts="2"/> + solverType="direct" + directParallel="0" + logLevel="0"/> - - - - - - - - - + + + + + + + maxTime="0.2"> @@ -63,7 +46,7 @@ @@ -93,6 +76,12 @@ name="displacementHistoryOutput" timeFrequency="0.2" targetExactTimestep="0" - target="/Outputs/displacementOutput"/> + target="/Outputs/displacementOutput"/> + + diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_smoke.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_smoke.xml index b788e0ac183..d3a1a91319c 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_smoke.xml @@ -2,7 +2,7 @@ - + - - - - - - - - - + + + + + + - + name="./UnstructuredCrack_benchmark.xml"/> - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - + target="/Outputs/vtkOutput"/> + diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_smoke.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_smoke.xml index 71b7da13653..20cf7288baa 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_smoke.xml @@ -1,75 +1,38 @@ - + name="./UnstructuredCrack_smoke.xml"/> - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - @@ -90,14 +53,12 @@ targetExactTimestep="0" target="/Outputs/restartOutput"/> - + target="/Outputs/vtkOutput"/> + diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_slippingFault_base.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_slippingFault_base.xml deleted file mode 100644 index 0c5350192c1..00000000000 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_slippingFault_base.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_slippingFault_horizontal_smoke.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_slippingFault_horizontal_smoke.xml index 6b59abebbbf..7584144aec3 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_slippingFault_horizontal_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_slippingFault_horizontal_smoke.xml @@ -3,132 +3,64 @@ - + - - - - - - - - - - - - - - - - - + + + + + + - + + + + + - + + - + - + - - - - - - - - - - - - - + + + diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_slippingFault_vertical_smoke.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_slippingFault_vertical_smoke.xml index b520f3498c6..9a6ca75ddba 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_slippingFault_vertical_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_slippingFault_vertical_smoke.xml @@ -3,107 +3,64 @@ - + - - - + + + + + + - - + + + + + - - - + + - - + - + - + + - - - - - - - - - - - - - - diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_PassingCrack_base.xml b/inputFiles/lagrangianContactMechanics/PassingCrack_base.xml similarity index 78% rename from inputFiles/lagrangianContactMechanics/ContactMechanics_PassingCrack_base.xml rename to inputFiles/lagrangianContactMechanics/PassingCrack_base.xml index c309080025d..14ccc3cd8f8 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_PassingCrack_base.xml +++ b/inputFiles/lagrangianContactMechanics/PassingCrack_base.xml @@ -3,22 +3,6 @@ - - - - - - - - @@ -124,9 +103,9 @@ - + diff --git a/inputFiles/lagrangianContactMechanics/PassingCrack_smoke.xml b/inputFiles/lagrangianContactMechanics/PassingCrack_smoke.xml new file mode 100644 index 00000000000..5af8f7534a5 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/PassingCrack_smoke.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_base.xml b/inputFiles/lagrangianContactMechanics/SimpleCubes_base.xml similarity index 80% rename from inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_base.xml rename to inputFiles/lagrangianContactMechanics/SimpleCubes_base.xml index 690ecf823a3..47bf36cc58b 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_base.xml +++ b/inputFiles/lagrangianContactMechanics/SimpleCubes_base.xml @@ -3,25 +3,6 @@ - - - - - - - - - @@ -158,9 +134,10 @@ - + diff --git a/inputFiles/lagrangianContactMechanics/SimpleCubes_smoke.xml b/inputFiles/lagrangianContactMechanics/SimpleCubes_smoke.xml new file mode 100644 index 00000000000..157f01ceda1 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/SimpleCubes_smoke.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_base.xml b/inputFiles/lagrangianContactMechanics/SingleFracCompression_base.xml old mode 100755 new mode 100644 similarity index 81% rename from inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_base.xml rename to inputFiles/lagrangianContactMechanics/SingleFracCompression_base.xml index 28b80df0368..2da12a025df --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_base.xml +++ b/inputFiles/lagrangianContactMechanics/SingleFracCompression_base.xml @@ -4,27 +4,6 @@ - - - - - - - - - diff --git a/inputFiles/lagrangianContactMechanics/SingleFracCompression_benchmark.xml b/inputFiles/lagrangianContactMechanics/SingleFracCompression_benchmark.xml new file mode 100644 index 00000000000..346528e4bea --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/SingleFracCompression_benchmark.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/SingleFracCompression_smoke.xml b/inputFiles/lagrangianContactMechanics/SingleFracCompression_smoke.xml new file mode 100644 index 00000000000..a724d175616 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/SingleFracCompression_smoke.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/SlippingFault_base.xml b/inputFiles/lagrangianContactMechanics/SlippingFault_base.xml new file mode 100644 index 00000000000..5299794fe0f --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/SlippingFault_base.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/almContactMechanics/ALM_stickFault_vertical_smoke.xml b/inputFiles/lagrangianContactMechanics/SlippingFault_horizontal_smoke.xml similarity index 53% rename from inputFiles/almContactMechanics/ALM_stickFault_vertical_smoke.xml rename to inputFiles/lagrangianContactMechanics/SlippingFault_horizontal_smoke.xml index 4eb31ff467b..2d81f9a0593 100644 --- a/inputFiles/almContactMechanics/ALM_stickFault_vertical_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/SlippingFault_horizontal_smoke.xml @@ -3,38 +3,38 @@ - + - + + dimensions="{ 180, 10 }"/> + dimensions="{ 180, 10 }"/> @@ -61,7 +61,7 @@ fieldName="totalDisplacement" component="0" scale="0.0" - setNames="{ xneg, xpos }"/> + setNames="{ yneg }"/> + setNames="{ yneg, ypos, xneg, xpos }"/> + setNames="{ zneg, zpos }"/> - + + + + + + - + + plotFileRoot="faultSlip_horizontal"/> - + name="restartOutput"/> + diff --git a/inputFiles/almContactMechanics/ALM_slipFault_vertical_smoke.xml b/inputFiles/lagrangianContactMechanics/SlippingFault_vertical_smoke.xml similarity index 75% rename from inputFiles/almContactMechanics/ALM_slipFault_vertical_smoke.xml rename to inputFiles/lagrangianContactMechanics/SlippingFault_vertical_smoke.xml index 1e11f4bd806..8c70450485d 100644 --- a/inputFiles/almContactMechanics/ALM_slipFault_vertical_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/SlippingFault_vertical_smoke.xml @@ -3,19 +3,19 @@ - + @@ -26,7 +26,7 @@ origin="{0.0, 0.0, 0.0}" lengthVector="{0.0, 1.0, 0.0}" widthVector="{0.0, 0.0, 1.0}" - dimensions="{ 500, 200 }"/> + dimensions="{ 180, 10 }"/> + dimensions="{ 180, 10 }"/> @@ -56,20 +56,20 @@ scale="1"/> + setNames="{ xneg }"/> + setNames="{ yneg, ypos, xneg, xpos }"/> + setNames="{ zneg, zpos }"/> - + scale="-4.25e6"/> - @@ -105,6 +104,6 @@ plotFileRoot="faultSlip_vertical"/> - + name="restartOutput"/> + diff --git a/inputFiles/lagrangianContactMechanics/Sneddon_contactMechanics_base.xml b/inputFiles/lagrangianContactMechanics/Sneddon_base.xml old mode 100755 new mode 100644 similarity index 96% rename from inputFiles/lagrangianContactMechanics/Sneddon_contactMechanics_base.xml rename to inputFiles/lagrangianContactMechanics/Sneddon_base.xml index 64b949a396e..b4d2d0a3a22 --- a/inputFiles/lagrangianContactMechanics/Sneddon_contactMechanics_base.xml +++ b/inputFiles/lagrangianContactMechanics/Sneddon_base.xml @@ -27,11 +27,6 @@ name="FE1" order="1"/> - - - - @@ -114,7 +109,7 @@ setNames="{ core }"/> - + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/Sneddon_smoke.xml b/inputFiles/lagrangianContactMechanics/Sneddon_smoke.xml new file mode 100644 index 00000000000..5e64b204ad1 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/Sneddon_smoke.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_base.xml b/inputFiles/lagrangianContactMechanics/TFrac_base.xml similarity index 97% rename from inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_base.xml rename to inputFiles/lagrangianContactMechanics/TFrac_base.xml index d8d82afdd12..9c3a4f54cdd 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_base.xml +++ b/inputFiles/lagrangianContactMechanics/TFrac_base.xml @@ -43,11 +43,6 @@ name="FE1" order="1"/> - - - - @@ -159,6 +154,7 @@ inputVarNames="{ time }" coordinates="{ 0.0, 1.0 }" values="{ 0.0, 1.e0 }"/> + diff --git a/inputFiles/lagrangianContactMechanics/TFrac_benchmark.xml b/inputFiles/lagrangianContactMechanics/TFrac_benchmark.xml new file mode 100644 index 00000000000..60f1a1f537a --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/TFrac_benchmark.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/TFrac_smoke.xml b/inputFiles/lagrangianContactMechanics/TFrac_smoke.xml new file mode 100644 index 00000000000..5ab56b69af9 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/TFrac_smoke.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_base.xml b/inputFiles/lagrangianContactMechanics/UnstructuredCrack_base.xml similarity index 79% rename from inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_base.xml rename to inputFiles/lagrangianContactMechanics/UnstructuredCrack_base.xml index 4c4c2bb1379..557166a2c23 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_base.xml +++ b/inputFiles/lagrangianContactMechanics/UnstructuredCrack_base.xml @@ -3,23 +3,6 @@ - - - - - - - - - @@ -136,13 +114,13 @@ name="ForceTimeFunction" inputVarNames="{ time }" coordinates="{ 0.0, 2.0 }" - values="{ 0.0, 2.e0 }"/> + values="{ 0.0, 2.e0 }"/> - + diff --git a/inputFiles/lagrangianContactMechanics/UnstructuredCrack_benchmark.xml b/inputFiles/lagrangianContactMechanics/UnstructuredCrack_benchmark.xml new file mode 100644 index 00000000000..bb32766c947 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/UnstructuredCrack_benchmark.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/UnstructuredCrack_smoke.xml b/inputFiles/lagrangianContactMechanics/UnstructuredCrack_smoke.xml new file mode 100644 index 00000000000..faf2455cbf1 --- /dev/null +++ b/inputFiles/lagrangianContactMechanics/UnstructuredCrack_smoke.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/lagrangianContactMechanics/contactMechanics.ats b/inputFiles/lagrangianContactMechanics/contactMechanics.ats index b522d942a63..27e4fab80b9 100644 --- a/inputFiles/lagrangianContactMechanics/contactMechanics.ats +++ b/inputFiles/lagrangianContactMechanics/contactMechanics.ats @@ -21,7 +21,7 @@ decks = [ check_step=2, restartcheck_params=RestartcheckParameters(**restartcheck_params)), TestDeck( - name="Sneddon_contactMechanics_smoke", + name="ContactMechanics_Sneddon_smoke", description= "Testing Sneddon problem using contact mechanics (structured grid)", partitions=((1, 1, 1), ), @@ -52,6 +52,45 @@ decks = [ restart_step=5, check_step=10, restartcheck_params=RestartcheckParameters(**restartcheck_params)) + TestDeck( + name="ALM_SimpleCubes_smoke", + description= + "Two cubes with a fracture separating them (structured grid)", + partitions=((1, 1, 1), (2, 2, 2), (1, 3, 3)), + restart_step=10, + check_step=20, + restartcheck_params=RestartcheckParameters(**restartcheck_params)), + TestDeck( + name="ALM_UnstructuredCrack_smoke", + description="A thick plane with a crack in it (unstructured grid)", + partitions=((1, 1, 1), ), + restart_step=1, + check_step=2, + restartcheck_params=RestartcheckParameters(**restartcheck_params)), + TestDeck( + name="ALM_Sneddon_smoke", + description= + "Testing Sneddon problem using contact mechanics (structured grid)", + partitions=((1, 1, 1), ), + restart_step=1, + check_step=2, + restartcheck_params=RestartcheckParameters(**restartcheck_params)), + TestDeck( + name="ALM_TFrac_smoke", + description= + "Two fractures intersecting at a right angle (structured grid)", + partitions=((1, 1, 1), (2, 2, 1)), + restart_step=1, + check_step=2, + restartcheck_params=RestartcheckParameters(**restartcheck_params)), + TestDeck( + name="ALM_SingleFracCompression_smoke", + description= + "Single tilted fracture subjected to remote compression (unstructured grid)", + partitions=((1, 1, 1), ), + restart_step=1, + check_step=2, + restartcheck_params=RestartcheckParameters(**restartcheck_params)), ] generate_geos_tests(decks) From 9cf7431f9f8632e70e6373387e49b6dbf978ee1f Mon Sep 17 00:00:00 2001 From: mfrigo Date: Thu, 5 Sep 2024 13:27:18 -0700 Subject: [PATCH 17/41] Fixed compilation errors --- .../constitutive/contact/CoulombFriction.hpp | 17 +++++++++-------- .../constitutive/contact/FrictionBase.hpp | 11 +++++++++-- .../contact/SolidMechanicsALMKernelsBase.hpp | 11 +++++------ 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/coreComponents/constitutive/contact/CoulombFriction.hpp b/src/coreComponents/constitutive/contact/CoulombFriction.hpp index c1566a3b7bd..5f65da2152f 100644 --- a/src/coreComponents/constitutive/contact/CoulombFriction.hpp +++ b/src/coreComponents/constitutive/contact/CoulombFriction.hpp @@ -119,7 +119,10 @@ class CoulombFrictionUpdates : public FrictionBaseUpdates arraySlice1d< real64 const > const & deltaDispJump, arraySlice1d< real64 > const & tractionVector, integer const fractureState, - std::map< std::string const, real64 const > const & tolerance, + real64 const normalTractionTolerance, + real64 const normalDisplacementTolerance, + real64 const slidingTolerance, + real64 const slidingCheckTolerance, integer & condConv ) const override final; private: @@ -477,7 +480,7 @@ inline void CoulombFrictionUpdates::updateTractionOnly( arraySlice1d< real64 con { // TODO: Pass this tol as an argument or define a new class member - constexpr real64 zero = std::numeric_limits< real64 >::epsilon(); + real64 const zero = std::numeric_limits< real64 >::epsilon(); tractionNew[0] = traction[0] + penalty[0] * dispJump[0]; tractionNew[1] = traction[1] + penalty[1] * deltaDispJump[1]; @@ -521,17 +524,15 @@ inline void CoulombFrictionUpdates::constraintCheck( arraySlice1d< real64 const arraySlice1d< real64 const > const & deltaDispJump, arraySlice1d< real64 > const & tractionVector, integer const fractureState, - std::map< std::string const, real64 const > const & tolerance, + real64 const normalTractionTolerance, + real64 const normalDisplacementTolerance, + real64 const slidingTolerance, + real64 const slidingCheckTolerance, integer & condConv ) const { using namespace fields::contact; - real64 const normalTractionTolerance = tolerance.at( "normalTraction" ); - real64 const normalDisplacementTolerance = tolerance.at( "normalDisplacement" ); - real64 const slidingTolerance = tolerance.at( "sliding" ); - real64 const slidingCheckTolerance = tolerance.at( "slidingCheck" ); - // Compute the slip real64 const deltaDisp[2] = { deltaDispJump[1], deltaDispJump[2] }; diff --git a/src/coreComponents/constitutive/contact/FrictionBase.hpp b/src/coreComponents/constitutive/contact/FrictionBase.hpp index 1f80a55a88e..e05923f2998 100644 --- a/src/coreComponents/constitutive/contact/FrictionBase.hpp +++ b/src/coreComponents/constitutive/contact/FrictionBase.hpp @@ -154,9 +154,16 @@ class FrictionBaseUpdates arraySlice1d< real64 const > const & deltaDispJump, arraySlice1d< real64 > const & tractionVector, integer const fractureState, - std::map< std::string const, real64 const > const & tolerance, + real64 const normalTractionTolerance, + real64 const normalDisplacementTolerance, + real64 const slidingTolerance, + real64 const slidingCheckTolerance, integer & condConv ) const - { GEOS_UNUSED_VAR( dispJump, deltaDispJump, tractionVector, fractureState, tolerance, condConv ); } + { + GEOS_UNUSED_VAR( dispJump, deltaDispJump, tractionVector, fractureState, + normalTractionTolerance, normalDisplacementTolerance, slidingTolerance, + slidingCheckTolerance, condConv ); + } /** * @brief Evaluate the limit tangential traction norm and return the derivative wrt normal traction diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp index 880d93bb7be..d3c134d09de 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp @@ -355,15 +355,14 @@ struct ConstraintCheckKernel { if( ghostRank[k] < 0 ) { - std::map< std::string const, real64 const > const tolerance = {{"normalTraction", normalTractionTolerance[k]}, - {"normalDisplacement", normalDisplacementTolerance[k]*area[k] }, - {"sliding", slidingTolerance[k]*area[k] }, - {"slidingCheck", slidingCheckTolerance }}; contactWrapper.constraintCheck( dispJump[k], deltaDispJump[k], traction[k], fractureState[k], - tolerance, + normalTractionTolerance[k], + normalDisplacementTolerance[k]*area[k], + slidingTolerance[k]*area[k], + slidingCheckTolerance, condConv[k] ); } @@ -406,7 +405,7 @@ struct UpdateStateKernel forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) { - constexpr real64 zero = 1.e-10; + real64 const zero = std::numeric_limits< real64 >::epsilon(); real64 localPenalty[3][3] = {}; real64 localTractionNew[3] = {}; From f990243cc32665f58d22a293d704e60727f92c1e Mon Sep 17 00:00:00 2001 From: mfrigo Date: Thu, 5 Sep 2024 17:50:28 -0700 Subject: [PATCH 18/41] Fixed compilation errors --- ...lidMechanicsAugmentedLagrangianContact.cpp | 89 +++++++++---------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index 02a6f1e2755..f67f585a8c9 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -807,7 +807,6 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit dispJump, deltaDispJump, traction_new_v ); - } } ); @@ -832,54 +831,54 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit area, fractureState, condConv_v ); - - RAJA::ReduceSum< parallelDeviceReduce, localIndex > localSum[5] = - { RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), - RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), - RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), - RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), - RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ) }; - forAll< parallelDevicePolicy<> >( subRegion.size(), [ localSum, ghostRank, condConv_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) + } ); + + RAJA::ReduceSum< parallelDeviceReduce, localIndex > localSum[5] = + { RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), + RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), + RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), + RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), + RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ) }; + forAll< parallelDevicePolicy<> >( subRegion.size(), [ localSum, ghostRank, condConv_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) + { + if( ghostRank[kfe] < 0 ) { - if( ghostRank[kfe] < 0 ) - { - localSum[condConv_v[kfe]] += 1; - } - } ); - - localIndex const localConvCond[5] = { static_cast< localIndex >( localSum[0].get()), - static_cast< localIndex >( localSum[1].get()), - static_cast< localIndex >( localSum[2].get()), - static_cast< localIndex >( localSum[3].get()), - static_cast< localIndex >( localSum[4].get()) }; - - int const rank = MpiWrapper::commRank( MPI_COMM_GEOS ); - int const numRanks = MpiWrapper::commSize( MPI_COMM_GEOS ); - array1d< localIndex > globalValues( numRanks * 5 ); - - // Everything is done on rank 0 - MpiWrapper::gather( localConvCond, - 5, - globalValues.data(), - 5, - 0, - MPI_COMM_GEOS ); - - if( rank==0 ) + localSum[condConv_v[kfe]] += 1; + } + } ); + + localIndex const localConvCond[5] = { static_cast< localIndex >( localSum[0].get()), + static_cast< localIndex >( localSum[1].get()), + static_cast< localIndex >( localSum[2].get()), + static_cast< localIndex >( localSum[3].get()), + static_cast< localIndex >( localSum[4].get()) }; + + int const rank = MpiWrapper::commRank( MPI_COMM_GEOS ); + int const numRanks = MpiWrapper::commSize( MPI_COMM_GEOS ); + array1d< localIndex > globalValues( numRanks * 5 ); + + // Everything is done on rank 0 + MpiWrapper::gather( localConvCond, + 5, + globalValues.data(), + 5, + 0, + MPI_COMM_GEOS ); + + if( rank==0 ) + { + for( int r=0; r const traction_new_v = traction_new.toView(); arrayView2d< real64 > const traction = subRegion.getField< contact::traction >(); - - forAll< parallelDevicePolicy<> >( subRegion.size(), [ traction, traction_new_v ] ( localIndex const kfe ) + + forAll< parallelDevicePolicy<> >( subRegion.size(), [ traction, traction_new_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) { LvArray::tensorOps::copy< 3 >( traction[kfe], traction_new_v[kfe] ); } ); From 23ea6b39244297750933fa655441e5d20a0f6725 Mon Sep 17 00:00:00 2001 From: mfrigo Date: Thu, 5 Sep 2024 17:56:10 -0700 Subject: [PATCH 19/41] uncrustify_style --- .../SolidMechanicsAugmentedLagrangianContact.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index f67f585a8c9..b8aae453007 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -832,7 +832,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit fractureState, condConv_v ); } ); - + RAJA::ReduceSum< parallelDeviceReduce, localIndex > localSum[5] = { RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), @@ -846,17 +846,17 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit localSum[condConv_v[kfe]] += 1; } } ); - + localIndex const localConvCond[5] = { static_cast< localIndex >( localSum[0].get()), static_cast< localIndex >( localSum[1].get()), static_cast< localIndex >( localSum[2].get()), static_cast< localIndex >( localSum[3].get()), static_cast< localIndex >( localSum[4].get()) }; - + int const rank = MpiWrapper::commRank( MPI_COMM_GEOS ); int const numRanks = MpiWrapper::commSize( MPI_COMM_GEOS ); array1d< localIndex > globalValues( numRanks * 5 ); - + // Everything is done on rank 0 MpiWrapper::gather( localConvCond, 5, @@ -864,7 +864,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit 5, 0, MPI_COMM_GEOS ); - + if( rank==0 ) { for( int r=0; r const traction_new_v = traction_new.toView(); arrayView2d< real64 > const traction = subRegion.getField< contact::traction >(); - + forAll< parallelDevicePolicy<> >( subRegion.size(), [ traction, traction_new_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) { LvArray::tensorOps::copy< 3 >( traction[kfe], traction_new_v[kfe] ); From b9def29c89a2d2a3ee2bf2e385046c747a4bff7c Mon Sep 17 00:00:00 2001 From: Matteo Frigo Date: Thu, 5 Sep 2024 21:21:52 -0700 Subject: [PATCH 20/41] Fixed contactMechanics.ats --- inputFiles/lagrangianContactMechanics/contactMechanics.ats | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inputFiles/lagrangianContactMechanics/contactMechanics.ats b/inputFiles/lagrangianContactMechanics/contactMechanics.ats index 27e4fab80b9..bc4a2e43d0e 100644 --- a/inputFiles/lagrangianContactMechanics/contactMechanics.ats +++ b/inputFiles/lagrangianContactMechanics/contactMechanics.ats @@ -51,7 +51,7 @@ decks = [ partitions=((1, 1, 1), (2, 1, 1)), restart_step=5, check_step=10, - restartcheck_params=RestartcheckParameters(**restartcheck_params)) + restartcheck_params=RestartcheckParameters(**restartcheck_params)), TestDeck( name="ALM_SimpleCubes_smoke", description= @@ -90,7 +90,7 @@ decks = [ partitions=((1, 1, 1), ), restart_step=1, check_step=2, - restartcheck_params=RestartcheckParameters(**restartcheck_params)), + restartcheck_params=RestartcheckParameters(**restartcheck_params)) ] generate_geos_tests(decks) From 2454a4ff330be8185a982e01233fb19d2ad998cf Mon Sep 17 00:00:00 2001 From: Matteo Frigo <43966286+matteofrigo5@users.noreply.github.com> Date: Thu, 5 Sep 2024 22:08:14 -0700 Subject: [PATCH 21/41] Update src/coreComponents/constitutive/contact/CoulombFriction.hpp Co-authored-by: Matteo Cusini <49037133+CusiniM@users.noreply.github.com> --- src/coreComponents/constitutive/contact/CoulombFriction.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/constitutive/contact/CoulombFriction.hpp b/src/coreComponents/constitutive/contact/CoulombFriction.hpp index 5f65da2152f..c896a5f62f4 100644 --- a/src/coreComponents/constitutive/contact/CoulombFriction.hpp +++ b/src/coreComponents/constitutive/contact/CoulombFriction.hpp @@ -563,7 +563,7 @@ inline void CoulombFrictionUpdates::constraintCheck( arraySlice1d< real64 const else { // Case 2: compenetration - if(( std::abs( dispJump[0] ) > normalDisplacementTolerance ) && + if(( LvArray::math::abs( dispJump[0] ) > normalDisplacementTolerance ) && (fractureState != FractureState::Open)) { condConv = 2; From 1ad12cb8ef3a6a9dcfeba83ff586103e89cbdb80 Mon Sep 17 00:00:00 2001 From: Matteo Frigo <43966286+matteofrigo5@users.noreply.github.com> Date: Thu, 5 Sep 2024 22:08:58 -0700 Subject: [PATCH 22/41] Update src/coreComponents/constitutive/contact/CoulombFriction.hpp Co-authored-by: Matteo Cusini <49037133+CusiniM@users.noreply.github.com> --- src/coreComponents/constitutive/contact/CoulombFriction.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/constitutive/contact/CoulombFriction.hpp b/src/coreComponents/constitutive/contact/CoulombFriction.hpp index c896a5f62f4..addbe1105e5 100644 --- a/src/coreComponents/constitutive/contact/CoulombFriction.hpp +++ b/src/coreComponents/constitutive/contact/CoulombFriction.hpp @@ -576,7 +576,7 @@ inline void CoulombFrictionUpdates::constraintCheck( arraySlice1d< real64 const } // Case 4: the elastic tangential traction is greater than the limit - if( currentTau > (std::abs( limitTau ) * (1.0 + slidingCheckTolerance)) ) + if( currentTau > (LvArray::math::abs( limitTau ) * (1.0 + slidingCheckTolerance)) ) { condConv = 4; } From 0ad9cb6be4f5a9157d610d6ff09cef2c8b93c168 Mon Sep 17 00:00:00 2001 From: Matteo Frigo <43966286+matteofrigo5@users.noreply.github.com> Date: Thu, 5 Sep 2024 22:32:50 -0700 Subject: [PATCH 23/41] Update src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp Co-authored-by: Matteo Cusini <49037133+CusiniM@users.noreply.github.com> --- .../contact/SolidMechanicsAugmentedLagrangianContact.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index b8aae453007..e1dd6dab74c 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -272,7 +272,7 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & { // Set the penalty coefficients forAll< parallelDevicePolicy<> >( subRegion.size(), - [ penalty, fractureState, dispJumpUpdPenalty ] + [=] GEOS_HOST_DEVICE ( localIndex const k ) { if( fractureState[k] == contact::FractureState::Stick ) From e521e3fc98c02b3218c329a3a3bff9a3a182fadc Mon Sep 17 00:00:00 2001 From: Matteo Frigo <43966286+matteofrigo5@users.noreply.github.com> Date: Fri, 6 Sep 2024 10:06:54 -0700 Subject: [PATCH 24/41] Update src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp Co-authored-by: Matteo Cusini <49037133+CusiniM@users.noreply.github.com> --- .../contact/SolidMechanicsAugmentedLagrangianContact.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index e1dd6dab74c..3588863b5fc 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -291,7 +291,7 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & } forAll< parallelDevicePolicy<> >( subRegion.size(), - [ dispJumpUpdPenalty, elemsToFaces, incrBubbleDisp ] + [ = ] GEOS_HOST_DEVICE ( localIndex const k ) { LvArray::tensorOps::fill< 3 >( dispJumpUpdPenalty[k], 0.0 ); From 2e9b5cbe5b6dc63125629c44839a69718210f416 Mon Sep 17 00:00:00 2001 From: Matteo Frigo <43966286+matteofrigo5@users.noreply.github.com> Date: Fri, 6 Sep 2024 10:07:15 -0700 Subject: [PATCH 25/41] Update src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp Co-authored-by: Matteo Cusini <49037133+CusiniM@users.noreply.github.com> --- .../contact/SolidMechanicsAugmentedLagrangianContact.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index 3588863b5fc..f4c5ab8a094 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -574,8 +574,7 @@ real64 SolidMechanicsAugmentedLagrangianContact::calculateResidualNorm( real64 c arrayView1d< globalIndex const > const bubbleDofNumber = faceManager.getReference< globalIndex_array >( bubbleDofKey ); forAll< parallelDevicePolicy<> >( subRegion.size(), - [ elemsToFaces, localRhs, localSum, - bubbleDofNumber, rankOffset, ghostRank] + [ = ] GEOS_HOST_DEVICE ( localIndex const kfe ) { From f92159d0ebee2fb60226d2328956ac15b5c51c59 Mon Sep 17 00:00:00 2001 From: mfrigo Date: Fri, 6 Sep 2024 14:51:22 -0700 Subject: [PATCH 26/41] Fixed reviewer's comments --- .../ALM_PassingCrack_smoke.xml | 8 +-- .../ALM_SimpleCubes_smoke.xml | 8 +-- .../ALM_SingleFracCompression_benchmark.xml | 8 +-- .../ALM_SingleFracCompression_smoke.xml | 8 +-- .../ALM_Sneddon_benchmark.xml | 8 +-- .../ALM_Sneddon_smoke.xml | 8 +-- .../ALM_TFrac_benchmark.xml | 8 +-- .../ALM_TFrac_smoke.xml | 8 +-- .../ALM_UnstructuredCrack_benchmark.xml | 8 +-- .../ALM_UnstructuredCrack_smoke.xml | 8 +-- .../ALM_slippingFault_horizontal_smoke.xml | 8 +-- .../ALM_slippingFault_vertical_smoke.xml | 8 +-- .../SolidMechanicsALMBubbleKernels.hpp | 26 +--------- .../contact/SolidMechanicsALMKernels.hpp | 1 - .../SolidMechanicsALMSimultaneousKernels.hpp | 1 - ...lidMechanicsAugmentedLagrangianContact.cpp | 49 ++++++++----------- 16 files changed, 70 insertions(+), 103 deletions(-) diff --git a/inputFiles/lagrangianContactMechanics/ALM_PassingCrack_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_PassingCrack_smoke.xml index 505c666da63..2025d1e4e19 100644 --- a/inputFiles/lagrangianContactMechanics/ALM_PassingCrack_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ALM_PassingCrack_smoke.xml @@ -17,10 +17,10 @@ + maxNumConfigurationAttempts="50" + newtonMaxIter="20" + lineSearchAction="None" + lineSearchMaxCuts="4"/> diff --git a/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml index 7b65d538238..8ec77da7d9a 100644 --- a/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml @@ -17,10 +17,10 @@ + maxNumConfigurationAttempts="50" + newtonMaxIter="20" + lineSearchAction="None" + lineSearchMaxCuts="4"/> diff --git a/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_benchmark.xml b/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_benchmark.xml index 3dae566dbaf..2202aa2f739 100644 --- a/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_benchmark.xml +++ b/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_benchmark.xml @@ -17,10 +17,10 @@ + maxNumConfigurationAttempts="50" + newtonMaxIter="20" + lineSearchAction="None" + lineSearchMaxCuts="4"/> diff --git a/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_smoke.xml index 67956c6d3b7..8b09acbea67 100644 --- a/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ALM_SingleFracCompression_smoke.xml @@ -17,10 +17,10 @@ + maxNumConfigurationAttempts="50" + newtonMaxIter="20" + lineSearchAction="None" + lineSearchMaxCuts="4"/> diff --git a/inputFiles/lagrangianContactMechanics/ALM_Sneddon_benchmark.xml b/inputFiles/lagrangianContactMechanics/ALM_Sneddon_benchmark.xml index 515940af232..ba0462cbe05 100644 --- a/inputFiles/lagrangianContactMechanics/ALM_Sneddon_benchmark.xml +++ b/inputFiles/lagrangianContactMechanics/ALM_Sneddon_benchmark.xml @@ -17,10 +17,10 @@ + maxNumConfigurationAttempts="50" + newtonMaxIter="20" + lineSearchAction="None" + lineSearchMaxCuts="4"/> diff --git a/inputFiles/lagrangianContactMechanics/ALM_Sneddon_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_Sneddon_smoke.xml index a8285f0d4e7..41c125ef0e5 100644 --- a/inputFiles/lagrangianContactMechanics/ALM_Sneddon_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ALM_Sneddon_smoke.xml @@ -17,10 +17,10 @@ + maxNumConfigurationAttempts="50" + newtonMaxIter="20" + lineSearchAction="None" + lineSearchMaxCuts="4"/> diff --git a/inputFiles/lagrangianContactMechanics/ALM_TFrac_benchmark.xml b/inputFiles/lagrangianContactMechanics/ALM_TFrac_benchmark.xml index 1f0c102f9f8..92db6ad31b4 100644 --- a/inputFiles/lagrangianContactMechanics/ALM_TFrac_benchmark.xml +++ b/inputFiles/lagrangianContactMechanics/ALM_TFrac_benchmark.xml @@ -17,10 +17,10 @@ newtonTol="1.0e-8" logLevel="2" newtonMaxIter="10" - maxNumConfigurationAttempts="20" - lineSearchAction="Require" - lineSearchMaxCuts="2" - maxTimeStepCuts="2"/> + maxNumConfigurationAttempts="50" + newtonMaxIter="20" + lineSearchAction="None" + lineSearchMaxCuts="4"/> + maxNumConfigurationAttempts="50" + newtonMaxIter="20" + lineSearchAction="None" + lineSearchMaxCuts="4"/> + maxNumConfigurationAttempts="50" + newtonMaxIter="20" + lineSearchAction="None" + lineSearchMaxCuts="4"/> + maxNumConfigurationAttempts="50" + newtonMaxIter="20" + lineSearchAction="None" + lineSearchMaxCuts="4"/> + maxNumConfigurationAttempts="50" + newtonMaxIter="20" + lineSearchAction="None" + lineSearchMaxCuts="4"/> diff --git a/inputFiles/lagrangianContactMechanics/ALM_slippingFault_vertical_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_slippingFault_vertical_smoke.xml index 02701b7639c..7beefc7386d 100644 --- a/inputFiles/lagrangianContactMechanics/ALM_slippingFault_vertical_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ALM_slippingFault_vertical_smoke.xml @@ -17,10 +17,10 @@ + maxNumConfigurationAttempts="50" + newtonMaxIter="20" + lineSearchAction="None" + lineSearchMaxCuts="4"/> diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp index 3e624db831d..b7702d53fdd 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp @@ -285,30 +285,7 @@ class ALMBubbleKernels : real64 strainBubbleMatrix[6][nBubbleUdof]; solidMechanicsALMKernelsHelper::assembleStrainOperator< 6, nBubbleUdof, numFacesPerElem >( strainBubbleMatrix, dBubbleNdX ); - // TODO: Use the following functions - //using namespace PDEUtilities; - //constexpr FunctionSpace displacementTrialSpace = FE_TYPE::template getFunctionSpace< numDofPerTrialSupportPoint >(); - //constexpr FunctionSpace displacementTestSpace = displacementTrialSpace; - //real64 Abb_bilinear[nBubbleUdof][nBubbleUdof]; - //BilinearFormUtilities::compute< displacementTrialSpace, - // displacementTestSpace, - // DifferentialOperator::SymmetricGradient, - // DifferentialOperator::SymmetricGradient > - //( - // Abb_bilinear, - // dBubbleNdX, - // stack.constitutiveStiffness, // fourth-order tensor handled via DiscretizationOps - // dBubbleNdX, - // -detJ ); - - - //LinearFormUtilities::compute< displacementTestSpace, - // DifferentialOperator::Identity > - //( - //stack.localResidualMomentum, - //N, - //stack.bodyForce, - //detJxW ); + // TODO: It would be nice use BilinearFormUtilities::compute real64 matBD[nBubbleUdof][6]; real64 Abb_gauss[nBubbleUdof][nBubbleUdof], Abu_gauss[nBubbleUdof][nUdof], Aub_gauss[nUdof][nBubbleUdof]; @@ -331,6 +308,7 @@ class ALMBubbleKernels : LvArray::tensorOps::scaledAdd< nUdof, nBubbleUdof >( stack.localAub, Aub_gauss, -detJ ); // Compute the initial stress + // The following block assumes a linear elastic constitutive model real64 rb_gauss[nBubbleUdof]; real64 strain[6] = {0}; LvArray::tensorOps::Ri_eq_AijBj< 6, nUdof >( strain, strainMatrix, stack.uLocal ); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp index 389d88a4de4..8241dd60165 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp @@ -232,7 +232,6 @@ class ALM : stack.dispJumpLocal[i] = m_dispJump( k, i ); stack.oldDispJumpLocal[i] = m_oldDispJump( k, i ); } - stack.oldDispJumpLocal[0] = 0.0; for( int i=0; i<3; ++i ) { diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp index 12c35c0a3f6..f9cd307b6fe 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMSimultaneousKernels.hpp @@ -236,7 +236,6 @@ class ALMSimultaneous : stack.dispJumpLocal[i] = m_dispJump( k, i ); stack.oldDispJumpLocal[i] = m_oldDispJump( k, i ); } - stack.oldDispJumpLocal[0] = 0.0; for( int i=0; i<3; ++i ) { diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index f4c5ab8a094..5ff8c4eef35 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -521,9 +521,7 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepComplete( real64 cons arrayView1d< integer > const oldFractureState = subRegion.getField< contact::oldFractureState >(); forAll< parallelDevicePolicy<> >( subRegion.size(), - [ deltaDispJump, - oldDispJump, dispJump, - oldFractureState, fractureState ] + [ = ] GEOS_HOST_DEVICE ( localIndex const kfe ) { LvArray::tensorOps::fill< 3 >( deltaDispJump[kfe], 0.0 ); @@ -838,7 +836,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ), RAJA::ReduceSum< parallelDeviceReduce, localIndex >( 0 ) }; - forAll< parallelDevicePolicy<> >( subRegion.size(), [ localSum, ghostRank, condConv_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) + forAll< parallelDevicePolicy<> >( subRegion.size(), [ = ] GEOS_HOST_DEVICE ( localIndex const kfe ) { if( ghostRank[kfe] < 0 ) { @@ -889,13 +887,10 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit int hasConfigurationConvergedGlobally = (totCondNotConv == 0) ? true : false; - if( getLogLevel() >= 1 && logger::internal::rank==0 ) - { - std::cout << GEOS_FMT( " ALM convergence summary:" - " converged: {:6} | stick & gn>0: {:6} | compenetration: {:6} | stick & gt>lim: {:6} | tau>tauLim: {:6}\n", - globalCondConv[0], globalCondConv[1], globalCondConv[2], - globalCondConv[3], globalCondConv[4] ); - } + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( " ALM convergence summary:" + " converged: {:6} | stick & gn>0: {:6} | compenetration: {:6} | stick & gt>lim: {:6} | tau>tauLim: {:6}\n", + globalCondConv[0], globalCondConv[1], globalCondConv[2], + globalCondConv[3], globalCondConv[4] )); if( hasConfigurationConvergedGlobally ) { @@ -913,7 +908,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit arrayView2d< real64 > const traction_new_v = traction_new.toView(); arrayView2d< real64 > const traction = subRegion.getField< contact::traction >(); - forAll< parallelDevicePolicy<> >( subRegion.size(), [ traction, traction_new_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) + forAll< parallelDevicePolicy<> >( subRegion.size(), [ = ] GEOS_HOST_DEVICE ( localIndex const kfe ) { LvArray::tensorOps::copy< 3 >( traction[kfe], traction_new_v[kfe] ); } ); @@ -970,8 +965,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit fractureState ); } ); - forAll< parallelDevicePolicy<> >( subRegion.size(), [ dispJumpUpdPenalty, - dispJump, deltaDispJump] + forAll< parallelDevicePolicy<> >( subRegion.size(), [ = ] GEOS_HOST_DEVICE ( localIndex const kfe ) { dispJumpUpdPenalty[kfe][0] = dispJump[kfe][0]; @@ -1025,9 +1019,7 @@ void SolidMechanicsAugmentedLagrangianContact::updateStickSlipList( DomainPartit arrayView1d< localIndex > const keys_v = keys.toView(); arrayView1d< localIndex > const vals_v = vals.toView(); forAll< parallelDevicePolicy<> >( faceElementList.size(), - [ nStick_r, nSlip_r, - fractureState, faceElementList, - keys_v, vals_v ] + [ = ] GEOS_HOST_DEVICE ( localIndex const kfe ) { @@ -1066,13 +1058,13 @@ void SolidMechanicsAugmentedLagrangianContact::updateStickSlipList( DomainPartit arrayView1d< localIndex > const stickList_v = stickList.toView(); arrayView1d< localIndex > const slipList_v = slipList.toView(); - forAll< parallelDevicePolicy<> >( nStick, [stickList_v, vals_v] + forAll< parallelDevicePolicy<> >( nStick, [ = ] GEOS_HOST_DEVICE ( localIndex const kfe ) { stickList_v[kfe] = vals_v[kfe]; } ); - forAll< parallelDevicePolicy<> >( nSlip, [slipList_v, vals_v, nStick] + forAll< parallelDevicePolicy<> >( nSlip, [ = ] GEOS_HOST_DEVICE ( localIndex const kfe ) { slipList_v[kfe] = vals_v[nStick+kfe]; @@ -1115,8 +1107,7 @@ void SolidMechanicsAugmentedLagrangianContact::createFaceTypeList( DomainPartiti // Determine the size of the lists and generate the vector keys and vals for parallel indexing into lists. // (With RAJA, parallelizing this operation seems the most viable approach.) forAll< parallelDevicePolicy<> >( subRegion.size(), - [ nTri_r, nQuad_r, faceToNodeMap, - keys_v, vals_v ] GEOS_HOST_DEVICE ( localIndex const kfe ) + [ = ] GEOS_HOST_DEVICE ( localIndex const kfe ) { localIndex const numNodesPerFace = faceToNodeMap.sizeOfArray( kfe ); @@ -1152,12 +1143,12 @@ void SolidMechanicsAugmentedLagrangianContact::createFaceTypeList( DomainPartiti arrayView1d< localIndex > const quadList_v = quadList.toView(); arrayView1d< localIndex > const triList_v = triList.toView(); - forAll< parallelDevicePolicy<> >( nTri, [triList_v, vals_v] GEOS_HOST_DEVICE ( localIndex const kfe ) + forAll< parallelDevicePolicy<> >( nTri, [ = ] GEOS_HOST_DEVICE ( localIndex const kfe ) { triList_v[kfe] = vals_v[kfe]; } ); - forAll< parallelDevicePolicy<> >( nQuad, [quadList_v, vals_v, nTri] GEOS_HOST_DEVICE ( localIndex const kfe ) + forAll< parallelDevicePolicy<> >( nQuad, [ = ] GEOS_HOST_DEVICE ( localIndex const kfe ) { quadList_v[kfe] = vals_v[nTri+kfe]; } ); @@ -1188,7 +1179,7 @@ void SolidMechanicsAugmentedLagrangianContact::createBubbleCellList( DomainParti { ArrayOfArraysView< localIndex const > const elemsToFaces = subRegion.faceList().toViewConst(); - forAll< parallelDevicePolicy<> >( subRegion.size(), [ tmpSpace_v, elemsToFaces ] GEOS_HOST_DEVICE ( localIndex const kfe ) + forAll< parallelDevicePolicy<> >( subRegion.size(), [ = ] GEOS_HOST_DEVICE ( localIndex const kfe ) { localIndex const kf0 = elemsToFaces[kfe][0], kf1 = elemsToFaces[kfe][1]; @@ -1223,7 +1214,7 @@ void SolidMechanicsAugmentedLagrangianContact::createBubbleCellList( DomainParti SortedArrayView< localIndex const > const faceIdList_v = faceIdList.toViewConst(); forAll< parallelDevicePolicy<> >( cellElementSubRegion.size(), - [ keys_v, vals_v, perms_v, localFaceIds_v, nBubElems_r, elemsToFaces, faceIdList_v ] + [ = ] GEOS_HOST_DEVICE ( localIndex const kfe ) { for( int i=0; i < elemsToFaces.size( 1 ); ++i ) @@ -1257,18 +1248,18 @@ void SolidMechanicsAugmentedLagrangianContact::createBubbleCellList( DomainParti arrayView1d< localIndex > const bubbleElemsList_v = bubbleElemsList.toView(); - forAll< parallelDevicePolicy<> >( n_max, [ keys_v, vals_v, perms_v ] GEOS_HOST_DEVICE ( localIndex const k ) + forAll< parallelDevicePolicy<> >( n_max, [ = ] GEOS_HOST_DEVICE ( localIndex const k ) { keys_v[k] = vals_v[perms_v[k]]; } ); - forAll< parallelDevicePolicy<> >( nBubElems, [ bubbleElemsList_v, keys_v ] GEOS_HOST_DEVICE ( localIndex const k ) + forAll< parallelDevicePolicy<> >( nBubElems, [ = ] GEOS_HOST_DEVICE ( localIndex const k ) { bubbleElemsList_v[k] = keys_v[k]; } ); cellElementSubRegion.setBubbleElementsList( bubbleElemsList.toViewConst()); - forAll< parallelDevicePolicy<> >( n_max, [ keys_v, localFaceIds_v, perms_v ] GEOS_HOST_DEVICE ( localIndex const k ) + forAll< parallelDevicePolicy<> >( n_max, [ = ] GEOS_HOST_DEVICE ( localIndex const k ) { keys_v[k] = localFaceIds_v[perms_v[k]]; } ); @@ -1279,7 +1270,7 @@ void SolidMechanicsAugmentedLagrangianContact::createBubbleCellList( DomainParti arrayView2d< localIndex > const faceElemsList_v = faceElemsList.toView(); forAll< parallelDevicePolicy<> >( nBubElems, - [ faceElemsList_v, keys_v, elemsToFaces, bubbleElemsList_v ] + [ = ] GEOS_HOST_DEVICE ( localIndex const k ) { localIndex const kfe = bubbleElemsList_v[k]; From 4e64aa67c3534d17ab878165476513d300008b8a Mon Sep 17 00:00:00 2001 From: mfrigo Date: Fri, 6 Sep 2024 15:14:25 -0700 Subject: [PATCH 27/41] Fixed reviewer's comments (2) --- .../contact/SolidMechanicsALMBubbleKernels.hpp | 2 +- .../physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp index b7702d53fdd..4b76b7a4a3d 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMBubbleKernels.hpp @@ -309,7 +309,7 @@ class ALMBubbleKernels : // Compute the initial stress // The following block assumes a linear elastic constitutive model - real64 rb_gauss[nBubbleUdof]; + real64 rb_gauss[nBubbleUdof]{}; real64 strain[6] = {0}; LvArray::tensorOps::Ri_eq_AijBj< 6, nUdof >( strain, strainMatrix, stack.uLocal ); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp index d3c134d09de..7010adbcbfb 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp @@ -407,8 +407,8 @@ struct UpdateStateKernel real64 const zero = std::numeric_limits< real64 >::epsilon(); - real64 localPenalty[3][3] = {}; - real64 localTractionNew[3] = {}; + real64 localPenalty[3][3]{}; + real64 localTractionNew[3]{}; contactWrapper.updateTraction( oldDispJump[k], dispJump[k], penalty[k], @@ -426,7 +426,7 @@ struct UpdateStateKernel LvArray::tensorOps::fill< 3 >( localTractionNew, 0.0 ); } - else if( std::abs( localTractionNew[ 0 ] ) < normalTractionTolerance[k] ) + else if( LvArray::math::abs( localTractionNew[ 0 ] ) < normalTractionTolerance[k] ) { LvArray::tensorOps::fill< 3 >( localTractionNew, 0.0 ); fractureState[k] = fields::contact::FractureState::Slip; From 5ad715f8137822660eca4b06ac70d7aa3e9370dd Mon Sep 17 00:00:00 2001 From: mfrigo Date: Fri, 6 Sep 2024 17:27:46 -0700 Subject: [PATCH 28/41] Fixed reviewer's comments (3) --- .../ALM_TFrac_benchmark.xml | 1 - .../ALM_TFrac_smoke.xml | 1 - .../ALM_UnstructuredCrack_benchmark.xml | 1 - .../ALM_UnstructuredCrack_smoke.xml | 1 - .../elementFormulations/LagrangeBasis1.hpp | 124 +++++++++++------- 5 files changed, 80 insertions(+), 48 deletions(-) diff --git a/inputFiles/lagrangianContactMechanics/ALM_TFrac_benchmark.xml b/inputFiles/lagrangianContactMechanics/ALM_TFrac_benchmark.xml index 92db6ad31b4..8acc35c09b1 100644 --- a/inputFiles/lagrangianContactMechanics/ALM_TFrac_benchmark.xml +++ b/inputFiles/lagrangianContactMechanics/ALM_TFrac_benchmark.xml @@ -16,7 +16,6 @@ Date: Sat, 7 Sep 2024 15:10:22 -0700 Subject: [PATCH 29/41] Fixed vtk-silo in the inputFiles/lagrangeContactMechanics --- .../lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml | 2 +- .../ALM_UnstructuredCrack_benchmark.xml | 2 +- .../ALM_UnstructuredCrack_smoke.xml | 3 ++- .../ContactMechanics_SimpleCubes_smoke.xml | 2 +- .../ContactMechanics_UnstructuredCrack_benchmark.xml | 2 +- .../ContactMechanics_UnstructuredCrack_smoke.xml | 2 +- inputFiles/lagrangianContactMechanics/SimpleCubes_base.xml | 7 +++---- .../lagrangianContactMechanics/UnstructuredCrack_base.xml | 6 +++--- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml index 8ec77da7d9a..a67c6421f4c 100644 --- a/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml @@ -48,7 +48,7 @@ name="outputs" timeFrequency="1" targetExactTimestep="0" - target="/Outputs/vtkOutput"/> + target="/Outputs/siloOutput"/> diff --git a/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_benchmark.xml b/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_benchmark.xml index 7f8a67d4a16..4a893d5dc0a 100644 --- a/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_benchmark.xml +++ b/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_benchmark.xml @@ -51,7 +51,7 @@ name="outputs" timeFrequency="1" targetExactTimestep="0" - target="/Outputs/vtkOutput"/> + target="/Outputs/siloOutput"/> diff --git a/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_smoke.xml index 25eee8db96b..4b230c006ce 100644 --- a/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ALM_UnstructuredCrack_smoke.xml @@ -51,7 +51,8 @@ name="outputs" timeFrequency="1" targetExactTimestep="0" - target="/Outputs/vtkOutput"/> + target="/Outputs/siloOutput"/> + diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_smoke.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_smoke.xml index cd29c971b9d..458b4d06343 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_smoke.xml @@ -57,7 +57,7 @@ name="outputs" timeFrequency="1" targetExactTimestep="0" - target="/Outputs/vtkOutput"/> + target="/Outputs/siloOutput"/> diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_benchmark.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_benchmark.xml index d4ded577995..82aee1a0f2a 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_benchmark.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_benchmark.xml @@ -57,7 +57,7 @@ name="outputs" timeFrequency="1" targetExactTimestep="0" - target="/Outputs/vtkOutput"/> + target="/Outputs/siloOutput"/> diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_smoke.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_smoke.xml index 20cf7288baa..ea9c2adfe64 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_UnstructuredCrack_smoke.xml @@ -57,7 +57,7 @@ name="outputs" timeFrequency="1" targetExactTimestep="0" - target="/Outputs/vtkOutput"/> + target="/Outputs/siloOutput"/> diff --git a/inputFiles/lagrangianContactMechanics/SimpleCubes_base.xml b/inputFiles/lagrangianContactMechanics/SimpleCubes_base.xml index 47bf36cc58b..2098ad04708 100644 --- a/inputFiles/lagrangianContactMechanics/SimpleCubes_base.xml +++ b/inputFiles/lagrangianContactMechanics/SimpleCubes_base.xml @@ -134,10 +134,9 @@ - + diff --git a/inputFiles/lagrangianContactMechanics/UnstructuredCrack_base.xml b/inputFiles/lagrangianContactMechanics/UnstructuredCrack_base.xml index 557166a2c23..b8de0e0eaea 100644 --- a/inputFiles/lagrangianContactMechanics/UnstructuredCrack_base.xml +++ b/inputFiles/lagrangianContactMechanics/UnstructuredCrack_base.xml @@ -118,9 +118,9 @@ - + From 647efc074291deb119be0071feb7a797031aabd2 Mon Sep 17 00:00:00 2001 From: Matteo Frigo Date: Sat, 7 Sep 2024 17:33:35 -0700 Subject: [PATCH 30/41] Fixed vtk-silo in the inputFiles/lagrangeContactMechanics --- .../lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml | 4 ++++ .../ContactMechanics_SimpleCubes_smoke.xml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml b/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml index a67c6421f4c..d0c48b78bdf 100644 --- a/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ALM_SimpleCubes_smoke.xml @@ -28,6 +28,10 @@ + + diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_smoke.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_smoke.xml index 458b4d06343..733a439db2e 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_SimpleCubes_smoke.xml @@ -37,6 +37,10 @@ + + From 0d0d1d19fad6cfe31abb997eca950d5cd5d1636b Mon Sep 17 00:00:00 2001 From: Matteo Cusini <49037133+CusiniM@users.noreply.github.com> Date: Thu, 12 Sep 2024 14:17:42 -0700 Subject: [PATCH 31/41] Update src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp --- .../physicsSolvers/contact/SolidMechanicsALMKernels.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp index 8241dd60165..79607d5cc14 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp @@ -249,7 +249,7 @@ class ALM : StackVariables & stack ) const { GEOS_UNUSED_VAR( k ); - constexpr real64 zero = std::numeric_limits< real64 >::epsilon(); + constexpr real64 zero = LvArray::NumericLimits< real64 >::epsilon(); constexpr int numUdofs = numNodesPerElem * 3 * 2; From b63b9ed5231181e5d2767e8f0b1afff2d20ef369 Mon Sep 17 00:00:00 2001 From: "Randolph R. Settgast" Date: Fri, 13 Sep 2024 14:02:54 -0700 Subject: [PATCH 32/41] fix bug --- .../physicsSolvers/contact/SolidMechanicsALMKernels.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp index 79607d5cc14..9f5c53f5132 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernels.hpp @@ -249,7 +249,7 @@ class ALM : StackVariables & stack ) const { GEOS_UNUSED_VAR( k ); - constexpr real64 zero = LvArray::NumericLimits< real64 >::epsilon(); + constexpr real64 zero = LvArray::NumericLimits< real64 >::epsilon; constexpr int numUdofs = numNodesPerElem * 3 * 2; From cdbcd8c42eda3082bc4c69de1cba51725f564c83 Mon Sep 17 00:00:00 2001 From: Matteo Cusini <49037133+CusiniM@users.noreply.github.com> Date: Fri, 13 Sep 2024 15:01:05 -0700 Subject: [PATCH 33/41] Update src/coreComponents/constitutive/contact/CoulombFriction.hpp --- src/coreComponents/constitutive/contact/CoulombFriction.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/constitutive/contact/CoulombFriction.hpp b/src/coreComponents/constitutive/contact/CoulombFriction.hpp index addbe1105e5..a9f653440f6 100644 --- a/src/coreComponents/constitutive/contact/CoulombFriction.hpp +++ b/src/coreComponents/constitutive/contact/CoulombFriction.hpp @@ -480,7 +480,7 @@ inline void CoulombFrictionUpdates::updateTractionOnly( arraySlice1d< real64 con { // TODO: Pass this tol as an argument or define a new class member - real64 const zero = std::numeric_limits< real64 >::epsilon(); + real64 const zero = LvArray::NumericLimits< real64 >::epsilon(); tractionNew[0] = traction[0] + penalty[0] * dispJump[0]; tractionNew[1] = traction[1] + penalty[1] * deltaDispJump[1]; From af1dcd3ac9720e0c53482f10e467feac99e540ee Mon Sep 17 00:00:00 2001 From: Matteo Cusini <49037133+CusiniM@users.noreply.github.com> Date: Fri, 13 Sep 2024 15:22:45 -0700 Subject: [PATCH 34/41] Apply suggestions from code review --- src/coreComponents/constitutive/contact/CoulombFriction.hpp | 2 +- .../physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreComponents/constitutive/contact/CoulombFriction.hpp b/src/coreComponents/constitutive/contact/CoulombFriction.hpp index a9f653440f6..2ed7d182536 100644 --- a/src/coreComponents/constitutive/contact/CoulombFriction.hpp +++ b/src/coreComponents/constitutive/contact/CoulombFriction.hpp @@ -480,7 +480,7 @@ inline void CoulombFrictionUpdates::updateTractionOnly( arraySlice1d< real64 con { // TODO: Pass this tol as an argument or define a new class member - real64 const zero = LvArray::NumericLimits< real64 >::epsilon(); + real64 const zero = LvArray::NumericLimits< real64 >::epsilon; tractionNew[0] = traction[0] + penalty[0] * dispJump[0]; tractionNew[1] = traction[1] + penalty[1] * deltaDispJump[1]; diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp index 7010adbcbfb..c64c0a5da88 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp @@ -405,7 +405,7 @@ struct UpdateStateKernel forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) { - real64 const zero = std::numeric_limits< real64 >::epsilon(); + real64 const zero = LvArray::NumericLimits< real64 >::epsilon; real64 localPenalty[3][3]{}; real64 localTractionNew[3]{}; From 065a962806f899bbb51f28928c3d723081701e81 Mon Sep 17 00:00:00 2001 From: Matteo Frigo Date: Sun, 15 Sep 2024 04:28:17 -0700 Subject: [PATCH 35/41] Fixing documentation error --- .../faultMechanics/intersectFrac/Example.rst | 18 +++++++++++------- .../intersectFrac/intersectFracFigure.py | 2 +- .../singleFracCompression/Example.rst | 18 +++++++++++------- .../singleFracCompressionFigure.py | 4 ++-- .../faultMechanics/sneddon/Example.rst | 15 ++++++++------- 5 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/intersectFrac/Example.rst b/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/intersectFrac/Example.rst index a1019bac817..6714806e81f 100644 --- a/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/intersectFrac/Example.rst +++ b/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/intersectFrac/Example.rst @@ -14,11 +14,15 @@ method `(Phan et al., 2003) :end-before: @@ -78,7 +82,7 @@ with one group of cell blocks named here ``cb1``. Refinement is necessary to conform with the fracture geometry specified in the ``Geometry`` section. -.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_base.xml +.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/TFrac_base.xml :language: xml :start-after: :end-before: @@ -124,7 +128,7 @@ A homogeneous and isotropic domain with one solid material is assumed, and its m Fracture surface slippage is assumed to be governed by the Coulomb failure criterion. The contact constitutive behavior is named ``fractureMaterial`` in the ``Coulomb`` block, where cohesion ``cohesion="0.0"`` and friction coefficient ``frictionCoefficient="0.577350269"`` are specified. -.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_base.xml +.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/TFrac_base.xml :language: xml :start-after: :end-before: @@ -145,7 +149,7 @@ In the ``Tasks`` section, ``PackCollection`` tasks are defined to collect time h Either the entire field or specified named sets of indices in the field can be collected. In this example, ``tractionCollection`` and ``displacementJumpCollection`` tasks are specified to output the local traction ``fieldName="traction"`` and relative displacement ``fieldName="displacementJump"`` on the fracture surface. -.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_base.xml +.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/TFrac_base.xml :language: xml :start-after: :end-before: @@ -171,7 +175,7 @@ The remaining parts of the outer boundaries are subjected to roller constraints. These boundary conditions are set up through the ``FieldSpecifications`` section. -.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_base.xml +.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/TFrac_base.xml :language: xml :start-after: :end-before: diff --git a/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/intersectFrac/intersectFracFigure.py b/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/intersectFrac/intersectFracFigure.py index 2aa2ffa8fdf..ac6f796ed04 100644 --- a/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/intersectFrac/intersectFracFigure.py +++ b/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/intersectFrac/intersectFracFigure.py @@ -105,7 +105,7 @@ def main(): geosDir = args.geosDir hdf5File1Path = outputDir + "/traction_history.hdf5" hdf5File2Path = outputDir + "/displacementJump_history.hdf5" - xmlFilePath = geosDir + "/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_base.xml" + xmlFilePath = geosDir + "/inputFiles/lagrangianContactMechanics/TFrac_base.xml" # Read HDF5 # Global Coordinate of Fracture Element Center diff --git a/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/singleFracCompression/Example.rst b/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/singleFracCompression/Example.rst index c34a6cf30cb..4b29541ce9d 100644 --- a/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/singleFracCompression/Example.rst +++ b/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/singleFracCompression/Example.rst @@ -13,11 +13,15 @@ In this example, a single fracture is simulated using a Lagrange contact model i **Input file** -Everything required is contained within two GEOS input files and one mesh file located at: +Everything required is contained within these GEOS input files and one mesh file located at: .. code-block:: console - inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_base.xml + inputFiles/lagrangianContactMechanics/SingleFracCompression_base.xml + +.. code-block:: console + + inputFiles/lagrangianContactMechanics/SingleFracCompression_benchmark.xml .. code-block:: console @@ -79,7 +83,7 @@ The syntax to import external meshes is simple: in the XML file, the mesh file ``crackInPlane_benchmark.vtu`` is included with its relative or absolute path to the location of the GEOS XML file and a user-specified label (here ``CubeHex``) is given to the mesh object. This unstructured mesh contains quadrilaterals elements and interface elements. Refinement is performed to conform with the fracture geometry specified in the ``Geometry`` section. -.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_benchmark.xml +.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/SingleFracCompression_benchmark.xml :language: xml :start-after: :end-before: @@ -110,7 +114,7 @@ To setup a coupling between rock and fracture deformations, we define three diff - The solver ``SurfaceGenerator`` defines the fracture region and rock toughness. -.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_base.xml +.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_benchmark.xml :language: xml :start-after: :end-before: @@ -124,7 +128,7 @@ For this specific problem, we simulate the elastic deformation and fracture slip Fracture surface slippage is assumed to be governed by the Coulomb failure criterion. The contact constitutive behavior is named ``fractureMaterial`` in the ``Coulomb`` block, where cohesion ``cohesion="0.0"`` and friction coefficient ``frictionCoefficient="0.577350269"`` are specified. -.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_base.xml +.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/SingleFracCompression_base.xml :language: xml :start-after: :end-before: @@ -145,7 +149,7 @@ In the ``Tasks`` section, ``PackCollection`` tasks are defined to collect time h Either the entire field or specified named sets of indices in the field can be collected. In this example, ``tractionCollection`` and ``displacementJumpCollection`` tasks are specified to output the local traction ``fieldName="traction"`` and relative displacement ``fieldName="displacementJump"`` on the fracture surface. -.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_base.xml +.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/SingleFracCompression_base.xml :language: xml :start-after: :end-before: @@ -170,7 +174,7 @@ The remaining parts of the outer boundaries are subjected to roller constraints. These boundary conditions are set up through the ``FieldSpecifications`` section. -.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_base.xml +.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/SingleFracCompression_base.xml :language: xml :start-after: :end-before: diff --git a/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/singleFracCompression/singleFracCompressionFigure.py b/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/singleFracCompression/singleFracCompressionFigure.py index 01513ae946d..32afe5d42b2 100644 --- a/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/singleFracCompression/singleFracCompressionFigure.py +++ b/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/singleFracCompression/singleFracCompressionFigure.py @@ -96,8 +96,8 @@ def main(): geosDir = args.geosDir hdf5File1Path = outputDir + "/traction_history.hdf5" hdf5File2Path = outputDir + "/displacementJump_history.hdf5" - xmlFile1Path = geosDir + "/inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_base.xml" - xmlFile2Path = geosDir + "/inputFiles/lagrangianContactMechanics/ContactMechanics_SingleFracCompression_benchmark.xml" + xmlFile1Path = geosDir + "/inputFiles/lagrangianContactMechanics/SingleFracCompression_base.xml" + xmlFile2Path = geosDir + "/inputFiles/lagrangianContactMechanics/SingleFracCompression_benchmark.xml" # Read HDF5 # Global Coordinate of Fracture Element Center diff --git a/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/sneddon/Example.rst b/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/sneddon/Example.rst index 65a1ad48d5e..c8a81833630 100644 --- a/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/sneddon/Example.rst +++ b/src/docs/sphinx/advancedExamples/validationStudies/faultMechanics/sneddon/Example.rst @@ -29,8 +29,9 @@ The xml input files for the case with LagrangianContact solver are located at: .. code-block:: console - inputFiles/lagrangianContactMechanics/Sneddon_contactMechanics_base.xml - inputFiles/lagrangianContactMechanics/Sneddon_contactMechanics_benchmark.xml + inputFiles/lagrangianContactMechanics/Sneddon_base.xml + inputFiles/lagrangianContactMechanics/Sneddon_benchmark.xml + inputFiles/lagrangianContactMechanics/ContactMechanics_Sneddon_benchmark.xml The xml input files for the case with HydroFracture solver are located at: @@ -99,7 +100,7 @@ To setup a coupling between rock and fracture deformations in LagrangianContact - The solver ``SurfaceGenerator`` defines the fracture region and rock toughness. -.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/Sneddon_contactMechanics_benchmark.xml +.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/ContactMechanics_Sneddon_benchmark.xml :language: xml :start-after: :end-before: @@ -155,7 +156,7 @@ along the Z axes, 121 elements along the X axis and 921 elements along the Y axi The mesh for the case with LagrangianContact solver was also created using the internal mesh generator, as parametrized in the ``InternalMesh`` XML tag. The mesh discretizes the same compational domain (:math:`40\, m \, \times 40 \, m \, \times 1 \, m`) with 300 x 300 x 2 eight-node brick elements in the x, y, and z directions respectively. -.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/Sneddon_contactMechanics_benchmark.xml +.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/Sneddon_benchmark.xml :language: xml :start-after: :end-before: @@ -209,7 +210,7 @@ The static fracture is defined by a nodeset occupying a small region within the - The test case with LagrangianContact solver: -.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/Sneddon_contactMechanics_base.xml +.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/Sneddon_base.xml :language: xml :start-after: :end-before: @@ -242,7 +243,7 @@ In this example, a task is specified to output fracture aperture (normal opening - The test case with LagrangianContact solver: -.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/Sneddon_contactMechanics_base.xml +.. literalinclude:: ../../../../../../../inputFiles/lagrangianContactMechanics/Sneddon_base.xml :language: xml :start-after: :end-before: @@ -271,7 +272,7 @@ To run these three cases, use the following commands: ``path/to/geos -i inputFiles/efemFractureMechanics/Sneddon_embeddedFrac_verification.xml`` -``path/to/geos -i inputFiles/lagrangianContactMechanics/Sneddon_contactMechanics_benchmark.xml`` +``path/to/geos -i inputFiles/lagrangianContactMechanics/ContactMechanics_Sneddon_benchmark.xml`` ``path/to/geos -i inputFiles/hydraulicFracturing/Sneddon_hydroFrac_benchmark.xml`` From add8a0ae0059ec70a95617ee6c23184189d8816a Mon Sep 17 00:00:00 2001 From: Matteo Frigo Date: Sun, 15 Sep 2024 05:30:03 -0700 Subject: [PATCH 36/41] Adding doxygen comments --- .../Stanford/sherlock-gcc10-ompi4.1.2-openblas0.3.10.cmake | 1 - .../contact/SolidMechanicsAugmentedLagrangianContact.hpp | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/host-configs/Stanford/sherlock-gcc10-ompi4.1.2-openblas0.3.10.cmake b/host-configs/Stanford/sherlock-gcc10-ompi4.1.2-openblas0.3.10.cmake index 0f1a8120e2e..d29b6180e11 100644 --- a/host-configs/Stanford/sherlock-gcc10-ompi4.1.2-openblas0.3.10.cmake +++ b/host-configs/Stanford/sherlock-gcc10-ompi4.1.2-openblas0.3.10.cmake @@ -40,5 +40,4 @@ set(LAPACK_LIBRARIES "${OPENBLAS_ROOT}/lib/libopenblas.so" CACHE STRING "") set(ENABLE_VALGRIND OFF CACHE BOOL "") set(ENABLE_CALIPER ON CACHE BOOL "") -set(GEOSX_TPL_DIR "${GEOSX_TPL_DIR}" CACHE PATH "" FORCE) include(${CMAKE_CURRENT_LIST_DIR}/../tpls.cmake) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp index c66a259defe..54ffa40bab7 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.hpp @@ -241,10 +241,15 @@ class SolidMechanicsAugmentedLagrangianContact : public ContactSolverBase constexpr static char const * dispJumpUpdPenaltyString() { return "dispJumpUpdPenalty"; } }; + /// Tolerance for the sliding check: the tangential traction must exceed (1 + m_slidingCheckTolerance) * t_lim to activate the sliding + /// condition real64 const m_slidingCheckTolerance = 0.05; + /// Flag to update the Lagrange multiplier at each Newton iteration (true), or only after the Newton loop has converged (false) bool m_simultaneous = true; + /// Flag to neglect the non-symmetric contribution in the tangential matrix, i.e., the derivative of tangential traction with respect to + /// the normal displacement is neglected bool m_symmetric = true; }; From 0202b508af5e9981c36231c0b1e33e346937ddec Mon Sep 17 00:00:00 2001 From: Randolph Settgast Date: Sun, 15 Sep 2024 13:44:59 -0700 Subject: [PATCH 37/41] fix documentation error: --- .../ContactMechanics_TFrac_benchmark.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_benchmark.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_benchmark.xml index 028262a170d..89e2f4854df 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_benchmark.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_benchmark.xml @@ -7,8 +7,8 @@ - - + - - + + + From 78e74de0f7967f276a2a35717ffb466112d003b6 Mon Sep 17 00:00:00 2001 From: Matteo Frigo Date: Mon, 16 Sep 2024 02:00:34 -0700 Subject: [PATCH 38/41] Change penalty to iterativePenalty --- .../physicsSolvers/contact/ContactFields.hpp | 6 ++-- .../contact/SolidMechanicsALMKernelsBase.hpp | 2 +- ...lidMechanicsAugmentedLagrangianContact.cpp | 36 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/ContactFields.hpp b/src/coreComponents/physicsSolvers/contact/ContactFields.hpp index ec94567db6b..4792ca2d019 100644 --- a/src/coreComponents/physicsSolvers/contact/ContactFields.hpp +++ b/src/coreComponents/physicsSolvers/contact/ContactFields.hpp @@ -50,13 +50,13 @@ struct FractureState }; }; -DECLARE_FIELD( penalty, - "penalty", +DECLARE_FIELD( iterativePenalty, + "iterativePenalty", array2d< real64 >, 1.e5, LEVEL_0, WRITE_AND_READ, - "Penalty coefficients" ); + "Penalty coefficients used in the iterative procedure of the Augmented Lagrangian Method" ); DECLARE_FIELD( rotationMatrix, "rotationMatrix", diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp index c64c0a5da88..4f3504e3d5f 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsALMKernelsBase.hpp @@ -98,7 +98,7 @@ class ALMKernelsBase : m_rotationMatrix( elementSubRegion.getField< fields::contact::rotationMatrix >().toViewConst()), m_dispJump( elementSubRegion.getField< fields::contact::dispJump >().toView() ), m_oldDispJump( elementSubRegion.getField< fields::contact::oldDispJump >().toViewConst() ), - m_penalty( elementSubRegion.getField< fields::contact::penalty >().toViewConst() ) + m_penalty( elementSubRegion.getField< fields::contact::iterativePenalty >().toViewConst() ) {} //*************************************************************************** diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index 5ff8c4eef35..e91a8503251 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -99,8 +99,8 @@ void SolidMechanicsAugmentedLagrangianContact::registerDataOnMesh( dataRepositor subRegion.registerField< contact::oldDispJump >( this->getName() ). reference().resizeDimension< 1 >( 3 ); - // Register the displacement jump - subRegion.registerField< contact::penalty >( this->getName() ). + // Register the penalty coefficients for the iterative procedure + subRegion.registerField< contact::iterativePenalty >( this->getName() ). reference().resizeDimension< 1 >( 5 ); subRegion.registerWrapper< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ). @@ -265,27 +265,27 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & subRegion.getReference< array2d< real64 > >( viewKeyStruct::dispJumpUpdPenaltyString() ); arrayView2d< real64 > const - penalty = subRegion.getField< fields::contact::penalty >().toView(); + iterativePenalty = subRegion.getField< fields::contact::iterativePenalty >().toView(); arrayView1d< integer const > const fractureState = subRegion.getField< contact::fractureState >(); if( m_simultaneous ) { - // Set the penalty coefficients + // Set the iterative penalty coefficients forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const k ) { if( fractureState[k] == contact::FractureState::Stick ) { - penalty[k][2] = penalty[k][1]; - penalty[k][3] = penalty[k][1]; - penalty[k][4] = 0.0; + iterativePenalty[k][2] = iterativePenalty[k][1]; + iterativePenalty[k][3] = iterativePenalty[k][1]; + iterativePenalty[k][4] = 0.0; } else { - penalty[k][2] = 0.0; - penalty[k][3] = 0.0; - penalty[k][4] = 0.0; + iterativePenalty[k][2] = 0.0; + iterativePenalty[k][3] = 0.0; + iterativePenalty[k][4] = 0.0; } } ); } @@ -759,7 +759,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit arrayView2d< real64 const > const dispJump = subRegion.getField< contact::dispJump >(); arrayView2d< real64 const > const deltaDispJump = subRegion.getField< contact::deltaDispJump >(); - arrayView2d< real64 const > const penalty = subRegion.getField< contact::penalty >(); + arrayView2d< real64 const > const iterativePenalty = subRegion.getField< contact::iterativePenalty >(); arrayView1d< integer const > const fractureState = subRegion.getField< contact::fractureState >(); arrayView1d< real64 const > const normalDisplacementTolerance = @@ -788,7 +788,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit { solidMechanicsALMKernels::ComputeTractionSimultaneousKernel:: launch< parallelDevicePolicy<> >( subRegion.size(), - penalty, + iterativePenalty, traction, dispJump, deltaDispJump, @@ -799,7 +799,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit solidMechanicsALMKernels::ComputeTractionKernel:: launch< parallelDevicePolicy<> >( subRegion.size(), frictionWrapper, - penalty, + iterativePenalty, traction, dispJump, deltaDispJump, @@ -935,7 +935,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit arrayView1d< real64 const > const normalTractionTolerance = subRegion.getReference< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ); - arrayView2d< real64 > const penalty = subRegion.getField< fields::contact::penalty >().toView(); + arrayView2d< real64 > const iterativePenalty = subRegion.getField< fields::contact::iterativePenalty >().toView(); arrayView2d< real64 > const dispJumpUpdPenalty = subRegion.getReference< array2d< real64 > >( viewKeyStruct::dispJumpUpdPenaltyString() ); @@ -958,7 +958,7 @@ bool SolidMechanicsAugmentedLagrangianContact::updateConfiguration( DomainPartit frictionWrapper, oldDispJump, dispJump, - penalty, + iterativePenalty, m_symmetric, normalTractionTolerance, traction, @@ -1598,7 +1598,7 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio subRegion.getReference< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ); arrayView2d< real64 > const - penalty = subRegion.getField< fields::contact::penalty >().toView(); + iterativePenalty = subRegion.getField< fields::contact::iterativePenalty >().toView(); forAll< parallelHostPolicy >( subRegion.size(), [=] ( localIndex const kfe ) { @@ -1687,8 +1687,8 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio pow( rotatedInvStiffApprox[ 2 ][ 2 ], 2 )) * averageYoungModulus / 2.e+5; normalTractionTolerance[kfe] = (1.0 / 2.0) * (averageConstrainedModulus / averageBoxSize0) * (normalDisplacementTolerance[kfe]); - penalty[kfe][0] = 1e+01*averageConstrainedModulus/(averageBoxSize0*area); - penalty[kfe][1] = 1e-01*averageConstrainedModulus/(averageBoxSize0*area); + iterativePenalty[kfe][0] = 1e+01*averageConstrainedModulus/(averageBoxSize0*area); + iterativePenalty[kfe][1] = 1e-01*averageConstrainedModulus/(averageBoxSize0*area); } ); } From c7c6bff632c4a26de077c62e6b152ac2b9e63308 Mon Sep 17 00:00:00 2001 From: Matteo Cusini <49037133+CusiniM@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:09:23 -0700 Subject: [PATCH 39/41] update baselines. --- .integrated_tests.yaml | 2 +- BASELINE_NOTES.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.integrated_tests.yaml b/.integrated_tests.yaml index 85a23286bf6..8f04a1ad830 100644 --- a/.integrated_tests.yaml +++ b/.integrated_tests.yaml @@ -1,6 +1,6 @@ baselines: bucket: geosx - baseline: integratedTests/baseline_integratedTests-pr3318-7578-14f13e2 + baseline: integratedTests/baseline_integratedTests-pr3217-7637-78e74de allow_fail: all: '' diff --git a/BASELINE_NOTES.md b/BASELINE_NOTES.md index 7c26b2ef528..a01e4749868 100644 --- a/BASELINE_NOTES.md +++ b/BASELINE_NOTES.md @@ -6,6 +6,10 @@ This file is designed to track changes to the integrated test baselines. Any developer who updates the baseline ID in the .integrated_tests.yaml file is expected to create an entry in this file with the pull request number, date, and their justification for rebaselining. These notes should be in reverse-chronological order, and use the following time format: (YYYY-MM-DD). +PR #3217 (2024-09-16) +====================== +ALM slip and open modes with relative tests. + PR #3318 (2024-09-12) ====================== Modified SeismicityRate poroelastic case. From 9b4a604fec027d8aca703cccda86ba0a57acf647 Mon Sep 17 00:00:00 2001 From: Matteo Frigo Date: Tue, 17 Sep 2024 02:48:03 -0700 Subject: [PATCH 40/41] Fixed bug parallel execution --- ...lidMechanicsAugmentedLagrangianContact.cpp | 164 ++++++++++-------- 1 file changed, 92 insertions(+), 72 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp index e91a8503251..eb9fc81049e 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -302,6 +302,22 @@ void SolidMechanicsAugmentedLagrangianContact::implicitStepSetup( real64 const & } ); } ); + // Sync iterativePenalty + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, + MeshLevel & mesh, + arrayView1d< string const > const & ) + { + FieldIdentifiers fieldsToBeSync; + + fieldsToBeSync.addElementFields( { contact::iterativePenalty::key() }, + { getUniqueFractureRegionName() } ); + + CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, + mesh, + domain.getNeighbors(), + true ); + } ); + } void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time, @@ -1600,96 +1616,100 @@ void SolidMechanicsAugmentedLagrangianContact::computeTolerances( DomainPartitio arrayView2d< real64 > const iterativePenalty = subRegion.getField< fields::contact::iterativePenalty >().toView(); + arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); + forAll< parallelHostPolicy >( subRegion.size(), [=] ( localIndex const kfe ) { - real64 const area = faceArea[kfe]; - // approximation of the stiffness along coordinate directions - // ( first, second ) index -> ( element index, direction ) - // 1. T -> top (index 0), B -> bottom (index 1) - // 2. the coordinate direction (x, y, z) - real64 stiffDiagApprox[ 2 ][ 3 ]; - real64 averageYoungModulus = 0.0; - real64 averageConstrainedModulus = 0.0; - real64 averageBoxSize0 = 0.0; - - for( localIndex i = 0; i < elemsToFaces.sizeOfArray( kfe ); ++i ) + if( ghostRank[kfe] < 0 ) { - localIndex const faceIndex = elemsToFaces[kfe][i]; - localIndex const er = faceToElemRegion[faceIndex][0]; - localIndex const esr = faceToElemSubRegion[faceIndex][0]; - localIndex const ei = faceToElemIndex[faceIndex][0]; + real64 const area = faceArea[kfe]; + // approximation of the stiffness along coordinate directions + // ( first, second ) index -> ( element index, direction ) + // 1. T -> top (index 0), B -> bottom (index 1) + // 2. the coordinate direction (x, y, z) + real64 stiffDiagApprox[ 2 ][ 3 ]; + real64 averageYoungModulus = 0.0; + real64 averageConstrainedModulus = 0.0; + real64 averageBoxSize0 = 0.0; + + for( localIndex i = 0; i < elemsToFaces.sizeOfArray( kfe ); ++i ) + { + localIndex const faceIndex = elemsToFaces[kfe][i]; + localIndex const er = faceToElemRegion[faceIndex][0]; + localIndex const esr = faceToElemSubRegion[faceIndex][0]; + localIndex const ei = faceToElemIndex[faceIndex][0]; - real64 const volume = elemVolume[er][esr][ei]; + real64 const volume = elemVolume[er][esr][ei]; - // Get the "element to node" map for the specific region/subregion - NodeMapViewType const & cellElemsToNodes = elemToNodeView[er][esr]; - localIndex const numNodesPerElem = cellElemsToNodes.size( 1 ); + // Get the "element to node" map for the specific region/subregion + NodeMapViewType const & cellElemsToNodes = elemToNodeView[er][esr]; + localIndex const numNodesPerElem = cellElemsToNodes.size( 1 ); - // Compute the box size - real64 maxSize[3]; - real64 minSize[3]; - for( localIndex j = 0; j < 3; ++j ) - { - maxSize[j] = nodePosition[cellElemsToNodes[ei][0]][j]; - minSize[j] = nodePosition[cellElemsToNodes[ei][0]][j]; - } - for( localIndex a = 1; a < numNodesPerElem; ++a ) - { + // Compute the box size + real64 maxSize[3]; + real64 minSize[3]; for( localIndex j = 0; j < 3; ++j ) { - maxSize[j] = fmax( maxSize[j], nodePosition[cellElemsToNodes[ei][a]][j] ); - minSize[j] = fmin( minSize[j], nodePosition[cellElemsToNodes[ei][a]][j] ); + maxSize[j] = nodePosition[cellElemsToNodes[ei][0]][j]; + minSize[j] = nodePosition[cellElemsToNodes[ei][0]][j]; + } + for( localIndex a = 1; a < numNodesPerElem; ++a ) + { + for( localIndex j = 0; j < 3; ++j ) + { + maxSize[j] = fmax( maxSize[j], nodePosition[cellElemsToNodes[ei][a]][j] ); + minSize[j] = fmin( minSize[j], nodePosition[cellElemsToNodes[ei][a]][j] ); + } } - } - real64 boxSize[3]; - for( localIndex j = 0; j < 3; ++j ) - { - boxSize[j] = maxSize[j] - minSize[j]; - } + real64 boxSize[3]; + for( localIndex j = 0; j < 3; ++j ) + { + boxSize[j] = maxSize[j] - minSize[j]; + } + + // Get linear elastic isotropic constitutive parameters for the element + real64 const K = bulkModulus[er][esr][ei]; + real64 const G = shearModulus[er][esr][ei]; + real64 const E = 9.0 * K * G / ( 3.0 * K + G ); + real64 const nu = ( 3.0 * K - 2.0 * G ) / ( 2.0 * ( 3.0 * K + G ) ); + real64 const M = K + 4.0 / 3.0 * G; - // Get linear elastic isotropic constitutive parameters for the element - real64 const K = bulkModulus[er][esr][ei]; - real64 const G = shearModulus[er][esr][ei]; - real64 const E = 9.0 * K * G / ( 3.0 * K + G ); - real64 const nu = ( 3.0 * K - 2.0 * G ) / ( 2.0 * ( 3.0 * K + G ) ); - real64 const M = K + 4.0 / 3.0 * G; + // Combine E and nu to obtain a stiffness approximation (like it was an hexahedron) + for( localIndex j = 0; j < 3; ++j ) + { + stiffDiagApprox[ i ][ j ] = E / ( ( 1.0 + nu )*( 1.0 - 2.0*nu ) ) * 4.0 / 9.0 * ( 2.0 - 3.0 * nu ) * volume / ( boxSize[j]*boxSize[j] ); + } + + averageYoungModulus += 0.5*E; + averageConstrainedModulus += 0.5*M; + averageBoxSize0 += 0.5*boxSize[0]; + } - // Combine E and nu to obtain a stiffness approximation (like it was an hexahedron) + // Average the stiffness and compute the inverse + real64 invStiffApprox[ 3 ][ 3 ] = { { 0 } }; for( localIndex j = 0; j < 3; ++j ) { - stiffDiagApprox[ i ][ j ] = E / ( ( 1.0 + nu )*( 1.0 - 2.0*nu ) ) * 4.0 / 9.0 * ( 2.0 - 3.0 * nu ) * volume / ( boxSize[j]*boxSize[j] ); + invStiffApprox[ j ][ j ] = ( stiffDiagApprox[ 0 ][ j ] + stiffDiagApprox[ 1 ][ j ] ) / ( stiffDiagApprox[ 0 ][ j ] * stiffDiagApprox[ 1 ][ j ] ); } - averageYoungModulus += 0.5*E; - averageConstrainedModulus += 0.5*M; - averageBoxSize0 += 0.5*boxSize[0]; + // Rotate in the local reference system, computing R^T * (invK) * R + real64 temp[ 3 ][ 3 ]; + LvArray::tensorOps::Rij_eq_AkiBkj< 3, 3, 3 >( temp, faceRotationMatrix[ kfe ], invStiffApprox ); + real64 rotatedInvStiffApprox[ 3 ][ 3 ]; + LvArray::tensorOps::Rij_eq_AikBkj< 3, 3, 3 >( rotatedInvStiffApprox, temp, faceRotationMatrix[ kfe ] ); + LvArray::tensorOps::scale< 3, 3 >( rotatedInvStiffApprox, area ); + + // Finally, compute tolerances for the given fracture element + normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+7; + slidingTolerance[kfe] = sqrt( pow( rotatedInvStiffApprox[ 1 ][ 1 ], 2 ) + + pow( rotatedInvStiffApprox[ 2 ][ 2 ], 2 )) * averageYoungModulus / 2.e+5; + normalTractionTolerance[kfe] = (1.0 / 2.0) * (averageConstrainedModulus / averageBoxSize0) * + (normalDisplacementTolerance[kfe]); + iterativePenalty[kfe][0] = 1e+01*averageConstrainedModulus/(averageBoxSize0*area); + iterativePenalty[kfe][1] = 1e-01*averageConstrainedModulus/(averageBoxSize0*area); } - - // Average the stiffness and compute the inverse - real64 invStiffApprox[ 3 ][ 3 ] = { { 0 } }; - for( localIndex j = 0; j < 3; ++j ) - { - invStiffApprox[ j ][ j ] = ( stiffDiagApprox[ 0 ][ j ] + stiffDiagApprox[ 1 ][ j ] ) / ( stiffDiagApprox[ 0 ][ j ] * stiffDiagApprox[ 1 ][ j ] ); - } - - // Rotate in the local reference system, computing R^T * (invK) * R - real64 temp[ 3 ][ 3 ]; - LvArray::tensorOps::Rij_eq_AkiBkj< 3, 3, 3 >( temp, faceRotationMatrix[ kfe ], invStiffApprox ); - real64 rotatedInvStiffApprox[ 3 ][ 3 ]; - LvArray::tensorOps::Rij_eq_AikBkj< 3, 3, 3 >( rotatedInvStiffApprox, temp, faceRotationMatrix[ kfe ] ); - LvArray::tensorOps::scale< 3, 3 >( rotatedInvStiffApprox, area ); - - // Finally, compute tolerances for the given fracture element - normalDisplacementTolerance[kfe] = rotatedInvStiffApprox[ 0 ][ 0 ] * averageYoungModulus / 2.e+7; - slidingTolerance[kfe] = sqrt( pow( rotatedInvStiffApprox[ 1 ][ 1 ], 2 ) + - pow( rotatedInvStiffApprox[ 2 ][ 2 ], 2 )) * averageYoungModulus / 2.e+5; - normalTractionTolerance[kfe] = (1.0 / 2.0) * (averageConstrainedModulus / averageBoxSize0) * - (normalDisplacementTolerance[kfe]); - iterativePenalty[kfe][0] = 1e+01*averageConstrainedModulus/(averageBoxSize0*area); - iterativePenalty[kfe][1] = 1e-01*averageConstrainedModulus/(averageBoxSize0*area); - } ); } } ); From bb696c150daf5ca3cd1597336aa4f1d331803131 Mon Sep 17 00:00:00 2001 From: Matteo Frigo Date: Tue, 17 Sep 2024 07:30:34 -0700 Subject: [PATCH 41/41] Update baselines --- .integrated_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.integrated_tests.yaml b/.integrated_tests.yaml index 8f04a1ad830..53c078f12d0 100644 --- a/.integrated_tests.yaml +++ b/.integrated_tests.yaml @@ -1,6 +1,6 @@ baselines: bucket: geosx - baseline: integratedTests/baseline_integratedTests-pr3217-7637-78e74de + baseline: integratedTests/baseline_integratedTests-pr3217-7661-9b4a604 allow_fail: all: ''