[petsc-users] Suggestions for code with dof >> 1 ?
Christophe Ortiz
christophe.ortiz at ciemat.es
Wed Oct 23 10:23:00 CDT 2013
On Wed, Oct 23, 2013 at 4:52 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> Christophe Ortiz <christophe.ortiz at ciemat.es> writes:
> > I finally found what was wrong. I used -mat_view to check each element of
> > the Jacobian. The structure was ok but there was some unexpected values.
> > Then I checked my code and found a mistake while assigning values to some
> > array (the diagonal block). It was cumulating values during the loop for
> > (row i) {}. Now, at the beginning of the loop I use PetscMemzero(array)
> to
> > reset the array.
> >
> > Now it works much better with 1bee and linesearch bt. It converges
> quickly
> > to large times in few timesteps.
>
> That's reassuring to hear, thanks.
>
> > Nevertheless...I still observe some problem, some oscillations in the
> > solution, but in some extreme cases. It occurs with the following system,
> > when q is very large:
> >
> > u_t - alpha u_xx + (k.u.v - q.w) = 0
> > v_t - alpha v_xx + (k.u.v - q.w) = 0
> > w_t - (k.u.v - q.w) = 0
> >
> > I guess the problem becomes stiff.
>
> Does a shorter time step fix the oscillations?
Hi Jed,
Thanks for the prompt reply.
No, it did not in this case. However, I noticed for "smoother" cases that
max timestep matters. I try to fix it to finaltime/100 to avoid too large
timesteps. I also use -ts_adapt_basic_clip 0.1,1.1 to avoid large timesteps.
> Is this with
> -ts_arkimex_type 1bee or something else?
>
It occurs with 1bee, a2 or arkimex 3.
>
> Can you try -ts_arkimex_fully_implicit and add -snes_mf_operator if
> necessary to get SNES to converge?
I tried -ts_arkimex_fully_implicit and it gave a wrong result. As if there
was no diffusion. Seems there is an artefact with fullyimplicit option.
With -snes_mf_operator I got an error message:
[0]PETSC ERROR: No support for this operation for this object type!
[0]PETSC ERROR: Mat type mffd!
> (I'm assuming you have used an IMEX
> formulation here, but perhaps you already use fully implicit?)
>
I put everything under IFunction and IJacobian. This part is not clear to
me actually. I understand that in IMEX methods, the LHS is solved
implicitely and the RHS explicitely. What happens when I use an IMEX method
with no RHS, everything in the LHS ? Is there any explicit stage ?
Actually, I could solve the problem by adding mesh points. Since I start
from steep gaussian distributions with large peak values, maybe there was a
problem with large gradients.
BTW, is it possible to have adaptive mesh in 1D with PETSc ? I am thinking
of steep profiles that evolve and that require a fine mesh at the beginning.
Christophe
>
> > I tried assuming that the reaction is in steady state (w_t=0) and
> modifying
> > the IJacobian accordingly, but it did not work.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131023/5d4b86e0/attachment-0001.html>
More information about the petsc-users
mailing list