Skip to main content

A high-performance Python library for material simulation and analysis

Project description

MaterForge - Materials Formulation Engine with Python

A high-performance Python library for material simulation and analysis. MaterForge enables efficient modeling of pure metals and alloys through YAML configuration files, providing symbolic and numerical property evaluation for various material properties.

Python Latest Release License Documentation Status Pipeline Status Code Coverage

Table of Contents

🚀 Key Features

  • Modular Architecture: Clean separation with algorithms, parsing, and visualization modules
  • Flexible Material Definition: Support for both pure metals and alloys
  • YAML-Driven Configuration: Define materials using intuitive YAML files
  • Temperature-Dependent Properties: Support for complex temperature-dependent material properties
  • Symbolic Mathematics: Built on SymPy for precise mathematical expressions
  • Piecewise Functions: Advanced piecewise function support with regression capabilities
  • Property Inversion: Create inverse functions for energy density and other properties
  • Visualization: Automatic plotting of material properties with customizable options
  • Material Types: Support for both pure metals and alloys with appropriate phase transition temperatures
  • Multiple Property Types: Support for constants, step functions, file-based data, key-value pairs, and computed properties
  • Regression Analysis: Built-in piecewise linear fitting with configurable parameters

📦 Installation

Prerequisites

  • Python 3.10 or higher
  • Required dependencies: numpy, sympy, matplotlib, pandas, ruamel.yaml

Install using pip

pip install materforge

Development Installation

git clone https://i10git.cs.fau.de/rahil.doshi/materforge.git
cd materforge
git submodule update --init --recursive
pip install -e .[dev]

🏃 Quick Start

Basic Material Creation

import sympy as sp
from materforge.parsing.api import create_material

# Create a material with symbolic temperature
T = sp.Symbol('T')
material_T = create_material('path/to/material.yaml', T)

# Access properties
print(f"Heat capacity: {material_T.heat_capacity}")

# Evaluate at specific temperature
temp_value = 1500.0  # Kelvin
density_at_temp = material_T.evaluate_properties_at_temperature(temp_value)
print(f"Density at {temp_value}K: {density_at_temp:.2f} kg/m³")

# For symbolic expressions with automatic plotting
material_with_plot = create_material('steel.yaml', T, enable_plotting=True)

Working with Piecewise Inverse Functions

from materforge.algorithms.piecewise_inverter import PiecewiseInverter

# Create inverse energy density function: T = f_inv(E)
if hasattr(material, 'energy_density'):
    E = sp.Symbol('E')
    inverse_func = PiecewiseInverter.create_energy_density_inverse(material, 'E')

    # Test round-trip accuracy
    test_temp = 500.0
    energy_val = float(material.energy_density.subs(T, test_temp))
    recovered_temp = float(inverse_func.subs(E, energy_val))
    print(f"Round-trip: T={test_temp} -> E={energy_val:.2e} -> T={recovered_temp:.2f}")

📋 YAML Configuration Format

Supported Property Types

  • CONSTANT_VALUE: Simple numeric values
  • FILE_IMPORT: Data loaded from CSV/Excel/text files
  • TABULAR_DATA: Temperature and corresponding property value pairs
  • STEP_FUNCTION: Discontinuous transitions
  • PIECEWISE_EQUATION: Symbolic equations over temperature ranges
  • COMPUTED_PROPERTY: Properties calculated from other properties

See the YAML schema documentation for detailed configuration options. YAML configuration examples can be found here:

📚 Documentation

Our documentation follows the Diátaxis framework with four distinct types:

Tutorials - Learning-oriented guides

How-to Guides - Problem-oriented instructions

Reference - Information-oriented documentation

Explanation - Understanding-oriented discussions

🤝 Contributing

Contributions are welcome! Please see our Contributing Guide for details on how to get started.

🐛 Known Limitations

  • Piecewise Inverter: Currently supports only linear piecewise functions
  • File Formats: Limited to CSV, Excel, and text files
  • Memory Usage: Large datasets may require optimization for very high-resolution data
  • Regression: Maximum 8 segments recommended for stability

📄 License

Core Library (BSD-3-Clause)

The MaterForge library itself (src/materforge/, examples/, tests/, docs/) is licensed under the BSD 3-Clause License. You can use, modify, and distribute it freely under permissive terms. See the root LICENSE file for full details.

Application Examples (GPL-3.0-or-later)

The apps/ directory contains demonstration applications that integrate MaterForge with waLBerla and pystencils. Because these dependencies are GPLv3-licensed, the apps directory and its contents are licensed under GPLv3 or later. See apps/LICENSE for full details.

PyPI Distribution

The pip install materforge package includes only the BSD-3-Clause licensed core library. The GPL-licensed apps are excluded from the PyPI distribution and are available only in the source repository for developers who clone it.

Summary Table

Component Location License Included in PyPI
Core library src/materforge/ BSD-3-Clause ✅ Yes
Example scripts examples/ BSD-3-Clause ❌ No
Tests tests/ BSD-3-Clause ❌ No
Documentation docs/ BSD-3-Clause ❌ No
Apps (waLBerla/pystencils demos) apps/ GPL-3.0-or-later ❌ No

For questions about licensing, contact rahil.doshi@fau.de.

📖 Citation

If you use MaterForge in your research, please cite it using the information in our CITATION.cff file.

📞 Support

🙏 Acknowledgments

  • Built with SymPy for symbolic mathematics
  • Data handling powered by pandas
  • Uses pwlf for piecewise linear fitting
  • Visualization powered by Matplotlib
  • YAML parsing with ruamel.yaml

MaterForge - Empowering material simulation with Python 🚀


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

materforge-0.6.2.tar.gz (9.0 MB view details)

Uploaded Source

Built Distribution

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

materforge-0.6.2-py3-none-any.whl (290.4 kB view details)

Uploaded Python 3

File details

Details for the file materforge-0.6.2.tar.gz.

File metadata

  • Download URL: materforge-0.6.2.tar.gz
  • Upload date:
  • Size: 9.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for materforge-0.6.2.tar.gz
Algorithm Hash digest
SHA256 92f8740110eeafef6fcb34922b61112537bf30c465e45a81c7600474b59dcc32
MD5 94c1e78d8e0937194fad9ed8f5c6da1d
BLAKE2b-256 a3577c6f55e163f4e460ac6205aa911420818399301f07530a98b1bd0c1e5c95

See more details on using hashes here.

File details

Details for the file materforge-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: materforge-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 290.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for materforge-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 39dc4e4e4c8b30c0dc448cf93a77cee84727acacf4120301ab45134c6407c15c
MD5 b8851d8faba7f2c21657d6adccef11e6
BLAKE2b-256 2280b127fb2f6860cd9b4644eabd8882220f3dcb3b1ab0a300534e7f5d6842a4

See more details on using hashes here.

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