<div data-ntes="ntes_mail_body_root" style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div id="spnEditorContent"><div style="margin: 0;"><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">$</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">\</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(86, 156, 214);">quad</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">$</span><span style="background-color: rgb(30, 30, 30); color: rgb(218, 218, 218); font-family: Consolas, "Courier New", monospace; white-space: pre;"> </span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(206, 145, 120);">-pc_type composite -pc_composite_type multiplicative -pc_composite_pcs jacobi,ilu -sub_0_pc_jacobi_type rowl1</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); color: rgb(218, 218, 218); font-family: Consolas, "Courier New", monospace; white-space: pre;"> can set the type, but there is still no way to set the left preconditioner or right preconditioner. Is there a command line such as </span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(206, 145, 120);">-sub_0_ksp_pc_side left -sub_1_ksp_pc_side right</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); color: rgb(218, 218, 218); font-family: Consolas, "Courier New", monospace; white-space: pre;">?</span></div><div style="margin: 0;"><br></div><div style="margin: 0;"><br></div></div><div style="position:relative;zoom:1"></div><div id="divNeteaseMailCard"></div><div style="margin: 0;"><br></div><p>At 2026-01-09 09:57:01, "陈培群 " <logic_imagination@163.com> wrote:</p><blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div data-ntes="ntes_mail_body_root" style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div id="spnEditorContent"><div style="margin: 0;"><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">$</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">\</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(86, 156, 214);">quad</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">$</span><span style="background-color: rgb(30, 30, 30); color: rgb(218, 218, 218); font-family: Consolas, "Courier New", monospace; white-space: pre;"> Thanks. What I want is to use </span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(206, 145, 120);">rowl1</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); color: rgb(218, 218, 218); font-family: Consolas, "Courier New", monospace; white-space: pre;"> as scaling and then apply other preconditioner, but when I use </span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(206, 145, 120);">-pc_type composite -pc_composite_type multiplicative -pc_composite_pcs jacobi,...</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); color: rgb(218, 218, 218); font-family: Consolas, "Courier New", monospace; white-space: pre;">, I can't set </span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(206, 145, 120);">-pc_jacobi_type rowl1</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); color: rgb(218, 218, 218); font-family: Consolas, "Courier New", monospace; white-space: pre;">. Can </span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(206, 145, 120);">-sub_pc_type</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); color: rgb(218, 218, 218); font-family: Consolas, "Courier New", monospace; white-space: pre;"> or </span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(206, 145, 120);">PCCOMPOSITE</span><span style="background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; white-space: pre; color: rgb(180, 180, 180);">`</span><span style="background-color: rgb(30, 30, 30); color: rgb(218, 218, 218); font-family: Consolas, "Courier New", monospace; white-space: pre;"> achieve the above requirements?</span><br></div><div style="color: rgb(218, 218, 218); background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; line-height: 19px; white-space: pre;"><div><span style="color: #b4b4b4;">$</span><span style="color: #b4b4b4;">\</span><span style="color: #569cd6;">quad</span><span style="color: #b4b4b4;">$</span> I couldn't find the relevant command line. so I manually scale the linear system in SNES. But it seems that when the preconditioning matrix is constructed by the finite difference method based on the residual, the use of a row scaling similar to the left preconditioner will cause the residual to change and lead to repeated scaling. Is that so?</div><div><span style="color: #b4b4b4;">$</span><span style="color: #b4b4b4;">\</span><span style="color: #569cd6;">quad</span><span style="color: #b4b4b4;">$</span> Then how does the left preconditioner in petsc do not affect the residuals used to construct the preconditioning matrix?</div></div></div><div style="position:relative;zoom:1"></div><div></div><div style="margin: 0;"><br></div><p>At 2026-01-09 03:00:52, "Mark Adams" <mfadams@lbl.gov> wrote:</p><blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div dir="ltr">You don't want to scale the matrix manually. <span style="color:rgb(206,145,120);font-family:Consolas,"Courier New",monospace;font-size:14px;background-color:rgb(30,30,30)">-pc_jacobi_type rowl1 <br></span>do what you want. And Jacobi is a more common choice.<br><br>Mark</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, Jan 8, 2026 at 1:02 PM 陈培群 <<a href="mailto:logic_imagination@163.com">logic_imagination@163.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="line-height:1.7;color:rgb(0,0,0);font-size:14px;font-family:Arial"><div style="margin:0px"><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(180,180,180)">$</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(180,180,180)">\</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(86,156,214)">quad</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(180,180,180)">$</span><span style="background-color:rgb(30,30,30);color:rgb(218,218,218);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap"> Hello, I use </span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(180,180,180)">`</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(206,145,120)">SNESComputeJacobianDefault</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(180,180,180)">`</span><span style="background-color:rgb(30,30,30);color:rgb(218,218,218);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap"> to build a preconditioning matrix for JFNK and use </span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(180,180,180)">`</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(206,145,120)">MatGetRowSumAbs</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(180,180,180)">`</span><span style="background-color:rgb(30,30,30);color:rgb(218,218,218);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap"> to obtain the vector for scaling. When I modify the preconditioning matrix in formJacobian</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(180,180,180)">[</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(206,145,120)">`SNESSetJacobian`</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(180,180,180)">]</span><span style="background-color:rgb(30,30,30);color:rgb(218,218,218);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap"> and modify rhs and the solution variables in preSolve</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(180,180,180)">[</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(206,145,120)">`KSPSetPreSolve`</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(180,180,180)">]</span><span style="background-color:rgb(30,30,30);color:rgb(218,218,218);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap"> and postSolve</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(180,180,180)">[</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(206,145,120)">`KSPSetPostSolve`</span><span style="background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap;color:rgb(180,180,180)">]</span><span style="background-color:rgb(30,30,30);color:rgb(218,218,218);font-family:Consolas,"Courier New",monospace;white-space:pre-wrap"> as scaling, I encounter the following questions.</span><div style="color:rgb(218,218,218);background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span style="color:rgb(103,150,230)">1.</span><span style="color:rgb(218,218,218)"> If I need to scale the solution variables, do I need to call </span><span style="color:rgb(180,180,180)">`</span><span style="color:rgb(206,145,120)">SNESGetSolutionUpdate</span><span style="color:rgb(180,180,180)">`</span><span style="color:rgb(218,218,218)"> to scale the increment vector instead of the solution vector in </span><span style="color:rgb(180,180,180)">`</span><span style="color:rgb(206,145,120)">postSolve(KSP /*ksp*/, Vec rhs, Vec x, void * ctx)</span><span style="color:rgb(180,180,180)">`</span><span style="color:rgb(218,218,218)">?</span></div><div><span style="color:rgb(103,150,230)">2.</span><span style="color:rgb(218,218,218)"> Whether this can achieve the same scaling effect as </span><span style="color:rgb(180,180,180)">`</span><span style="color:rgb(206,145,120)">-pc_jacobi_type rowl1</span><span style="color:rgb(180,180,180)">`</span><span style="color:rgb(218,218,218)">, so that the built-in preconditioner scheme of petsc can be applied on the basis of the above modified linear system? Or whether this will affect the residual used to construct the matrix through the finite difference and then lead to the wrong scaling effect?</span></div></div><br></div></div></blockquote></div>
</blockquote></div></blockquote></div>