I.1.19 Get_DeltaR2f_Cells_of_Cells_Multi_Mesh Procedure

The main documentation of the Get_DeltaR2f_Cells_of_Cells_Multi_Mesh Procedure contains additional explanation of this code listing.

  subroutine Get_DeltaR2f_C_of_C_MMesh (DeltaR2f_Cells_of_Cells, Mesh)

    ! Input variable.
  
    type(Multi_Mesh_type), intent(inout) :: Mesh   ! Mesh object.

    ! Input/Output variable.
    
    type(real,2) :: DeltaR2f_Cells_of_Cells ! DeltaR2f_Cells_of_Cells BNV.

    ! Internal variables.

    type(integer) :: cell, other_cell          ! Loop variables.
    type(real,3) :: Coordinates_Cells_of_Cells ! Coordinates of other cells.
    type(real,3) :: Coordinates_Faces_of_Cells ! Coordinates of face centers.

    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
    ! Verify requirements.
  
    VERIFY(Valid_State(Mesh),5)                       ! Mesh is valid.
    ! DeltaR2f_Cells_of_Cells is valid.
    VERIFY(Valid_State(DeltaR2f_Cells_of_Cells),5)  
    ! DeltaR2f_Cells_of_Cells has correct dimensions.
    VERIFY(SIZE(DeltaR2f_Cells_of_Cells,1) == Mesh%NCells_PE,5)
    VERIFY(SIZE(DeltaR2f_Cells_of_Cells,2) == Mesh%Faces_per_Cell,5)

    ! Get other_cell and face coordinates.

    call Initialize (Coordinates_Cells_of_Cells, Mesh%NDimensions, &
                     Mesh%NCells_PE, Mesh%Faces_per_Cell)
    call Get_Coordinates_Cells_of_Cells (Coordinates_Cells_of_Cells, Mesh)

    call Initialize (Coordinates_Faces_of_Cells, Mesh%NDimensions, &
                     Mesh%NCells_PE, Mesh%Faces_per_Cell)
    call Get_Coordinates_Faces_of_Cells (Coordinates_Faces_of_Cells, Mesh)

    ! Calculate absolute distance from cell center across the face (the 
    ! other_cell) to the face,
    ! 
    !   DeltaR2f = | R_f - R_2 |.

    do cell = 1, Mesh%NCells_PE
      do other_cell = 1, Mesh%Faces_per_Cell
        DeltaR2f_Cells_of_Cells(cell,other_cell) = &
          SQRT(DOT_PRODUCT( &
            Coordinates_Faces_of_Cells(:,cell,other_cell) - &
            Coordinates_Cells_of_Cells(:,cell,other_cell), &
            Coordinates_Faces_of_Cells(:,cell,other_cell) - &
            Coordinates_Cells_of_Cells(:,cell,other_cell)))
      end do
    end do

    ! Finalizations.

    call Finalize (Coordinates_Cells_of_Cells)
    call Finalize (Coordinates_Faces_of_Cells)
  
    ! Verify guarantees.

    VERIFY(Valid_State(Mesh),5)                ! Mesh is valid.
    ! DeltaR2f_Cells_of_Cells is valid.
    VERIFY(Valid_State(DeltaR2f_Cells_of_Cells),5) 
  
    return
  end subroutine Get_DeltaR2f_C_of_C_MMesh



Michael L. Hall