自己的 CFD 代码的初学者指南?二维欧拉方程

发布于 2024-12-12 06:26:27 字数 1539 浏览 5 评论 0原文

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

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

发布评论

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

评论(4

森林散布 2024-12-19 06:26:27

是的,很多人以前都这样做过。

诀窍是将质量、动量和能量的守恒定律写成积分方程,并将它们转化为矩阵方程,以便您可以数值求解它们。变换过程通常涉及使用简单的形状(例如 2D 的三角形和四边形以及 3D 的四面体和砖块)来离散控制体积,并假设形状内相关变量的分布。

如果问题是瞬态的,您将需要了解大量有关线性代数和数值积分的知识。

有几种技术可以做到这一点:有限差分、有限元和边界元(如果存在合适的格林函数)。

这不是小事。您需要阅读如下内容:

http://www.amazon.com/数值传递半球计算力学/dp/0891165223

Yes, lots of people have done it before.

The trick is to write conservation laws for mass, momentum, and energy as integral equations and turn them into matrix equations so you can solve them numerically. The transformation process usually involves discretizing a control volume using simple shapes like triangles and quadrilaterals for 2D and tetrahedra and bricks for 3D and assuming distributions of pertinent variables within the shape.

You'll need to know a fair amount about linear algebra, and numerical integration if the problem is transient.

There are several techniques for doing it: finite differences, finite elements, and boundary elements (if a suitable Green's function exists).

It's not trivial. You'll want to read something like this:

http://www.amazon.com/Numerical-Transfer-Hemisphere-Computational-Mechanics/dp/0891165223

手心的海 2024-12-19 06:26:27

本书:

http://www.amazon.com/Computational-Fluid-Dynamics-John -Anderson/dp/0070016852

非常简单明了地描述了编写 CFD 代码所需的内容。它适合本科水平的入门课程,其中实际示例多于理论。

This book:

http://www.amazon.com/Computational-Fluid-Dynamics-John-Anderson/dp/0070016852

is a pretty straightforward, simple description of what it takes to write a CFD code. It's suitable for an undergraduate level intro with more practical examples than theory.

枫以 2024-12-19 06:26:27

您 6 年前提出的问题在所有计算流体动力学 (CFD) 新手中仍然相当常见(“这有多难?”)。然而,在这一阶段必须小心,不要轻视求解给定方程组背后的数学。

对于 CFD 新手(或感兴趣)的人 -

在开始考虑编码之前,了解您要求解的方程的性质非常重要。椭圆问题(如势流的泊松解算器)与双曲系统(如欧拉方程)非常不同,双曲系统中信息以不同波模的形式通过数值域“传播”。这是我的第一点,

1。了解系统的性质并研究方程 - 在这一步中,您需要阅读有关偏微分方程的数学教科书,并知道如何对不同的方程进行分类。 (请参阅 Farlow 的科学家和工程师的偏微分方程,或重新访问您的本科数学课程。)

2。研究线性代数 - 我认识的最好的 CFD 专家都拥有扎实的线性代数基础知识。

转向双曲问题的特定情况,例如欧拉方程

3。阅读空间和时间离散化 - 这是 CFD 新手不太理解的一点。由于信息在双曲线问题中以确定的方向和速度传播,因此您不能任意离散化您的方程。为此,您需要了解黎曼问题的概念,即给定给定时间两个状态之间的不连续界面,系统如何演化?现代有限体积方法使用空间离散化来复制信息在空间和时间上的模拟传播方式。这称为逆风。阅读 Toro 的关于黎曼求解器的书,了解逆风的详细介绍。

4.了解稳定性的概念 - 并非所有离散化和时间积分方法都会导致到稳定的解决方案。了解限制时间步长的概念 (CFL-条件)。如果不遵循逆风定律,就很难得到稳定的解。

此时,您将更清楚地了解 CFD 代码的内容,并且可以开始担心使用哪种语言进行编码。最广泛使用的 CFD 代码是用 C 或 Fortran 编写的,以提高计算速度和并行化。但是,如果您只是为了学习而编写代码,则可以使用 Matlab 或 Python,使用起来不会那么令人沮丧。我还应该提到,编写 2D 欧拉求解器是航空航天工程专业研究生的典型家庭作业问题,因此,如果您成功了,请尝试保持谦虚并乐于学习。

对于任何研究 CFD 的人来说,都知道这是一个充满挑战且令人惊叹的领域,并取得了许多进步。如果您希望成功,请阅读论文(尤其是基础知识),如果您无法理解某个主题,请不要放弃。继续努力,您会发现自己正在突破 CFD 的极限。

Your 6 year old question is still fairly common among all Computational Fluid Dynamics (CFD) newbies ("How hard can this be?"). However, one must at this stage be careful to not trivialize the math behind solving a given system of equations.

To those new to (or interested) in CFD -

Before you start thinking about coding, it is important to understand the nature of the equations you are trying to solve. An elliptic problem (like a Poisson solver for potential flow) is very different from a hyperbolic system (like the Euler equations) in which information "propagates" through the numerical domain in the form of different wave modes. Which is my first point,

1. Know the properties of the system and study the equations - For this step, you will need to go through math textbooks on partial differential equations, and know how to classify different equations. (See Partial Differential Equations for Scientists and Engineers by Farlow, or revisit your undergraduate math courses.)

2. Study linear algebra - The best CFD experts I know, have strong fundamentals in linear algebra.

Moving to a specific case for hyperbolic problems, e.g. the Euler equations

3. Read on spatial and temporal discretization - This is the point that is less well understood by people new to CFD. Since information propagates in a definite direction and speed in hyperbolic problems, you cannot discretize your equations arbitrarily. For this, you need to understand the concept of Riemann problems, i.e. given a discontinuous interface between two states at a given time, how does the system evolve? Modern finite-volume methods, use spatial discretizations that replicate how information is propagated through your simulation in space and time. This is called upwinding. Read Toro's book on Riemann solvers for a good introduction to upwinding.

4. Understand the concept of stability - Not all discretizations and time-integration methods will lead to a stable solution. Understand the concept of a limiting time-step (CFL-condition). If you don't follow the laws of upwinding, it will be difficult to get a stable solution.

At this point of time, you will have a clearer idea of what goes into a CFD code and you can start worrying about which language to use to code. Most widely used CFD codes are written in C or Fortran for computational speed and parallelization. However, if you intend to code only to learn, you can use Matlab or Python, which will be less frustrating to work with. I should also mention that coding a 2D Euler solver is a typical homework problem for new graduate students in Aerospace engineering, so try and be humble and open to learning if you succeed.

For anyone who is looking into CFD, know that it is a challenging and amazing field, with many advancements. If you wish to succeed, read up on papers (especially the fundamentals) and don't give up if you can't understand a topic. Keep working hard, and you will find yourself pushing the boundaries of what CFD can do.

聚集的泪 2024-12-19 06:26:27

您的问题的答案取决于您想要用来求解二维欧拉方程的方法。就我个人而言,我推荐有限体积方法并理解它,我认为你应该看看这本书:
计算流体动力学:Jiri Blazek 的原理和应用

这是一本好书,从一开始就接受有限体积方法,直到编写自己的代码,并且还附带了一个配套代码来指导整个过程。这是一本非常好的书,当我写硕士论文时,它让我感到惊奇。

The answer to your question depends on the approach you want to use to solve the 2D Euler equation . Personally , I recommend the finite Volume approach and to understand it, I think you should take a look on this book:
Computational Fluid Dynamics: Principles and Applications by Jiri Blazek.

It's a good book that takes from the beginning to stand the finite volume method to writing your own code and it also comes with a companion code to guide along the way . It's very good book, it did me wonders when I was writing my Master's thesis.

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