Can tgv be chosen different values for Mat and vector

Dear all,

I find the tgvs are chosen different values for Mat and vector in this code line 34 and 36
laplace-adapt-3d-PETSc.edp (1.9 KB)

A = vPoisson(Vh, Vh, tgv = -2);
set(A, sparams = “-ksp_monitor -pc_type hypre”);
real[int] rhs = vPoisson(0, Vh, tgv = -1);

So I have the question as shown in the title, or it’s just a typo.

Why would it matter? Have you understood the meaning of a negative value for tgv?

Thank for your quick reply. My understanding is that tgv = -2 for matrix means symmetric and tgv = -1 for matrix means nonsymmetric. But I am just confused that the tgvs for Matrix and vector can be chosen differently here.

Sorry, I meant to ask you if you understood the meaning for the linear form.

Yes, it’s the variational formulation of the Poisson equation with homogeneous boundary
−∆u = 1, on Ω
u = 0, on Γ

You are not answering my question. If you answer to the question: « what is the meaning of a negative tgv for the linear form? », you will have the answer for your initial question.

Thank you very much for your precious time. I truly did’t understand the meaning of tgv for the linear form before. So I search in the tutorial to learn how to assemble matrix and vector with different value of tgvs. This code
tgv-test.edp (1.1 KB)
explains clearly.

varf va(u,v)= int1d(Th)(uv4*9.)+on(1,2,u=0);// mul by 12 to have integer coef ..
// label : 1 on first DoF O
// 2 on last DoF 2
// tgv : -30 set column of Dof with label 1 or 2 to zero
// tgv : -20 set row and column of Dof with label 1 or 2 to zero
// tgv : -10 set row of Dof with label 1 or 2 to zero
// tgv : -3 set column of Dof with label 1 or 2 to zero and set diagonal term to one
// tgv : -2 set row and column of Dof with label 1 or 2 to zero and set diagonal term to one
// tgv : -1 set row of Dof with label 1 or 2 to zero and set diagonal term to one
// tgv >=0 set diagonal term of Dof with label 1 or 2 to tgv value

Thanks agian!

This example is almost exclusively about the bilinear part, but OK…