Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions docs/geos-posp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ GEOS Post-Processing tools

./geos_posp_docs/home.rst

./geos_posp_docs/modules.rst

./geos_posp_docs/visualization.rst
./geos_posp_docs/modules.rst
14 changes: 0 additions & 14 deletions docs/geos_posp_docs/PVplugins.rst

This file was deleted.

37 changes: 0 additions & 37 deletions docs/geos_posp_docs/visu.PVUtils.rst

This file was deleted.

12 changes: 0 additions & 12 deletions docs/geos_posp_docs/visu.rst

This file was deleted.

9 changes: 0 additions & 9 deletions docs/geos_posp_docs/visualization.rst

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ Mohr's Circle Package

This package includes utilities to compute and plot Mohr's Circles using the Python View from Paraview.

geos_posp.visu.mohrCircles.functionsMohrCircle module
geos.pv.utils.mohrCircles.functionsMohrCircle module
--------------------------------------------------------

.. automodule:: geos_posp.visu.mohrCircles.functionsMohrCircle
.. automodule:: geos.pv.utils.mohrCircles.functionsMohrCircle
:members:
:undoc-members:
:show-inheritance:

geos_posp.visu.mohrCircles.plotMohrCircles module
geos.pv.utils.mohrCircles.plotMohrCircles module
--------------------------------------------------

.. automodule:: geos_posp.visu.mohrCircles.plotMohrCircles
.. automodule:: geos.pv.utils.mohrCircles.plotMohrCircles
:members:
:undoc-members:
:show-inheritance:
10 changes: 8 additions & 2 deletions docs/geos_pv_docs/processing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The plugins include:
* A reader that parse GEOS output log file;
* 3D mesh cleanning plugins;
* Processing plugins to compute additional geomechanical properties;
* Visualization plugins to plot Mohr's circles (currently in `geos_posp`) and cross plots using Paraview Python View.
* Visualization plugins to plot Mohr's circles and cross plots using Paraview Python View.


PVAttributeMapping
Expand Down Expand Up @@ -103,4 +103,10 @@ PVGeomechanicsWorkflowVolumeWell plugin
PVGeomechanicsCalculator plugin
---------------------------------------

.. automodule:: geos.pv.plugins.PVGeomechanicsCalculator
.. automodule:: geos.pv.plugins.PVGeomechanicsCalculator


PVMohrCirclePlot plugin
---------------------------------

.. automodule:: geos.pv.plugins.PVMohrCirclePlot
2 changes: 1 addition & 1 deletion docs/geos_pv_docs/pyplotUtils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ geos.pv.pyplotUtils.matplotlibOptions module
.. automodule:: geos.pv.pyplotUtils.matplotlibOptions
:members:
:undoc-members:
:show-inheritance:
:show-inheritance:
2 changes: 2 additions & 0 deletions docs/geos_pv_docs/utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ Utilities
pythonViewUtils

utils

mohrCircles
101 changes: 63 additions & 38 deletions geos-geomechanics/src/geos/geomechanics/model/MohrCircle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
# SPDX-FileContributor: Alexandre Benedicto, Martin Lemay
import numpy as np
import numpy.typing as npt
from typing_extensions import Self
from typing_extensions import Self, Any

from geos.geomechanics.processing.geomechanicsCalculatorFunctions import (
computeStressPrincipalComponentsFromStressVector, )

__doc__ = """
MohrCircle module define the Mohr's circle parameters.

Inputs are a 6 component stress vector, a circle id, and the mechanical
convention used for compression.
Inputs are a 6 component stress vector, and a circle id.
The class computes principal components from stress vector during initialization.
Accessors get access to these 3 principal components as well as circle center
and radius.
Expand All @@ -23,21 +22,21 @@

from processing.MohrCircle import MohrCircle

# create the object
stressVector :npt.NDArray[np.float64]
circleId :str
mohrCircle :MohrCircle = MohrCircle(circleId)
# Create the object
stressVector: npt.NDArray[np.float64]
circleId: str
mohrCircle: MohrCircle = MohrCircle(circleId)

# either directly set principal components (p3 <= p2 <= p1)
# Either directly set principal components (p3 <= p2 <= p1)
mohrCircle.SetPrincipalComponents(p3, p2, p1)
# or compute them from stress vector
# Or compute them from stress vector
mohrCircle.computePrincipalComponents(stressVector)

# access to members
id :str = mohrCircle.getCircleId()
p1, p2, p3 :float = mohrCircle.getPrincipalComponents()
radius :float = mohrCircle.getCircleRadius()
center :float = mohrCircle.getCircleCenter()
# Access to members
id: str = mohrCircle.getCircleId()
p1, p2, p3: float = mohrCircle.getPrincipalComponents()
radius: float = mohrCircle.getCircleRadius()
center: float = mohrCircle.getCircleCenter()
"""


Expand All @@ -49,60 +48,86 @@ def __init__( self: Self, circleId: str ) -> None:
Args:
circleId (str): Mohr's circle id.
"""
self.m_circleId: str = circleId
self.circleId: str = circleId

self.m_p1: float = 0.0
self.m_p2: float = 0.0
self.m_p3: float = 0.0
self.p1: float = 0.0
self.p2: float = 0.0
self.p3: float = 0.0

def __str__( self: Self ) -> str:
"""Overload of __str__ method."""
return self.m_circleId
return self.circleId

def __repr__( self: Self ) -> str:
"""Overload of __repr__ method."""
return self.m_circleId
return self.circleId

def __eq__( self: Self, other: Any ) -> bool:
"""Overload of __eq__ method."""
if not isinstance( other, MohrCircle ):
return NotImplemented
return self.circleId == other.circleId

def __hash__( self: Self ) -> int:
"""Overload of hash method."""
return hash( self.circleId )

def setCircleId( self: Self, circleId: str ) -> None:
"""Set circle Id variable.

Args:
circleId (str): circle Id.
circleId (str): Circle Id.
"""
self.m_circleId = circleId
self.circleId = circleId

def getCircleId( self: Self ) -> str:
"""Access the Id of the Mohr circle.

Returns:
str: Id of the Mohr circle
"""
return self.m_circleId
return self.circleId

def getCircleRadius( self: Self ) -> float:
"""Compute and return Mohr's circle radius from principal components."""
return ( self.m_p1 - self.m_p3 ) / 2.0
"""Compute and return Mohr's circle radius from principal components.

Returns:
float: Mohr circle radius.
"""
return ( self.p1 - self.p3 ) / 2.0

def getCircleCenter( self: Self ) -> float:
"""Compute and return Mohr's circle center from principal components."""
return ( self.m_p1 + self.m_p3 ) / 2.0
"""Compute and return Mohr's circle center from principal components.

Returns:
float: Mohr circle center.
"""
return ( self.p1 + self.p3 ) / 2.0

def getPrincipalComponents( self: Self ) -> tuple[ float, float, float ]:
"""Get Moh's circle principal components."""
return ( self.m_p3, self.m_p2, self.m_p1 )
"""Get Moh's circle principal components.

Returns:
tuple[float, float, float]: Mohr circle principal components.
"""
return ( self.p3, self.p2, self.p1 )

def setPrincipalComponents( self: Self, p3: float, p2: float, p1: float ) -> None:
"""Set principal components.

Args:
p3 (float): first component. Must be the lowest.
p2 (float): second component.
p1 (float): third component. Must be the greatest.
p3 (float): First component. Must be the lowest.
p2 (float): Second component.
p1 (float): Third component. Must be the greatest.

Raises:
ValueError: Expected p3 <= p2 <= p1.
"""
assert ( p3 <= p2 ) and ( p2 <= p1 ), "Component order is wrong."
self.m_p3 = p3
self.m_p2 = p2
self.m_p1 = p1
if not ( ( p3 <= p2 ) and ( p2 <= p1 ) ):
raise ValueError( "Component order is wrong. Expected p3 <= p2 <= p1." )
self.p3 = p3
self.p2 = p2
self.p1 = p1

def computePrincipalComponents( self: Self, stressVector: npt.NDArray[ np.float64 ] ) -> None:
"""Calculate principal components.
Expand All @@ -111,5 +136,5 @@ def computePrincipalComponents( self: Self, stressVector: npt.NDArray[ np.float6
stressVector (npt.NDArray[np.float64]): 6 components stress vector
Stress vector must follow GEOS convention (XX, YY, ZZ, YZ, XZ, XY)
"""
# get stress principal components
self.m_p3, self.m_p2, self.m_p1 = ( computeStressPrincipalComponentsFromStressVector( stressVector ) )
# Get stress principal components
self.p3, self.p2, self.p1 = ( computeStressPrincipalComponentsFromStressVector( stressVector ) )
3 changes: 1 addition & 2 deletions geos-posp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include-package-data = true

[tool.setuptools.packages.find]
where = ["src"]
include = ["geos_posp*", "PVplugins*"]
include = ["geos_posp*"]
exclude = ['tests*']

[project]
Expand Down Expand Up @@ -90,5 +90,4 @@ source = ["geos-posp"]
omit = [
"*/pyvistaUtils/*",
"*/visu/*",
"*/PVplugins/*",
]
13 changes: 0 additions & 13 deletions geos-posp/src/PVplugins/__init__.py

This file was deleted.

Empty file removed geos-posp/src/PVplugins/py.typed
Empty file.
Loading