I.1.18 Get_DeltaR1f_Cells_of_Cells_Multi_Mesh Procedure

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

  subroutine Get_DeltaR1f_C_of_C_MMesh (DeltaR1f_Cells_of_Cells, Mesh)

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

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

    ! Internal variables.

    type(integer) :: cell, other_cell        ! Loop variables.
    type(real,2) :: Coordinates_Cells        ! Coordinates of the cell centers.
    type(real,3) :: Coordinates_Faces_of_Cells ! Coordinates of face centers.

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

    ! Get cell and face coordinates.

    call Initialize (Coordinates_Cells, Mesh%NDimensions, Mesh%NCells_PE)
    call Get_Coordinates_Cells (Coordinates_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 to all faces,
    ! 
    !   DeltaR1f = | R_f - R_1 |.

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

    ! Finalizations.

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

    VERIFY(Valid_State(Mesh),5)                ! Mesh is valid.
    ! DeltaR1f_Cells_of_Cells is valid.
    VERIFY(Valid_State(DeltaR1f_Cells_of_Cells),5) 
  
    return
  end subroutine Get_DeltaR1f_C_of_C_MMesh



Michael L. Hall