Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Soumya_B_
Beginner
55 Views

mkl poisson solver with periodic and dirichlet boundary condition

Hello Sir,

 I am trying to solve electrostatic Poisson's equation using Poisson MKL library 'd_Poisson_2D_c.c' but my boundary conditions are periodic (X direction) and fixed in Y direction. How shall i incorporate periodic condition in the X direction ? 

I tried in this way but i donot think it is correct,

for( iy = 0; iy <= ny; iy++){

  bd_ax[iy] = bd_bx[iy];

}

  and  applied BCtype='PPDD' .

I am very new in this field. Please help me.

Thanks

0 Kudos
9 Replies
55 Views

Hi,

Everything is correct. Moreover, you don't need to describe value of boundary condition on x=ax and x=bx - you set them as periodical so bd_ax and bd_bx have not use in computational.

Thanks,

Alex

Soumya_B_
Beginner
55 Views

Dear Alex,

  Thanks for your reply, but i am not getting it. Do you mean that if i impose the condition 'bd_ax[iy] = bd_bx[iy]', the routine doesnot 

at all use this in the computation ? If so, then what kind of value  will it take ? Actually it is not clear to me.

sorry for the inconvinience.

Thanks,

Soumya
 

55 Views

Hi Soumya,

It will use condition like u(i,j) = u(N+i,j) for any i,j. That's mean left edge of square is equal to right one.

Thanks,

Alex

 

Soumya_B_
Beginner
55 Views

I got it..Thanks alot....!!

Soumya_B_
Beginner
55 Views

Hi,

  i have a query. when i am imposing periodic boundary condition do i  need to write both the conditions as shown in the manual.

For periodic in X direction i gave bd_ax(iy) = bd_bx(iy)(for iy = 0:ny)equation.gif

Now do i need to specify the derivative boundary condition also ? if yes how to specify in terms of bd_ax and bd_bx or when i impose bc_type as

'PPDD' it automatically takes care of both the conditions ? Please help.

Thanks,

Soumya

55 Views

Hi 

'PPDD' automatically takes care of both the conditions - correct

Thanks,

Alex

Leonardo_B_
Beginner
55 Views

Hi, I am using the  d_Helmholtz_2D routine to solve the poisson equation with full Neumann boundary conditions (NNNN). I am sure that the output is correct but the warning message ''The problem is degenerate up to rounding errors! ...'' on screen bothers me.  I found in previous forums that one solution is to set ipar(2) equals to zero. I tried it but I didn't work. I realized that the warning message appears after the call of routine d_Helmholtz_2D. If it might help find below an excerpt of the code and the output.

Thanks in advance

%%%%%%%%%%%%%

        do i=1,128
           ipar(i)=0
        enddo

!        print*,ipar(2),' setting warning signal'        
        ! Initializing simple data structures of Poisson Library for 2D Poisson Solver
        call d_init_Helmholtz_2D(0.D0, sizex, 0.D0, sizey, nx, ny, BCtype, q, ipar, dpar, istat)        
        print*,ipar(2),' first warning'
        ipar(2)=0
        if (istat.lt.0) goto 999

        ! Initializing complex data structures of Poisson Library for 2D Poisson Solver
        ! NOTE: Right-hand side f may be altered after the Commit step. If you want
        ! to keep it, you should save it in another memory location!
        call d_commit_Helmholtz_2D(f, bd_ax, bd_bx, bd_ay, bd_by, xhandle, ipar, dpar, istat)
        print*,ipar(2), ' second warning'
        if (istat.lt.0) goto 999

        ! Computing the approximate solution of 2D Poisson problem
        ! NOTE: Boundary data stored in the arrays bd_ax, bd_bx, bd_ay, bd_by
        ! should not be changed between the Commit step and the subsequent call to
        ! the Solver routine! Otherwise the results may be wrong.
        call d_Helmholtz_2D(f, bd_ax, bd_bx, bd_ay, bd_by, xhandle, ipar, dpar, istat)
        print*,ipar(2),' third warning'
        if (istat.lt.0) goto 999

        ! Cleaning the memory used by xhandle
        call free_Helmholtz_2D(xhandle, ipar, istat)
        print*,ipar(2),' fourth warning'
        if (istat.lt.0) goto 999
        ! Now we can use xhandle to solve another 2D Poisson problem

%%%%%%%%%%%%%%%%%%%%%%%%

           1  first warning
           0  second warning
 -------------------------------------------------------------------------------
MKL POISSON LIBRARY WARNING:
The problem is degenerate up to rounding errors! The approximate solution
that provides the minimal Euclidean norm of the solution will be computed...
           0  third warning
           0  fourth warning

55 Views

Hi,

I see that you use Fortran based code to call Helmholtz solver. In such case set ipar(3) to zero instead of ipar(2)

Thanks,

Alex

Leonardo_B_
Beginner
55 Views

Dear

Alex

Thanks for your reply. I did what you suggested and it worked.

Best regards,

Leonardo