Skip to main content

GPU-enabled vectorized material modeling library

Project description

Logo Logo

Documentation C++ backend testing Python package testing PyPI

Overview

The New Engineering Material model Library, version 2

NEML2 is an offshoot of NEML, an earlier material modeling code developed at Argonne National Laboratory. Like its predecessor, NEML2 provides a flexible, modular way to build material models from smaller blocks. Unlike its predecessor, NEML2 vectorizes the material update to efficiently run on GPUs. In addition, NEML2 models can use PyTorch as the backend to provide first-class support for automatic differentiation, operator fusion, lazy tensor evaluation, inference mode, etc.

NEML2 is provided as open source software under a MIT license.

Disclaimer

NEML2 is not a database of material models. There are many example material models in the library for testing and verification purposes. These models do not represent the response of any actual material.

Quick installation

Python package (recommended): Pre-built wheels are available on PyPI:

pip install neml2

C++ library: Clone the repository, configure with CMake, and build:

git clone -b main https://github.com/applied-material-modeling/neml2.git
cmake --preset release -S neml2
cmake --build --preset release

Refer to the installation guide for more detailed instructions and finer control over various dependencies as well as other build customization.

Once NEML2 is installed, refer to the getting started guide for commonly used APIs.

Features and design philosophy

Vectorization

NEML2 models can be vectorized, meaning that a large batch of material models can be evaluated simultaneously. The vectorized models can be evaluated on either CPUs or GPUs/other accelerators. Moreover, NEML2 provides a unified implementation and user interface, for both developers and end users, that work on all supported devices.

The table below compares three approaches for solving the same problem: a crystal plasticity simulation using the Taylor method, with 50,000 grains and 250 load steps. The first approach is using NEML (the predecessor of NEML2) which is a CPU-only, fully threaded library. The second and the third approaches use NEML2, evaluating the same model on CPU and GPU (CUDA), respectively.

Device Wall time (s) Specs
NEML CPU 42,500 Intel Xeon Gold 6346 CPU with 32 threads
NEML2 CPU 15,000 Intel Xeon Gold 6346 CPU with 32 threads
NEML2 GPU 68 1 NVIDIA RTX A5000 GPUs
34 2 NVIDIA RTX A5000 GPUs

NEML2 is more than 2x faster than NEML on CPU, owing to more comprehensive threading and vectorization as well as Just-In-Time compilation. In this case, GPUs further speed up the calculation by more than 400 times.

Multiphysics coupling

NEML2 is not tied to any underlying problem physics, e.g., solid mechanics, heat transfer, fluid dynamics, electromagnetics, etc. Current modules cover thermal and mechanical material models, but the framework can be used to implement a wider range of constitutive models. For coupled problems, NEML2 will return the exact, coupled Jacobian entries required to achieve optimal convergence. NEML2 can be used together with MOOSE, a Multiphysics finite element framework, to solve partial differential equations.

Modularity and flexibility

NEML2 material models are modular – they are built up from smaller pieces into a complete model. NEML2 offers an extremely flexible way of composing models. Each individual model only defines the forward operator (and optionally its derivative) with a given set of inputs and outputs. When a set of models are composed together to form a composite model, dependencies among different models are automatically detected, registered, and resolved. The user has complete control over how NEML2 evaluates a set of models.

Extensibility

The library is structured so that adding a new feature to an existing material model should be as simple as possible and require as little code as possible. In line with this philosophy, the library only requires new components to provide a few partial derivatives, and NEML2 uses this information to automatically assemble the overall Jacobian using chain rule and provide the algorithmic tangent needed to integrate the model into an implicit finite element framework. Moreover, in NEML2, implementations can forgo providing these partial derivatives, and NEML2 will calculate them with automatic differentiation.

Friendly user interfaces

There are three general ways of interfacing with NEML2 material models: the compiled C++ library, the Python package, and the runner. In all interfaces, creation and archival of NEML2 models rely on input files written in the hierarchical HIT format. NEML2 models created using the Python bindings are fully interoperable with PyTorch tensors and modules, meaning that NEML2 material models can seamlessly work with popular machine learning frameworks developed using PyTorch.

Strict quality assurance

NEML2 is developed under a strict quality assurance program. Because the NEML2 distributions do not provide full, parameterized models for any actual materials, ensuring the quality of the library is a verification problem – testing to make sure that NEML2 is correctly implementing the mathematical models – rather than a validation problem of comparing the results of a model to an experiment. In NEML2, this verification is done with extensive unit testing. Additional regression tests are set up for each combination of material model to ensure result consistency across releases.

Citing NEML2

@article{neml2_softwarex_2025,
  title = {NEML2: An efficient and modular multiphysics constitutive modeling library for hybrid computing environments},
  journal = {SoftwareX},
  volume = {31},
  pages = {102302},
  year = {2025},
  issn = {2352-7110},
  doi = {https://doi.org/10.1016/j.softx.2025.102302},
  url = {https://www.sciencedirect.com/science/article/pii/S2352711025002687},
  author = {Tianchen Hu and Mark C. Messner},
  keywords = {Constitutive model, GPU, Multiphysics}
}
@techreport{neml2osti2440430,
  author      = {Tianchen Hu and Mark C.  Messner and Daniel Schwen and Lynn B.  Munday and Dewen Yushu},
  title       = {NEML2: A High Performance Library for Constitutive Modeling},
  institution = {Argonne National Laboratory (ANL), Argonne, IL (United States); Idaho National Laboratory (INL), Idaho Falls, ID (United States)},
  doi         = {10.2172/2440430},
  url         = {https://www.osti.gov/biblio/2440430},
  place       = {United States},
  year        = {2024},
  month       = {09}
}
@misc{neml2osti1961125,
  author = {MESSNER, MARK and HU, TIANCHEN and US DOE NE-NEAMS},
  title  = {NEML2 - THE NEW ENGINEERING MATERIAL MODEL LIBRARY, VERSION 2},
  doi    = {10.11578/dc.20230314.1},
  url    = {https://www.osti.gov/biblio/1961125},
  place  = {United States},
  year   = {2023},
  month  = {01}
}

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

neml2-2.1.3.tar.gz (9.2 MB view details)

Uploaded Source

Built Distributions

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

neml2-2.1.3-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

neml2-2.1.3-cp314-cp314-macosx_11_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

neml2-2.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

neml2-2.1.3-cp313-cp313-macosx_11_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

neml2-2.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

neml2-2.1.3-cp312-cp312-macosx_11_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

neml2-2.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

neml2-2.1.3-cp311-cp311-macosx_11_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

neml2-2.1.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

neml2-2.1.3-cp310-cp310-macosx_11_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file neml2-2.1.3.tar.gz.

File metadata

  • Download URL: neml2-2.1.3.tar.gz
  • Upload date:
  • Size: 9.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for neml2-2.1.3.tar.gz
Algorithm Hash digest
SHA256 f7920556c41334f242bfb2e868cdbf990c5dd7bead6ffea729596643ec520ae7
MD5 16e49baf7b41f5c297cd64a4d8bfdf0b
BLAKE2b-256 c6849cd6ab5f9756a5ea15e8dc3d462e5f53010c9b4739dfae619ad3c3ed537a

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.3.tar.gz:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.3-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-2.1.3-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c5a1f724955bc34550fd5e40318fb09647e878f55b116dcadd1b2fd16d66fa6b
MD5 7dcc10000f70530d47d3171aed6f47ad
BLAKE2b-256 4298db04a56770339ffdc3058e6e7bcf590b5e77d65d775d73b0e72ae72fe5b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.3-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.3-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-2.1.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9ab466e201560fb63d1148130eb00cf2a561dad94a09bdbcb5614f847b61d973
MD5 e7d91917bd780565d83da2d52f897dff
BLAKE2b-256 431ebcb7abbb3beda49923b3723dbfcc92dfea60bf9880517ad8d7d6ca11c867

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.3-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-2.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 77b153dfe5edc815d24b6b7b8b54658a2d29da6a3aa0fa6af2fa6389b950a286
MD5 302d359e0dffdecbf3305b5dee80af2c
BLAKE2b-256 47cc552813657730f87d94b8599f0d5959d7c8dd3a7d5cd650d80ce8241887ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-2.1.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fbe0d996556a9c1e485175033a7d2abf6923d259924d2b8dde582a15f901fee6
MD5 99d7483d1c712437674970a3a6f62a51
BLAKE2b-256 4022b2e1a349377314d40ca0db94cc1daae74a7b77a182b23aaedba363296867

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.3-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-2.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fa1b111b942a34db7daecdfaebc60ce38cf3552da6182cc63f1e7472cf3ecec2
MD5 af6f4d4ef5aebb0cdb4fd42553a2d31b
BLAKE2b-256 f525697e7000beaf92c51c6a2eb03ae929f760cd43ef576f8f9b689adbb6bcbc

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-2.1.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 79450ac36586ca9d21479c6abecbd44a0eb7d1979e61a0d4b1219e8736a64736
MD5 3e8dafd01b27c8e4ca2325fc8c668672
BLAKE2b-256 6f661a127318260a39bb21498a9d32f3166210e284114cfadecf41b2a2a42383

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.3-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-2.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 72b1580be00ec1f4f9abd2b304fd55b4ce0c4b0bc469c0f925c6783e5441b39f
MD5 fd22a68984f91b7ab3524fda8db64bce
BLAKE2b-256 e9f280cb0a4d01fa8f2f3051f88dde81be836f06aa738671470bf166811b339a

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-2.1.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e02d9ffbf7599e19a20b0e37520d954b6d45a0a0a8ad387a2c50c3f21bd55c0b
MD5 82bce90ff1816353774273c56c1a26b3
BLAKE2b-256 ef96b4325c307a2f28822b96c8573b9f733cb15933372b6349cf777949ca4015

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.3-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-2.1.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 00c40ec1d65a23893b1477c0742e1f70303231f6bbc99215b6f8cad12b129961
MD5 f85080f4ac7804e323651ccbb93658d8
BLAKE2b-256 12dba631fe89cbdcf079aca9f627b0c67b47a318a7a07dc0336a6c06e93e5a75

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-2.1.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5770d06bd88fbda08d77a833dee3d448ac2e6170cdecebea40fb5de0d6af1e5b
MD5 b6edb800105eb47d93e8b9d6f104f24c
BLAKE2b-256 c11d8c8ca1631cd5bbf428b0d5f72c619890e2a9b5bb0b9c61a6a2ead4ce910f

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.3-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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