Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ftn:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

titan-cray:
( $(MAKE) all \
Expand All @@ -66,7 +66,7 @@ titan-cray:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

pgi:
( $(MAKE) all \
Expand All @@ -91,7 +91,7 @@ pgi:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

pgi-nersc:
( $(MAKE) all \
Expand All @@ -112,7 +112,7 @@ pgi-nersc:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

pgi-llnl:
( $(MAKE) all \
Expand All @@ -133,7 +133,7 @@ pgi-llnl:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

ifort:
( $(MAKE) all \
Expand All @@ -158,7 +158,7 @@ ifort:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

ifort-scorep:
( $(MAKE) all \
Expand All @@ -183,7 +183,7 @@ ifort-scorep:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

ifort-gcc:
( $(MAKE) all \
Expand All @@ -208,7 +208,7 @@ ifort-gcc:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

gfortran:
( $(MAKE) all \
Expand All @@ -233,7 +233,7 @@ gfortran:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

gfortran-clang:
( $(MAKE) all \
Expand All @@ -258,7 +258,7 @@ gfortran-clang:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

g95:
( $(MAKE) all \
Expand All @@ -279,7 +279,7 @@ g95:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

pathscale-nersc:
( $(MAKE) all \
Expand All @@ -300,7 +300,7 @@ pathscale-nersc:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

cray-nersc:
( $(MAKE) all \
Expand All @@ -321,7 +321,7 @@ cray-nersc:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

gnu-nersc:
( $(MAKE) all \
Expand All @@ -344,7 +344,7 @@ gnu-nersc:
"DEBUG = $(DEBUG)" \
"SERIAL = $(SERIAL)" \
"USE_PAPI = $(USE_PAPI)" \
"CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE -D_MPI $(FILE_OFFSET) $(ZOLTAN_DEFINE)" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI $(FILE_OFFSET) $(ZOLTAN_DEFINE)" )

intel-nersc:
( $(MAKE) all \
Expand All @@ -369,7 +369,7 @@ intel-nersc:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

bluegene:
( $(MAKE) all \
Expand Down
6 changes: 0 additions & 6 deletions src/Makefile.in.ACME
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ override CPPINCLUDES += -I$(EXEROOT)/$(COMPONENT)/source/inc -I$(INSTALL_SHAREDP
override FCINCLUDES += -I$(EXEROOT)/$(COMPONENT)/source/inc -I$(INSTALL_SHAREDPATH)/include -I$(INSTALL_SHAREDPATH)/$(COMP_INTERFACE)/$(ESMFDIR)/$(NINST_VALUE)/csm_share -I$(NETCDF)/include -I$(PIO) -I$(PNETCDF)/include
LIBS += -L$(PIO) -L$(PNETCDF)/lib -L$(NETCDF)/lib -L$(LIBROOT) -L$(INSTALL_SHAREDPATH)/lib -lpio -lpnetcdf -lnetcdf

ifneq (,$(findstring FORTRANUNDERSCORE, $(CPPFLAGS)))
ifeq (,$(findstring DUNDERSCORE, $(CPPFLAGS)))
override CPPFLAGS += -DUNDERSCORE
endif
endif

ifeq ($(DEBUG), TRUE)
override CPPFLAGS += -DMPAS_DEBUG
endif
Expand Down
6 changes: 0 additions & 6 deletions src/Makefile.in.CESM
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ override CPPINCLUDES += -I$(EXEROOT)/$(COMPONENT)/source/inc -I$(SHAREDPATH)/inc
override FCINCLUDES += -I$(EXEROOT)/$(COMPONENT)/source/inc -I$(SHAREDPATH)/include -I$(SHAREDPATH)/$(COMP_INTERFACE)/$(ESMFDIR)/$(NINST_VALUE)/csm_share -I$(NETCDF)/include -I$(PIO) -I$(PNETCDF)/include
LIBS += -L$(PIO) -L$(PNETCDF)/lib -L$(NETCDF)/lib -L$(LIBROOT) -L$(SHAREDPATH)/lib -lpio -lpnetcdf -lnetcdf

ifneq (,$(findstring FORTRANUNDERSCORE, $(CPPFLAGS)))
ifeq (,$(findstring DUNDERSCORE, $(CPPFLAGS)))
override CPPFLAGS += -DUNDERSCORE
endif
endif

ifeq ($(DEBUG), TRUE)
override CPPFLAGS += -DMPAS_DEBUG
endif
Expand Down
48 changes: 38 additions & 10 deletions src/core_init_atmosphere/mpas_init_atm_gwd.F
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,35 @@
!
module mpas_init_atm_gwd

use iso_c_binding, only : c_char, c_int, c_float, c_ptr, c_loc

use mpas_derived_types, only : MPAS_LOG_ERR
use mpas_framework
use mpas_timekeeping
use mpas_log, only : mpas_log_write
use mpas_c_interfacing, only : mpas_f_to_c_string

public :: compute_gwd_fields

private

interface
subroutine read_geogrid(fname, rarray, nx, ny, nz, isigned, endian, &
scalefactor, wordsize, status) bind(C)
use iso_c_binding, only : c_char, c_int, c_float, c_ptr
character (c_char), dimension(*), intent(in) :: fname
type (c_ptr), value :: rarray
integer (c_int), intent(in), value :: nx
integer (c_int), intent(in), value :: ny
integer (c_int), intent(in), value :: nz
integer (c_int), intent(in), value :: isigned
integer (c_int), intent(in), value :: endian
real (c_float), intent(in), value :: scalefactor
integer (c_int), intent(in), value :: wordsize
integer (c_int), intent(inout) :: status
end subroutine read_geogrid
end interface

integer, parameter :: I1KIND = selected_int_kind(2)

real (kind=RKIND), parameter :: Re = 6371229.0_RKIND ! Earth radius in MPAS-Atmosphere
Expand Down Expand Up @@ -314,14 +334,17 @@ function read_global_30s_topo(path, sub_path) result(iErr)
integer, parameter :: tile_y = 1200 ! y-dimension of each tile of global 30-arc-second topography
integer, parameter :: tile_bdr = 3 ! number of layers of border/halo points surrounding each tile

integer :: istatus
integer (c_int) :: istatus
integer :: ix, iy, ishift, ix_shift
integer :: isigned, endian, wordsize, nx, ny, nz
real (kind=R4KIND) :: scalefactor
real (kind=R4KIND), dimension(:,:,:), allocatable :: tile
integer (c_int) :: isigned, endian, wordsize, nx, ny, nz
real (c_float) :: scalefactor
real (c_float), dimension(:,:,:), pointer, contiguous :: tile
type (c_ptr) :: tile_ptr
character(len=StrKIND) :: filename
character(kind=c_char), dimension(StrKIND+1) :: c_filename

allocate(tile(tile_x+2*tile_bdr,tile_y+2*tile_bdr,1))
tile_ptr = c_loc(tile)

isigned = 1
endian = 0
Expand All @@ -345,7 +368,8 @@ function read_global_30s_topo(path, sub_path) result(iErr)
do ix=1,topo_x,tile_x
write(filename,'(a,i5.5,a1,i5.5,a1,i5.5,a1,i5.5)') trim(path)//trim(sub_path), ix, '-', (ix+tile_x-1), '.', &
iy, '-', (iy+tile_y-1)
call read_geogrid(filename, len_trim(filename), tile, nx, ny, nz, isigned, endian, &
call mpas_f_to_c_string(filename, c_filename)
call read_geogrid(c_filename, tile_ptr, nx, ny, nz, isigned, endian, &
scalefactor, wordsize, istatus)
if (istatus /= 0) then
call mpas_log_write('Error reading topography tile '//trim(filename), messageType=MPAS_LOG_ERR)
Expand Down Expand Up @@ -389,14 +413,17 @@ function read_global_30s_landuse(path) result(iErr)
integer, parameter :: tile_x = 1200 ! x-dimension of each tile of global 30-arc-second landuse
integer, parameter :: tile_y = 1200 ! y-dimension of each tile of global 30-arc-second landuse

integer :: istatus
integer (c_int) :: istatus
integer :: ix, iy
integer :: isigned, endian, wordsize, nx, ny, nz
real (kind=R4KIND) :: scalefactor
real (kind=R4KIND), dimension(:,:,:), allocatable :: tile
integer (c_int) :: isigned, endian, wordsize, nx, ny, nz
real (c_float) :: scalefactor
real (c_float), dimension(:,:,:), pointer, contiguous :: tile
type (c_ptr) :: tile_ptr
character(len=StrKIND) :: filename
character(kind=c_char), dimension(StrKIND+1) :: c_filename

allocate(tile(tile_x,tile_y,1))
tile_ptr = c_loc(tile)

isigned = 1
endian = 0
Expand All @@ -410,7 +437,8 @@ function read_global_30s_landuse(path) result(iErr)
do ix=1,topo_x,tile_x
write(filename,'(a,i5.5,a1,i5.5,a1,i5.5,a1,i5.5)') trim(path)//'/landuse_30s/', ix, '-', (ix+tile_x-1), '.', &
iy, '-', (iy+tile_y-1)
call read_geogrid(filename, len_trim(filename), tile, nx, ny, nz, isigned, endian, &
call mpas_f_to_c_string(filename, c_filename)
call read_geogrid(c_filename, tile_ptr, nx, ny, nz, isigned, endian, &
scalefactor, wordsize, istatus)
if (istatus /= 0) then
call mpas_log_write('Error reading landuse tile '//trim(filename))
Expand Down
Loading