Dear Professor Renard,

I tried with GradGT() but I had some issues in reducing the matrix properly. 
Finally I resolved by computing handy the x-y-z components of the tangent 
vector lambda and multiplying those for the components of the gradient, within 
the assembly procedure. It seems to work properly.

/// Build the mixed pressure term for 1D mesh
/// D = - \int p du/ds ds = = - \int p GRAD(u).lambda
template<typename MAT, typename VEC>
void
asm_poiseuille(MAT & D,
               const VEC & lambdax,
               const VEC & lambday,
               const VEC & lambdaz,
               const mesh_im & mim,
               const mesh_fem & mf_u,
               const mesh_fem & mf_p,
               const mesh_fem & mf_data,
               const mesh_region & rg = mesh_region::all_convexes()
               )
{
    GMM_ASSERT1(mf_p.get_qdim() == 1 && mf_u.get_qdim() == 1,
               "invalid data mesh fem (Qdim=1 required)");
    generic_assembly
    assem("l1=data$1(#3); l2=data$2(#3); l3=data$3(#3);"
          "t=comp(Base(#1).Grad(#2).Base(#3)); 
M$1(#1,#2)+=-t(:,:,1,i).l1(i)-t(:,:,2,i).l2(i)-t(:,:,3,i).l3(i);");
    assem.push_mi(mim);
    assem.push_mf(mf_p);
    assem.push_mf(mf_u);
    assem.push_mf(mf_data);
    assem.push_data(lambdax);
    assem.push_data(lambday);
    assem.push_data(lambdaz);
    assem.push_mat(D);
    assem.assembly(rg);
}


Thank you,
domenico_notaro
_______________________________________________
Getfem-users mailing list
[email protected]
https://mail.gna.org/listinfo/getfem-users

Reply via email to