Skip to main content

µSpectre is an open-source platform for efficient FFT-based continuum mesoscale modelling

Project description

µ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.

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

muspectre-0.27.0.tar.gz (10.1 MB view details)

Uploaded Source

Built Distributions

muspectre-0.27.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

muspectre-0.27.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

muspectre-0.27.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

muspectre-0.27.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

muspectre-0.27.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.7 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

muspectre-0.27.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

File details

Details for the file muspectre-0.27.0.tar.gz.

File metadata

  • Download URL: muspectre-0.27.0.tar.gz
  • Upload date:
  • Size: 10.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for muspectre-0.27.0.tar.gz
Algorithm Hash digest
SHA256 346824d815ce049b403c6fa5fa09bd394111d646b99186599d1ad34cc0778e52
MD5 f947f3d075e280b1d84989a691705a3b
BLAKE2b-256 b037d99cb56abd25409f56f2742640b106214af99dffc91cc47283aa6895241c

See more details on using hashes here.

File details

Details for the file muspectre-0.27.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for muspectre-0.27.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bcb959acb4a384a8cf75bfabc5d0c7ce5284d4fcfa15990eff20567bd1709dba
MD5 ccb4bca108926c9fba4caf5cfa04ec2a
BLAKE2b-256 821238bfd583660d109b9d5e8f91590ffb5b4071364a56f61b1512e4ca426648

See more details on using hashes here.

File details

Details for the file muspectre-0.27.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for muspectre-0.27.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 62fc034937af54f086fbf6bf6527015cdd80601c9b55e1cd84703111a4c8e5b7
MD5 9ea4434dfc74e8aaebe35609d3822c9e
BLAKE2b-256 eac655f9cfc088abd563f510997dfe45664d160a845499d7cc628ac749dc0d68

See more details on using hashes here.

File details

Details for the file muspectre-0.27.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for muspectre-0.27.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a21163157d603a5531d8cb460339d881cdbc3dbb49b5d9bbf2dfc4028ad57d19
MD5 ddca4e83f09cf75d721f3d399c85dec8
BLAKE2b-256 fc2bd8d685b9f19fab13905e055a07e4f8b7f7864e55adc245fc9d2dd24dcb91

See more details on using hashes here.

File details

Details for the file muspectre-0.27.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for muspectre-0.27.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 12dbd8c35284b7f3505b5f4f1c94bbbb58ea806c9428a0d0dd2eda1bb2b608a8
MD5 8f0ae73f2f39716b2bb48265d2e58524
BLAKE2b-256 fe732dd65d0519ff6859e0d5341af930f31aedf84251b4579359f1e6ea6b67a8

See more details on using hashes here.

File details

Details for the file muspectre-0.27.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for muspectre-0.27.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa04a7c60648d3acd58aa515eb55f14f23f6b63cc6860ef52d37f6914ccc5f5b
MD5 45cfa0e3bac54eb4a0065fad6c02fdc5
BLAKE2b-256 be2579eab79f74a078e1634615d6cecee04903b83fd4de5a1a27c0c829041053

See more details on using hashes here.

File details

Details for the file muspectre-0.27.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for muspectre-0.27.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2a74e765a59b15b2d33df617532638a105dc486b8342b43e56fd16f71627955f
MD5 be30efd1540f2fb6ef19911943549653
BLAKE2b-256 5328c6bc592b7bba2f39749906a63a296bcbd490a4b34d528a1c6ecb7b270d07

See more details on using hashes here.

Supported by

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