<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
Hello,</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<br>
</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
I have the following issue regarding TS and field split. </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<br>
</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
In a TS setting, I have a linear problem with the IJacobian of the IFunction with a block form<o:p> </o:p></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<o:p> </o:p></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
| K<span> <span class="Apple-converted-space"> </span></span>0 |<o:p> </o:p></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
| 0<span> <span class="Apple-converted-space"> </span></span>D |<o:p> </o:p></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<o:p> </o:p></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
Where K is sparse, while D is a diagonal. The sizes of the square matrices K and D are dynamic (varying between time steps). The fact that, K and D are completely decoupled, and D is just a diagonal motivated us to use fieldsplit techniques rather than a monolithic
one. However, this needs to recreate a fieldsplit preconditioner at each time step using the indices of K. To achieve this, I use the<span class="Apple-converted-space"> </span><span style="font-size: 10pt; font-family: Menlo">TSSetPreStep(ts, fun) </span>function
to perform the<span class="Apple-converted-space"> </span><span style="font-size: 10pt; font-family: Menlo">fun(TS ts)</span><span class="Apple-converted-space"> </span>routine which does following<o:p> </o:p></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<o:p> </o:p></p>
<p class="MsoListParagraphCxSpFirst" style="margin: 0cm 0cm 0cm 36pt; font-size: 12pt; font-family: Calibri, sans-serif;text-indent:-18.0pt;mso-list:l0 level1 lfo1">
<span style="mso-list: ignore"><span style="mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman""> <span class="Apple-converted-space"> </span></span></span></span></span>Get
indices of K,<span class="Apple-converted-space"> </span><o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0cm 36pt; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0cm 36pt; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo">PetscInt *idx_k; // size_of_k<o:p> </o:p></span></p>
<p class="MsoListParagraphCxSpMiddle" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0cm 36pt; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0cm 36pt; font-size: 12pt; font-family: Calibri, sans-serif;text-indent:-18.0pt;mso-list:l0 level1 lfo1">
<span style="mso-list: ignore"><span style="mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman""> <span class="Apple-converted-space"> </span></span></span></span></span>Create
an IS corresponding to K (IS is_k) using<span class="Apple-converted-space"> </span><o:p> </o:p><br>
<br>
<o:p> </o:p><br>
<br>
<span> </span><span style="font-size: 11pt; font-family: Menlo">ISCreatGeneral(mpiComm, size_of_k, idx_k, PETSC_COPY_VALUES, &is_k);<span class="Apple-converted-space"> </span><o:p> </o:p></span><br>
<br>
<o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0cm 36pt; font-size: 12pt; font-family: Calibri, sans-serif;text-indent:-18.0pt;mso-list:l0 level1 lfo1">
<span style="mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><span style="mso-list:Ignore">3.<span style="font:7.0pt "Times New Roman""> <span class="Apple-converted-space"> </span></span></span></span>Then set a fieldsplit preconditioner PC
pc using is_k through<span class="Apple-converted-space"> </span><o:p> </o:p><br>
<br>
<o:p> </o:p><br>
<br>
<span style="font-size: 11pt; font-family: Menlo">PCFieldSplitSetIS(pc, NULL, is_k);<o:p> </o:p></span><br>
<br>
<span> </span><o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0cm 36pt; font-size: 12pt; font-family: Calibri, sans-serif;text-indent:-18.0pt;mso-list:l0 level1 lfo1">
<span style="mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><span style="mso-list:Ignore">4.<span style="font:7.0pt "Times New Roman""> <span class="Apple-converted-space"> </span></span></span></span>Finally the is_k is properly destroyed
through<span class="Apple-converted-space"> </span><o:p> </o:p><br>
<br>
<o:p> </o:p></p>
<p class="MsoListParagraphCxSpLast" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0cm 36pt; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo">ISDestroy(&is_lo);<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<o:p> </o:p></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
With the above setup, I have also used the following runtime options<span class="Apple-converted-space"> </span><o:p> </o:p></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<o:p> </o:p></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-ts_monitor<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-ts_exact_final_time stepover<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-ts_dt 0.1<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-ts_max_time 1<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-ts_adapt_type none<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;"><o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-ksp_type gmres<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-pc_type fieldsplit<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-pc_fieldsplit_diag_use_amat<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-pc_fieldsplit_type additive<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-fieldsplit_0_ksp_type preonly<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-fieldsplit_0_pc_type lu<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-fieldsplit_0_pc_factor_mat_solver_type mumps<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-fieldsplit_1_ksp_type preonly<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-fieldsplit_1_pc_type jacobi<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;"><o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-snes_atol 1e-8<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-snes_rtol 1e-12<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-ksp_monitor<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-snes_monitor<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;">-snes_lag_jacobian 1<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: Menlo; color: black;"><o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="color: black;">Result: with the setup described above and the options, I expect to get ksp convergence in a single step (at every time step), however, what I am getting in actuality is that the fieldsplit works as expected only for the first timestep,
after that it either take too many ksp steps to converge or diverge completely. I have a suspicion that, the way the fieldsplit set up at each time using the TSSetPreStep() somehow adds new split over previous splits. For this, I have also tried using TSSetPostStep()
function to reset both the ksp and pc as follows<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="color: black;"><o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="color: black;">KSPRest(ksp);<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="color: black;">PCReset(pc);<o:p> </o:p></span></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm; font-size: medium; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<span style="color: black;"><o:p> </o:p></span></p>
<span style="font-size: 12pt; font-family: Calibri, sans-serif; color: black;">But these don’t help either.<span class="Apple-converted-space"> </span><span> </span><span> </span></span><span style="caret-color: rgb(0, 0, 0); font-family: -webkit-standard; font-size: medium; color: rgb(0, 0, 0); display: inline !important;"></span><br>
</div>
</body>
</html>