注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

阿弥陀佛

街树飘影未见尘 潭月潜水了无声 般若观照心空静...

 
 
 

日志

 
 
关于我

一直从事气象预报、服务建模实践应用。 注重气象物理场、实况场、地理信息、本体知识库、分布式气象内容管理系统建立。 对Barnes客观分析, 小波,计算神经网络、信任传播、贝叶斯推理、专家系统、网络本体语言有一定体会。 一直使用Java、Delphi、Prolog、SQL编程。

网易考拉推荐

Burger`s方程初始条件计算  

2016-09-30 14:56:44|  分类: Spark |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

Initial conditions

We would like to create a "Burger object" which allows us the Burger equation on a domain from xmin to xmax, dividing this domain into Nx cells and updating with time step size dt. We will also have a choice of two types of "automatic" initial data; a Gaussian profile centered about the center of the domain, and a discontinuous initial profile with value qL on the left qR on the right of some point. Though it is possible to input other initial profiles, these two allow us to see how Burger's equation affects the evolution of discontinuities.

The constructor creates the Burger object given the number of cells Nx, time step size dt, and a boolean value "smooth" which determines whether the initial profile will be Gaussian or discontinuous when the init_fluid() method is invoked. The domain (xmin, xmax) is also automatically initialized to (0, 5), so to solve over a different domain it is only necessary to change xmin and xmax definitions here. Using xmin, xmax, and Nx, an array x[] of length Nx is created to hold the positions of the cell centers. The array q[] (also of length Nx) is also created to hold the average value of the function over each cell, but until init_fluid() has been called, every element of q[] is by default set to 0. (The number of ghost cells Ng is also automatically set to 2).

The init_fluid() method fills q[] with the relevant initial data, Gaussian if smooth = true and discontinuous otherwise. By default the maximum of the Gaussian and initial discontinuity are centered over the domain (with qL = 1.0 and qR = 0.1 in the latter case) but it is simple enough to modify this method if different initial profiles are desired.

Boundary conditions

It is clear that the Roe flux method cannot be used for the two cells adjacent to each boundary of the domain, since the calculation of the numerical flux in this scheme requires knowledge of values in two cells to the immediate left and right of the cell being updated. These cells are called "ghost cells", and are updated differently from cells in the interior of the domain depending on the desired boundary conditions. Here we use "outflow" conditions, which assume no waves travelling in from outside the domain will influence the solution within it. We can then choose to update the ghost cells by extrapolating from the interior solution, assuming continuity at the boundary. The most obvious way to do this is to copy the value from the nearest non-ghost cell (constant or zero-order extrapolation):

//constant extrapolation
for (int i = 0; i < Ng; i++) {
    qnp1[i] = qnp1[Ng];
    qnp1[Nx - i - 1] = qnp1[Nx - Ng - 1];
}

An equally intuitive choice would be to extrapolate linearly from the two closest non-ghost cells, or first-order extrapolation

//first order extrapolation
for (>int i = 0; i < Ng; i++) {
    qnp1[i] = qnp1[Ng]  - (Ng - i)*(qnp1[Ng + 1] - qnp1[Ng]);
    qnp1[Nx - i - 1] = qnp1[Nx - Ng - 1] + (Ng - i)*(qnp1[Nx - Ng - 1] - qnp1[Nx - Ng - 2]);
}

This seems as though it would always be more accurate than zero-order extrapolation, but in practice it may be lead to stability problems. In either case, we expect that this extrapolation will have a lower order than the scheme used in the interior, and therefore that the order of convergence at the boundaries will be less than around smooth interior sections. At later times, inaccuracy from the boundaries may "leak in" and corrupt the solution even at the interior. This is particularly evident in the case of the ultrarelativistic Gaussian evolution, though in this instance using first-order extrapolation appears to improve the situation somewhat.

  评论这张
 
阅读(66)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017