<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 15, 2013 at 2:53 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br>






<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>Christophe Ortiz <<a href="mailto:christophe.ortiz@ciemat.es" target="_blank">christophe.ortiz@ciemat.es</a>> writes:<br>







<br>
> I have a doubt...<br>
> Let's imagine I have a system of 2 diffusion equations (dof=2) with one<br>
> coupling, both with Dirichlet boundary conditions:<br>
><br>
> u_t - D u_xx = -k*u*v        u(x=0,t)=u(x=L,t)=0<br>
> v_t - D v_xx = -k*u*v         v(x=0,t)=v(x=L,t)=0<br>
><br>
> If I write everything under IFunction, then the IJacobian is:<br>
><br>
>        1        0          |<br>
>        0        1          |<br>
><br>
> -D/dx^2   0           | a+2D/dx^2+kv       +ku  | -D/dx^2     0<br>
>     0        -D/dx^2  |         +kv                  +ku  |      0<br>
> -D/dx^2<br>
><br>
><br>
> The first block on top represents Dirichlet boundary conditions. The three<br>
> other blocks are for interior nodes.<br>
><br>
> My question is on how to set dfill matrix. For boundary conditions, the<br>
> diagonal block does not have the same pattern as the one for interior node.<br>
> We see that for node i=0, components are just coupled with themselves while<br>
> for the interior diagonal block, they are coupled one with each other.<br>
> Then, how to set dfill ? Should it be<br>
><br>
> {1,   0,<br>
>  0,    1 }<br>
><br>
> or<br>
><br>
> { 1,   1,<br>
>   1,    1}   ?<br>
<br>
</div>You have to preallocate for the max number of entries in each kind of<br>
block.  The slight bit of extra memory for the boundary conditions will<br>
be squeezed out and not affect performance.<br></blockquote><div><br></div><div>Thanks. Ok, so I guess that I should use {1, 1, 1, 1} to preallocate for the max number of entries.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">







<div><br>
> BTW, does DMDASetBlockFills help during solving or is it just for managing<br>
> memory ?<br>
<br>
</div>Allocated nonzeros that have never been "set" are squeezed out in<br>
assembly, so they only affect memory.  Allocated entries that are<br>
explicitly set to 0.0 are not squeezed out, though there is a Mat option<br>
to do that.<br></blockquote><div><br></div><div>I see.</div><div><br></div><div>Before I go on implementing all the coupling between all the dof, I am doing some tests with the system described above and I see some strange behavior...</div>





<div>To do some tests, as initial conditions I set two gaussian distributions for u and v. When the peak value of the gaussians is in the order of unity, no problem, ARKIMEX as well as ROSW work fine. However, when I use peak values in the order of 1e15-1e20 (which is of interest for me), then troubles arise. I see it takes much more time to do one timestep for ARKIMEX. This, even when I switch off the coupling and there is only diffusion. It takes too long.<br>


</div>

<div>I tried KSPCG and KSPGMRES and PCNONE/PCILU.</div><div><br></div><div>- is it due to some problem with ARKIMEX and large values ?</div><div><br></div><div>- How do you use ts_adapt_basic_clip in the run command to decrease the fastest increase of timestep ? I would like to set 1.5 for the fastest increase instead of 10, which is the default. I tried but PETSc complains saying:</div>



<div><br></div><div><div>[0]PETSC ERROR: Argument out of range!</div><div>[0]PETSC ERROR: Must give exactly two values to -ts_adapt_basic_clip!</div></div><div><br></div><div>- ARKIMEX seems to work better if I decrease the number of nodes, ie if I increase the dx.</div>



<div><br></div><div>- I found out with ts_view that the ARKIMEX type is always ARKIMEX3, even when I use </div><div><br></div><div>   ierr = TSARKIMEXSetType(ts,TSARKIMEX1BEE);<br></div><div><br></div><div>Is it normal ?</div>

<div><br></div><div>- With TSROSW, much better. Any idea why ?</div><div><br></div><div>- Do you recommend a particular KSP/PC for this type of problem ?</div><div><br></div><div><br></div>

<div>Christophe</div><div> </div></div><br></div></div>