Skip to content

Commit

Permalink
Merge pull request #155 from GEOS-ESM/develop
Browse files Browse the repository at this point in the history
Merge Develop into Main for release
  • Loading branch information
mathomp4 authored Jan 4, 2022
2 parents c2b9511 + 4a7c519 commit 01f8e86
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 48 deletions.
60 changes: 36 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,26 @@ workflows:
compiler: [gfortran, ifort]
context:
- docker-hub-creds
- make-FV3-exp:
name: make-FV3-exp-on-<< matrix.compiler >>
matrix:
parameters:
compiler: [gfortran, ifort]
context:
- docker-hub-creds
requires:
- build-GEOSgcm-on-<< matrix.compiler >>
- run-FV3:
name: run-FV3-on-<< matrix.compiler >>
matrix:
parameters:
compiler: [gfortran, ifort]
context:
- docker-hub-creds
requires:
- make-FV3-exp-on-<< matrix.compiler >>


###################################################
# - make-FV3-exp: #
# name: make-FV3-exp-on-<< matrix.compiler >> #
# matrix: #
# parameters: #
# compiler: [gfortran, ifort] #
# context: #
# - docker-hub-creds #
# requires: #
# - build-GEOSgcm-on-<< matrix.compiler >> #
# - run-FV3: #
# name: run-FV3-on-<< matrix.compiler >> #
# matrix: #
# parameters: #
# compiler: [gfortran, ifort] #
# context: #
# - docker-hub-creds #
# requires: #
# - make-FV3-exp-on-<< matrix.compiler >> #
###################################################

commands:
versions:
Expand All @@ -67,6 +67,14 @@ commands:
command: |
mpirun --version && << parameters.compiler >> --version && echo $BASEDIR && pwd && ls && echo "$(nproc)"
compress_artifacts:
description: "Compress artifacts"
steps:
- run:
name: "Compress artifacts"
command: |
gzip -9 /logfiles/*
checkout_fixture:
description: "Checkout fixture"
parameters:
Expand Down Expand Up @@ -178,12 +186,15 @@ jobs:
compiler: << parameters.compiler >>
- buildinstall:
repo: GEOSgcm
- compress_artifacts
- store_artifacts:
path: /logfiles
- persist_to_workspace:
root: workspace
paths:
- install-GEOSgcm
###########################
# - persist_to_workspace: #
# root: workspace #
# paths: #
# - install-GEOSgcm #
###########################

make-FV3-exp:
parameters:
Expand Down Expand Up @@ -260,6 +271,7 @@ jobs:
echo "EGRESS not found!"
exit 1
fi
- compress_artifacts
- store_artifacts:
path: /logfiles

58 changes: 41 additions & 17 deletions fv_regrid_c2c.F90
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,48 @@ module fv_regrid_c2c
integer :: IUNIT=15
integer :: OUNIT=16

interface read_topo_file
module procedure read_topo_file_r4
module procedure read_topo_file_r8
end interface

contains

subroutine read_topo_file_r4(fname,output,grid,rc)
character(len=*), intent(in) :: fname
type(ESMF_Grid), intent(in) :: grid
real(real4), intent(inout) :: output(:,:)
integer, intent(out), optional :: rc

integer :: status,dims(3),funit
real, allocatable :: input(:,:)
call MAPL_GridGet(grid,globalCellCountPerDim=dims,_RC)
allocate(input(dims(1),dims(2)))
open(newunit=funit,file=trim(fname),form='unformatted',iostat=status)
_VERIFY(status)
read(funit)input
call ArrayScatter(local_array=output,global_array=input,grid=grid,_RC)
_RETURN(_SUCCESS)
end subroutine read_topo_file_r4

subroutine read_topo_file_r8(fname,output,grid,rc)
character(len=*), intent(in) :: fname
type(ESMF_Grid), intent(in) :: grid
real(real8), intent(inout) :: output(:,:)
integer, intent(out), optional :: rc

integer :: status,dims(3),funit
real, allocatable :: input(:,:)
real(real8), allocatable :: input_r8(:,:)
call MAPL_GridGet(grid,globalCellCountPerDim=dims,_RC)
allocate(input(dims(1),dims(2)),input_r8(dims(2),dims(2)))
open(newunit=funit,file=trim(fname),form='unformatted',iostat=status)
_VERIFY(status)
read(funit)input
input_r8 = input
call ArrayScatter(local_array=output,global_array=input_r8,grid=grid,_RC)
_RETURN(_SUCCESS)
end subroutine read_topo_file_r8

subroutine get_geos_ic( Atm, extra_rst, rstcube, gridOut)

Expand Down Expand Up @@ -1880,23 +1921,6 @@ end subroutine mpp_domain_decomp
!
! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ !
!-------------------------------------------------------------------------------

subroutine read_topo_file(fname,output,grid,rc)
character(len=*), intent(in) :: fname
type(ESMF_Grid), intent(in) :: grid
real(real4), intent(inout) :: output(:,:)
integer, intent(out), optional :: rc

integer :: status,dims(3),funit
real, allocatable :: input(:,:)
call MAPL_GridGet(grid,globalCellCountPerDim=dims,_RC)
allocate(input(dims(1),dims(2)))
open(newunit=funit,file=trim(fname),form='unformatted',iostat=status)
_VERIFY(status)
read(funit)input
call ArrayScatter(local_array=output,global_array=input,grid=grid,_RC)
_RETURN(_SUCCESS)
end subroutine read_topo_file

end module fv_regrid_c2c

6 changes: 3 additions & 3 deletions fv_regrid_c2c_bin.F90
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ subroutine get_geos_ic_bin( Atm, extra_rst, rstcube, gridOut)
if (extra_rst(i)%have_descriptor) then
do j=1,size(extra_rst(i)%vars)
if (extra_rst(i)%vars(j)%nLev/=1) then
allocate(extra_rst(i)%vars(j)%ptr3d(isd:ied,jsd:jed,extra_rst(i)%vars(j)%nLev),source=0.0 )
allocate(extra_rst(i)%vars(j)%ptr3d(isd:ied,jsd:jed,extra_rst(i)%vars(j)%nLev),source=0.0_FVPRC )
else
allocate(extra_rst(i)%vars(j)%ptr2d(isd:ied,jsd:jed), source=0.0 )
allocate(extra_rst(i)%vars(j)%ptr2d(isd:ied,jsd:jed), source=0.0_FVPRC )
end if
enddo
else
do j=1,size(extra_rst(i)%vars)
allocate(extra_rst(i)%vars(j)%ptr3d(isd:ied,jsd:jed,extra_rst(i)%vars(j)%nLev),source=0.0 )
allocate(extra_rst(i)%vars(j)%ptr3d(isd:ied,jsd:jed,extra_rst(i)%vars(j)%nLev),source=0.0_FVPRC )
enddo
end if
enddo
Expand Down
8 changes: 4 additions & 4 deletions fv_regridding_utils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,25 @@ subroutine alloc_var(this,is,ie,js,je,km,rc)
integer :: km_use

if (this%rank==2) then
allocate(this%ptr2d(is:ie,js:je),source=0.0)
allocate(this%ptr2d(is:ie,js:je),source=0.0_FVPRC)
else if (this%rank==3) then
if (this%n_ungrid > 0) then
allocate(this%ptr3d(is:ie,js:je,this%n_ungrid),source=0.0)
allocate(this%ptr3d(is:ie,js:je,this%n_ungrid),source=0.0_FVPRC)
else if (this%n_ungrid == 0) then
if (present(km)) then
km_use = km
else
km_use = this%nlev
end if
allocate(this%ptr3d(is:ie,js:je,km_use),source=0.0)
allocate(this%ptr3d(is:ie,js:je,km_use),source=0.0_FVPRC)
end if
else if (this%rank == 4) then
if (present(km)) then
km_use = km
else
km_use = this%nlev
end if
allocate(this%ptr4d(is:ie,js:je,km_use,this%n_ungrid),source=0.0)
allocate(this%ptr4d(is:ie,js:je,km_use,this%n_ungrid),source=0.0_FVPRC)
end if
_RETURN(_SUCCESS)

Expand Down

0 comments on commit 01f8e86

Please sign in to comment.