PyCCX


NamePyCCX JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/drlukeparry/pyccx
SummarySimulation and FEA environment for Python built upon Calculix and GMSH
upload_time2023-07-11 17:32:08
maintainer
docs_urlNone
authorLuke Parry
requires_python>=3.5
license
keywords fea finite element analysis simulation calculix gmsh
VCS
bugtrack_url
requirements sphinx numpy gmsh
Travis-CI No Travis.
coveralls test coverage No coveralls.
            PyCCX - Python Library for Calculix
=======================================

.. image:: https://github.com/drlukeparry/pyccx/workflows/Python%20application/badge.svg
    :target: https://github.com/drlukeparry/pyccx/actions
.. image:: https://readthedocs.org/projects/pyccx/badge/?version=latest
    :target: https://pyccx.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status
.. image:: https://badge.fury.io/py/PyCCX.svg
    :target: https://badge.fury.io
.. image:: https://badges.gitter.im/pyccx/community.svg
    :target: https://gitter.im/pyccx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
    :alt: Chat on Gitter

Provides a library for creating and running 3D FEA simulations using the opensource Calculix FEA Package.

The aims of this project was to provide a simple framework for implemented 3D FEA Analysis using the opensource `Calculix <http://www.calculix.de>`_ solver.
The analysis is complimented by use of the recent introduction of the
`GMSH-SDK <http://https://gitlab.onelab.info/gmsh/gmsh/api>`_ , an extension to `GMSH <http://gmsh.info/>`_  to provide API bindings for different programming languages
by the project authors to provide sophisticated 3D FEA mesh generation outside of the GUI implementation. This project aims to provide an integrated approach for generating full 3D FEA analysis
for use in research, development and prototyping in a Python environment. Along with setting up and processing the analysis,
convenience functions are included.

The inception of this project was a result of finding no native Python/Matlab package available to perfom full non-linear FEA analysis
of 3D CAD models in order to prototype a concept related to 3D printing. The project aims to compliment the work of
the `PyCalculix project <https://github.com/spacether/pycalculix>`_, which currently is limited to providing capabilities
to generate 2D Meshes and FEA analysis for 2D planar structures. The potential in the future is to provide
a more generic extensible framework compatible with different opensource and commercial FEA solvers (e.g. Abaqus, Marc, Z88, Elmer).

An interface that built upon GMSH was required to avoid the use of the GUI, and the domain specific .geo scripts.
`Learn more <http://lukeparry.uk/>`_.

Structure
##############

PyCCX framework consists of classes for specifying common components on the pre-processing phase, including the following
common operations:

* Mesh generation
* Creating and applying boundary conditions
* Creating load cases
* Creating and assigning material models
* Performing the simulation

In addition, a meshing class provides an interface with GMSH for performing the meshing routines and for associating
boundary conditions with the elements/faces generated from geometrical CAD entities. The Simulation class assembles the
analysis and performs the execution to the Calculix Solver. Results obtained upon completion of the analysis can be processed.
Currently the analysis is unit-less, therefore the user should ensure that all constant, material paramters, and geometric
lengths are consistent - by default GMSH assumes 'mm' units.

Current Features
******************

**Meshing:**

* Integration with GMSH for generation 3D FEA Meshes (Tet4, Tet10 currently supported)
* Merging CAD assemblies using GMSH
* Attaching boundary conditions to Geometrical CAD entities

**FEA Capabilities:**

* **Boundary Conditions** (Acceleration, Convection, Fixed Displacements, Forces, Fluxes, Pressure, Radiation)
* **Loadcase Types** (Structural Static, Thermal, Coupled Thermo-Mechanical)
* **Materials** (Non-linear Elasto-Plastic Material)

**Results Processing:**

* Element and Nodal Results can be obtained across timesteps


Installation
*************
Installation is currently supported on Windows, all this further support will be added for
Linux environments. PyCCX can be installed along with dependencies for GMSH automatically using.

.. code:: bash

    pip install pyccx


Depending on your environment, you will need to install the latest version of Calculix. This can be done through
the conda-forge `calculix package <https://anaconda.org/conda-forge/calculix>`_ in the Anaconda distribution,

.. code:: bash

    conda install -c conda-forge calculix


or alternatively downloading the package directly. On Windows platforms the path of the executable needs to be initialised before use.

.. code:: python

    from pyccx.core import Simulation

    # Set the path for Calculix in Windows
    Simulation.setCalculixPath('Path')


Usage
******

The following code excerpt shows an example for creating and running a steady state thermal analysis of model using PyCCX
of an existing mesh generated using the pyccx.mesh.mesher class.

.. code:: python

    from pyccx.core import DOF, ElementSet, NodeSet, SurfaceSet, Simulation
    from pyccx.results import ElementResult, NodalResult, ResultProcessor
    from pyccx.loadcase import  LoadCase, LoadCaseType
    from pyccx.material import ElastoPlasticMaterial

    # Set the path for Calculix in Windows
    Simulation.setCalculixPath('Path')

    # Create a thermal load case and set the timesettings
    thermalLoadCase = LoadCase('Thermal Load Case')

    # Set the loadcase type to thermal - eventually this will be individual analysis classes with defaults
    thermalLoadCase.setLoadCaseType(LoadCaseType.THERMAL)

    # Set the thermal analysis to be a steady state simulation
    thermalLoadCase.isSteadyState = True

    # Attach the nodal and element result options to each loadcase
    # Set the nodal and element variables to record in the results (.frd) file
    nodeThermalPostResult = NodalResult('VolumeNodeSet')
    nodeThermalPostResult.useNodalTemperatures = True

    elThermalPostResult = ElementResult('Volume1')
    elThermalPostResult.useHeatFlux = True

    # Add the result configurations to the loadcase
    thermalLoadCase.resultSet = [nodeThermalPostResult, elThermalPostResult]

    # Set thermal boundary conditions for the loadcase using specific NodeSets
    thermalLoadCase.boundaryConditions.append(
        {'type': 'fixed', 'nodes': 'surface6Nodes', 'dof': [DOF.T], 'value': [60]})

    thermalLoadCase.boundaryConditions.append(
        {'type': 'fixed', 'nodes': 'surface1Nodes', 'dof': [DOF.T], 'value': [20]})

    # Material
    # Add a elastic material and assign it to the volume.
    # Note ensure that the units correctly correspond with the geometry length scales
    steelMat = ElastoPlasticMaterial('Steel')
    steelMat.density = 1.0    # Density
    steelMat.cp =  1.0        # Specific Heat
    steelMat.k = 1.0          # Thermal Conductivity

    analysis.materials.append(steelMat)

    # Assign the material the volume (use the part name set for geometry)
    analysis.materialAssignments = [('PartA', 'Steel')]

    # Set the loadcases used in sequential order
    analysis.loadCases = [thermalLoadCase]

    # Analysis Run #
    # Run the analysis
    analysis.run()

    # Open the results  file ('input') is currently the file that is generated by PyCCX
    results = analysis.results()
    results.load()


The basic usage is split between the meshing facilities provided by GMSH and analysing a problem using the Calculix Solver. Documented
examples are provided in `examples <https://github.com/drlukeparry/pyccx/tree/master/examples>`_ .

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/drlukeparry/pyccx",
    "name": "PyCCX",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "FEA,Finite Element Analysis,Simulation,Calculix,GMSH",
    "author": "Luke Parry",
    "author_email": "dev@lukeparry.uk",
    "download_url": "https://files.pythonhosted.org/packages/a6/91/187c659379da8921c361dfee1e6f77ec86cbfd2ddb0f36d997c7eb98758f/PyCCX-0.1.2.tar.gz",
    "platform": null,
    "description": "PyCCX - Python Library for Calculix\n=======================================\n\n.. image:: https://github.com/drlukeparry/pyccx/workflows/Python%20application/badge.svg\n    :target: https://github.com/drlukeparry/pyccx/actions\n.. image:: https://readthedocs.org/projects/pyccx/badge/?version=latest\n    :target: https://pyccx.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n.. image:: https://badge.fury.io/py/PyCCX.svg\n    :target: https://badge.fury.io\n.. image:: https://badges.gitter.im/pyccx/community.svg\n    :target: https://gitter.im/pyccx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge\n    :alt: Chat on Gitter\n\nProvides a library for creating and running 3D FEA simulations using the opensource Calculix FEA Package.\n\nThe aims of this project was to provide a simple framework for implemented 3D FEA Analysis using the opensource `Calculix <http://www.calculix.de>`_ solver.\nThe analysis is complimented by use of the recent introduction of the\n`GMSH-SDK <http://https://gitlab.onelab.info/gmsh/gmsh/api>`_ , an extension to `GMSH <http://gmsh.info/>`_  to provide API bindings for different programming languages\nby the project authors to provide sophisticated 3D FEA mesh generation outside of the GUI implementation. This project aims to provide an integrated approach for generating full 3D FEA analysis\nfor use in research, development and prototyping in a Python environment. Along with setting up and processing the analysis,\nconvenience functions are included.\n\nThe inception of this project was a result of finding no native Python/Matlab package available to perfom full non-linear FEA analysis\nof 3D CAD models in order to prototype a concept related to 3D printing. The project aims to compliment the work of\nthe `PyCalculix project <https://github.com/spacether/pycalculix>`_, which currently is limited to providing capabilities\nto generate 2D Meshes and FEA analysis for 2D planar structures. The potential in the future is to provide\na more generic extensible framework compatible with different opensource and commercial FEA solvers (e.g. Abaqus, Marc, Z88, Elmer).\n\nAn interface that built upon GMSH was required to avoid the use of the GUI, and the domain specific .geo scripts.\n`Learn more <http://lukeparry.uk/>`_.\n\nStructure\n##############\n\nPyCCX framework consists of classes for specifying common components on the pre-processing phase, including the following\ncommon operations:\n\n* Mesh generation\n* Creating and applying boundary conditions\n* Creating load cases\n* Creating and assigning material models\n* Performing the simulation\n\nIn addition, a meshing class provides an interface with GMSH for performing the meshing routines and for associating\nboundary conditions with the elements/faces generated from geometrical CAD entities. The Simulation class assembles the\nanalysis and performs the execution to the Calculix Solver. Results obtained upon completion of the analysis can be processed.\nCurrently the analysis is unit-less, therefore the user should ensure that all constant, material paramters, and geometric\nlengths are consistent - by default GMSH assumes 'mm' units.\n\nCurrent Features\n******************\n\n**Meshing:**\n\n* Integration with GMSH for generation 3D FEA Meshes (Tet4, Tet10 currently supported)\n* Merging CAD assemblies using GMSH\n* Attaching boundary conditions to Geometrical CAD entities\n\n**FEA Capabilities:**\n\n* **Boundary Conditions** (Acceleration, Convection, Fixed Displacements, Forces, Fluxes, Pressure, Radiation)\n* **Loadcase Types** (Structural Static, Thermal, Coupled Thermo-Mechanical)\n* **Materials** (Non-linear Elasto-Plastic Material)\n\n**Results Processing:**\n\n* Element and Nodal Results can be obtained across timesteps\n\n\nInstallation\n*************\nInstallation is currently supported on Windows, all this further support will be added for\nLinux environments. PyCCX can be installed along with dependencies for GMSH automatically using.\n\n.. code:: bash\n\n    pip install pyccx\n\n\nDepending on your environment, you will need to install the latest version of Calculix. This can be done through\nthe conda-forge `calculix package <https://anaconda.org/conda-forge/calculix>`_ in the Anaconda distribution,\n\n.. code:: bash\n\n    conda install -c conda-forge calculix\n\n\nor alternatively downloading the package directly. On Windows platforms the path of the executable needs to be initialised before use.\n\n.. code:: python\n\n    from pyccx.core import Simulation\n\n    # Set the path for Calculix in Windows\n    Simulation.setCalculixPath('Path')\n\n\nUsage\n******\n\nThe following code excerpt shows an example for creating and running a steady state thermal analysis of model using PyCCX\nof an existing mesh generated using the pyccx.mesh.mesher class.\n\n.. code:: python\n\n    from pyccx.core import DOF, ElementSet, NodeSet, SurfaceSet, Simulation\n    from pyccx.results import ElementResult, NodalResult, ResultProcessor\n    from pyccx.loadcase import  LoadCase, LoadCaseType\n    from pyccx.material import ElastoPlasticMaterial\n\n    # Set the path for Calculix in Windows\n    Simulation.setCalculixPath('Path')\n\n    # Create a thermal load case and set the timesettings\n    thermalLoadCase = LoadCase('Thermal Load Case')\n\n    # Set the loadcase type to thermal - eventually this will be individual analysis classes with defaults\n    thermalLoadCase.setLoadCaseType(LoadCaseType.THERMAL)\n\n    # Set the thermal analysis to be a steady state simulation\n    thermalLoadCase.isSteadyState = True\n\n    # Attach the nodal and element result options to each loadcase\n    # Set the nodal and element variables to record in the results (.frd) file\n    nodeThermalPostResult = NodalResult('VolumeNodeSet')\n    nodeThermalPostResult.useNodalTemperatures = True\n\n    elThermalPostResult = ElementResult('Volume1')\n    elThermalPostResult.useHeatFlux = True\n\n    # Add the result configurations to the loadcase\n    thermalLoadCase.resultSet = [nodeThermalPostResult, elThermalPostResult]\n\n    # Set thermal boundary conditions for the loadcase using specific NodeSets\n    thermalLoadCase.boundaryConditions.append(\n        {'type': 'fixed', 'nodes': 'surface6Nodes', 'dof': [DOF.T], 'value': [60]})\n\n    thermalLoadCase.boundaryConditions.append(\n        {'type': 'fixed', 'nodes': 'surface1Nodes', 'dof': [DOF.T], 'value': [20]})\n\n    # Material\n    # Add a elastic material and assign it to the volume.\n    # Note ensure that the units correctly correspond with the geometry length scales\n    steelMat = ElastoPlasticMaterial('Steel')\n    steelMat.density = 1.0    # Density\n    steelMat.cp =  1.0        # Specific Heat\n    steelMat.k = 1.0          # Thermal Conductivity\n\n    analysis.materials.append(steelMat)\n\n    # Assign the material the volume (use the part name set for geometry)\n    analysis.materialAssignments = [('PartA', 'Steel')]\n\n    # Set the loadcases used in sequential order\n    analysis.loadCases = [thermalLoadCase]\n\n    # Analysis Run #\n    # Run the analysis\n    analysis.run()\n\n    # Open the results  file ('input') is currently the file that is generated by PyCCX\n    results = analysis.results()\n    results.load()\n\n\nThe basic usage is split between the meshing facilities provided by GMSH and analysing a problem using the Calculix Solver. Documented\nexamples are provided in `examples <https://github.com/drlukeparry/pyccx/tree/master/examples>`_ .\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Simulation and FEA environment for Python built upon Calculix and GMSH",
    "version": "0.1.2",
    "project_urls": {
        "Documentation": "https://pyccx.readthedocs.io/en/latest/",
        "Homepage": "https://github.com/drlukeparry/pyccx",
        "Source": "https://github.com/drylukeparry/pyccx/pyccx/",
        "Tracker": "https://github.com/drlukeparry/pyccx/issues"
    },
    "split_keywords": [
        "fea",
        "finite element analysis",
        "simulation",
        "calculix",
        "gmsh"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "04491a2bf6647fe4dfd86e993ae6bed3b9243639c98a3bceff26a14e451bd85f",
                "md5": "e0bb6479c6893f3ec23aa40f73d08fe3",
                "sha256": "00942b58ee0de19e2352b66a9fa925ceb4dbe91db86e18f2c52412dfbe2ec362"
            },
            "downloads": -1,
            "filename": "PyCCX-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e0bb6479c6893f3ec23aa40f73d08fe3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 34503,
            "upload_time": "2023-07-11T17:32:06",
            "upload_time_iso_8601": "2023-07-11T17:32:06.591986Z",
            "url": "https://files.pythonhosted.org/packages/04/49/1a2bf6647fe4dfd86e993ae6bed3b9243639c98a3bceff26a14e451bd85f/PyCCX-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a691187c659379da8921c361dfee1e6f77ec86cbfd2ddb0f36d997c7eb98758f",
                "md5": "0b2d485960907112d25a5fe5fd27e79b",
                "sha256": "41e816f3ff8d47da8e55684abb01da41e8d397b57685beaa49ad9eb5999e4156"
            },
            "downloads": -1,
            "filename": "PyCCX-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "0b2d485960907112d25a5fe5fd27e79b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 30715,
            "upload_time": "2023-07-11T17:32:08",
            "upload_time_iso_8601": "2023-07-11T17:32:08.420657Z",
            "url": "https://files.pythonhosted.org/packages/a6/91/187c659379da8921c361dfee1e6f77ec86cbfd2ddb0f36d997c7eb98758f/PyCCX-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-11 17:32:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "drlukeparry",
    "github_project": "pyccx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "sphinx",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "gmsh",
            "specs": [
                [
                    ">=",
                    "4.7"
                ]
            ]
        }
    ],
    "lcname": "pyccx"
}
        
Elapsed time: 0.19271s