diff --git a/docs/geos_posp_docs/PVplugins.rst b/docs/geos_posp_docs/PVplugins.rst index 391c2632..66a3b583 100644 --- a/docs/geos_posp_docs/PVplugins.rst +++ b/docs/geos_posp_docs/PVplugins.rst @@ -5,59 +5,9 @@ Paraview plugins were developed using Python 3.9.13 and are compatible with Para 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 and cross plots using Paraview Python View. -PVExtractMergeBlocksVolume plugin -------------------------------------------- - -.. automodule:: PVplugins.PVExtractMergeBlocksVolume - - -PVExtractMergeBlocksVolumeSurface plugin --------------------------------------------------- - -.. automodule:: PVplugins.PVExtractMergeBlocksVolumeSurface - - -PVExtractMergeBlocksVolumeSurfaceWell plugin ------------------------------------------------------- - -.. automodule:: PVplugins.PVExtractMergeBlocksVolumeSurfaceWell - - -PVExtractMergeBlocksVolumeWell plugin ------------------------------------------------ - -.. automodule:: PVplugins.PVExtractMergeBlocksVolumeWell - -PVGeomechanicsWorkflowVolume plugin ---------------------------------------------- - -.. automodule:: PVplugins.PVGeomechanicsWorkflowVolume - - -PVGeomechanicsWorkflowVolumeSurface plugin ----------------------------------------------------- - -.. automodule:: PVplugins.PVGeomechanicsWorkflowVolumeSurface - - -PVGeomechanicsWorkflowVolumeSurfaceWell plugin --------------------------------------------------------- - -.. automodule:: PVplugins.PVGeomechanicsWorkflowVolumeSurfaceWell - - -PVGeomechanicsWorkflowVolumeWell plugin -------------------------------------------------- - -.. automodule:: PVplugins.PVGeomechanicsWorkflowVolumeWell - - PVMohrCirclePlot plugin --------------------------------- diff --git a/docs/geos_pv_docs/processing.rst b/docs/geos_pv_docs/processing.rst index 7b3753b6..726100fd 100644 --- a/docs/geos_pv_docs/processing.rst +++ b/docs/geos_pv_docs/processing.rst @@ -1,5 +1,12 @@ Post-/Pre-processing ========================= +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. + PVAttributeMapping -------------------- @@ -19,12 +26,6 @@ PVFillPartialArrays .. automodule:: geos.pv.plugins.PVFillPartialArrays -PVGeomechanicsCalculator plugin ---------------------------------------- - -.. automodule:: geos.pv.plugins.PVGeomechanicsCalculator - - PVSplitMesh ---------------------------------- @@ -41,3 +42,65 @@ PVClipToMainFrame ---------------------------------- .. automodule:: geos.pv.plugins.PVClipToMainFrame + + +Geos output pre-processing ++++++++++++++++++++++++++++++ + +PVExtractMergeBlocksVolume plugin +------------------------------------------- + +.. automodule:: geos.pv.plugins.PVExtractMergeBlocksVolume + + +PVExtractMergeBlocksVolumeSurface plugin +-------------------------------------------------- + +.. automodule:: geos.pv.plugins.PVExtractMergeBlocksVolumeSurface + + +PVExtractMergeBlocksVolumeSurfaceWell plugin +------------------------------------------------------ + +.. automodule:: geos.pv.plugins.PVExtractMergeBlocksVolumeSurfaceWell + + +PVExtractMergeBlocksVolumeWell plugin +----------------------------------------------- + +.. automodule:: geos.pv.plugins.PVExtractMergeBlocksVolumeWell + + + +Geomechanics workflows +++++++++++++++++++++++++ + + +PVGeomechanicsWorkflowVolume plugin +--------------------------------------------- + +.. automodule:: geos.pv.plugins.PVGeomechanicsWorkflowVolume + + +PVGeomechanicsWorkflowVolumeSurface plugin +---------------------------------------------------- + +.. automodule:: geos.pv.plugins.PVGeomechanicsWorkflowVolumeSurface + + +PVGeomechanicsWorkflowVolumeSurfaceWell plugin +-------------------------------------------------------- + +.. automodule:: geos.pv.plugins.PVGeomechanicsWorkflowVolumeSurfaceWell + + +PVGeomechanicsWorkflowVolumeWell plugin +------------------------------------------------- + +.. automodule:: geos.pv.plugins.PVGeomechanicsWorkflowVolumeWell + + +PVGeomechanicsCalculator plugin +--------------------------------------- + +.. automodule:: geos.pv.plugins.PVGeomechanicsCalculator \ No newline at end of file diff --git a/geos-posp/src/PVplugins/PVExtractMergeBlocksVolume.py b/geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolume.py similarity index 97% rename from geos-posp/src/PVplugins/PVExtractMergeBlocksVolume.py rename to geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolume.py index 17921902..ef97c659 100644 --- a/geos-posp/src/PVplugins/PVExtractMergeBlocksVolume.py +++ b/geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolume.py @@ -2,20 +2,20 @@ # SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies. # SPDX-FileContributor: Martin Lemay # ruff: noqa: E402 # disable Module level import not at top of file -import os import sys +from pathlib import Path import numpy as np import numpy.typing as npt from typing_extensions import Self from vtkmodules.vtkCommonCore import vtkInformation, vtkInformationVector from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet -dir_path = os.path.dirname( os.path.realpath( __file__ ) ) -parent_dir_path = os.path.dirname( dir_path ) -if parent_dir_path not in sys.path: - sys.path.append( parent_dir_path ) +# update sys.path to load all GEOS Python Package dependencies +geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent +sys.path.insert( 0, str( geos_pv_path / "src" ) ) +from geos.pv.utils.config import update_paths -import PVplugins # noqa: F401 +update_paths() from geos.utils.GeosOutputsConstants import ( GeosMeshOutputsEnum, @@ -28,7 +28,7 @@ copyAttribute, createCellCenterAttribute, ) -from geos_posp.visu.PVUtils.paraviewTreatments import getTimeStepIndex +from geos.pv.utils.paraviewTreatments import getTimeStepIndex from paraview.util.vtkAlgorithm import ( # type: ignore[import-not-found] VTKPythonAlgorithmBase, smdomain, smhint, smproperty, smproxy, ) diff --git a/geos-posp/src/PVplugins/PVExtractMergeBlocksVolumeSurface.py b/geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolumeSurface.py similarity index 97% rename from geos-posp/src/PVplugins/PVExtractMergeBlocksVolumeSurface.py rename to geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolumeSurface.py index f011f9d3..c9a27e53 100644 --- a/geos-posp/src/PVplugins/PVExtractMergeBlocksVolumeSurface.py +++ b/geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolumeSurface.py @@ -2,8 +2,8 @@ # SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies. # SPDX-FileContributor: Martin Lemay # ruff: noqa: E402 # disable Module level import not at top of file -import os import sys +from pathlib import Path import numpy as np import numpy.typing as npt @@ -11,12 +11,12 @@ from vtkmodules.vtkCommonCore import vtkInformation, vtkInformationVector from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet -dir_path = os.path.dirname( os.path.realpath( __file__ ) ) -parent_dir_path = os.path.dirname( dir_path ) -if parent_dir_path not in sys.path: - sys.path.append( parent_dir_path ) +# update sys.path to load all GEOS Python Package dependencies +geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent +sys.path.insert( 0, str( geos_pv_path / "src" ) ) +from geos.pv.utils.config import update_paths -import PVplugins # noqa: F401 +update_paths() from geos.utils.GeosOutputsConstants import ( GeosMeshOutputsEnum, @@ -29,7 +29,7 @@ copyAttribute, createCellCenterAttribute, ) -from geos_posp.visu.PVUtils.paraviewTreatments import getTimeStepIndex +from geos.pv.utils.paraviewTreatments import getTimeStepIndex from paraview.util.vtkAlgorithm import ( # type: ignore[import-not-found] VTKPythonAlgorithmBase, smdomain, smhint, smproperty, smproxy, ) diff --git a/geos-posp/src/PVplugins/PVExtractMergeBlocksVolumeSurfaceWell.py b/geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolumeSurfaceWell.py similarity index 97% rename from geos-posp/src/PVplugins/PVExtractMergeBlocksVolumeSurfaceWell.py rename to geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolumeSurfaceWell.py index c6bfabae..74710a34 100644 --- a/geos-posp/src/PVplugins/PVExtractMergeBlocksVolumeSurfaceWell.py +++ b/geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolumeSurfaceWell.py @@ -2,8 +2,8 @@ # SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies. # SPDX-FileContributor: Martin Lemay # ruff: noqa: E402 # disable Module level import not at top of file -import os import sys +from pathlib import Path import numpy as np import numpy.typing as npt @@ -11,12 +11,12 @@ from vtkmodules.vtkCommonCore import vtkInformation, vtkInformationVector from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet -dir_path = os.path.dirname( os.path.realpath( __file__ ) ) -parent_dir_path = os.path.dirname( dir_path ) -if parent_dir_path not in sys.path: - sys.path.append( parent_dir_path ) +# update sys.path to load all GEOS Python Package dependencies +geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent +sys.path.insert( 0, str( geos_pv_path / "src" ) ) +from geos.pv.utils.config import update_paths -import PVplugins # noqa: F401 +update_paths() from geos.utils.GeosOutputsConstants import ( GeosMeshOutputsEnum, @@ -29,7 +29,7 @@ copyAttribute, createCellCenterAttribute, ) -from geos_posp.visu.PVUtils.paraviewTreatments import getTimeStepIndex +from geos.pv.utils.paraviewTreatments import getTimeStepIndex from paraview.util.vtkAlgorithm import ( # type: ignore[import-not-found] VTKPythonAlgorithmBase, smdomain, smhint, smproperty, smproxy, ) diff --git a/geos-posp/src/PVplugins/PVExtractMergeBlocksVolumeWell.py b/geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolumeWell.py similarity index 97% rename from geos-posp/src/PVplugins/PVExtractMergeBlocksVolumeWell.py rename to geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolumeWell.py index 76287b52..4b7e4389 100644 --- a/geos-posp/src/PVplugins/PVExtractMergeBlocksVolumeWell.py +++ b/geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolumeWell.py @@ -2,8 +2,8 @@ # SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies. # SPDX-FileContributor: Martin Lemay # ruff: noqa: E402 # disable Module level import not at top of file -import os import sys +from pathlib import Path import numpy as np import numpy.typing as npt @@ -14,12 +14,12 @@ from vtkmodules.vtkCommonCore import vtkInformation, vtkInformationVector from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet -dir_path = os.path.dirname( os.path.realpath( __file__ ) ) -parent_dir_path = os.path.dirname( dir_path ) -if parent_dir_path not in sys.path: - sys.path.append( parent_dir_path ) +# update sys.path to load all GEOS Python Package dependencies +geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent +sys.path.insert( 0, str( geos_pv_path / "src" ) ) +from geos.pv.utils.config import update_paths -import PVplugins # noqa: F401 +update_paths() from geos.utils.GeosOutputsConstants import ( GeosMeshOutputsEnum, @@ -32,7 +32,7 @@ copyAttribute, createCellCenterAttribute, ) -from geos_posp.visu.PVUtils.paraviewTreatments import getTimeStepIndex +from geos.pv.utils.paraviewTreatments import getTimeStepIndex __doc__ = """ PVExtractMergeBlocksVolumeWell is a Paraview plugin that allows to merge diff --git a/geos-posp/src/PVplugins/PVGeomechanicsWorkflowVolume.py b/geos-pv/src/geos/pv/plugins/PVGeomechanicsWorkflowVolume.py similarity index 90% rename from geos-posp/src/PVplugins/PVGeomechanicsWorkflowVolume.py rename to geos-pv/src/geos/pv/plugins/PVGeomechanicsWorkflowVolume.py index b077fe7b..50a6a0f3 100644 --- a/geos-posp/src/PVplugins/PVGeomechanicsWorkflowVolume.py +++ b/geos-pv/src/geos/pv/plugins/PVGeomechanicsWorkflowVolume.py @@ -2,8 +2,8 @@ # SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies. # SPDX-FileContributor: Martin Lemay # ruff: noqa: E402 # disable Module level import not at top of file -import os import sys +from pathlib import Path import numpy as np from typing_extensions import Self @@ -11,12 +11,12 @@ from vtkmodules.vtkCommonDataModel import ( vtkMultiBlockDataSet, ) -dir_path = os.path.dirname( os.path.realpath( __file__ ) ) -parent_dir_path = os.path.dirname( dir_path ) -if parent_dir_path not in sys.path: - sys.path.append( parent_dir_path ) +# update sys.path to load all GEOS Python Package dependencies +geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent +sys.path.insert( 0, str( geos_pv_path / "src" ) ) +from geos.pv.utils.config import update_paths -import PVplugins # noqa: F401 +update_paths() from geos.utils.Logger import Logger, getLogger from geos.utils.PhysicalConstants import ( @@ -29,12 +29,9 @@ from paraview.util.vtkAlgorithm import ( # type: ignore[import-not-found] VTKPythonAlgorithmBase, smdomain, smhint, smproperty, smproxy, ) -from paraview.detail.loghandler import ( # type: ignore[import-not-found] - VTKHandler, -) # source: https://github.com/Kitware/ParaView/blob/master/Wrapping/Python/paraview/detail/loghandler.py -from PVplugins.PVExtractMergeBlocksVolume import PVExtractMergeBlocksVolume -from geos.processing.post_processing.GeomechanicsCalculator import GeomechanicsCalculator +from geos.pv.plugins.PVExtractMergeBlocksVolume import PVExtractMergeBlocksVolume +from geos.pv.plugins.PVGeomechanicsCalculator import PVGeomechanicsCalculator __doc__ = """ PVGeomechanicsWorkflowVolume is a Paraview plugin that execute multiple filters @@ -372,16 +369,14 @@ def computeAdditionalOutputsVolume( self: Self ) -> bool: Returns: bool: True if calculation successfully eneded, False otherwise. """ - filter = GeomechanicsCalculator( self.m_volumeMesh, - computeAdvancedOutputs=self.getComputeAdvancedOutputs(), - speHandler=True ) - if not filter.logger.hasHandlers(): - filter.setLoggerHandler( VTKHandler() ) - filter.physicalConstants.grainBulkModulus = self.grainBulkModulus - filter.physicalConstants.specificDensity = self.specificDensity - filter.physicalConstants.rockCohesion = self.rockCohesion - filter.physicalConstants.frictionAngle = self.frictionAngle - filter.applyFilter() - self.m_volumeMesh.ShallowCopy( filter.getOutput() ) + filter = PVGeomechanicsCalculator() + filter.SetInputDataObject( self.m_volumeMesh ), + filter.setComputeAdvancedProperties( self.getComputeAdvancedOutputs() ) + filter.setGrainBulkModulus( self.m_grainBulkModulus ) + filter.setSpecificDensity = ( self.m_specificDensity ) + filter.setRockCohesion = ( self.m_rockCohesion ) + filter.setFrictionAngle = ( self.m_frictionAngle ) + filter.Update() + self.m_volumeMesh.ShallowCopy( filter.GetOutputDataObject( 0 ) ) self.m_volumeMesh.Modified() return True diff --git a/geos-posp/src/PVplugins/PVGeomechanicsWorkflowVolumeSurface.py b/geos-pv/src/geos/pv/plugins/PVGeomechanicsWorkflowVolumeSurface.py similarity index 91% rename from geos-posp/src/PVplugins/PVGeomechanicsWorkflowVolumeSurface.py rename to geos-pv/src/geos/pv/plugins/PVGeomechanicsWorkflowVolumeSurface.py index 03024b83..c1370de6 100644 --- a/geos-posp/src/PVplugins/PVGeomechanicsWorkflowVolumeSurface.py +++ b/geos-pv/src/geos/pv/plugins/PVGeomechanicsWorkflowVolumeSurface.py @@ -2,8 +2,8 @@ # SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies. # SPDX-FileContributor: Martin Lemay # ruff: noqa: E402 # disable Module level import not at top of file -import os import sys +from pathlib import Path import numpy as np from typing_extensions import Self @@ -11,19 +11,16 @@ from vtkmodules.vtkCommonDataModel import ( vtkMultiBlockDataSet, ) -dir_path = os.path.dirname( os.path.realpath( __file__ ) ) -parent_dir_path = os.path.dirname( dir_path ) -if parent_dir_path not in sys.path: - sys.path.append( parent_dir_path ) +# update sys.path to load all GEOS Python Package dependencies +geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent +sys.path.insert( 0, str( geos_pv_path / "src" ) ) +from geos.pv.utils.config import update_paths -import PVplugins # noqa: F401 +update_paths() from paraview.util.vtkAlgorithm import ( # type: ignore[import-not-found] VTKPythonAlgorithmBase, smdomain, smhint, smproperty, smproxy, ) -from paraview.detail.loghandler import ( # type: ignore[import-not-found] - VTKHandler, -) # source: https://github.com/Kitware/ParaView/blob/master/Wrapping/Python/paraview/detail/loghandler.py from geos.utils.Logger import Logger, getLogger from geos.utils.PhysicalConstants import ( @@ -33,9 +30,9 @@ DEFAULT_ROCK_COHESION, WATER_DENSITY, ) -from PVplugins.PVExtractMergeBlocksVolumeSurface import ( +from geos.pv.plugins.PVExtractMergeBlocksVolumeSurface import ( PVExtractMergeBlocksVolumeSurface, ) -from geos.processing.post_processing.GeomechanicsCalculator import GeomechanicsCalculator +from geos.pv.plugins.PVGeomechanicsCalculator import PVGeomechanicsCalculator from geos.pv.plugins.PVSurfaceGeomechanics import PVSurfaceGeomechanics __doc__ = """ @@ -373,17 +370,15 @@ def computeAdditionalOutputsVolume( self: Self ) -> bool: Returns: bool: True if calculation successfully eneded, False otherwise. """ - filter = GeomechanicsCalculator( self.m_volumeMesh, - computeAdvancedOutputs=self.getComputeAdvancedOutputs(), - speHandler=True ) - if not filter.logger.hasHandlers(): - filter.setLoggerHandler( VTKHandler() ) - filter.physicalConstants.grainBulkModulus = self.grainBulkModulus - filter.physicalConstants.specificDensity = self.specificDensity - filter.physicalConstants.rockCohesion = self.rockCohesion - filter.physicalConstants.frictionAngle = self.frictionAngle - filter.applyFilter() - self.m_volumeMesh.ShallowCopy( filter.getOutput() ) + filter = PVGeomechanicsCalculator() + filter.SetInputDataObject( self.m_volumeMesh ), + filter.setComputeAdvancedProperties( self.getComputeAdvancedOutputs() ) + filter.setGrainBulkModulus( self.m_grainBulkModulus ) + filter.setSpecificDensity = ( self.m_specificDensity ) + filter.setRockCohesion = ( self.m_rockCohesion ) + filter.setFrictionAngle = ( self.m_frictionAngle ) + filter.Update() + self.m_volumeMesh.ShallowCopy( filter.GetOutputDataObject( 0 ) ) self.m_volumeMesh.Modified() return True diff --git a/geos-posp/src/PVplugins/PVGeomechanicsWorkflowVolumeSurfaceWell.py b/geos-pv/src/geos/pv/plugins/PVGeomechanicsWorkflowVolumeSurfaceWell.py similarity index 91% rename from geos-posp/src/PVplugins/PVGeomechanicsWorkflowVolumeSurfaceWell.py rename to geos-pv/src/geos/pv/plugins/PVGeomechanicsWorkflowVolumeSurfaceWell.py index 52cae47b..693c6055 100644 --- a/geos-posp/src/PVplugins/PVGeomechanicsWorkflowVolumeSurfaceWell.py +++ b/geos-pv/src/geos/pv/plugins/PVGeomechanicsWorkflowVolumeSurfaceWell.py @@ -2,8 +2,8 @@ # SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies. # SPDX-FileContributor: Martin Lemay # ruff: noqa: E402 # disable Module level import not at top of file -import os import sys +from pathlib import Path import numpy as np from typing_extensions import Self @@ -11,19 +11,16 @@ from vtkmodules.vtkCommonDataModel import ( vtkMultiBlockDataSet, ) -dir_path = os.path.dirname( os.path.realpath( __file__ ) ) -parent_dir_path = os.path.dirname( dir_path ) -if parent_dir_path not in sys.path: - sys.path.append( parent_dir_path ) +# update sys.path to load all GEOS Python Package dependencies +geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent +sys.path.insert( 0, str( geos_pv_path / "src" ) ) +from geos.pv.utils.config import update_paths -import PVplugins # noqa: F401 +update_paths() from paraview.util.vtkAlgorithm import ( # type: ignore[import-not-found] VTKPythonAlgorithmBase, smdomain, smhint, smproperty, smproxy, ) -from paraview.detail.loghandler import ( # type: ignore[import-not-found] - VTKHandler, -) # source: https://github.com/Kitware/ParaView/blob/master/Wrapping/Python/paraview/detail/loghandler.py from geos.utils.Logger import Logger, getLogger from geos.utils.PhysicalConstants import ( @@ -33,9 +30,9 @@ DEFAULT_ROCK_COHESION, WATER_DENSITY, ) -from PVplugins.PVExtractMergeBlocksVolumeSurfaceWell import ( +from geos.pv.plugins.PVExtractMergeBlocksVolumeSurfaceWell import ( PVExtractMergeBlocksVolumeSurfaceWell, ) -from geos.processing.post_processing.GeomechanicsCalculator import GeomechanicsCalculator +from geos.pv.plugins.PVGeomechanicsCalculator import PVGeomechanicsCalculator from geos.pv.plugins.PVSurfaceGeomechanics import PVSurfaceGeomechanics __doc__ = """ @@ -382,17 +379,15 @@ def computeAdditionalOutputsVolume( self: Self ) -> bool: Returns: bool: True if calculation successfully eneded, False otherwise. """ - filter = GeomechanicsCalculator( self.m_volumeMesh, - computeAdvancedOutputs=self.getComputeAdvancedOutputs(), - speHandler=True ) - if not filter.logger.hasHandlers(): - filter.setLoggerHandler( VTKHandler() ) - filter.physicalConstants.grainBulkModulus = self.grainBulkModulus - filter.physicalConstants.specificDensity = self.specificDensity - filter.physicalConstants.rockCohesion = self.rockCohesion - filter.physicalConstants.frictionAngle = self.frictionAngle - filter.applyFilter() - self.m_volumeMesh.ShallowCopy( filter.getOutput() ) + filter = PVGeomechanicsCalculator() + filter.SetInputDataObject( self.m_volumeMesh ), + filter.setComputeAdvancedProperties( self.getComputeAdvancedOutputs() ) + filter.setGrainBulkModulus( self.m_grainBulkModulus ) + filter.setSpecificDensity = ( self.m_specificDensity ) + filter.setRockCohesion = ( self.m_rockCohesion ) + filter.setFrictionAngle = ( self.m_frictionAngle ) + filter.Update() + self.m_volumeMesh.ShallowCopy( filter.GetOutputDataObject( 0 ) ) self.m_volumeMesh.Modified() return True diff --git a/geos-posp/src/PVplugins/PVGeomechanicsWorkflowVolumeWell.py b/geos-pv/src/geos/pv/plugins/PVGeomechanicsWorkflowVolumeWell.py similarity index 91% rename from geos-posp/src/PVplugins/PVGeomechanicsWorkflowVolumeWell.py rename to geos-pv/src/geos/pv/plugins/PVGeomechanicsWorkflowVolumeWell.py index 0d5829dd..1e7c9980 100644 --- a/geos-posp/src/PVplugins/PVGeomechanicsWorkflowVolumeWell.py +++ b/geos-pv/src/geos/pv/plugins/PVGeomechanicsWorkflowVolumeWell.py @@ -2,8 +2,8 @@ # SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies. # SPDX-FileContributor: Martin Lemay # ruff: noqa: E402 # disable Module level import not at top of file -import os import sys +from pathlib import Path import numpy as np from typing_extensions import Self @@ -11,19 +11,16 @@ from vtkmodules.vtkCommonDataModel import ( vtkMultiBlockDataSet, ) -dir_path = os.path.dirname( os.path.realpath( __file__ ) ) -parent_dir_path = os.path.dirname( dir_path ) -if parent_dir_path not in sys.path: - sys.path.append( parent_dir_path ) +# update sys.path to load all GEOS Python Package dependencies +geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent +sys.path.insert( 0, str( geos_pv_path / "src" ) ) +from geos.pv.utils.config import update_paths -import PVplugins # noqa: F401 +update_paths() from paraview.util.vtkAlgorithm import ( # type: ignore[import-not-found] VTKPythonAlgorithmBase, smdomain, smhint, smproperty, smproxy, ) -from paraview.detail.loghandler import ( # type: ignore[import-not-found] - VTKHandler, -) # source: https://github.com/Kitware/ParaView/blob/master/Wrapping/Python/paraview/detail/loghandler.py from geos.utils.Logger import Logger, getLogger from geos.utils.PhysicalConstants import ( @@ -34,9 +31,9 @@ WATER_DENSITY, ) -from PVplugins.PVExtractMergeBlocksVolumeWell import ( +from geos.pv.plugins.PVExtractMergeBlocksVolumeWell import ( PVExtractMergeBlocksVolumeWell, ) -from geos.processing.post_processing.GeomechanicsCalculator import GeomechanicsCalculator +from geos.pv.plugins.PVGeomechanicsCalculator import PVGeomechanicsCalculator __doc__ = """ PVGeomechanicsWorkflowVolumeWell is a Paraview plugin that execute @@ -387,16 +384,14 @@ def computeAdditionalOutputsVolume( self: Self ) -> bool: Returns: bool: True if calculation successfully eneded, False otherwise. """ - filter = GeomechanicsCalculator( self.m_volumeMesh, - computeAdvancedOutputs=self.getComputeAdvancedOutputs(), - speHandler=True ) - if not filter.logger.hasHandlers(): - filter.setLoggerHandler( VTKHandler() ) - filter.physicalConstants.grainBulkModulus = self.grainBulkModulus - filter.physicalConstants.specificDensity = self.specificDensity - filter.physicalConstants.rockCohesion = self.rockCohesion - filter.physicalConstants.frictionAngle = self.frictionAngle - filter.applyFilter() - self.m_volumeMesh.ShallowCopy( filter.getOutput() ) + filter = PVGeomechanicsCalculator() + filter.SetInputDataObject( self.m_volumeMesh ), + filter.setComputeAdvancedProperties( self.getComputeAdvancedOutputs() ) + filter.setGrainBulkModulus( self.m_grainBulkModulus ) + filter.setSpecificDensity = ( self.m_specificDensity ) + filter.setRockCohesion = ( self.m_rockCohesion ) + filter.setFrictionAngle = ( self.m_frictionAngle ) + filter.Update() + self.m_volumeMesh.ShallowCopy( filter.GetOutputDataObject( 0 ) ) self.m_volumeMesh.Modified() return True diff --git a/geos-pv/src/geos/pv/utils/paraviewTreatments.py b/geos-pv/src/geos/pv/utils/paraviewTreatments.py index 2856aee7..98ad009a 100644 --- a/geos-pv/src/geos/pv/utils/paraviewTreatments.py +++ b/geos-pv/src/geos/pv/utils/paraviewTreatments.py @@ -133,7 +133,7 @@ def vtkUnstructuredGridCellsToDataframe( grid: vtkUnstructuredGrid ) -> pd.DataF grid = idFilter.GetOutput() cellData = grid.GetCellData() # Update cellData to point to the new grid's cell data cellIdAttributeName = "GlobalCellIds" - assert cellData.HasArray(cellIdAttributeName), "Invalid global ids array name selected." + assert cellData.HasArray( cellIdAttributeName ), "Invalid global ids array name selected." numberCells: int = grid.GetNumberOfCells() data: dict[ str, Any ] = {}