A parallel, object-oriented MATLAB finite element library.
mFEM is a parallel, object-oriented, open-source finite element library that includes automatic assembly routines. The project was started to serve as a means for methods testing and comparison against advanced, massively parallel frameworks such as libMesh.
This project is currently inactive. I am no longer working on the projected that supported the development of this code and no longer have access to MATLAB. The master branch is a relatively complete implementation and th parallel branch is a work in progress to imporve the efficiency. The later is working to some extent but requires quite a bit of work and some re-implementation before it is in a stable state. I honestly hope to return to this project some day and create a valuable educational tool, but it will likely not be for some years.
Installation is trival, since mFEM relies soley on MATLAB's built in functionality. To install mFEM:
>> install;
The following code solves a simple displacement problem using 13 lines of code, with a few extra for plotting the results. This is demo was extracted from Example 7 of the mFEM source code, which contains dozens of example problems, with and without the automatic solvers and assembly functionality.
Generate a rectangular, 2D grid. This grid rangs from 0 to 10 in the x-direction and -0.5 to 0.5 in the y-direction. It is discritized into 30 and 20 elements in the x- and y-direction, respectively.
mesh = mFEM.Mesh('Space','vector');
mesh.grid('Quad4',0,10,-0.5,0.5,30,20);
Add boundary tags to the left and right side.
mesh.addBoundary(1, 'right');
mesh.addBoundary(2, 'left');
mesh.update();
Add the finite element equations.
sys = mFEM.System(mesh);
sys.addConstant('E', 1e7, 'v', 0.3, 'P', [0;100]);
sys.addConstant('D', 'E / (1-v^2) * [1, v, 0; v, 1, 0; 0, 0, (1-v)/2]');
sys.addMatrix('K', 'B''*D*B');
sys.addVector('f', 'N''*P', 'Tag', 2);
Assemble and solve the equations.
solver = mFEM.solvers.LinearSolver(sys);
solver.addEssential('tag',1,'value',0);
u = solver.solve();
Plot the results.
mesh.plot(u,'-deform','Patch',{'EdgeColor','k'},'Colorbar','y-disp. (m)','Component', 2);
title('FEM Solution');
xlabel('x (m)'); ylabel([]);
Funding for this project was provided by the National Science Foundation Earth Sciences Postdoctoral Fellowship Program.