User login


You are here

what is the best computer language to program finite element methods with?


I hope it is ok to ask this here. If not, please let me know which forum to use.

what do you recommned to use for programming finite element methods these days?

I am now learning FEM, and would like to start programming small programs to solve very simple problems to help me learn it better.

 I'd like to be able to plot easily (I learn better by seeing plots than just numbers). A friend recommeneded I use Mathematica or Matlab.  What other options do you recommend?

 This is the list I made so far:

  1. Mathematica or Matlab/octave (easier to make plots and visulization with). I saw 2 good books on FEM with Mathematica, and few with Matlab also. Lots of buildin matrix and math related functions.
  2. Java (I have a book on programming FEM using Java with OO, looks interesting, and can do plots, but not as easily as with choice (1)
  3. Fortran. Hard to make plots with, but might be the fastest one.
  4. C++. Same as (3), but do not like pointers. Hard to manage.
  5. Ada. same as (3). Hard to plot with, might not be as good as Fortran for FEM.
  6. Python. Has plotting options, but I do not know Python and not sure this is better than (1) any way.

So, what would you recommend using? First time learning FEM and I have not programmed it before. I do see may older books on the subject that use Fortran. So I am not sure, that is why I am asking.

I also would like to know what language is used most commonly to write these commercial large FEM in? Is it still Fortran? But from what I see on the demos shown, they have lots of GUI and I was told that Fortran has no GUI in it. So I am thinking may be they use C++? Would any one know for sure?

If you know of links I can read to help me decide, please let me know.

thank you


A.Brick Chaouche's picture

Hello, i suggest Fortran or Python, these two are an easy languages for scientist to run their computation on computer, for python you can use Abaqus a software, you can draw your geometry on Abaqus and use its meshing capabilities, and then Abaqus trun all on a scripts files,you can get the data related to your model on a file to use them for your calculation on your programs. good luck

Dear Robert

I suggest Compaq Visual Fortran (CVF) for programming in FEM. You can use many numerical libraries that is developed in CVF.

 If you are running small meshes, then MATLAB is the way to go for sure. Plotting and solving are already taken care of for you. MATLAB is easily translated to Fortran once you want to run bigger simulations. You'll just have to write a solver function and have it write the results to a file instead of plotting directly.


Julia is a new one which is designed for scientific computing. It claims to have the power of Matlab but the speed of C, etc. I haven't used it, but I'm curious about how powerful it is for development. If you try it, please post back your thoughts. 

My Company - Red Cedar Technology


I may have to try this out for myself, the website shows some extremely impressive performance figures that one can't ignore. Thanks for posting this.


Hello.Undoubtedly, Matlab is the best and most powerful computer language provided that you do not need high calculation speed. By Matlab you can trace and analyze your program with ease. Also, drawing plots and eliminating errors is too easier than other programming languages. Matlab is an open-source and functional software and most well-known software are linked with it. You can find many translators (inward or outward) which relate MATLAB to others. For instance, you can run C and Fortran programs in Matlab by MEX file. I have worked with more mentioned computer languages especially for simulating Iterative Numerical Methods like FEM. I think the only disadvantage of Matlab is its time consuming.

Good Luck with FEM programming,


Matlab is easy to use and highly transferable. I did my thesis reseach using Matlab and Abaqus.

Temesgen Markos's picture

If you are programming FEM for the first time, Matlab is very convenient unless you are very good at programming in one of the other languages. Pick the langauge that is the easiest for you so that you can focus on FEM and not programming issues. For many people Matlab is easier.

johntfoster's picture

Whenever I ask students to program FEM for the first time, I always tell them to just use whatever language they feel most comfortable in.  If you have access to Mathematica it is a good choice because you can start with small problems and utilize ordinary matrix data structures, you can typeset your equations more-or-less as they appear in the book, and then as the complexity increases you can easily transition to using SpareArray data structures and compiled code either targeting the Mathematica Virtual Machine or even C code for increased memory efficiency and speed.  There are also some nice auto-parallelization features you can utilize.

If you do not have access to Mathematica, I would suggest Python as an alternative.  Using the numpy, scipy, and matplotlib extension libraries you can essentially replicate all of the functionality of Matlab for free.  Plus you get a language that was built from the ground up to be object-oriented, which may make the transition to C++ easier later on.  You can also easily call C or Fortran code from within Python making it a nice prototyping language and "glue" code.

For production quality code, Fortran and C/C++ are you real options.  Especially C++ if you use the parallel data structures and solvers in the Trilinos library for large problems. Although, this path will probably have a substantial learning curve if you are not already a C++ developer.

Amir Abdollahi's picture

Kratos is a free source C++ framework for building multi-disciplinary finite element programs. It provides several tools for easy implementation of finite element applications and a common platform for natural interaction of the same in different ways.  For further details you can visit the website: 



The choice depends on many parameters.

If you can make easily a code in any languge, so use this language. To plot or visualize the results, you can export them to a data file and use data-plotter software like prestoplot to make graphs.

For the using of Fortran or C++, I still thinking that Fortran is the best for FEM programming, for the time of compilation/excecution and accuracy. but I prefer to use C++ because I'm not very good with Fortran and they are similar for FEM programming.


Ronald Peters's picture

I used Python in the past with good success it is a high level programming language easily suited for beginners to grasp relatively quickly. 

For all scientific programming, FORTRAN is the best. Most of th ecommercial FEA codes have their core written in this language.

So if you are interested in not only learning FEA, but also its algorithmic implementation (means writing everything from scratch, thought for data input-output, storage, code optimization, etc.) FORTRAN would be the best to work with. And try not rely more on special library packages, as you might not appreciate the algorithms (this is my personal view)

If you interest is just in learning the working of FEA, then any language is good enough (e.g. python, julia, c++, etc.), or any tool such as MATLAB, mathematica, or mathcad. It all dependes on what your interests are. :)


The world started with 0, is progressing with 0, but doesn't want 0.

Subscribe to Comments for "what is the best computer language to program finite element methods with?"

Recent comments

More comments


Subscribe to Syndicate