Skip to main content

µSpectre

Project µSpectre aims at providing an open-source platform for efficient FFT-based continuum mesoscale modelling. This README contains only a small quick start guide. Please refer to the full documentation for more help.

Quick start

To install µSpectre, run

pip install muSpectre

Note that on most platforms this will install a binary wheel, that was compiled with a minimal configuration. To compile for your specific platform use

pip install -v --no-binary muSpectre muSpectre

which will compile the code. Monitor output for the compilation options printed on screen. µSpectre will autodetect various options and report which ones were enabled.

Simple usage example

The following is a simple example for using µSpectre through its convenient Python interface

#!/usr/bin/env python3

import numpy as np
import muSpectre as µ

# setting the geometry
nb_grid_pts = [51, 51]
center = np.array([r//2 for r in nb_grid_pts])
incl = nb_grid_pts[0]//5

lengths = [7., 5.]
formulation = µ.Formulation.small_strain

# creating the periodic cell
rve = µ.SystemFactory(nb_grid_pts,
                      lengths,
                      formulation)
hard = µ.material.MaterialLinearElastic1_2d.make(
    rve, "hard", 10e9, .33)
soft = µ.material.MaterialLinearElastic1_2d.make(
    rve, "soft",  70e9, .33)


# assign a material to each pixel
for i, pixel in enumerate(rve):
    if np.linalg.norm(center - np.array(pixel),2)<incl:
        hard.add_pixel(pixel)
    else:
        soft.add_pixel(pixel)

tol = 1e-5
cg_tol = 1e-8

# set macroscopic strain
Del0 = np.array([[.0, .0],
                 [0,  .03]])
if formulation == µ.Formulation.small_strain:
    Del0 = .5*(Del0 + Del0.T)
maxiter = 401
verbose = 2

solver = µ.solvers.SolverCG(rve, cg_tol, maxiter, verbose=False)
r = µ.solvers.newton_cg(rve, Del0, solver, tol, verbose)
print("nb of {} iterations: {}".format(solver.name(), r.nb_fev))

You can find more examples using both the python and the c++ interface in the examples and tests folder.

Funding

This development is funded by the Swiss National Science Foundation within an Ambizione Project and by the European Research Council within Starting Grant 757343.

Metadata

Release files for muSpectre 0.27.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for muSpectre 0.27.0
File Size Uploaded
muspectre-0.27.0.tar.gz 10.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for muSpectre 0.27.0
File
muspectre-0.27.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
muspectre-0.27.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
muspectre-0.27.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
muspectre-0.27.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
muspectre-0.27.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
muspectre-0.27.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details

Total release size: 49.9 MB

Release files / muspectre-0.27.0.tar.gz

Download URL muspectre-0.27.0.tar.gz
Size 10.1 MB
Tags Source
SHA-256 checksum
How to use checksums
346824d815ce049b403c6fa5fa09bd394111d646b99186599d1ad34cc0778e52
BLAKE2b-256 checksum
How to use checksums
b037d99cb56abd25409f56f2742640b106214af99dffc91cc47283aa6895241c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / muspectre-0.27.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL muspectre-0.27.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.6 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
bcb959acb4a384a8cf75bfabc5d0c7ce5284d4fcfa15990eff20567bd1709dba
BLAKE2b-256 checksum
How to use checksums
821238bfd583660d109b9d5e8f91590ffb5b4071364a56f61b1512e4ca426648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / muspectre-0.27.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL muspectre-0.27.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.6 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
62fc034937af54f086fbf6bf6527015cdd80601c9b55e1cd84703111a4c8e5b7
BLAKE2b-256 checksum
How to use checksums
eac655f9cfc088abd563f510997dfe45664d160a845499d7cc628ac749dc0d68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / muspectre-0.27.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL muspectre-0.27.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.6 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a21163157d603a5531d8cb460339d881cdbc3dbb49b5d9bbf2dfc4028ad57d19
BLAKE2b-256 checksum
How to use checksums
fc2bd8d685b9f19fab13905e055a07e4f8b7f7864e55adc245fc9d2dd24dcb91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / muspectre-0.27.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL muspectre-0.27.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.6 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
12dbd8c35284b7f3505b5f4f1c94bbbb58ea806c9428a0d0dd2eda1bb2b608a8
BLAKE2b-256 checksum
How to use checksums
fe732dd65d0519ff6859e0d5341af930f31aedf84251b4579359f1e6ea6b67a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / muspectre-0.27.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL muspectre-0.27.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.7 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
fa04a7c60648d3acd58aa515eb55f14f23f6b63cc6860ef52d37f6914ccc5f5b
BLAKE2b-256 checksum
How to use checksums
be2579eab79f74a078e1634615d6cecee04903b83fd4de5a1a27c0c829041053
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / muspectre-0.27.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL muspectre-0.27.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.8 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
2a74e765a59b15b2d33df617532638a105dc486b8342b43e56fd16f71627955f
BLAKE2b-256 checksum
How to use checksums
5328c6bc592b7bba2f39749906a63a296bcbd490a4b34d528a1c6ecb7b270d07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.27.0 This release

7 release files

0.25.2

5 release files

0.25.1

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page