# [petsc-users] Preconditioner for stokes flow with mixed boundary conditions.

Matthew Knepley knepley at gmail.com
Mon Apr 19 14:13:34 CDT 2021

On Mon, Apr 19, 2021 at 2:55 PM Abhinav Singh <abhinavrajendra at gmail.com>
wrote:

> The only reference that I know of which solves these equations is :
>
>

These people are using a direct method.

> There is coordinate free form in the appendix. They have been solved using
> the UMFPACK Solver on staggered grids. I am trying a new approach (pressure
> correction with auxiliary potential). In 2 dimensions, the approach worked
> well with GMRES. In 3d, GMRES again works but with Dirichlet
> boundary conditions.
>

GMRES with what preconditioner? It helps when you discuss solvers if you
send the output of -ksp_view.

Thanks,

Matt

> On Mon, 19 Apr 2021 at 20:45, Matthew Knepley <knepley at gmail.com> wrote:
>
>> On Mon, Apr 19, 2021 at 2:38 PM Abhinav Singh <abhinavrajendra at gmail.com>
>> wrote:
>>
>>> Hello,
>>>
>>> The Stokes flow equations are a 3d version of the equations attached
>>> (Stokes-Leslie Flow). Only variables/unknowns are v and
>>> u_xy=0.5(Dx(vy)+Dy(vx).
>>>
>>
>> This is not what I have referred to as Stokes flow (Google gave me no
>> results for Stokes-Leslie flow). The Stokes operator is elliptic, but I
>> have no idea if
>> what you have written is. It has fourth order derivatives in it, with
>> mixed nonlinear terms, so nothing is clear to me. Is there a
>> coordinate-independent form?
>> From what I see in the image, I have no idea what solvers might work. Do
>> you have any reference where people have solved this before?
>>
>>   Thanks,
>>
>>      Matt
>>
>>
>>> I am trying to solve them iteratively by correcting the pressure to
>>> solve the first iteration (periodic in X and Z. V=0 at Y=0 and
>>> Dx(vy)+Dy(vx)=g(x) at Y=10).
>>>
>>> I think the equations might be singular but I am not sure as in my
>>> experience, the problem is well posed if the solution is known at certain
>>> boundaries.
>>>
>>>
>>> [image: by default 2021-04-19 at 20.28.28.png]
>>>
>>> On Mon, 19 Apr 2021 at 15:59, Matthew Knepley <knepley at gmail.com> wrote:
>>>
>>>> On Mon, Apr 19, 2021 at 9:37 AM Abhinav Singh <
>>>> abhinavrajendra at gmail.com> wrote:
>>>>
>>>>> What does this mean? Stokes means using an incompressibility
>>>>>> constraint, for which we often introduce a pressure.
>>>>>
>>>>> Yes, what I mean is solving the momentum block, say with known
>>>>> pressure. viscosity is constant however, the momentum equation has both
>>>>>
>>>>
>>>> That does not make any sense to me. Can you write the equation?
>>>>
>>>>   Thanks,
>>>>
>>>>      Matt
>>>>
>>>>
>>>>> You should use a good Laplacian preconditioner, like -pc_type gamg or
>>>>>> -pc_type ml.
>>>>>
>>>>> I tried gamg and it seems to diverge as the solution is NaN. The KSP
>>>>> residual message is " 0 KSP Residual norm 1.131782747169e+01  ".
>>>>> When using -pc_type ml, I get Aggregate Warning and then some faulty
>>>>> address which stops the code.
>>>>>
>>>>>
>>>>>
>>>>> On Mon, 19 Apr 2021 at 12:31, Matthew Knepley <knepley at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> On Mon, Apr 19, 2021 at 6:18 AM Abhinav Singh <
>>>>>> abhinavrajendra at gmail.com> wrote:
>>>>>>
>>>>>>> Hello all,
>>>>>>>
>>>>>>> I am trying to solve for incompressible stokes flow on a particle
>>>>>>> based discretization. I use a pressure correction technique along with
>>>>>>> Particle strength exchange like operators.
>>>>>>>
>>>>>>> I call Petsc to solve the Stokes Equation without the pressure term.
>>>>>>>
>>>>>>
>>>>>> What does this mean? Stokes means using an incompressibility
>>>>>> constraint, for which we often introduce a pressure.
>>>>>>
>>>>>> Do you mean you are solving only the momentum block? If so, do you
>>>>>> have a constant viscosity? If so, then this is just the Laplace equation.
>>>>>> You should use a good Laplacian preconditioner, like -pc_type gamg or
>>>>>> -pc_type ml.
>>>>>>
>>>>>>   Thanks
>>>>>>
>>>>>>      Matt
>>>>>>
>>>>>>
>>>>>>> GMRES usually works great but with dirichlet boundary conditions.
>>>>>>> When I use a mixed boundary condition in Y, (dirichlet on bottom and
>>>>>>> Neumann on the top) with periodicity in X,Z. GMRES fails converge when the
>>>>>>> size of matrix increases. For smaller size (upto 27*27*5), only GMRES works
>>>>>>> and that too only with the option 'pc_type none'. I was unable to find any
>>>>>>> preconditioner which worked. Eventually, it also fails for bigger size.
>>>>>>> UMFPACK works but LU decomposition fails after a certain size and is very
>>>>>>> slow.
>>>>>>>
>>>>>>> It would be great if you could suggest a way or a preconditioner
>>>>>>> which suits this problem.
>>>>>>>
>>>>>>> Kind regards,
>>>>>>> Abhinav
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> What most experimenters take for granted before they begin their
>>>>>> experiments is infinitely more interesting than any results to which their
>>>>>> -- Norbert Wiener
>>>>>>
>>>>>> https://www.cse.buffalo.edu/~knepley/
>>>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>>>
>>>>>
>>>>
>>>> --
>>>> What most experimenters take for granted before they begin their
>>>> experiments is infinitely more interesting than any results to which their
>>>> -- Norbert Wiener
>>>>
>>>> https://www.cse.buffalo.edu/~knepley/
>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>
>>>
>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> -- Norbert Wiener
>>
>> https://www.cse.buffalo.edu/~knepley/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>

--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210419/c8e4c9bc/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: by default 2021-04-19 at 20.28.28.png
Type: image/png
Size: 139022 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210419/c8e4c9bc/attachment-0001.png>