我正在尝试使用他的解析方程重新绘制Toth(1962)的剖面地下水流图。我设法正确绘制了头值,并添加了轮廓。我的问题是我无法找到一种方法来绘制类似于matlab(流线)或矢量场中的流线函数的图形。如果有人能指出正确的方向,我将不胜感激。
当前结果
所需结果
可复制代码
library(colorspace)
zo<-500
c<-tan(0.016)
s<-1000
#Create Function
wutang1 <- function(x,z) {
h<-zo+(c*s/2)
q<-(4*c*s/pi^2)
m<-seq(0,100,1)
b<-(cos((2*m+1)*(pi*x/s))*cosh((2*m+1)*(pi*z)/s))/((2*m+1)^2*cosh((2*m+1)*
(pi*zo/s)))
i<-sum(b)
wutang<-h-(q*i)
return(wutang)
}
#Vectorize my terrible coding
wutang2<-Vectorize(wutang1)
wutang2(999,499)
mat <- matrix(NA, nrow=1000, ncol=500)
mat2<-outer(1:nrow(mat), 1:ncol(mat) , wutang2)
#choose color
#load in package 'colorspace'
#you will have to choose a color scale, or just delete that piece from
#'image'
pal <- choose_palette()
#plot
x <- (1:nrow(mat2))
y <- (1:ncol(mat2))
par(mar = c(5,4,4,4) + 0.1)
image(x,y,mat2,col=pal(10),axes=FALSE)
contour(x,y,mat2,add = TRUE, col = "peru",labcex=1.2)
axis(1, at = seq(0, 1000, by = 200))
axis(2, at = seq(0, 500, by = 100))
title(main="Toth 1962 Analytical Solution to 2D Groundwater Flow",
col.main="black", font.main=4,cex.main = 1.5)