Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Generation and export of system matrices

More
3 years 6 months ago #3252 by michiba
Hello,

I want to integrate the FE model of a given geometry in a simulation model that is solved in another tool, e.g. Matlab. For that I want to mesh the geometry with Netgen and generate/export the system matrices (as linearization at a given point).


The problem would be a transient heat transfer problem. The interface/BC should be the heat flux densities at the surface elements of the generated mesh.

Would this be possible to do with Netgen/NGSolve?

Thanks!
Michael
More
3 years 6 months ago #3253 by christopher
In principle? Yes. You can create numpy/scipy matrics from NGSolve and afaik you can store these matrices in Matlab format. Probably won't be very efficient though...
More
3 years 6 months ago #3254 by michiba
Thanks for the rapid reply.
Efficiency is not our major concern atm.
Can you give me an entry point in the documentation for this?
More
3 years 6 months ago #3255 by christopher
I think the easiest way is to first go to numpy. Then there is a lot of stuff online for numpy <-> matlab. For exporting to numpy see for example here:

ngsolve.org/docu/latest/how_to/howto_numpy.html?highlight=scipy
More
3 years 6 months ago #3256 by michiba
Ok, thanks. I guess Numpy/Matlab is already covered on my side.
Basically I wanted to know if there is (easy) access to a vector/matrix representation of the system equations in NGSolve.
More
3 years 6 months ago #3257 by christopher
Yes. After assembling the matrix (stored in sparse csr format) is accessible by a.mat, the vector of the right hand side as f.vec. The sparse matrix has .CSR and .COO methods to get numpy arrays for the different sparse matrix formats.

For the input it depends how your heat flux is given. If it is described by a function you can formulate it using NGSolve CoefficientFunctions.
Time to create page: 0.125 seconds