找回密码
 注册
查看: 705|回复: 0

R语言 rootSolve包 steady.3D()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-27 23:00:37 | 显示全部楼层 |阅读模式
steady.3D(rootSolve)
steady.3D()所属R语言包:rootSolve

                                         Steady-state solver for 3-Dimensional ordinary differential equations
                                         3维常微分方程的稳态解算器

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Estimates the steady-state condition for a system of ordinary differential equations that result from 3-Dimensional partial differential equation models that have been converted to ODEs by numerical differencing.
估计常微分方程系统的稳定状态,结果从3维的偏微分方程模型,已转化为常微分方程的数值差异。

It is assumed that exchange occurs only between adjacent layers.
假定交换仅发生在相邻层之间。


用法----------Usage----------


steady.3D(y, time = 0, func, parms = NULL,
          nspec = NULL, dimens,
          names = NULL, cyclicBnd = NULL, ...)



参数----------Arguments----------

参数:y
the initial guess of (state) values for the ODE system, a vector.  
(州)的初始估计值的ODE系统的一个向量。


参数:time
time for which steady-state is wanted; the default is time=0.  
稳定状态的时间被通缉的默认时间= 0。


参数:func
either an R-function that computes the values of the derivatives in the ode system (the model defininition) at time time, or a character string giving the name of a compiled function in a dynamically loaded shared library. If func  is an R-function, it must be defined as: yprime = func(t, y, parms,...).  t is the current time point in the integration, y is the current estimate of the variables in the ODE system.  If the initial values y has a names attribute, the names will be available inside func. parms is a vector or list of parameters; ... (optional) are any other arguments passed to the function.  The return value of func should be a list, whose first element is a vector containing the derivatives of y with respect to time, and whose next elements are global values whose steady-state value is also required.  The derivatives should be specified in the same order as the state variables y.  
可以是R-函数的衍生物中的值,计算在时间的颂歌系统(模型defininition)time,或给人的编译函数在一个动态加载的共享库的名称的字符串。如果func是一个R-函数,它必须被定义为:yprime = func(t, y, parms,...)。 t是当前时间点的整合,y是目前估计的ODE系统中的变量。如果初始值y有一个名称属性,名称将是提供内func。 parms是一个向量或参数列表; (可选)传递给函数的任何其他参数。 func的返回值应该是一个列表的第一个元素是一个向量包含y的衍生工具就time,而其下一个元素是全球性的值,其稳态值也是必需的。衍生工具应以相同的顺序指定的作为状态变量y。


参数:parms
parameters passed to func.  
参数传递到func。


参数:nspec
the number of *species* (components) in the model.  
的数目*物种*(组件)在模型中。


参数:dimens
a 3-valued vector with the dimensionality of the model, i.e. the number of *boxes* in x-, y- and z- direction.  
3值与模型的维数的向量,即在x-,y-和z-方向的数目*盒*。


参数:cyclicBnd
if not NULL then a number or a 3-valued vector with the dimensions where a cyclic boundary is used - 1: x-dimension, 2: y-dimension; 3: z-dimension;see details.  
如果不是NULL然后一个号码或一个3值的矢量的尺寸,使用的环状的边界 - 1:x维度,2:y维度;3 :Z-尺寸,查看详细信息。


参数:names
the names of the components; used to label the output,  and for plotting.  
的部件的名称;用于标记的输出,和用于绘图。


参数:...
additional arguments passed to function stodes.  
额外的参数传递给函数的stodes。


Details

详细信息----------Details----------

This is the method of choice to find the steady-state for  3-dimensional models, that are only subjected to transport between  adjacent layers.
这是给出的方法找到的3维模型,即只进行运送的相邻层之间的稳态。

Based on the dimension of the problem, the method first calculates the sparsity pattern of the Jacobian, under the assumption  that transport is only occurring between adjacent layers. Then stodes is called to find the steady-state.
基于尺寸的问题,该方法首先计算出的雅可比矩阵的稀疏性图案,运输只发生在相邻层之间的假设下。 stodes被称为找到稳定的状态。

As stodes is used, it will probably be necessary to specify the length of the real work array, lrw.
作为stodes时,它可能会需要指定的长度,真正的工作数组,lrw。

Although a reasonable guess of lrw is made, it may occur that this will be too low. In this case, steady.3D will return with an error message telling the size of the work array actually needed. In the second try then, set lrw equal to this number.
虽然一个合理的猜测lrw是,它可能发生,这将是太低了。在这种情况下,steady.3D将返回一个错误消息,告知实际需要的工作数组的大小。在第二次尝试,然后lrw等于这个数字。

In some cases, a cyclic boundary condition exists. This is when the first boxes in x-, y-, or z-direction interact with the last boxes. In this case, there will be extra non-zero fringes in the Jacobian which need to be taken into account. The occurrence of cyclic boundaries can be toggled on by specifying argument cyclicBnd. For innstance, cyclicBnd = 1 indicates that a cyclic boundary is required only for the x-direction, whereas cyclicBnd = c(1,2) imposes a cyclic boundary for both x- and y-direction. The default is no cyclic boundaries.
在某些情况下,环状的边界条件存在。这是当所述第一盒中的x,y,或z方向上交互的最后方块。在这种情况下,会有额外的非零条纹中的雅可比矩阵,需要加以考虑。循环边界的发生,可以打开通过指定参数cyclicBnd。对于innstance,cyclicBnd = 1表示的环状边界只要求的x方向,而cyclicBnd = c(1,2)施加两个x-和y-方向的环状的边界。默认情况下是没有循环的界限。

See stodes for the additional options.
stodes的附加选项。


值----------Value----------

A list containing
一个列表,其中包含


参数:y
a vector with the state variable values from the last iteration during estimation of steady-state condition of the system of equations.  
从最后一次迭代在估算过程中的方程系统的稳态状况的状态变量值的一个矢量。


参数:...
the number of "global" values returned.  
返回的“全球性”的价值观。

The output will have the attribute steady, which returns TRUE, if steady-state has been reached and the attribute precis with the precision attained during each iteration.
输出将有steady,它返回的属性TRUE,如果稳态已达到和属性precis在每次迭代中达到的精度。


注意----------Note----------

It is advisable though not mandatory to specify BOTH nspec and dimens. In this case, the solver can check whether the input makes sense (as nspec*dimens[1]*dimens[2]*dimens[3] = length(y))
这是可取的,但不是强制性的指定两个nspec和dimens。在这种情况下,求解器可以检查输入是否是有道理的(如nspec *梦诗[1] *梦诗[2] *梦诗[3] =长度(Y))

do NOT use this method for problems that are not 3D.
是不是3D的问题,请不要使用此方法。


(作者)----------Author(s)----------



Karline Soetaert <karline.soetaert@nioz.nl>




参见----------See Also----------

steady, for a general interface to most of the steady-state solvers
steady,一个通用的接口,大部分的稳态解算器

steady.band, to find the steady-state of ODE models with a banded Jacobian
steady.band,找到稳定状态的ODE模型的一个带状的雅可比

steady.1D, steady.2D, steady-state solvers for 1-D and 2-D partial differential equations.
steady.1D,steady.2D,1-D和2-D偏微分方程的稳态解算器。

stode, iterative steady-state solver for ODEs with full or banded Jacobian.
stode,常微分方程全部或带状雅可比迭代稳态解算器。

stodes, iterative steady-state solver for ODEs with arbitrary sparse Jacobian.
stodes,常微分方程任意稀疏Jacobian迭代稳态解算器。

runsteady, steady-state solver by dynamically running to steady-state
runsteady,通过动态运行到稳定状态的稳态求解器


实例----------Examples----------


## =======================================================================[#================================================= ======================]
## Diffusion in 3-D; imposed boundary conditions[#3-D强加边界条件的扩散]
## =======================================================================[#================================================= ======================]
diffusion3D <- function(t, Y, par)   {
   yy    &lt;- array(dim=c(n,n,n),data=Y)  # vector to 3-D array[矢量的3-D阵列]
   dY   &lt;- -r*yy        # consumption[消费]
   BND   &lt;- rep(1,n)   # boundary concentration[边界浓度]
   for (i in 1:n) {
     y <- yy[i,,]
     #diffusion in X-direction; boundaries=imposed concentration[在X方向上的扩散;的边界=施加的浓度]
     Flux <- -Dy * rbind(y[1,]-BND,(y[2:n,]-y[1n-1),]),BND-y[n,])/dy
     dY[i,,]   <- dY[i,,] - (Flux[2n+1),]-Flux[1:n,])/dy

     #diffusion in Y-direction[在Y方向上的扩散]
     Flux <- -Dz * cbind(y[,1]-BND,(y[,2:n]-y[,1n-1)]),BND-y[,n])/dz
     dY[i,,]    <- dY[i,,] - (Flux[,2n+1)]-Flux[,1:n])/dz
   }
   for (j in 1:n) {
     y <- yy[,j,]
     #diffusion in X-direction; boundaries=imposed concentration[在X方向上的扩散;的边界=施加的浓度]
     Flux <- -Dx * rbind(y[1,]-BND,(y[2:n,]-y[1n-1),]),BND-y[n,])/dx
     dY[,j,]   <- dY[,j,] - (Flux[2n+1),]-Flux[1:n,])/dx

     #diffusion in Y-direction[在Y方向上的扩散]
     Flux <- -Dz * cbind(y[,1]-BND,(y[,2:n]-y[,1n-1)]),BND-y[,n])/dz
     dY[,j,]    <- dY[,j,] - (Flux[,2n+1)]-Flux[,1:n])/dz
   }
   for (k in 1:n) {
     y <- yy[,,k]
     #diffusion in X-direction; boundaries=imposed concentration[在X方向上的扩散;的边界=施加的浓度]
     Flux <- -Dx * rbind(y[1,]-BND,(y[2:n,]-y[1n-1),]),BND-y[n,])/dx
     dY[,,k]   <- dY[,,k] - (Flux[2n+1),]-Flux[1:n,])/dx

     #diffusion in Y-direction[在Y方向上的扩散]
     Flux <- -Dy * cbind(y[,1]-BND,(y[,2:n]-y[,1:(n-1)]),BND-y[,n])/dy
     dY[,,k]    <- dY[,,k] - (Flux[,2:(n+1)]-Flux[,1:n])/dy
   }
   return(list(as.vector(dY)))
}

  # parameters[参数]
  dy    &lt;- dx &lt;- dz &lt;-1   # grid size[网格大小]
  Dy    &lt;- Dx &lt;- Dz &lt;-1   # diffusion coeff, X- and Y-direction[扩散COEFF,X-和Y-方向]
  r     &lt;- 0.025     # consumption rate[消费率]

  n  <- 10
  y  <- array(dim=c(n, n, n), data = 10.)

  print(system.time(
  ST3 <- steady.3D(y, func =diffusion3D, parms = NULL, pos = TRUE,
                   dimens = c(n, n, n), lrw = 100000,
                   atol = 1e-10, rtol = 1e-10, ctol = 1e-10,
                   verbose = TRUE)
  ))

  # image plot[图像绘图]
  y <- array(dim=c(n, n, n), data = ST3$y)
  filled.contour(y[ , ,n/2], color.palette = terrain.colors)
   
  # rootSolve's image plot, looping over 3rd dimension[rootSolve的形象,图,循环第三维]
  image(ST3, mfrow = c(4,3))

  # loop over 1st dimension, contours, legends added[循环第一维,轮廓,传说补充说:]
  image(ST3, mfrow = c(2, 2), add.contour = TRUE, legend = TRUE,
        dimselect = list(x = c(1, 4, 8, 10)))


转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-25 15:53 , Processed in 0.022426 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表