Skip to main content

A Python library for generating tensor train representations of finite element meshes

Project description

TTFEMesh

PyPI Documentation Status Tests codecov

Python 3.10 Python 3.11 Python 3.12

TTFEMesh is a Python library for generating tensor train representations of finite element meshes. It provides a comprehensive toolkit for creating domains, generating meshes, and computing tensorized Jacobians, Dirichlet masks, and concatenation maps, all of which are essential for solving partial differential equations using tensor train decompositions.

Features

  • Domain creation and manipulation
  • Finite element mesh generation
  • Tensor train representation of mesh components
  • Computation of tensorized Jacobians
  • Dirichlet boundary condition handling
  • Concatenation map generation
  • Integration with the torchtt package for TT decompositions
  • Support for 2D domains and meshes
  • Flexible and extensible architecture

Installation

Platform Support

TTFEMesh is currently only supported on Linux systems due to dependencies on the torchtt package. For other platforms (macOS, Windows), we recommend using Docker.

Linux Installation

  1. Install system dependencies:
sudo apt-get update
sudo apt-get install -y libblas-dev liblapack-dev
  1. Install the package:
pip install ttfemesh

Quick Start

Here's a simple example to get you started:

from ttfemesh.domain import RectangleFactory, CurveConnection2D, DirichletBoundary2D, Domain2D
from ttfemesh.quadrature import GaussLegendre2D
from ttfemesh.mesh import DomainBilinearMesh2D

# Create a domain with two rectangles
rectangle1 = RectangleFactory.create((0, 0), (2, 1))
rectangle2 = RectangleFactory.create((2, 0), (3, 1))

# Connect the rectangles
edge = CurveConnection2D([0, 1], [1, 3])

# Set boundary conditions
bc = DirichletBoundary2D([(0, 3), (1, 1)])

# Create the domain
domain = Domain2D([rectangle1, rectangle2], [edge], bc)

# Generate a mesh
order = 1
qrule = GaussLegendre2D(order)
mesh_size_exponent = 3
mesh = DomainBilinearMesh2D(domain, qrule, mesh_size_exponent)

# Get tensorized components
subdmesh = mesh.get_subdomain_mesh(0)
jac_tts = subdmesh.get_jacobian_tensor_trains()
jac_dets = subdmesh.get_jacobian_det_tensor_trains()
jac_invdets = subdmesh.get_jacobian_invdet_tensor_trains()

# Get element to global index map
element2global_map = mesh.get_element2global_index_map()

# Get Dirichlet masks and concatenation maps
masks = mesh.get_dirichlet_masks()
concat_maps = mesh.get_concatenation_maps()

Documentation

For detailed documentation, including API reference and examples, visit our documentation.

Requirements

  • Python >= 3.10, < 3.13
  • Linux operating system (or Docker)
  • BLAS and LAPACK libraries (system dependencies)
  • torchtt (for tensor train operations)
  • Other dependencies listed in requirements.txt

Contributing

We welcome contributions! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.

License

TTFEMesh is licensed under the MIT License - see the LICENSE file for details.

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

ttfemesh-0.1.2.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

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

ttfemesh-0.1.2-py3-none-any.whl (40.2 kB view details)

Uploaded Python 3

File details

Details for the file ttfemesh-0.1.2.tar.gz.

File metadata

  • Download URL: ttfemesh-0.1.2.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for ttfemesh-0.1.2.tar.gz
Algorithm Hash digest
SHA256 19c4cb28c0c6edb570247bef2be6ab7b9230c2c86c646f3ce01372cd3d5d67cb
MD5 ef8cb4248c1f7853dfcbed04e0426a67
BLAKE2b-256 53df5e1cbeb719b0dd4a08e20cd6466760f23c1a2a24a2a02417cb2e38e5caf5

See more details on using hashes here.

File details

Details for the file ttfemesh-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ttfemesh-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 40.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for ttfemesh-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1681fe01cd2067ab5f48274648f9e71bc2b905556e09107f932f9032e6b2ed8b
MD5 b42aa618faaaeb0ff6e0cdb8fb2152e6
BLAKE2b-256 53e5f4a288a3d33ec7570479be76c90a9d5c5799232ac8b613de6ce6fe93461f

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