Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7056 Discussions

## solve the Poisson equation with d_Helmholtz_2D

Beginner
1,959 Views

Hi~

My problem looks like u/x+u/y=-F(x,y). Boundary conditions are u/x=0|(x=0,x=Lx) and u/y=0|(y=0,y=Ly). This is the Poisson equation. Because the Poisson problem is a special case of the Helmholtz problem. I want to use d_Helmholtz_2D(f, bd_ax, bd_bx, bd_ay, bd_by, bd_az, bd_bz, &xhandle, &yhandle, ipar, dpar, &stat)to solve the eqution with =0. Poisson Library uses the standard five-point finite difference approximation on this mesh to compute the approximation to the solution .It asks for f ,but I have no ideas on setting f on the boundary . In my opinion it is poisson eqution with the Neumann boundary condition,so should I set f=0 in the boundary?Or any advise?Thank you!!

21 Replies
Employee
1,770 Views

Hi,

Poisson library calculates approximate solution of both internal point and boundary point so you need to set correspondent values of rhs for boundary. If you know values of rhs (right-hand-side of initial differential equation) only inside domain you could continue it on boundary.

With best regards,

Beginner
1,770 Views
Thank you very much for your help.You said thatif you know values of rhs (right-hand-side of initial differential equation) only inside domain you could continue it on boundary.Could you give me more details about how to continue it on boundary?In my opinion I should give the valuesof rhs on the boudary the value of the inside point next to the boudary to match theNeumann boundary condition.Is the opinion is right?
Employee
1,770 Views
Hi,
It's strongly depends on problem you want to solve. Are you want to solve differential problem and you have value of differential rhs in all points inside domain? Or you know value of rhs in several points inside domain (grid points)?
With best regards,
Beginner
1,770 Views

In my poisson equation ,rhsare obtained by M(x,y)/x+N(x,y)/y ,and M(x,y) and N(x,y) are known in all points.I will use FDM to deal with M(x,y)/x+N(x,y)/y....Sorhs on the boundary arerelated to the Nboudary condition ? I don't know how to figure it out...Help me please~

Employee
1,770 Views
Hi,
Just set rhs on boundary poinst as it set in all domain, for example on boundary x = o set rhs = (M(x,y)/x)|(x=0)+N(0,y)/y
With best regards,
Beginner
1,770 Views
Dear Alexander,
This question is quite equal one I asked you before. My problem deals with second derivation in rhs and it is impossible to extend F to boundaries to be sure not to break physical meaning of the problem.
Do you have plans to change implementation ofd_Helmholtz_2D to suit its documentation or change documentation to suit real implementation? First option is much more preferred by me.
Thank you!
Regards,
Ilya
Employee
1,770 Views
Ilia,
With best regards,
Beginner
1,770 Views
Thank you very much !!I've got it~
Beginner
1,770 Views
Another question...
I 've used matlab to solve the 3D poisson equation with N BCs in my programme(poisson equation is only a part of it),but it failed,and matlab was always out of memorybecause of its limitations.SoIwant to solve 3D poisson equation with MKL d_Helmholtz_3D .Matlab is major ,and I use C++ to connect matlab with MKL d_Helmholtz_3D.
The question is if it is easy to do ?Any examples?And what about the memory?3D may be 500*250*250...So any advises?
Employee
1,770 Views
Hi,
Could you provide some information about matlab out of memory. Is it happened during call to helmholtz routine (if yes on what routine) or during allocating memory for helmholtz solver (solution vector + rhs) or sometimes else?
With best regards,
Beginner
1,770 Views
Hi
You may misuderstand me...We use [LA,UA]=luinc(A,1e-6) and p=bicgstab(A,b,MinErr,1000,LA,UA)in matlab to solve3D poisson equtionand itturns out to be out of memory becauseof luinc.
My question is when I use matlab with C++,MKL to solve 3D poisson equation with MKL,is the memory a problem?That is when I do it ,how much memory the computer needs to solve 3D(maybe 500*250*250) poisson equations~Thank you
Employee
1,770 Views

Oh,

Ive understood you. The largest arrays in poisson library are solution and rhs vectors. Their size is a size of the problem so in your case it is equal 500*250*250 = 30*10^6 elements. In double precision you need to have about a half of Gb to allocate them. Size of internal arrays is significantly smaller so I think that for your problem it is enough to have 1Gb of RAM.

With best regards,
Beginner
1,770 Views
Thank you very much
Employee
1,770 Views
You are welcome! Feel free to ask any questions about poison library or other parts of MKL
With best regards,
Beginner
1,770 Views

Hi
If fact ,I have same trouble in setting ispar(40 through 59)
ispar(40 through 59)====Contain the first twenty elements of the ipar array of the first Trigonometric Transform that the Solver uses. (For details, see Common Parameters in the "Trigonometric Transform Routines" section.)

ipar[0] of the first Trigonometric TransformContains the size of the problem to solve is said to be the size of the problem...It confuses me?What is the size ?In 2D problem ,when using TTF ,the size is(nx+1)*(ny+1)(nx and ny are the number of mesh intervals)?Inotice that ipar[0] should be an eveninteger?Any ideas?
Thank you

Employee
1,770 Views
Hi,
It's not recommended to change this parameters manually. Just call init and commit steps of poisson library with your input data like ax,bx,nx and etc and elements ipar[40-59] will set automatically.
With best regards,
Beginner
1,770 Views
Hi
Thank you ~
I got you meanings.

d_init_Helmholtz_2D( &ax,& bx, &ay, &by,& nx, &ny, BCtype,& q, ipar, dpar, & stat);

d_commit_Helmholtz_2D(f, bd_ax, bd_bx, bd_ay, bd_by, &xhandle, ipar, dpar,&stat);

d_Helmholtz_2D( f, bd_ax, bd_bx, bd_ay, bd_by, &xhandle, ipar, dpar,&stat);

free_Helmholtz_2D( &xhandle,ipar, &stat);

So~What about dpar ipar?I also have difficuties in setting xhandle~
If it is no need to set the parameters related with TT routine ?

Beginner
1,770 Views
That is to say when I call init and commit steps of poisson library with input data like &ax,& bx, &ay, &by,& nx, &ny, BCtype,& q,f, bd_ax, bd_bx, bd_ay, bd_by without ipar ,dpar, stat,and xhandle...

d_init_Helmholtz_2D( &ax,& bx, &ay, &by,& nx, &ny, BCtype,& q, ipar, dpar, & stat);

d_commit_Helmholtz_2D(f, bd_ax, bd_bx, bd_ay, bd_by, &xhandle, ipar, dpar,&stat);

I can get ipar ,dpar, stat,and xhandle (which are output patarmaters)automatically??
Employee
1,770 Views
HI,
in your example you need to setax,bx, ay, by,nx, ny, BCType, bd_ax,bd_bx, bd_ay, bd_by, f, u and stat and allocate ipar, dpar arrays and handle - pointer to internal structure (please look example named d_helmholtz_2D_c.c in example/pdepoissonc folder). After init and/or commit step you could change some ipar/dpar parameters (please look manual to find it exactly) which was setting automatically but it is not recommended.
With best regards,
Beginner
1,619 Views

Hi~Thank you so much~I get it.
I tried the example in the folder...It seems that there are some problems with linkers. I use Intel MKL 10.3.xand Microsoft* Visual Studio 2008.And Select Build Components I choose sequential...But it turns out

MKLtest.exe: E:\Vc++\MKLtest\Debug\MKLtest.exe

MKLtest.exe: C:\WINDOWS\system32\ntdll.dll

MKLtest.exe: C:\WINDOWS\system32\kernel32.dll

MKLtest.exe: C:\Program Files\Intel\ComposerXE-2011\redist\ia32\mkl\mkl_sequential.dll

MKLtest.exe: C:\WINDOWS\system32\msvcrt.dll

MKLtest.exe: C:\Program Files\Intel\ComposerXE-2011\redist\ia32\mkl\mkl_core.dll

MKLtest.exe: C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597c3456\msvcr90d.dll

MKLtest.exe: C:\Program Files\Intel\ComposerXE-2011\redist\ia32\mkl\mkl_p4m.dll

MKLtest.exe: C:\Program Files\Intel\ComposerXE-2011\redist\ia32\mkl\libimalloc.dll

MKLtest.exe: C:\Program Files\Intel\ComposerXE-2011\redist\ia32\mkl\libimalloc.dll
It is Chinese...Maybe...Any adviser?What is the problem?Thank you