Recent Commits
Commit | Author | Details | Committed | ||||
---|---|---|---|---|---|---|---|
6838d6519bc7 | D237 | junge | BUG: incorrect call to gradient integration in tests | Feb 13 2019 | |||
12f98c9a0983 | D236 | junge | BUG: Gradient integration was not using Formulation | Feb 13 2019 | |||
c6f5a64cea36 | D235 | junge | BUG: fixes bug T2542 and reintroduced a broken test | Feb 1 2019 | |||
ddfe8c7ab4c0 | D233 | RLeute | Visualization and tests finished | Jan 22 2019 | |||
3bc6fa3694d8 | D234 | junge | ENH: Added Material Evaluator | Jan 21 2019 | |||
676022f5dfa6 | D224 | junge | fixed pull-back for MaterialHyperElastoPlastic1 | Jan 7 2019 | |||
ee949b1469ba | D232 | junge | ENH: added MaterialLinearElasticGeneric2 | Dec 21 2018 | |||
d7e113f47457 | D230 | junge | ENH: Python Bindings for Generic Linear Elastic Material + doc | Dec 20 2018 | |||
92fa33a1065f | D229 | muSpectre-bot | MAINT: improved linting | Dec 12 2018 | |||
bdcd2d2db5b4 | D226 | junge/muSpectre-bot | linted entire c++ code base, added clang-format config and cpplint | Dec 12 2018 | |||
efec0cbbf093 | D227 | pastewka | MAINT: Fixes on OS X - exclude deprecation warnings in pybind11 and add library… | Dec 11 2018 | |||
46632033a7cc | junge | minor comment change | Dec 9 2018 | ||||
293be346d221 | D211 | junge | License switch to LGPL | Nov 20 2018 | |||
a2e8eb123503 | D204 | junge/muSpectre-bot | Fixed left-over instances of old, wrong license text | Oct 14 2018 | |||
91baed3bdbb9 | D203 | junge | Fixed License (referred to Emacs rather than µSpectre in places) | Oct 12 2018 |
README
µSpectre
Copyright © 2018 Till Junge
µSpectre is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3, or (at your option) any later version.
µSpectre is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
This README contains only a small quick start guide. Please refer to the full documentation for more help.
Building µSpectre
µSpectre is a CMake project that uses C++14. It depends on the Boost unit test framework for testing and uses uses python3 as secondary API. You will need a modern C++ compiler (µSpectre was tested with gcc-6 , gcc-7, clang-4 and clang5) and CMake version 3.7.0 or higher.
Compilation
$ git clone https://c4science.ch/source/muSpectre.git $ cd build $ cmake -DCMAKE_BUILD_TYPE=Release .. $ make
µSpectre makes use of expression templates, as a result, production code must be compiled with the CMAKE_BUILD_TYPE flag set to Release in order to get performance (under gcc, non-optimised code is about 50 times slower than the release). Be careful with parallel compilation: compiling µSpectre is quite memory-hungry because of the use of expression templates, a parallel make -j requires currently about 10 GB of RAM under GCC.
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 resolution = [51, 51] center = np.array([r//2 for r in resolution]) incl = resolution[0]//5 lengths = [7., 5.] formulation = µ.Formulation.small_strain # creating the periodic cell rve = µ.SystemFactory(resolution, 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 bin/ and tests folder.