µGrid is a library for regular grids
Project description
µGrid
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 muGrid
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 muGrid muGrid
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for mugrid-0.90.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6e932ba4d6522f0884a5caedb86936239e8d28608bb31922d6cc18446830f49 |
|
MD5 | 1225dc7f44f7952375be1d9ac8bfa7c6 |
|
BLAKE2b-256 | 66436099888fa3a225bd63b57b13348f42c2af8d69ea7d31859a91b43198d45d |
Hashes for mugrid-0.90.0-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4efe0dce4541bc9285ed3ecfd793b2073582901ed36d471bc44687a619ba87fc |
|
MD5 | 198178886ce4af3ad483f3ab205bed83 |
|
BLAKE2b-256 | 65d66bd497dc3e0618601de8756c2e456b4859f77c40c3c7e3ce266eeee66d06 |
Hashes for mugrid-0.90.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcabddacba00086eca4e8c359493bcf9d6666ccb6bbd1c1cad4bb5b9203463de |
|
MD5 | 255f3511e7dd9c2283abb1027b1ffb1b |
|
BLAKE2b-256 | 007310db27b2c3f71d43dc543c68ae0de12a12a17453c79a4a40abc00c66dd7c |
Hashes for mugrid-0.90.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89c750d908e4f6d3145bce9df5b7e996135ef3545b77ba962afe9d3ff356c379 |
|
MD5 | cb7c3b2f16ab91d511d951b5135a9a94 |
|
BLAKE2b-256 | 1d5ac1e1e7dfdda257f6774e4265a375a31980f351757415bcf5579a7a4d860e |
Hashes for mugrid-0.90.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e214f8a1bb84d9921f1bd3812a284efc896783bc321d73722b8463e6d930283 |
|
MD5 | 8cef4c3b8f98531338852374fb07ae15 |
|
BLAKE2b-256 | e410b346c2f814d544118b8060d8b7828f19207768acc411239f0a40b995fc36 |
Hashes for mugrid-0.90.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60d21f2546349ec62cc0f442eb5bf539132b603655aec55e5dfdfeac51625e54 |
|
MD5 | 8cce5d30bae4550ef3a95de38a7f1972 |
|
BLAKE2b-256 | a42f8483a0e3cf527ba880c1df940b7e3f6053801e085bfc0dff6b9ce1c555e3 |
Hashes for mugrid-0.90.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4b66812c80dbb9efc5c952eb8b7b625eece00cb9f37e42f4c034cb845be90e7 |
|
MD5 | ada812cd8f22791c69b10af667a84dd5 |
|
BLAKE2b-256 | e9dabbfb2fd9aa87629400300f26c9b02d5ee34facc9a22122a598947c0c0ae8 |
Hashes for mugrid-0.90.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb3cf2b8b67d8bd1c3adb2e54e6ba1feee7dab1986d983a19a841bd3d73141ce |
|
MD5 | cd73c8ac15c7ba614a5acac21bf52852 |
|
BLAKE2b-256 | 2c77238a88d99e69a3c8c06c4066c4d429ab6456ce478a2c41d521c1066bcb1c |
Hashes for mugrid-0.90.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92f53b544f567dc1d32fed0209ef65b5d912aafec7006a541489685c022d3d69 |
|
MD5 | 4279f92be0694bdc85d5d805585bff9c |
|
BLAKE2b-256 | 831be956f2d23579c3c9a4e83ac5fc0d5548fb1ca9ecc3249a9757d3e34f8449 |
Hashes for mugrid-0.90.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d22afd5a2751fd9d5aae17f071b529bf3d59acefbf0e05e96db10f6cc7ce3e20 |
|
MD5 | 8bf3c3de477f91c6a4934800da1f96fc |
|
BLAKE2b-256 | dc8d97c5edccde7f512a582db84b6fb502a07e46a655dc78287d905e99f5ccaf |