Solving partial differential equations using C#

别说谁变了你拦得住时间么 提交于 2019-12-07 05:04:36

问题


I am working on a project (C# and .NET Framework) which requires me to solve some partial differential equations. Are there any specific libraries based on .NET Framework that I could see and make my work simpler?

I have worked with MATLAb and solving partial differential equations is very straightforward there. How can I solve this problem?


回答1:


You could solve the problem in MATLAB and use the MATLAB compiler + Builder NE toolbox to create a .NET assembly which links to the rest of your app.




回答2:


Depends on which PDEs you want to solve and how you want to approach them.

Every approach that I know of will require linear algebra. You'll want to find a good matrix package for .NET, the best you can find, one that can handle sparse matricies efficiently.

Linear elliptic (steady state diffusion), parabolic (transient diffusion), and hyperbolic (F= MA dynamic) PDEs require slightly different approaches.

All three of these PDEs can use classical finite difference, finite element (weighted residual), or boundary element (Green's functions) to create the system matrix you'd like to solve. General non-linear PDEs are probably best attacked using a finite element/weighted residual technique.

But the parabolic and hyperbolic PDFs will turn into coupled sets of ODEs once you discretize them. You have to do transient integration to repeatedly solve the time evolution. Parabolic ODEs are first order in time; hyperbolic ODEs are second order in time.

I'm learning about CUDA and NVIDIA. You might want to look into CUDA bindings for your language.

All these are big topics unto themselves. Please Google for some sources, because it's not possible to give more than a cursory overview here.

UPDATE: I recently became aware of the Microsoft Solver Foundation. I haven't looked into it myself, but perhaps it'd be helpful to C# developers in solving this problem.




回答3:


Another suggestion is AlgLib . I like this because unlike comprehensive libraries where you have to find what you need, AlgLib has all the algoritms separated, and often offered in multiple languages (including C#, in most/all cases). Regarding calculus AlgLib covers:

        Euler's method
        Runge-Kutta method
        Runge-Kutta method for a system of ODEs
        Bulirsch-Stoer method for a system of ODEs

A word of caution, however... upon checking these algorithm at AlgLib, I noted that they were not supported anymore (by AlgLib), because their licenses may be imcompatible with AlgLib's license (which is GPL, I believe).




回答4:


Check out http://www.mathdotnet.com/About.aspx, it may have what you need. However I suspect you should get the best library for you application requirements, and then interface it to your .net application..

You'll probably find that with things like this (except where you using to learn either the language or the maths) there are a number of pre canned libraries.



来源:https://stackoverflow.com/questions/1452255/solving-partial-differential-equations-using-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!