[petsc-users] solving stokes-like equation in 3D staggered grid in irregular domain with petscsection

Jed Brown jedbrown at mcs.anl.gov
Tue Nov 12 15:55:28 CST 2013


Bishesh Khanal <bisheshkh at gmail.com> writes:

> Dear all,
> I have an implementation of stokes flow equation in cuboid using a
> staggered grid with DMDA. Now I want to solve a problem in a slightly
> different (but more difficult) situation where I think PetscSection might
> be useful although I have not used PetscSection that much and I understand
> that some of its aspects is still under development in petsc.
> I'm ok to work with the dev version of petsc if what I want to do using
> petscsection is plausible.
>
> Here is my problem description:
>
> I have a 3D binary image that partitions a cuboid into domain A and domain
> B by tagging each cell as 0 or 1. The shape of A and therefore B can be
> fairly arbitrary. I want to solve the following sets of equations:
>
> A. In A:
> div(mu(grad(u))) - grad(p) = f1   , where f1 depends on the position x.

Is mu constant or variable?  Should this be mu (grad(u) + grad(u)^T)/2 ?

> div(u)                                   = f2   , where f2 is non-zero and
> depends on the position x.

Does it really only depend on position or does it depend on state
variables (u,p)?

> ---------------------------------------
> B. In B:
> div(mu(grad(u)) = f3,    where f3 depends on the position x.

What physics does this represent?

> -----------------------------------------
> u = constant on the cuboid boundaries. (Dirichlet boundaries)
> p = constant on domain B (if needed as boundary condition for domain A)
> -------------------------------------------
>
> Now, I was thinking of creating a single matrix M that contains the
> operators for both A and B domains, and solve a linear system MX = R, where
> X and R are the solution and Rhs vectors of roughly the sizes 4*nA + 3*nB
> where,   nA => no. of cells in A, nB => no. of cells in B.
>
> Some questions:
>
> 1. Would PetscSection be useful in this case due to the arbitrary shape of
> domain A and because of different number of dofs in domain A and domain B ?
> Is there a simple example that uses petscsection for the staggered grid
> case ? I would like to be able to implement staggered grid without the use
> of ghost/fictitious cells.

Just put degrees of freedom on faces and cell centers when creating the
section.

> 2. Is it a good idea to create a single matrix corresponding to both the
> domains A and B (particularly in view of the difficulty it might bring in
> solving with some preconditioners using schur fieldsplit) ?

I would start with a single matrix.  Use MatSetValuesLocal() in assembly
so that you can easily switch to a different format.

> 3. I'm trying to put both domains in a single matrix to avoid the
> difficulty I would have if I want to consider only the domain A. In this
> case I would need a traction free boundary condition on the irregular
> boundary of domain A, and it seems a bit too challenging for me to
> incorporate it with the staggered grid. If there is an idea to implement
> this and if you think this could be more suitable than the approach in 2
> above, I would like to learn about that too!

Complexity of implementing boundary conditions on staggered grids is one
reason some people turn to other discretization technology, such as
finite elements.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131112/afdae5b6/attachment.pgp>


More information about the petsc-users mailing list