From 38f828f249fdb8272a76817e8d9e9956aaa94841 Mon Sep 17 00:00:00 2001 From: Guotong-Ren <133127368+Guotong-Ren@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:27:29 -0600 Subject: [PATCH 1/7] clear the fields --- .../surfaceGeneration/SurfaceGenerator.cpp | 22 +++++++++++++++++++ .../surfaceGeneration/SurfaceGenerator.hpp | 6 +---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp index 26089417c74..49e0cf5a1db 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp @@ -468,6 +468,28 @@ void SurfaceGenerator::postRestartInitialization() } ); } +bool SurfaceGenerator::execute( real64 const time_n, + real64 const dt, + integer const cycleNumber, + integer const GEOS_UNUSED_PARAM( eventCounter ), + real64 const GEOS_UNUSED_PARAM( eventProgress ), + DomainPartition & domain ) +{ + solverStep( time_n, dt, cycleNumber, domain ); + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, + MeshLevel & meshLevel, + arrayView1d< string const > const & ) + { + ElementRegionManager & elemManager = meshLevel.getElemManager(); + SurfaceElementRegion & fractureRegion = elemManager.getRegion< SurfaceElementRegion >( this->m_fractureRegionName ); + + FaceElementSubRegion & fractureSubRegion = fractureRegion.getUniqueSubRegion< FaceElementSubRegion >(); + // without the clear of the following two fields, the initial fracture's f-m connections will be replicated later + fractureSubRegion.m_recalculateConnectionsFor2dFaces.clear(); + fractureSubRegion.m_newFaceElements.clear(); + }); + return false; +} real64 SurfaceGenerator::solverStep( real64 const & time_n, real64 const & dt, diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.hpp b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.hpp index 1064fe5f6b0..ccb8f8ec9dc 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.hpp +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.hpp @@ -85,11 +85,7 @@ class SurfaceGenerator : public PhysicsSolverBase integer const cycleNumber, integer const GEOS_UNUSED_PARAM( eventCounter ), real64 const GEOS_UNUSED_PARAM( eventProgress ), - DomainPartition & domain ) override - { - solverStep( time_n, dt, cycleNumber, domain ); - return false; - } + DomainPartition & domain ) override; virtual real64 solverStep( real64 const & time_n, real64 const & dt, From 7ea590b0e8f5e0cc607a959976795b490ec96417 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Wed, 27 Nov 2024 12:04:16 -0600 Subject: [PATCH 2/7] code style --- .../physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp index 49e0cf5a1db..cb3c4254e1a 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp @@ -487,7 +487,7 @@ bool SurfaceGenerator::execute( real64 const time_n, // without the clear of the following two fields, the initial fracture's f-m connections will be replicated later fractureSubRegion.m_recalculateConnectionsFor2dFaces.clear(); fractureSubRegion.m_newFaceElements.clear(); - }); + } ); return false; } From c1d7ce4c525aa85f6c8dca98aac8e481d3bf3e2b Mon Sep 17 00:00:00 2001 From: Guotong-Ren <133127368+Guotong-Ren@users.noreply.github.com> Date: Tue, 3 Dec 2024 09:24:17 -0600 Subject: [PATCH 3/7] * revert back the execute() in surfacegenerator.cpp * relax the IF statement of fullyCoupledSolverStep() in hydrofracturesolver.cpp --- .../multiphysics/HydrofractureSolver.cpp | 14 ++++++----- .../surfaceGeneration/SurfaceGenerator.cpp | 23 ------------------- .../surfaceGeneration/SurfaceGenerator.hpp | 6 ++++- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp index 61529778ea6..eac4166c899 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp @@ -176,7 +176,8 @@ real64 HydrofractureSolver< POROMECHANICS_SOLVER >::fullyCoupledSolverStep( real int const cycleNumber, DomainPartition & domain ) { - if( cycleNumber == 0 && time_n <= 0 ) + // for initial fracture initialization + if( time_n <= 0 ) { initializeNewFractureFields( domain ); } @@ -366,11 +367,11 @@ void HydrofractureSolver< POROMECHANICS_SOLVER >::updateHydraulicApertureAndFrac maxHydraulicAperture = MpiWrapper::max( maxHydraulicAperture ); GEOS_LOG_LEVEL_INFO_RANK_0( logInfo::Solution, GEOS_FMT( " {}: Max aperture change: {} m, max hydraulic aperture change: {} m", - this->getName(), fmt::format( "{:.{}f}", maxApertureChange, 6 ), fmt::format( "{:.{}f}", maxHydraulicApertureChange, 6 ) ) ); + this->getName(), fmt::format( "{:.{}e}", maxApertureChange, 6 ), fmt::format( "{:.{}e}", maxHydraulicApertureChange, 6 ) ) ); GEOS_LOG_LEVEL_INFO_RANK_0( logInfo::Solution, GEOS_FMT( " {}: Min aperture: {} m, max aperture: {} m", - this->getName(), fmt::format( "{:.{}f}", minAperture, 6 ), fmt::format( "{:.{}f}", maxAperture, 6 ) ) ); + this->getName(), fmt::format( "{:.{}e}", minAperture, 6 ), fmt::format( "{:.{}e}", maxAperture, 6 ) ) ); GEOS_LOG_LEVEL_INFO_RANK_0( logInfo::Solution, GEOS_FMT( " {}: Min hydraulic aperture: {} m, max hydraulic aperture: {} m", - this->getName(), fmt::format( "{:.{}f}", minHydraulicAperture, 6 ), fmt::format( "{:.{}f}", maxHydraulicAperture, 6 ) ) ); + this->getName(), fmt::format( "{:.{}e}", minHydraulicAperture, 6 ), fmt::format( "{:.{}e}", maxHydraulicAperture, 6 ) ) ); } template< typename POROMECHANICS_SOLVER > void HydrofractureSolver< POROMECHANICS_SOLVER >::setupCoupling( DomainPartition const & domain, @@ -737,10 +738,11 @@ assembleForceResidualDerivativeWrtPressure( DomainPartition & domain, real64 nodalForceMag = fluidPressure[kfe] * Ja; real64 nodalForce[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( Nbar ); LvArray::tensorOps::scale< 3 >( nodalForce, nodalForceMag ); - + for( localIndex kf=0; kf<2; ++kf ) { localIndex const faceIndex = elemsToFaces[kfe][kf]; + std::cout << "kfe " << kfe << " faceindex " << faceIndex << std::endl; for( localIndex a=0; a::initializeNewFractureFields( D } } ); } - + std::cout << "init new frac field " < const & ) - { - ElementRegionManager & elemManager = meshLevel.getElemManager(); - SurfaceElementRegion & fractureRegion = elemManager.getRegion< SurfaceElementRegion >( this->m_fractureRegionName ); - - FaceElementSubRegion & fractureSubRegion = fractureRegion.getUniqueSubRegion< FaceElementSubRegion >(); - // without the clear of the following two fields, the initial fracture's f-m connections will be replicated later - fractureSubRegion.m_recalculateConnectionsFor2dFaces.clear(); - fractureSubRegion.m_newFaceElements.clear(); - } ); - return false; -} - real64 SurfaceGenerator::solverStep( real64 const & time_n, real64 const & dt, const int GEOS_UNUSED_PARAM( cycleNumber ), diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.hpp b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.hpp index ccb8f8ec9dc..1064fe5f6b0 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.hpp +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.hpp @@ -85,7 +85,11 @@ class SurfaceGenerator : public PhysicsSolverBase integer const cycleNumber, integer const GEOS_UNUSED_PARAM( eventCounter ), real64 const GEOS_UNUSED_PARAM( eventProgress ), - DomainPartition & domain ) override; + DomainPartition & domain ) override + { + solverStep( time_n, dt, cycleNumber, domain ); + return false; + } virtual real64 solverStep( real64 const & time_n, real64 const & dt, From cf56b97408973643e6bfccbd338d7da883b9ba38 Mon Sep 17 00:00:00 2001 From: Guotong-Ren <133127368+Guotong-Ren@users.noreply.github.com> Date: Tue, 3 Dec 2024 11:45:57 -0600 Subject: [PATCH 4/7] delete cout --- .../physicsSolvers/multiphysics/HydrofractureSolver.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp index eac4166c899..52643324993 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp @@ -742,8 +742,6 @@ assembleForceResidualDerivativeWrtPressure( DomainPartition & domain, for( localIndex kf=0; kf<2; ++kf ) { localIndex const faceIndex = elemsToFaces[kfe][kf]; - std::cout << "kfe " << kfe << " faceindex " << faceIndex << std::endl; - for( localIndex a=0; a::initializeNewFractureFields( D } } ); } - std::cout << "init new frac field " < Date: Tue, 3 Dec 2024 13:20:42 -0600 Subject: [PATCH 5/7] code style --- .../physicsSolvers/multiphysics/HydrofractureSolver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp index 52643324993..7941e76a7da 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp @@ -176,7 +176,7 @@ real64 HydrofractureSolver< POROMECHANICS_SOLVER >::fullyCoupledSolverStep( real int const cycleNumber, DomainPartition & domain ) { - // for initial fracture initialization + // for initial fracture initialization if( time_n <= 0 ) { initializeNewFractureFields( domain ); @@ -738,7 +738,7 @@ assembleForceResidualDerivativeWrtPressure( DomainPartition & domain, real64 nodalForceMag = fluidPressure[kfe] * Ja; real64 nodalForce[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( Nbar ); LvArray::tensorOps::scale< 3 >( nodalForce, nodalForceMag ); - + for( localIndex kf=0; kf<2; ++kf ) { localIndex const faceIndex = elemsToFaces[kfe][kf]; From d1de69675ddf1fccf2d76412e09ebd5677e348c4 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Wed, 4 Dec 2024 17:00:47 -0600 Subject: [PATCH 6/7] Update SurfaceGenerator.cpp --- .../physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp index b13917bd046..26089417c74 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp @@ -468,6 +468,7 @@ void SurfaceGenerator::postRestartInitialization() } ); } + real64 SurfaceGenerator::solverStep( real64 const & time_n, real64 const & dt, const int GEOS_UNUSED_PARAM( cycleNumber ), From 20b371ea7c98b5616df029c9d066385d56ae78c3 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 6 Dec 2024 14:06:29 -0600 Subject: [PATCH 7/7] Update HydrofractureSolver.cpp --- .../physicsSolvers/multiphysics/HydrofractureSolver.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp index d4640b6358f..bdbf407bea7 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp @@ -176,11 +176,8 @@ real64 HydrofractureSolver< POROMECHANICS_SOLVER >::fullyCoupledSolverStep( real int const cycleNumber, DomainPartition & domain ) { - // for initial fracture initialization - if( time_n <= 0 ) - { - initializeNewFractureFields( domain ); - } + // for initial fracture initialization in case when surface generator was called outside of the solver + initializeNewFractureFields( domain ); real64 dtReturn = dt;