Fixing values in a poisson eqn

Matthew Knepley knepley at gmail.com
Wed Aug 1 10:28:41 CDT 2007


On 8/1/07, Ben Tay <zonexo at gmail.com> wrote:
> Hi,
>
> I am trying to solve a pressure poisson eqn resulting from the NS eqn.
> How can I fixed the pressure at some nodes while solving the poisson eqn?
>
> I tried to make the coefficient of the diagonal location of the node
> very big e.g. 1e100. I also use

When you form the Jacobian, the row associated with the unknown should
be the identity (not a big number as above).

> call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr)

Should not matter.

> and insert the original values as initial solution:
>
> do i=1,blk(1)%size_x
>
>             do j=1,blk(1)%size_y
>
>                 call VecSetValue(xx,k,blk(1)%p(i,j),INSERT_VALUES,ierr)
>
>                 k=k+1
>
>             end do
>
>         end do

You want the boundary value on the rhs, not the solution.

>  in my code. However, after solving the eqn, the value I got is 1e-16 or
> 0. So what have I done wrong?

I would look at an example, like SNES ex5.

  Matt

> Thanks
>
>
>


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




More information about the petsc-users mailing list