Error operator * product of matrices

Hello,

I am currently working with FreeFrem during my internship and I get an error which I don’t understand. You can find my code following the link bellow my message. I took the code (which works) already written in the study made by Emil Garnell, Olivier Doaré and Corinne Rouby on Coupled vibro-acoustic modeling of a dielectric elastomer loudspeaker published in the Journal of the Acoustical Society of America. Their code allows to get the pressure field created by a membrane which vibrates with the implementation of perfectly matched layers. The acceleration g of the membrane is settled at the beggining of the code. I try to implement the electro-mechanical coupling to represent a real loud-speaker taking to account the action of the pressure on the membrane.

To do so I have taken the original code and I have made some modifications. I start with creating the mesh, the finite element space and writing the variationnal formulation which change a little bit compared to the initial program. The linear system is then of the shape : AP=F. Then I add two rows and two columns corresponding the the electro-mechanical equations to the matrix A, the position X and the electric charge Q are now new unknown. I also add two rows in the F vector. When I try to get the solution of this problem : Pn=An^-1*Fn, FreeFem writes the following error message :

« error operator * <18Matrice_Creuse_invISt7complexIdEE>, <14Matrice_CreuseISt7complexIdEE> »

I understand that FreeFem does not allow to give An^-1 and Fn as an argument to the operator *. It could stems from the difficulty to reverse the matrix, I tried the program with the initial solver (sparsesolver) and I tried UMFPACK but without more success. It is possible to reverse the matrix An, Matlab managed to do it. Do you know what is wrong with my code ? Could you advocate a solver relevant in the problem I try to solve ?

Here is the link towards my code(piston_norayleigh_strongcoupling_forum.edp) and the original code (without electromechanical coupling : piston_norayleigh.edp) :

Best

Mathieu S

You are trying to solve a system with multiple right-hand sides. That’s not possible with the standard interface, but you can do that with PETSc, see this GitHub issue for more details. Also, you should store your solutions and RHS as dense matrices, complex[int, int], not sparse matrices.

OK, after reading more carefully your problem, it looks like you in fact have a single right-hand side. You should just use complex[int] instead of matrix<complex> to store your solution and RHS, that will solve your problem.

Indeed it solved my problem.
Thank you very much !!