Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UFS-dev PR#94 #122

Merged
merged 9 commits into from
Mar 15, 2024
24 changes: 15 additions & 9 deletions .github/workflows/GCC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:

steps:

- name: install-doxygen
run: |
sudo apt-get install doxygen graphviz

- name: checkout-fv3atm
uses: actions/checkout@v3
with:
Expand All @@ -37,7 +41,7 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/spack-develop
key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-2
key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-2-${{ matrix.cmake_opts }}-${{ matrix.mpich }}

# Building dependencies takes 40+ min
- name: spack-install
Expand All @@ -55,13 +59,6 @@ jobs:
spack concretize |& tee ${SPACK_ENV}/log.concretize
spack install -j2 --fail-fast

- name: cache-save
uses: actions/cache/save@v3
if: ${{ always() }}
with:
path: ${{ github.workspace }}/spack-develop
key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-2

- name: build-fv3atm
run: |
. ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh
Expand All @@ -71,13 +68,22 @@ jobs:
git clone https://github.com/NOAA-EMC/CMakeModules
git clone --recurse-submodules https://github.com/NOAA-PSL/stochastic_physics stochastic_physics_repo
mkdir ${GITHUB_WORKSPACE}/build
sed -i 's/doc /upp_doc /' upp/docs/CMakeLists.txt
cd ${GITHUB_WORKSPACE}/build
cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }}
cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON
make -j2
ls -l /home/runner/work/fv3atm/fv3atm/fv3atm/io

- uses: actions/upload-artifact@v3
with:
name: docs
path: |
build/docs/html

- name: debug-artifacts
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: ccpp_prebuild_logs
path: ${{ github.workspace }}/build/ccpp/ccpp_prebuild.*

6 changes: 4 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
branch = main
[submodule "ccpp/physics"]
path = ccpp/physics
url = https://github.com/NCAR/ccpp-physics
branch = main
#url = https://github.com/NCAR/ccpp-physics
#branch = main
url = https://github.com/grantfirl/ccpp-physics
branch = ufs-dev-PR94
[submodule "upp"]
path = upp
url = https://github.com/NOAA-EMC/UPP
Expand Down
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# This is the main CMake file for fv3atm.
#
# Dusan Jovic, Alex Richert
cmake_minimum_required(VERSION 3.19)

# Handle user build options.
option(ENABLE_DOCS "Enable generation of doxygen-based documentation." OFF)

# Determine whether or not to generate documentation.
if(ENABLE_DOCS)
find_package(Doxygen REQUIRED)
add_subdirectory(docs)
endif()

# Enable CI build & unit testing:
if(BUILD_TESTING)
cmake_minimum_required(VERSION 3.19)
project(fv3atm VERSION 1.0 LANGUAGES C CXX Fortran)
include(ci/CMakeLists.txt)
endif()
Expand Down
266 changes: 260 additions & 6 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2349,6 +2349,266 @@ subroutine assign_importdata(jdat, rc)
endif
endif

! get surface snow area fraction: over land (if cpllnd=true and cpllnd2atm=true)
!------------------------------------------------
fldname = 'inst_snow_area_fraction_lnd'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex) .and. GFS_control%cpllnd .and. GFS_control%cpllnd2atm) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%landfrac(ix) > zero) then
GFS_data(nb)%Coupling%sncovr1_lnd(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get snow area fraction from land'
endif
endif

! get latent heat flux: over land (if cpllnd=true and cpllnd2atm=true)
!------------------------------------------------
fldname = 'inst_laten_heat_flx_lnd'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex) .and. GFS_control%cpllnd .and. GFS_control%cpllnd2atm) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%landfrac(ix) > zero) then
GFS_data(nb)%Coupling%evap_lnd(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get latent heat flux from land'
endif
endif

! get sensible heat flux: over land (if cpllnd=true and cpllnd2atm=true)
!--------------------------------------------------
fldname = 'inst_sensi_heat_flx_lnd'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex) .and. GFS_control%cpllnd .and. GFS_control%cpllnd2atm) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%landfrac(ix) > zero) then
GFS_data(nb)%Coupling%hflx_lnd(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get sensible heat flux from land'
endif
endif

! get surface upward potential latent heat flux: over land (if cpllnd=true and cpllnd2atm=true)
!------------------------------------------------
fldname = 'inst_potential_laten_heat_flx_lnd'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex) .and. GFS_control%cpllnd .and. GFS_control%cpllnd2atm) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%landfrac(ix) > zero) then
GFS_data(nb)%Coupling%ep_lnd(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get potential latent heat flux from land'
endif
endif

! get 2m air temperature: over land (if cpllnd=true and cpllnd2atm=true)
!------------------------------------------------
fldname = 'inst_temp_height2m_lnd'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex) .and. GFS_control%cpllnd .and. GFS_control%cpllnd2atm) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%landfrac(ix) > zero) then
GFS_data(nb)%Coupling%t2mmp_lnd(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get temperature at 2m from land'
endif
endif

! get 2m specific humidity: over land (if cpllnd=true and cpllnd2atm=true)
!------------------------------------------------
fldname = 'inst_spec_humid_height2m_lnd'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex) .and. GFS_control%cpllnd .and. GFS_control%cpllnd2atm) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%landfrac(ix) > zero) then
GFS_data(nb)%Coupling%q2mp_lnd(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get specific humidity at 2m from land'
endif
endif

! get specific humidity: over land (if cpllnd=true and cpllnd2atm=true)
!------------------------------------------------
fldname = 'inst_spec_humid_lnd'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex) .and. GFS_control%cpllnd .and. GFS_control%cpllnd2atm) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%landfrac(ix) > zero) then
GFS_data(nb)%Coupling%qsurf_lnd(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get specific humidity from land'
endif
endif

! get upward heat flux in soil (if cpllnd=true and cpllnd2atm=true)
!------------------------------------------------
fldname = 'inst_upward_heat_flux_lnd'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex) .and. GFS_control%cpllnd .and. GFS_control%cpllnd2atm) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%landfrac(ix) > zero) then
GFS_data(nb)%Coupling%gflux_lnd(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get upward heat flux from land'
endif
endif

! get surface runoff in soil (if cpllnd=true and cpllnd2atm=true)
!------------------------------------------------
fldname = 'inst_runoff_rate_lnd'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex) .and. GFS_control%cpllnd .and. GFS_control%cpllnd2atm) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%landfrac(ix) > zero) then
GFS_data(nb)%Coupling%runoff_lnd(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get surface runoff from land'
endif
endif

! get subsurface runoff in soil (if cpllnd=true and cpllnd2atm=true)
!------------------------------------------------
fldname = 'inst_subsurface_runoff_rate_lnd'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex) .and. GFS_control%cpllnd .and. GFS_control%cpllnd2atm) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%landfrac(ix) > zero) then
GFS_data(nb)%Coupling%drain_lnd(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get subsurface runoff from land'
endif
endif

! get momentum exchange coefficient (if cpllnd=true and cpllnd2atm=true)
!------------------------------------------------
fldname = 'inst_drag_wind_speed_for_momentum'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex) .and. GFS_control%cpllnd .and. GFS_control%cpllnd2atm) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%landfrac(ix) > zero) then
GFS_data(nb)%Coupling%cmm_lnd(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get drag wind speed for momentum from land'
endif
endif

! get thermal exchange coefficient (if cpllnd=true and cpllnd2atm=true)
!------------------------------------------------
fldname = 'inst_drag_mass_flux_for_heat_and_moisture'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex) .and. GFS_control%cpllnd .and. GFS_control%cpllnd2atm) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%landfrac(ix) > zero) then
GFS_data(nb)%Coupling%chh_lnd(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get thermal exchange coefficient form land'
endif
endif

! get function of surface roughness length and green vegetation fraction (if cpllnd=true and cpllnd2atm=true)
!------------------------------------------------
fldname = 'inst_func_of_roughness_length_and_vfrac'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex) .and. GFS_control%cpllnd .and. GFS_control%cpllnd2atm) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%landfrac(ix) > zero) then
GFS_data(nb)%Coupling%zvfun_lnd(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get func. of roughness length and vfrac form land'
endif
endif

endif ! if (datar8(isc,jsc) > -99999.0) then

!-------------------------------------------------------
Expand Down Expand Up @@ -3072,12 +3332,6 @@ subroutine setup_exportdata(rc)
! bottom layer meridional wind (v)
case('inst_merid_wind_height_lowest')
call block_data_copy_or_fill(datar82d, DYCORE_data(nb)%coupling%v_bot, zeror8, Atm_block, nb, rc=localrc)
! bottom layer zonal wind (u) from physics
case('inst_zonal_wind_height_lowest_from_phys')
call block_data_copy_or_fill(datar82d, GFS_data(nb)%Statein%ugrs, 1, zeror8, Atm_block, nb, rc=localrc)
! bottom layer meridional wind (v) from physics
case('inst_merid_wind_height_lowest_from_phys')
call block_data_copy_or_fill(datar82d, GFS_data(nb)%Statein%vgrs, 1, zeror8, Atm_block, nb, rc=localrc)
! surface friction velocity
case('surface_friction_velocity')
call block_data_copy_or_fill(datar82d, GFS_data(nb)%Sfcprop%uustar, zeror8, Atm_block, nb, rc=localrc)
Expand Down
1 change: 1 addition & 0 deletions ccpp/config/ccpp_prebuild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
'physics/physics/SFC_Layer/UFS/sfc_nst_post.f90',
'physics/physics/SFC_Models/Land/RUC/lsm_ruc.F90',
'physics/physics/SFC_Models/SeaIce/CICE/sfc_cice.f',
'physics/physics/SFC_Models/Land/sfc_land.F90',
'physics/physics/SFC_Models/Land/Noah/lsm_noah.f',
'physics/physics/SFC_Models/Land/Noahmp/noahmpdrv.F90',
'physics/physics/SFC_Models/Lake/Flake/flake_driver.F90',
Expand Down
Loading