Skip to content

Commit

Permalink
Merge pull request #35 from spencerkclark/fix-qflux-prescription
Browse files Browse the repository at this point in the history
Fix prescribed Q-flux bug and improve user experience of SOM
  • Loading branch information
lharris4 authored Dec 20, 2023
2 parents 2c5f17c + f051c6a commit a0478a9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
28 changes: 26 additions & 2 deletions FV3GFS/FV3GFS_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3065,6 +3065,30 @@ subroutine register_diag_manager_controlled_diagnostics(Time, Sfcprop, IntDiag,
Diag_diag_manager_controlled(index)%data(nb)%var2 => Sfcprop(nb)%slmsk(:)
enddo

index = index + 1
Diag_diag_manager_controlled(index)%axes = 2
Diag_diag_manager_controlled(index)%name = 'mixed_layer_depth'
Diag_diag_manager_controlled(index)%desc = 'ocean mixed layer depth'
Diag_diag_manager_controlled(index)%unit = 'm'
Diag_diag_manager_controlled(index)%mod_name = 'gfs_phys'
Diag_diag_manager_controlled(index)%coarse_graining_method = AREA_WEIGHTED
allocate (Diag_diag_manager_controlled(index)%data(nblks))
do nb = 1,nblks
Diag_diag_manager_controlled(index)%data(nb)%var2 => Sfcprop(nb)%mld(:)
enddo

index = index + 1
Diag_diag_manager_controlled(index)%axes = 2
Diag_diag_manager_controlled(index)%name = 'prescribed_qflux'
Diag_diag_manager_controlled(index)%desc = 'prescribed ocean Q-flux'
Diag_diag_manager_controlled(index)%unit = 'W/m**2'
Diag_diag_manager_controlled(index)%mod_name = 'gfs_phys'
Diag_diag_manager_controlled(index)%coarse_graining_method = AREA_WEIGHTED
allocate (Diag_diag_manager_controlled(index)%data(nblks))
do nb = 1,nblks
Diag_diag_manager_controlled(index)%data(nb)%var2 => Sfcprop(nb)%qfluxadj(:)
enddo

do index = 1, DIAG_SIZE
if (trim(Diag_diag_manager_controlled(index)%name) .eq. '') exit ! No need to populate non-existent diagnostics
Diag_diag_manager_controlled(index)%id = register_diag_field(trim(Diag_diag_manager_controlled(index)%mod_name), &
Expand Down Expand Up @@ -7087,7 +7111,7 @@ subroutine gfdl_diag_register(Time, Sfcprop, Gfs_diag, Cldprop, &
idx = idx + 1
Diag(idx)%axes = 2
Diag(idx)%name = 'MLD'
Diag(idx)%desc = 'ocean mixed layer depth'
Diag(idx)%desc = 'Interval-average ocean mixed layer depth'
Diag(idx)%unit = 'm'
Diag(idx)%mod_name = 'gfs_phys'
Diag(idx)%cnvfac = cn_one
Expand Down Expand Up @@ -7236,7 +7260,7 @@ subroutine send_diag_manager_controlled_diagnostic_data(Time, Atm_block, IPD_Dat
ii = i + isc - 1
nb = Atm_block%blkno(ii,jj)
ix = Atm_block%ixp(ii,jj)
var2d(i,j) = Diag(index)%data(nb)%var2(ix)
var2d(i,j) = Diag_diag_manager_controlled(index)%data(nb)%var2(ix)
enddo
enddo
endif
Expand Down
10 changes: 8 additions & 2 deletions gsmphys/sfcsub.F
Original file line number Diff line number Diff line change
Expand Up @@ -7528,7 +7528,7 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil,
&, imsk, jmsk, slmskh, gaus,blno, blto
&, outlat, outlon, me)
if (me .eq. 0) write(6,*) 'climatological ocean
& mixed layer depth read in.'
& Q-flux read in.'
endif
!
Expand Down Expand Up @@ -7808,7 +7808,7 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil,
&, imsk, jmsk, slmskh, gaus,blno, blto
&, outlat, outlon, me)
if (me .eq. 0) write(6,*) 'climatological ocean
& mixed layer depth read in.'
& Q-flux read in.'

endif
!
Expand Down Expand Up @@ -8010,6 +8010,12 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil,
mldclm(i) = wei1m * mld(i,k1) + wei2m * mld(i,k2)
enddo
endif

if(fnqfluxc(1:8).ne.' ') then
do i=1,len
qfluxadj(i) = wei1m * qflux(i,k1) + wei2m * qflux(i,k2)
enddo
endif
!clu ----------------------------------------------------------------------
!
!cbosu diagnostic print
Expand Down
2 changes: 1 addition & 1 deletion gsmphys/som_mlm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ subroutine ocean_init &
! close (Model%nlunit)

#ifdef INTERNAL_FILE_NML
read(input_nml_file, nml=ocean_nml, iostat=ios)
read(input_nml_file, nml=ocean_nml)
#else
! print *,' in sfcsub nlunit=',nlunit,' me=',me,' ialb=',ialb
inquire (file=trim(Model%fn_nml), exist=exists)
Expand Down

0 comments on commit a0478a9

Please sign in to comment.