# Load FieldSim library
library(FieldSim)
## Define the grid
Z <- 2
n <- 30
phi <- Z/n*(0:(n-1))
theta <- 2*pi/n*(0:(n-1))
S <- numeric(0)
for (kk in 1:(n-1)){
S <- cbind(S,rbind(cos(theta[kk])*sinh(phi),sin(theta[kk])*sinh(phi),cosh(phi)))
}
## Define the autocovariance function
d<-function(x){
u <- -x[1]*x[4]-x[2]*x[5]+x[3]*x[6]
if (u<1){u<-1}
acosh(u)
}
R<-function(x){
H<-0.3
1/2*(d(c(0,0,1,x[1:3]))^{2*H}+d(c(0,0,1,x[4:6]))^{2*H}-d(x)^{2*H})
}
Wg <- hypersimgrid(R,Ne=50,Nr=100,nbNeighbor=4,S)$Wg
Run the code above in your browser using DataLab