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

Change compiling flag for hydrostatic options #828

Merged
merged 8 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "atmos_cubed_sphere"]
path = atmos_cubed_sphere
url = https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere
branch = dev/emc
url = https://github.com/XiaqiongZhou-NOAA/GFDL_atmos_cubed_sphere
branch = hydro
[submodule "ccpp/framework"]
path = ccpp/framework
url = https://github.com/NCAR/ccpp-framework
Expand Down
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ set(USE_GFSL63 ON)
if(MOVING_NEST)
set(MOVING_NEST ON)
endif()
if(HYDRO)
set(HYDRO ON)
endif()
add_subdirectory(atmos_cubed_sphere)
target_compile_definitions(fv3 PRIVATE BYPASS_BREED_SLP_INLINE)

Expand All @@ -61,7 +64,11 @@ if(NOT PARALLEL_NETCDF)
endif()

if(MOVING_NEST)
list(APPEND _fv3atm_defs_private MOVING_NEST MOIST_CAPPA USE_COND)
list(APPEND _fv3atm_defs_private MOVING_NEST)
if(NOT HYDRO)
list(APPEND _fv3atm_defs_private MOIST_CAPPA USE_COND)
endif()

if(DEBUG)
list(APPEND _fv3atm_defs_private DEBUG)
endif()
Expand Down
2 changes: 1 addition & 1 deletion atmos_cubed_sphere
6 changes: 4 additions & 2 deletions ccpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ endif(CCPP_32BIT)

#------------------------------------------------------------------------------
# Add model-specific flags for C/C++/Fortran preprocessor
add_definitions(-DMOIST_CAPPA -DUSE_COND -DNEMS_GSM)
add_definitions(-DINTERNAL_FILE_NML)
if(NOT HYDRO)
add_definitions(-DMOIST_CAPPA -DUSE_COND -DNEMS_GSM)
endif()
add_definitions(-DINTERNAL_FILE_NML -DNEMS_GSM)

if(MULTI_GASES)
add_definitions(-DMULTI_GASES)
Expand Down
52 changes: 36 additions & 16 deletions io/post_fv3.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3564,6 +3564,19 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp)
enddo
endif

! model level omga
if(trim(fieldname)=='omga') then
!$omp parallel do default(none) private(i,j,l) shared(lm,jsta,jend,ista,iend,omga,arrayr43d,fillvalue,spval)
do l=1,lm
do j=jsta,jend
do i=ista, iend
omga(i,j,l) = arrayr43d(i,j,l)
if(abs(arrayr43d(i,j,l)-fillvalue)<small) omga(i,j,l) = spval
enddo
enddo
enddo
endif

! soilt
if(trim(fieldname)=='soilt') then
!$omp parallel do default(none) private(i,j,l) shared(nsoil,jsta,jend,ista,iend,stc,arrayr43d,sm,sice,fillvalue,spval)
Expand Down Expand Up @@ -4268,22 +4281,6 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp)
enddo
enddo

do l=lm,1,-1
!$omp parallel do default(none) private(i,j) shared(l,jsta,jend,omga,wh,dpres,zint,spval,ista,iend)
do j=jsta,jend
do i=ista,iend
if(wh(i,j,l) /= spval) then
omga(i,j,l) = (-1.) * wh(i,j,l) * dpres(i,j,l)/zint(i,j,l)
zint(i,j,l) = zint(i,j,l) + zint(i,j,l+1)
else
omga(i,j,l) = spval
zint(i,j,l) = spval
endif
enddo
enddo
enddo
! print *,'in post_lam,omga 3d=',maxval(omga(ista:iend,jsta:jend,1)),minval(omga(ista:iend,jsta:jend,1)), &
! 'lm=',maxval(omga(ista:iend,jsta:jend,lm)),minval(omga(ista:iend,jsta:jend,lm))

! compute pint from top down
!$omp parallel do default(none) private(i,j) shared(jsta,jend,ak5,pint,ista,iend)
Expand Down Expand Up @@ -4343,6 +4340,28 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp)
end do
end do

do l=lm,1,-1
!$omp parallel do default(none) private(i,j) shared(l,jsta,jend,omga,wh,dpres,zint,alpint,q,t,spval,ista,iend)
do j=jsta,jend
do i=ista,iend
if(wh(i,j,l) /= spval) then
if (omga(i,j,l) == spval .and. dpres(i,j,l) /= spval .and. zint(i,j,l) /=spval) &
omga(i,j,l) = (-1.) * wh(i,j,l) * dpres(i,j,l)/zint(i,j,l)
zint(i,j,l) = zint(i,j,l) + zint(i,j,l+1)
DusanJovic-NOAA marked this conversation as resolved.
Show resolved Hide resolved
else
if(zint(i,j,l+1) /=spval .and. t(i,j,l) /= spval .and. alpint(i,j,l+1) /= spval &
.and. alpint(i,j,l) /=spval .and. q(i,j,l) /= spval) then
zint(i,j,l) = zint(i,j,l+1)+(rgas/grav)*t(i,j,l)*(1.+fv*q(i,j,l))*(alpint(i,j,l+1)-alpint(i,j,l))
else
zint(i,j,l) = spval
endif
endif
enddo
enddo
enddo
! print *,'in post_lam,omga 3d=',maxval(omga(ista:iend,jsta:jend,1)),minval(omga(ista:iend,jsta:jend,1)), &
! 'lm=',maxval(omga(ista:iend,jsta:jend,lm)),minval(omga(ista:iend,jsta:jend,lm))

! compute zmid
do l=lm,1,-1
!$omp parallel do default(none) private(i,j) shared(l,jsta,jend,zmid,zint,pmid,alpint,spval,ista,iend)
Expand All @@ -4359,6 +4378,7 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp)
end do
end do


! surface potential T, and potential T at roughness length
!$omp parallel do default(none) private(i,j) shared(jsta,jend,ista,iend,spval,lp1,sm,ths,sst,thz0,sice,pint)
do j=jsta,jend
Expand Down