<div dir="ltr"><div dir="ltr"><div dir="ltr">Thanks for all the reply.<div>The model I simulated is a thermal model that contains multiple physical fields(eg. temperature, pressure, velocity). <span style="white-space:pre-wrap">In PDEs, these variables are preceded by some physical parameters, which in turn are functions of these variables(eg. d</span><span style="white-space:pre-wrap">ensity is a function of pressure and temperature.</span><span style="white-space:pre-wrap">). </span><span style="white-space:pre-wrap">Due to the complexity of these physical parameter functions, we cannot explicitly construct Jacobian matrices for this problem. So I use -snes_mf_operator.</span></div><div><span style="white-space:pre-wrap"><br></span></div><div><p style="margin:0px;white-space:pre-wrap">My preconditioner is to treat these physical parameters as constants. At the beginning of each nonlinear step(SNES), the Jacobian matrix is updated with the result of the previous nonlinear step output(the physical parameters are updated). </p><p style="margin:0px;white-space:pre-wrap"><br></p><p style="margin:0px;white-space:pre-wrap">After setting a large KSP restart step, about 60 KSP can converge(ksp_rtol = 1.e-5).</p><p style="margin:0px;white-space:pre-wrap"><br></p><p style="margin:0px;white-space:pre-wrap">I have a feeling that my initial values are too large to cause this phenomenon.</p><p style="margin:0px;white-space:pre-wrap"><br></p><p style="margin:0px;white-space:pre-wrap">Snes/ex19 is actually a lot like my example, setting up: -da_grid_x 200 -da_grid_y 200 -snes_mf <br></p><p style="margin:0px;white-space:pre-wrap">There will also be a residual rise in step 1290 of KSP<br></p><p style="margin:0px;white-space:pre-wrap">But not all examples will produce this phenomenon.<br></p><p style="margin:0px;white-space:pre-wrap"><br></p><p style="margin:0px;white-space:pre-wrap">Thanks,
Yingjie</p></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> 于2019年3月21日周四 上午1:18写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On Mar 20, 2019, at 5:52 AM, Yingjie Wu via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
> <br>
> Dear PETSc developers:<br>
> Hi,<br>
> Recently, I used PETSc to solve a non-linear PDEs for thermodynamic problems. In the process of solving, I found the following two phenomena, hoping to get some help and suggestions. <br>
> <br>
> 1. Because my problem involves a lot of physical parameters, it needs to call a series of functions, and can not analytically construct Jacobian matrix, so I use - snes_mf_operator to solve it, and give an approximate Jacobian matrix as a preconditioner. Because of the large dimension of the problem and the magnitude difference of the physical variables involved, it is found that the linear step residuals will increase at each restart (default 30th linear step) . This problem can be solved by setting a large number of restart steps. I would like to ask the reasons for this phenomenon? What knowledge or articles should I learn if I want to find out this problem? <br>
<br>
I've seen this behavior. I think in your case it is likely the -snes_mf_operator is not really producing an "accurate enough" Jacobian-Vector product (and the "solution" being generated by GMRES may be garbage). Run with -ksp_monitor_true_residual<br>
<br>
If your residual function has if () statements in it or other very sharp changes (discontinuities) then it may not even have a true Jacobian at the locations it is being evaluated at. In the sense that the "Jacobian" you are applying via finite differences is not a linear operator and hence GMRES will fail on it.<br>
<br>
What are you using for a preconditioner? And roughly how many KSP iterations are being used.<br>
<br>
Barry<br>
<br>
> <br>
> <br>
> 2. In my problem model, there are many physical fields (variables are realized by finite difference method), and the magnitude of variables varies greatly. Is there any Scaling interface or function in Petsc? <br>
> <br>
> Thanks,<br>
> Yingjie<br>
<br>
</blockquote></div>