ghost_grid Subroutine

private subroutine ghost_grid(nodes, dims)

generate ghost grid for the various operations later.

Arguments

Type IntentOptional AttributesName
type(nodetype), intent(inout), dimension(-2:dims%imx+3,-2:dims%jmx+3,-2:dims%kmx+3):: nodes

grid points

type(extent), intent(in) :: dims

Extent of the domain:imx,jmx,kmx


Calls

proc~~ghost_grid~~CallsGraph proc~ghost_grid ghost_grid debugcall debugcall proc~ghost_grid->debugcall

Called by

proc~~ghost_grid~~CalledByGraph proc~ghost_grid ghost_grid proc~setup_grid setup_grid proc~setup_grid->proc~ghost_grid proc~setup_solver setup_solver proc~setup_solver->proc~setup_grid proc~start_run start_run proc~start_run->proc~setup_solver program~main main program~main->proc~start_run

Contents

Source Code


Source Code

        subroutine ghost_grid(nodes, dims)
          !< generate ghost grid for the various operations later.
          implicit none
          type(extent), intent(in) :: dims
          !< Extent of the domain:imx,jmx,kmx
          type(nodetype), dimension(-2:dims%imx+3,-2:dims%jmx+3,-2:dims%kmx+3), intent(inout) :: nodes
          !< grid points

          DebugCall('ghost_grid')
          !-------------------------------------------------------------------
          !getting ghost cell for all faces even if it is a interface cell
          ! <algorithm>
          ! Point_ghost = 2*Point_first_inner_cell - Point_second_inner_cell
          ! </algorithm>
          !-------------------------------------------------------------------

          !--- I faces ---!
          !imin face -> 0 grid point
          !imin face -> -1 grid point
          !imin face -> -2 grid point
          nodes( 0,:,:)%x=2*nodes( 1,:,:)%x-nodes(2,:,:)%x
          nodes( 0,:,:)%y=2*nodes( 1,:,:)%y-nodes(2,:,:)%y
          nodes( 0,:,:)%z=2*nodes( 1,:,:)%z-nodes(2,:,:)%z
          nodes(-1,:,:)%x=2*nodes( 0,:,:)%x-nodes(1,:,:)%x
          nodes(-1,:,:)%y=2*nodes( 0,:,:)%y-nodes(1,:,:)%y
          nodes(-1,:,:)%z=2*nodes( 0,:,:)%z-nodes(1,:,:)%z
          nodes(-2,:,:)%x=2*nodes(-1,:,:)%x-nodes(0,:,:)%x
          nodes(-2,:,:)%y=2*nodes(-1,:,:)%y-nodes(0,:,:)%y
          nodes(-2,:,:)%z=2*nodes(-1,:,:)%z-nodes(0,:,:)%z

          !imax face -> imx+1 grid point
          !imax face -> imx+2 grid point
          !imax face -> imx+3 grid point
          nodes(dims%imx+1,:,:)%x=2*nodes(dims%imx+0,:,:)%x-nodes(dims%imx-1,:,:)%x
          nodes(dims%imx+1,:,:)%y=2*nodes(dims%imx+0,:,:)%y-nodes(dims%imx-1,:,:)%y
          nodes(dims%imx+1,:,:)%z=2*nodes(dims%imx+0,:,:)%z-nodes(dims%imx-1,:,:)%z
          nodes(dims%imx+2,:,:)%x=2*nodes(dims%imx+1,:,:)%x-nodes(dims%imx-0,:,:)%x
          nodes(dims%imx+2,:,:)%y=2*nodes(dims%imx+1,:,:)%y-nodes(dims%imx-0,:,:)%y
          nodes(dims%imx+2,:,:)%z=2*nodes(dims%imx+1,:,:)%z-nodes(dims%imx-0,:,:)%z
          nodes(dims%imx+3,:,:)%x=2*nodes(dims%imx+2,:,:)%x-nodes(dims%imx+1,:,:)%x
          nodes(dims%imx+3,:,:)%y=2*nodes(dims%imx+2,:,:)%y-nodes(dims%imx+1,:,:)%y
          nodes(dims%imx+3,:,:)%z=2*nodes(dims%imx+2,:,:)%z-nodes(dims%imx+1,:,:)%z


          !--- Jmin faces ---!
          !jmin faces -> 0 grid point
          !jmin face -> -1 grid point
          !jmin face -> -2 grid point
          nodes(:, 0,:)%x=2*nodes(:, 1,:)%x-nodes(:,2,:)%x
          nodes(:, 0,:)%y=2*nodes(:, 1,:)%y-nodes(:,2,:)%y
          nodes(:, 0,:)%z=2*nodes(:, 1,:)%z-nodes(:,2,:)%z
          nodes(:,-1,:)%x=2*nodes(:, 0,:)%x-nodes(:,1,:)%x
          nodes(:,-1,:)%y=2*nodes(:, 0,:)%y-nodes(:,1,:)%y
          nodes(:,-1,:)%z=2*nodes(:, 0,:)%z-nodes(:,1,:)%z
          nodes(:,-2,:)%x=2*nodes(:,-1,:)%x-nodes(:,0,:)%x
          nodes(:,-2,:)%y=2*nodes(:,-1,:)%y-nodes(:,0,:)%y
          nodes(:,-2,:)%z=2*nodes(:,-1,:)%z-nodes(:,0,:)%z

          !jmax face -> jmx+1 grid point
          !jmax face -> jmx+3 grid point
          !jmax face -> jmx+2 grid point
          nodes(:,dims%jmx+1,:)%x=2*nodes(:,dims%jmx+0,:)%x-nodes(:,dims%jmx-1,:)%x
          nodes(:,dims%jmx+1,:)%y=2*nodes(:,dims%jmx+0,:)%y-nodes(:,dims%jmx-1,:)%y
          nodes(:,dims%jmx+1,:)%z=2*nodes(:,dims%jmx+0,:)%z-nodes(:,dims%jmx-1,:)%z
          nodes(:,dims%jmx+2,:)%x=2*nodes(:,dims%jmx+1,:)%x-nodes(:,dims%jmx-0,:)%x
          nodes(:,dims%jmx+2,:)%y=2*nodes(:,dims%jmx+1,:)%y-nodes(:,dims%jmx-0,:)%y
          nodes(:,dims%jmx+2,:)%z=2*nodes(:,dims%jmx+1,:)%z-nodes(:,dims%jmx-0,:)%z
          nodes(:,dims%jmx+3,:)%x=2*nodes(:,dims%jmx+2,:)%x-nodes(:,dims%jmx+1,:)%x
          nodes(:,dims%jmx+3,:)%y=2*nodes(:,dims%jmx+2,:)%y-nodes(:,dims%jmx+1,:)%y
          nodes(:,dims%jmx+3,:)%z=2*nodes(:,dims%jmx+2,:)%z-nodes(:,dims%jmx+1,:)%z


          !--- Kmax faces ---!
          !kmin faces -> 0 grid point
          !kmin face -> -1 grid point
          !kmin face -> -2 grid point
          nodes(:,:, 0)%x=2*nodes(:,:, 1)%x-nodes(:,:,2)%x
          nodes(:,:, 0)%y=2*nodes(:,:, 1)%y-nodes(:,:,2)%y
          nodes(:,:, 0)%z=2*nodes(:,:, 1)%z-nodes(:,:,2)%z
          nodes(:,:,-1)%x=2*nodes(:,:, 0)%x-nodes(:,:,1)%x
          nodes(:,:,-1)%y=2*nodes(:,:, 0)%y-nodes(:,:,1)%y
          nodes(:,:,-1)%z=2*nodes(:,:, 0)%z-nodes(:,:,1)%z
          nodes(:,:,-2)%x=2*nodes(:,:,-1)%x-nodes(:,:,0)%x
          nodes(:,:,-2)%y=2*nodes(:,:,-1)%y-nodes(:,:,0)%y
          nodes(:,:,-2)%z=2*nodes(:,:,-1)%z-nodes(:,:,0)%z

          !kmax face -> kmx+1 grid point
          !kmax face -> kmx+2 grid point
          !kmax face -> kmx+3 grid point
          nodes(:,:,dims%kmx+1)%x=2*nodes(:,:,dims%kmx+0)%x-nodes(:,:,dims%kmx-1)%x
          nodes(:,:,dims%kmx+1)%y=2*nodes(:,:,dims%kmx+0)%y-nodes(:,:,dims%kmx-1)%y
          nodes(:,:,dims%kmx+1)%z=2*nodes(:,:,dims%kmx+0)%z-nodes(:,:,dims%kmx-1)%z
          nodes(:,:,dims%kmx+2)%x=2*nodes(:,:,dims%kmx+1)%x-nodes(:,:,dims%kmx-0)%x
          nodes(:,:,dims%kmx+2)%y=2*nodes(:,:,dims%kmx+1)%y-nodes(:,:,dims%kmx-0)%y
          nodes(:,:,dims%kmx+2)%z=2*nodes(:,:,dims%kmx+1)%z-nodes(:,:,dims%kmx-0)%z
          nodes(:,:,dims%kmx+3)%x=2*nodes(:,:,dims%kmx+2)%x-nodes(:,:,dims%kmx+1)%x
          nodes(:,:,dims%kmx+3)%y=2*nodes(:,:,dims%kmx+2)%y-nodes(:,:,dims%kmx+1)%y
          nodes(:,:,dims%kmx+3)%z=2*nodes(:,:,dims%kmx+2)%z-nodes(:,:,dims%kmx+1)%z

        end subroutine ghost_grid