zhanghouxing的个人博客分享 http://blog.sciencenet.cn/u/zhanghouxing

博文

显式与隐式差分

已有 26772 次阅读 2016-8-9 11:30 |系统分类:科研笔记| 差分, 数值计算

数值差分方法一般分为显式差分与隐式差分,对二者的区别我查阅了相关的资料。我后面发现关于二者区分不是有一些差异。如Wiki:

Explicit methods calculate the state of a system at a later time from the state of the system at the current time, while implicit methods find a solution by solving an equation involving both the current state of the system and the later one. Mathematically, if is the current system state and is the state at the later time ( is a small time step), then, for an explicit method

while for an implicit method one solves an equation

to find

下面几个链接是其它的一些讨论:

http://earthscience.stackexchange.com/questions/2253/what-are-the-differences-between-implicit-and-explicit-methods-when-applied-to-m

http://www.cfd-online.com/Forums/main/5982-implicit-vs-explicit-method.html

这几个讨论,认为如果下一时刻状态值,能通过当前时刻值进行直接计算,则表示显式差分,如果下一时刻状态值,不能通过当前时刻值进行直接计算,而必须求解(1)式来计算,则表示隐式差分。

这个定义似乎很简单,也容易理解,但现在有一个情况是,式(1)如果是线性的,并且通过式(1),我们能反解出Y(t+dt),使其能够写出显示差分的格式。举一个例子吧,

du/dt = f(u)
where u is a vector and f is a known function. Then we may approximate the time derivative over a time step h as
(implicit) u(n+1) = u(n) + h.f(u(n+1))

if f(u) = Au where A is a constant, then u(n+1)=u(n)+Ahu(n+1),then, u(n+1)=u(n)/(1-Ah)

这种情况下,差分方法是显式还是隐式呢? 本质上我们也求解方程(1), 但是我们得到了显示格式。


后面我又查了相关的资料,如:

https://www.flow3d.com/home/resources/cfd-101/numerical-issues/implicit-versus-explicit-numerical-methods

这里认为:When a direct computation of the dependent variables can be made in terms of known quantities, the computation is said to be explicit. When the dependent variables are defined by coupled sets of equations, and either a matrix or iterative technique is needed to obtain the solution, the numerical method is said to be implicit.

根据这个理解,如果待求的值,能用已知的(已经计算的)值直接计算出来,则表示显式差分,相反,则表示隐式差分。

如下面的例子,我们计算某一位置某一时刻的值时,不仅用到了前一时刻的信息,也用到了当前时刻的信息,最后通反求解的方式,得到计算值,然而此类差分仍然属于显式差分。

另外一个定义:The idea behind the explicit method is to be able to obtain values such as
y i+1 = f(xi, yi), yi+2 = f(xi,xi+1,y i,yi+1), etc.In other words, your solution proceeds by solving explicitly for a new unknown value inthe solution array, given all previous values in the array. On the other hand, implicit
methods imply the simultaneous solution of n linear algebraic equations that provide, atonce, the elements of the solution array.

对于隐式差分,我有个例子

在上面的式子中,我们并不能直接求解出yi,这时候需要更多的方程来求解,这些方程可以写成矩阵来求解。

关于两者的Advantage与Disadvantage,应该比较清楚,前者速率快,但是本质上是conditionally stable,当dt较大,精度就会受到限制;而后者是unconditionally stable,但是计算效率低。

1-s2.0-S0096300304004680-main.pdf

role_959843.pdf

tcs-30_web.pdf


今天查看另外一个链接:http://echo2.epfl.ch/VICAIRE/,相关信息如下:

In finite-difference methods, calculations are performed on a grid placed over the interesting flow domain into the x-t plane. This computational grid is defined by some equal or variable space and time steps, Δx and Δt, respectively. A network of discrete points is thus obtained and the flow variables Q, z (or Q, h; V, z; V, h) are derived only for this finite number of grid points. Figure 6.2 shows a typical computational grid. The spatial positions of the grid points are denoted by index jand the time moments by index i.

Figure 6.2. Finite-difference computational grid.

As principle, finite-difference methods transform governing partial differential equations into a set of algebraic (linear or nonlinear) finite-difference equations, which are solved to allow the values of flow variables in a grid point or in all grid points on a time line. These finite-difference equations are derived by approximating the time and space derivatives with some finite-difference expressions. Not only the derivatives, but also the other terms into the Saint-Vénant equations must be defined in a certain manner.

Concerning the space derivative of a continuous function f(x,t) at time moment ti and space position xj on the grid in Figure 6.2, this can be approximated as:

a forward difference approximation;

a backward difference relationship;

a central difference expression,

(6.29)

in which fji represents the value of f at grid point (xj ,ti).

In an analogous manner, the time derivative may be defined in several different ways as, for example:

;

(6.30)

Usually, the value of the function f(x,t) is accepted at grid point (xj,ti) as fji , but some different approximations can also be decided.

A finite difference method must employ a certain type of finite-difference scheme. These schemes are grouped in two major classes: explicit and implicit finite-difference schemes.

Explicit schemes are those in which the flow variables at any point j and time level i+1 may be computed using only known data at a few adjacent points on the time line i. These schemes do not lead to a system of algebraic equations, but rather to only two finite difference equations for each grid point (xj,ti+1). By solving the two equations the unknown values of flow variables are obtained and then, the computation proceeds to the next grid point along the time line i+1.

In implicit schemes, finite-difference expressions used to approximate the space and/or time derivatives at grid point (xj, ti+1) include the unknown values of flow variables at a few adjacent points on the time line i+1. Consequently, a system of algebraic equations is produced for a given time line i+1 and by solving this system, all unknown values are simultaneously determined at time level i+1.

Replacing the continuous original problem with an integration over a discrete computational grid introduces numerical errors into the results. A finite-difference scheme is stable if such errors are not amplified during computation from one time level to the next. The numerical stability depends on the size of the time and space steps and on some flow characteristics. The Courant condition:

(6.31)

is a necessary but insufficient condition for stability of an explicit scheme.

Therefore, any explicit scheme is conditionally stable, the Courant condition requiring to work with small time steps as compared with the physical phenomena evolution. Despite their computational simplicity, the explicit methods are seldom used in river modelling for reasons of this stability restriction.

On the other hand, the implicit schemes may appear more complicated, but can generally be made unconditionally stable for large computation steps and with little loss of accuracy.

Another distinction among schemes belonging to the same class is related to the way in which the non derivative terms (such as Sf(Q,h), B(h), A(h) etc.) are discretized. Because these terms are functions of dependent variables, their treatment induces a linear or nonlinear feature of the finite-difference equations.

A lot of finite-difference schemes will be presented in more details within the next sections.


Numerical solution of kinematic wave model

First form (6.21) of the kinematic wave model is used to illustrate an explicit linear scheme on a finite-difference cell as show in Figure 6.4.

A backward finite-difference is used to approximate the space derivative, while the time derivative is usually expressed at the same xj+1 spatial position. In order to obtain a linear scheme, the nonderivative term αβQβ-1 must be evaluated for a known Q value, which here is accepted as mean between the two diagonal valuesQji+1 and Qij+1.

Figure 6.4. Finite-difference cell for linear kinematic wave solution.

Consequently, the finite-difference form of equation 6.21 is:

(6.40)

and the unknown Qj+1i+1 results as:

(6.41)

Starting with the inflow hydrograph value Q at the time level ti+1, the computation sequentially proceeds from upstream towards downstream grid points, along the current time line i+1.

However, this scheme supposes that within the coefficient α, the wetted perimeter P remains constant. On the other hand, by using Q instead of A into the time derivative A/t, relative computational errors are decreased. Indeed, taking the logarithm of equation 6.20, i.e.

,

and differentiating, one obtains:

,

where β is 0.6 for the Manning's equation. It follows that the estimation error in Q would be magnified by 1/0.6 ≈ 1.67 if the cross-sectional area A is used as dependent variable.


来自另外一本书:Chow, E.A., Applied hydrology. 1988.

A finite-difference method may employ either an explicit scheme or an implicit scheme for solution. The main difference between the two is that in the explicit method, the unknown values are solved sequentially along a time line from one distance point to the next, while in the implicit method the unknown valueson a given time line are all determined simultaneously. The explicit method is simpler but can be unstable, which means that small values of Ax and A^ are required for convergence of the numerical procedure.

综合上面的分析,对于PDE,如果在某个待求得时间点上,各位置(from upper to down)的值能够被依次直接求解的情况,认为是显示差分;而如果某个待求得时间点上,各位置的值必须同时联立起来求解,应该是隐式差分。



https://blog.sciencenet.cn/blog-922140-995390.html

上一篇:C语言与MATLAB对二进制文件与ASCII文件转换
下一篇:截断误差与舍入误差
收藏 IP: 107.178.194.*| 热度|

2 何思为 于国际

该博文允许注册用户评论 请点击登录 评论 (7 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-27 03:33

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部