从头开始实施科学模拟方法的最佳实践

发布于 2024-09-24 07:43:02 字数 1431 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

风流物 2024-10-01 07:43:02

这是一个阅读清单。不确定它对您来说是否太基础:

编写科学软件:基本“学习 C++ 编程”或其他内容的良好后续内容。

C++ 和 MPI 中的并行科学计算:如果您不打算并行化您的应用程序,那么您应该这样做。

工程和科学 C++:一本很好的、针对特定领域的 C++ 编程介绍。语言细节有点过时,但整体方法并没有过时。

我建议您通读诸如“我应该如何设计大型 C++ 程序?”等问题的 SO 答案。有关其他可能感兴趣的书籍的建议。

至于最佳实践,这里有一些建议。再说一遍,我不确定您的出发点,因此其中一些内容可能太基础了:

  • 正如我上面所写,您应该从一开始就计划开发一个并行程序。如果您不喜欢集群上的消息传递,至少考虑多核桌面的共享内存编程。 OpenMP 值得研究。
  • 让自己熟悉现有的工作。 BOOST 库可能是必不可少的。虽然我对您自行开发的意图表示赞赏,但不要忽视现有的完善的数值库,例如 BLAS 和 LAPACK,您可以在 Netlib。根据您的开发平台和工具集,您可能会发现它们已经安装。
  • 如果您有科学背景,您可能想提高软件工程方面的知识和技能。例如:源代码控制;测试;代码分析和优化;深入了解您的编译器可以做什么。根据我的经验,许多计算科学家在所有这些方面的背景都很薄弱。
  • 您应该计划在设计和测试程序上花费(大约)与实际编码一样多的时间。即使是自己工作,在开始编码之前制定一个良好的行动计划也很重要。没有理由一开始就必须把每一个细节都完成,但永远不要在没有地图的情况下进入领土。
  • 您对想要模拟的物理世界的各个方面保持沉默。在各种物理模拟中有很多现有技术,如果您更具体一点,那么也许能够提供一些更具体的建议。

Here's something of a reading list. Not sure if it's too basic for you:

Writing Scientific Software: a good follow-on to a basic 'Learn to Program in C++' or whatever.

Parallel Scientific Computing in C++ and MPI: if you are not planning to parallelise your application, you should be.

Engineering and Scientific C++: a good, domain-specific, introduction to programming in C++. A bit dated in language details, but the overall approach hasn't aged.

I suggest that you read through the SO answers to questions such as 'How should I design a large C++ program ?' for advice on other books which may be of interest.

As to best practices, here are some suggestions. Again, I'm not sure of your starting point so some of this may be too basic:

  • As I wrote above, you should be planning from the outset to develop a parallel program. If message-passing on a cluster is not your cup of tea, at least consider shared memory programming for a multi-core desktop. OpenMP is worth investigating.
  • Make yourself familiar with existing work. The BOOST libraries are probably essential. While I applaud your intention to roll-your-own, don't ignore existing well-established numerical libraries such as BLAS and LAPACK which you'll find at Netlib. Depending on your development platform and toolset you may find them already installed.
  • If you are coming from a scientific background, you may want to improve your knowledge of and skills in software engineering. Matters such as: source code control; testing; code profiling and optimisation; deep knowledge of what your compiler(s) can do. In my experience many computational scientists have a weak background in all of this stuff.
  • You should be planning to spend (approximately) as much time on designing and testing your program as on actually coding it. Even working on your own it is essential to have a good plan of action before you start coding. There's no reason why it has to be complete in every detail at the beginning but never enter territory without a map.
  • You are silent on the aspect(s) of the physical world you want to simulate. There is a lot of prior art in all sorts of physical simulations, if you were a bit more specific SO might be able to provide some more specific suggestions.
少女七分熟 2024-10-01 07:43:02

数值秘诀:科学计算的艺术开始。一本相当全面的书。但是,请记住两件事:

  • 它包含 C++ 和 Fortran 90 代码示例。
  • 不过,忘记在项目中实际使用任何代码示例 - AFAIK 它们是受版权保护的,并且必须单独获得许可才能重复使用。

尽管如此,如果您出于教育目的需要它,强烈推荐阅读这本书。

Start with Numerical recipes: the art of scientific computing. A pretty comprehensive tome. However, keep in mind two things:

  • It contains both C++ and Fortran 90 code samples.
  • Forget about actually using any of the code samples in your project, though - AFAIK they are copyrighted and must be licensed for reuse separately.

Still, if you need it for educational purposes, this book is a highly recommended reading.

最后的乘客 2024-10-01 07:43:02

看看 OpenModelica

Have a look at OpenModelica.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文