Skip to main content

A mechanical solver to simulate fiber packing and perform statistical analysis.

Project description

Welcome to FiberMat’s documentation!

banner

pypi version GitHub Badge Read the Docs License: MIT François Mahé Mail

License
                                        ██╖
████████╖  ████┐  ████╖       ██╖      ██╓╜
██╔═════╝  ██╔██ ██╔██║       ██║    ██████╖
█████─╖    ██║ ███╓╜██║██████╖██████╖██║ ██║
██╔═══╝    ██║ ╘══╝ ██║██║ ██║██╓─██║██╟───╜
██║    ██┐ ██║      ██║███ ██║██║ ██║│█████╖
╚═╝    └─┘ ╚═╝      ╚═╝╚══╧══╝╚═╝ ╚═╝╘═════╝
 █████┐       █████┐       ██┐
██╔══██┐     ██╓──██┐      └─┘       █╖████╖
 ██╖ └─█████ └███ └─┘      ██╖██████╖██╔══█║
██╔╝  ██╔══██   ███╖ ████╖ ██║██║ ██║██║  └╜
│██████╓╜   ██████╓╜ ╚═══╝ ██║██████║██║
╘══════╝    ╘═════╝        ╚═╝██╔═══╝╚═╝
      Rennes                  ██║
                              ╚═╝
@author: François Mahé
@mail: francois.mahe@ens-rennes.fr
(Univ Rennes, ENS Rennes, CNRS, IPR - UMR 6251, F-35000 Rennes, France)

@project: FiberMat
@version: v1.0

License
-------
MIT License

Copyright (c) 2024 François Mahé

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Description
-----------
A mechanical solver to simulate fiber packing and perform statistical analysis.

References
----------
Mahé, F. (2023). Statistical mechanical framework for discontinuous composites:
  application to the modeling of flow in SMC compression molding (Doctoral
  dissertation, École centrale de Nantes).

FiberMat is a mechanical solver to simulate fiber packing and perform statistical analysis. It generates realistic 3D fiber mesostructures and computes internal forces and deformations.

This code is the result of thesis work that can be found in:

Mahé, F. (2023). Statistical mechanical framework for discontinuous composites: application to the modeling of flow in SMC compression molding (Doctoral dissertation, École centrale de Nantes).

Installation

Requirements:

Python versions

Install the package with Pip

Run the following commands:

# Install `FiberMat`
pip install fibermat

# Try it out
python -c "import fibermat"

Install the package in an Anaconda environment

  1. Create a conda environment:

    # Create conda environment
    conda create -n fibermat python=3.11
    
    # Activate the environment
    conda activate fibermat
    
    # Optional
    pip install jupyter
    
  2. Install FiberMat:

    # Install `FiberMat`
    pip install --upgrade fibermat
    
    # Try it out
    python -c "import fibermat"
    
  3. To leave fibermat environment, run conda deactivate.

Directly from the sources

Clone the repository and run pip command:

# Clone the repository
git clone git@github.com:fmahe/fibermat.git
cd ./fibermat

# Install `FiberMat`
pip install --upgrade .

Build the sources

FiberMat's documentation is created using Sphinx [1].

  1. Clone the repository:

    # Clone the repository
    git clone git@github.com:fmahe/fibermat.git
    cd ./fibermat
    
  2. Install dependencies required to compile documentation:

    • Install the packages listed in requirements.txt with Pip:

      # Install dependencies
      pip install -r requirements.txt
      
    • Alternatively, you can create a new environment that already meets the requirements:

      # Create an environment from the `environment.yml` file
      conda env create -n fibermat -f ./environment.yml
      
      # Activate the environment
      conda activate fibermat
      
  3. Execute ./make script:

    # Build the sources
    ./make --all
    
  4. Test the library:

    pytest
    

[1] : Here a tutorial (fr) for Sphinx: Introduction à Sphinx, un outil de documentation puissant.

Documentation

See the tutorial in jupyter-notebook.ipynb.

Example

from fibermat import *

# Generate a set of fibers
mat = Mat(100, length=25., width=2., thickness=0.5, size=50., shear=1., tensile=2500.)
# Build the fiber network
net = Net(mat, periodic=True)
# Stack fibers
stack = Stack(net, threshold=10)
# Create the fiber mesh
mesh = Mesh(stack)

# Solve the mechanical packing problem
sol = solve(Model(mesh), packing=4.)

# Export as VTK
msh = vtk_mesh(
    mesh,
    sol.displacement(1),
    sol.rotation(1),
    sol.force(1),
    sol.torque(1),
)
msh.plot(scalars="force", cmap=plt.cm.twilight_shifted)
msh.save("outputs/msh.vtk")

example

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fibermat-1.0.12.tar.gz (5.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fibermat-1.0.12-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

Details for the file fibermat-1.0.12.tar.gz.

File metadata

  • Download URL: fibermat-1.0.12.tar.gz
  • Upload date:
  • Size: 5.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for fibermat-1.0.12.tar.gz
Algorithm Hash digest
SHA256 f069fc49eb5d2f298aadf47f56077906ca260e1bd3af1a952b7a0f2dfbe195a0
MD5 6f1bdf06a87c8b0ec0027942f07c61d6
BLAKE2b-256 009de4bc48f2610eb029bd0fa31927bdf5bb26605137086a671d336e48869397

See more details on using hashes here.

File details

Details for the file fibermat-1.0.12-py3-none-any.whl.

File metadata

  • Download URL: fibermat-1.0.12-py3-none-any.whl
  • Upload date:
  • Size: 40.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for fibermat-1.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 e8cfe32b7c46f9bc3cc379622243d6356f0ccebab7cbc24531c48ea7b464e0e8
MD5 fb4d47ea143583ac4a0af9f162c8df62
BLAKE2b-256 be2f4181784ed1aeedcb42ac9a4f0e04c4d3fd4bd7e9f0cf8672b81754f22a26

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page