florence

A finite element framework for Python's scientific stack: arbitrary order planar/curvilinear mesh generation and finite element methods for linear and nonlinear analysis of coupled multiphysics problems

https://github.com/romeric/florence

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.2%) to scientific vocabulary

Keywords

electromechanics finite-elements high-performance mechanics multiphysics python
Last synced: 6 months ago · JSON representation

Repository

A finite element framework for Python's scientific stack: arbitrary order planar/curvilinear mesh generation and finite element methods for linear and nonlinear analysis of coupled multiphysics problems

Basic Info
  • Host: GitHub
  • Owner: romeric
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 2.93 MB
Statistics
  • Stars: 90
  • Watchers: 7
  • Forks: 16
  • Open Issues: 3
  • Releases: 5
Topics
electromechanics finite-elements high-performance mechanics multiphysics python
Created over 10 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog License

README.md

Build Status Coverage Status

Florence is a Python-based computational framework for the numerical simulations of multi-physics problems using the finite element methods.

Features

A non-exhaustive list of core features: - High order planar and curved finite and boundary elements (line, tri, quad, tet, hex) - In-built CAD-conformal curvilinear mesh generator - Powerful in-built pre and post processor with the ability to visualise high order curved meshes - Poisson, electrostatic and heat transfer solvers - Linear, geometrically linearised and fully nonlinear solid/structural mechanics solvers - Linear, geometrically linearised and fully nonlinear electromechanics solvers - Implicit and explicit dynamic solvers with contact formulation - Generic monolithic, staggered and multigrid solvers for coupled multiphysics driven problems - Strain gradient and micropolar elasticity and electro-elasticty solvers - A suite of advanced hyperelastic, electrostatic and electro-hyperelastic material models - Ability to read/write mesh/simulation data to/from gmsh, Salome, GID, Tetgen, obj, FRO, VTK and HDF5 - Support for heterogeneous computing using SIMD, shared parallelism, cloud-based parallelism and cluster-based parallelism - Interfaces to a suite of sparse direct and iterative solvers including MUMPS, Pardiso, Petsc and hypre

In addition, the framework also provides Python interfaces to many low-level numerical subroutines written in C, C++ and Cython.

Platform support

Florence supports all major operating systems including Linux, macOS and Windows (under Cygwin/MinGW) under - Python 2.7 - Python >= 3.5 - PyPy >= v5.7.0

Dependencies

The following packages are hard dependencies - Fastor: Data parallel (SIMD) FEM assembler - cython - numpy - scipy

The following packages are optional (but recommended) dependencies - PostMesh: High order curvilinear mesh generator - pyevtk - matplotlib - mayavi - scikit-umfpack - pyamg - psutil - h5py

In addition, it is recommended to have an optimised BLAS library such as OpenBLAS or MKL installed and configured on your machine.

Installation

The easy way

using pip

pip install Florence

For pip installation to work you need to have Fastor installed. You can achieve this by

cd ~ git clone https://github.com/romeric/Fastor mv Fastor/ /usr/local/include/Fastor/

It is also a good practice to set your compilers before pip installing florence

export CC=/path/to/c/compiler export CXX=/path/to/c++/compiler

Building from source

Have a look at travis.yml file for directions on installing florence's core library. First install cython, numpy and scipy. Download Fastor headers and place them under their default location /usr/local/include/Fastor

cd ~ git clone https://github.com/romeric/Fastor mv Fastor/ /usr/local/include/Fastor/

Then installation of the core library is as easy as

git clone https://github.com/romeric/florence cd florence python setup.py build export PYTHONPATH="/path/to/florence:$PYTHONPATH"

This builds many low-level cython modules, ahead of time. Options can be given to setup.py for instance

python setup.py build BLAS=mkl CXX=/usr/local/bin/g++ CC=~/LLVM/clang

By default, florence builds in parallel using all the machine's CPU cores. To limit the build process to a specific number of cores, use the np flag for instance, for serial build one can trigger the build process as

python setup.py build np=1

Configuring MUMPS direct sparse solver

Florence can automatically switch to MUMPS sparse direct solver if available. To install MUMPS, the easiest way is to use homebrew on macOS and linuxbrew on linux:

brew install mumps --without-mpi --with-openblas git clone https://github.com/romeric/MUMPS.py cd MUMPS.py python setup.py build python setup.py install

And whenever MUMPS solver is needed, just open a new terminal window/tab and do (this is the default setting for linuxbrew) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/linuxbrew/.linuxbrew/lib

Configuring Pardiso direct sparse solver

The direct sparse solver shipped with MKL, Pardiso can be used if MKL is available. Both Anaconda and Intel distribution for python ship these. If MKL is installed, the low-level FEM assembler in florence is also automatically linked to it during compilation, as long as "BLAS=mkl" flag is issued to setup.py.

shell conda install -c haasad pypardiso We typically do not recommed adding anaconda/bin to your path. Hence, whenever MKL features or Pardiso solver is needed, just open a new terminal window/tab and type

export PATH="/path/to/anaconda2/bin:$PATH"

Philosophy

Florence follows scipy's philosophy of providing a high level pythonic interface to finite element analysis of partial differential equations. It is a light weight library that depends only on the most ubiquitous python packages namely numpy, scipy and cython. Yet it is aimed to deliver high performance numerical computations on a range modern architectures. It is backend is designed to be configurable for plugging new solvers such as Petsc's and hypre's parallel solvers.

Documentation

Documentation is available under wiki pages. Furthermore, a series of well explained examples are provided in the example folder that cover most of the functionality of florence.

To get a quick taste of Florence, let us consider the Laplacian for example. Setting up and solving the Laplace equation using fourth order hexahedral Lagrange shape functions over a cube is as simple as

~~~python import numpy as np from Florence import *

def simple_laplace(): """An example of solving the Laplace equation using fourth order hexahedral elements on a cube """

# generate a linear hexahedral mesh on a cube
mesh = Mesh()
mesh.Cube(element_type="hex", nx=6, ny=6, nz=6)
# generate the corresponding fourth order mesh
mesh.GetHighOrderMesh(p=4)

# set up boundary conditions
def dirichlet_function(mesh):
    # create boundary flags - nan values would be treated as free boundary
    boundary_data = np.zeros(mesh.nnode)+np.NAN
    # potential at left (Y=0)
    Y_0 = np.isclose(mesh.points[:,1],0)
    boundary_data[Y_0] = 0.
    # potential at right (Y=1)
    Y_1 = np.isclose(mesh.points[:,1],mesh.points[:,1].max())
    boundary_data[Y_1] = 10.

    return boundary_data

boundary_condition = BoundaryCondition()
boundary_condition.SetDirichletCriteria(dirichlet_function, mesh)

# set up material
material = IdealDielectric(mesh.InferSpatialDimension(), eps=2.35)
# set up variational form
formulation = LaplacianFormulation(mesh)
# set up solver
fem_solver = FEMSolver(optimise=True)
# solve
results = fem_solver.Solve( boundary_condition=boundary_condition,
                            material=material,
                            formulation=formulation,
                            mesh=mesh)

# write results to vtk file
results.WriteVTK("laplacian_results")

if name == "main": simple_laplace() ~~~

Owner

  • Name: Roman
  • Login: romeric
  • Kind: user
  • Location: United Kingdom

GitHub Events

Total
  • Watch event: 6
  • Push event: 5
Last Year
  • Watch event: 6
  • Push event: 5

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 842
  • Total Committers: 5
  • Avg Commits per committer: 168.4
  • Development Distribution Score (DDS): 0.029
Past Year
  • Commits: 10
  • Committers: 1
  • Avg Commits per committer: 10.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
romeric r****a@y****m 818
romeric r****n@R****l 8
romeric r****n@r****e 8
Roman Poya r****c 7
Graham Knapp 3****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 6
  • Total pull requests: 3
  • Average time to close issues: 6 months
  • Average time to close pull requests: about 3 hours
  • Total issue authors: 4
  • Total pull request authors: 2
  • Average comments per issue: 1.17
  • Average comments per pull request: 0.67
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • romeric (3)
  • nicolaskr (1)
  • ywan459 (1)
  • jdlaubrie (1)
Pull Request Authors
  • romeric (2)
  • dancergraham (1)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 103 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 6
  • Total maintainers: 1
pypi.org: florence

A Python based computational framework for integrated computer aided design, curvilinear mesh generation and finite and boundary element methods for linear and nonlinear analysis of solids and coupled multiphysics problems

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 103 Last month
Rankings
Dependent packages count: 7.3%
Stargazers count: 8.1%
Forks count: 9.9%
Average: 13.3%
Downloads: 18.9%
Dependent repos count: 22.1%
Maintainers (1)
Last synced: 6 months ago

Dependencies

requirements.txt pypi
  • coverage *
  • cython *
  • matplotlib *
  • nose2 *
  • numpy >=1.14
  • psutil *
  • pyamg *
  • pyevtk *
  • python-coveralls *
  • scikit-umfpack ==0.3.1
  • scipy *
setup.py pypi
  • cython >=0.23
  • numpy >=1.9
  • scikit-umfpack >=0.2
  • scipy >=0.14