我正在尝试处理 sqrt 但不知何故我无法理解为什么在编译该程序时会出现分段错误错误。我检测到这是因为 sqrt。但是我怎样才能在这些类型的配方中正确使用 sqrt 呢?
SUBROUTINE constructImages(image,w,w_b,x_w)
USE cellConst
USE simParam, ONLY: xDim, yDim, obstX, obstY, obstR,L_max
USE D2Q9Const, ONLY: v
implicit none
integer, INTENT(INOUT):: image(yDim,xDim),w_b(yDim,xDim),w(yDim,xDim)
double precision, dimension(L_max,0:1), INTENT(INOUT):: x_w
integer:: x,y,i,cont_L
double precision::x2,y2
!Disk Shape
do x = 1, xDim
do y = 1, yDim
if (((x-obstX)**2.0d0 + (y-obstY)**2.0d0) <= (obstR**2.0d0) ) then
image(y,x) = wall
w(y,x) = wall
end if
end do
end do
do x = 1, xDim
do y = 3, yDim-2
do i= 1,8
if ((w(y,x) == fluid) .and. (w(y+v(i,1),x+v(i,0)) == wall)) then
w_b(y,x) = 2
end if
end do
end do
end do
do x = 1,xDim
do y = 3, yDim-2
if (w_b(y,x) == 2) then
w_b(y,x) = wall
w(y,x) = wall
image(y,x) = wall
end if
end do
end do
x_w = 0.0d0 !Lagrangian vector for boundary exact position
cont_L = 0
do x = 1, xDim
do y = 1, yDim
do i = 1, 8
if ((w(y+v(i,1),x+v(i,0)) == fluid) .and. (w_b(y,x) == wall)) then
cont_L = cont_L +1
. x_w(cont_L,0) = x2 - ((x-obstX)^2.0d0 + (y-obstY)^2.0d0) ^0.5d0 - obstR
. x_w(cont_L,1) = y2 - ((x-obstX)^2.0d0 + (y-obstY)^2.0d0) ^0.5d0 - obstR
! write(*,*) x2,y2
! write(*,*) x_w(cont_L,0),x_w(cont_L,1)
end if
end do
end do
end do
END SUBROUTINE constructImages
如果需要更多信息,请告诉我,
真挚地,
阿尔伯特 P
PD,3 个整数欧拉网格是 0 / 1 2D 网格,其中 1 分配给由圆盘分隔的墙,w_b(y,x) 是边界点,w(y,x) 是整个圆盘点和 x_w 我想为障碍物设置离散精确位置的朗朗日向量。真的不需要明白这一点。