@@ -59,7 +59,48 @@ module fv_regrid_c2c
5959 integer :: IUNIT= 15
6060 integer :: OUNIT= 16
6161
62+ interface read_topo_file
63+ module procedure read_topo_file_r4
64+ module procedure read_topo_file_r8
65+ end interface
66+
6267contains
68+
69+ subroutine read_topo_file_r4 (fname ,output ,grid ,rc )
70+ character (len=* ), intent (in ) :: fname
71+ type (ESMF_Grid), intent (in ) :: grid
72+ real (real4), intent (inout ) :: output(:,:)
73+ integer , intent (out ), optional :: rc
74+
75+ integer :: status,dims(3 ),funit
76+ real , allocatable :: input(:,:)
77+ call MAPL_GridGet(grid,globalCellCountPerDim= dims,_RC)
78+ allocate (input(dims(1 ),dims(2 )))
79+ open (newunit= funit,file= trim (fname),form= ' unformatted' ,iostat= status)
80+ _VERIFY(status)
81+ read (funit)input
82+ call ArrayScatter(local_array= output,global_array= input,grid= grid,_RC)
83+ _RETURN(_SUCCESS)
84+ end subroutine read_topo_file_r4
85+
86+ subroutine read_topo_file_r8 (fname ,output ,grid ,rc )
87+ character (len=* ), intent (in ) :: fname
88+ type (ESMF_Grid), intent (in ) :: grid
89+ real (real8), intent (inout ) :: output(:,:)
90+ integer , intent (out ), optional :: rc
91+
92+ integer :: status,dims(3 ),funit
93+ real , allocatable :: input(:,:)
94+ real (real8), allocatable :: input_r8 (:,:)
95+ call MAPL_GridGet(grid,globalCellCountPerDim= dims,_RC)
96+ allocate (input(dims(1 ),dims(2 )),input_r8 (dims(2 ),dims(2 )))
97+ open (newunit= funit,file= trim (fname),form= ' unformatted' ,iostat= status)
98+ _VERIFY(status)
99+ read (funit)input
100+ input_r8 = input
101+ call ArrayScatter(local_array= output,global_array= input_r8 ,grid= grid,_RC)
102+ _RETURN(_SUCCESS)
103+ end subroutine read_topo_file_r8
63104
64105 subroutine get_geos_ic ( Atm , extra_rst , rstcube , gridOut )
65106
@@ -1880,23 +1921,6 @@ end subroutine mpp_domain_decomp
18801921!
18811922! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ !
18821923!- ------------------------------------------------------------------------------
1883-
1884- subroutine read_topo_file (fname ,output ,grid ,rc )
1885- character (len=* ), intent (in ) :: fname
1886- type (ESMF_Grid), intent (in ) :: grid
1887- real (real4), intent (inout ) :: output(:,:)
1888- integer , intent (out ), optional :: rc
18891924
1890- integer :: status,dims(3 ),funit
1891- real , allocatable :: input(:,:)
1892- call MAPL_GridGet(grid,globalCellCountPerDim= dims,_RC)
1893- allocate (input(dims(1 ),dims(2 )))
1894- open (newunit= funit,file= trim (fname),form= ' unformatted' ,iostat= status)
1895- _VERIFY(status)
1896- read (funit)input
1897- call ArrayScatter(local_array= output,global_array= input,grid= grid,_RC)
1898- _RETURN(_SUCCESS)
1899- end subroutine read_topo_file
1900-
19011925 end module fv_regrid_c2c
19021926
0 commit comments