Git Product home page Git Product logo

pycm's Introduction

License: GPL v3

Introduction

Contour method

The contour method for measuring residual stress is a cost effective, robust technique which has seen much interest both by academics and industry alike. First developed by Michael Prime at Los Alamos, it has seen a great deal of development both in the US and UK.

For more information on the contour method:

Analysis code

Recently it has been found that the visualization tools that are available in MATLAB are not the most robust for the purposes of the contour method. For example, large datasets developed with laser profilometers can often exceed the graphical capabilities of recent versions of MATLAB. The reasons for moving from MATLAB for contour method analysis are numerous:

  • Proprietary nature of the built-in libraries, cost and licensing issues with external ones.
  • Difficulties in dealing with path dependencies on managed desktops.
  • Although 'compiled' MATLAB code can be run on computers without MATLAB installed, this is reliant on the target machine having an identical MATLAB component runtime installation, which is proprietary and quite large (250 Mb+).
  • Diminished text file parsing built into MATLAB which makes working with FE codes difficult; this is particularly true for very large input files/meshes.

Each of these factors contribute to the overall portability of the code and present barriers to the residual stress characterisation community developing, validating and using analysis code.

Some of these have already been addressed via projects such as GNU Octave, a free and open source language similar to MATLAB in terms of development environment and syntax. However, this language has been shown to be quite slow in some cases, as inter-operability with MATLAB was favoured in place of speed. Inter-operability between GNU Octave and MATLAB is still relatively incomplete as MATLAB is developed independently of Octave.

Many researchers have moved from using MATLAB to Python entirely for numerical analysis. Python is an extremely flexible language, with many packages available to perform the same work as MATLAB. Due to the open source nature of Python, there have been many contributions that allow for wrapping compiled science and engineering code written in other languages (Fortran, C, Java) to be called directly by Python. When coupled with Numerical Python (NumPy) and SciPy, a significant amount of the same functionality is available as in MATLAB. Furthermore, there is a maintained library of Python bindings for VTK, the Visualization Toolkit, an extremely robust tool for visualising large datasets. For example, ParaView, an open source FEA post processor, makes extensive use of VTK - and the results of this application can be opened natively with this tool.

Moving forward

It is for these reasons the overall aim is to future proof the analysis code by moving towards using Python as the language of choice. To this end, a Python package called pyCM (Python Contour Method) has been developed. The idea is to fully move over from using primarily MATLAB functions/scripts to Python equivalents in a step-by-step manner. The development strategy adopted is to build new tools where required, and allow for existing MATLAB tools to be used on the input and output from these Python tools. This will be accomplished using the SciPy packages which generate binary MATLAB files to store workspace variables, so processing can be partially performed in Python, and shifted back into MATLAB to use existing scripts.

Latest version

Alpha release 1.1.x is currently the latest version which contains a complete toolchain for rectangular specimens with no self-restraint. Note that the post-processor is still in a beta form for testing purposes on quadrilateral meshes only; if tetrahedral meshes are employed, then the native FEA code's post processor should be employed (GraphiX or Abaqus Viewer). It has been confirmed that equivalent results are obtained with both CalculiX and Abaqus.

Requirements

  1. Python 3.x
  2. Numpy
  3. Scipy
  4. VTK
  5. Matplotlib
  6. pyYaml
  7. PyQt5
  8. Pandas

Once Python is installed, it is recommended on Windows machines to get numpy, scipy and VTK binaries from Christoph Gohlke's Unofficial Windows Binaries for Python Extension Packages for the best possible performance. Note that URLs on this site are blocked, you will have to manually select the distribution that you will need. Install them via:

pip install <pkg_prefix>.whl

However, the sources which arrive from PyPI are acceptable for most purposes and should automatically install - see next section.

Installation

These instructions cover the steps needed to install all dependencies and then add the pyCM components to your Python PATH. This permits calling the pyCM components anywhere on a host machine.

  1. Clone this repository to a location on the host machine.
  2. Change directory to this location and from the command line, run pip install pyCM-* where pyCM-* is the most recent tarball from the dist directory where you've cloned the repository. For example:
pip install pyCM-<version>.tar.gz

The remainder of the requisite packages will be installed from PyPI.

  1. Check if it installed properly by trying to import the pyCM library from any working directory at the Python prompt/IDLE:
from pyCM import *

or a check of installed packages via the pip freeze command.

Uninstalling can be accomplished via pip:

pip uninstall pyCM

Modules

  • main - a tabbed viewer which groups the following tools together to allow a more cohesive analysis route.
  • point_cloud - utility to read and work with raw contour data both with and without perimeter files.
  • align_average - utility to manipulate, align and average two contour surface datasets with perimeter files.
  • fit_surface - utility to fit averaged point clouds
  • preprocess - meshing/boundary condition building tool which works with Abaqus and OS FEA toolchains (Gmsh & Calculix).
  • postprocess - BETA currently only supports results from analyses with quadrilateral meshes, but for both Calculix and Abaqus.

Contributions and extensions

This project is intended to best serve the overall residual stress community, so feel free to adjust as needed and add functionality. Please contact me directly by email prior to submitting pull requests so that we can discuss overall structure further.

Currently, this project has only been tested on Windows 7 x64, but there is nothing to suggest that it will not work across all platforms.

Acknowledgements

A number of these tools have been developed based on MATLAB code written by Greg Johnson, Chris Gill, Matt Fox, Philip Frankel and Yuan-Sheng Xiong (and probably others) at the University of Manchester between 2004-2013.

I'd also like to acknowledge Richard Moat at the Open University for outlining the architecture of Python and MATLAB interchangeability and highlighting the performance improvements in visualization garnered by VTK.

pycm's People

Contributors

nikstoyanov avatar majroy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.