I.1 Multi_Mesh Class Code Listing

The main documentation of the Multi_Mesh Class contains additional explanation of this code listing.

!
!     Author: Michael L. Hall
!             P.O. Box 1663, MS-D413, LANL
!             Los Alamos, NM 87545
!             ph: 505-665-4312
!             email: Hall@LANL.gov
!
!     Created on: 04/20/00
!     CVS Info:   $Id: multi_mesh.F90,v 1.39 2009/09/17 01:11:51 hall Exp $

module Caesar_Multi_Mesh_Class

  ! Global use associations.

  use Caesar_Data_Structures_Module
  use Caesar_Numbers_Module, only: zero, fourth, half, one
  ! Only used for GMV dumps of MVs.
  use Caesar_Linear_Algebra_Module

  ! Start up with everything untyped and private.

  implicit none
  private

  ! Public procedures.

  public :: Initialize, Finalize, Valid_State, Initialized
  public :: Assignment (=), Cell_Structure, Dump_GMV, Dump_XMGrace, &
            Face_Structure, First_Cell_PE, First_Face_PE, First_Node_PE, &
            Get_Area_Faces_of_Cells, Get_Faces_per_Cell, &
            Get_Coordinates_Cells, Get_Coordinates_Cells_of_Cells, &
            Get_Coordinates_Faces_of_Cells, Get_Coordinates_Nodes_of_Cells, &
            Get_DeltaR1f_Cells_of_Cells, Get_DeltaR2f_Cells_of_Cells, &
            Get_DeltaR21_Cells_of_Cells, Get_Flag_Faces_of_Cells, &
            Get_NDimensions, Get_Volume_Cells, Last_Cell_PE, Last_Face_PE, &
            Last_Node_PE, Name, NCells_PE, NCells_Total, NFaces_PE, &
            NFaces_Total, NNodes_PE, NNodes_Total, Node_Structure, &
            Output, Range_Cells_PE, Range_Faces_PE, Range_Nodes_PE, &
            Set_Version, Version

  interface Initialize
    module procedure Initialize_Uniform_Multi_Mesh
    module procedure Initialize_Orthogonal_MMesh
    module procedure Initialize_Base_Multi_Mesh
  end interface

  interface Finalize
    module procedure Finalize_Multi_Mesh
  end interface

  interface Valid_State
    module procedure Valid_State_Multi_Mesh
  end interface

  interface Initialized
    module procedure Initialized_Multi_Mesh
  end interface

!  interface Dump_CGNS
!    module procedure Dump_CGNS_Multi_Mesh
!  end interface

  interface Dump_GMV
    module procedure Dump_GMV_Multi_Mesh
  end interface

  interface Dump_XMGrace
    module procedure Dump_XMGrace_Multi_Mesh
  end interface

  fortext([Value],
          [Name Cell_Structure Node_Structure Face_Structure dnl
           First_Cell_PE Last_Cell_PE NCells_PE NCells_Total dnl
           First_Node_PE Last_Node_PE NNodes_PE NNodes_Total dnl
           First_Face_PE Last_Face_PE NFaces_PE NFaces_Total dnl
           Range_Cells_PE Range_Nodes_PE Range_Faces_PE],[
    interface Value
      module procedure expand(Get_Value_Multi_Mesh)
    end interface
  ])

  interface Get_Area_Faces_of_Cells
    module procedure Get_Area_Faces_of_Cells_MMesh
  end interface

  interface Get_Faces_per_Cell
    module procedure Get_Faces_per_Cell_Multi_Mesh
  end interface

  interface Get_Flag_Faces_of_Cells
    module procedure Get_Flag_Faces_of_Cells_MMesh
  end interface

  interface Get_Coordinates_Cells
    module procedure Get_Coordinates_Cells_MMesh
  end interface

  interface Get_Coordinates_Cells_of_Cells
    module procedure Get_Coordinates_CoC_MMesh
  end interface

  interface Get_Coordinates_Faces_of_Cells
    module procedure Get_Coordinates_FoC_MMesh
  end interface

  interface Get_Coordinates_Nodes_of_Cells
    module procedure Get_Coordinates_NoC_MMesh
  end interface

  interface Get_DeltaR1f_Cells_of_Cells
    module procedure Get_DeltaR1f_C_of_C_MMesh
  end interface

  interface Get_DeltaR2f_Cells_of_Cells
    module procedure Get_DeltaR2f_C_of_C_MMesh
  end interface

  interface Get_DeltaR21_Cells_of_Cells
    module procedure Get_DeltaR21_C_of_C_MMesh
  end interface

  interface Get_NDimensions
    module procedure Get_NDimensions_Multi_Mesh
  end interface

  interface Get_Volume_Cells
    module procedure Get_Volume_Cells_Multi_Mesh
  end interface

!  interface Set_Coordinates
!    module procedure Set_Coordinates_Multi_Mesh_1
!    module procedure Set_Coordinates_Multi_Mesh_2
!    module procedure Set_Coordinates_Multi_Mesh_3
!    module procedure Set_Coordinates_Multi_Mesh_4
!    module procedure Set_Coordinates_Multi_Mesh_5
!  end interface

  interface Set_Version
    module procedure Set_Version_Multi_Mesh
  end interface

  interface Version
    module procedure Get_Version_Multi_Mesh
  end interface

  ! Public type definitions.

  public :: Multi_Mesh_type

  type Multi_Mesh_type
  
    ! Initialization flag.

    type(integer) :: Initialized
  
    ! The name for this mesh.
    
    type(character,name_length) :: Name
  
    ! Version number which is incremented every time the mesh is modified.

    type(integer) :: Version

    ! Mesh type information.

    type(integer)               :: NDimensions   ! Number of Dimensions.
    type(character,name_length) :: Geometry      ! Cartesian (x, xy, or xyz), 
                                                 ! Cylindrical (r or rz), or
                                                 ! Spherical (r)
    type(character,name_length) :: Uniformity    ! "Uniform" or "Nonuniform"
    type(character,name_length) :: Orthogonality ! "Orthogonal" or 
                                                 ! "Nonorthogonal"
    type(character,name_length) :: Structure     ! "Structured" or 
                                                 ! "Unstructured"
    type(logical)               :: AMR           ! Adaptive Mesh Refinement 
                                                 ! (H-type).
    type(character,name_length) :: Shape         ! "Segmented", "Triangular", 
                                                 ! "Quadrilateral", 
                                                 ! "Polygonal", "Tetrahedral", 
                                                 ! "Hexahedral" or "Polyhedral"
   
    ! Base structures for the mesh.
  
    type(Base_Structure_type) ::  Node_Structure
    type(Base_Structure_type) ::  Cell_Structure
    type(Base_Structure_type) ::  Face_Structure
    type(Base_Structure_type) ::  Boundary_Face_Structure
  
    ! Connectivity information for the mesh.
  
    type(Data_Index_type) :: Nodes_of_Cells_Index 
    type(Data_Index_type) :: Nodes_of_Faces_Index
    type(Data_Index_type) :: Faces_of_Cells_Index
    type(Data_Index_type) :: Cells_of_Faces_Index
    ! May depend on discretization.
    type(Data_Index_type) :: Faces_of_Faces_Index
    type(Data_Index_type) :: Cells_of_Cells_Index

    ! Coordinate data.

    type(Distributed_Vector_type) :: Coordinates_Nodes_DV
    type(Overlapped_Vector_type)  :: Coordinates_Nodes_of_Cells_OV
    type(Collected_Array_type)    :: Coordinates_Nodes_of_Cells_CA
    type(Overlapped_Vector_type)  :: Coordinates_Nodes_of_Faces_OV
    type(Collected_Array_type)    :: Coordinates_Nodes_of_Faces_CA
  
    ! Flags.
  
    type(Distributed_Vector_type) :: Flags_Nodes_DV
    type(Distributed_Vector_type) :: Flags_Cells_DV
    type(Distributed_Vector_type) :: Flags_Faces_DV
  
    ! User-numbering, that is, numbers assigned by the user that may 
    ! be different from those needed by the mesh class itself.
  
    type(Distributed_Vector_type) :: User_Numbers_Nodes_DV
    type(Distributed_Vector_type) :: User_Numbers_Cells_DV
    type(Distributed_Vector_type) :: User_Numbers_Faces_DV
  
    ! Point locations (calculated).
  
    type(Distributed_Vector_type) :: Coordinates_Cells_DV
    type(Distributed_Vector_type) :: Coordinates_Faces_DV
    type(Collected_Array_type)    :: Coordinates_Faces_of_Cells_CA
    type(Collected_Array_type)    :: Coordinates_Cells_of_Cells_CA
    type(Collected_Array_type)    :: QuarterPoints_Faces_of_Cells_CA
                                     
    ! Volume and area data.          
                                     
    type(Distributed_Vector_type) :: Volume_Cells_DV
    type(Collected_Array_type)    :: Vector_Area_Faces_of_Cells_CA
    type(Collected_Array_type)    :: Unit_Normal_Faces_of_Cells_CA
    type(Collected_Array_type)    :: Area_Faces_of_Cells_CA
    type(Distributed_Vector_type) :: Area_Faces_DV
    type(Distributed_Vector_type) :: JMT_Cells_DV
  
    ! Mesh scalar info.
  
    type(integer) :: NCells_total   ! Number of Cells in the whole problem.
    type(integer) :: NCells_PE      ! Number of Cells on this PE.
    type(integer) :: First_Cell_PE  ! First global cell number on this PE.
    type(integer) :: Last_Cell_PE   ! Last global cell number on this PE.
    type(integer), dimension(2) :: Range_Cells_PE ! Cell number range for PE.

    type(integer) :: NNodes_total   ! Number of Nodes in the whole problem.
    type(integer) :: NNodes_PE      ! Number of Nodes on this PE.
    type(integer) :: First_Node_PE  ! First global node number on this PE.
    type(integer) :: Last_Node_PE   ! Last global node number on this PE.
    type(integer), dimension(2) :: Range_Nodes_PE ! Node number range for PE.

    type(integer) :: NFaces_total   ! Number of Faces in the whole problem.
    type(integer) :: NFaces_PE      ! Number of Faces on this PE.
    type(integer) :: First_Face_PE  ! First global face number on this PE.
    type(integer) :: Last_Face_PE   ! Last global face number on this PE.
    type(integer), dimension(2) :: Range_Faces_PE ! Face number range for PE.

    type(integer) :: Faces_per_Cell ! = 2*NDimensions for Type 2 mesh.
    type(integer) :: Nodes_per_Cell ! = 2**NDimensions for Type 2 mesh.
    type(integer) :: Nodes_per_Face ! = 2**(NDimensions-1) for Type 2 mesh.

    ! Global mesh data (valid for uniform meshes only).
  
    type(real)   :: Volume_All_Cells  
    type(real,1) :: Area_All_Faces ! Scalar face area, stored as a vector for  
                                   ! the number of dimensions.
    ! Vector of physical mesh extents in each direction.
    type(real,1) :: Lengths

    ! Mesh edge data (valid for orthogonal meshes only).

    type(real,1) :: Coordinates_Nodes_X, & ! Coordinate vectors of the nodes 
                    Coordinates_Nodes_Y, & ! along an edge of the mesh, stored 
                    Coordinates_Nodes_Z    ! on all PEs.

    ! Face Flags for Structured Meshes. This is set to: 0 for internal, 
    ! 1 for left (-x), 2 for right (+x), 3 for front (-y), 4 for back (+y), 
    ! 5 for bottom (-z), 6 for top (+z).

    type(integer,2) :: Flag_Faces_of_Cells
  
  end type Multi_Mesh_type

!Operations:
!  call Initialize (Mesh,Mesh_type,Geometry,Coordinates,NNodes_PE,etc.)
!  call Initialize (Mesh,File)    ! Synonym = Read_from_File
!  call Initialize (Mesh,Mesh_type,"Kershaw (or other mesh type)")
!                   "Uniform", "Random", "Kershaw", "Kershaw-squared", "Shestakov"
!  call Finalize (Mesh)
!  logical = Valid_State(Mesh)
!  Node_Structure => Get_Node_Structure(Mesh)   ! returns a pointer.
!  Cell_Structure => Get_Cell_Structure(Mesh)   ! returns a pointer.
!  Face_Structure => Get_Face_Structure(Mesh)   ! returns a pointer.
!  Boundary_Face_Structure => Get_Boundary_Face_Structure(Mesh)
!    --> Ditto for all the Data_Index variables.
!  Get_Vector_Area_Faces_of_Cells (Mesh)
!  Get_Area_Faces (Mesh)
!  Get_Volume_Cells (Mesh)
!  Get_JMT_Cells (Mesh)
!  call Set_Coordinates (Mesh, Coordinates_BNV)   ! Synonym = Move
!  Coordinates_Nodes_BNV = Get_Coordinates_Nodes(Mesh)
!  Coordinates_Cells_BNV = Get_Coordinates_Cells(Mesh)
!  Coordinates_Faces_BNV = Get_Coordinates_Faces(Mesh)
!  Coordinates_Faces_of_Cells_BNV = Get_Coordinates_Faces_of_Cells(Mesh)
!  QuarterPoints_BNV = Get_QuarterPoints(Mesh)
!  Functions to return the mesh scalar variables, 
!    i.e. integer = NDimensions(Mesh), logical = AMR(Mesh), 
!    logical = Uniform(Mesh), etc.
!  From draco''s AMR_Mesh... useful?  
!    min(Mesh) - Returns the minimum coordinate value along the
!      specified direction for the specified cell. Ditto, max. 
!    get_cell (Mesh) Returns the cell number that contains the
!      specified point in space.
!    get_db (Mesh, Omega) Returns the distance to the nearest 
!      boundary in the specified cell and direction for the 
!      specified point in space.
!    get_generation (Mesh) Returns the generation (i.e., refinement)
!      level for the specified cell.
!  Get_Cell_Flags (Mesh, DV)
!  Get_Face_Flags (Mesh, DV)
!  Get_Node_Flags (Mesh, DV)
!  Get_Boundary_Face_Flags (Mesh, DV)
!  call Output (Mesh)
!  call Output (Mesh,"Format (like GMV, CGNS, RTT)")
!  call Output (Mesh, DV(:), "Format (like GMV, CGNS, RTT)")
!  call Interpolate (Mesh, DV1, DV2, Interpolation_type)

  ! Global class variables.

  type(integer), parameter :: Version_Increment = 1
  type(character,name_length), dimension(3), parameter :: &
    Geometry_Options = (/"Cartesian  ", "Cylindrical", "Spherical  "/)
  type(character,name_length), dimension(2), parameter :: &
    Uniformity_Options =  (/"Uniform   ", "Nonuniform"/)
  type(character,name_length), dimension(2), parameter :: &
    Orthogonality_Options =  (/"Orthogonal   ", "Nonorthogonal"/)
  type(character,name_length), dimension(2), parameter :: &
    Structure_Options =  (/"Structured  ", "Unstructured"/)
  type(character,name_length), dimension(7), parameter :: &
    Shape_Options = (/"Segmented    ", "Triangular   ", "Quadrilateral", &
                      "Polygonal    ", "Tetrahedral  ", "Hexahedral   ", &
                      "Polyhedral   "/)

contains

The Multi_Mesh Class contains the following routines which are listed in separate sections:

* Initialize_Base_Multi_Mesh
* Initialize_Uniform_Multi_Mesh
* Initialize_Orthogonal_Multi_Mesh
* Finalize_Multi_Mesh
* Valid_State_Multi_Mesh
* Initialized_Multi_Mesh
* Dump_CGNS_Multi_Mesh
* Dump_GMV_Multi_Mesh
* Dump_GMV DV and MV Vector
* Dump_XMGrace_Multi_Mesh
* Dump_XMGrace DV and MV Vector
* Gen_StructureMesh_Connectivity
* Get_Area_Faces_of_Cells_Multi_Mesh
* Get_Coordinates_Cells_Multi_Mesh
* Get_Coordinates_Cells_of_Cells_Multi_Mesh
* Get_Coordinates_Faces_of_Cells_Multi_Mesh
* Get_Coordinates_Nodes_of_Cells_Multi_Mesh
* Get_DeltaR21_Cells_of_Cells_Multi_Mesh
* Get_DeltaR1f_Cells_of_Cells_Multi_Mesh
* Get_DeltaR2f_Cells_of_Cells_Multi_Mesh
* Get_Flag_Faces_of_Cells_Multi_Mesh
* Get Value Multi_Mesh
* Get_Version_Multi_Mesh
* Get_Volume_Cells_Multi_Mesh
* Set_Coordinates_Multi_Mesh
* Set_Version_Multi_Mesh

end module Caesar_Multi_Mesh_Class



Subsections
Michael L. Hall