如何在周期系统中实现“孔”的规则晶格?

时间:2019-08-24 09:11:05

标签: fortran

我正在尝试为我的工作在仿真中实现特定类型的几何。

我的系统是一个矩形条纹,在y方向具有边界边界,在x方向具有周期性边界。

我的代码涉及在NN x NN点的网格上使用有限差分方法。 模拟区域为size_x * size_y,所以我有(size_x/nn) * (size_y/nn)的网格元素,这需要成为方形网格元素。

然后,我需要编写一些代码行,在其中可以放置半径= R的孔,孔间隔为周期距离= W,但这些孔在x方向的整个周期边界上必须是周期性的。

我使用下面的代码创建了下面的图像,但是该代码不允许我快速自由地更改R和W。我必须手动更改代码以适合所需的孔配置。重要的是请注意,可以更改SIZE_X和SIZE_Y以适合周期。

This is the image I refered to above, please see this.

我尝试了几种不同的方法,但是我正在努力理解实现该方法所必需的方法,因此,今天就加入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_periodantidot_radius的任何值,并具有关于中心X和Y轴对称的真实周期性几何形状;就像在我提供的图片中看到的一样。

如果有人可以帮助,将不胜感激。

1 个答案:

答案 0 :(得分:0)

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