Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
14 changes: 8 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: 2.1

# Anchors in case we need to override the defaults from the orb
#baselibs_version: &baselibs_version v7.33.0
#bcs_version: &bcs_version v11.6.0
#baselibs_version: &baselibs_version v8.32.0
#bcs_version: &bcs_version v12.0.0

orbs:
ci: geos-esm/circleci-tools@4
ci: geos-esm/circleci-tools@5

workflows:
build-test:
Expand All @@ -17,11 +17,13 @@ workflows:
- docker-hub-creds
matrix:
parameters:
compiler: [ifort, gfortran]
# We cannot currently test with ifx because HDF4 Fortran interface
# cannot be compiled with ifx. The HDF4 Fortran interface is required
# for the GEOSldas
#compiler: [gfortran, ifort, ifx]
compiler: [gfortran, ifort]
#baselibs_version: *baselibs_version
repo: GEOSldas
checkout_fixture: true
mepodevelop: false
# This is needed due to the LDAS BRIDGE workflow
checkout_if_exists: false
persist_workspace: false # Needs to be true to run fv3/gcm experiment, costs extra
5 changes: 3 additions & 2 deletions .github/workflows/push-to-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ on:
jobs:
pull_request:
name: Create Pull Request
if: github.repository_owner == 'GEOS-ESM'
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Run the action
uses: devops-infra/action-pull-request@v0.5.5
uses: devops-infra/action-pull-request@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: develop
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate_yaml_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
validate-YAML:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- id: yaml-lint
name: yaml-lint
uses: ibiqlik/action-yamllint@v3
Expand All @@ -24,7 +24,7 @@ jobs:
format: colored
config_file: .yamllint.yml

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
if: always()
with:
name: yamllint-logfile
Expand Down
147 changes: 32 additions & 115 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,123 +11,40 @@ on:
- "**.perl"
- ".github/CODEOWNERS"
- ".circleci/config.yml"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}

jobs:
build_ldas_ifort:
name: Build GEOSldas with ifort
if: "!contains(github.event.pull_request.labels.*.name, '0 diff trivial')"
runs-on: ubuntu-24.04
container:
image: gmao/ubuntu24-geos-env:v7.33.0-intelmpi_2021.13-ifort_2021.13

env:
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
OMPI_MCA_btl_vader_single_copy_mechanism: none

steps:
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache

- name: Checkout LDAS
uses: actions/checkout@v4
with:
fetch-depth: 1
filter: blob:none
repository: GEOS-ESM/GEOSldas

- name: Set all directories as git safe
run: |
git config --global --add safe.directory '*'

- name: Versions etc.
run: |
ifort --version
mpirun --version
echo $BASEDIR

- name: Mepo clone external repos
run: |
mepo clone --partial blobless
mepo status

- name: Debug PR branch
run: echo "PR is coming from ${{ github.event.pull_request.head.ref }}"

- name: Update other branches
if: ${{ github.event.pull_request.head.ref != 'main' && github.event.pull_request.head.ref != 'develop' }}
run: |
mepo checkout-if-exists ${GITHUB_HEAD_REF}
mepo status

- name: CMake
run: |
cmake -B build -S . --install-prefix=${pwd}/install -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_BUILD_TYPE=Debug -DMPIEXEC_PREFLAGS='--oversubscribe' -DUSE_F2PY=OFF

- name: Build
run: |
cmake --build build -j 4
cmake --install build


build_ldas_gfortran:
name: Build GEOSldas with gfortran
if: "!contains(github.event.pull_request.labels.*.name, '0 diff trivial')"
runs-on: ubuntu-24.04
container:
image: gmao/ubuntu24-geos-env-mkl:v7.33.0-openmpi_5.0.5-gcc_14.2.0

env:
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
OMPI_MCA_btl_vader_single_copy_mechanism: none

steps:
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache

- name: Checkout LDAS
uses: actions/checkout@v4
with:
fetch-depth: 1
filter: blob:none
repository: GEOS-ESM/GEOSldas

- name: Set all directories as git safe
run: |
git config --global --add safe.directory '*'

- name: Versions etc.
run: |
gfortran --version
mpirun --version
echo $BASEDIR

- name: Mepo clone external repos
run: |
mepo clone --partial blobless
mepo status

- name: Debug PR branch
run: echo "PR is coming from ${{ github.event.pull_request.head.ref }}"

- name: Update other branches
if: ${{ github.event.pull_request.head.ref != 'main' && github.event.pull_request.head.ref != 'develop' }}
run: |
mepo checkout-if-exists ${GITHUB_HEAD_REF}
mepo status

- name: CMake
run: |
cmake -B build -S . --install-prefix=${pwd}/install -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_BUILD_TYPE=Debug -DMPIEXEC_PREFLAGS='--oversubscribe' -DUSE_F2PY=OFF

- name: Build
run: |
cmake --build build -j 4
cmake --install build
build_ldas:
strategy:
fail-fast: false
matrix:
# We cannot currently test with ifx because HDF4 Fortran interface
# cannot be compiled with ifx. The HDF4 Fortran interface is required
# for the GEOSldas
#compiler: [ifort, gfortran-15, ifx]
compiler: [ifort, gfortran-15]
build-type: [Debug]
uses: GEOS-ESM/CI-workflows/.github/workflows/geosgcm_build_tests.yml@project/geosgcm
with:
compiler: ${{ matrix.compiler }}
cmake-build-type: ${{ matrix.build-type }}
fixture-repo: GEOS-ESM/GEOSldas
run-mepo-develop: false

# We cannot currently test with spack because spack does not build the
# HDF4 Fortran interface, which is required for the GEOSldas.
#######################################################################################
# spack_build: #
# uses: GEOS-ESM/CI-workflows/.github/workflows/spack_gcc_build.yml@project/geosgcm #
# secrets: #
# BUILDCACHE_USERNAME: ${{ secrets.BUILDCACHE_USERNAME }} #
# BUILDCACHE_TOKEN: ${{ secrets.BUILDCACHE_TOKEN }} #
# with: #
# fixture-repo: GEOS-ESM/GEOSldas #
# run-mepo-develop: false #
# load-fms: true #
#######################################################################################
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ esma_add_library(${this}
SRCS GEOS_LdasGridComp.F90
SUBCOMPONENTS ${alldirs}
SUBDIRS LDAS_Shared
DEPENDENCIES GEOSland_GridComp GEOSlandice_GridComp GEOSroute_GridComp makebcs MAPL
DEPENDENCIES GEOSland_GridComp GEOSlake_GridComp GEOSlandice_GridComp GEOSroute_GridComp makebcs MAPL
INCLUDES ${INC_ESMF})

esma_add_subdirectory(GEOSldas_App)
55 changes: 50 additions & 5 deletions GEOS_LdasGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module GEOS_LdasGridCompMod
use GEOS_LandAssimGridCompMod, only: LandAssimSetServices => SetServices
use GEOS_LandiceGridCompMod, only: LandiceSetServices => SetServices
use GEOS_RouteGridCompMod, only: RouteSetServices => SetServices
use GEOS_LakeGridCompMod, only: LakeSetServices => SetServices

use GEOS_MetforceAvgGridCompMod, only: MetforceAvgSetServices => SetServices
use GEOS_LandAvgGridCompMod, only: LandAvgSetServices => SetServices
Expand Down Expand Up @@ -55,6 +56,7 @@ module GEOS_LdasGridCompMod

! All children
integer,allocatable :: LAND(:)
integer,allocatable :: LAKE(:)
integer,allocatable :: LANDICE(:)
integer,allocatable :: ROUTE(:)
integer,allocatable :: LANDPERT(:)
Expand All @@ -68,6 +70,7 @@ module GEOS_LdasGridCompMod
logical :: mwRTM
logical :: ensemble_forcing ! switch between deterministic and ensemble forcing
logical :: with_landice ! true if landice tiles requested by config
logical :: with_lake ! true if lake tiles requested by config
logical :: with_land ! true if land tiles requested by config
integer :: RUN_ROUTE ! 0:, no river routing, 1: routing w/o reservoirs, 2: routing w/ reservoirs

Expand Down Expand Up @@ -178,11 +181,15 @@ subroutine SetServices(gc, rc)

with_landice = .false.
with_land = .false.
! with_lake = .false.
with_lake = .false.

if (any(tile_types == MAPL_LANDICE)) with_landice = .true.
if (any(tile_types == MAPL_LAND )) with_land = .true.
! if (any(tile_types == MAPL_LAKE )) with_lake = .true.
if (any(tile_types == MAPL_LAKE )) with_lake = .true.

if (NUM_ENSEMBLE > 1 .and. with_lake) then
_ASSERT(.false., "Lake is not supported in ensemble mode.")
endif

call MAPL_GetResource ( MAPL, LAND_ASSIM_STR, Label="LAND_ASSIM:", DEFAULT="NO", RC=STATUS)
VERIFY_(STATUS)
Expand Down Expand Up @@ -214,6 +221,7 @@ subroutine SetServices(gc, rc)
endif

if (with_land) allocate(LAND( NUM_ENSEMBLE),LANDPERT(NUM_ENSEMBLE))
if (with_lake) allocate(LAKE( NUM_ENSEMBLE))
if (with_landice) allocate(LANDICE(NUM_ENSEMBLE))
if (RUN_ROUTE >= 1) then
_ASSERT( with_land, "RUNOFF must be from the export of land_gridcomp for now.")
Expand Down Expand Up @@ -261,6 +269,12 @@ subroutine SetServices(gc, rc)
VERIFY_(status)
endif

if (with_lake) then
childname = 'LAKE' // trim(ensid_string)
LAKE(i) = MAPL_AddChild(gc, name=childname, ss=LakeSetServices, rc=status)
VERIFY_(status)
endif

if (with_landice .and. i == 1) then
childname='LANDICE'//trim(ensid_string)
LANDICE(i) = MAPL_AddChild(gc, name=childname, ss=LandiceSetServices, rc=status)
Expand Down Expand Up @@ -416,6 +430,7 @@ subroutine Initialize(gc, import, export, clock, rc)
! MAPL variables
type(MAPL_LocStream) :: surf_locstream
type(MAPL_LocStream) :: land_locstream
type(MAPL_LocStream) :: lake_locstream
type(MAPL_LocStream) :: landice_locstream
type(MAPL_LocStream) :: force_locstream
type(MAPL_MetaComp), pointer :: MAPL=>null() ! GC's MAPL obj
Expand Down Expand Up @@ -606,8 +621,9 @@ subroutine Initialize(gc, import, export, clock, rc)
call MAPL_Get(MAPL, GCS=gcs, GCNAMES=gcnames, rc=status)
VERIFY_(status)

! Create LAND's locstreams as subset of Surface locstream
! Create component locstreams as subsets of Surface locstream
! and add it to the children's MAPL objects
! build the active forcing tile mask in tile-file order: LAND -> LAKE -> LANDICE.
allocate(mask(0))
if (with_land) then
call MAPL_LocStreamCreate( &
Expand All @@ -620,7 +636,16 @@ subroutine Initialize(gc, import, export, clock, rc)
VERIFY_(status)
mask =[mask,MAPL_LAND]
endif

if (with_lake) then
call MAPL_LocStreamCreate( &
lake_locstream, &
surf_locstream, &
name=gcnames(LAKE(1)), &
mask=[MAPL_LAKE], &
rc=status )
VERIFY_(status)
mask = [mask, MAPL_LAKE]
endif
if (with_landice) then
call MAPL_LocStreamCreate( &
landice_locstream, &
Expand Down Expand Up @@ -806,7 +831,13 @@ subroutine Initialize(gc, import, export, clock, rc)
call ESMF_UserCompSetInternalState(gcs(LANDPERT(i)), 'TILE_COORD', tcwrap, status)
VERIFY_(status)
endif

if (with_lake) then
call MAPL_GetObjectFromGC(gcs(LAKE(i)), CHILD_MAPL, rc=status)
VERIFY_(status)

call MAPL_Set(CHILD_MAPL, LocStream=lake_locstream, rc=status)
VERIFY_(status)
endif
if (with_landice .and. i == 1) then
call MAPL_GetObjectFromGC(gcs(LANDICE(i)), CHILD_MAPL, rc=status)
VERIFY_(status)
Expand Down Expand Up @@ -1026,6 +1057,10 @@ subroutine Run(gc, import, export, clock, rc)
call ESMF_GridCompRun(gcs(igc), importState=gex(igc), exportState=gim(LANDICE(i)), clock=clock, phase=4, userRC=status)
VERIFY_(status)
endif
if (with_lake) then
call ESMF_GridCompRun(gcs(igc), importState=gex(igc), exportState=gim(LAKE(i)), clock=clock, phase=5, userRC=status)
VERIFY_(status)
endif
call MAPL_TimerOff(MAPL, gcnames(igc))
enddo

Expand Down Expand Up @@ -1070,6 +1105,16 @@ subroutine Run(gc, import, export, clock, rc)
call MAPL_TimerOff(MAPL, gcnames(igc))
endif ! with_land_ice

if (with_lake) then
igc = LAKE(i)
call MAPL_TimerOn(MAPL, gcnames(igc))
call ESMF_GridCompRun(gcs(igc), importState=gim(igc), exportState=gex(igc), clock=clock, phase=1, userRC=status)
VERIFY_(status)
call ESMF_GridCompRun(gcs(igc), importState=gim(igc), exportState=gex(igc), clock=clock, phase=2, userRC=status)
VERIFY_(status)
call MAPL_TimerOff(MAPL, gcnames(igc))
endif ! with_lake

if ( RUN_ROUTE >= 1 ) then
igc = ROUTE(i)
call MAPL_TimerOn(MAPL, gcnames(igc))
Expand Down
Loading
Loading