- Thank you received: 0
Generation and export of system matrices
4 years 1 month ago #3252
by michiba
Generation and export of system matrices was created 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
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
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
4 years 1 month ago #3253
by christopher
Replied by christopher on topic Generation and export of system matrices
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...
4 years 1 month ago #3254
by michiba
Replied by michiba on topic Generation and export of system matrices
Thanks for the rapid reply.
Efficiency is not our major concern atm.
Can you give me an entry point in the documentation for this?
Efficiency is not our major concern atm.
Can you give me an entry point in the documentation for this?
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
4 years 1 month ago #3255
by christopher
Replied by christopher on topic Generation and export of system matrices
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
ngsolve.org/docu/latest/how_to/howto_numpy.html?highlight=scipy
4 years 1 month ago #3256
by michiba
Replied by michiba on topic Generation and export of system matrices
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.
Basically I wanted to know if there is (easy) access to a vector/matrix representation of the system equations in NGSolve.
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
4 years 1 month ago #3257
by christopher
Replied by christopher on topic Generation and export of system matrices
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.
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.111 seconds