├── .github └── workflows │ ├── ci.yaml │ └── publish.yaml ├── .gitignore ├── LICENSE.md ├── README.rst ├── examples ├── example01.py ├── example02.py └── script_template.py ├── other_files ├── figures │ ├── output_example_Fs-min.svg │ ├── output_example_Fs.svg │ └── slope_geometry.svg ├── pyCSSmanualSpanish.pdf └── validations │ ├── Validation-01.svg │ ├── Validation-01.txt │ ├── Validation-02.svg │ ├── Validation-02.txt │ ├── Validation-03.svg │ ├── Validation-03.txt │ ├── Validation-04.svg │ ├── Validation-04.txt │ ├── Validation-05.svg │ ├── Validation-05.txt │ ├── externalValidationFiles │ ├── validation02-comparisonUSarmyCorpsOfEngineers.xlsx │ ├── validation04-noSubmergedSlope.slim │ └── validation05-partiallySubmergedSlope.slim │ ├── validation01-comparisonChang1992.py │ ├── validation02-comparisonUSarmyCorpsOfEngineers.py │ ├── validation03-comparisonZhao.etal.,2014.py │ ├── validation04-noSubmergedSlope.py │ └── validation05-partiallySubmergedSlope.py ├── package_test ├── Example-01.svg ├── Example-01.txt └── example01.py ├── pycss_lem ├── __init__.py ├── automaticslipcircles.py ├── azimuthangle.py ├── circleby2ptsradius.py ├── create2dsegmentstructure.py ├── defineslipcircle.py ├── defineswatertable.py ├── divideslipintoslices.py ├── extractplinefrom2pts.py ├── interatefbishopsimpsat.py ├── interateffelleniussat.py ├── materialboundary.py ├── obtainmaxdepthdist.py ├── onlyonecircle.py ├── plotslice.py ├── polyarea.py ├── pyCSS.py ├── reportslicestructurevalues.py ├── sliparcdiscretization.py ├── tangentlineatcirclept.py ├── terrainsurface.py ├── uniquewithtolerance.py ├── unitvector.py └── vertprojection2pline.py ├── pyproject.toml └── requirements.txt /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: CI/CD 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | defaults: 7 | run: 8 | shell: bash 9 | 10 | jobs: 11 | run-examples: 12 | runs-on: ubuntu-latest 13 | strategy: 14 | matrix: 15 | python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11-dev"] 16 | fail-fast: false 17 | 18 | steps: 19 | - uses: actions/checkout@v3 20 | 21 | - name: Set up Python 22 | uses: actions/setup-python@v4 23 | with: 24 | python-version: ${{ matrix.python-version }} 25 | 26 | - uses: actions/cache@v3 27 | id: cache 28 | with: 29 | path: ${{ env.pythonLocation }} 30 | key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test-v01 31 | 32 | - name: Install dependencies 33 | if: steps.cache.outputs.cache-hit != 'true' 34 | run: | 35 | python -m pip install -U pip 36 | pip install -e . 37 | 38 | - name: Run examples in Python-${{ matrix.python-version }} 39 | run: | 40 | python3 examples/example01.py 41 | python3 examples/example02.py 42 | 43 | - uses: actions/upload-artifact@v3 44 | with: 45 | name: py-${{ matrix.python-version }} 46 | path: examples/ 47 | -------------------------------------------------------------------------------- /.github/workflows/publish.yaml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | release: 5 | types: 6 | - created 7 | 8 | jobs: 9 | publish: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v3 13 | 14 | - name: Set up Python 15 | uses: actions/setup-python@v4 16 | with: 17 | python-version: "3.7" 18 | 19 | - uses: actions/cache@v3 20 | id: cache 21 | with: 22 | path: ${{ env.pythonLocation }} 23 | key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish 24 | 25 | - name: Install build dependencies 26 | if: steps.cache.outputs.cache-hit != 'true' 27 | run: python -m pip install --upgrade build 28 | 29 | - name: Build distribution 30 | run: python -m build 31 | 32 | - name: Publish 33 | uses: pypa/gh-action-pypi-publish@v1.5.1 34 | with: 35 | password: ${{ secrets.AUTO_PACKAGE_WITH_RELEASE }} 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | 131 | # vscode 132 | .vscode 133 | 134 | # Specific files 135 | /notebooks/mesh.geo 136 | /notebooks/mesh.msh 137 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # BSD 2 license 2 | 3 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 4 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | 1. Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | 14 | 2. Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 19 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 25 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 26 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Circular Slope Stability PyProgram (pyCSS) 2 | ========================================== 3 | 4 | It is an open-source program written in Python for 2D slope stability analysis of circular surfaces by the limit equilibrium method (Fellenius and Bishop methods). 5 | 6 | .. image:: https://raw.githubusercontent.com/eamontoyaa/pyCSS/master/other_files/figures/output_example_Fs.svg 7 | :width: 500 8 | :alt: Assessment of a single potential circular failure surface 9 | 10 | .. image:: https://raw.githubusercontent.com/eamontoyaa/pyCSS/master/other_files/figures/output_example_Fs-min.svg 11 | :width: 500 12 | :alt: Assessment of a multiple potential circular failure surface for getting the minimum Fs 13 | 14 | Downloading the program 15 | ----------------------- 16 | 17 | To install **pyCSS v0.1.0** from PyPI, run this command in your terminal: 18 | 19 | .. code-block:: console 20 | 21 | pip install pycss-lem 22 | 23 | Also, you can clone the original repo directory (release v0.0.9) using git: 24 | 25 | .. code-block:: console 26 | 27 | git clone https://github.com/eamontoyaa/pyCSS/ --branch v0.0.9 28 | 29 | or directly use the download options from GitHub. 30 | 31 | Installing dependencies 32 | ----------------------- 33 | 34 | The program has been tested in Python ≥3.6. It is suggested to create a virtual environment to use the program. 35 | 36 | From release v0.1.0, the program is expected to install its dependencies automatically. If this does not happen, please follow the instructions as for previous releases: 37 | 38 | Download the `requirements.txt` file. In the same directory, type and execute the following line in your terminal: 39 | 40 | .. code-block:: console 41 | 42 | python3 -m pip install -r requirements.txt 43 | 44 | Usage 45 | ----- 46 | 47 | Release v0.1.0+ 48 | ^^^^^^^^^^^^^^^ 49 | 50 | Please, refer to `this notebook `_ prepared 51 | for the Slope Stability class at EAFIT University (Colombia). There, you will find a series of commented code blocks to carry out a stability assessment 52 | using **pyCSS**. 53 | 54 | You can run the program by editing the `script_template.py` file located in the `./examples/` directory of the installation folder. 55 | Use the examples located in the same folder as an input guide. 56 | Then, save the script wherever you need it to be saved, and run it by typing the following line from the terminal: 57 | 58 | .. code-block:: console 59 | 60 | python3 script_template.py 61 | 62 | **Note:** the graphical user interface is not yet available from release v0.1.0. 63 | 64 | 65 | Release v0.0.9 66 | ^^^^^^^^^^^^^^ 67 | 68 | You can run the program via GUI by typing the following line in the root directory: 69 | 70 | .. code-block:: console 71 | 72 | python3 pyCSS.py 73 | 74 | Or editing the `finalModule.py` file located in the root directory and running it: 75 | 76 | .. code-block:: console 77 | 78 | python3 finalModule.py 79 | 80 | You can test the program by runing the files in the `/examples` folder. 81 | 82 | .. code-block:: console 83 | 84 | cd examples/ 85 | python3 example01.py 86 | 87 | 88 | If the example runs successfully, the program will create two files. One is a graphical output of the slope and the stability analysis. The second file is a text file with a summary of the run. 89 | 90 | 91 | Documentation 92 | ------------- 93 | 94 | Please refer to the user manual `user manual for release v0.0.9 `_ to learn more. Currently, the manual is in Spanish, but in the future, we will translate it to English. 95 | 96 | Citation 97 | -------- 98 | 99 | To cite **pyCSS** in publications, use: 100 | 101 | Suarez-Burgoa, Ludger O., and Exneyder A. Montoya-Araque. 2016. 102 | “Programa en código abierto para el análisis bidimensional de estabilidad 103 | de taludes por el método de equilibrio límite.” Revista de La Facultad 104 | de Ciencias 5 (2): 88–104. . 105 | 106 | A BibTeX entry for LaTeX users is: 107 | 108 | .. code:: bibtex 109 | 110 | @article{SuarezBurgoa_MontoyaAraque_2016_art, 111 | doi = {10.15446/rev.fac.cienc.v5n2.59914}, 112 | journal = {Revista de la Facultad de Ciencias}, 113 | keywords = {C{\'{o}}digo fuente libre,an{\'{a}}lisis de estabilidad de taludes,m{\'{e}}todo de Bishop,m{\'{e}}todo de equilibrio l{\'{i}}mite}, 114 | month = {jul}, 115 | number = {2}, 116 | pages = {88--104}, 117 | title = {{Programa en c{\'{o}}digo abierto para el an{\'{a}}lisis bidimensional de estabilidad de taludes por el m{\'{e}}todo de equilibrio l{\'{i}}mite}}, 118 | volume = {5}, 119 | year = {2016} 120 | } 121 | 122 | -------------------------------------------------------------------------------- /examples/example01.py: -------------------------------------------------------------------------------- 1 | ''' 2 | # Description. 3 | This is a minimal module in order to perform a circular arc slope stability 4 | analysis for the example number 01. # 5 | ''' 6 | 7 | #-----------------------------------------------------------------------------# 8 | ## Modules/Functions import 9 | import numpy as np 10 | import time 11 | 12 | from pycss_lem import get_fos 13 | 14 | #-----------------------------------------------------------------------------# 15 | ### Poject data ### 16 | projectName = 'Example-01' 17 | projectAuthor = 'Exneyder A. Montoya Araque' 18 | projectDate = time.strftime("%d/%m/%y") 19 | 20 | #-----------------------------------------------------------------------------# 21 | ### Previous calculations ### 22 | segmentAC = 40/np.sin(np.radians(30)) 23 | 24 | ### Define inputs ### 25 | # The slope geometry # 26 | slopeHeight = [40, 'ft'] 27 | slopeDip = np.array([1, np.tan(np.radians(45))]) 28 | crownDist = [30, 'ft'] 29 | toeDist = [30, 'ft'] 30 | wantAutomaticToeDepth = False 31 | toeDepth = [10, 'ft'] 32 | # The slip arc-circle # 33 | hztDistPointAtCrownFromCrown = [40/np.tan(np.radians(45))-\ 34 | 40/np.tan(np.radians(30)), 'ft'] 35 | hztDistPointAtToeFromCrown = [40/np.tan(np.radians(45)), 'ft'] 36 | slipRadius = [0.5*80/np.sin(0.5*np.radians(70)), 'ft'] 37 | # Watertable # 38 | wantWatertable = False 39 | wtDepthAtCrown = ['No watertable'] 40 | toeUnderWatertable = False 41 | # Materials properties # 42 | waterUnitWeight = [62.4, 'pcf'] 43 | materialUnitWeight = [115, 'pcf'] 44 | frictionAngleGrad = [20, 'degrees'] 45 | cohesion = [400, 'psf'] 46 | 47 | ### Advanced inputs ### 48 | # Want divide the slip surface in constant width slices? # 49 | wantConstSliceWidthTrue = True 50 | # Number of discretizations of slip surface. # 51 | numSlices = 15 52 | # Number of discretizations of circular arcs. # 53 | nDivs = numSlices 54 | # Select the method to calcualte the safety factor ['Flns', 'Bshp' or 'Allm'] # 55 | methodString = 'Allm' 56 | # Select the output format image ['.eps', '.jpeg', '.jpg', '.pdf', '.pgf', \ # 57 | # '.png', '.ps', '.raw', '.rgba', '.svg', '.svgz', '.tif', '.tiff']. # 58 | outputFormatImg = '.svg' 59 | 60 | #-----------------------------------------------------------------------------# 61 | # Operations for only one slip surface # 62 | msg = get_fos( 63 | projectName, 64 | projectAuthor, 65 | projectDate, 66 | slopeHeight, 67 | slopeDip, 68 | crownDist, 69 | toeDist, 70 | wantAutomaticToeDepth, 71 | toeDepth, 72 | hztDistPointAtCrownFromCrown, 73 | hztDistPointAtToeFromCrown, 74 | slipRadius, 75 | wantWatertable, 76 | wtDepthAtCrown, 77 | toeUnderWatertable, 78 | waterUnitWeight, 79 | materialUnitWeight, 80 | frictionAngleGrad, 81 | cohesion, 82 | wantConstSliceWidthTrue, 83 | numSlices, 84 | nDivs, 85 | methodString, 86 | outputFormatImg 87 | ) 88 | 89 | ''' 90 | BSD 2 license. 91 | 92 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 93 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 94 | All rights reserved. 95 | 96 | Redistribution and use in source and binary forms, with or without 97 | modification, are permitted provided that the following conditions are 98 | met: 99 | 100 | 1. Redistributions of source code must retain the above copyright notice, 101 | this list of conditions and the following disclaimer. 102 | 103 | 2. Redistributions in binary form must reproduce the above copyright 104 | notice, this list of conditions and the following disclaimer in the 105 | documentation and/or other materials provided with the distribution. 106 | 107 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 108 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 109 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 110 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 111 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 112 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 113 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 114 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 115 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 116 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 117 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 118 | ''' 119 | -------------------------------------------------------------------------------- /examples/example02.py: -------------------------------------------------------------------------------- 1 | ''' 2 | # Description. 3 | This is a minimal module in order to perform a circular arc slope stability 4 | analysis for the example number 02. # 5 | ''' 6 | 7 | #-----------------------------------------------------------------------------# 8 | ## Modules/Functions import 9 | import numpy as np 10 | import time 11 | 12 | from pycss_lem import get_fos 13 | 14 | #-----------------------------------------------------------------------------# 15 | ### Poject data ### 16 | projectName = 'Example-02' 17 | projectAuthor = 'Exneyder A. Montoya Araque' 18 | projectDate = time.strftime("%d/%m/%y") 19 | 20 | #-----------------------------------------------------------------------------# 21 | ### Previous calculations ### 22 | waterUnitWeight = [9.8, 'kN/m3'] 23 | materialDryUnitWeight = [13, 'kN/m3'] 24 | specificGravity = 2.4 25 | moisture = 0.18 26 | voidRatio = (waterUnitWeight[0]*specificGravity/materialDryUnitWeight[0])-1 27 | materialUnitWeight = [specificGravity*(1+moisture)*waterUnitWeight[0]/\ 28 | (1+voidRatio), 'kN/m3'] 29 | materialSatUnitWeight = [(specificGravity+voidRatio)*waterUnitWeight[0]/\ 30 | (1+voidRatio), 'kN/m3'] 31 | 32 | ### Define inputs ### 33 | # The slope geometry # 34 | slopeHeight = [11.5, 'm'] 35 | slopeDip = np.array([3, 8]) 36 | crownDist = [15, 'm'] 37 | toeDist = [15, 'm'] 38 | wantAutomaticToeDepth = True 39 | toeDepth = ['automatic toe Depth'] 40 | # The slip arc-circle # 41 | hztDistPointAtCrownFromCrown = [-11, 'm'] 42 | hztDistPointAtToeFromCrown = [13.5, 'm'] 43 | slipRadius = [15.6, 'm'] 44 | # Water table depth # 45 | wantWatertable = True 46 | wtDepthAtCrown = [3.7, 'm'] 47 | toeUnderWatertable = False 48 | # Materials properties # 49 | waterUnitWeight = waterUnitWeight[:] 50 | materialUnitWeight = materialSatUnitWeight[:] 51 | frictionAngleGrad = [21, 'degrees'] 52 | cohesion = [4.5, 'kPa'] 53 | 54 | ### Advanced inputs ### 55 | # Want divide the slip surface in constant width slices? # 56 | wantConstSliceWidthTrue = True 57 | # Number of discretizations of slip surface. # 58 | numSlices = 10 59 | # Number of discretizations of circular arcs. # 60 | nDivs = numSlices 61 | # Select the method to calcualte the safety factor ['Flns', 'Bshp' or 'Allm'] # 62 | methodString = 'Bshp' 63 | # Select the output format image ['.eps', '.jpeg', '.jpg', '.pdf', '.pgf', \ # 64 | # '.png', '.ps', '.raw', '.rgba', '.svg', '.svgz', '.tif', '.tiff']. # 65 | outputFormatImg = '.svg' 66 | 67 | #-----------------------------------------------------------------------------# 68 | # Operations for only one slip surface # 69 | msg = get_fos( 70 | projectName, 71 | projectAuthor, 72 | projectDate, 73 | slopeHeight, 74 | slopeDip, 75 | crownDist, 76 | toeDist, 77 | wantAutomaticToeDepth, 78 | toeDepth, 79 | hztDistPointAtCrownFromCrown, 80 | hztDistPointAtToeFromCrown, 81 | slipRadius, 82 | wantWatertable, 83 | wtDepthAtCrown, 84 | toeUnderWatertable, 85 | waterUnitWeight, 86 | materialUnitWeight, 87 | frictionAngleGrad, 88 | cohesion, 89 | wantConstSliceWidthTrue, 90 | numSlices, 91 | nDivs, 92 | methodString, 93 | outputFormatImg 94 | ) 95 | 96 | ''' 97 | BSD 2 license. 98 | 99 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 100 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 101 | All rights reserved. 102 | 103 | Redistribution and use in source and binary forms, with or without 104 | modification, are permitted provided that the following conditions are 105 | met: 106 | 107 | 1. Redistributions of source code must retain the above copyright notice, 108 | this list of conditions and the following disclaimer. 109 | 110 | 2. Redistributions in binary form must reproduce the above copyright 111 | notice, this list of conditions and the following disclaimer in the 112 | documentation and/or other materials provided with the distribution. 113 | 114 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 115 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 116 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 117 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 118 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 119 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 120 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 121 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 122 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 123 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 124 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 125 | ''' 126 | -------------------------------------------------------------------------------- /examples/script_template.py: -------------------------------------------------------------------------------- 1 | ''' 2 | # Description. 3 | This is a minimal module in order to perform a circular arc slope stability 4 | analysis by the limit equilibrium model by Fellenius and Bishop symplified 5 | methods. 6 | ''' 7 | 8 | import numpy as np 9 | import time 10 | 11 | from pycss_lem import get_fos, get_min_fos 12 | 13 | #------------------------------------------------------------------------------ 14 | ## Poject data 15 | projectName = '' 16 | projectAuthor = '' 17 | projectDate = time.strftime("%d/%m/%y") 18 | 19 | #------------------------------------------------------------------------------ 20 | ## Define inputs 21 | # The slope geometry 22 | slopeHeight = [, ''] 23 | slopeDip = np.array([, ]) 24 | crownDist = [, ''] 25 | toeDist = [, ''] 26 | wantAutomaticToeDepth = True 27 | if wantAutomaticToeDepth == True: 28 | toeDepth = ['automatic toe Depth'] 29 | else: 30 | toeDepth = [, ''] 31 | # The slip arc-circle 32 | wantEvaluateOnlyOneSurface = False 33 | if wantEvaluateOnlyOneSurface == True: 34 | hztDistPointAtCrownFromCrown = [, ''] 35 | hztDistPointAtToeFromCrown = [, ''] 36 | slipRadius = [, ''] 37 | else: 38 | numCircles = 39 | radiusIncrement = [, ''] 40 | numberIncrements = 41 | maxFsValueCont = 42 | # Watertable 43 | wantWatertable = True 44 | if wantWatertable == True: 45 | wtDepthAtCrown = [, ''] 46 | else: 47 | wtDepthAtCrown = ['No watertable'] 48 | toeUnderWatertable = False 49 | # Materials properties. 50 | waterUnitWeight = [, ''] 51 | materialUnitWeight = [, ''] 52 | frictionAngleGrad = [, ''] 53 | cohesion = [, ''] 54 | 55 | ## Advanced inputs 56 | # Want divide the slip surface in constant width slices? 57 | wantConstSliceWidthTrue = True 58 | # Number of discretizations of slip surface. 59 | numSlices = 15 60 | # Number of discretizations of circular arcs. 61 | nDivs = numSlices 62 | # Select the method to calcualte the safety factor ['Flns', 'Bshp' or 'Allm']. 63 | methodString = 'Allm' 64 | # Select the output format image #['.eps', '.jpeg', '.jpg', '.pdf', '.pgf', \ 65 | # '.png', '.ps', '.raw', '.rgba', '.svg', '.svgz', '.tif', '.tiff']. 66 | outputFormatImg = '.svg' 67 | 68 | #------------------------------------------------------------------------------ 69 | # Operations for only one slip surface 70 | if wantEvaluateOnlyOneSurface: 71 | msg = get_fos( 72 | projectName, 73 | projectAuthor, 74 | projectDate, 75 | slopeHeight, 76 | slopeDip, 77 | crownDist, 78 | toeDist, 79 | wantAutomaticToeDepth, 80 | toeDepth, 81 | hztDistPointAtCrownFromCrown, 82 | hztDistPointAtToeFromCrown, 83 | slipRadius, 84 | wantWatertable, 85 | wtDepthAtCrown, 86 | toeUnderWatertable, 87 | waterUnitWeight, 88 | materialUnitWeight, 89 | frictionAngleGrad, 90 | cohesion, 91 | wantConstSliceWidthTrue, 92 | numSlices, 93 | nDivs, 94 | methodString, 95 | outputFormatImg 96 | ) 97 | 98 | #------------------------------------------------------------------------------ 99 | # Operations for multiple slip surface 100 | else: 101 | get_min_fos( 102 | projectName, 103 | projectAuthor, 104 | projectDate, 105 | slopeHeight, 106 | slopeDip, 107 | crownDist, 108 | toeDist, 109 | wantAutomaticToeDepth, 110 | toeDepth, 111 | numCircles, 112 | radiusIncrement, 113 | numberIncrements, 114 | maxFsValueCont, 115 | wantWatertable, 116 | wtDepthAtCrown, 117 | toeUnderWatertable, 118 | waterUnitWeight, 119 | materialUnitWeight, 120 | frictionAngleGrad, 121 | cohesion, 122 | wantConstSliceWidthTrue, 123 | numSlices, 124 | nDivs, 125 | methodString, 126 | outputFormatImg 127 | ) 128 | 129 | ''' 130 | BSD 2 license. 131 | 132 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 133 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 134 | All rights reserved. 135 | 136 | Redistribution and use in source and binary forms, with or without 137 | modification, are permitted provided that the following conditions are 138 | met: 139 | 140 | 1. Redistributions of source code must retain the above copyright notice, 141 | this list of conditions and the following disclaimer. 142 | 143 | 2. Redistributions in binary form must reproduce the above copyright 144 | notice, this list of conditions and the following disclaimer in the 145 | documentation and/or other materials provided with the distribution. 146 | 147 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 148 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 149 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 150 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 151 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 152 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 153 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 154 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 155 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 156 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 157 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 158 | ''' 159 | -------------------------------------------------------------------------------- /other_files/pyCSSmanualSpanish.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eamontoyaa/pyCSS/f62a6239d8f173c0aa7ac3959123a88117b4cc15/other_files/pyCSSmanualSpanish.pdf -------------------------------------------------------------------------------- /other_files/validations/Validation-01.txt: -------------------------------------------------------------------------------- 1 | ---SUMMARY OF PROJECT--- 2 | 3 | Project name: Validation-01 4 | Author: Exneyder A. Montoya Araque 5 | Date: 06/05/16 6 | Safety factors: 7 | -Fellenius method: 1.94362485125 8 | -Bishop method: 2.09590467259 9 | 10 | --Slope geometry-- 11 | Height: 40 ft 12 | Dip: 31.3008270055 degrees 13 | Crown distance: 60 ft 14 | Toe distance: 20 ft 15 | Toe depth: 20 ft 16 | Surface coordinates: 17 | [[ 0. 60.] 18 | [ 60. 60.] 19 | [ 140. 20.] 20 | [ 160. 20.]] 21 | 22 | --Watertable geometry-- 23 | Depth at crown: 60 ft 24 | Is the slope partially submerged? No 25 | Watertable coordinates: 26 | [[ 0. 0.] 27 | [ 160. 0.]] 28 | 29 | --Slip circle-- 30 | Radius: 80 ft 31 | Center coordinates: [ 120. 90.] 32 | 33 | --Materials properties-- 34 | Water unit weight: 62.4 pcf 35 | Soil unit weight: 120 pcf 36 | Friction angle 20 degrees 37 | Cohesion: 600 psf 38 | 39 | --Slices data-- 40 | Number of slices: 10 41 | Has the surface slip constant width slices? No 42 | 43 | Slices structures data: 44 | [['Index' 'Abscissa' 'Ordinate' 'Area' 'Width' 'Height' 45 | 'Secant Angle Grad at Bottom' 'Angle Grad at Top' 'Water Height' 46 | 'Water Height Above Slope' 'Horizontal Moment Arm' 'Vertical Moment Arm'] 47 | ['0.0' '51.5' '50.3' '109.9' '11.3' '9.7' '59.9' '-0.0' '0.0' '0.0' 48 | '-68.5' '30.0'] 49 | ['1.0' '58.6' '38.8' '60.9' '2.9' '21.2' '50.2' '-0.0' '0.0' '0.0' '-61.4' 50 | '30.0'] 51 | ['2.0' '64.2' '33.0' '209.8' '8.4' '24.9' '44.4' '26.6' '0.0' '0.0' 52 | '-55.8' '32.1'] 53 | ['3.0' '74.1' '24.9' '317.2' '11.3' '28.1' '35.2' '26.6' '0.0' '0.0' 54 | '-45.9' '37.0'] 55 | ['4.0' '85.4' '18.2' '329.2' '11.3' '29.2' '25.8' '26.6' '0.0' '0.0' 56 | '-34.6' '42.7'] 57 | ['5.0' '96.6' '13.7' '315.7' '11.3' '28.0' '17.0' '26.6' '0.0' '0.0' 58 | '-23.4' '48.3'] 59 | ['6.0' '107.9' '11.1' '281.3' '11.3' '24.9' '8.7' '26.6' '0.0' '0.0' 60 | '-12.1' '54.0'] 61 | ['7.0' '119.2' '10.2' '227.9' '11.3' '20.2' '0.6' '26.6' '0.0' '0.0' 62 | '-0.8' '59.6'] 63 | ['8.0' '130.5' '10.9' '156.3' '11.3' '13.8' '-7.6' '26.6' '0.0' '0.0' 64 | '10.5' '65.3'] 65 | ['9.0' '138.1' '12.1' '34.1' '3.8' '8.9' '-13.1' '26.6' '0.0' '0.0' '18.1' 66 | '69.0'] 67 | ['10.0' '143.7' '13.7' '46.9' '7.4' '6.3' '-17.3' '-0.0' '0.0' '0.0' 68 | '23.7' '70.0'] 69 | ['11.0' '153.1' '17.4' '29.1' '11.3' '2.6' '-24.5' '-0.0' '0.0' '0.0' 70 | '33.1' '70.0']] 71 | 72 | Note: This program calculated the safety factor to circular slip, 73 | under limit equilibrium considerations, using Fellenius and Bishop 74 | methods. The imagen attached shows the calculation performed. 75 | 76 | This program is distributed in the hope that it will be useful, 77 | but WITHOUT ANY WARRANTY; without even the implied warranty of 78 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -------------------------------------------------------------------------------- /other_files/validations/Validation-02.txt: -------------------------------------------------------------------------------- 1 | ---SUMMARY OF PROJECT--- 2 | 3 | Project name: Validation-02 4 | Author: Exneyder A. Montoya Araque 5 | Date: 06/05/16 6 | Safety factors: 7 | -Fellenius method: 2.12594476815 8 | -Bishop method: 2.24951727747 9 | 10 | --Slope geometry-- 11 | Height: 50 ft 12 | Dip: 14.5213463629 degrees 13 | Crown distance: 15 ft 14 | Toe distance: 15 ft 15 | Toe depth: 10 ft 16 | Surface coordinates: 17 | [[ 0. 60. ] 18 | [ 15. 60. ] 19 | [ 216.43529412 10. ] 20 | [ 231.43529412 10. ]] 21 | 22 | --Watertable geometry-- 23 | Depth at crown: 30 ft 24 | Is the slope partially submerged? Yes 25 | Watertable coordinates: 26 | [[ 0. 30. ] 27 | [ 231.43529412 30. ]] 28 | 29 | --Slip circle-- 30 | Radius: 169 ft 31 | Center coordinates: [ 135.33785938 178.65833136] 32 | 33 | --Materials properties-- 34 | Water unit weight: 62.4 pcf 35 | Soil unit weight: 115 pcf 36 | Friction angle 25 degrees 37 | Cohesion: 200 psf 38 | 39 | --Slices data-- 40 | Number of slices: 6 41 | Has the surface slip constant width slices? Yes 42 | 43 | Slices structures data: 44 | [['Index' 'Abscissa' 'Ordinate' 'Area' 'Width' 'Height' 45 | 'Secant Angle Grad at Bottom' 'Angle Grad at Top' 'Water Height' 46 | 'Water Height Above Slope' 'Horizontal Moment Arm' 'Vertical Moment Arm'] 47 | ['0.0' '29.3' '48.4' '230.4' '28.5' '8.1' '39.2' '13.9' '0.0' '0.0' 48 | '-106.1' '122.2'] 49 | ['1.0' '57.8' '29.4' '571.3' '28.5' '20.0' '27.4' '13.9' '0.6' '0.0' 50 | '-77.5' '129.3'] 51 | ['2.0' '86.3' '17.6' '704.5' '28.5' '24.7' '16.9' '13.9' '12.4' '0.0' 52 | '-49.0' '136.4'] 53 | ['3.0' '114.9' '11.5' '676.0' '28.5' '23.7' '7.0' '13.9' '18.5' '0.0' 54 | '-20.5' '143.4'] 55 | ['4.0' '143.4' '10.5' '504.2' '28.5' '17.7' '-2.7' '13.9' '19.5' '1.9' 56 | '8.1' '150.5'] 57 | ['5.0' '172.0' '14.3' '191.8' '28.5' '6.7' '-12.6' '13.9' '15.7' '9.0' 58 | '36.6' '157.6']] 59 | 60 | Note: This program calculated the safety factor to circular slip, 61 | under limit equilibrium considerations, using Fellenius and Bishop 62 | methods. The imagen attached shows the calculation performed. 63 | 64 | This program is distributed in the hope that it will be useful, 65 | but WITHOUT ANY WARRANTY; without even the implied warranty of 66 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -------------------------------------------------------------------------------- /other_files/validations/Validation-03.txt: -------------------------------------------------------------------------------- 1 | ---SUMMARY OF PROJECT--- 2 | 3 | Project name: Validation-03 4 | Author: Exneyder A. Montoya Araque 5 | Date: 06/05/16 6 | Safety factors: 7 | -Fellenius method: 0.966546341911 8 | -Bishop method: 0.991935135839 9 | 10 | --Slope geometry-- 11 | Height: 10 m 12 | Dip: 31.3008270055 degrees 13 | Crown distance: 5 m 14 | Toe distance: 5 m 15 | Toe depth: 3 m 16 | Surface coordinates: 17 | [[ 3.55271368e-15 1.30000000e+01] 18 | [ 5.00000000e+00 1.30000000e+01] 19 | [ 2.50000000e+01 3.00000000e+00] 20 | [ 3.00000000e+01 3.00000000e+00]] 21 | 22 | --Watertable geometry-- 23 | Depth at crown: 13 m 24 | Is the slope partially submerged? No 25 | Watertable coordinates: 26 | [[ 3.55271368e-15 0.00000000e+00] 27 | [ 3.00000000e+01 0.00000000e+00]] 28 | 29 | --Slip circle-- 30 | Radius: 34.95 m 31 | Center coordinates: [ 27.57060747 37.85533642] 32 | 33 | --Materials properties-- 34 | Water unit weight: 0 kN/m3 35 | Soil unit weight: 20 kN/m3 36 | Friction angle 19.6 degrees 37 | Cohesion: 3 kPa 38 | 39 | --Slices data-- 40 | Number of slices: 15 41 | Has the surface slip constant width slices? No 42 | 43 | Slices structures data: 44 | [['Index' 'Abscissa' 'Ordinate' 'Area' 'Width' 'Height' 45 | 'Secant Angle Grad at Bottom' 'Angle Grad at Top' 'Water Height' 46 | 'Water Height Above Slope' 'Horizontal Moment Arm' 'Vertical Moment Arm'] 47 | ['0.0' '3.7' '12.3' '1.0' '1.5' '0.7' '43.0' '-0.0' '0.0' '0.0' '-23.8' 48 | '24.9'] 49 | ['1.0' '4.7' '11.4' '0.9' '0.5' '1.6' '40.8' '-0.0' '0.0' '0.0' '-22.8' 50 | '24.9'] 51 | ['2.0' '5.5' '10.8' '1.8' '0.9' '2.0' '39.2' '26.6' '0.0' '0.0' '-22.1' 52 | '25.1'] 53 | ['3.0' '6.7' '9.9' '3.4' '1.5' '2.3' '36.7' '26.6' '0.0' '0.0' '-20.9' 54 | '25.7'] 55 | ['4.0' '8.1' '8.8' '3.8' '1.5' '2.6' '33.8' '26.6' '0.0' '0.0' '-19.4' 56 | '26.4'] 57 | ['5.0' '9.6' '7.9' '4.1' '1.5' '2.8' '31.0' '26.6' '0.0' '0.0' '-18.0' 58 | '27.2'] 59 | ['6.0' '11.1' '7.1' '4.3' '1.5' '2.9' '28.2' '26.6' '0.0' '0.0' '-16.5' 60 | '27.9'] 61 | ['7.0' '12.5' '6.3' '4.3' '1.5' '2.9' '25.5' '26.6' '0.0' '0.0' '-15.0' 62 | '28.6'] 63 | ['8.0' '14.0' '5.7' '4.2' '1.5' '2.8' '22.9' '26.6' '0.0' '0.0' '-13.6' 64 | '29.4'] 65 | ['9.0' '15.5' '5.1' '3.9' '1.5' '2.7' '20.3' '26.6' '0.0' '0.0' '-12.1' 66 | '30.1'] 67 | ['10.0' '16.9' '4.6' '3.6' '1.5' '2.5' '17.7' '26.6' '0.0' '0.0' '-10.6' 68 | '30.8'] 69 | ['11.0' '18.4' '4.1' '3.2' '1.5' '2.2' '15.2' '26.6' '0.0' '0.0' '-9.2' 70 | '31.6'] 71 | ['12.0' '19.9' '3.8' '2.6' '1.5' '1.8' '12.7' '26.6' '0.0' '0.0' '-7.7' 72 | '32.3'] 73 | ['13.0' '21.3' '3.5' '2.0' '1.5' '1.4' '10.3' '26.6' '0.0' '0.0' '-6.2' 74 | '33.0'] 75 | ['14.0' '22.8' '3.2' '1.3' '1.5' '0.9' '7.8' '26.6' '0.0' '0.0' '-4.8' 76 | '33.8'] 77 | ['15.0' '24.3' '3.1' '0.4' '1.5' '0.3' '5.4' '26.6' '0.0' '0.0' '-3.3' 78 | '34.5']] 79 | 80 | Note: This program calculated the safety factor to circular slip, 81 | under limit equilibrium considerations, using Fellenius and Bishop 82 | methods. The imagen attached shows the calculation performed. 83 | 84 | This program is distributed in the hope that it will be useful, 85 | but WITHOUT ANY WARRANTY; without even the implied warranty of 86 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -------------------------------------------------------------------------------- /other_files/validations/Validation-04.txt: -------------------------------------------------------------------------------- 1 | ---SUMMARY OF PROJECT--- 2 | 3 | Project name: Validation-04 4 | Author: Exneyder A. Montoya Araque 5 | Date: 06/05/16 6 | Safety factors: 7 | -Fellenius method: 0.749683161791 8 | -Bishop method: 0.735820172098 9 | 10 | --Slope geometry-- 11 | Height: 10 m 12 | Dip: 31.3008270055 degrees 13 | Crown distance: 5 m 14 | Toe distance: 5 m 15 | Toe depth: 3 m 16 | Surface coordinates: 17 | [[ 3.55271368e-15 1.30000000e+01] 18 | [ 5.00000000e+00 1.30000000e+01] 19 | [ 2.50000000e+01 3.00000000e+00] 20 | [ 3.00000000e+01 3.00000000e+00]] 21 | 22 | --Watertable geometry-- 23 | Depth at crown: 5 m 24 | Is the slope partially submerged? No 25 | Watertable coordinates: 26 | [[ 3.55271368e-15 8.00000000e+00] 27 | [ 1.50000000e+01 8.00000000e+00] 28 | [ 2.50000000e+01 3.00000000e+00] 29 | [ 3.00000000e+01 3.00000000e+00]] 30 | 31 | --Slip circle-- 32 | Radius: 34.95 m 33 | Center coordinates: [ 27.57060747 37.85533642] 34 | 35 | --Materials properties-- 36 | Water unit weight: 9.81 kN/m3 37 | Soil unit weight: 20 kN/m3 38 | Friction angle 19.6 degrees 39 | Cohesion: 3 kPa 40 | 41 | --Slices data-- 42 | Number of slices: 15 43 | Has the surface slip constant width slices? Yes 44 | 45 | Slices structures data: 46 | [['Index' 'Abscissa' 'Ordinate' 'Area' 'Width' 'Height' 47 | 'Secant Angle Grad at Bottom' 'Angle Grad at Top' 'Water Height' 48 | 'Water Height Above Slope' 'Horizontal Moment Arm' 'Vertical Moment Arm'] 49 | ['0.0' '3.7' '12.3' '1.0' '1.5' '0.7' '43.0' '-0.0' '0.0' '0.0' '-23.8' 50 | '24.9'] 51 | ['1.0' '5.2' '11.0' '2.7' '1.5' '1.8' '39.8' '17.7' '0.0' '0.0' '-22.4' 52 | '25.0'] 53 | ['2.0' '6.7' '9.9' '3.4' '1.5' '2.3' '36.7' '26.6' '0.0' '0.0' '-20.9' 54 | '25.7'] 55 | ['3.0' '8.1' '8.8' '3.8' '1.5' '2.6' '33.8' '26.6' '0.0' '0.0' '-19.4' 56 | '26.4'] 57 | ['4.0' '9.6' '7.9' '4.1' '1.5' '2.8' '31.0' '26.6' '0.1' '0.0' '-18.0' 58 | '27.2'] 59 | ['5.0' '11.1' '7.1' '4.3' '1.5' '2.9' '28.2' '26.6' '0.9' '0.0' '-16.5' 60 | '27.9'] 61 | ['6.0' '12.5' '6.3' '4.3' '1.5' '2.9' '25.5' '26.6' '1.7' '0.0' '-15.0' 62 | '28.6'] 63 | ['7.0' '14.0' '5.7' '4.2' '1.5' '2.8' '22.9' '26.6' '2.3' '0.0' '-13.6' 64 | '29.4'] 65 | ['8.0' '15.5' '5.1' '3.9' '1.5' '2.7' '20.3' '26.6' '2.6' '0.0' '-12.1' 66 | '30.1'] 67 | ['9.0' '16.9' '4.6' '3.6' '1.5' '2.5' '17.7' '26.6' '2.5' '0.0' '-10.6' 68 | '30.8'] 69 | ['10.0' '18.4' '4.1' '3.2' '1.5' '2.2' '15.2' '26.6' '2.2' '0.0' '-9.2' 70 | '31.6'] 71 | ['11.0' '19.9' '3.8' '2.6' '1.5' '1.8' '12.7' '26.6' '1.8' '0.0' '-7.7' 72 | '32.3'] 73 | ['12.0' '21.3' '3.5' '2.0' '1.5' '1.4' '10.3' '26.6' '1.4' '0.0' '-6.2' 74 | '33.0'] 75 | ['13.0' '22.8' '3.2' '1.3' '1.5' '0.9' '7.8' '26.6' '0.9' '0.0' '-4.8' 76 | '33.8'] 77 | ['14.0' '24.3' '3.1' '0.4' '1.5' '0.3' '5.4' '26.6' '0.3' '0.0' '-3.3' 78 | '34.5']] 79 | 80 | Note: This program calculated the safety factor to circular slip, 81 | under limit equilibrium considerations, using Fellenius and Bishop 82 | methods. The imagen attached shows the calculation performed. 83 | 84 | This program is distributed in the hope that it will be useful, 85 | but WITHOUT ANY WARRANTY; without even the implied warranty of 86 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -------------------------------------------------------------------------------- /other_files/validations/Validation-05.txt: -------------------------------------------------------------------------------- 1 | ---SUMMARY OF PROJECT--- 2 | 3 | Project name: Validation-05 4 | Author: Exneyder A. Montoya Araque 5 | Date: 06/05/16 6 | Safety factors: 7 | -Fellenius method: 0.962223775503 8 | -Bishop method: 1.00379027165 9 | 10 | --Slope geometry-- 11 | Height: 10 m 12 | Dip: 31.3008270055 degrees 13 | Crown distance: 5 m 14 | Toe distance: 5 m 15 | Toe depth: 3 m 16 | Surface coordinates: 17 | [[ 3.55271368e-15 1.30000000e+01] 18 | [ 5.00000000e+00 1.30000000e+01] 19 | [ 2.50000000e+01 3.00000000e+00] 20 | [ 3.00000000e+01 3.00000000e+00]] 21 | 22 | --Watertable geometry-- 23 | Depth at crown: 5 m 24 | Is the slope partially submerged? Yes 25 | Watertable coordinates: 26 | [[ 3.55271368e-15 8.00000000e+00] 27 | [ 3.00000000e+01 8.00000000e+00]] 28 | 29 | --Slip circle-- 30 | Radius: 34.95 m 31 | Center coordinates: [ 27.57060747 37.85533642] 32 | 33 | --Materials properties-- 34 | Water unit weight: 9.81 kN/m3 35 | Soil unit weight: 20 kN/m3 36 | Friction angle 19.6 degrees 37 | Cohesion: 3 kPa 38 | 39 | --Slices data-- 40 | Number of slices: 15 41 | Has the surface slip constant width slices? Yes 42 | 43 | Slices structures data: 44 | [['Index' 'Abscissa' 'Ordinate' 'Area' 'Width' 'Height' 45 | 'Secant Angle Grad at Bottom' 'Angle Grad at Top' 'Water Height' 46 | 'Water Height Above Slope' 'Horizontal Moment Arm' 'Vertical Moment Arm'] 47 | ['0.0' '3.7' '12.3' '1.0' '1.5' '0.7' '43.0' '-0.0' '0.0' '0.0' '-23.8' 48 | '24.9'] 49 | ['1.0' '5.2' '11.0' '2.7' '1.5' '1.8' '39.8' '17.7' '0.0' '0.0' '-22.4' 50 | '25.0'] 51 | ['2.0' '6.7' '9.9' '3.4' '1.5' '2.3' '36.7' '26.6' '0.0' '0.0' '-20.9' 52 | '25.7'] 53 | ['3.0' '8.1' '8.8' '3.8' '1.5' '2.6' '33.8' '26.6' '0.0' '0.0' '-19.4' 54 | '26.4'] 55 | ['4.0' '9.6' '7.9' '4.1' '1.5' '2.8' '31.0' '26.6' '0.1' '0.0' '-18.0' 56 | '27.2'] 57 | ['5.0' '11.1' '7.1' '4.3' '1.5' '2.9' '28.2' '26.6' '0.9' '0.0' '-16.5' 58 | '27.9'] 59 | ['6.0' '12.5' '6.3' '4.3' '1.5' '2.9' '25.5' '26.6' '1.7' '0.0' '-15.0' 60 | '28.6'] 61 | ['7.0' '14.0' '5.7' '4.2' '1.5' '2.8' '22.9' '26.6' '2.3' '0.0' '-13.6' 62 | '29.4'] 63 | ['8.0' '15.5' '5.1' '3.9' '1.5' '2.7' '20.3' '26.6' '2.9' '0.2' '-12.1' 64 | '30.1'] 65 | ['9.0' '16.9' '4.6' '3.6' '1.5' '2.5' '17.7' '26.6' '3.4' '1.0' '-10.6' 66 | '30.8'] 67 | ['10.0' '18.4' '4.1' '3.2' '1.5' '2.2' '15.2' '26.6' '3.9' '1.7' '-9.2' 68 | '31.6'] 69 | ['11.0' '19.9' '3.8' '2.6' '1.5' '1.8' '12.7' '26.6' '4.2' '2.4' '-7.7' 70 | '32.3'] 71 | ['12.0' '21.3' '3.5' '2.0' '1.5' '1.4' '10.3' '26.6' '4.5' '3.2' '-6.2' 72 | '33.0'] 73 | ['13.0' '22.8' '3.2' '1.3' '1.5' '0.9' '7.8' '26.6' '4.8' '3.9' '-4.8' 74 | '33.8'] 75 | ['14.0' '24.3' '3.1' '0.4' '1.5' '0.3' '5.4' '26.6' '4.9' '4.6' '-3.3' 76 | '34.5']] 77 | 78 | Note: This program calculated the safety factor to circular slip, 79 | under limit equilibrium considerations, using Fellenius and Bishop 80 | methods. The imagen attached shows the calculation performed. 81 | 82 | This program is distributed in the hope that it will be useful, 83 | but WITHOUT ANY WARRANTY; without even the implied warranty of 84 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -------------------------------------------------------------------------------- /other_files/validations/externalValidationFiles/validation02-comparisonUSarmyCorpsOfEngineers.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eamontoyaa/pyCSS/f62a6239d8f173c0aa7ac3959123a88117b4cc15/other_files/validations/externalValidationFiles/validation02-comparisonUSarmyCorpsOfEngineers.xlsx -------------------------------------------------------------------------------- /other_files/validations/externalValidationFiles/validation04-noSubmergedSlope.slim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eamontoyaa/pyCSS/f62a6239d8f173c0aa7ac3959123a88117b4cc15/other_files/validations/externalValidationFiles/validation04-noSubmergedSlope.slim -------------------------------------------------------------------------------- /other_files/validations/externalValidationFiles/validation05-partiallySubmergedSlope.slim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eamontoyaa/pyCSS/f62a6239d8f173c0aa7ac3959123a88117b4cc15/other_files/validations/externalValidationFiles/validation05-partiallySubmergedSlope.slim -------------------------------------------------------------------------------- /other_files/validations/validation01-comparisonChang1992.py: -------------------------------------------------------------------------------- 1 | ''' 2 | # Description. 3 | This is a minimal module in order to perform a circular arc slope stability 4 | analysis by the limit equilibrium model by Fellenius and Bishop symplified 5 | methods. 6 | ''' 7 | 8 | #------------------------------------------------------------------------------ 9 | ## Add functions directory 10 | import sys 11 | sys.path += ['../functions'] 12 | 13 | #------------------------------------------------------------------------------ 14 | ## Modules/Functions import 15 | import numpy as np 16 | import time 17 | 18 | from automaticslipcircles import automaticslipcircles 19 | from onlyonecircle import onlyonecircle 20 | 21 | #------------------------------------------------------------------------------ 22 | ## Poject data 23 | projectName = 'Validation-01' 24 | projectAuthor = 'Exneyder A. Montoya Araque' 25 | projectDate = time.strftime("%d/%m/%y") 26 | 27 | #------------------------------------------------------------------------------ 28 | ## Define inputs 29 | # The slope geometry 30 | slopeHeight = [40, 'ft'] 31 | slopeDip = np.array([2, 1]) 32 | crownDist = [60, 'ft'] 33 | toeDist = [20, 'ft'] 34 | wantAutomaticToeDepth = False 35 | if wantAutomaticToeDepth == True: 36 | toeDepth = ['automatic toe Depth'] 37 | else: 38 | toeDepth = [20, 'ft'] 39 | # The slip arc-circle 40 | wantEvaluateOnlyOneSurface = True 41 | if wantEvaluateOnlyOneSurface == True: 42 | hztDistPointAtCrownFromCrown = [10*(12-np.sqrt(55))-60, 'ft'] 43 | hztDistPointAtToeFromCrown = [10*(12+np.sqrt(15))-60, 'ft'] 44 | slipRadius = [80, 'ft'] 45 | else: 46 | numCircles = 1000 47 | radiusIncrement = [4, 'm'] 48 | numberIncrements = 30 49 | maxFsValueCont = 3 50 | # Watertable 51 | wantWatertable = False 52 | if wantWatertable == True: 53 | wtDepthAtCrown = [0, 'ft'] 54 | else: 55 | wtDepthAtCrown = ['No watertable'] 56 | toeUnderWatertable = False 57 | # Materials properties. 58 | waterUnitWeight = [62.4, 'pcf'] 59 | materialUnitWeight = [120, 'pcf'] 60 | frictionAngleGrad = [20, 'degrees'] 61 | cohesion = [600, 'psf'] 62 | 63 | ## Advanced inputs 64 | # Want divide the slip surface in constant width slices? 65 | wantConstSliceWidthTrue = False 66 | # Number of discretizations of slip surface. 67 | numSlices = 10 68 | # Number of discretizations of circular arcs. 69 | nDivs = numSlices 70 | # Select the method to calcualte the safety factor ['Flns', 'Bshp' or 'Allm']. 71 | methodString = 'Allm' 72 | # Select the output format image #['.eps', '.jpeg', '.jpg', '.pdf', '.pgf', \ 73 | # '.png', '.ps', '.raw', '.rgba', '.svg', '.svgz', '.tif', '.tiff']. 74 | outputFormatImg = '.svg' 75 | 76 | #------------------------------------------------------------------------------ 77 | # Operations for only one slip surface 78 | if wantEvaluateOnlyOneSurface == True: 79 | msg = onlyonecircle(projectName, projectAuthor, projectDate, slopeHeight, \ 80 | slopeDip, crownDist, toeDist, wantAutomaticToeDepth, toeDepth, \ 81 | hztDistPointAtCrownFromCrown, hztDistPointAtToeFromCrown, \ 82 | slipRadius, wantWatertable, wtDepthAtCrown, toeUnderWatertable, \ 83 | waterUnitWeight, materialUnitWeight, frictionAngleGrad, cohesion, \ 84 | wantConstSliceWidthTrue, numSlices, nDivs, methodString, \ 85 | outputFormatImg) 86 | #------------------------------------------------------------------------------ 87 | # Operations for multiple slip surface 88 | else: 89 | automaticslipcircles(projectName, projectAuthor, projectDate, slopeHeight,\ 90 | slopeDip, crownDist, toeDist, wantAutomaticToeDepth, toeDepth, \ 91 | numCircles, radiusIncrement, numberIncrements, maxFsValueCont, \ 92 | wantWatertable, wtDepthAtCrown, toeUnderWatertable, waterUnitWeight, \ 93 | materialUnitWeight, frictionAngleGrad, cohesion, \ 94 | wantConstSliceWidthTrue, numSlices, nDivs, methodString, \ 95 | outputFormatImg) 96 | ''' 97 | BSD 2 license. 98 | 99 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 100 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 101 | All rights reserved. 102 | 103 | Redistribution and use in source and binary forms, with or without 104 | modification, are permitted provided that the following conditions are 105 | met: 106 | 107 | 1. Redistributions of source code must retain the above copyright notice, 108 | this list of conditions and the following disclaimer. 109 | 110 | 2. Redistributions in binary form must reproduce the above copyright 111 | notice, this list of conditions and the following disclaimer in the 112 | documentation and/or other materials provided with the distribution. 113 | 114 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 115 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 116 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 117 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 118 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 119 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 120 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 121 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 122 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 123 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 124 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 125 | ''' 126 | -------------------------------------------------------------------------------- /other_files/validations/validation02-comparisonUSarmyCorpsOfEngineers.py: -------------------------------------------------------------------------------- 1 | ''' 2 | # Description. 3 | This is a minimal module in order to perform a circular arc slope stability 4 | analysis by the limit equilibrium model by Fellenius and Bishop symplified 5 | methods. 6 | ''' 7 | 8 | #------------------------------------------------------------------------------ 9 | ## Add functions directory 10 | import sys 11 | sys.path += ['../functions'] 12 | 13 | #------------------------------------------------------------------------------ 14 | ## Modules/Functions import 15 | import numpy as np 16 | import time 17 | 18 | from automaticslipcircles import automaticslipcircles 19 | from onlyonecircle import onlyonecircle 20 | 21 | #------------------------------------------------------------------------------ 22 | ## Poject data 23 | projectName = 'Validation-02' 24 | projectAuthor = 'Exneyder A. Montoya Araque' 25 | projectDate = time.strftime("%d/%m/%y") 26 | 27 | #------------------------------------------------------------------------------ 28 | ## Define inputs 29 | # The slope geometry 30 | slopeHeight = [50, 'ft'] 31 | slopeDip = np.array([171.22, 42.5]) 32 | crownDist = [15, 'ft'] 33 | toeDist = [15, 'ft'] 34 | wantAutomaticToeDepth = False 35 | if wantAutomaticToeDepth == True: 36 | toeDepth = ['automatic toe Depth'] 37 | else: 38 | toeDepth = [10, 'ft'] 39 | # The slip arc-circle 40 | wantEvaluateOnlyOneSurface = True 41 | if wantEvaluateOnlyOneSurface == True: 42 | hztDistPointAtCrownFromCrown = [0, 'ft'] 43 | hztDistPointAtToeFromCrown = [171.22, 'ft'] 44 | slipRadius = [169, 'ft'] 45 | else: 46 | numCircles = 1000 47 | radiusIncrement = [4, 'm'] 48 | numberIncrements = 30 49 | maxFsValueCont = 3 50 | # Watertable 51 | wantWatertable = True 52 | if wantWatertable == True: 53 | wtDepthAtCrown = [30, 'ft'] 54 | else: 55 | wtDepthAtCrown = ['No watertable'] 56 | toeUnderWatertable = True 57 | # Materials properties. 58 | waterUnitWeight = [62.4, 'pcf'] 59 | materialUnitWeight = [115, 'pcf'] 60 | frictionAngleGrad = [25, 'degrees'] 61 | cohesion = [200, 'psf'] 62 | 63 | ## Advanced inputs 64 | # Want divide the slip surface in constant width slices? 65 | wantConstSliceWidthTrue = True 66 | # Number of discretizations of slip surface. 67 | numSlices = 6 68 | # Number of discretizations of circular arcs. 69 | nDivs = numSlices 70 | # Select the method to calcualte the safety factor ['Flns', 'Bshp' or 'Allm']. 71 | methodString = 'Allm' 72 | # Select the output format image #['.eps', '.jpeg', '.jpg', '.pdf', '.pgf', \ 73 | # '.png', '.ps', '.raw', '.rgba', '.svg', '.svgz', '.tif', '.tiff']. 74 | outputFormatImg = '.svg' 75 | 76 | #------------------------------------------------------------------------------ 77 | # Operations for only one slip surface 78 | if wantEvaluateOnlyOneSurface == True: 79 | msg = onlyonecircle(projectName, projectAuthor, projectDate, slopeHeight, \ 80 | slopeDip, crownDist, toeDist, wantAutomaticToeDepth, toeDepth, \ 81 | hztDistPointAtCrownFromCrown, hztDistPointAtToeFromCrown, \ 82 | slipRadius, wantWatertable, wtDepthAtCrown, toeUnderWatertable, \ 83 | waterUnitWeight, materialUnitWeight, frictionAngleGrad, cohesion, \ 84 | wantConstSliceWidthTrue, numSlices, nDivs, methodString, \ 85 | outputFormatImg) 86 | 87 | #------------------------------------------------------------------------------ 88 | # Operations for multiple slip surface 89 | else: 90 | automaticslipcircles(projectName, projectAuthor, projectDate, slopeHeight,\ 91 | slopeDip, crownDist, toeDist, wantAutomaticToeDepth, toeDepth, \ 92 | numCircles, radiusIncrement, numberIncrements, maxFsValueCont, \ 93 | wantWatertable, wtDepthAtCrown, toeUnderWatertable, waterUnitWeight, \ 94 | materialUnitWeight, frictionAngleGrad, cohesion, \ 95 | wantConstSliceWidthTrue, numSlices, nDivs, methodString, \ 96 | outputFormatImg) 97 | ''' 98 | BSD 2 license. 99 | 100 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 101 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 102 | All rights reserved. 103 | 104 | Redistribution and use in source and binary forms, with or without 105 | modification, are permitted provided that the following conditions are 106 | met: 107 | 108 | 1. Redistributions of source code must retain the above copyright notice, 109 | this list of conditions and the following disclaimer. 110 | 111 | 2. Redistributions in binary form must reproduce the above copyright 112 | notice, this list of conditions and the following disclaimer in the 113 | documentation and/or other materials provided with the distribution. 114 | 115 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 116 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 117 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 118 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 119 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 120 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 121 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 122 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 123 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 124 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 125 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 126 | ''' 127 | -------------------------------------------------------------------------------- /other_files/validations/validation03-comparisonZhao.etal.,2014.py: -------------------------------------------------------------------------------- 1 | ''' 2 | # Description. 3 | This is a minimal module in order to perform a circular arc slope stability 4 | analysis by the limit equilibrium model by Fellenius and Bishop symplified 5 | methods. 6 | ''' 7 | 8 | #------------------------------------------------------------------------------ 9 | ## Add functions directory 10 | import sys 11 | sys.path += ['../functions'] 12 | 13 | #------------------------------------------------------------------------------ 14 | ## Modules/Functions import 15 | import numpy as np 16 | import time 17 | 18 | from automaticslipcircles import automaticslipcircles 19 | from onlyonecircle import onlyonecircle 20 | 21 | #------------------------------------------------------------------------------ 22 | ## Poject data 23 | projectName = 'Validation-03' 24 | projectAuthor = 'Exneyder A. Montoya Araque' 25 | projectDate = time.strftime("%d/%m/%y") 26 | 27 | #------------------------------------------------------------------------------ 28 | ## Define inputs 29 | # The slope geometry 30 | slopeHeight = [10, 'm'] 31 | slopeDip = np.array([2, 1]) 32 | crownDist = [5, 'm'] 33 | toeDist = [5, 'm'] 34 | wantAutomaticToeDepth = False 35 | if wantAutomaticToeDepth == True: 36 | toeDepth = ['automatic toe Depth'] 37 | else: 38 | toeDepth = [3, 'm'] 39 | # The slip arc-circle 40 | wantEvaluateOnlyOneSurface = True 41 | if wantEvaluateOnlyOneSurface == True: 42 | hztDistPointAtCrownFromCrown = [-2, 'm'] 43 | hztDistPointAtToeFromCrown = [20, 'm'] 44 | slipRadius = [34.95, 'm'] 45 | else: 46 | numCircles = 2000 47 | radiusIncrement = [2, 'm'] 48 | numberIncrements = 40 49 | maxFsValueCont = 2 50 | # Watertable 51 | wantWatertable = False 52 | if wantWatertable == True: 53 | wtDepthAtCrown = [0, 'm'] 54 | else: 55 | wtDepthAtCrown = ['No watertable'] 56 | toeUnderWatertable = False 57 | # Materials properties. 58 | waterUnitWeight = [0, 'kN/m3'] 59 | materialUnitWeight = [20, 'kN/m3'] 60 | frictionAngleGrad = [19.6, 'degrees'] 61 | cohesion = [3, 'kPa'] 62 | 63 | ## Advanced inputs 64 | # Want divide the slip surface in constant width slices? 65 | wantConstSliceWidthTrue = False 66 | # Number of discretizations of slip surface. 67 | numSlices = 15 68 | # Number of discretizations of circular arcs. 69 | nDivs = numSlices 70 | # Select the method to calcualte the safety factor ['Flns', 'Bshp' or 'Allm']. 71 | methodString = 'Allm' 72 | # Select the output format image #['.eps', '.jpeg', '.jpg', '.pdf', '.pgf', \ 73 | # '.png', '.ps', '.raw', '.rgba', '.svg', '.svgz', '.tif', '.tiff']. 74 | outputFormatImg = '.svg' 75 | 76 | #------------------------------------------------------------------------------ 77 | # Operations for only one slip surface 78 | if wantEvaluateOnlyOneSurface == True: 79 | msg = onlyonecircle(projectName, projectAuthor, projectDate, slopeHeight, \ 80 | slopeDip, crownDist, toeDist, wantAutomaticToeDepth, toeDepth, \ 81 | hztDistPointAtCrownFromCrown, hztDistPointAtToeFromCrown, \ 82 | slipRadius, wantWatertable, wtDepthAtCrown, toeUnderWatertable, \ 83 | waterUnitWeight, materialUnitWeight, frictionAngleGrad, cohesion, \ 84 | wantConstSliceWidthTrue, numSlices, nDivs, methodString, \ 85 | outputFormatImg) 86 | 87 | #------------------------------------------------------------------------------ 88 | # Operations for multiple slip surface 89 | else: 90 | automaticslipcircles(projectName, projectAuthor, projectDate, slopeHeight,\ 91 | slopeDip, crownDist, toeDist, wantAutomaticToeDepth, toeDepth, \ 92 | numCircles, radiusIncrement, numberIncrements, maxFsValueCont, \ 93 | wantWatertable, wtDepthAtCrown, toeUnderWatertable, waterUnitWeight, \ 94 | materialUnitWeight, frictionAngleGrad, cohesion, \ 95 | wantConstSliceWidthTrue, numSlices, nDivs, methodString, \ 96 | outputFormatImg) 97 | ''' 98 | BSD 2 license. 99 | 100 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 101 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 102 | All rights reserved. 103 | 104 | Redistribution and use in source and binary forms, with or without 105 | modification, are permitted provided that the following conditions are 106 | met: 107 | 108 | 1. Redistributions of source code must retain the above copyright notice, 109 | this list of conditions and the following disclaimer. 110 | 111 | 2. Redistributions in binary form must reproduce the above copyright 112 | notice, this list of conditions and the following disclaimer in the 113 | documentation and/or other materials provided with the distribution. 114 | 115 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 116 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 117 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 118 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 119 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 120 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 121 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 122 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 123 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 124 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 125 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 126 | ''' 127 | -------------------------------------------------------------------------------- /other_files/validations/validation04-noSubmergedSlope.py: -------------------------------------------------------------------------------- 1 | ''' 2 | # Description. 3 | This is a minimal module in order to perform a circular arc slope stability 4 | analysis by the limit equilibrium model by Fellenius and Bishop symplified 5 | methods. 6 | ''' 7 | 8 | #------------------------------------------------------------------------------ 9 | ## Add functions directory 10 | import sys 11 | sys.path += ['../functions'] 12 | 13 | #------------------------------------------------------------------------------ 14 | ## Modules/Functions import 15 | import numpy as np 16 | import time 17 | 18 | from automaticslipcircles import automaticslipcircles 19 | from onlyonecircle import onlyonecircle 20 | 21 | #------------------------------------------------------------------------------ 22 | ## Poject data 23 | projectName = 'Validation-04' 24 | projectAuthor = 'Exneyder A. Montoya Araque' 25 | projectDate = time.strftime("%d/%m/%y") 26 | 27 | #------------------------------------------------------------------------------ 28 | ## Define inputs 29 | # The slope geometry 30 | slopeHeight = [10, 'm'] 31 | slopeDip = np.array([2, 1]) 32 | crownDist = [5, 'm'] 33 | toeDist = [5, 'm'] 34 | wantAutomaticToeDepth = False 35 | if wantAutomaticToeDepth == True: 36 | toeDepth = ['automatic toe Depth'] 37 | else: 38 | toeDepth = [3, 'm'] 39 | # The slip arc-circle 40 | wantEvaluateOnlyOneSurface = True 41 | if wantEvaluateOnlyOneSurface == True: 42 | hztDistPointAtCrownFromCrown = [-2, 'm'] 43 | hztDistPointAtToeFromCrown = [20, 'm'] 44 | slipRadius = [34.95, 'm'] 45 | else: 46 | numCircles = 2000 47 | radiusIncrement = [2, 'm'] 48 | numberIncrements = 40 49 | maxFsValueCont = 2 50 | # Watertable 51 | wantWatertable = True 52 | if wantWatertable == True: 53 | wtDepthAtCrown = [5, 'm'] 54 | else: 55 | wtDepthAtCrown = ['No watertable'] 56 | toeUnderWatertable = False 57 | # Materials properties. 58 | waterUnitWeight = [9.81, 'kN/m3'] 59 | materialUnitWeight = [20, 'kN/m3'] 60 | frictionAngleGrad = [19.6, 'degrees'] 61 | cohesion = [3, 'kPa'] 62 | 63 | ## Advanced inputs 64 | # Want divide the slip surface in constant width slices? 65 | wantConstSliceWidthTrue = True 66 | # Number of discretizations of slip surface. 67 | numSlices = 15 68 | # Number of discretizations of circular arcs. 69 | nDivs = numSlices 70 | # Select the method to calcualte the safety factor ['Flns', 'Bshp' or 'Allm']. 71 | methodString = 'Allm' 72 | # Select the output format image #['.eps', '.jpeg', '.jpg', '.pdf', '.pgf', \ 73 | # '.png', '.ps', '.raw', '.rgba', '.svg', '.svgz', '.tif', '.tiff']. 74 | outputFormatImg = '.svg' 75 | 76 | #------------------------------------------------------------------------------ 77 | # Operations for only one slip surface 78 | if wantEvaluateOnlyOneSurface == True: 79 | msg = onlyonecircle(projectName, projectAuthor, projectDate, slopeHeight, \ 80 | slopeDip, crownDist, toeDist, wantAutomaticToeDepth, toeDepth, \ 81 | hztDistPointAtCrownFromCrown, hztDistPointAtToeFromCrown, \ 82 | slipRadius, wantWatertable, wtDepthAtCrown, toeUnderWatertable, \ 83 | waterUnitWeight, materialUnitWeight, frictionAngleGrad, cohesion, \ 84 | wantConstSliceWidthTrue, numSlices, nDivs, methodString, \ 85 | outputFormatImg) 86 | 87 | #------------------------------------------------------------------------------ 88 | # Operations for multiple slip surface 89 | else: 90 | automaticslipcircles(projectName, projectAuthor, projectDate, slopeHeight,\ 91 | slopeDip, crownDist, toeDist, wantAutomaticToeDepth, toeDepth, \ 92 | numCircles, radiusIncrement, numberIncrements, maxFsValueCont, \ 93 | wantWatertable, wtDepthAtCrown, toeUnderWatertable, waterUnitWeight, \ 94 | materialUnitWeight, frictionAngleGrad, cohesion, \ 95 | wantConstSliceWidthTrue, numSlices, nDivs, methodString, \ 96 | outputFormatImg) 97 | ''' 98 | BSD 2 license. 99 | 100 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 101 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 102 | All rights reserved. 103 | 104 | Redistribution and use in source and binary forms, with or without 105 | modification, are permitted provided that the following conditions are 106 | met: 107 | 108 | 1. Redistributions of source code must retain the above copyright notice, 109 | this list of conditions and the following disclaimer. 110 | 111 | 2. Redistributions in binary form must reproduce the above copyright 112 | notice, this list of conditions and the following disclaimer in the 113 | documentation and/or other materials provided with the distribution. 114 | 115 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 116 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 117 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 118 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 119 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 120 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 121 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 122 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 123 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 124 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 125 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 126 | ''' 127 | -------------------------------------------------------------------------------- /other_files/validations/validation05-partiallySubmergedSlope.py: -------------------------------------------------------------------------------- 1 | ''' 2 | # Description. 3 | This is a minimal module in order to perform a circular arc slope stability 4 | analysis by the limit equilibrium model by Fellenius and Bishop symplified 5 | methods. 6 | ''' 7 | 8 | #------------------------------------------------------------------------------ 9 | ## Add functions directory 10 | import sys 11 | sys.path += ['../functions'] 12 | 13 | #------------------------------------------------------------------------------ 14 | ## Modules/Functions import 15 | import numpy as np 16 | import time 17 | 18 | from automaticslipcircles import automaticslipcircles 19 | from onlyonecircle import onlyonecircle 20 | 21 | #------------------------------------------------------------------------------ 22 | ## Poject data 23 | projectName = 'Validation-05' 24 | projectAuthor = 'Exneyder A. Montoya Araque' 25 | projectDate = time.strftime("%d/%m/%y") 26 | 27 | #------------------------------------------------------------------------------ 28 | ## Define inputs 29 | # The slope geometry 30 | slopeHeight = [10, 'm'] 31 | slopeDip = np.array([2, 1]) 32 | crownDist = [5, 'm'] 33 | toeDist = [5, 'm'] 34 | wantAutomaticToeDepth = False 35 | if wantAutomaticToeDepth == True: 36 | toeDepth = ['automatic toe Depth'] 37 | else: 38 | toeDepth = [3, 'm'] 39 | # The slip arc-circle 40 | wantEvaluateOnlyOneSurface = True 41 | if wantEvaluateOnlyOneSurface == True: 42 | hztDistPointAtCrownFromCrown = [-2, 'm'] 43 | hztDistPointAtToeFromCrown = [20, 'm'] 44 | slipRadius = [34.95, 'm'] 45 | else: 46 | numCircles = 2000 47 | radiusIncrement = [2, 'm'] 48 | numberIncrements = 40 49 | maxFsValueCont = 2 50 | # Watertable 51 | wantWatertable = True 52 | if wantWatertable == True: 53 | wtDepthAtCrown = [5, 'm'] 54 | else: 55 | wtDepthAtCrown = ['No watertable'] 56 | toeUnderWatertable = True 57 | # Materials properties. 58 | waterUnitWeight = [9.81, 'kN/m3'] 59 | materialUnitWeight = [20, 'kN/m3'] 60 | frictionAngleGrad = [19.6, 'degrees'] 61 | cohesion = [3, 'kPa'] 62 | 63 | ## Advanced inputs 64 | # Want divide the slip surface in constant width slices? 65 | wantConstSliceWidthTrue = True 66 | # Number of discretizations of slip surface. 67 | numSlices = 15 68 | # Number of discretizations of circular arcs. 69 | nDivs = numSlices 70 | # Select the method to calcualte the safety factor ['Flns', 'Bshp' or 'Allm']. 71 | methodString = 'Allm' 72 | # Select the output format image #['.eps', '.jpeg', '.jpg', '.pdf', '.pgf', \ 73 | # '.png', '.ps', '.raw', '.rgba', '.svg', '.svgz', '.tif', '.tiff']. 74 | outputFormatImg = '.svg' 75 | 76 | #------------------------------------------------------------------------------ 77 | # Operations for only one slip surface 78 | if wantEvaluateOnlyOneSurface == True: 79 | msg = onlyonecircle(projectName, projectAuthor, projectDate, slopeHeight, \ 80 | slopeDip, crownDist, toeDist, wantAutomaticToeDepth, toeDepth, \ 81 | hztDistPointAtCrownFromCrown, hztDistPointAtToeFromCrown, \ 82 | slipRadius, wantWatertable, wtDepthAtCrown, toeUnderWatertable, \ 83 | waterUnitWeight, materialUnitWeight, frictionAngleGrad, cohesion, \ 84 | wantConstSliceWidthTrue, numSlices, nDivs, methodString, \ 85 | outputFormatImg) 86 | 87 | #------------------------------------------------------------------------------ 88 | # Operations for multiple slip surface 89 | else: 90 | automaticslipcircles(projectName, projectAuthor, projectDate, slopeHeight,\ 91 | slopeDip, crownDist, toeDist, wantAutomaticToeDepth, toeDepth, \ 92 | numCircles, radiusIncrement, numberIncrements, maxFsValueCont, \ 93 | wantWatertable, wtDepthAtCrown, toeUnderWatertable, waterUnitWeight, \ 94 | materialUnitWeight, frictionAngleGrad, cohesion, \ 95 | wantConstSliceWidthTrue, numSlices, nDivs, methodString, \ 96 | outputFormatImg) 97 | ''' 98 | BSD 2 license. 99 | 100 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 101 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 102 | All rights reserved. 103 | 104 | Redistribution and use in source and binary forms, with or without 105 | modification, are permitted provided that the following conditions are 106 | met: 107 | 108 | 1. Redistributions of source code must retain the above copyright notice, 109 | this list of conditions and the following disclaimer. 110 | 111 | 2. Redistributions in binary form must reproduce the above copyright 112 | notice, this list of conditions and the following disclaimer in the 113 | documentation and/or other materials provided with the distribution. 114 | 115 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 116 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 117 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 118 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 119 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 120 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 121 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 122 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 123 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 124 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 125 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 126 | ''' 127 | -------------------------------------------------------------------------------- /package_test/Example-01.txt: -------------------------------------------------------------------------------- 1 | ---SUMMARY OF PROJECT--- 2 | 3 | Project name: Example-01 4 | Author: Exneyder A. Montoya Araque 5 | Date: 06/10/22 6 | Safety factors: 7 | -Fellenius method: 1.2422357242032032 8 | -Bishop method: 1.2909646637377918 9 | 10 | --Slope geometry-- 11 | Height: 40 ft 12 | Dip: 89.2328896037985 degrees 13 | Crown distance: 30 ft 14 | Toe distance: 30 ft 15 | Toe depth: 10 ft 16 | Surface coordinates: 17 | [[ 0. 50.] 18 | [ 30. 50.] 19 | [ 70. 10.] 20 | [100. 10.]] 21 | 22 | --Watertable geometry-- 23 | Depth at crown: 50 ft 24 | Is the slope partially submerged? No 25 | Watertable coordinates: 26 | [[ 0. 0.] 27 | [100. 0.]] 28 | 29 | --Slip circle-- 30 | Radius: 69.73787182484394 ft 31 | Center coordinates: [63.92194398 79.47249817] 32 | 33 | --Materials properties-- 34 | Water unit weight: 62.4 pcf 35 | Soil unit weight: 115 pcf 36 | Friction angle 20 degrees 37 | Cohesion: 400 psf 38 | 39 | --Slices data-- 40 | Number of slices: 15 41 | Has the surface slip constant width slices? Yes 42 | 43 | Slices structures data: 44 | [['Index' 'Abscissa' 'Ordinate' 'Area' 'Width' 'Height' 45 | 'Secant Angle Grad at Bottom' 'Angle Grad at Top' 'Water Height' 46 | 'Water Height Above Slope' 'Horizontal Moment Arm' 47 | 'Vertical Moment Arm'] 48 | ['0.0' '3.0' '45.8' '19.3' '4.6' '4.2' '61.1' '-0.0' '0.0' '0.0' '-60.9' 49 | '29.5'] 50 | ['1.0' '7.6' '38.5' '53.2' '4.6' '11.5' '53.9' '-0.0' '0.0' '0.0' 51 | '-56.3' '29.5'] 52 | ['2.0' '12.3' '32.7' '79.7' '4.6' '17.3' '47.9' '-0.0' '0.0' '0.0' 53 | '-51.7' '29.5'] 54 | ['3.0' '16.9' '28.1' '101.2' '4.6' '21.9' '42.5' '-0.0' '0.0' '0.0' 55 | '-47.0' '29.5'] 56 | ['4.0' '21.5' '24.2' '119.2' '4.6' '25.8' '37.5' '-0.0' '0.0' '0.0' 57 | '-42.4' '29.5'] 58 | ['5.0' '26.1' '20.9' '134.3' '4.6' '29.1' '32.9' '-0.0' '0.0' '0.0' 59 | '-37.8' '29.5'] 60 | ['6.0' '30.7' '18.2' '142.3' '4.6' '30.5' '28.4' '33.4' '0.0' '0.0' 61 | '-33.2' '30.7'] 62 | ['7.0' '35.4' '15.9' '132.7' '4.6' '28.7' '24.2' '45.0' '0.0' '0.0' 63 | '-28.6' '34.8'] 64 | ['8.0' '40.0' '14.0' '120.1' '4.6' '26.0' '20.1' '45.0' '0.0' '0.0' 65 | '-23.9' '39.5'] 66 | ['9.0' '44.6' '12.5' '105.7' '4.6' '22.9' '16.1' '45.0' '0.0' '0.0' 67 | '-19.3' '44.1'] 68 | ['10.0' '49.2' '11.3' '89.8' '4.6' '19.4' '12.2' '45.0' '0.0' '0.0' 69 | '-14.7' '48.7'] 70 | ['11.0' '53.8' '10.5' '72.3' '4.6' '15.7' '8.3' '45.0' '0.0' '0.0' 71 | '-10.1' '53.3'] 72 | ['12.0' '58.5' '10.0' '53.4' '4.6' '11.6' '4.5' '45.0' '0.0' '0.0' 73 | '-5.5' '57.9'] 74 | ['13.0' '63.1' '9.8' '33.0' '4.6' '7.2' '0.7' '45.0' '0.0' '0.0' '-0.9' 75 | '62.5'] 76 | ['14.0' '67.7' '9.9' '11.2' '4.6' '2.4' '-3.1' '45.0' '0.0' '0.0' '3.8' 77 | '67.2']] 78 | 79 | Note: This program calculated the safety factor to circular slip, 80 | under limit equilibrium considerations, using Fellenius and Bishop 81 | methods. The imagen attached shows the calculation performed. 82 | 83 | This program is distributed in the hope that it will be useful, 84 | but WITHOUT ANY WARRANTY; without even the implied warranty of 85 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -------------------------------------------------------------------------------- /package_test/example01.py: -------------------------------------------------------------------------------- 1 | """ 2 | # Description. 3 | This is a minimal module in order to perform a circular arc slope stability 4 | analysis for the example number 01. # 5 | """ 6 | 7 | # --------------------------------------------------------------------------- # 8 | ## Modules/Functions import 9 | import numpy as np 10 | import matplotlib.pyplot as plt 11 | import time 12 | 13 | from pycss_lem import get_fos 14 | 15 | # --------------------------------------------------------------------------- # 16 | ### Poject data ### 17 | projectName = "Example-01" 18 | projectAuthor = "Exneyder A. Montoya Araque" 19 | projectDate = time.strftime("%d/%m/%y") 20 | 21 | # --------------------------------------------------------------------------- # 22 | ### Previous calculations ### 23 | segmentAC = 40 / np.sin(np.radians(30)) 24 | 25 | ### Define inputs ### 26 | # The slope geometry # 27 | slopeHeight = [40, "ft"] 28 | slopeDip = np.array([1, np.tan(np.radians(45))]) 29 | crownDist = [30, "ft"] 30 | toeDist = [30, "ft"] 31 | wantAutomaticToeDepth = False 32 | toeDepth = [10, "ft"] 33 | # The slip arc-circle # 34 | hztDistPointAtCrownFromCrown = [ 35 | 40 / np.tan(np.radians(45)) - 40 / np.tan(np.radians(30)), 36 | "ft", 37 | ] 38 | hztDistPointAtToeFromCrown = [40 / np.tan(np.radians(45)), "ft"] 39 | slipRadius = [0.5 * 80 / np.sin(0.5 * np.radians(70)), "ft"] 40 | # Watertable # 41 | wantWatertable = False 42 | wtDepthAtCrown = ["No watertable"] 43 | toeUnderWatertable = False 44 | # Materials properties # 45 | waterUnitWeight = [62.4, "pcf"] 46 | materialUnitWeight = [115, "pcf"] 47 | frictionAngleGrad = [20, "degrees"] 48 | cohesion = [400, "psf"] 49 | 50 | ### Advanced inputs ### 51 | # Want divide the slip surface in constant width slices? # 52 | wantConstSliceWidthTrue = True 53 | # Number of discretizations of slip surface. # 54 | numSlices = 15 55 | # Number of discretizations of circular arcs. # 56 | nDivs = numSlices 57 | # Select the method to calcualte the safety factor ['Flns', 'Bshp' or 'Allm'] # 58 | methodString = "Allm" 59 | # Select the output format image ['.eps', '.jpeg', '.jpg', '.pdf', '.pgf', \ # 60 | # '.png', '.ps', '.raw', '.rgba', '.svg', '.svgz', '.tif', '.tiff']. # 61 | outputFormatImg = ".svg" 62 | 63 | # --------------------------------------------------------------------------- # 64 | # Operations for only one slip surface # 65 | msg = get_fos( 66 | projectName, 67 | projectAuthor, 68 | projectDate, 69 | slopeHeight, 70 | slopeDip, 71 | crownDist, 72 | toeDist, 73 | wantAutomaticToeDepth, 74 | toeDepth, 75 | hztDistPointAtCrownFromCrown, 76 | hztDistPointAtToeFromCrown, 77 | slipRadius, 78 | wantWatertable, 79 | wtDepthAtCrown, 80 | toeUnderWatertable, 81 | waterUnitWeight, 82 | materialUnitWeight, 83 | frictionAngleGrad, 84 | cohesion, 85 | wantConstSliceWidthTrue, 86 | numSlices, 87 | nDivs, 88 | methodString, 89 | outputFormatImg, 90 | ) 91 | plt.show() 92 | """ 93 | BSD 2 license. 94 | 95 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 96 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 97 | All rights reserved. 98 | 99 | Redistribution and use in source and binary forms, with or without 100 | modification, are permitted provided that the following conditions are 101 | met: 102 | 103 | 1. Redistributions of source code must retain the above copyright notice, 104 | this list of conditions and the following disclaimer. 105 | 106 | 2. Redistributions in binary form must reproduce the above copyright 107 | notice, this list of conditions and the following disclaimer in the 108 | documentation and/or other materials provided with the distribution. 109 | 110 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 111 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 112 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 113 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 114 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 115 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 116 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 117 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 118 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 119 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 120 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 121 | """ 122 | -------------------------------------------------------------------------------- /pycss_lem/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Open-source program written in Python3 for 2D slope stability analysis of 3 | circular surfaces by the limit equilibrium method (Fellenius and Bishop methods). 4 | """ 5 | 6 | __version__ = "0.1.0" 7 | 8 | 9 | from .automaticslipcircles import * 10 | from .onlyonecircle import * 11 | -------------------------------------------------------------------------------- /pycss_lem/azimuthangle.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | 4 | ''' 5 | # Description. 6 | Given a 2x1 vector, this function obtains the angle of the azimuth from 7 | x-axis in a counter clockwise sense. 8 | Coordiante system is with x in the abscisas and y in the ordinates (i.e. 9 | x horizontal pointing to the right and y vertical pointing upwards). 10 | 11 | # Input(s). 12 | Array that representing a bi-dimensional vector (vector). 13 | 14 | # Output(s). 15 | Angle in radians representing the azimut of the vector (angleRad). 16 | 17 | Example: giving next array 18 | vector = np.array([3,-5]), is obtined 5.2528 radians 19 | --- 20 | angleRad = azimuthangle(vector) 21 | ''' 22 | def azimuthangle(vector): 23 | if vector[0] == 0: 24 | if vector[1] >= 0: 25 | angleRad = np.pi/2 26 | else: 27 | angleRad = 3*np.pi/2 28 | else: 29 | basicAngleRad = np.arctan(np.abs(vector[1])/np.abs(vector[0])) 30 | if vector[0] >= 0: 31 | if vector[1] >= 0: #case 1 32 | angleRad = basicAngleRad 33 | elif vector[1] < 0: #case 4 34 | angleRad = 2*np.pi-basicAngleRad 35 | elif vector[0] < 0: 36 | if vector[1] >= 0: #case 2 37 | angleRad = np.pi-basicAngleRad 38 | elif vector[1] < 0: #case 3 39 | angleRad = np.pi+basicAngleRad 40 | else: 41 | print("Error: bad number") 42 | 43 | return angleRad 44 | ''' 45 | BSD 2 license. 46 | 47 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 48 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 49 | All rights reserved. 50 | 51 | Redistribution and use in source and binary forms, with or without 52 | modification, are permitted provided that the following conditions are 53 | met: 54 | 55 | 1. Redistributions of source code must retain the above copyright notice, 56 | this list of conditions and the following disclaimer. 57 | 58 | 2. Redistributions in binary form must reproduce the above copyright 59 | notice, this list of conditions and the following disclaimer in the 60 | documentation and/or other materials provided with the distribution. 61 | 62 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 63 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 64 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 65 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 66 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 67 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 68 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 69 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 70 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 71 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 72 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 73 | ''' 74 | -------------------------------------------------------------------------------- /pycss_lem/circleby2ptsradius.py: -------------------------------------------------------------------------------- 1 | ## Import modules 2 | import numpy as np 3 | import scipy.linalg as la 4 | 5 | ''' 6 | Description. 7 | Function used to compute the center of the circle given two points and a 8 | radius. Takes only real inputs and gives only real outputs. 9 | Function originally named: circ_cent.m for MatLab(R) 10 | By: Chiran 2010, BST license 11 | 12 | # Input(s): 13 | First circle point (pt1Vec). 14 | 15 | Second circle point (pt2Vec). 16 | 17 | Circle radius (radius). 18 | 19 | # Output(s): 20 | Row vector of the point where the first possible center (centerVec1); 21 | 22 | Row vector of the point where the second possible center (centerVec2). 23 | 24 | # Example1: 25 | pt1Vec = np.array([40, 12]); pt2Vec = np.array([4.347, 24]); radius = 34.4848 26 | One of the solutions is: np.array([31.3936, 45.3936]). 27 | 28 | --- 29 | centerVec1, centerVec2 = circleby2ptsradius(pt1Vec, pt2Vec, radius) 30 | ''' 31 | def circleby2ptsradius(pt1Vec, pt2Vec, radius): 32 | 33 | if radius < la.norm(pt1Vec-pt2Vec)/2: 34 | centerVec1 = np.array(['NaN', 'NaN']) 35 | centerVec2 = np.array(['NaN', 'NaN']) 36 | else: 37 | a = pt1Vec[0]**2-pt2Vec[0]**2 38 | b = pt1Vec[1]**2-pt2Vec[1]**2 39 | c = -2*(pt1Vec[0]-pt2Vec[0]) 40 | d = -2*(pt1Vec[1]-pt2Vec[1]) 41 | e = a+b 42 | Coeff1 = 1+(d/c)**2 43 | Coeff2 = ((2*d*e/c**2) +(pt2Vec[0]*2*d/c) -2*pt2Vec[1]) 44 | Coeff3 = ((e/c)**2+(2*pt2Vec[0]*e/c)+pt2Vec[0]**2+pt2Vec[1]**2-\ 45 | radius**2) 46 | 47 | All_coeff = np.array([Coeff1, Coeff2, Coeff3]) 48 | Eq_root = np.roots(All_coeff) 49 | 50 | # centersArray--center of the circle. It is a 2x2 matrix. First row 51 | # represents first possible center (x1, y1) and second row is the 52 | # second possible center. 53 | centersArray = np.zeros((len(Eq_root),2)) 54 | 55 | for i in list(range(len(Eq_root))): 56 | x = -(e+d*Eq_root[i])/c 57 | centersArray[i,0] = x 58 | centersArray[i,1] = Eq_root[i] 59 | 60 | # Check if values in centerArray are real or unreal numbers 61 | if la.norm(centersArray.imag) != 0: 62 | print('Circle with the specified radius does not pass through', 63 | 'specified points', sep=" ") 64 | centerVec1 = np.array(['NaN', 'NaN']) 65 | centerVec2 = np.array(['NaN', 'NaN']) 66 | else: 67 | centerVec1 = centersArray[0, :] 68 | centerVec2 = centersArray[1, :] 69 | 70 | return centerVec1, centerVec2 71 | ''' 72 | BSD 2 license. 73 | 74 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 75 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 76 | All rights reserved. 77 | 78 | Redistribution and use in source and binary forms, with or without 79 | modification, are permitted provided that the following conditions are 80 | met: 81 | 82 | 1. Redistributions of source code must retain the above copyright notice, 83 | this list of conditions and the following disclaimer. 84 | 85 | 2. Redistributions in binary form must reproduce the above copyright 86 | notice, this list of conditions and the following disclaimer in the 87 | documentation and/or other materials provided with the distribution. 88 | 89 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 90 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 91 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 92 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 93 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 94 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 95 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 96 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 97 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 98 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 99 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 100 | ''' 101 | -------------------------------------------------------------------------------- /pycss_lem/create2dsegmentstructure.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | from .azimuthangle import azimuthangle 4 | from .unitvector import unitvector 5 | 6 | ''' 7 | # Description. 8 | Creates a two-dimensional line segment structure from their initial and 9 | final points. It returns a dictionary type segment structure. 10 | 11 | # External sub-function(s): 12 | azimuthangle, unitvector. 13 | 14 | # Input(s): 15 | Array type two-dimensional vector, that represents the segment initial point 16 | relative to a coordinate system (iniPnt2dRowVec); 17 | 18 | Array type two-dimensional vector, that represents the segment end point 19 | relative to a coordinate system (endPnt2dRowVec); 20 | 21 | # Output(s): 22 | Dictionary type segment structure (segmentSTR) with the following fields: 23 | iniPtVec: vector of the coordinates of the first line point; 24 | endPtVec: vector of the coordinates of the second line point; 25 | unitVec: unit vector that defines a direction; 26 | lambda: value that defines the segment length; 27 | slope: value that defines the slope of the line equation of the 28 | segment; 29 | azimuthRad: counter-clockwise angle (in radians) from a reference 30 | axis of [1, 0] to [0, 1]; 31 | intercept: value that defines the intercept of line equation of the 32 | segment. 33 | 34 | # Example1. 35 | These two points defines a two dimensional segment 36 | iniPnt2dRowVec = np.array([53.8973, 43.2314]) 37 | endPnt2dRowVec = np.array([69.0489, 50.5464]) 38 | the the segment values are as following: 39 | iniPtVec: [53.8973 43.2314] 40 | endPtVec: [69.0489 50.5464] 41 | unitVec: [0.9005 0.4348] 42 | lambda: 16.8250 43 | slope: 0.4828 44 | azimuthRad: 0.4498 45 | intercept: 17.2105 46 | 47 | --- 48 | segmentSTR = create2dsegmentstructure(iniPnt2dRowVec, endPnt2dRowVec) 49 | ''' 50 | def create2dsegmentstructure(iniPnt2dRowVec, endPnt2dRowVec): 51 | 52 | # Obtaining the unit vector of the segment 53 | segmentVec = endPnt2dRowVec-iniPnt2dRowVec 54 | unitVec = unitvector(segmentVec) 55 | 56 | # Obtaining the segment length, lambda; 57 | # the line equation can be expressed by: 58 | # $\vec{p}=\vec{p_{\mathrm{o}}} +\lambda \vec{u}$ 59 | lamda = np.sqrt(np.dot(segmentVec, segmentVec)) 60 | 61 | # Obtaining the segment inclination and sense, based on a 62 | # counter-clockwise angle increment from a left--right sense. 63 | azimuthRad = azimuthangle(unitVec) 64 | slope = unitVec[1]/unitVec[0] 65 | 66 | # Obtaining the line intercept 67 | intercept = iniPnt2dRowVec[1]-slope*iniPnt2dRowVec[0] 68 | 69 | # Arranging the structure 70 | segmentSTR = { 71 | 'iniPtVec': iniPnt2dRowVec, 72 | 'endPtVec': endPnt2dRowVec, 73 | 'unitVec': unitVec, 74 | 'lambda': lamda, 75 | 'slope': slope, 76 | 'azimuthRad': azimuthRad, 77 | 'intercept': intercept} 78 | 79 | return segmentSTR 80 | ''' 81 | BSD 2 license. 82 | 83 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 84 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 85 | All rights reserved. 86 | 87 | Redistribution and use in source and binary forms, with or without 88 | modification, are permitted provided that the following conditions are 89 | met: 90 | 91 | 1. Redistributions of source code must retain the above copyright notice, 92 | this list of conditions and the following disclaimer. 93 | 94 | 2. Redistributions in binary form must reproduce the above copyright 95 | notice, this list of conditions and the following disclaimer in the 96 | documentation and/or other materials provided with the distribution. 97 | 98 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 99 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 100 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 101 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 102 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 103 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 104 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 105 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 106 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 107 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 108 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 109 | ''' 110 | -------------------------------------------------------------------------------- /pycss_lem/defineslipcircle.py: -------------------------------------------------------------------------------- 1 | # Import modules 2 | import numpy as np 3 | 4 | from .circleby2ptsradius import circleby2ptsradius 5 | from .unitvector import unitvector 6 | from .azimuthangle import azimuthangle 7 | 8 | ''' 9 | # Description. 10 | Define the values of the slip circle arc (i.e. arc center point, radius 11 | and initial and final angles ) by giving two extreme points and the circle 12 | radius. 13 | 14 | # External subfunction(s): 15 | circleby2ptsradius, azimuthangle, unitvector. 16 | 17 | # Input(s). 18 | Two dimensional vector of the coordinates that defines the slip at the 19 | slope toe (pointAtToeVec); 20 | 21 | Two dimensional vector of the coordinates that defines the slip at the 22 | slope crown (pointAtCrownVec); 23 | 24 | Arc radius (slipRadius). 25 | 26 | # Output(s). 27 | Boolean variable giving True if an arc is possible within the given 28 | input variables and the sense of a slip surface (existSlipCircleTrue). 29 | Normaly, any arc can satisfy two points and a radius definition; but there 30 | are less arcs can either attain the conditions to be an concave inferior 31 | arc to represent a slip surface. 32 | 33 | Dictionary type structure of the arc that defines the slip (slipArcSTR). 34 | The fields of the strucrure is as following: 35 | center: center of the slip arc; 36 | radius: radius of the slip arc; 37 | iniAngGrad: counter clockwise angle (in sexagesimal grades) 38 | from a reference unit vector [1 0] to the initial radius that 39 | defines the arc; 40 | endAngGrad: counter clockwise angle (in sexagesimal grades) 41 | from a reference unit vector [1 0] to the final radius that 42 | defines the arc; 43 | deepDist: deepest distance from toe--point horizontal 44 | reference where the arc passes; 45 | leftDist: most left distance from toe--point vertical 46 | reference where the arc passes; 47 | 48 | # Example1: 49 | When putting the following inputs: 50 | pointAtToeVec = np.array([40, 12]) 51 | pointAtCrownVec = np.array([4.347, 24]) 52 | slipRadius = 34.4848 53 | The outputs then are: 54 | True, 55 | {'center': array([ 31.39356183, 45.39357203]), 56 | 'deepDist': 10.908772031832854, 57 | 'endAngGrad': 284.45218279917071, 58 | 'iniAngGrad': 218.34366020340661, 59 | 'leftDist': -3.0912381712059478, 60 | 'radius': 34.4848} 61 | --- 62 | existSlipCircleTrue, slipArcSTR = defineslipcircle(pointAtToeVec, \ 63 | pointAtCrownVec, slipRadius) 64 | ''' 65 | def defineslipcircle(pointAtToeVec, pointAtCrownVec, slipRadius): 66 | 67 | ## Finding out the two possible centers within the points 68 | centerVec1, centerVec2 = circleby2ptsradius(pointAtToeVec, \ 69 | pointAtCrownVec, slipRadius) 70 | 71 | ## Verifying if exist a circle 72 | existSlipCircleTrue = True 73 | error = False 74 | for i in list(range(len(centerVec1))): 75 | if centerVec1[i] == 'NaN' or centerVec2[i] == 'NaN': 76 | existSlipCircleTrue = False 77 | break 78 | 79 | ## Doing the math 80 | if existSlipCircleTrue == False: 81 | error = True 82 | 83 | else: 84 | ## Selecting the appropriate center vector for the slip circle. 85 | # The line unit vector. 86 | diffVec = (pointAtCrownVec-pointAtToeVec) 87 | diffUnitVec = unitvector(diffVec) 88 | 89 | # The line equation (analitical eq.). 90 | lineSlope = diffUnitVec[1]/diffUnitVec[0] 91 | intercept = pointAtToeVec[1]-lineSlope*pointAtToeVec[0] 92 | 93 | # Verifying. 94 | y1 = intercept+lineSlope*centerVec1[0] 95 | y2 = intercept+lineSlope*centerVec2[0] 96 | if centerVec1[1] >= y1 and centerVec2[1] < y2: 97 | slipCenterVec = centerVec1 98 | elif centerVec1[1] < y1 and centerVec2[1] >= y2: 99 | slipCenterVec = centerVec2 100 | else: 101 | print ('error: there is no slip at that points') 102 | error = True 103 | 104 | if error == True: 105 | ##assigning values 106 | slipCenterVec = np.array(['NaN', 'NaN']) 107 | slipRadius = 'NaN' 108 | initialAngleGrad = 'NaN' 109 | endAngleGrad = 'NaN' 110 | deepestVertDepth = 'NaN' 111 | mostleftHorzDist = 'NaN' 112 | else: 113 | ## Finding out the sector initial and final angles. 114 | # Toe vector. 115 | toeCenter2PtVec = pointAtToeVec-slipCenterVec 116 | toeCenter2PtUnitVec = unitvector(toeCenter2PtVec) 117 | toeRadiusAngleRad = azimuthangle(toeCenter2PtUnitVec) 118 | endAngleGrad = toeRadiusAngleRad*180/np.pi 119 | # Crown vector. 120 | crownCenter2PtVec = pointAtCrownVec-slipCenterVec; 121 | crownCenter2PtUnitVec = unitvector(crownCenter2PtVec) 122 | crownRadiusAngleRad = azimuthangle(crownCenter2PtUnitVec) 123 | initialAngleGrad = crownRadiusAngleRad*180/np.pi 124 | 125 | # Extreme slip values. 126 | # Deepest vertical point at the slip circle 127 | deepestVertDepth = slipCenterVec[1]-slipRadius 128 | # Nost Left horizontal distance at the slio circle 129 | mostleftHorzDist = slipCenterVec[0]-slipRadius 130 | 131 | ## Creating the structure 132 | slipArcSTR = {'center': slipCenterVec, 133 | 'radius': slipRadius, 134 | 'iniAngGrad': initialAngleGrad, 135 | 'endAngGrad': endAngleGrad, 136 | 'deepDist': deepestVertDepth, 137 | 'leftDist': mostleftHorzDist} 138 | 139 | return existSlipCircleTrue, slipArcSTR 140 | ''' 141 | BSD 2 license. 142 | 143 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 144 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 145 | All rights reserved. 146 | 147 | Redistribution and use in source and binary forms, with or without 148 | modification, are permitted provided that the following conditions are 149 | met: 150 | 151 | 1. Redistributions of source code must retain the above copyright notice, 152 | this list of conditions and the following disclaimer. 153 | 154 | 2. Redistributions in binary form must reproduce the above copyright 155 | notice, this list of conditions and the following disclaimer in the 156 | documentation and/or other materials provided with the distribution. 157 | 158 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 159 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 160 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 161 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 162 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 163 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 164 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 165 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 166 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 167 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 168 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 169 | ''' 170 | -------------------------------------------------------------------------------- /pycss_lem/defineswatertable.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | from .create2dsegmentstructure import create2dsegmentstructure 5 | 6 | ''' 7 | # Description. 8 | Generates a horizontal watertable can be: coincident with the surface slope, 9 | be below the surface slope, or be above the foot of the slope. 10 | 11 | # External subfunction(s): 12 | create2dsegmentstructure. 13 | 14 | # Input(s). 15 | Distance from the horizontal surface at the slope crown to the 16 | watertable (wtDepthAtCrown). 17 | 18 | List with data of the surface boundatry geometric definition 19 | (surfaceDataCell), in which each element is a dictionary type 20 | line structure. Each line has the following fields: 21 | iniPtVec: row vector with the initial coordiantes; 22 | endPtVec: row vector with the final coordiantes; 23 | unitVec: line unit vector; 24 | lambda: line length; 25 | slope: slope of the line; 26 | azimuthRad: anglular valor of the slope in radians; 27 | intercept: the value of the line intercept in the coordiante system. 28 | 29 | Logical value put as 'True' or 'False' if it is wanted to consider the slope 30 | partially submerged, ie the foot slope is under the watertable 31 | (toeUnderWatertable). 32 | 33 | Logical value put as 'True' or 'False' if it is wanted to plot. Default 34 | value is 'False' (want2plot). 35 | 36 | # Output(s). 37 | Similar to 'surfaceDataCell', this variable contains data of a plyline 38 | but that represents the water table surface (watertableDataCell). In each 39 | element of the list is a dictionary type line structure with the same 40 | variables as the strucures of 'surfaceDataCell' (watertableDataCell). 41 | 42 | Array of n x 2 with the coordiantes that define the open polygon of the 43 | water table surface (wtCoordsArray). 44 | 45 | ## Example1: 46 | # inputs 47 | slopeHeight = 12; slopeDip = np.array([1, 2.5]); crownDist = 10.0; 48 | toeDist = 10.0; fromToeOriginRowVec = np.array([-14.8, -3.30]); 49 | wtDepthAtCrown = 0 50 | # Previous functions 51 | surfaceDataCell, surfaceChordsArray = terrainsurface(fromToeOriginRowVec, \ 52 | slopeHeight, slopeDip, crownDist, toeDist) 53 | 54 | The first element of the watertableDataCell list is the dictionary as follows: 55 | {'azimuthRad': 0.0, 56 | 'endPtVec': array([-19.6, 8.7]), 57 | 'iniPtVec': array([-29.6, 8.7]), 58 | 'intercept': 8.6999999999999993, 59 | 'lambda': 10.0, 60 | 'slope': 0.0, 61 | 'unitVec': array([ 1., 0.])} 62 | and watertable coordinates array is: 63 | array([[-29.6, 8.7], 64 | [-19.6, 8.7], 65 | [-14.8, -3.3], 66 | [ -4.8, -3.3]]) 67 | --- 68 | watertableDataCell, wtCoordsArray = defineswatertable(wtDepthAtCrown, \ 69 | surfaceDataCell, toeUnderWatertable = False, want2plot = False) 70 | ''' 71 | def defineswatertable(wtDepthAtCrown, surfaceDataCell, \ 72 | toeUnderWatertable = False, want2plot = False): 73 | 74 | ## Input management 75 | 76 | # Ordinate value at crown 77 | ordinateAtCrown = surfaceDataCell[0]['iniPtVec'][1] 78 | ordinateAtToe = surfaceDataCell[-1]['iniPtVec'][1] 79 | ordinateAtCrownWt = ordinateAtCrown-wtDepthAtCrown 80 | 81 | ## When negative values of 'wtDepthAtCrown' abort 82 | if wtDepthAtCrown >= 0 and toeUnderWatertable == False: 83 | 84 | # If is equal then the water table surface is coincident with the 85 | # terrain surface. 86 | if ordinateAtCrownWt == ordinateAtCrown: 87 | watertableDataCell = surfaceDataCell[:] 88 | numSegments = len(surfaceDataCell) 89 | wtCoordsArray = np.zeros((numSegments+1, 2)) 90 | for i in list(range(numSegments)): 91 | wtCoordsArray[i] = surfaceDataCell[i]['iniPtVec'] 92 | wtCoordsArray[-1] = surfaceDataCell[-1]['endPtVec'] 93 | 94 | # when water table is between the crown surface and the toe surface 95 | elif ordinateAtCrownWt < ordinateAtCrown and \ 96 | ordinateAtCrownWt > ordinateAtToe: 97 | 98 | # first line paralell to the crown surface 99 | wtIniPtVec1 = np.array([surfaceDataCell[0]['iniPtVec'][0], \ 100 | (surfaceDataCell[0]['iniPtVec'][1]-wtDepthAtCrown)]) 101 | wtUnitVec1 =surfaceDataCell[0]['unitVec'] 102 | 103 | # the end point of the segment is the intersection of the two first 104 | # lines. 105 | 106 | # ...the first segment 107 | point1Vec = wtIniPtVec1 108 | unitVec1 = wtUnitVec1 109 | 110 | point2Vec =surfaceDataCell[1]['iniPtVec'] 111 | unitVec2 =surfaceDataCell[1]['unitVec'] 112 | 113 | x = (unitVec1[1]/unitVec1[0]*point1Vec[0]-unitVec2[1]/unitVec2[0]\ 114 | *point2Vec[0]-(point1Vec[1]-point2Vec[1]))/(unitVec1[1]/\ 115 | unitVec1[0]-unitVec2[1]/unitVec2[0]) 116 | 117 | y = point1Vec[1]+unitVec1[1]/unitVec1[0]*(x-point1Vec[0]) 118 | wtEndPtVec1 = np.array([x, y]) 119 | 120 | # ...the second segment 121 | wtIniPtVec2 = wtEndPtVec1 122 | #wtEndPtVec2 =surfaceDataCell{2}.endPtVec; 123 | 124 | # ...the third segment 125 | wtIniPtVec3 = surfaceDataCell[2]['iniPtVec'] 126 | wtEndPtVec3 = surfaceDataCell[2]['endPtVec'] 127 | 128 | # the matrix of coordinates 129 | numSegments = len(surfaceDataCell) 130 | wtCoordsArray = np.zeros((numSegments+1, 2)) 131 | wtCoordsArray[0] = wtIniPtVec1 132 | wtCoordsArray[1] = wtIniPtVec2 133 | wtCoordsArray[2] = wtIniPtVec3 134 | wtCoordsArray[3] = wtEndPtVec3 135 | 136 | # when water table is below the toe surface 137 | elif ordinateAtCrownWt <= ordinateAtToe: 138 | 139 | numSegments = 1 140 | 141 | yCord = ordinateAtCrownWt 142 | 143 | wtIniPtVec = np.array([surfaceDataCell[0]['iniPtVec'][0], yCord]) 144 | wtEndPtVec = np.array([surfaceDataCell[-1]['endPtVec'][0], yCord]) 145 | 146 | wtCoordsArray = np.zeros((numSegments+1, 2)) 147 | wtCoordsArray[0] = wtIniPtVec 148 | wtCoordsArray[1] = wtEndPtVec 149 | 150 | #creating the structure 151 | watertableDataCell = [] 152 | for i in list(range(numSegments)): 153 | segmentSTR = create2dsegmentstructure(wtCoordsArray[i], \ 154 | wtCoordsArray[i+1]) 155 | watertableDataCell += [segmentSTR] 156 | 157 | elif wtDepthAtCrown >= 0 and toeUnderWatertable == True: 158 | 159 | numSegments = 1 160 | 161 | yCord = ordinateAtCrownWt 162 | 163 | wtIniPtVec = np.array([surfaceDataCell[0]['iniPtVec'][0], yCord]) 164 | wtEndPtVec = np.array([surfaceDataCell[-1]['endPtVec'][0], yCord]) 165 | 166 | wtCoordsArray = np.zeros((numSegments+1, 2)) 167 | wtCoordsArray[0] = wtIniPtVec 168 | wtCoordsArray[1] = wtEndPtVec 169 | 170 | #creating the structure 171 | watertableDataCell = [] 172 | for i in list(range(numSegments)): 173 | segmentSTR = create2dsegmentstructure(wtCoordsArray[i], \ 174 | wtCoordsArray[i+1]) 175 | watertableDataCell += [segmentSTR] 176 | 177 | else: 178 | watertableDataCell, wtCoordsArray = np.nan, np.nan 179 | print('error: Values must be equal or greater than cero!') 180 | 181 | ## Ploting 182 | if want2plot: 183 | # plt.hold(True) 184 | plt.axis('equal') 185 | plt.plot(wtCoordsArray[:,0], wtCoordsArray[:,1], 'b-') 186 | plt.grid(True) 187 | plt.show(False) 188 | 189 | return watertableDataCell, wtCoordsArray 190 | ''' 191 | BSD 2 license. 192 | 193 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 194 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 195 | All rights reserved. 196 | 197 | Redistribution and use in source and binary forms, with or without 198 | modification, are permitted provided that the following conditions are 199 | met: 200 | 201 | 1. Redistributions of source code must retain the above copyright notice, 202 | this list of conditions and the following disclaimer. 203 | 204 | 2. Redistributions in binary form must reproduce the above copyright 205 | notice, this list of conditions and the following disclaimer in the 206 | documentation and/or other materials provided with the distribution. 207 | 208 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 209 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 210 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 211 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 212 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 213 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 214 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 215 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 216 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 217 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 218 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 219 | ''' 220 | -------------------------------------------------------------------------------- /pycss_lem/divideslipintoslices.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | from .sliparcdiscretization import sliparcdiscretization 4 | from .uniquewithtolerance import uniquewithtolerance 5 | from .vertprojection2pline import vertprojection2pline 6 | from .tangentlineatcirclept import tangentlineatcirclept 7 | from .extractplinefrom2pts import extractplinefrom2pts 8 | from .polyarea import polyarea 9 | 10 | ''' 11 | # Description: 12 | Divides the slip circular arc into the respective required number of 13 | slices according to the surface--terrain configuration, and creates the 14 | slices data structure with all the useful data in order to perform any 15 | further limit equilibrium slip analysis. 16 | 17 | # External sub-function(s): 18 | sliparcdiscretization, uniquewithtolerance, vertprojection2pline, 19 | tangentlineatcirclept, extractplinefrom2pts, polyarea. 20 | 21 | # Input(s): 22 | Dictionary type slip circle structure (slipArcSTR) which contains the 23 | following fields: 24 | center: center of the slip arc; 25 | radius: radius of the slip arc; 26 | iniAngGrad: initial angle in hexagesimal degrees of the slop arc; 27 | endAngGrad: final angle in hexagesimal degrees of the slop arc; 28 | deepDist: deepest vertical distance in respecto to the surface; 29 | leftDist: backwards distance formo the center vertical. 30 | Values of the coordiantes are relative to the global coordinate system. 31 | 32 | List containinig lines structures of the surface terrain 33 | (surfaceDataCell), each line structure has the following fields: 34 | iniPtVec: vector of the coordinates of the first line point; 35 | endPtVec: vector of the coordinates of the second line point; 36 | unitVec: unit vector that defines a direction; 37 | lambda: value that defines the segment length; 38 | slope: value that defines the slope of the line equation of the 39 | segment; 40 | azimuthRad: counter-clockwise angle (in radians) from a reference 41 | axis of [1, 0] to [0, 1]; 42 | intercept: value that defines the intercept of line equation of the 43 | segment. 44 | Values of the coordiantes are relative to the global coordinate system. 45 | 46 | Similar to 'surfaceDataCell', this variable contains data of a plyline 47 | but that represents the water table surface (watertableDataCell). In each 48 | element of the list is a dictionary type line structure with the same 49 | variables as the strucures of 'surfaceDataCell' (watertableDataCell). 50 | 51 | Number of slices one wants to disect the slip circle (numSlices). 52 | 53 | Two dimensional vector of the coordinates that defines the slip at the 54 | slope toe (pointAtToeVec); 55 | 56 | Two dimensional vector of the coordinates that defines the slip at the 57 | slope crown (pointAtCrownVec); 58 | 59 | Do you what to generate constant width slices, if so put it True 60 | (wantConstSliceWidthTrue). Default value is False. 61 | 62 | # Output(s): 63 | List containing all the slices dictionary type structures (slicesSTRCell). 64 | Each slice structure has the following fields: 65 | plineCords: contains all the coordiantes that gives the 66 | slice closed polyline; 67 | area: slice polygon area; 68 | midPoint: coordinates of the middle point of the slice at its base; 69 | midHeight: value of the mean height taken the initial, 70 | middle and end heights of the slice at its base to terrain surface; 71 | width: value of width slice; 72 | inclinationAngleGradAtBottom: angle in sexagesimal grades of the 73 | secant line that passess trough the extreme borders of the bottom slice; 74 | inclinationAngleGradAtTop: angle in sexagesimal grades of the 75 | secant line that passess trough the extreme borders of the top slice; 76 | wtMidHeight: value of the mean height taken the initial, 77 | middle and end heights of the slice at its base to watertable surface; 78 | wtMidHeightAboveSlope: value of the mean height taken the initial, 79 | middle and end heights of the water column above slope surface; 80 | hrzMomentArm: value of the horizontal component of the moment arm acting 81 | on the slope due to the water above it; 82 | vrtMomentArm: value of the vertical component of the moment arm acting 83 | on the slope due to the water above it; 84 | 85 | ## Example1: 86 | # inputs: 87 | slopeHeight = 12.0; slopeDip = np.array([1, 2.5]); crownDist = 10.0 88 | toeDist = 10.0; wtDepthAtCrown = 0; numSlices = 10; slipRadius = 15 89 | pointAtToeVec = np.array([23, 3.3]); pointAtCrownVec = np.array([2, 15.3]) 90 | # Previous functions 91 | boundPointsCordsArray, fromToeOriginRowVec, coordTransMat = \ 92 | materialboundary(slopeHeight, slopeDip, crownDist, toeDist) 93 | surfaceDataCell, surfaceChordsArray = terrainsurface(fromToeOriginRowVec,\ 94 | slopeHeight, slopeDip, crownDist, toeDist) 95 | watertableDataCell, wtCoordsArray = defineswatertable(wtDepthAtCrown, 96 | surfaceDataCell) 97 | existSlipCircleTrue, slipArcSTR = defineslipcircle(pointAtToeVec, \ 98 | pointAtCrownVec, slipRadius) 99 | # This function 100 | slicesSTRCell = divideslipintoslices(slipArcSTR, \ 101 | surfaceDataCell, watertableDataCell, numSlices, pointAtToeVec, \ 102 | pointAtCrownVec) 103 | --- 104 | slicesSTRCell = divideslipintoslices(slipArcSTR, surfaceDataCell, \ 105 | watertableDataCell, numSlices, pointAtToeVec, pointAtCrownVec, \ 106 | wantConstSliceWidthTrue = False) 107 | ''' 108 | def divideslipintoslices(slipArcSTR, surfaceDataCell, watertableDataCell, \ 109 | numSlices, pointAtToeVec, pointAtCrownVec, \ 110 | wantConstSliceWidthTrue = False): 111 | 112 | ## Obtaining the coordiantes of the slip surface 113 | slipChordsArray = sliparcdiscretization(pointAtToeVec, pointAtCrownVec, \ 114 | numSlices, slipArcSTR) 115 | 116 | ## Diserning between doing a calculation of equal or non--equal width slices 117 | if wantConstSliceWidthTrue == False: 118 | #Do calculation in order to divide the slip surface into non--equal 119 | #slices but coinciding with surfaces bifurcations points 120 | 121 | #Coordiantes array of terrain surface 122 | numLines = len(surfaceDataCell) 123 | terrainChordsArray = np.zeros((numLines+1,2)) 124 | for i in range(numLines): 125 | tlineSTR = surfaceDataCell[i] 126 | terrainChordsArray[i,:] = tlineSTR['iniPtVec'] 127 | terrainChordsArray[-1,:] = tlineSTR['endPtVec'] 128 | #Terrain coordiantes between the limits of the slip surface 129 | #lower boundary 130 | indexesIniVec = terrainChordsArray[:,0] >= slipChordsArray[-1,0] 131 | terrainChordsInsideSlipArray = terrainChordsArray[indexesIniVec,:] 132 | #upper boundary 133 | indexesEndVec = terrainChordsInsideSlipArray[:,0] <= \ 134 | slipChordsArray[0,0] 135 | terrainChordsInsideSlipArray = terrainChordsInsideSlipArray\ 136 | [indexesEndVec,:] 137 | #Obtaining the y--coordiante at the slip of the terrain points 138 | xCoordsArray = terrainChordsInsideSlipArray[:,0] 139 | yCoordsArray = slipArcSTR['center'][1]-np.sqrt(slipArcSTR['radius']**2\ 140 | -(xCoordsArray-slipArcSTR['center'][0])**2) 141 | addedTerrainSlipChoordsArray = np.transpose(np.array([xCoordsArray, \ 142 | yCoordsArray])) 143 | 144 | #Coordiantes array of water table surface 145 | wtNumLines = len(watertableDataCell) 146 | watertableChordsArray = np.zeros((wtNumLines+1,2)) 147 | for i in range(wtNumLines): 148 | wlineSTR = watertableDataCell[i] 149 | watertableChordsArray[i,:] = wlineSTR['iniPtVec'] 150 | watertableChordsArray[-1,:] = wlineSTR['endPtVec'] 151 | #Water table coordiantes between the limits of the slip surface 152 | #lower boundary 153 | indexesIniVec = watertableChordsArray[:,0] >= slipChordsArray[-1,0] 154 | watertableChordsInsideSlipArray = watertableChordsArray[indexesIniVec,\ 155 | :] 156 | #upper boundary 157 | indexesEndVec = watertableChordsInsideSlipArray[:,0] <= \ 158 | slipChordsArray[0,0] 159 | watertableChordsInsideSlipArray = watertableChordsInsideSlipArray\ 160 | [indexesEndVec,:] 161 | #Obtaining the y--coordiante at the slip of the terrain points 162 | xCoordsArray = watertableChordsInsideSlipArray[:,0] 163 | yCoordsArray = slipArcSTR['center'][1]-np.sqrt(slipArcSTR['radius']**2\ 164 | -(xCoordsArray-slipArcSTR['center'][0])**2) 165 | addedWatertableSlipChoordsArray = np.transpose(np.array([xCoordsArray,\ 166 | yCoordsArray])) 167 | 168 | #Joining the bifurcation points 169 | totalInsideSlipArray = np.concatenate((slipChordsArray, \ 170 | addedTerrainSlipChoordsArray, addedWatertableSlipChoordsArray), 0) 171 | #totalInsideSlipArray =unique( totalInsideSlipArray ,'rows' ); 172 | totalInsideSlipArray = uniquewithtolerance(totalInsideSlipArray, 0.01) 173 | 174 | else: 175 | #Do calculation in order to divide the slip surface into equal width 176 | #slices 177 | totalInsideSlipArray = uniquewithtolerance(slipChordsArray, 0.01) 178 | 179 | #------------------------------------------------------------------------------ 180 | ## Obtain coordiantes from slip surface to the surface terrain 181 | numberOfSlipPoints = len(totalInsideSlipArray[:,0]) 182 | totalTerrainFromSlipArray = np.zeros((numberOfSlipPoints,2)) 183 | for i in range(numberOfSlipPoints): 184 | totalTerrainFromSlipArray[i,:] = vertprojection2pline\ 185 | (totalInsideSlipArray[i,:], surfaceDataCell) 186 | 187 | # Obtaining the arrays for calculations 188 | newNumSlices = len(totalInsideSlipArray[:,0])-1 189 | 190 | # Obtaining coordiantes of initial and end points coordinates at slip 191 | # surface 192 | slicesIniPointsArray = totalInsideSlipArray[0:-1,:] 193 | slicesEndPointsArray = totalInsideSlipArray[1:,:] 194 | 195 | # Obtaining coordiantes of initial and end points coordiantes at terrain 196 | # surface 197 | terrainIniPointsArray = totalTerrainFromSlipArray[0:-1,:] 198 | terrainEndPointsArray = totalTerrainFromSlipArray[1:,:] 199 | 200 | # Extreme vertical borders slice heights 201 | slicesIniHeightArray = terrainIniPointsArray[:,1]-slicesIniPointsArray[:,1] 202 | slicesEndHeightArray = terrainEndPointsArray[:,1]-slicesEndPointsArray[:,1] 203 | 204 | ## Coordiantes of slices mid points. 205 | slicesMidPointsArray = np.zeros((newNumSlices, 2)) 206 | slicesMidPointsArray[:,0] = 0.5*(slicesEndPointsArray[:,0]+\ 207 | slicesIniPointsArray[:,0]) 208 | slicesMidPointsArray[:,1] = 0.5*(slicesEndPointsArray[:,1]+\ 209 | +slicesIniPointsArray[:,1]) 210 | 211 | ## Slice material heights are each the mean of initial, final and middle. 212 | # Terrain heights. 213 | sliceProjOrdinateArray = np.zeros(newNumSlices); 214 | for i in range(newNumSlices): 215 | tempo00 = vertprojection2pline(slicesMidPointsArray[i,:], \ 216 | surfaceDataCell) 217 | sliceProjOrdinateArray[i] = tempo00[1] 218 | sliceProjHeightArray = sliceProjOrdinateArray-slicesMidPointsArray[:,1] 219 | # The used slice height at middle point. 220 | sliceHeightArray = 1/3*(sliceProjHeightArray+slicesIniHeightArray+\ 221 | slicesEndHeightArray) 222 | ## Slice material width. 223 | sliceWidthArray = slicesEndPointsArray[:,0]-slicesIniPointsArray[:,0] 224 | 225 | #------------------------------------------------------------------------------ 226 | ## Obtain coordiantes from slip surface to the water table surface. 227 | totalWatertableFromSlipArray = np.zeros((numberOfSlipPoints, 2)) 228 | for i in range(numberOfSlipPoints): 229 | totalWatertableFromSlipArray[i,:] = vertprojection2pline\ 230 | (totalInsideSlipArray[i,:], watertableDataCell) 231 | 232 | # Obtaining coordiantes of initial and end point at water--table surface. 233 | watertableIniPointsArray = totalWatertableFromSlipArray[0:-1,:] 234 | watertableEndPointsArray = totalWatertableFromSlipArray[1:,:] 235 | 236 | # Extreme vertical borders slice heights. 237 | slicesWtIniHeightArray = watertableIniPointsArray[:,1]-\ 238 | slicesIniPointsArray[:,1] 239 | slicesWtEndHeightArray = watertableEndPointsArray[:,1]-\ 240 | slicesEndPointsArray[:,1] 241 | 242 | # Slice water heights are each the mean of initial, final and middle 243 | # water table heights. 244 | 245 | sliceWtProjOrdinateArray = np.zeros(newNumSlices) 246 | for i in range(newNumSlices): 247 | tempo01 = vertprojection2pline(slicesMidPointsArray[i,:], \ 248 | watertableDataCell) 249 | sliceWtProjOrdinateArray[i] = tempo01[1] 250 | sliceWtProjHeightArray = sliceWtProjOrdinateArray-slicesMidPointsArray[:,1] 251 | 252 | # The used slice water table height at middle point. 253 | sliceWtHeightArray = 1/3*(sliceWtProjHeightArray+slicesWtIniHeightArray+\ 254 | slicesWtEndHeightArray) 255 | # Negative values are transformed to cero. 256 | indexesLessCero = sliceWtHeightArray < 0 257 | sliceWtHeightArray[indexesLessCero] = 0 258 | 259 | #------------------------------------------------------------------------------ 260 | ## Water column height above the surface of the slope 261 | wtHeightAboveSlope = sliceWtHeightArray-sliceHeightArray 262 | # Negative values are transformed to cero. 263 | indexesLessCero = wtHeightAboveSlope < 0 264 | wtHeightAboveSlope[indexesLessCero] = 0 265 | 266 | hrzMomentArm = slicesMidPointsArray[:,0]-slipArcSTR['center'][0] 267 | vrtMomentArm = -1*(slicesMidPointsArray[:,1]+sliceHeightArray-\ 268 | slipArcSTR['center'][1]) 269 | 270 | #------------------------------------------------------------------------------ 271 | ## Slice inclinations angle at their bottoms. 272 | # They will be the slice--surface secant inclination in hexagesima degrees. 273 | 274 | # If the slice is drawn from left to right (which is the case), then 275 | # slideOrientationSign =-1 276 | slideOrientationSign =-1; 277 | 278 | sliceSurfaceSecIncliGradArray = np.degrees(slideOrientationSign*np.arctan(\ 279 | (totalInsideSlipArray[1:,1]-totalInsideSlipArray[:-1,1])/(\ 280 | totalInsideSlipArray[1:,0]-totalInsideSlipArray[:-1,0]))) 281 | 282 | ## The slice--surface tangent inclination in hexagesimal degrees. 283 | sliceSurfaceTanIncliGradArray = np.zeros(newNumSlices) 284 | # The used slice--surface inclination in hexagesimal degrees. 285 | for i in range(newNumSlices): 286 | temp, tangentLineSTR = tangentlineatcirclept(slicesMidPointsArray[i,:],\ 287 | slipArcSTR) 288 | sliceSurfaceTanIncliGradArray[i] = np.degrees(np.arctan(tangentLineSTR\ 289 | ['slope'])) 290 | 291 | # The slice--surface inclinations is those tangent to the circle at slice 292 | # middle point. 293 | errorTanGradArray = 0.5*abs(-1*sliceSurfaceTanIncliGradArray-\ 294 | sliceSurfaceSecIncliGradArray) 295 | 296 | sliceSurfaceIncliGradArray = sliceSurfaceSecIncliGradArray[:] 297 | 298 | #------------------------------------------------------------------------------ 299 | ## Slice inclinations angle at their top. 300 | 301 | sliceTopIncliGradArray = np.degrees(slideOrientationSign*np.arctan(\ 302 | (totalTerrainFromSlipArray[1:,1]-totalTerrainFromSlipArray[:-1,1])/(\ 303 | totalTerrainFromSlipArray[1:,0]-totalTerrainFromSlipArray[:-1,0]))) 304 | 305 | #------------------------------------------------------------------------------ 306 | ## Slices structures stored in a cell 307 | slicesSTRCell = [] 308 | 309 | for i in range(newNumSlices): 310 | # Extract polyline beetween two extreme points. 311 | tempo01 = slicesIniPointsArray[i,1]+slicesIniHeightArray[i] 312 | tempo02 = slicesEndPointsArray[i,1]+slicesEndHeightArray[i] 313 | baseSlicePlineCordsArray = np.concatenate(( 314 | [np.array([slicesIniPointsArray[i,0], tempo01])], 315 | [slicesIniPointsArray[i,:]], 316 | [slicesMidPointsArray[i,:]], 317 | [slicesEndPointsArray[i,:]], 318 | [np.array([slicesEndPointsArray[i,0], tempo02])]), 0) 319 | 320 | terrainSlicePlineCordsArray = extractplinefrom2pts\ 321 | (slicesIniPointsArray[i,:], slicesEndPointsArray[i,:],\ 322 | surfaceDataCell) 323 | 324 | if len(terrainSlicePlineCordsArray[1:-1,:]) == 0: 325 | completeSlicePlineCordsArray = np.concatenate(( 326 | baseSlicePlineCordsArray, 327 | baseSlicePlineCordsArray[0:1,:]), 0) 328 | else: 329 | completeSlicePlineCordsArray = np.concatenate(( 330 | baseSlicePlineCordsArray, 331 | terrainSlicePlineCordsArray[1:-1,:], 332 | baseSlicePlineCordsArray[0:1,:]), 0) 333 | 334 | sliceSTR = { 335 | 'plineCords': completeSlicePlineCordsArray[:], 336 | 'area': polyarea(completeSlicePlineCordsArray[0:-1,0],\ 337 | completeSlicePlineCordsArray[0:-1,1]), 338 | 'midPoint': slicesMidPointsArray[i,:], 339 | 'midHeight': sliceHeightArray[i], 340 | 'width': sliceWidthArray[i], 341 | 'inclinationAngleGradAtBottom': sliceSurfaceIncliGradArray[i], 342 | 'inclinationAngleGradAtTop': sliceTopIncliGradArray[i], 343 | 'wtMidHeight': sliceWtHeightArray[i], 344 | 'wtMidHeightAboveSlope': wtHeightAboveSlope[i], 345 | 'hrzMomentArm': hrzMomentArm[i], 346 | 'vrtMomentArm': vrtMomentArm[i]} 347 | 348 | slicesSTRCell += [sliceSTR] 349 | 350 | return slicesSTRCell 351 | ''' 352 | BSD 2 license. 353 | 354 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 355 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 356 | All rights reserved. 357 | 358 | Redistribution and use in source and binary forms, with or without 359 | modification, are permitted provided that the following conditions are 360 | met: 361 | 362 | 1. Redistributions of source code must retain the above copyright notice, 363 | this list of conditions and the following disclaimer. 364 | 365 | 2. Redistributions in binary form must reproduce the above copyright 366 | notice, this list of conditions and the following disclaimer in the 367 | documentation and/or other materials provided with the distribution. 368 | 369 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 370 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 371 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 372 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 373 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 374 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 375 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 376 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 377 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 378 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 379 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 380 | ''' 381 | -------------------------------------------------------------------------------- /pycss_lem/extractplinefrom2pts.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | 4 | ''' 5 | # Description: 6 | Get the coordinates of the points defining a polyline 'A', extracted from 7 | another, and two end points corresponding to the beginning and end of 'A'. 8 | 9 | # Input(s): 10 | First point given by a two-dimensional array (pointOneVec); 11 | Second point given by a two-dimensional array (pointTwoVec); 12 | Polyline structure (surfaceDataCell). 13 | 14 | # Output(s): 15 | Array nx2 containing the coordinates that belongs to the new polyline 16 | (plineChordsArray). 17 | 18 | # Example1: 19 | pointOneVec = np.array([4.3470, 24]); 20 | pointTwoVec = np.array([12.0085, 23.1966]); 21 | surfaceDataCell = [ 22 | {'iniPtVec':np.array([0, 24]), 'endPtVec':np.array([10, 24]), 'unitVec':\ 23 | np.array([1, 0]), 'lambda':10, 'slope':0, 'azimuthRad':0, 'intercept':24}, 24 | {'iniPtVec':np.array([10, 24]), 'endPtVec':np.array([40, 12]), 'unitVec':\ 25 | np.array([0.9285, -0.3714]), 'lambda':32.3110, 'slope':-0.4228, 26 | 'azimuthRad':5.9027, 'intercept':34.1470}, 27 | {'iniPtVec':np.array([40, 12]), 'endPtVec':np.array([50, 12]), 'unitVec':\ 28 | np.array([1, 0]), 'lambda':10, 'slope':0, 'azimuthRad':0, 'intercept':12}] 29 | 30 | it's obtained: 31 | plineChordsArray = 32 | array([[ 12.0085 , 29.0698062], 33 | [ 10. , 24. ], 34 | [ 4.347 , 24. ]]) 35 | --- 36 | plineChordsArray = extractplinefrom2pts(pointOneVec, pointTwoVec, \ 37 | surfaceDataCell) 38 | ''' 39 | def extractplinefrom2pts(pointOneVec, pointTwoVec, surfaceDataCell): 40 | 41 | if pointTwoVec[0] < pointOneVec[0]: 42 | temp = pointOneVec 43 | pointOneVec = pointTwoVec 44 | pointTwoVec = temp 45 | 46 | ## Number of lines. 47 | numLines = len(surfaceDataCell) 48 | 49 | ## For the first point. 50 | firstPtBelongArray = np.zeros(numLines) 51 | for i in list(range(numLines)): 52 | if pointOneVec[0] >= surfaceDataCell[i]['iniPtVec'][0] and \ 53 | pointOneVec[0] < surfaceDataCell[i]['endPtVec'][0]: 54 | firstPtBelongArray[i] = 1 55 | break 56 | 57 | pointOnePlineIndex = np.nonzero(firstPtBelongArray)[0] 58 | 59 | ## For the second point. 60 | secondPtBelongArray = np.zeros(numLines) 61 | for i in list(range(numLines)): 62 | if pointTwoVec[0] >= surfaceDataCell[i]['iniPtVec'][0] and \ 63 | pointTwoVec[0] < surfaceDataCell[i]['endPtVec'][0]: 64 | secondPtBelongArray[i] = 1 65 | break 66 | 67 | pointTwoPlineIndex = np.nonzero(secondPtBelongArray)[0] 68 | 69 | ## Now it will built the array, but with extremes values. 70 | numSubPoints = (sum(pointTwoPlineIndex)-sum(pointOnePlineIndex)+1)*2 71 | plineChordsArray = np.zeros((numSubPoints, 2)) 72 | j = 0 73 | for i in list(range(sum(pointOnePlineIndex), sum(pointTwoPlineIndex)+1)): 74 | tempo1Array = surfaceDataCell[i]['iniPtVec'] 75 | tempo2Array = surfaceDataCell[i]['endPtVec'] 76 | plineChordsArray[j:j+2,:] = np.array([tempo1Array, tempo2Array]) 77 | j += 2 78 | 79 | ## Now one will replace the extreme values. 80 | # Left end. 81 | xLeftEnd = pointOneVec[0] 82 | yLeftEnd = surfaceDataCell[pointOnePlineIndex[0]]['intercept']\ 83 | +surfaceDataCell[pointOnePlineIndex[0]]['slope']*pointOneVec[0] 84 | # Right end. 85 | xRightEnd = pointTwoVec[0] 86 | yRightEnd = surfaceDataCell[sum(pointTwoPlineIndex)]['intercept']\ 87 | +surfaceDataCell[sum(pointTwoPlineIndex)]['slope']*pointTwoVec[0] 88 | 89 | plineChordsArray[0,:] = np.array([xLeftEnd, yLeftEnd]) 90 | plineChordsArray[-1,:] = np.array([xRightEnd, yRightEnd]) 91 | 92 | ## Extracting unique values. 93 | plineChordsArray = np.vstack(list({tuple(row) for row in plineChordsArray})) 94 | ## Sorting the array (key=item[0]) upwardly. 95 | plineChordsArray = plineChordsArray[plineChordsArray[:,0].argsort()] 96 | ## Arranging inverse. 97 | plineChordsArray = np.flipud(plineChordsArray) 98 | 99 | return plineChordsArray 100 | 101 | ''' 102 | BSD 2 license. 103 | 104 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 105 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 106 | All rights reserved. 107 | 108 | Redistribution and use in source and binary forms, with or without 109 | modification, are permitted provided that the following conditions are 110 | met: 111 | 112 | 1. Redistributions of source code must retain the above copyright notice, 113 | this list of conditions and the following disclaimer. 114 | 115 | 2. Redistributions in binary form must reproduce the above copyright 116 | notice, this list of conditions and the following disclaimer in the 117 | documentation and/or other materials provided with the distribution. 118 | 119 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 120 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 121 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 122 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 123 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 124 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 125 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 126 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 127 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 128 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 129 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 130 | ''' 131 | -------------------------------------------------------------------------------- /pycss_lem/interatefbishopsimpsat.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | from .reportslicestructurevalues import reportslicestructurevalues 4 | 5 | ''' 6 | # Description. 7 | Obtains the safety factor under the Bishop simplified method for any freatic 8 | level in coincidence or below the slope terrain surface. 9 | 10 | # External sub-function(s): 11 | reportslicestructurevalues. 12 | 13 | # Input(s). 14 | Cell which in each element has a slice strucure (slicesSTRCell). The 15 | slice structure is as follows: 16 | plineCords: contains all the coordiantes that gives the 17 | slice closed polyline; 18 | area: slice polygon area; 19 | midPoint: coordinates of the middle point of the slice at its base; 20 | midHeight: value of the mean height taken the initial, 21 | middle and end heights of the slice at its base to terrain surface; 22 | width: value of width slice; 23 | inclinationAngleGradAtBottom: angle in sexagesimal grades of the 24 | secant line that passess trough the extreme borders of the bottom slice; 25 | inclinationAngleGradAtTop: angle in sexagesimal grades of the 26 | secant line that passess trough the extreme borders of the top slice; 27 | wtMidHeight: value of the mean height taken the initial, 28 | middle and end heights of the slice at its base to watertable surface; 29 | wtMidHeightAboveSlope: value of the mean height taken the initial, 30 | middle and end heights of the water column above slope surface; 31 | hrzMomentArm: value of the horizontal component of the moment arm acting 32 | on the slope due to the water above it; 33 | vrtMomentArm: value of the vertical component of the moment arm acting 34 | on the slope due to the water above it; 35 | 36 | Unit weight of the water (waterUnitWeight). 37 | 38 | Geomaterial unit weight in dry state (materialUnitWeight). 39 | 40 | Angle of friction of the geomaterial at the slice base (frictionAngleGrad). 41 | 42 | Cohesion of the geomaterial at the slice base (cohesion). 43 | 44 | Value of slip circle radius (slipRadius) 45 | 46 | Value of any factor of safety to be the seed to initiaite the iteration 47 | (seedFs). Default value is 1.5. 48 | 49 | Number of iterations (iterations). Default value is 5. 50 | 51 | # Output(s). 52 | The safety factor value (sf). 53 | 54 | ### Example1. 55 | # inputs: 56 | slopeHeight = 12.0; slopeDip = np.array([1, 2.5]); crownDist = 10.0; 57 | toeDist = 10.0; wtDepthAtCrown = 10; numSlices = 10; nDivs = numSlices; 58 | pointAtToeVec = np.array([23, 3]); pointAtCrownVec = np.array([2, 15]); 59 | slipRadius = 14; waterUnitWeight = 9.81; materialUnitWeight = 19.5; 60 | frictionAngleGrad = 23; cohesion = 18; wantConstSliceWidthTrue = False; 61 | # Previous functions 62 | boundPointsCordsArray, fromToeOriginRowVec, coordTransMat = materialboundary\ 63 | (slopeHeight, slopeDip, crownDist, toeDist) 64 | surfaceDataCell, surfaceChordsArray = terrainsurface(fromToeOriginRowVec, \ 65 | slopeHeight, slopeDip, crownDist, toeDist) 66 | watertableDataCell, wtCoordsArray = defineswatertable(wtDepthAtCrown, \ 67 | surfaceDataCell) 68 | existSlipCircleTrue, slipArcSTR = defineslipcircle(pointAtToeVec, \ 69 | pointAtCrownVec, slipRadius) 70 | slicesSTRCell = divideslipintoslices(slipArcSTR, surfaceDataCell, \ 71 | watertableDataCell, numSlices, pointAtToeVec, pointAtCrownVec, \ 72 | wantConstSliceWidthTrue) 73 | # This function 74 | print(interatefbishopsimpsat(slicesSTRCell, waterUnitWeight, \ 75 | materialUnitWeight, frictionAngleGrad, cohesion, slipRadius)) 76 | 77 | ################ 78 | sf = interatefbishopsimpsat(slicesSTRCell, waterUnitWeight, \ 79 | materialUnitWeight, frictionAngleGrad, cohesion, slipRadius) 80 | ''' 81 | def interatefbishopsimpsat(slicesSTRCell, waterUnitWeight, 82 | materialUnitWeight, frictionAngleGrad, cohesion, slipRadius,\ 83 | seedSafetyFactor = 1.5, iterations = 5): 84 | 85 | ## Transform information of slices structures into an array and display 86 | # input variables 87 | temp, reportedArray = reportslicestructurevalues(slicesSTRCell) 88 | 89 | numSlices = len(reportedArray[:,0]) 90 | num = np.zeros(numSlices) 91 | 92 | # Obtain values from the array for further calculations 93 | #midPointArray = reportedArray[:,0:2] 94 | areaArray = reportedArray[:,2] 95 | widthArray =reportedArray[:,3]; 96 | #midHeightArray =reportedArray[:,4] 97 | inclinationAngleGradAtBottomArray = reportedArray[:,5] 98 | inclinationAngleGradAtTopArray = reportedArray[:,6] 99 | wtMidHeightArray = reportedArray[:,7] 100 | wtMidHeightAboveSlopeArray = reportedArray[:,8] 101 | hrzMomentArm = reportedArray[:,9] 102 | vrtMomentArm = reportedArray[:,10] 103 | 104 | ## Precalculating some variables 105 | 106 | wtExternalPressureArray = wtMidHeightAboveSlopeArray*waterUnitWeight 107 | porePressureArray = wtMidHeightArray*waterUnitWeight 108 | 109 | ## Solve for the factor of safety 110 | fricAngTangent = np.tan(np.radians(frictionAngleGrad)) 111 | alphaAngBottomSinArray = \ 112 | np.sin(np.radians(inclinationAngleGradAtBottomArray)) 113 | alphaAngBottomCosArray = \ 114 | np.cos(np.radians(inclinationAngleGradAtBottomArray)) 115 | BetaAngTopCosArray = \ 116 | np.cos(np.radians(inclinationAngleGradAtTopArray)) 117 | BetaAngTopSinArray = \ 118 | np.sin(np.radians(inclinationAngleGradAtTopArray)) 119 | 120 | # slice weights 121 | materialWeightArray = materialUnitWeight*areaArray 122 | externalWtForceArray = wtExternalPressureArray*widthArray/\ 123 | BetaAngTopCosArray 124 | wtForceArray = porePressureArray*widthArray 125 | 126 | momentWtForce = externalWtForceArray*(BetaAngTopCosArray*hrzMomentArm+\ 127 | BetaAngTopSinArray*vrtMomentArm) 128 | 129 | for i in range(iterations): 130 | 131 | mAlpha = alphaAngBottomCosArray+(fricAngTangent*\ 132 | alphaAngBottomSinArray/seedSafetyFactor) 133 | 134 | num = (cohesion*widthArray+(materialWeightArray+externalWtForceArray-\ 135 | wtForceArray)*fricAngTangent)/mAlpha 136 | 137 | den = materialWeightArray*alphaAngBottomSinArray 138 | 139 | sf = sum(num)/(sum(den)-sum(momentWtForce)/slipRadius) 140 | seedSafetyFactor = sf 141 | 142 | return sf 143 | ''' 144 | BSD 2 license. 145 | 146 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 147 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 148 | All rights reserved. 149 | 150 | Redistribution and use in source and binary forms, with or without 151 | modification, are permitted provided that the following conditions are 152 | met: 153 | 154 | 1. Redistributions of source code must retain the above copyright notice, 155 | this list of conditions and the following disclaimer. 156 | 157 | 2. Redistributions in binary form must reproduce the above copyright 158 | notice, this list of conditions and the following disclaimer in the 159 | documentation and/or other materials provided with the distribution. 160 | 161 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 162 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 163 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 164 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 165 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 166 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 167 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 168 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 169 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 170 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 171 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 172 | ''' 173 | -------------------------------------------------------------------------------- /pycss_lem/interateffelleniussat.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | from .reportslicestructurevalues import reportslicestructurevalues 4 | 5 | ''' 6 | # Description. 7 | Obtains the safety factor under the Fellenius method for any freatic level 8 | below the slope terrain surface. 9 | 10 | # External sub-function(s): 11 | reportslicestructurevalues. 12 | 13 | # Input(s). 14 | Cell which in each element has a slice strucure (slicesSTRCell). The 15 | slice structure is as follows: 16 | plineCords: contains all the coordiantes that gives the 17 | slice closed polyline; 18 | area: slice polygon area; 19 | midPoint: coordinates of the middle point of the slice at its base; 20 | midHeight: value of the mean height taken the initial, 21 | middle and end heights of the slice at its base to terrain surface; 22 | width: value of width slice; 23 | inclinationAngleGradAtBottom: angle in sexagesimal grades of the 24 | secant line that passess trough the extreme borders of the bottom slice; 25 | inclinationAngleGradAtTop: angle in sexagesimal grades of the 26 | secant line that passess trough the extreme borders of the top slice; 27 | wtMidHeight: value of the mean height taken the initial, 28 | middle and end heights of the slice at its base to watertable surface; 29 | wtMidHeightAboveSlope: value of the mean height taken the initial, 30 | middle and end heights of the water column above slope surface; 31 | hrzMomentArm: value of the horizontal component of the moment arm acting 32 | on the slope due to the water above it; 33 | vrtMomentArm: value of the vertical component of the moment arm acting 34 | on the slope due to the water above it; 35 | 36 | Unit weight of the water (waterUnitWeight). 37 | 38 | Geomaterial unit weight in dry state (materialUnitWeight). 39 | 40 | Angle of friction of the geomaterial at the slice base (frictionAngleGrad). 41 | 42 | Cohesion of the geomaterial at the slice base (cohesion). 43 | 44 | Value of slip circle radius (slipRadius) 45 | 46 | # Output(s). 47 | The safety factor value (sf). 48 | 49 | ### Example1. 50 | # inputs: 51 | slopeHeight = 12.0; slopeDip = np.array([1, 2.5]); crownDist = 10.0; 52 | toeDist = 10.0; wtDepthAtCrown = 10; numSlices = 10; nDivs = numSlices; 53 | pointAtToeVec = np.array([23, 3]); pointAtCrownVec = np.array([2, 15]); 54 | slipRadius = 14; waterUnitWeight = 9.81; materialUnitWeight = 19.5; 55 | frictionAngleGrad = 23; cohesion = 18; wantConstSliceWidthTrue = False; 56 | # Previous functions 57 | boundPointsCordsArray, fromToeOriginRowVec, coordTransMat = materialboundary\ 58 | (slopeHeight, slopeDip, crownDist, toeDist) 59 | surfaceDataCell, surfaceChordsArray = terrainsurface(fromToeOriginRowVec, \ 60 | slopeHeight, slopeDip, crownDist, toeDist) 61 | watertableDataCell, wtCoordsArray = defineswatertable(wtDepthAtCrown, \ 62 | surfaceDataCell) 63 | existSlipCircleTrue, slipArcSTR = defineslipcircle(pointAtToeVec, \ 64 | pointAtCrownVec, slipRadius) 65 | slicesSTRCell = divideslipintoslices(slipArcSTR, surfaceDataCell, \ 66 | watertableDataCell, numSlices, pointAtToeVec, pointAtCrownVec, \ 67 | wantConstSliceWidthTrue) 68 | # This function 69 | print(interateffelleniussat(slicesSTRCell, waterUnitWeight, \ 70 | materialUnitWeight, frictionAngleGrad, cohesion, slipRadius)) 71 | 72 | --- 73 | sf = interateffelleniussat(slicesSTRCell, waterUnitWeight, \ 74 | materialUnitWeight, frictionAngleGrad, cohesion, slipRadius) 75 | ''' 76 | def interateffelleniussat(slicesSTRCell, waterUnitWeight, \ 77 | materialUnitWeight, frictionAngleGrad, cohesion, slipRadius): 78 | 79 | ## Transform information of slices structures into an array and display 80 | # input variables 81 | temp, reportedArray = reportslicestructurevalues(slicesSTRCell) 82 | 83 | numSlices = len(reportedArray[:,0]) 84 | num = np.zeros(numSlices) 85 | 86 | # Obtain values from the array for further calculations 87 | #midPointArray = reportedArray[:,0:2] 88 | areaArray = reportedArray[:,2] 89 | widthArray =reportedArray[:,3]; 90 | #midHeightArray =reportedArray[:,4] 91 | inclinationAngleGradAtBottomArray = reportedArray[:,5] 92 | inclinationAngleGradAtTopArray = reportedArray[:,6] 93 | wtMidHeightArray = reportedArray[:,7] 94 | wtMidHeightAboveSlopeArray = reportedArray[:,8] 95 | hrzMomentArm = reportedArray[:,9] 96 | vrtMomentArm = reportedArray[:,10] 97 | 98 | ## Precalculating some variables 99 | 100 | wtExternalPressureArray = wtMidHeightAboveSlopeArray*waterUnitWeight 101 | porePressureArray = wtMidHeightArray*waterUnitWeight 102 | 103 | ## Solve for the factor of safety 104 | fricAngTangent = np.tan(np.radians(frictionAngleGrad)) 105 | alphaAngBottomSinArray = \ 106 | np.sin(np.radians(inclinationAngleGradAtBottomArray)) 107 | alphaAngBottomCosArray = \ 108 | np.cos(np.radians(inclinationAngleGradAtBottomArray)) 109 | BetaAngTopCosArray = \ 110 | np.cos(np.radians(inclinationAngleGradAtTopArray)) 111 | BetaAngTopSinArray = \ 112 | np.sin(np.radians(inclinationAngleGradAtTopArray)) 113 | angDifCosArray = np.cos(np.radians(inclinationAngleGradAtBottomArray-\ 114 | inclinationAngleGradAtTopArray)) 115 | 116 | lengthBaseArray = widthArray/alphaAngBottomCosArray 117 | 118 | # slice weights 119 | materialWeightArray = materialUnitWeight*areaArray 120 | externalWtForceArray = wtExternalPressureArray*widthArray/\ 121 | BetaAngTopCosArray 122 | wtForceArray = porePressureArray*lengthBaseArray 123 | 124 | momentWtForce = externalWtForceArray*(BetaAngTopCosArray*hrzMomentArm+\ 125 | BetaAngTopSinArray*vrtMomentArm) 126 | 127 | # final math 128 | num = cohesion*lengthBaseArray+(materialWeightArray*\ 129 | alphaAngBottomCosArray+externalWtForceArray*angDifCosArray-\ 130 | wtForceArray*alphaAngBottomCosArray**2)*fricAngTangent 131 | 132 | den = materialWeightArray*alphaAngBottomSinArray 133 | 134 | sf = sum(num)/(sum(den)-sum(momentWtForce)/slipRadius) 135 | 136 | return sf 137 | ''' 138 | BSD 2 license. 139 | 140 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 141 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 142 | All rights reserved. 143 | 144 | Redistribution and use in source and binary forms, with or without 145 | modification, are permitted provided that the following conditions are 146 | met: 147 | 148 | 1. Redistributions of source code must retain the above copyright notice, 149 | this list of conditions and the following disclaimer. 150 | 151 | 2. Redistributions in binary form must reproduce the above copyright 152 | notice, this list of conditions and the following disclaimer in the 153 | documentation and/or other materials provided with the distribution. 154 | 155 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 156 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 157 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 158 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 159 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 160 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 161 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 162 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 163 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 164 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 165 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 166 | ''' 167 | -------------------------------------------------------------------------------- /pycss_lem/materialboundary.py: -------------------------------------------------------------------------------- 1 | #Import modules 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | from .obtainmaxdepthdist import obtainmaxdepthdist 5 | 6 | ''' 7 | # Description. 8 | Defines and plots the boundary of the material were the slope stability 9 | analysis will be immersed. The analysis will be performed only in slopes 10 | which faces to the right (i.e. slip to the right in a counter clockwise 11 | sense). Also, this function only creates a standard slope: horizontal 12 | surfaces behind the crown and below the foot of the slope. The boundary 13 | is defined therefore by the slope height and the slope inclination and 14 | the two horizontal distances. 15 | 16 | # External sub-function(s): 17 | obtainmaxdepthdist. 18 | 19 | # Input(s). 20 | Height of the slope (slopeHeight). 21 | 22 | Slope dip, given by a bidimensional vector which represents a vertical 23 | distance and a horizontal distance that not necesary representing the real 24 | slope distances [horzDist,vertDist], (slopeDip). 25 | 26 | Crown horizontal plane distance (crownDist). 27 | 28 | Toe horizontal plane distance (toeDist). 29 | 30 | Logical value put as 'True' or 'False' if it is wanted to plot. Default 31 | value is 'False' (want2plot). 32 | 33 | # Output(s): 34 | Contour coordinates of the material boundary given in a n x 2 array 35 | (boundPointsCordsArray). 36 | 37 | Row vector that specifies this coordinate system origin problem relative 38 | to the slip toe (fromToeOriginRowVec). 39 | 40 | Coordinate system transformation matrix of 2x2 size (coordTransMat). 41 | The reference system of points coordinates are the left bottom side. 42 | 43 | # Example1: by giving next values 44 | slopeHeight = 12; slopeDip = np.array([1, 2.5]); crownDist = 10.0;\ 45 | toeDist = 10.0; it is obtained: 46 | 47 | boundPointsCordsArray = | fromToeOrginRowVec = array([14.8, 3.30]) 48 | (array([[ 0. , 0. ], | 49 | [ 24.8 , 0. ], | coordTransMat = array([[1, 0], 50 | [ 24.8 , 3.3 ], | [0, 1]]) 51 | [ 14.8 , 3.3 ], | 52 | [ 10. , 15.3 ], | 53 | [ 0. , 15.3 ], | 54 | [ 0. , 0. ]]) | 55 | 56 | --- 57 | boundPointsCordsArray, fromToeOriginRowVec, coordTransMat = \ 58 | materialboundary(slopeHeight, slopeDip, crownDist, toeDist) 59 | ''' 60 | def materialboundary(slopeHeight, slopeDip, crownDist,\ 61 | toeDist, want2plot = False): 62 | 63 | # Obtaining the maximum depth from the toe 64 | toeDepth = obtainmaxdepthdist(slopeHeight, slopeDip,\ 65 | crownDist, toeDist) 66 | slopeDipGrad = np.degrees(np.arctan(slopeDip[1]/slopeDip[0])) 67 | 68 | # Slope vertical projection (horizontal distance) 69 | slopeDist = slopeHeight/np.tan(np.radians(slopeDipGrad)) 70 | 71 | # Creating the contour 72 | boundPointsCordsArray = np.array([ 73 | [0, 0], 74 | [(crownDist +slopeDist +toeDist), 0], 75 | [(crownDist +slopeDist +toeDist), toeDepth], 76 | [(crownDist +slopeDist), toeDepth], 77 | [crownDist, (toeDepth +slopeHeight)], 78 | [0, (toeDepth +slopeHeight)], 79 | [0, 0]]) 80 | 81 | # Obtaining the vector that directs the origin of the problem coordiante 82 | # system 83 | fromToeOriginRowVec = np.array([(crownDist+slopeDist), toeDepth]) 84 | 85 | #Coordinate system matrix transformation 86 | coordTransMat = np.transpose(np.array([[1, 0], [0, 1]])) 87 | 88 | # Plotting 89 | if want2plot: 90 | # plt.hold(True) 91 | plt.axis('equal') 92 | plt.plot(boundPointsCordsArray[:,0], boundPointsCordsArray[:,1], '-k') 93 | plt.plot(boundPointsCordsArray[:,0], boundPointsCordsArray[:,1], 'or') 94 | plt.grid(True) 95 | plt.show(False) 96 | 97 | return boundPointsCordsArray, fromToeOriginRowVec, coordTransMat 98 | ''' 99 | BSD 2 license. 100 | 101 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 102 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 103 | All rights reserved. 104 | 105 | Redistribution and use in source and binary forms, with or without 106 | modification, are permitted provided that the following conditions are 107 | met: 108 | 109 | 1. Redistributions of source code must retain the above copyright notice, 110 | this list of conditions and the following disclaimer. 111 | 112 | 2. Redistributions in binary form must reproduce the above copyright 113 | notice, this list of conditions and the following disclaimer in the 114 | documentation and/or other materials provided with the distribution. 115 | 116 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 117 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 118 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 119 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 120 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 121 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 122 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 123 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 124 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 125 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 126 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 127 | ''' 128 | -------------------------------------------------------------------------------- /pycss_lem/obtainmaxdepthdist.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | 4 | ''' 5 | # Description. 6 | With the extreme points of the defined slope, this function obtains the 7 | lower possible boundary in where a slip circle can be, i.e. obtains the 8 | maximum depth computed from the slope toe. 9 | 10 | # Input(s). 11 | Height of the slope (slopeHeight). 12 | 13 | Slope dip, can be given by an angle in gradians, angle in radians, a 14 | horizontal distance value relative to a unitary vertical distance (i.e. 15 | horz:1), or a bidimensional vector which represents a horizontal distance and 16 | a vertical distance that not necessary representing the real slope distances 17 | [horzDist, vertDist], (slopeDip). 18 | 19 | Crown horizontal plane distance (crownDist). 20 | 21 | Toe horizontal plane distance (toeDist). 22 | 23 | # Output(s): 24 | Vertical distance from the slide--toe to downwards (toeDepth). 25 | 26 | # Example1: By giving next values: 27 | slopeHeight = 12; slopeDip = np.array([2.5, 1]); crownDist = 10.0;\ 28 | toeDist = 10.0; it is obtained a toeDepth = 14.44. 29 | 30 | --- 31 | toeDepth = obtainmaxdepthdist(slopeHeight, slopeDip, crownDist, toeDist) 32 | ''' 33 | def obtainmaxdepthdist(slopeHeight, slopeDip, crownDist, toeDist): 34 | 35 | #Calculation assuming coordinates origin at the slip--toe 36 | extremeToePointVec = np.array([toeDist, 0]) 37 | 38 | #slope vertical projection (horizontal distance) 39 | slopeDist = slopeHeight*slopeDip[0]/slopeDip[1] 40 | 41 | extremeCrownPointVec = np.array([-(slopeDist +crownDist), slopeHeight]) 42 | 43 | #distance between the two extreme points 44 | differenceVec = extremeToePointVec-extremeCrownPointVec 45 | distExtrPts = np.sqrt(np.dot(differenceVec, differenceVec)) 46 | maximumCircleRadius = distExtrPts/2*distExtrPts/differenceVec[0] 47 | 48 | #the toe depth is the difference between the maximum--circle radius and the 49 | #slope height 50 | toeDepth = maximumCircleRadius-slopeHeight 51 | 52 | return toeDepth 53 | ''' 54 | BSD 2 license. 55 | 56 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 57 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 58 | All rights reserved. 59 | 60 | Redistribution and use in source and binary forms, with or without 61 | modification, are permitted provided that the following conditions are 62 | met: 63 | 64 | 1. Redistributions of source code must retain the above copyright notice, 65 | this list of conditions and the following disclaimer. 66 | 67 | 2. Redistributions in binary form must reproduce the above copyright 68 | notice, this list of conditions and the following disclaimer in the 69 | documentation and/or other materials provided with the distribution. 70 | 71 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 72 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 73 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 74 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 75 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 76 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 77 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 78 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 79 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 80 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 81 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 82 | ''' 83 | -------------------------------------------------------------------------------- /pycss_lem/plotslice.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import matplotlib.pyplot as plt 3 | 4 | ''' 5 | # Description. 6 | Plot one slide from its structure. 7 | 8 | # Input(s). 9 | Slices dictionary type structures (slicesSTRCell). Has the following fields: 10 | plineCords: contains all the coordiantes that gives the 11 | slice closed polyline; 12 | area: slice polygon area; 13 | midPoint: coordinates of the middle point of the slice at its base; 14 | midHeight: value of the mean height taken the initial, 15 | middle and end heights of the slice at its base to terrain surface; 16 | width: value of width slice; 17 | inclinationAngleGradAtBottom: angle in sexagesimal grades of the 18 | secant line that passess trough the extreme borders of the bottom slice; 19 | inclinationAngleGradAtTop: angle in sexagesimal grades of the 20 | secant line that passess trough the extreme borders of the top slice; 21 | wtMidHeight: value of the mean height taken the initial, 22 | middle and end heights of the slice at its base to watertable surface; 23 | wtMidHeightAboveSlope: value of the mean height taken the initial, 24 | middle and end heights of the water column above slope surface; 25 | hrzMomentArm: value of the horizontal component of the moment arm acting 26 | on the slope due to the water above it; 27 | vrtMomentArm: value of the vertical component of the moment arm acting 28 | on the slope due to the water above it; 29 | 30 | # Output(s). 31 | Array containing the coordinates of the slice contourn 32 | (slicePlineCordsArray). 33 | 34 | # Example1. 35 | slicesSTR = \ 36 | {'area': 18.063276613019383, 37 | 'hrzMomentArm': -5.4527963142320601, 38 | 'inclinationAngleGradAtBottom': 21.379968728885775, 39 | 'inclinationAngleGradAtTop': 68.198590513648185, 40 | 'midHeight': 8.6015602919139909, 41 | 'midPoint': np.array([ 11.45 , 3.07666551]), 42 | 'plineCords': np.array([[ 10.4 , 14.30322581], 43 | [ 10.4 , 3.4877326 ], 44 | [ 11.45 , 3.07666551], 45 | [ 12.5 , 2.66559843], 46 | [ 12.5 , 9.05322581], 47 | [ 10.4 , 14.30322581]]), 48 | 'vrtMomentArm': 5.3266677434544878, 49 | 'width': 2.0999999999999996, 50 | 'wtMidHeight': 8.6015602919139909, 51 | 'wtMidHeightAboveSlope': 0.0} 52 | 53 | --- 54 | slicePlineCordsArray = plotslice(slicesSTR) 55 | ''' 56 | def plotslice(slicesSTR): 57 | # plt.hold(True) 58 | #Plot the slice contourn and middle point 59 | plt.plot(slicesSTR['plineCords'][:,0], slicesSTR['plineCords']\ 60 | [:,1], 'k-', lw=0.5) 61 | plt.plot(slicesSTR['midPoint'][0], slicesSTR['midPoint'][1], 'k.', lw=0.3) 62 | 63 | #redirecting the to the output variable 64 | slicePlineCordsArray = slicesSTR['plineCords'] 65 | 66 | return slicePlineCordsArray 67 | ''' 68 | BSD 2 license. 69 | 70 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 71 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 72 | All rights reserved. 73 | 74 | Redistribution and use in source and binary forms, with or without 75 | modification, are permitted provided that the following conditions are 76 | met: 77 | 78 | 1. Redistributions of source code must retain the above copyright notice, 79 | this list of conditions and the following disclaimer. 80 | 81 | 2. Redistributions in binary form must reproduce the above copyright 82 | notice, this list of conditions and the following disclaimer in the 83 | documentation and/or other materials provided with the distribution. 84 | 85 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 86 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 87 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 88 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 89 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 90 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 91 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 92 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 93 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 94 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 95 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 96 | ''' 97 | -------------------------------------------------------------------------------- /pycss_lem/polyarea.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | 4 | ''' 5 | # Description. 6 | determine the area of a simple polygon whose vertices are described by 7 | ordered pairs in the plane based on Gauss's area formula. 8 | 9 | # Input(s). 10 | 1xn vector with x-coordinates of the polygon (xCoord). 11 | 12 | 1xn vector with y-coordinates of the polygon (yCoord). 13 | 14 | # Output(s): 15 | polygon area (area) 16 | 17 | # Example1: by giving next values 18 | xCoord = np.arange(1,10) 19 | yCoord = xCoord**2 20 | 21 | is obtained: area = 84.0 22 | 23 | --- 24 | area = polyarea(xCoord, yCoord) 25 | ''' 26 | def polyarea(xCoord, yCoord): 27 | area = 0.5*np.abs(np.dot(xCoord, np.roll(yCoord, 1))-\ 28 | np.dot(yCoord, np.roll(xCoord, 1))) 29 | return area 30 | ''' 31 | BSD 2 license. 32 | 33 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 34 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 35 | All rights reserved. 36 | 37 | Redistribution and use in source and binary forms, with or without 38 | modification, are permitted provided that the following conditions are 39 | met: 40 | 41 | 1. Redistributions of source code must retain the above copyright notice, 42 | this list of conditions and the following disclaimer. 43 | 44 | 2. Redistributions in binary form must reproduce the above copyright 45 | notice, this list of conditions and the following disclaimer in the 46 | documentation and/or other materials provided with the distribution. 47 | 48 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 49 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 50 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 51 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 52 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 53 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 54 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 55 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 56 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 57 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 58 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 59 | ''' 60 | -------------------------------------------------------------------------------- /pycss_lem/pyCSS.py: -------------------------------------------------------------------------------- 1 | ''' 2 | # Description. 3 | This is the graphical user interface (GUI) module in order to perform a \ 4 | circular arc slope stability analysis by the limit equilibrium model by 5 | Fellenius and Bishop symplified methods implemented in pyCSS program. 6 | ''' 7 | 8 | #------------------------------------------------------------------------------ 9 | ## Add functions path 10 | import sys 11 | sys.path += ['./functions'] 12 | 13 | #------------------------------------------------------------------------------ 14 | ## Modules/Functions import 15 | from tkinter import * 16 | import tkinter.ttk as ttk 17 | from tkinter import messagebox 18 | import numpy as np 19 | import time 20 | 21 | from automaticslipcircles import automaticslipcircles 22 | from onlyonecircle import onlyonecircle 23 | 24 | #####---------------------------------------------------------------------##### 25 | ## master window 26 | 27 | gui = Tk() 28 | gui.geometry("790x370") 29 | gui.title('pyCSS') 30 | 31 | #####---------------------------------------------------------------------##### 32 | ## Poject data ## 33 | projectDataFrame = LabelFrame(gui, relief=RIDGE, borderwidth=1.5, \ 34 | text='Información del proyecto', width=200, height=105).place(x=20, y=20) 35 | 36 | Label(projectDataFrame, text='Título').place(x=30, y=40) 37 | projectNameVal = StringVar() ##### projectName ##### 38 | Entry(projectDataFrame, width=15, textvariable=projectNameVal).place(x=84, \ 39 | y=40) 40 | 41 | Label(projectDataFrame, text='Autor').place(x=30, y=60) 42 | projectAuthorVal = StringVar() ##### projectAuthor ##### 43 | Entry(projectDataFrame, width=15, textvariable=projectAuthorVal).place(x=84,\ 44 | y=60) 45 | 46 | def setwaterunitweight(): 47 | if units.get() == 1: 48 | waterUnitWeightVal.set(9.81) 49 | elif units.get() == 2: 50 | waterUnitWeightVal.set(62.4) 51 | Label(projectDataFrame, text='Unidades').place(x=30, y=90) 52 | units = IntVar()##### units ##### 53 | Radiobutton(projectDataFrame, text='m - kN/m3 - kPa', value=1, \ 54 | variable=units, command=setwaterunitweight).place(x=90, y=80) 55 | Radiobutton(projectDataFrame, text='ft - pcf - psf', value=2, \ 56 | variable=units, command=setwaterunitweight).place(x=90, y=97.5) 57 | units.set(1) 58 | 59 | #####---------------------------------------------------------------------##### 60 | ## slope geometry ## 61 | 62 | geometrySlopeFrame = LabelFrame(gui, relief=RIDGE, borderwidth=1.5, width=200,\ 63 | height=170, text='Geometría del talud').place(x=20, y=140) 64 | 65 | Label(geometrySlopeFrame, text='Altura').place(x=30, y=160) 66 | slopeHeightVal = DoubleVar() ##### slopeHeight ##### 67 | Entry(geometrySlopeFrame, width=8, textvariable=slopeHeightVal).place(x=140, \ 68 | y=160) 69 | 70 | Label(geometrySlopeFrame, text='Longitud corona').place(x=30, y=180) 71 | crownDistVal = DoubleVar() #### crownDist ##### 72 | Entry(geometrySlopeFrame, width=8, textvariable=crownDistVal).place(x=140, \ 73 | y=180) 74 | 75 | Label(geometrySlopeFrame, text='Longitud pie').place(x=30, y=200) 76 | toeDistVal = DoubleVar() ##### toeDist ##### 77 | Entry(gui, width=8, textvariable=toeDistVal).place(x=140, \ 78 | y=200) 79 | 80 | Label(geometrySlopeFrame, text='Pendiente').place(x=30, y=230) 81 | Label(geometrySlopeFrame, text=u'\u0394'+'x:', font='Verdana 8').\ 82 | place(x=105, y=220) 83 | slopeDip0 = DoubleVar() ##### slopeDip-0 ##### 84 | Entry(geometrySlopeFrame, width=8, textvariable=slopeDip0).place(x=140, \ 85 | y=220) 86 | Label(geometrySlopeFrame, text=u'\u0394'+'y:', font='Verdana 8').\ 87 | place(x=105, y=240) 88 | slopeDip1 = DoubleVar() ##### slopeDip-1 ##### 89 | Entry(geometrySlopeFrame, width=8, textvariable=slopeDip1).place(x=140, \ 90 | y=240) 91 | 92 | Label(geometrySlopeFrame, text='Profundidad').place(x=30, y=260) 93 | toeDepthVal = DoubleVar() ##### toeDepth ##### 94 | Entry(geometrySlopeFrame, width=8, textvariable=toeDepthVal, \ 95 | state='normal').place(x=140, y=260) 96 | def toeDepthValActivate(): 97 | if wantAutomaticToeDepthVal.get() == True: 98 | Entry(geometrySlopeFrame, width=8, textvariable=toeDepthVal, \ 99 | state='disabled').place(x=140, y=260) 100 | else: 101 | Entry(geometrySlopeFrame, width=8, textvariable=toeDepthVal, \ 102 | state='normal').place(x=140, y=260) 103 | wantAutomaticToeDepthVal = BooleanVar() ##### wantAutomaticToeDepth ##### 104 | Checkbutton(geometrySlopeFrame, text='Profundidad automática', \ 105 | variable=wantAutomaticToeDepthVal, onvalue=True, offvalue=False, \ 106 | command=toeDepthValActivate).place(x=40, y=280) 107 | 108 | #####---------------------------------------------------------------------##### 109 | ## Slip arc-circle ## 110 | 111 | # only one circle 112 | slipCircleFrame = LabelFrame(gui, relief=RIDGE, borderwidth=1.5, width=540, \ 113 | height=125, text='Superficie circular').place(x=230,y=20) 114 | 115 | wantEvaluateOnlyOneSurfaceVal = BooleanVar() ### wantEvaluateOnlyOneSurface ### 116 | wantEvaluateOnlyOneSurfaceVal.set(True) 117 | def wantEvaluateOnlyOneSurfaceActivate(): 118 | if wantEvaluateOnlyOneSurfaceVal.get() == True: 119 | Entry(slipCircleFrame, width=8, textvariable=\ 120 | hztDistPointAtCrownFromCrownVal, state='normal').place(x=366, y=60) 121 | Entry(slipCircleFrame, width=8, \ 122 | textvariable=hztDistPointAtToeFromCrownVal, state='normal').place(\ 123 | x=366, y=80) 124 | Entry(slipCircleFrame, width=8, textvariable=slipRadiusVal, \ 125 | state='normal').place(x=366, y=100) ###--- 126 | Entry(slipCircleFrame, width=8, textvariable=numCirclesVal, \ 127 | state='disabled').place(x=690, y=40) 128 | Entry(slipCircleFrame, width=8, textvariable=radiusIncrementVal, \ 129 | state='disabled').place(x=690, y=60) 130 | Entry(slipCircleFrame, width=8, textvariable=numberIncrementsVal, \ 131 | state='disabled').place(x=690, y=80) 132 | Entry(slipCircleFrame, width=8, textvariable=maxFsValueContVal, \ 133 | state='disabled').place(x=690, y=100) ###--- 134 | ttk.Combobox(values=['Fellenius', 'Bishop', 'Ambos'], state='normal',\ 135 | textvariable=methodStringVal, width=7).place(x=420, y=300) 136 | else: 137 | Entry(slipCircleFrame, width=8, textvariable=\ 138 | hztDistPointAtCrownFromCrownVal, state='disabled').place(\ 139 | x=366, y=60) 140 | Entry(slipCircleFrame, width=8, \ 141 | textvariable=hztDistPointAtToeFromCrownVal, state='disabled').\ 142 | place(x=366, y=80) 143 | Entry(slipCircleFrame, width=8, textvariable=slipRadiusVal, \ 144 | state='disabled').place(x=366, y=100) ###--- 145 | Entry(slipCircleFrame, width=8, textvariable=numCirclesVal, \ 146 | state='normal').place(x=690, y=40) 147 | Entry(slipCircleFrame, width=8, textvariable=radiusIncrementVal, \ 148 | state='normal').place(x=690, y=60) 149 | Entry(slipCircleFrame, width=8, textvariable=numberIncrementsVal, \ 150 | state='normal').place(x=690, y=80) 151 | Entry(slipCircleFrame, width=8, textvariable=maxFsValueContVal, \ 152 | state='normal').place(x=690, y=100) ###--- 153 | methodStringVal.set('Ambos') 154 | ttk.Combobox(values=['Fellenius', 'Bishop', 'Ambos'], state='disable',\ 155 | textvariable=methodStringVal, width=7).place(x=420, y=300) 156 | Checkbutton(slipCircleFrame, text='Evaluar una única superficie', \ 157 | variable=wantEvaluateOnlyOneSurfaceVal, onvalue=True, offvalue=False, \ 158 | command=wantEvaluateOnlyOneSurfaceActivate).place(x=235, y=40) 159 | 160 | Label(slipCircleFrame, text='Primer punto*').place(x=240, y=60) 161 | hztDistPointAtCrownFromCrownVal = DoubleVar() ## hztDistPointAtCrownFromCrown # 162 | Entry(slipCircleFrame, width=8, textvariable=hztDistPointAtCrownFromCrownVal)\ 163 | .place(x=366, y=60) 164 | 165 | Label(slipCircleFrame, text='Segundo punto*').place(x=240, y=80) 166 | hztDistPointAtToeFromCrownVal = DoubleVar() ## hztDistPointAtToeFromCrownVal ## 167 | Entry(slipCircleFrame, width=8, textvariable=hztDistPointAtToeFromCrownVal)\ 168 | .place(x=366, y=80) 169 | 170 | Label(slipCircleFrame, text='Radio').place(x=240, y=100) 171 | slipRadiusVal = DoubleVar() ##### slipRadius ##### 172 | Entry(slipCircleFrame, width=8, textvariable=slipRadiusVal)\ 173 | .place(x=366, y=100) 174 | 175 | Label(slipCircleFrame, text='* Medida horizontal desde el vértice de la '+ 176 | 'corona. Valores a la izquierda del vértice son negativos y a la '+ 177 | 'derecha positivos.', justify='left', font='Arial 7').place(x=240, y=120) 178 | 179 | # multiple circles 180 | Label(slipCircleFrame, text='Número de superficies consideradas').\ 181 | place(x=460, y=40) 182 | numCirclesVal = DoubleVar() ##### numCircles ##### 183 | Entry(slipCircleFrame, width=8, textvariable=numCirclesVal, state='disabled'\ 184 | ).place(x=690, y=40) 185 | numCirclesVal.set(500) 186 | 187 | Label(slipCircleFrame, text='Longitud que aumenta el radio').place(x=460, y=60) 188 | radiusIncrementVal = DoubleVar() ##### radiusIncrement ##### 189 | Entry(slipCircleFrame, width=8, textvariable=radiusIncrementVal, \ 190 | state='disabled').place(x=690, y=60) 191 | radiusIncrementVal.set(3) 192 | 193 | Label(slipCircleFrame, text='Cantidad de incrementos en el radio').\ 194 | place(x=460, y=80) 195 | numberIncrementsVal = DoubleVar() ##### numberIncrements ##### 196 | Entry(slipCircleFrame, width=8, textvariable=numberIncrementsVal, \ 197 | state='disabled').place(x=690, y=80) 198 | numberIncrementsVal.set(4) 199 | 200 | Label(slipCircleFrame, text='Máximo valor de Fs para mostrar', justify='left')\ 201 | .place(x=460, y=100) 202 | maxFsValueContVal = DoubleVar() ##### maxFsValueCont ##### 203 | Entry(slipCircleFrame, width=8, textvariable=maxFsValueContVal, \ 204 | state='disabled').place(x=690, y=100) 205 | maxFsValueContVal.set(3) 206 | 207 | #####---------------------------------------------------------------------##### 208 | ## watertable surface ## 209 | 210 | watertableFrame = LabelFrame(gui, relief=RIDGE, borderwidth=1.5, width=270, \ 211 | height=90, text='Nivel freático').place(x=230, y=150) 212 | 213 | Label(watertableFrame, text='Profundidad desde la corona').place(\ 214 | x=240, y=190) 215 | wtDepthAtCrownVal = DoubleVar() ##### wtDepthAtCrown ##### 216 | Entry(watertableFrame, width=8, textvariable=wtDepthAtCrownVal).place(x=420, \ 217 | y=190) 218 | 219 | toeUnderWatertableVal = BooleanVar() ##### toeUnderWatertable ##### 220 | Checkbutton(watertableFrame, text='Talud parcialmente sumergido', \ 221 | variable=toeUnderWatertableVal, onvalue=True, offvalue=False).place(\ 222 | x=235, y=210) 223 | 224 | wantWatertableVal = BooleanVar() ##### wantWatertable ##### 225 | wantWatertableVal.set(True) 226 | def wantWatertableActivate(): 227 | if wantWatertableVal.get() == True: 228 | Entry(watertableFrame, width=8, textvariable=wtDepthAtCrownVal, \ 229 | state='normal').place(x=420, y=190) 230 | Checkbutton(watertableFrame, text='Talud parcialmente sumergido', \ 231 | variable=toeUnderWatertableVal, onvalue=True, offvalue=False, \ 232 | state='normal').place(x=235, y=210) 233 | else: 234 | Entry(watertableFrame, width=8, textvariable=wtDepthAtCrownVal, \ 235 | state='disabled').place(x=420, y=190) 236 | Checkbutton(watertableFrame, text='Talud parcialmente sumergido', \ 237 | variable=toeUnderWatertableVal, onvalue=True, offvalue=False, \ 238 | state='disabled').place(x=235, y=210) 239 | Checkbutton(watertableFrame, text='Incluir nivel freático', \ 240 | variable=wantWatertableVal, onvalue=True, offvalue=False, \ 241 | command=wantWatertableActivate).place(x=235, y=170) 242 | 243 | #####---------------------------------------------------------------------##### 244 | ## Material properties ## 245 | 246 | watertableFrame = LabelFrame(gui, relief=RIDGE, borderwidth=1.5, width=260, \ 247 | height=115, text='Propiedades de los materiales').place(x=510, y=150) 248 | 249 | Label(watertableFrame, text='Peso específico del agua').place(\ 250 | x=520, y=170) 251 | waterUnitWeightVal = DoubleVar() ##### waterUnitWeight ##### 252 | Entry(watertableFrame, width=8, textvariable=waterUnitWeightVal).place(x=690, \ 253 | y=170) 254 | waterUnitWeightVal.set(9.81) 255 | 256 | Label(watertableFrame, text='Peso específico del suelo').place(\ 257 | x=520, y=190) 258 | materialUnitWeightVal = DoubleVar() ##### materialUnitWeight ##### 259 | Entry(watertableFrame, width=8, textvariable=materialUnitWeightVal).place(\ 260 | x=690, y=190) 261 | 262 | Label(watertableFrame, text='Ángulo de fricción del suelo').place(\ 263 | x=520, y=210) 264 | frictionAngleGradVal = DoubleVar() ##### frictionAngleGrad ##### 265 | Entry(watertableFrame, width=8, textvariable=frictionAngleGradVal).place(\ 266 | x=690, y=210) 267 | 268 | Label(watertableFrame, text='Cohesión del suelo').place(\ 269 | x=520, y=230) 270 | cohesionVal = DoubleVar() ##### cohesion ##### 271 | Entry(watertableFrame, width=8, textvariable=cohesionVal).place(\ 272 | x=690, y=230) 273 | 274 | #####---------------------------------------------------------------------##### 275 | ## Advanced variables ## 276 | 277 | watertableFrame = LabelFrame(gui, relief=RIDGE, borderwidth=1.5, width=270, \ 278 | height=110, text='Variables avanzadas').place(x=230, y=240) 279 | 280 | Label(watertableFrame, text='Número de dovelas').place(x=240, y=260) 281 | numSlicesVal = IntVar() ##### numSlices ##### 282 | Spinbox(watertableFrame, from_=2, to=50, width=7, textvariable=numSlicesVal).\ 283 | place(x=420, y=260) 284 | numSlicesVal.set(10) 285 | 286 | wantConstSliceWidthTrueVal = BooleanVar() ##### wantConstSliceWidthTrue ##### 287 | Checkbutton(watertableFrame, text='Ancho de las dovelas constante', \ 288 | variable=wantConstSliceWidthTrueVal, onvalue=True, offvalue=False).place(\ 289 | x=240, y=280) 290 | wantConstSliceWidthTrueVal.set(True) 291 | 292 | Label(watertableFrame, text='Método de análisis').place(x=240, y=300) 293 | methodStringVal = StringVar() ##### methodString ##### 294 | ttk.Combobox(values=['Fellenius', 'Bishop', 'Ambos'],\ 295 | textvariable=methodStringVal, width=7).place(x=420, y=300) 296 | methodStringVal.set('Bishop') 297 | 298 | Label(watertableFrame, text='Formato de la imágen').place(x=240, y=320) 299 | outputFormatImgVal = StringVar() ##### outputFormatImg ##### 300 | outputFormatImgList = ['.eps', '.jpeg', '.jpg', '.pdf', '.pgf', '.png', '.ps',\ 301 | '.raw', '.rgba', '.svg', '.svgz', '.tif', '.tiff'] 302 | ttk.Combobox(values=outputFormatImgList, textvariable=outputFormatImgVal, \ 303 | width=7).place(x=420, y=320) 304 | outputFormatImgVal.set('.svg') 305 | 306 | def exitgui(): 307 | return gui.quit() 308 | #gui.destroy(), 309 | def cssanalysis(): 310 | ## Units 311 | unitTemp = units.get() 312 | if unitTemp == 1: 313 | unitsTuple = ('m', 'kN/m3', 'kPa') 314 | else: 315 | unitsTuple = ('ft', 'pcf', 'psf') 316 | ## Poject data 317 | projectName = projectNameVal.get() 318 | projectAuthor = projectAuthorVal.get() 319 | projectDate = time.strftime("%d/%m/%y") 320 | ## The slope geometry 321 | slopeHeight = [slopeHeightVal.get(), unitsTuple[0]] 322 | crownDist = [crownDistVal.get(), unitsTuple[0]] 323 | toeDist = [toeDistVal.get(), unitsTuple[0]] 324 | slopeDip = np.array([slopeDip0.get(), slopeDip1.get()]) 325 | toeDepth = [toeDepthVal.get(), unitsTuple[0]] 326 | wantAutomaticToeDepth = wantAutomaticToeDepthVal.get() 327 | # The slip arc-circle 328 | wantEvaluateOnlyOneSurface = wantEvaluateOnlyOneSurfaceVal.get() 329 | hztDistPointAtCrownFromCrown = [hztDistPointAtCrownFromCrownVal.get(),\ 330 | unitsTuple[0]] 331 | hztDistPointAtToeFromCrown = [hztDistPointAtToeFromCrownVal.get(),\ 332 | unitsTuple[0]] 333 | slipRadius = [slipRadiusVal.get(), unitsTuple[0]] 334 | numCircles = int(numCirclesVal.get()) 335 | radiusIncrement = [radiusIncrementVal.get(), unitsTuple[0]] 336 | numberIncrements = int(numberIncrementsVal.get()) 337 | maxFsValueCont = maxFsValueContVal.get() 338 | # Watertable 339 | wtDepthAtCrown = [wtDepthAtCrownVal.get(), unitsTuple[0]] 340 | toeUnderWatertable = toeUnderWatertableVal.get() 341 | wantWatertable = wantWatertableVal.get() 342 | # Materials properties. 343 | waterUnitWeight = [waterUnitWeightVal.get(), unitsTuple[1]] 344 | materialUnitWeight = [materialUnitWeightVal.get(), unitsTuple[1]] 345 | frictionAngleGrad = [frictionAngleGradVal.get(), 'degrees'] 346 | cohesion = [cohesionVal.get(), unitsTuple[2]] 347 | # Advanced inputs 348 | numSlices = numSlicesVal.get() 349 | nDivs = numSlices 350 | wantConstSliceWidthTrue = wantConstSliceWidthTrueVal.get() 351 | if methodStringVal.get() == 'Fellenius': 352 | methodString = 'Flns' 353 | elif methodStringVal.get() == 'Bishop': 354 | methodString = 'Bshp' 355 | else: 356 | methodString = 'Allm' 357 | outputFormatImg = outputFormatImgVal.get() 358 | 359 | #-------------------------------------------------------------------------- 360 | # Operations for only one slip surface 361 | if wantEvaluateOnlyOneSurface == True: 362 | msg = onlyonecircle(projectName, projectAuthor, projectDate, \ 363 | slopeHeight, slopeDip, crownDist, toeDist, wantAutomaticToeDepth, \ 364 | toeDepth,hztDistPointAtCrownFromCrown, hztDistPointAtToeFromCrown,\ 365 | slipRadius, wantWatertable, wtDepthAtCrown, toeUnderWatertable, \ 366 | waterUnitWeight, materialUnitWeight, frictionAngleGrad, cohesion, \ 367 | wantConstSliceWidthTrue, numSlices, nDivs, methodString, \ 368 | outputFormatImg) 369 | messagebox.showinfo(title='pyCSS', message=msg) 370 | anotherAnalysis = messagebox.askyesno(title='pyCSS', message='¿Desea'+\ 371 | ' realizar otro análisis?') 372 | 373 | #-------------------------------------------------------------------------- 374 | # Operations for multiple slip surface 375 | else: 376 | automaticslipcircles(projectName, projectAuthor, projectDate, \ 377 | slopeHeight, slopeDip, crownDist, toeDist, wantAutomaticToeDepth, \ 378 | toeDepth, numCircles, radiusIncrement, numberIncrements, \ 379 | maxFsValueCont, wantWatertable, wtDepthAtCrown, \ 380 | toeUnderWatertable, waterUnitWeight, materialUnitWeight, \ 381 | frictionAngleGrad, cohesion, wantConstSliceWidthTrue, numSlices, \ 382 | nDivs, methodString, outputFormatImg) 383 | messagebox.showinfo(title='pyCSS', \ 384 | message='Analysis successfully!') 385 | anotherAnalysis = messagebox.askyesno(title='pyCSS', message='¿Desea'+\ 386 | ' realizar otro análisis?') 387 | 388 | if anotherAnalysis == False: 389 | exitgui() ##### close GUI ##### 390 | 391 | cssanalysisButton = Button(gui, text='Ejecutar análisis', command=cssanalysis,\ 392 | height=1, width=29).place(x=510, y=280) 393 | 394 | exitButton = Button(gui, text='Salir', command=exitgui,\ 395 | height=1, width=29).place(x=510, y=320) 396 | 397 | gui.mainloop() 398 | ''' 399 | BSD 2 license. 400 | 401 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 402 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 403 | All rights reserved. 404 | 405 | Redistribution and use in source and binary forms, with or without 406 | modification, are permitted provided that the following conditions are 407 | met: 408 | 409 | 1. Redistributions of source code must retain the above copyright notice, 410 | this list of conditions and the following disclaimer. 411 | 412 | 2. Redistributions in binary form must reproduce the above copyright 413 | notice, this list of conditions and the following disclaimer in the 414 | documentation and/or other materials provided with the distribution. 415 | 416 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 417 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 418 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 419 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 420 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 421 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 422 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 423 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 424 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 425 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 426 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 427 | ''' 428 | -------------------------------------------------------------------------------- /pycss_lem/reportslicestructurevalues.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | 4 | ''' 5 | # Description. 6 | Transform and summarize the slices structures into an array 7 | 8 | # Input(s). 9 | List containing all the slices dictionary type structures (slicesSTRCell). 10 | 11 | # Output(s). 12 | Slices dictionary type structures summarized into an nx7 array which rows are 13 | each slice data, and columns are 'Abscissa', 'Ordinate', 'Area', 'Width', 14 | 'Height', 'Secant Angle Grads', and 'Water Height' respectively. 15 | (reportedArray). 16 | 17 | n+1x8 array like table, that summarizes the data structures of all slices. 18 | the fields in the first row corresponds to the labels in the table; 19 | the first column is an index numbering; and other cells are the same 20 | as 'reportedArray' (reportCell). 21 | 22 | # Example: 23 | # inputs: 24 | slopeHeight = 12.0; slopeDip = np.array([1, 2.5]); crownDist = 10.0 25 | toeDist = 10.0; wtDepthAtCrown = 0; numSlices = 10; slipRadius = 15 26 | pointAtToeVec = np.array([23, 3.3]); pointAtCrownVec = np.array([2, 15.3]) 27 | # Previous functions 28 | boundPointsCordsArray, fromToeOriginRowVec, coordTransMat = materialboundary(\ 29 | slopeHeight, slopeDip, crownDist, toeDist) 30 | surfaceDataCell, surfaceChordsArray = terrainsurface(fromToeOriginRowVec, \ 31 | slopeHeight, slopeDip, crownDist, toeDist) 32 | watertableDataCell, wtCoordsArray = defineswatertable(wtDepthAtCrown, \ 33 | surfaceDataCell) 34 | existSlipCircleTrue, slipArcSTR = defineslipcircle(pointAtToeVec, \ 35 | pointAtCrownVec, slipRadius) 36 | slicesSTRCell = divideslipintoslices(slipArcSTR, surfaceDataCell, \ 37 | watertableDataCell, numSlices, pointAtToeVec, pointAtCrownVec) 38 | # This function 39 | print(reportslicestructurevalues(slicesSTRCell)) 40 | --- 41 | # reportCell, reportedArray = reportslicestructurevalues(slicesSTRCell) 42 | ''' 43 | def reportslicestructurevalues(slicesSTRCell): 44 | numberSlices = len(slicesSTRCell) 45 | reportedArray = np.zeros((numberSlices, 11)) 46 | 47 | temp = list(range(numberSlices)) 48 | for i in temp: 49 | reportedArray[i,0:2] =slicesSTRCell[i]['midPoint'] 50 | reportedArray[i,2] = slicesSTRCell[i]['area'] 51 | reportedArray[i,3] = slicesSTRCell[i]['width'] 52 | reportedArray[i,4] = slicesSTRCell[i]['midHeight'] 53 | reportedArray[i,5] = slicesSTRCell[i]['inclinationAngleGradAtBottom'] 54 | reportedArray[i,6] = slicesSTRCell[i]['inclinationAngleGradAtTop'] 55 | reportedArray[i,7] = slicesSTRCell[i]['wtMidHeight'] 56 | reportedArray[i,8] = slicesSTRCell[i]['wtMidHeightAboveSlope'] 57 | reportedArray[i,9] = slicesSTRCell[i]['hrzMomentArm'] 58 | reportedArray[i,10] = slicesSTRCell[i]['vrtMomentArm'] 59 | 60 | indexArray = np.reshape(temp,(len(temp),1)) 61 | namesCell = np.array([['Index', 'Abscissa', 'Ordinate', 'Area', 'Width', \ 62 | 'Height', 'Secant Angle Grad at Bottom', 'Angle Grad at Top', \ 63 | 'Water Height', 'Water Height Above Slope', 'Horizontal Moment Arm', \ 64 | 'Vertical Moment Arm']]) 65 | 66 | #Create the cell (like array) 67 | reportedArrayTemp = np.around(reportedArray, decimals=1) 68 | numericValues = np.concatenate((indexArray, reportedArrayTemp),1) 69 | reportCell = np.concatenate((namesCell[:], numericValues), 0) 70 | 71 | return reportCell, reportedArray 72 | ''' 73 | BSD 2 license. 74 | 75 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 76 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 77 | All rights reserved. 78 | 79 | Redistribution and use in source and binary forms, with or without 80 | modification, are permitted provided that the following conditions are 81 | met: 82 | 83 | 1. Redistributions of source code must retain the above copyright notice, 84 | this list of conditions and the following disclaimer. 85 | 86 | 2. Redistributions in binary form must reproduce the above copyright 87 | notice, this list of conditions and the following disclaimer in the 88 | documentation and/or other materials provided with the distribution. 89 | 90 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 91 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 92 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 93 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 94 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 95 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 96 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 97 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 98 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 99 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 100 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 101 | ''' 102 | -------------------------------------------------------------------------------- /pycss_lem/sliparcdiscretization.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | 5 | ''' 6 | # Description. 7 | Obtains the coordiantes and also plots the arc that forms the slip 8 | surface, knowing the points at crown and toe, number of slices and 9 | slip arc structure obtained previously with 'defineslipcircle' function. The 10 | segment arc is represented as a polyline, therefore one should give the 11 | number of segments the arc may de divided, but it is recommended to be 12 | equal to the number of slices in future calculations. 13 | 14 | # External sub-function(s): none. 15 | 16 | # Input(s). 17 | Two dimensional vector of the coordinates that defines the slip at the 18 | slope toe (pointAtToeVec); 19 | 20 | Two dimensional vector of the coordinates that defines the slip at the 21 | slope crown (pointAtCrownVec); 22 | 23 | Number of polylines that defines the arc (nDivs). 24 | 25 | Dictionary type structure of the arc that defines the slip (slipArcSTR). 26 | 27 | Boolean value of true if a plot of the resulting arc is wanted. Default value 28 | is False (want2plot). 29 | 30 | # Output(s). 31 | A n x 2 array that represents the coordiantes of the points that defines 32 | the slip arc (arcPointsCoordsArray). 33 | 34 | # Example1: 35 | pointAtToeVec = np.array([23, 3.3]); pointAtCrownVec = np.array([2, 15.3]) 36 | nDivs = 6; want2plot = True; 37 | slipArcSTR = {'center': np.array([ 31.39356183, 45.39357203]), 38 | 'deepDist': 10.908772031832854, 39 | 'endAngGrad': 284.45218279917071, 40 | 'iniAngGrad': 218.34366020340661, 41 | 'leftDist': -3.0912381712059478, 42 | 'radius': 34.4848} 43 | 44 | is obtaided: 45 | arcPointsCoordsArray= 46 | array([[ 23. , 11.94585834], 47 | [ 19.5 , 13.02468855], 48 | [ 16. , 14.53519091], 49 | [ 12.5 , 16.54509283], 50 | [ 9. , 19.1689687 ], 51 | [ 5.5 , 22.6180394 ], 52 | [ 2. , 27.35971626]]) 53 | 54 | --- 55 | arcPointsCoordsArray = sliparcdiscretization(pointAtToeVec, \ 56 | pointAtCrownVec, nDivs, slipArcSTR) 57 | ''' 58 | def sliparcdiscretization(pointAtToeVec, pointAtCrownVec, nDivs, slipArcSTR,\ 59 | want2plot = False ): 60 | 61 | ## Doing the math 62 | xCoordIni = pointAtCrownVec[0] 63 | xCoordEnd = pointAtToeVec[0] 64 | 65 | xCoords = np.linspace(xCoordIni, xCoordEnd, nDivs+1) 66 | yCoords = slipArcSTR['center'][1]-np.sqrt(slipArcSTR['radius']**2\ 67 | -(xCoords-slipArcSTR['center'][0])**2) 68 | 69 | arcPointsCoordsArray = np.transpose(np.vstack((xCoords, yCoords))) 70 | arcPointsCoordsArray = np.flipud(arcPointsCoordsArray) 71 | 72 | ## Plotting the arc 73 | if want2plot: 74 | # plt.hold(True) 75 | plt.axis('equal') 76 | plt.plot(arcPointsCoordsArray[:,0], arcPointsCoordsArray[:,1], 'g-') 77 | plt.grid(True) 78 | plt.show(False) 79 | 80 | return arcPointsCoordsArray 81 | ''' 82 | BSD 2 license. 83 | 84 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 85 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 86 | All rights reserved. 87 | 88 | Redistribution and use in source and binary forms, with or without 89 | modification, are permitted provided that the following conditions are 90 | met: 91 | 92 | 1. Redistributions of source code must retain the above copyright notice, 93 | this list of conditions and the following disclaimer. 94 | 95 | 2. Redistributions in binary form must reproduce the above copyright 96 | notice, this list of conditions and the following disclaimer in the 97 | documentation and/or other materials provided with the distribution. 98 | 99 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 100 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 101 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 102 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 103 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 104 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 105 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 106 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 107 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 108 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 109 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 110 | ''' 111 | -------------------------------------------------------------------------------- /pycss_lem/tangentlineatcirclept.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | from .unitvector import unitvector 4 | from .azimuthangle import azimuthangle 5 | 6 | ''' 7 | tangentlineatcirclept means: 'tangent--line at circle point' 8 | 9 | # Description. 10 | Calculates a line that is tangent to a specificed point that belongs to a 11 | circular arc. The code verifies if the point belongs to the circular arc 12 | equation (i.e. the circle), and tolerates some points that could be 13 | closer to the circle by recalculating the y coordianted based on the x 14 | coordinate of the point. If the point belongs to the circle of the arc, it 15 | verfies if that point is betwwen the limits that defines the arc. 16 | 17 | # External sub-function(s): unitvector, azimuthangle. 18 | 19 | # Input(s). 20 | Two-dimensional vector that defines the point that belongs to the circle 21 | (atCirclePointVec); 22 | 23 | Structure of an circular arc from which the circle belongs and at which 24 | the tanget line is wanted to obtain (slipCircleSTR). It's obtained previously 25 | with 'defineslipcircle' function. This structure has the following fields: 26 | center: center of the slip arc; 27 | radius: radius of the slip arc; 28 | iniAngGrad: counter clockwise angle (in sexagesimal grades) 29 | from a reference unit vector [1 0] to the initial radius that 30 | defines the arc; 31 | endAngGrad: counter clockwise angle (in sexagesimal grades) 32 | from a reference unit vector [1 0] to the final radius that 33 | defines the arc; 34 | deepDist: deepest distance from toe--point horizontal 35 | reference where the arc passes; 36 | leftDist: most left distance from toe--point vertical 37 | reference where the arc passes; 38 | 39 | # Output(s). 40 | Boolean variable with a true value if the given point is inside the 41 | circular arc (isPtBetweenArcLimitsTrue). 42 | 43 | Structure of an infinite line (tangentLineSTR). The following fields forms 44 | this structure: 45 | refPtVec 46 | unitVec 47 | slope 48 | nearestAzimuthAngRad 49 | farestAzimuthAngRad 50 | intercept 51 | Among the fields of this structure, some of them are easy to understand; 52 | but the nearesAzimuthAngRad is the angle of the azimuth (given in radians) 53 | of the tangent sense that is nearest to the reference vector [1 0] when 54 | turning couterclockwise sense. 55 | Then the 'farestAzimuthAngRad' is a similar azimuth angle of the oposite 56 | tangent sense. 57 | 58 | # Example1: 59 | atCirclePointVec = np.array([16.7036, 14.1941]) 60 | slipCircleSTR = {'center':np.array([31.3936, 45.3936]), 'radius':34.4848, 61 | 'iniAngGrad': 218.3437, 'endAngGrad': 284.4522, 'deepDist': 10.9088, 62 | 'leftDist': -3.0912} 63 | 64 | --- 65 | isPtBetweenArcLimitsTrue, tangentLineSTR = tangentlineatcirclept\ 66 | (atCirclePointVec, slipCircleSTR) 67 | ''' 68 | def tangentlineatcirclept(atCirclePointVec, slipCircleSTR): 69 | 70 | #Recalculating the point at circle 71 | distanceTolerance = 0.01*slipCircleSTR['radius'] 72 | 73 | #Point to cicle--center vector 74 | ptCenVec = atCirclePointVec-slipCircleSTR['center'] 75 | unitPtCenVec = unitvector(ptCenVec) 76 | 77 | #vector length 78 | vectorLength = np.sqrt(np.dot(ptCenVec, ptCenVec)) 79 | #vector length must be near to the circle radius 80 | if vectorLength <= slipCircleSTR['radius']+distanceTolerance and \ 81 | vectorLength >= slipCircleSTR['radius']-distanceTolerance: 82 | #Calculate the new at--circle point 83 | newAtCirclePtVec = slipCircleSTR['center']+slipCircleSTR['radius']\ 84 | *unitPtCenVec 85 | else: 86 | #print ('Error in "tangentlineatcirclept": The given point does not '+ 87 | #'belongs to the circle', sep="") 88 | newAtCirclePtVec = slipCircleSTR['center']+slipCircleSTR['radius']\ 89 | *unitPtCenVec 90 | 91 | #Tangent line paramemters 92 | tangentPoint = newAtCirclePtVec 93 | unitTangentVec = np.array([unitPtCenVec[1], -1*unitPtCenVec[0]]) 94 | if unitTangentVec[0] == 0: 95 | tangentSlope = np.inf 96 | else: 97 | tangentSlope = unitTangentVec[1]/unitTangentVec[0] 98 | tangentIntercept = tangentPoint[1]-tangentSlope*tangentPoint[0] 99 | 100 | #Verifying if the point is between the arc extremes 101 | azimuthAngleGrad = azimuthangle(unitPtCenVec)*180/np.pi 102 | if azimuthAngleGrad >= slipCircleSTR['iniAngGrad']: 103 | if azimuthAngleGrad <= slipCircleSTR['endAngGrad']: 104 | isPtBetweenArcLimitsTrue = True 105 | else: 106 | isPtBetweenArcLimitsTrue = False 107 | else: 108 | isPtBetweenArcLimitsTrue = False 109 | 110 | #calculating nearest and farest azimuth 111 | angle1Rad = azimuthangle(unitTangentVec) 112 | angle2Rad = azimuthangle(-1*unitTangentVec) 113 | if angle1Rad < angle2Rad: 114 | nearestAzimuthAngRad = angle1Rad 115 | farestAzimuthAngRad = angle2Rad 116 | elif angle1Rad > angle2Rad: 117 | nearestAzimuthAngRad = angle2Rad 118 | farestAzimuthAngRad = angle1Rad 119 | elif angle1Rad == angle2Rad: 120 | nearestAzimuthAngRad = angle1Rad 121 | farestAzimuthAngRad = angle1Rad 122 | 123 | #Building the structure 124 | tangentLineSTR = { 125 | 'refPtVec': tangentPoint, 126 | 'unitVec': unitTangentVec, 127 | 'slope': tangentSlope, 128 | 'nearestAzimuthAngRad': nearestAzimuthAngRad, 129 | 'farestAzimuthAngRad': farestAzimuthAngRad, 130 | 'intercept': tangentIntercept} 131 | 132 | return isPtBetweenArcLimitsTrue, tangentLineSTR 133 | ''' 134 | BSD 2 license. 135 | 136 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 137 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 138 | All rights reserved. 139 | 140 | Redistribution and use in source and binary forms, with or without 141 | modification, are permitted provided that the following conditions are 142 | met: 143 | 144 | 1. Redistributions of source code must retain the above copyright notice, 145 | this list of conditions and the following disclaimer. 146 | 147 | 2. Redistributions in binary form must reproduce the above copyright 148 | notice, this list of conditions and the following disclaimer in the 149 | documentation and/or other materials provided with the distribution. 150 | 151 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 152 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 153 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 154 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 155 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 156 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 157 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 158 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 159 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 160 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 161 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 162 | ''' 163 | -------------------------------------------------------------------------------- /pycss_lem/terrainsurface.py: -------------------------------------------------------------------------------- 1 | #Import modules 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | from .create2dsegmentstructure import create2dsegmentstructure 5 | 6 | ''' 7 | # Description. 8 | Defines and plots the slope surface tarrain as an open polygon. The 9 | polygon is stored on a list, in which each element is a dictionary type 10 | line structure. 11 | 12 | # External sub-function(s): 13 | create2dsegmentstructure. 14 | 15 | # Input(s). 16 | Vector that connects the toe with global coordinate system origin 17 | (fromToeOriginRowVec). Obtained with materialboundary function. 18 | 19 | Height of the slope (slopeHeight) 20 | 21 | Slope dip, given by a 1x2 vector which represents a horizontal distance and 22 | a vertical distance not necesary representing the real slope distances 23 | [horzDist, vertDist], (slopeDip). 24 | 25 | Crown horizontal distance (crownDist). 26 | 27 | Toe horizontal distance (toeDist). 28 | 29 | Logical value put as 'True' or 'False' if it is wanted to plot. Default 30 | value is 'False' (want2plot). 31 | 32 | # Output(s). 33 | One list that stores all the lines conforming the surface 34 | polyline (surfaceDataCell), in which each element is a dictionary type 35 | line structure. Each line has the following fields: 36 | iniPtVec: vector of the coordinates of the first line point; 37 | endPtVec: vector of the coordinates of the second line point; 38 | unitVec: unit vector that defines a direction; 39 | lambda: value that defines the segment length; 40 | slope: value that defines the slope of the line equation of the 41 | segment; 42 | azimuthRad: counter-clockwise angle (in radians) from a reference 43 | axis of [1, 0] to [0, 1]; 44 | intercept: value that defines the intercept of line equation of the 45 | segment. 46 | 47 | Coordinates of the slope terrain polyline given in a nx2 array 48 | (surfaceChordsArray). 49 | 50 | # Example: 51 | By putting the following input variables obtained with materialboundary 52 | function: 53 | 54 | slopeHeight = 12; slopeDip = np.array([1, 2.5]); crownDist = 10.0;\ 55 | toeDist = 10.0; fromToeOriginRowVec = np.array([-14.8, -3.30]) 56 | 57 | The first element of the surfaceDataCell list is the dictionary as follows: 58 | {'azimuthRad': 0.0, 59 | 'endPtVec': array([-19.6, 8.7]), 60 | 'iniPtVec': array([-29.6, 8.7]), 61 | 'intercept': 8.6999999999999993, 62 | 'lambda': 10.0, 63 | 'slope': 0.0, 64 | 'unitVec': array([ 1., 0.])} 65 | 66 | --- 67 | surfaceDataCell, surfaceChordsArray = terrainsurface(fromToeOriginRowVec, 68 | slopeHeight, slopeDip, crownDist, toeDist) 69 | ''' 70 | def terrainsurface(fromToeOriginRowVec, slopeHeight, slopeDip, crownDist, 71 | toeDist , want2plot = False): 72 | 73 | # Slope vertical projection (horizontal distance) 74 | slopeDist = slopeHeight*slopeDip[0]/slopeDip[1]; 75 | 76 | # Creating the temporal surface line coordiantes array 77 | relSurfaceChordsArray = np.array([ 78 | [-(crownDist +slopeDist), slopeHeight], 79 | [-slopeDist, slopeHeight], 80 | [0, 0], 81 | [toeDist, 0]]) 82 | 83 | # Creating the absolute coordinate system relative to toe 84 | tempo01 = fromToeOriginRowVec[0]+relSurfaceChordsArray[:,0] 85 | tempo02 = fromToeOriginRowVec[1]+relSurfaceChordsArray[:,1] 86 | surfaceChordsArray = np.transpose(np.vstack((tempo01, tempo02))) 87 | 88 | # Creating the data array of dictionary structures: 89 | numOfPoints = len(surfaceChordsArray[:,0]) 90 | 91 | surfaceDataCell = [] 92 | for i in list(range(numOfPoints-1)): 93 | iniPnt2dRowVec = surfaceChordsArray[i,:] 94 | endPnt2dRowVec = surfaceChordsArray[i+1,:] 95 | lineSTR = create2dsegmentstructure(iniPnt2dRowVec, endPnt2dRowVec) 96 | surfaceDataCell += [lineSTR] 97 | 98 | # Plotting 99 | if want2plot: 100 | # plt.hold(True) 101 | plt.axis('equal') 102 | plt.plot(surfaceChordsArray[:,0], surfaceChordsArray[:,1], 'r--', \ 103 | linewidth=1.5) 104 | plt.grid(True) 105 | plt.show(False) 106 | 107 | return surfaceDataCell, surfaceChordsArray 108 | ''' 109 | BSD 2 license. 110 | 111 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 112 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 113 | All rights reserved. 114 | 115 | Redistribution and use in source and binary forms, with or without 116 | modification, are permitted provided that the following conditions are 117 | met: 118 | 119 | 1. Redistributions of source code must retain the above copyright notice, 120 | this list of conditions and the following disclaimer. 121 | 122 | 2. Redistributions in binary form must reproduce the above copyright 123 | notice, this list of conditions and the following disclaimer in the 124 | documentation and/or other materials provided with the distribution. 125 | 126 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 127 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 128 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 129 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 130 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 131 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 132 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 133 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 134 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 135 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 136 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 137 | ''' 138 | -------------------------------------------------------------------------------- /pycss_lem/uniquewithtolerance.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | 4 | ''' 5 | # Description. 6 | Given an array of two columns (n x 2), the function extracts unique row 7 | values that are not necessarily and strictly equal among other rows; the 8 | desition is governed by a tolerance value. 9 | 10 | # Input(s). 11 | Array of n x 2 of dimension (array). 12 | 13 | Number that will define the tolerance of the selection criterium (tolerance). 14 | 15 | # Output(s). 16 | New array with unique rows (uniqueArray). 17 | 18 | # Example: 19 | Given the following array: 20 | array = np.array([\ 21 | [ 9. , 2. ], 22 | [ 7. , 4.123], 23 | [ 5. , 6.129], 24 | [ 7. , 8.12 ], 25 | [ 0. , 1.1 ], 26 | [ 9.001, 2. ]]) 27 | it's obtained: 28 | array([[ 0. , 1.1 ], 29 | [ 5. , 6.129], 30 | [ 7. , 4.123], 31 | [ 7. , 8.12 ], 32 | [ 9. , 2. ]]) 33 | --- 34 | uniqueArray = uniquewithtolerance(array, tolerance = 0.001) 35 | ''' 36 | def uniquewithtolerance( array, tolerance = 0.001): 37 | 38 | ## Doing the sort 39 | indexes = np.argsort(array, 0) 40 | sortedArray = array[indexes[:,0], :] 41 | 42 | ## Applying the tolerance criterium 43 | uniMaskX = np.diff(np.hstack((np.zeros(1), sortedArray[:,0]))) > tolerance 44 | uniMaskY = np.diff(np.hstack((np.zeros(1), sortedArray[:,1]))) > tolerance 45 | 46 | uniMask = np.logical_or(uniMaskX, uniMaskY) 47 | uniqueArray = sortedArray[uniMask,:] 48 | 49 | return uniqueArray 50 | ''' 51 | BSD 2 license. 52 | 53 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 54 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 55 | All rights reserved. 56 | 57 | Redistribution and use in source and binary forms, with or without 58 | modification, are permitted provided that the following conditions are 59 | met: 60 | 61 | 1. Redistributions of source code must retain the above copyright notice, 62 | this list of conditions and the following disclaimer. 63 | 64 | 2. Redistributions in binary form must reproduce the above copyright 65 | notice, this list of conditions and the following disclaimer in the 66 | documentation and/or other materials provided with the distribution. 67 | 68 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 69 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 70 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 71 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 72 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 73 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 74 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 75 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 76 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 77 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 78 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 79 | ''' 80 | -------------------------------------------------------------------------------- /pycss_lem/unitvector.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | 4 | ''' 5 | # Description. 6 | Obtains the unit vector of an input vector. 7 | 8 | # Input(s). 9 | Array nx1 with size different to unit (vector) 10 | 11 | # Example 12 | vector = np.random.rand(2) 13 | 14 | --- 15 | uVector = unitvector(vector) 16 | ''' 17 | def unitvector(vector): 18 | 19 | vecDist = np.sqrt(np.dot(vector,vector)) 20 | uVector = vector/vecDist 21 | 22 | return uVector 23 | ''' 24 | BSD 2 license. 25 | 26 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 27 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 28 | All rights reserved. 29 | 30 | Redistribution and use in source and binary forms, with or without 31 | modification, are permitted provided that the following conditions are 32 | met: 33 | 34 | 1. Redistributions of source code must retain the above copyright notice, 35 | this list of conditions and the following disclaimer. 36 | 37 | 2. Redistributions in binary form must reproduce the above copyright 38 | notice, this list of conditions and the following disclaimer in the 39 | documentation and/or other materials provided with the distribution. 40 | 41 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 42 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 43 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 44 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 45 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 46 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 48 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 49 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 50 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 51 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 52 | ''' 53 | -------------------------------------------------------------------------------- /pycss_lem/vertprojection2pline.py: -------------------------------------------------------------------------------- 1 | # import modules 2 | import numpy as np 3 | 4 | ''' 5 | # Description. 6 | Obtains the coordinates of a point ---or a group of points--- projected 7 | vertically to an open polyline. 8 | 9 | # Input(s): 10 | Vector of the point is wanted to project vertically to the pline 11 | (pointVec). 12 | 13 | Polyline structure cell which has as number of elements as number of 14 | lines it has (plineStructureCell). 15 | 16 | # Output(s). 17 | Vector of the projected point (projectedPointVec). 18 | 19 | # Example1. 20 | pointVec = np.array([7.35, 18]) 21 | plineStructureCell = [ 22 | {'iniPtVec':np.array([0, 24]), 'endPtVec':np.array([10, 24]), 'unitVec':\ 23 | np.array([1, 0]), 'lambda':10, 'slope':0, 'azimuthRad':0, 'intercept':24}, 24 | {'iniPtVec':np.array([10, 24]), 'endPtVec':np.array([40, 12]), 'unitVec':\ 25 | np.array([0.9285, -0.3714]), 'lambda':32.3110, 'slope':-0.4228, 26 | 'azimuthRad':5.9027, 'intercept':34.1470}, 27 | {'iniPtVec':np.array([40, 12]), 'endPtVec':np.array([50, 12]), 'unitVec':\ 28 | np.array([1, 0]), 'lambda':10, 'slope':0, 'azimuthRad':0, 'intercept':12}] 29 | Giving the answer of: 30 | projectedPointVec = np.array([7.35, 24]) 31 | 32 | ################# 33 | # projectedPointVec = vertprojection2pline(pointVec, plineStructureCell) 34 | ''' 35 | def vertprojection2pline(pointVec, plineStructureCell): 36 | 37 | projectedPointVec = np.zeros(2) 38 | numberPlines = len(plineStructureCell) 39 | 40 | projectedPointVec[0] = pointVec[0] 41 | 42 | for i in list(range(numberPlines)): 43 | #The line structure 44 | lineSTR = plineStructureCell[i] 45 | #Select the proper pline 46 | if pointVec[0] >= lineSTR['iniPtVec'][0]: 47 | if pointVec[0] < lineSTR['endPtVec'][0]: 48 | #Obtaining the y--coordiante at the projected point 49 | projectedPointVec[1] = lineSTR['intercept']+lineSTR['slope']*\ 50 | pointVec[0] 51 | #Finishing the loop 52 | break 53 | else: 54 | projectedPointVec[:] = np.nan 55 | return projectedPointVec 56 | ''' 57 | BSD 2 license. 58 | 59 | Copyright (c) 2016, Universidad Nacional de Colombia, Ludger O. 60 | Suarez-Burgoa and Exneyder Andrés Montoya Araque. 61 | All rights reserved. 62 | 63 | Redistribution and use in source and binary forms, with or without 64 | modification, are permitted provided that the following conditions are 65 | met: 66 | 67 | 1. Redistributions of source code must retain the above copyright notice, 68 | this list of conditions and the following disclaimer. 69 | 70 | 2. Redistributions in binary form must reproduce the above copyright 71 | notice, this list of conditions and the following disclaimer in the 72 | documentation and/or other materials provided with the distribution. 73 | 74 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 75 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 76 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 77 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 78 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 79 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 80 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 81 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 82 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 83 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 84 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 85 | ''' 86 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["hatchling"] 3 | build-backend = "hatchling.build" 4 | 5 | [project] 6 | name = "pycss-lem" 7 | description = "2D slope stability analysis of circular surfaces by the limit equilibrium method (Fellenius and Bishop methods)." 8 | readme = "README.rst" 9 | requires-python = ">=3.6" 10 | license = "MIT" 11 | authors = [ 12 | { name = "Exneyder A. Montoya-Araque", email = "eamontoyaa@gmail.com" }, 13 | { name = "Suarez-Burgoa, Ludger O", email = "losuarezb@unal.edu.co" }, 14 | ] 15 | 16 | classifiers = [ 17 | "Intended Audience :: Information Technology", 18 | "Intended Audience :: System Administrators", 19 | "Operating System :: OS Independent", 20 | "Programming Language :: Python :: 3", 21 | "Programming Language :: Python", 22 | "Topic :: Software Development :: Libraries :: Python Modules", 23 | "Topic :: Software Development :: Libraries", 24 | "Topic :: Software Development", 25 | "Development Status :: 4 - Beta", 26 | "Intended Audience :: Developers", 27 | "License :: OSI Approved :: MIT License", 28 | "Programming Language :: Python :: 3 :: Only", 29 | "Programming Language :: Python :: 3.7", 30 | "Programming Language :: Python :: 3.8", 31 | "Programming Language :: Python :: 3.9", 32 | "Programming Language :: Python :: 3.10", 33 | ] 34 | dependencies = [ 35 | "numpy>=1.14.5", 36 | "matplotlib>=1.5.3", 37 | "scipy>=1.5", 38 | ] 39 | dynamic = ["version"] 40 | 41 | [tool.hatch.module] 42 | name = "pycss_lem" 43 | 44 | [tool.hatch.build] 45 | include = [ 46 | "pycss_lem/*.py", 47 | ] 48 | 49 | [project.urls] 50 | Homepage = "https://github.com/eamontoyaa/pyCSS" 51 | Documentation = "https://github.com/eamontoyaa/pyCSS" 52 | 53 | [tool.hatch.version] 54 | path = "pycss_lem/__init__.py" 55 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | numpy>=1.14.5 2 | matplotlib>=1.5.3 3 | scipy>=1.5 4 | --------------------------------------------------------------------------------