简体   繁体   English

使用C#求解偏微分方程

[英]Solving partial differential equations using C#

I am working on a project (C# and .NET Framework) which requires me to solve some partial differential equations. 我正在研究一个项目(C#和.NET Framework),它要求我解决一些偏微分方程。 Are there any specific libraries based on .NET Framework that I could see and make my work simpler? 是否有基于.NET Framework的特定库我可以看到并使我的工作更简单?

I have worked with MATLAb and solving partial differential equations is very straightforward there. 我使用MATLAb并且在那里求解偏微分方程是非常简单的。 How can I solve this problem? 我怎么解决这个问题?

Depends on which PDEs you want to solve and how you want to approach them. 取决于您想要解决的PDE以及您希望如何处理它们。

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. 你会想找到一个很好的.NET矩阵包,你可以找到最好的,可以有效地处理稀疏matricies。

Linear elliptic (steady state diffusion), parabolic (transient diffusion), and hyperbolic (F= MA dynamic) PDEs require slightly different approaches. 线性椭圆(稳态扩散),抛物线(瞬态扩散)和双曲线(F = MA动态)偏微分方法需要稍微不同的方法。

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. 所有这三个PDE都可以使用经典的有限差分,有限元(加权残差)或边界元素(格林函数)来创建您想要解决的系统矩阵。 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. 但抛物线和双曲线PDF将在您离散后转变为耦合的ODE集。 You have to do transient integration to repeatedly solve the time evolution. 你必须做瞬态整合来反复解决时间演变。 Parabolic ODEs are first order in time; 抛物线ODE是时间上的第一顺序; hyperbolic ODEs are second order in time. 双曲线ODE是时间上的二阶。

I'm learning about CUDA and NVIDIA. 我正在学习CUDA和NVIDIA。 You might want to look into CUDA bindings for your language. 您可能希望查看针对您的语言的CUDA绑定。

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. 请Google提供一些消息来源,因为这里不可能提供更多粗略概述。

UPDATE: I recently became aware of the Microsoft Solver Foundation . 更新:我最近了解了Microsoft Solver Foundation I haven't looked into it myself, but perhaps it'd be helpful to C# developers in solving this problem. 我自己没有调查过,但也许它对C#开发人员解决这个问题很有帮助。

Another suggestion is AlgLib . 另一个建议是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). 我喜欢这个,因为不像您需要找到所需内容的综合库,AlgLib将所有算法分开,并且通常以多种语言提供(包括大多数/所有情况下的C#)。 Regarding calculus AlgLib covers: 关于微积分AlgLib涵盖:

        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). 但请注意,在AlgLib上检查这些算法时,我注意到它们不再受支持(由AlgLib提供),因为它们的许可证可能与AlgLib的许可证(我认为是GPL)不兼容。

Check out http://www.mathdotnet.com/About.aspx , it may have what you need. 查看http://www.mathdotnet.com/About.aspx ,它可能有你需要的东西。 However I suspect you should get the best library for you application requirements, and then interface it to your .net application.. 但是我怀疑你应该为你的应用程序需求获得最好的库,然后将它连接到你的.net应用程序..

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. 你可能会发现这样的事情(除了你用来学习语言或数学的地方)之外,还有许多预制的库。

您可以在MATLAB中解决问题,并使用MATLAB编译器 + Builder NE工具箱创建一个.NET程序集,该程序集链接到您应用程序的其余部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM