!Copyright (c) 2013 by https://git.em3d.cn/ under guide of Xiu Li(lixiu@chd.edu.cn) !written by Huaifeng Sun(sunhuaifeng@email.sdu.edu.cn) and Xushan Lu(luxushan@gmail.com) !Code distribution @ https://git.em3d.cn/ MODULE CONSTANTPARAMETERS INTEGER NX,NY,NZ ! Nx,Ny,Nz is the number of grid in x, y and z directions respectively; REAL*8 SourceLength ! The length of source INTEGER SourceGridNum ! The number of grids in source area (x direction) INTEGER NXB,NYB,NZB !Nxb=Nx+1, Nyb=Ny+1, Nzb=Nz+1 INTEGER NXS,NYS,NZS !This parameter mostly represents the middle grid's number, Nxs=Nx/2 or Nxs=Nxb/2, Nys=Ny/2 or Nys=Nyb/2, Nzs=Nz/2 REAL*8 BACKGROUND_CONDUCTIVITY,TUNNEL_LENGTH !The conductivity���絼�ʣ� of background; the length of tunnel INTEGER CAL_TYPE !The type of Calculation�����㣩, in this case, it is semi which represents semi_airborne REAL*8 SIGMA_MIN !The minimum value of sigma REAL(KIND=8) TIME_MAX !The maximum value of iteration�������� time step INTEGER NSTOP !The number of total iteration steps REAL*8 MAX_OFF_TIME !The maximum calculation time, in ms INTEGER LOOP !Iteration step INTEGER TEMP_II REAL*8, PARAMETER:: CC=2.99792458D8 !The velocity of light�����٣� REAL*8, PARAMETER:: PI=3.141592653589793238462643383276D0 !PI REAL*8, PARAMETER:: SCALE_PAR=1.3d0 !The ratio of adjacent grid's length �������񳤶ȱ��� REAL*8, PARAMETER:: MAX_RATIO=50.0D0 !The maximum value of scale_par���߶Ȳ����� REAL*8 GridSize, GridSize_MAX !The size of a single grid, it represents the size of uniform grid. REAL(KIND=8), DIMENSION(:),ALLOCATABLE:: CDELX !The array�����飩 of all grid size in x direction, designed for the recording of ununiform meshing. REAL(KIND=8), DIMENSION(:),ALLOCATABLE:: CDELY !The array of all grid size in y direction, designed for the recording of ununiform meshing. REAL(KIND=8), DIMENSION(:),ALLOCATABLE:: CDELZ !The array of all grid size in z direction, designed for the recording of ununiform meshing. integer::mstop(100000),mstart(100000),num_fra_com ! ! The entire computation process is cut into hundreds of computing fractions. At the begining of each computation fraction, data is sent to GPU-- ! --device, then the computation of this section starts in device, and the data is sent back to host when the comutation is finished in device------- ! --then we record electromagnetic field value to the hard disk. This procedure keeps running until the end of the entire computation. ! mstop is an array used to store the iteration steps in a section, the length is set to 10000 because we can not know the number of sections at-- ! --the beginning of computation and it's value usually is smaller than 10000. Thus you should change it when there are more than 10000 computation-- ! --fractions in some certain computing task. ! mstart is used to store the value of the beginning iteration step number of the entire iteration process. It has the same length with mstop. ! num_fra_com is the number of computation fractions of the entire computation process. REAL*8, PARAMETER:: MU0=4.0*PI*1.0D-7 !The permeability of vaccum.����մŵ�ϵ���� REAL*8, PARAMETER:: EPS0=1.0/(CC*CC*MU0) !The dielectric constant of vaccum.����ս�糣���� REAL*8, PARAMETER:: AIR_CONDUCTIVITY=1.0D-6 CHARACTER(LEN=20) SOURCE_TYPE !The type of source, most commonly used one is tixing_upcos. character*30,allocatable::RecHzFile(:,:),RecHEFile(:,:),RecFile(:,:) !The filename of Recording file, RecHzFile for the Hz mode which only record the value of Hz-- ! --RecHEFile for HE mode which record every component of electromagnetic filed, RecFile is used in the filename distribution process. character*30 PostProcessFile,SplitFile !The filename of PostProcessFileList.dat which stores the name of files need to be post processed. character*2 RecFlag !Recording mode flag, possible values are: Hz and HE. It is specified in input.dat file. integer,allocatable::RecHzFilePid(:,:),RecHEFilePid(:,:),RecFilePid(:,:) !File pid of RecHzFile, RecHeFile and RecFile. integer PostProcessFilePid,SplitFilePid !The pid of PostProcessFileList.dat Integer,Allocatable::is_ex_in_source(:,:) !An array used in GetSourcePosition subroutine, the dimension of it is (Nx,Ny), in the source area, the value of this array is 1, else it is 0. integer,allocatable::is_ey_in_source(:,:) !The same as above. integer UniGridNumZ1,UniGridNumZ2,UniGridNumX1,UniGridNumX2,UniGridNumY1,UniGridNumY2 INTEGER Logic_PML !Boundary condition switch read from input.dat: 1=CPML absorbing boundary, 0=original Dirichlet (zero field) boundary on the non-uniform grid INTEGER PML_X,PML_Y,PML_Z !PML thickness read from input.dat (only valid when Logic_PML=1) INTEGER PML_X1,PML_X2,PML_Y1,PML_Y2,PML_Z1,PML_Z2 !PML thickness of the two sides of each direction, set as PML_X1=PML_X, PML_X2=PML_X, etc. integer RecPointMin,RecPointMax integer,allocatable::RecLine(:),RecPoint(:) !Two dimensional array which stores the value of grid number as (x,y) at which the value of EM filed need to be recorded. integer,allocatable::FlightHeight(:) !This is the flight height of semi_airborne TEM or you can see it as the height of recording plane. character*3,allocatable::Height(:) !This is used in the filename distribution process INTEGER,allocatable:: GridNumHeight(:) !The number of grids between flight height plane and ground in z direction. INTEGER,allocatable:: NZS_AIR(:) !The grid number in z direction of flight height plane INTEGER NumRecLines,NumRecPoints,NumRecHeights !The number of total recording points and recording heights REAL(KIND=8), DIMENSION(:), ALLOCATABLE:: SOURCE !Nstop length array which stores the value of amplitude of source. INTEGER, DIMENSION(:), ALLOCATABLE:: TAR_X1 !The left grid number of anomalous body in x direction. INTEGER, DIMENSION(:), ALLOCATABLE:: TAR_X2 !The right grid number of anomalous body in x direction. INTEGER, DIMENSION(:), ALLOCATABLE:: TAR_Y1 !The left grid number of anomalous body in y direction. INTEGER, DIMENSION(:), ALLOCATABLE:: TAR_Y2 !The right grid number of anomalous body in y direction. INTEGER, DIMENSION(:), ALLOCATABLE:: TAR_Z1 !The left grid number of anomalous body in z direction. INTEGER, DIMENSION(:), ALLOCATABLE:: TAR_Z2 !The right grid number of anomalous body in z direction. REAL(KIND=8), DIMENSION(:), ALLOCATABLE:: TAR_CONDUCTIVITY !The conductivity array of anomalous body real*8,allocatable::Eps_r(:),Cq(:) !Nstop length array of fictitious dielectric constant; cq is a middle variable used in the iteration part. REAL*8 RAISETIME,RAMP,WAVE,AMP !The time of raising edge, ramp edge and duration in trapezoidal waveform, amp is the amplitude of source REAL*8 RAISESTEP,WAVESTEP,RAMPSTEP,TIMESTEP ! The iteration time step in raise, duration, ramp and cutoff period. real*8,allocatable::Coordix(:),Coordiy(:),Coordiz(:) !=================================================================================================== REAL*8, DIMENSION( : ), ALLOCATABLE :: CoordinatesX, CoordinatesY, CoordinatesZ INTEGER, DIMENSION( : ), ALLOCATABLE :: Element_Node1, Element_Node2, Element_Node3 REAL*8, DIMENSION( : ), ALLOCATABLE :: Element_Label1_Coordx, Element_Label1_Coordy, Element_Label1_Coordz REAL*8, DIMENSION( : ), ALLOCATABLE :: Element_Label2_Coordx, Element_Label2_Coordy, Element_Label2_Coordz REAL*8, DIMENSION( : ), ALLOCATABLE :: Element_Label3_Coordx, Element_Label3_Coordy, Element_Label3_Coordz REAL*8, DIMENSION(:,:), ALLOCATABLE :: Normal !Save the normal of Triangle REAL*8, DIMENSION( : ), ALLOCATABLE :: V1X, V1Y, V1Z !Save the vertor of Edge1 from Triangle REAL*8, DIMENSION( : ), ALLOCATABLE :: V2X, V2Y, V2Z !Save the vertor of Edge2 from Triangle REAL(KIND=8):: eps105 = 1.0e-5 INTEGER, ALLOCATABLE :: Node_Label( : ) INTEGER, ALLOCATABLE :: Element_Label( : ) INTEGER :: n_face,n_point REAL*8, DIMENSION( : ), ALLOCATABLE :: Node_Coordx, Node_Coordy, Node_Coordz INTEGER(KIND=4) :: mm,mmx,mmy,mmz,mmmz,mmmx,mmmy INTEGER(KIND=4) :: X_max,X_min,Y_max,Y_min,Z_max,Z_min INTEGER(KIND=4) :: KIdx_1,KIdx_2 INTEGER(KIND=4) :: Rx,Ry,Rz INTEGER(KIND=4) :: idx_start,idx_end INTEGER(KIND=4), DIMENSION(:), ALLOCATABLE :: mmz_per,mmy_per,mmx_per REAL(KIND=8) :: tao_abnormal REAL(KIND=8) :: max_coord_x,min_coord_x REAL(KIND=8) :: max_coord_y,min_coord_y REAL(KIND=8) :: max_coord_z,min_coord_z REAL(KIND=8) :: verts_Dotmultp REAL(KIND=8) :: dir_z(3),dir_x(3),dir_y(3) !direction vector REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: coordinates_x,coordinates_y,coordinates_z !Yee grid node coordinates REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: Coord_HZ_X,Coord_HZ_Y,Coord_HZ_Z REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: det_x,det_y,det_z REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: u_x,u_z,u_y,v_z,v_x,v_y,t_z,t_x,t_y REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: vert0,vert1,vert2 !Vertex coordinates of triangular elements REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: edge1,edge2 !Triangular element vector REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: Face_Triangle_NormVect REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: orig_z,orig_x,orig_y !Ray origin coordinate REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: pvec_z,pvec_x,pvec_y REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: tvec_x,tvec_y,tvec_z REAL(KIND=8), DIMENSION(:,:,:), ALLOCATABLE :: LenRatio_CCSIGX, LenRatio_CCSIGY, LenRatio_CCSIGZ LOGICAL :: Logic_1,Logic_2,Logi_Sourcelenth LOGICAL :: Logic_AnomalousDat,Logic_AnomalousStl !Logic_AnomalousDat is .TRUE. when Complex_anomalous.dat (the original text format) exists; !Logic_AnomalousStl is .TRUE. when Complex_anomalous.stl (the ASCII STL format) exists. !They are detected in GETDATA, and used by RES_CONFIGURE and anomalous_conformal to choose !the proper reader. Only one of the two files should exist in the working folder. LOGICAL :: Logic_TerrainDat,Logic_TerrainStl !Logic_TerrainDat is .TRUE. when Complex_Terrain.dat (the original text format) exists; !Logic_TerrainStl is .TRUE. when Complex_Terrain.stl (the ASCII STL format) exists. !They are detected in GETDATA, and used by RES_CONFIGURE and terrain_conformal to choose !the proper reader. Only one of the two files should exist in the working folder. TYPE Coordinates !coordinates represents the coordinate REAL(KIND=8):: Coord_X,Coord_Y,Coord_Z END TYPE Coordinates TYPE CrossPoint_Property TYPE(coordinates):: Global_Coord LOGICAL:: Log_In END TYPE CrossPoint_Property TYPE(CrossPoint_Property), DIMENSION(:,:), ALLOCATABLE :: crosspoint_XX,crosspoint_YY,crosspoint_ZZ TYPE(CrossPoint_Property), DIMENSION(:,:,:), ALLOCATABLE :: coor_z,coor_x,coor_y INTEGER(KIND=4):: Point_Num TYPE Coordmesh !coordmesh represents coordinates in terms of grids INTEGER(KIND=4):: Coordmesh_X,Coordmesh_Y,Coordmesh_Z END TYPE Coordmesh TYPE Observers TYPE(Coordinates):: Local_Coord_To_Source !This array is used to record the position of the inversion point relative to the source. TYPE(Coordmesh):: Global_Coordmesh(8) TYPE(coordinates):: Global_Coord !coordinates represents the coordinate REAL(KIND=8):: Coeff(8) INTEGER(KIND=4):: Idx_Num END TYPE Observers TYPE(observers), DIMENSION(:), ALLOCATABLE:: Points_Observer ENDMODULE CONSTANTPARAMETERS