Linux | Linux | Windows |
---|---|---|
DelFEM2 is a end-to-end framework for geometry processing and FEM simulation covering wide range of components including shape editing, meshing, FEM simulation, linear solver, and visualization. DelFEM2 is aiming an interactive digital engineering and authoring tool.
Aside from the C++ implementation, python wrapper called PyDelFEM2 is provided. PyDelFEM2 can run various types of FEM simulation just a 10-20 lines of codes. Here is the example of solving the Poisson's equation in a square domain.
import PyDelFEM2 as dfm2
import PyDelFEM2.gl.glfw
cad = dfm2.Cad2D()
cad.add_polygon(list_xy=[-1,-1, +1,-1, +1,0, +0,+0, 0,+1, -1,+1.0])
mesh,map_cad2mesh = cad.mesh(0.05)
fem = dfm2.FEM_Poisson(source=1.0)
fem.updated_topology(mesh)
npIdP = cad.points_edge([0,1,2,3], mesh.np_pos)
fem.ls.bc[npIdP] = 1
fem.solve()
field = dfm2.VisFEM_ColorContour(fem,"value")
dfm2.gl._glfw.winDraw3d([field])
The result of this code woud be the following window
The implementation is based on the DelFEM library
Please find out more detail in this project document
Please look at the python exaxmples under examples_cpp
, examples_py
, examples_pyqt
, and examples_jupyter
.
Reading the test code under tests\
also help understanding the code behaviour
PyDelFEM runs on Python3. Python2 is not supported.
PyDelFEM2 depends on following python packages:
- numpy
- glfw
- PyOpenGL
- PySide2
These dependency is written in REQUIRED_PACKAGES
in the setup.py, so they are automatically installed when installing the PyDelFEM2 pakage using the setup.py
or pip3
.
PyDelFEM2 can be installed simply with
pip3 install PyDelFEM2
For Ubuntu, if you don't have pip installed, get it with sudo apt-get install python3-pip
The installation fails if OpenGL packages are missing. For Ubuntu, install them sudo apt-get install freeglut3-dev libglfw3-dev libglew-dev
Installation from the GitHub repository can be done with the command:
pip3 install git+https://github.com/nobuyuki83/delfem2
git clone https://github.com/nobuyuki83/delfem2.git
git submodle update --init --recursive
python3 setup.py install
For Ubuntu if you don't have git install it with sudo apt-get install git
For the testing, DelFEM2 used following models:
test_piputs/RiggedFigure.glb
from https://github.com/cx20/gltf-test/tree/master/sampleModels/RiggedFiguretest_inputs/CesiumMan.glb
from https://github.com/cx20/gltf-test/tree/master/sampleModels/CesiumMantest_inputs/rollsRoyce.obj
from https://poly.google.com/view/3DtJTlxgO_Utest_inputs/walk.bvh
from https://sites.google.com/a/cgspeed.com/cgspeed/motion-capture/cmu-bvh-conversiontest_inputs/jump.bvh
from https://sites.google.com/a/cgspeed.com/cgspeed/motion-capture/cmu-bvh-conversiontest_input/uglysweater.jpg
from https://www.flickr.com/photos/74812695@N00/6516495819test_input/bolt.STEP
from https://grabcad.com/library/anchor-bolt-2test_inputs/epping_forest_01_1k.hdr
from https://hdrihaven.com/hdri/?h=epping_forest_01