-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Adding a fault stability analysis workflow #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
paloma-martinez
wants to merge
13
commits into
main
Choose a base branch
from
pmartinez/feature/faultStabilityVisu
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
763c6c6
Adding the code as is
paloma-martinez 6a95227
Split and change to camel case
paloma-martinez 2fc08a8
Merge branch 'main' into pmartinez/feature/faultStabilityVisu
paloma-martinez 237d21a
First pass of typing
paloma-martinez 7520eba
Removing Config due to problematic circular imports
paloma-martinez 94e2c65
Migration pyvista to vtk
paloma-martinez 79da00e
Clean and add logger and doc
paloma-martinez f6cb474
Merge branch 'main' into pmartinez/feature/faultStabilityVisu
paloma-martinez 6a89e8c
Missing docstring
paloma-martinez 525681a
Typing & linting
paloma-martinez 9e06935
Fix import
paloma-martinez 712aa0e
Add filter and tools to doc and fix doc build
paloma-martinez 373749e
First pass following review
paloma-martinez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| Utilities classes for processing filters | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| The `tools` folder contains utilities classes that are used in some of the processing filters. | ||
|
|
||
| FaultGeometry | ||
| ---------------------- | ||
| .. automodule:: geos.processing.tools.FaultGeometry | ||
| :members: | ||
| :undoc-members: | ||
| :show-inheritance: | ||
|
|
||
|
|
||
| FaultVisualizer | ||
| ---------------------- | ||
| .. automodule:: geos.processing.tools.FaultVisualizer | ||
| :members: | ||
| :undoc-members: | ||
| :show-inheritance: | ||
|
|
||
| MohrCoulomb | ||
| ---------------------- | ||
| .. automodule:: geos.processing.tools.MohrCoulomb | ||
| :members: | ||
| :undoc-members: | ||
| :show-inheritance: | ||
|
|
||
|
|
||
| ProfileExtractor | ||
| ---------------------- | ||
| .. automodule:: geos.processing.tools.ProfileExtractor | ||
| :members: | ||
| :undoc-members: | ||
| :show-inheritance: | ||
|
|
||
|
|
||
| SensitivityAnalyzer | ||
| ---------------------- | ||
| .. automodule:: geos.processing.tools.SensitivityAnalyzer | ||
| :members: | ||
| :undoc-members: | ||
| :show-inheritance: | ||
|
|
||
|
|
||
| StressProjector | ||
| ---------------------- | ||
| .. automodule:: geos.processing.tools.StressProjector | ||
| :members: | ||
| :undoc-members: | ||
| :show-inheritance: |
79 changes: 79 additions & 0 deletions
79
geos-geomechanics/src/geos/geomechanics/model/StressTensor.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: Copyright 2023-2026 TotalEnergies. | ||
| # SPDX-FileContributor: Nicolas Pillardou, Paloma Martinez | ||
|
|
||
| import numpy as np | ||
| import numpy.typing as npt | ||
| from typing_extensions import Any | ||
|
|
||
|
|
||
| # ============================================================================ | ||
| # STRESS TENSOR OPERATIONS | ||
| # ============================================================================ | ||
| class StressTensor: | ||
| """Utility class for stress tensor operations.""" | ||
|
|
||
| @staticmethod | ||
| def buildFromArray( arr: npt.NDArray[ np.float64 ] ) -> npt.NDArray[ np.float64 ]: | ||
| """Convert stress array to 3x3 tensor format. | ||
|
|
||
| Args: | ||
| arr ( npt.NDArray[np.float64]): Array to convert. | ||
|
|
||
| Returns: | ||
| npt.NDArray[np.float64]: 3x3 converted stress tensor. | ||
| """ | ||
| n = arr.shape[ 0 ] | ||
| tensors: npt.NDArray[ np.float64 ] = np.zeros( ( n, 3, 3 ), dtype=np.float64 ) | ||
|
|
||
| if arr.shape[ 1 ] == 6: # Voigt notation | ||
| tensors[ :, 0, 0 ] = arr[ :, 0 ] # Sxx | ||
| tensors[ :, 1, 1 ] = arr[ :, 1 ] # Syy | ||
| tensors[ :, 2, 2 ] = arr[ :, 2 ] # Szz | ||
| tensors[ :, 1, 2 ] = tensors[ :, 2, 1 ] = arr[ :, 3 ] # Syz | ||
| tensors[ :, 0, 2 ] = tensors[ :, 2, 0 ] = arr[ :, 4 ] # Sxz | ||
| tensors[ :, 0, 1 ] = tensors[ :, 1, 0 ] = arr[ :, 5 ] # Sxy | ||
| elif arr.shape[ 1 ] == 9: | ||
| tensors = arr.reshape( ( -1, 3, 3 ) ) | ||
| else: | ||
| raise ValueError( f"Unsupported stress shape: {arr.shape}" ) | ||
|
|
||
| return tensors | ||
|
|
||
| @staticmethod | ||
| def rotateToFaultFrame( stressTensorArr: npt.NDArray[ np.float64 ], normal: npt.NDArray[ np.float64 ], | ||
| tangent1: npt.NDArray[ np.float64 ], | ||
| tangent2: npt.NDArray[ np.float64 ] ) -> dict[ str, Any ]: | ||
| """Rotate stress tensor to fault local coordinate system. | ||
|
|
||
| Args: | ||
| stressTensorArr (npt.NDArray[np.float64]): Stress tensor to rotate. | ||
| normal (npt.NDArray[np.float64]): Surface normal vectors. | ||
| tangent1 (npt.NDArray[np.float64]): Surface tangents vectors 1. | ||
| tangent2 (npt.NDArray[np.float64])): Surface tangents vectors 2. | ||
|
|
||
| Returns: | ||
| dict[str, Any]: Dictionary containing local stress, normal stress, shear stress and strike and shear dip. | ||
| """ | ||
| # Verify orthonormality | ||
| if np.abs( np.linalg.norm( tangent1 ) - 1.0 ) >= 1e-10 or np.abs( np.linalg.norm( tangent2 ) - 1.0 ) >= 1e-10: | ||
| raise ValueError( "Tangents expected to be normalized." ) | ||
| if np.abs( np.dot( normal, tangent1 ) ) >= 1e-10 or np.abs( np.dot( normal, tangent2 ) ) >= 1e-10: | ||
| raise ValueError( "Tangents and Normals expected to be orthogonal." ) | ||
|
|
||
| # Rotation matrix: columns = local directions (n, t1, t2) | ||
| R = np.column_stack( ( normal, tangent1, tangent2 ) ) | ||
|
|
||
| # Rotate tensor | ||
| stressLocal = R.T @ stressTensorArr @ R | ||
|
|
||
| # Traction on fault plane (normal = [1,0,0] in local frame) | ||
| tractionLocal = stressLocal @ np.array( [ 1.0, 0.0, 0.0 ] ) | ||
|
|
||
| return { | ||
| 'stressLocal': stressLocal, | ||
| 'normalStress': tractionLocal[ 0 ], | ||
| 'shearStress': np.sqrt( tractionLocal[ 1 ]**2 + tractionLocal[ 2 ]**2 ), | ||
| 'shearStrike': tractionLocal[ 1 ], | ||
| 'shearDip': tractionLocal[ 2 ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have you add pointNormals arguments ? It is not used in the function.