How to use PDE tool or other FEM tool to compile into C++?

2 views (last 30 days)
Greetings,
I am trying to use MATLAB to model a thermal domain FEM problem that will be ultimately be used as an MPC based real time controller run in C++. The FEM problem has some fairly complex 2D geometry (its a non uniform thermal borehole array for inter-seasonal heat storage). The fastest route to my mind would be to use the PDE tool to define the geometry and then export the mesh and boundary conditions to a user defined block in our SIMSCAPE based model of the rest of the plant, and then finally compile this into C++ code using the MATLAB code builder.
However the solver [parabolic] is not supported in either SIMSCAPE language or the real time encoder (due to it seems, amongst others, the [sparse] function used within it).
We really want to avoid having to code the maths of the FEM problem from scratch as this would be a lot of work. Is anyone aware of a possible approach in MATLAB that would get round the unsupported functions in the compiler, or any open source FEM tool/code that that will compile as C++?
Failing that, if anyone has come across a decent C++ FEM library this would be useful too!
Many thanks in advance for your valuable time and advice,
Simon Le Blond
  1 Comment
Simon  Le Blond
Simon Le Blond on 15 Oct 2015
Edited: Simon Le Blond on 15 Oct 2015
In case anyone is interested, the approach we decided to go with in the end was to make MATLAB code with the pdetool and then use the MATLAB application builder to run this as a stand alone .exe rather than going into C++. Happily the application builder allows you to build the [parabolic] solver unlike the code builder, negating the need to go deeper into FEM code. Simon

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!