出版于

对话与话语

与迪里奇和诺伊曼边界的对比的数值方案和分析解决方案

评估有限差异方案的性能。

Analytical and numerical solutions differ drastically in derivation, efficiency, and implementation. This piece aims to provide a full-scale comparison between such models, from derivation to implementation, for a basic standard diffusion model.

假设我们有一个系统,其中浓度从单数点跨越一维物理结构域扩散,该域由抛物线偏微分方程建模

通常被称为Fick的第二定律,在该定律中,扩散率是由常数表示的D。初始条件可以表示为

Consider the Dirichlet boundary conditions

以及诺伊曼边界条件

where the system is said to have reached completion when the concentration profile at a particular iteration first reaches a linear condition.

微分方程和边界可以通过数学求解以实现有效的分析模型。但是,数值方法通过采用有限的差异方案来近似于微分方程的解决方案。这样的方案会开发出大型代数矩阵,这些矩阵对于计算机算法求解非常有效。在数值解决方案中,我们主要关注源自Euler方法的显式,隐式和曲柄尼古尔森方案。MATLAB将用于计算浓度轮廓达到完成所需的时间,并提供图形表示。将讨论差异方案的截断误差和稳定性。

可以通过拉普拉斯变换来求解非均匀的部分微分方程。Fick的第二定律将首先在Dirichlet条件下解决,其次是Neumann条件。

When the Laplace transformation is taken with respect to time, we arrive at

whereUrepresents the transformed concentration variable ands代表时间替代。应用初始条件,方程简化为

and the transformed boundaries appear as

均质的普通微分方程的一般解决方案是

Substituting the transformed boundary conditions into the general solution allows the following calculations,

为了

泰勒(Taylor)对分母的扩展使我们能够离散方程式,因此对于逆拉动段转换可行。

鉴于以下逆拉环转换身份,

whereerfc(z)表示互补的错误函数,我们到达

2.2 Neumann边界解决方案

在解决Neumann边界问题时,该方法非常相似,显然是转化的边界条件。最初的转换方程仍然存在

而转变的边界现在看起来像

Substituting the transformed boundary conditions into the general solution allows the following calculations,

分母表示为离散化的泰勒级数,因此

鉴于我们现有的分析模型,可能不需要得出提供近似值而不是精确解决方案的数值方案。但是,必须指出的是,分析方法随着复杂性更大的问题而逐渐徒劳地增长。数值方案,即用于我们的目的有限差异,对于计算和分析增加复杂性的高阶模型至关重要。以下数值分析适用于比先前衍生的分析解决方案更大的问题。

离散的近似仅将数值解限制为有限数量的点。因此,离散近似值将导致一组代数方程,可以评估某些离散的未知数或“节点”。“网格”通常用于可视化节点的位置,该节点的位置由距离步骤决定,测量空间中相邻位置之间的局部距离,并测量相邻迭代之间的局部距离。因此,相对于时间或空间的导数可以用差分方程代替,而差异方程式用位于网格上的离散值编写。尽管本文未使用网格,但其原理应用于以下有限差异方案的推导和分析。

关于以下数值方案,给定问题的离散近似是基于不同的有限差异方案。Fick的第二定律的明确方案可以通过前向Euler方法来计算。除非另有提及,请假设nas the distance-step andj作为时间步长。

Fick’s Second Law can, therefore, be rewritten as

In some cases, expressing the scheme in a matrix-vector form is more convenient. Conversion to matrix form does not give the explicit scheme a significant advantage during computation. Regardless, the basic matrix form is given below but is elaborated further in the implicit and Crank-Nicolson scheme.

The implicit scheme gives the advantage of unconditional stability, as proven in (4.3.2). It can be calculated through the Backward Euler method,

which must be converted into matrix form because the values of concentration are now coupled.

对于给定的DIRICHLET条件,必须在右侧添加附加矩阵。

The Neumann conditions require an adjustment to the left-hand side matrix concerning the coefficients.

The new coefficient of

必须包括在(n+1,n)for a(n+1,n+1)矩阵。

事实证明,曲柄 - 尼科森方案被证明是有用的,因为它具有将隐式方法的无条件稳定性与时空中二阶方案的精度相结合的能力,如(4.1.3)所证明。

允许

with the Dirichlet boundaries accounted for in a similar fashion. Previously solved for in the simple implicit scheme, Neumann boundaries are included in the coefficient matrix on the left-hand side.

Local truncation error pertains to the error in approximating differential equations, calculated by the difference between said differential equation and its finite difference representation at a particular point in space and time. From such calculations, the local accuracies of various difference schemes can be compared.

泰勒的扩展允许以下定义,

(1)
(1)
(2)
(3)

Therefore,

Given

the main portion of the local truncation error is

因此,

A simplified and perhaps more elegant methodology is shown below.

(4)

Taylor’s expansion provides the following,

(5)
(6)

将(3),(5)和(6)替换为(4)产量

再次,

and the main portion of the local truncation error is

因此,we arrive at the same result as in the explicit scheme,

替换(1-3),(5)和(6)为(4)产量

Again,

本地截断误差的主要部分是,

因此,the local truncation error for this scheme can be expressed by

Finite difference schemes vary in their stability. For the case of difference schemes of differential equations, a scheme may be deemed stable if it does not allow the magnification of round-off error or minor fluctuations in initial data as the iterative process continues.

当离散方程接近微分方程的分析解作为时间和距离近近近时,融合可以定义为当接收方程接近分析解时。收敛的数学表示如下所示。

where

are fixed values.

冯·诺伊曼(Von Neumann)稳定性分析是一种用于验证有限差异方案的稳定性的方法,尤其是应用于线性偏微分方程时。通过将圆形误差分解为傅立叶系列,该方法可以通过。回想一下Fick的第二定律可能被离散为

允许圆形错误定义

where

represents the ideal case of the discretized equation calculated without round-off error and

代表遭受圆形误差的数值解决方案。如果

假定可以满足离散方程的满足,我们有

因此,圆形误差的变化可以在有限的傅立叶级数中表达

where

照常。误差的幅度可以假定为时间的指数函数,

自从the behavior of each term in the difference equation is the same as the series, it is appropriate to express the growth of round-off error of a single term as

Amplification, often referred to as the growth factor, must be equal or less than 1 if the system is to remain stable. For example,

The Forward Euler Method provides the iterative equation

自从

因为

The greatest value of alpha that satisfies the inequality is 0.5. Thus, the explicit scheme is conditionally stable so long

向后的Euler方法提供了迭代方程

通过与明确的非常相似的计算,我们得出

Observe that because

will always hold true. Therefore, the implicit scheme is unconditionally stable.

Yet again, the von Neumann analysis of the Crank-Nicolson Scheme is very similar to that of the explicit.

自从

will always hold true. Therefore, the Crank-Nicolson scheme is unconditionally stable.

Newton-Raphson方法允许计算分析表达式的溶液越来越准确的近似值。对于Dirichlet和Neumann溶液,初始近似

分别使Newton-Raphson方法确定连续近似值的近似值,以收敛到以下分析解决方案。

WhereD=1,

在哪里d = .5,

但是,必须通过迭代计算来解决差异方案。以下图表描述了浓度曲线达到线性状态的秒数的时间。α固定为0.5,而使用各种扩散率值。

分析 - 诺伊曼边界

Analytical — Dirichlet Boundary

数值 - 诺伊曼边界

传说在每次迭代中表示秒的时间。

数值 - dirichlet边界

菲克(Fick)第二定律的明确,隐性,曲柄尼科尔森和分析解决方案在我们既定的边界内取得了合理的结果。在有限的差异方案中,明确的方案可能是最简单的,但由于其有条件稳定的性质而面临限制。显式方案的本地截断误差与隐式方案的顺序相同。尽管隐式和曲柄 - 尼科尔森方案都被证明是无条件稳定的,因此融合,但鉴于其局部截断误差的较高顺序,曲柄 - 尼科尔森的速度更快,更准确。当然,分析解决方案产生的准确性最高。但是,它的计算速度比差异公式所需的代数集要慢得多。

LaTeX was used for producing scientific or mathematical symbols and expressions. Thus, the conversion to a Medium story resulted in odd spacing and slightly discolored images.

- -

- -

获取中型应用betway娱乐官网

一个说“在应用商店上下载”的按钮,如果单击,它将带您到iOS App Store
一个说“获取它,Google Play”的按钮,如果单击它,它将带您到Google Play商店
Eric Song

Interested in physical modeling, algorithmic design, physics, economics, and public policy.

Baidu