我正在尝试在我的工作模拟中实现特定类型的几何图形。
我的系统是一个矩形条带,在 y 方向上有边缘边界,在 x 方向上有周期性边界。
我的代码涉及在NN x NN
点的网格上使用有限差分方法。 模拟区域size_x * size_y
,所以我有(size_x/nn) * (size_y/nn)
的网格元素,这需要是一个方形网格元素。
然后,我需要一些代码行,我可以在其中放置半径 = R 的孔,这些孔由周期性距离 = W 分隔,但这些孔需要在 x 方向上跨周期性边界。
下图是我用后面的代码创建的,但代码不允许我快速自由地更改 R 和 W。我必须手动更改代码以适应我想要的孔配置。重要的是要注意,可以更改SIZE_X和SIZE_Y以适应周期性。
这是我上面提到的图像,请参阅此图像。
我已经尝试了几种不同的方法,但我正在努力理解实现此方法所需的方法,因此今天加入 SOF 并询问你们中的一些人。
下面我向您展示了我拥有的 Fortran 代码,它能够生成上图中显示的几何图形。
size_x=30.d0
size_y=30.d0 !!! Simulation area
wstr=20.0d0 !!! Width of stripe (y-direction), periodic in x-direction ù
nn=128 !!! number of grid points
grid_step = size_x/nn !!! Units of xsi(T)
antidot_period = 6.d0 !!! Units of xsi(T) xsi(T) is just some length
antidot_radius = 1.d0 !!! Units of xsi(T)
W = int(antidot_period/grid_step) !!! Hole period
R = int(antidot_radius/grid_step) !!! Hole Radius
do k=int(nn/2 - W),int(nn/2 + W),int(W)
do n=int(W/2+1),int(nn-(W/2)),int(W)
do i=int(-R),int(R),1
do j=int(-R),int(R),1
iss(k+i,n+j)= 0
end do
end do
end do
end do
因此,我需要某种方法来更改这段代码,以便我可以输入任何antidot_period
和antidot_radius
值,并具有围绕中心 X 和 Y 轴对称的真实周期几何图形;如我提供的图像所示。
如果有人能帮忙,将不胜感激。
antidot_period = 6.d0 !!! Units of xsi(T)
antidot_radius = 1.d0 !!! Units of xsi(T)
nod_in_X = 5.0d0 !!! Number of anti dots in the x-direction
grid_step = 0.25d0
W = int(antidot_period/grid_step) !!! Antidot period --- Integer value used for antidot creation loop at line 130
R = int(antidot_radius/grid_step) !!! Antidot Radius --- Integer value used for antidot creation loop at line 130
size_x= (nod_in_X * antidot_period) +antidot_period !!! Size of the simulation region in x-direction in units of xi(T)
size_y= size_x !!! Size of the simulation region in y-direction in units of xi(T)
nn = int((nod_in_X/grid_step)*antidot_period) !!! number of grid points, has to be a power of 2 for fft
do k=int(nn/2 - W),int(nn/2 + W),int(W)
do n=int(W/2),int(nn-(W/2)),int(W)
do i=int(-R),int(R),1
do j=int(-R),int(R),1
iss(k+i,n+j)= 0 !!! Basically inserts a hole
end do
end do
end do
end do