Skip to content

Commit

Permalink
Merge pull request #315 from NorESMhub/feature-hamocc_beyond-CMIP6
Browse files Browse the repository at this point in the history
Breaking CMIP6 backward compatibility through bugfixes - iHAMOCC ready for NorESM2.1
  • Loading branch information
jmaerz authored Nov 21, 2023
2 parents 26793d2 + 0196525 commit cca8d11
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 86 deletions.
26 changes: 13 additions & 13 deletions hamocc/mo_aufr_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ subroutine aufr_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,kplyear,kplmon,kplday,o
use mo_vgrid, only: kbo
use mo_sedmnt, only: sedhpl
use mo_intfcblom, only: sedlay2,powtra2,burial2,atm2
use mo_param_bgc, only: bifr13,bifr14,c14fac,re1312,re14to,prei13,prei14
use mo_param_bgc, only: bifr13_ini,bifr14_ini,c14fac,re1312,re14to,prei13,prei14
use mo_netcdf_bgcrw, only: read_netcdf_var

! Arguments
Expand Down Expand Up @@ -518,14 +518,14 @@ subroutine aufr_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,kplyear,kplmon,kplday,o
! Initialise the remaining 13C and 14C fields, using the restart isco212 field
rco213=locetra(i,j,k,isco213)/(locetra(i,j,k,isco212)+safediv)
rco214=locetra(i,j,k,isco214)/(locetra(i,j,k,isco212)+safediv)
locetra(i,j,k,idoc13)=locetra(i,j,k,idoc)*rco213*bifr13
locetra(i,j,k,idoc14)=locetra(i,j,k,idoc)*rco214*bifr14
locetra(i,j,k,iphy13)=locetra(i,j,k,iphy)*rco213*bifr13
locetra(i,j,k,iphy14)=locetra(i,j,k,iphy)*rco214*bifr14
locetra(i,j,k,izoo13)=locetra(i,j,k,izoo)*rco213*bifr13
locetra(i,j,k,izoo14)=locetra(i,j,k,izoo)*rco214*bifr14
locetra(i,j,k,idet13)=locetra(i,j,k,idet)*rco213*bifr13
locetra(i,j,k,idet14)=locetra(i,j,k,idet)*rco214*bifr14
locetra(i,j,k,idoc13)=locetra(i,j,k,idoc)*rco213*bifr13_ini
locetra(i,j,k,idoc14)=locetra(i,j,k,idoc)*rco214*bifr14_ini
locetra(i,j,k,iphy13)=locetra(i,j,k,iphy)*rco213*bifr13_ini
locetra(i,j,k,iphy14)=locetra(i,j,k,iphy)*rco214*bifr14_ini
locetra(i,j,k,izoo13)=locetra(i,j,k,izoo)*rco213*bifr13_ini
locetra(i,j,k,izoo14)=locetra(i,j,k,izoo)*rco214*bifr14_ini
locetra(i,j,k,idet13)=locetra(i,j,k,idet)*rco213*bifr13_ini
locetra(i,j,k,idet14)=locetra(i,j,k,idet)*rco214*bifr14_ini
locetra(i,j,k,icalc13)=locetra(i,j,k,icalc)*rco213
locetra(i,j,k,icalc14)=locetra(i,j,k,icalc)*rco214
endif
Expand All @@ -542,8 +542,8 @@ subroutine aufr_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,kplyear,kplmon,kplday,o
rco214=locetra(i,j,kbo(i,j),isco214)/(locetra(i,j,kbo(i,j),isco212)+safediv)
powtra2(i,j,k,ipowc13)=powtra2(i,j,k,ipowaic)*rco213
powtra2(i,j,k,ipowc14)=powtra2(i,j,k,ipowaic)*rco214
sedlay2(i,j,k,issso13)=sedlay2(i,j,k,issso12)*rco213*bifr13
sedlay2(i,j,k,issso14)=sedlay2(i,j,k,issso12)*rco214*bifr14
sedlay2(i,j,k,issso13)=sedlay2(i,j,k,issso12)*rco213*bifr13_ini
sedlay2(i,j,k,issso14)=sedlay2(i,j,k,issso12)*rco214*bifr14_ini
sedlay2(i,j,k,isssc13)=sedlay2(i,j,k,isssc12)*rco213
sedlay2(i,j,k,isssc14)=sedlay2(i,j,k,isssc12)*rco214
endif
Expand All @@ -557,8 +557,8 @@ subroutine aufr_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,kplyear,kplmon,kplday,o
if(omask(i,j) > 0.5) then
rco213=locetra(i,j,kbo(i,j),isco213)/(locetra(i,j,kbo(i,j),isco212)+safediv)
rco214=locetra(i,j,kbo(i,j),isco214)/(locetra(i,j,kbo(i,j),isco212)+safediv)
burial2(i,j,k,issso13)=burial2(i,j,k,issso12)*rco213*bifr13
burial2(i,j,k,issso14)=burial2(i,j,k,issso12)*rco214*bifr14
burial2(i,j,k,issso13)=burial2(i,j,k,issso12)*rco213*bifr13_ini
burial2(i,j,k,issso14)=burial2(i,j,k,issso12)*rco214*bifr14_ini
burial2(i,j,k,isssc13)=burial2(i,j,k,isssc12)*rco213
burial2(i,j,k,isssc14)=burial2(i,j,k,isssc12)*rco214
endif
Expand Down
3 changes: 0 additions & 3 deletions hamocc/mo_biomod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ module mo_biomod
real, dimension (:,:), allocatable, public :: int_chbr3_prod
real, dimension (:,:), allocatable, public :: int_chbr3_uv

real, public :: growth_co2
real, public :: bifr13_perm

CONTAINS

subroutine alloc_mem_biomod(kpie,kpje,kpke)
Expand Down
6 changes: 3 additions & 3 deletions hamocc/mo_carchm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ subroutine carchm(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,prho,pglat,omask,psicomo
!$OMP ,kwco2,kwdms,kwo2,atco2,ato2,atn2,fluxd,fluxu,oxflux,tc_sat &
!$OMP ,niflux,n2oflux,dmsflux,omega,supsat,undsa,dissol &
!$OMP ,sch_11,sch_12,sch_sf,kw_11,kw_12,kw_sf,a_11,a_12,a_sf,flx11 &
!$OMP ,flx12,flxsf,atm_cfc11,atm_cfc12,atm_sf6 &
!$OMP ,flx12,flxsf,atm_cfc11,atm_cfc12,atm_sf6,fact &
!$OMP ,natcu,natcb,natcc,natpco2,natfluxd,natfluxu,natomega &
!$OMP ,natsupsat,natundsa,natdissol &
!$OMP ,atco213,atco214,rco213,rco214,pco213,pco214,frac_aqg &
!$OMP ,frac_dicg,flux13d,flux13u,flux14d,flux14u,dissol13,dissol14 &
!$OMP ,flx_bromo,sch_bromo,kw_bromo,a_bromo,atbrf,Kb1,lsub &
!$OMP ,j,i)
!$OMP ,k,j,i,rrho,scn2,scn2o,kwn2,kwn2o)
do k=1,kpke
do j=1,kpje
do i=1,kpie
Expand Down Expand Up @@ -572,7 +572,7 @@ subroutine carchm(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,prho,pglat,omask,psicomo
! C14 decay in the sediment (could be moved to sediment part)
if (use_cisonew .and. .not. use_sedbypass) then
do k=1,ks
!$OMP PARALLEL DO PRIVATE(i)
!$OMP PARALLEL DO PRIVATE(i,j)
do j=1,kpje
do i=1,kpie
if(omask(i,j).gt.0.5) then
Expand Down
4 changes: 2 additions & 2 deletions hamocc/mo_dipowa.F90
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ subroutine dipowa(kpie,kpje,kpke,omask,lspin)
real :: tredsy(kpie,0:kpke,3) ! redsy for 'reduced system'?
real :: aprior ! start value of oceanic tracer in bottom layer

!$OMP PARALLEL DO &
!$OMP&PRIVATE(i,k,iv,l,tredsy,sedb1,aprior,iv_oc)
!$OMP PARALLEL DO PRIVATE(i,k,iv,l,tredsy,sedb1,aprior,iv_oc)
j_loop: do j=1,kpje

k = 0
Expand Down Expand Up @@ -182,6 +181,7 @@ subroutine dipowa(kpie,kpje,kpke,omask,lspin)
endif ! .not. lspin

enddo j_loop
!$OMP END PARALLEL DO

end subroutine dipowa

Expand Down
26 changes: 13 additions & 13 deletions hamocc/mo_ini_fields.F90
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ subroutine ini_fields_ocean(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask,pglon,pg
!***********************************************************************************************

use mo_carbch, only: co2star,co3,hi,ocetra
use mo_param_bgc, only: fesoly,cellmass,fractdim,bifr13,bifr14,c14fac,re1312,re14to
use mo_param_bgc, only: fesoly,cellmass,fractdim,bifr13_ini,bifr14_ini,c14fac,re1312,re14to
use mo_biomod, only: abs_oce
use mo_control_bgc, only: rmasks,use_FB_BGC_OCE,use_cisonew,use_AGG,use_CFC,use_natDIC, &
use_BROMO, use_sedbypass
Expand Down Expand Up @@ -213,14 +213,14 @@ subroutine ini_fields_ocean(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask,pglon,pg
if (use_cisonew) then
rco213=ocetra(i,j,k,isco213)/(ocetra(i,j,k,isco212)+safediv)
rco214=ocetra(i,j,k,isco214)/(ocetra(i,j,k,isco212)+safediv)
ocetra(i,j,k,iphy13) =ocetra(i,j,k,iphy)*rco213*bifr13
ocetra(i,j,k,iphy14) =ocetra(i,j,k,iphy)*rco214*bifr14
ocetra(i,j,k,izoo13) =ocetra(i,j,k,izoo)*rco213*bifr13
ocetra(i,j,k,izoo14) =ocetra(i,j,k,izoo)*rco214*bifr14
ocetra(i,j,k,idoc13) =ocetra(i,j,k,idoc)*rco213*bifr13
ocetra(i,j,k,idoc14) =ocetra(i,j,k,idoc)*rco214*bifr14
ocetra(i,j,k,idet13) =ocetra(i,j,k,idet)*rco213*bifr13
ocetra(i,j,k,idet14) =ocetra(i,j,k,idet)*rco214*bifr14
ocetra(i,j,k,iphy13) =ocetra(i,j,k,iphy)*rco213*bifr13_ini
ocetra(i,j,k,iphy14) =ocetra(i,j,k,iphy)*rco214*bifr14_ini
ocetra(i,j,k,izoo13) =ocetra(i,j,k,izoo)*rco213*bifr13_ini
ocetra(i,j,k,izoo14) =ocetra(i,j,k,izoo)*rco214*bifr14_ini
ocetra(i,j,k,idoc13) =ocetra(i,j,k,idoc)*rco213*bifr13_ini
ocetra(i,j,k,idoc14) =ocetra(i,j,k,idoc)*rco214*bifr14_ini
ocetra(i,j,k,idet13) =ocetra(i,j,k,idet)*rco213*bifr13_ini
ocetra(i,j,k,idet14) =ocetra(i,j,k,idet)*rco214*bifr14_ini
ocetra(i,j,k,icalc13)=ocetra(i,j,k,icalc)*rco213
ocetra(i,j,k,icalc14)=ocetra(i,j,k,icalc)*rco214
endif
Expand Down Expand Up @@ -268,10 +268,10 @@ subroutine ini_fields_ocean(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask,pglon,pg
if (use_cisonew) then
rco213=ocetra(i,j,kbo(i,j),isco213)/(ocetra(i,j,kbo(i,j),isco212)+safediv)
rco214=ocetra(i,j,kbo(i,j),isco214)/(ocetra(i,j,kbo(i,j),isco212)+safediv)
powtra(i,j,k,ipowc13)=powtra(i,j,k,ipowaic)*rco213*bifr13
powtra(i,j,k,ipowc14)=powtra(i,j,k,ipowaic)*rco214*bifr14
sedlay(i,j,k,issso13)=sedlay(i,j,k,issso12)*rco213*bifr13
sedlay(i,j,k,issso14)=sedlay(i,j,k,issso12)*rco214*bifr14
powtra(i,j,k,ipowc13)=powtra(i,j,k,ipowaic)*rco213*bifr13_ini
powtra(i,j,k,ipowc14)=powtra(i,j,k,ipowaic)*rco214*bifr14_ini
sedlay(i,j,k,issso13)=sedlay(i,j,k,issso12)*rco213*bifr13_ini
sedlay(i,j,k,issso14)=sedlay(i,j,k,issso12)*rco214*bifr14_ini
sedlay(i,j,k,isssc13)=sedlay(i,j,k,isssc12)*rco213
sedlay(i,j,k,isssc14)=sedlay(i,j,k,isssc12)*rco214
endif
Expand Down
40 changes: 33 additions & 7 deletions hamocc/mo_intfcblom.F90
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ subroutine blom2hamocc(m,n,mm,nn)
! --- calculate pressure at interfaces (necesarry since p has
! --- not been calculated at restart)

!$OMP PARALLEL DO PRIVATE(k,kn,l,i)
do k=1,kk
kn=k+nn
do j=1,jj
Expand All @@ -235,7 +234,6 @@ subroutine blom2hamocc(m,n,mm,nn)
enddo
enddo
enddo
!$OMP END PARALLEL DO

! --- ------------------------------------------------------------------
! --- 2D fields
Expand Down Expand Up @@ -334,13 +332,22 @@ subroutine blom2hamocc(m,n,mm,nn)
do i=max(1,ifp(j,l)),min(ii,ilp(j,l))
sedlay(i,j,k,:) = sedlay2(i,j,kn,:)
powtra(i,j,k,:) = powtra2(i,j,kn,:)
burial(i,j,:) = burial2(i,j,n,:)
enddo
enddo
enddo
enddo
!$OMP END PARALLEL DO

!$OMP PARALLEL DO PRIVATE(l,i)
do j=1,jj
do l=1,isp(j)
do i=max(1,ifp(j,l)),min(ii,ilp(j,l))
burial(i,j,:) = burial2(i,j,n,:)
enddo
enddo
enddo
!$OMP END PARALLEL DO

endif

! --- ------------------------------------------------------------------
Expand Down Expand Up @@ -436,15 +443,25 @@ subroutine hamocc2blom(m,n,mm,nn)
powtra2(i,j,km,:) = wts1*powtra2(i,j,km,:) &
& + wts2*powtra2(i,j,kn,:) &
& + wts2*powtra(i,j,k,:)
burial2(i,j,m,:) = wts1*burial2(i,j,m,:) &
& + wts2*burial2(i,j,n,:) &
& + wts2*burial(i,j,:)
enddo
enddo
enddo
enddo
!$OMP END PARALLEL DO


!$OMP PARALLEL DO PRIVATE(l,i)
do j=1,jj
do l=1,isp(j)
do i=max(1,ifp(j,l)),min(ii,ilp(j,l)) ! time smoothing (analog to tmsmt2.F)
burial2(i,j,m,:) = wts1*burial2(i,j,m,:) &
+ wts2*burial2(i,j,n,:) &
+ wts2*burial(i,j,:)
enddo
enddo
enddo
!$OMP END PARALLEL DO

!$OMP PARALLEL DO PRIVATE(k,kn,l,i)
do k=1,ks
kn=k+nns
Expand All @@ -453,13 +470,22 @@ subroutine hamocc2blom(m,n,mm,nn)
do i=max(1,ifp(j,l)),min(ii,ilp(j,l))
sedlay2(i,j,kn,:) = sedlay(i,j,k,:) ! new time level replaces old time level here
powtra2(i,j,kn,:) = powtra(i,j,k,:)
burial2(i,j,n,:) = burial(i,j,:)
enddo
enddo
enddo
enddo
!$OMP END PARALLEL DO

!$OMP PARALLEL DO PRIVATE(l,i)
do j=1,jj
do l=1,isp(j)
do i=max(1,ifp(j,l)),min(ii,ilp(j,l))
burial2(i,j,n,:) = burial(i,j,:)
enddo
enddo
enddo
!$OMP END PARALLEL DO

endif ! .not. use_sedbypass

! --- ------------------------------------------------------------------
Expand Down
Loading

0 comments on commit cca8d11

Please sign in to comment.