Hum... no sorry, I made a mistake. The assembly string should be
generic_assembly assem("M$1(#2,#1)+=comp(Base(#2).vGrad(#1))(:,:,i,i);");
I forgot to exchange the #1 and #2 in M$1(#1,#2)Yves. ----- Mail original ----- De: "Domenico Notaro" <[email protected]> À: "yves renard" <[email protected]> Cc: "getfem-users" <[email protected]> Envoyé: Dimanche 8 Novembre 2015 19:09:58 Objet: [SOLVED] [Getfem-users] Assembly of rectangular matrix: order of trial and test FE spaces OK, hence the following statement should be valid: If one wants to implement a matrix A(i,j) i=1,...,mf_p.nb_dof(), j=1,...,mf_u.nb_dof() He has to "invert" the order of basis function within the assembly: assem("M$1(#1,#2)+=comp(Base(#2).Base(#1));"); as a consequence of the generic FEM relation A(i,j) = a(Base^j, Base^i), being a(.,.) the bilinear form associated to A. Thank you so much, Domenico ________________________________________ Da: Yves Renard <[email protected]> Inviato: domenica 8 novembre 2015 18.52 A: Domenico Notaro Cc: getfem-users Oggetto: Re: [Getfem-users] Assembly of rectangular matrix: order of trial and test FE spaces Dear Domenico, You can of course obtain the transposed matrix. In fact just by interverting the terms in the assembly string: generic_assembly assem("M$1(#1,#2)+=comp(Base(#2).vGrad(#1))(:,:,i,i);"); assem.push_mi(mim); assem.push_mf(mf_u); assem.push_mf(mf_p); assem.push_mat(M); assem.assembly(rg); Yves. ----- Mail original ----- De: "Domenico Notaro" <[email protected]> À: "yves renard" <[email protected]> Cc: "getfem-users" <[email protected]> Envoyé: Dimanche 8 Novembre 2015 18:08:54 Objet: Re: [Getfem-users] Assembly of rectangular matrix: order of trial and test FE spaces Dear Professor Renard, thank you for your prompt reply. Actually, the solution you suggest me was exactly my first attempt (a), apart from a stupid typing error (obviously it was "vBase().Normal()"-->"vGrad()"!). But this assembly routine returns a mf_u.nb_dof() x mf_p.nb_dof() matrix while I need the transposed... That's why I arrived to option (b), since I thought the dimensions of output matrix follow from the order of mesh_fem pushes. Finally, if I have understood you correctly, in the main file I have to: - define a blank transposed matrix: sparse_matrix_type D(mf_u.nb_dof(), mf_p.nb_dof()); - call the assembly routine (a) over this matrix D - use gmm::transposed(D) every time I need the matrix D=\int DIV(u).q And I am supposed to do the same for every rectangular matrix assembly? Best regards, Domenico ________________________________________ Da: Yves Renard <[email protected]> Inviato: domenica 8 novembre 2015 17.19 A: Domenico Notaro Cc: getfem-users Oggetto: Re: [Getfem-users] Assembly of rectangular matrix: order of trial and test FE spaces Dear Domenico, The assembly in the low-level generic assembly should be generic_assembly assem("M$1(#1,#2)+=comp(vGrad(#1).Base(#2))(:,i,i,:);"); assem.push_mi(mim); assem.push_mf(mf_u); assem.push_mf(mf_p); assem.push_mat(M); assem.assembly(rg); (You have it in getfem_assembling.h for instance at lines 769 (asm_stokes_B). Note that you can obtain this also with the high-level generic assembly with an assembly string of the form "Div_Test_u*Test_p". Yves. ----- Mail original ----- De: "Domenico Notaro" <[email protected]> À: "getfem-users" <[email protected]> Envoyé: Samedi 7 Novembre 2015 12:45:32 Objet: [Getfem-users] Assembly of rectangular matrix: order of trial and test FE spaces Dear GetFEM users, I would like to have a double-check on a very basic issue, that is the order of trial and test spaces in rectangular matrix assembly. In particular, which of the following assembly routines returns the matrix $ M = \int DIV(u).q $ where u is the trial mf_u function and q is the test mf_p function? (a) generic_assembly assem("M$1(#1,#2)+=comp(vBase(#1).Normal().Base(#2))(:,i,i,:);"); assem.push_mi(mim); assem.push_mf(mf_u); assem.push_mf(mf_p); assem.push_mat(M); assem.assembly(rg); (b) generic_assembly assem("M$1(#2,#1)+=comp(vBase(#2).Normal().Base(#1))(:,i,i,:);"); assem.push_mi(mim); assem.push_mf(mf_p); assem.push_mf(mf_u); assem.push_mat(M); assem.assembly(rg); (c) generic_assembly assem("M$1(#1,#2)+=comp(Base(#1).vBase(#2).Normal())(:,:,i,i);"); assem.push_mi(mim); assem.push_mf(mf_p); assem.push_mf(mf_u); assem.push_mat(M); assem.assembly(rg); I want to build a matrix M with mf_p.nb_dof() rows and mf_u.nb_dof() columns (i.e. in the main file I have " sparse_matrix_type M(mf_p.nb_dof(), mf_u.nb_dof()); ") Thank you in advance, Domenico _______________________________________________ Getfem-users mailing list [email protected] https://mail.gna.org/listinfo/getfem-users _______________________________________________ Getfem-users mailing list [email protected] https://mail.gna.org/listinfo/getfem-users
