No project description provided
Project description
Rayse
A fast hp-FEA library for linear elasticity and the relaxed micromorphic model. The library exposes models for full three-dimensional-, plane-strain- and antiplane-shear models with a common user interface.
Installation
Use the package manager pip to install Rayse:
pip install rayse
Usage
Example for a relaxed micromorphic model of plane-strain. In this example, the python library meshzoo is used to generate the mesh.
from rayse.relaxed_plane_strain import *
from rayse.plot import *
from rayse.consts import *
import meshzoo
# Example mesh generation with meshzoo
h = 0.25
pts, cells = meshzoo.ngon(4, int(1. / h))
pts, cells = pts.tolist(), cells.tolist()
# Define element power and plot resolution
p = 7
res = 5
# Initialize the mesh object
mesh = Mesh(pts, cells, p)
# Create a group for the outher boundary
outer = mesh.def_outer()
# Initialize the computational domain
dom = Dom(mesh)
# Define group "outer" as the Dirichlet boundary
dom.set_boundary(outer)
# Get the number of degrees of freedom
free_dofs, constrained_dofs = dom.dofs()
# Plot the mesh
sys = plot_curves(*dom.plot_sys())
plot(sys).show()
# Define material constants
lam = 11.54
mu = 7.69
c_ec = venant(lam, mu, 2)
c_ecm = venant(2. * lam, 2. * mu, 2)
mulc = 1.
# Set material constants
dom.set_consts(c_ec, c_ecm, mulc)
# Embed a Dirichlet boundary condition on the outer group
dom.embed_bcond(lambda x, y: [sin(x), cos(y)], outer)
# Set force and micro-moment
dom.set_force(lambda x, y: [0., 0.])
# Solve
dom.solve()
# Retrieve results
dom.set_vals()
# Plot results
curves = plot_curves(*dom.plot_curves(res))
surface = plot_surf(*dom.plot_disp(res), opacity=0.9)
plot(curves, surface).show()
# Plot the flux of the microdistorion for the y-axis
flux = plot_flux(*dom.plot_flux(res, 1))
plot(sys, flux).show()
License
Rayse is licensed under GNU LGPLv3.
This software relies on the PyO3 library under the Apache-2.0 license for ffi and on the rayon crate under the MIT and Apache-2.0 licenses for parallelism. The library also exposes a small wrapper for the Plotly library under the MIT license for the purpose of visualization.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.