Skip to content
Snippets Groups Projects
Rahil Doshi's avatar
d12998ce

pymatlib

Pymatlib is a Python library designed to simulate and analyze material properties. It provides tools for modeling alloys, interpolating material properties, and more.

Pipeline Status License

Table of Contents

Installation

To install pymatlib, you can use pip. It is recommended to install it in a virtual environment:

pip install -e .

This command installs the package in editable mode, allowing you to make changes without needing to reinstall.

Installation Requirements

  • Python version: >= 3.10
  • Required packages:

Installation Steps

  1. Clone the repository:
git clone https://i10git.cs.fau.de/rahil.doshi/pymatlib.git
cd pymatlib
  1. Install the package:
pip install -e .

This installs pymatlib in editable mode for development.

Usage

Here are some examples of how to use the library:

Example 1: Creating an Alloy

from pymatlib.core.alloy import Alloy

alloy = Alloy(
  elements=['Fe', 'Cr'], 
  composition=[0.7, 0.3], 
  temperature_solidus=1700.0, 
  temperature_liquidus=1800.0)
print(alloy)
# Output: Alloy(Fe: 70%, Cr: 30%, solidus: 1700.0 K, liquidus: 1800.0 K)

Example 2: Interpolating Material Properties

from pymatlib.core.interpolators import interpolate_property

T = 1400.0
temp_array = [1300.0, 1400.0, 1500.0]
prop_array = [100.0, 200.0, 300.0]

result = interpolate_property(T, temp_array, prop_array)
print(result)
# Output: 200.0

Features

  • Material Modeling: Define alloys and their properties with ease. Supports various material properties including density, thermal conductivity, and heat capacity.
  • Interpolation: Interpolate material properties across temperature ranges. Provides functions for interpolation of properties based on temperature.
  • Symbolic Calculations: Utilize symbolic math with tools like sympy. Includes data structures for managing assignments and symbolic variables.
  • Extensibility: Add new material properties and interpolators as needed.

Classes

Alloy

A dataclass for alloys, with properties like:

  • elements
  • composition
  • temperature_solidus
  • temperature_liquidus

Assignment

A dataclass representing an assignment operation with:

  • lhs: Left-hand side (symbolic variable).
  • rhs: Right-hand side (expression or tuple).
  • lhs_type: Type of the left-hand side.

MaterialProperty

A dataclass representing a material property that can be evaluated as a function of a symbolic variable (e.g., temperature) and includes symbolic assignments.

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch:
git checkout -b feature/your-feature
  1. Make your changes and commit:
git commit -m "Add new feature"
  1. Push to the branch:
git push origin feature/your-feature
  1. Open a pull request.

License

This project is licensed under the GNU General Public License v3 (GPLv3). See the LICENSE file for details.

Contact

For inquiries or issues: