Skip to content

Commit

Permalink
Update icepack for new bgc
Browse files Browse the repository at this point in the history
- Refactor icepack_init_zbgc, leverage icepack_parameters for most arguments instead
- Update standalone icepack driver to be consistent with latest bgc changes
  • Loading branch information
apcraig committed Apr 18, 2024
1 parent c090b4b commit c1099ac
Show file tree
Hide file tree
Showing 8 changed files with 267 additions and 1,179 deletions.
28 changes: 16 additions & 12 deletions columnphysics/icepack_algae.F90
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ subroutine zbio (dt, nblyr, &
!change to inout when updating ocean fields
ocean_bio ! ocean concentrations (mmol/m^3)

real (kind=dbl_kind), dimension (nbtrcr), intent(out) :: &
real (kind=dbl_kind), optional, dimension (:), intent(out) :: &
!change to inout when updating ocean fields
ocean_bio_dh ! ocean concentrations * hbrine * phi (mmol/m^2)

Expand All @@ -208,13 +208,15 @@ subroutine zbio (dt, nblyr, &
PP_net , & ! net PP (mg C/m^2/d) times aice
grow_net , & ! net specific growth (m/d) times vice
upNO , & ! tot nitrate uptake rate (mmol/m^2/d) times aice
upNH , & ! tot ammonium uptake rate (mmol/m^2/d) times aice
upNH ! tot ammonium uptake rate (mmol/m^2/d) times aice

real (kind=dbl_kind), optional, intent(inout):: &
totalChla ! total chla (mg chla/m^2)

real (kind=dbl_kind), dimension (nblyr+1), intent(inout):: & ! diagnostics
bioPorosityIceCell , & ! porosity on vertical interface points
bioSalinityIceCell , & ! salinity on vertical interface points (ppt)
bioTemperatureIceCell ! temperature on vertical interface points (oC)
real (kind=dbl_kind), optional, dimension (nblyr+1), intent(inout):: & ! diagnostics
bioPorosityIceCell , & ! porosity on vertical interface points
bioSalinityIceCell , & ! salinity on vertical interface points (ppt)
bioTemperatureIceCell ! temperature on vertical interface points (oC)

logical (kind=log_kind), intent(in) :: &
first_ice ! initialized values should be used
Expand Down Expand Up @@ -265,6 +267,7 @@ subroutine zbio (dt, nblyr, &
write_flux_diag = .false.

call bgc_carbon_sum(nblyr, hbri_old, trcrn(:), carbonInitial,n_doc,n_dic,n_algae,n_don)
if (icepack_warnings_aborted(subname)) return

if (aice_old > puny) then
hsnow_i = vsno_old/aice_old
Expand Down Expand Up @@ -324,7 +327,9 @@ subroutine zbio (dt, nblyr, &
enddo

call bgc_carbon_sum(nblyr, hbri, trcrn(:), carbonFinal,n_doc,n_dic,n_algae,n_don)
if (icepack_warnings_aborted(subname)) return
call bgc_carbon_flux(flux_bio_atm,flux_bion,n_doc,n_dic,n_algae,n_don,carbonFlux)
if (icepack_warnings_aborted(subname)) return

carbonError = carbonInitial-carbonFlux*dt-carbonFinal

Expand Down Expand Up @@ -379,7 +384,6 @@ subroutine zbio (dt, nblyr, &
!call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
call icepack_warnings_add(subname//" zbio: Carbon conservation failure after z_biogeochemistry")
endif

if (icepack_warnings_aborted(subname)) return

if (write_flux_diag) then
Expand Down Expand Up @@ -408,7 +412,6 @@ subroutine zbio (dt, nblyr, &
enddo
endif
endif

if (icepack_warnings_aborted(subname)) return

call merge_bgc_fluxes (dt, nblyr, &
Expand Down Expand Up @@ -450,6 +453,7 @@ subroutine zbio (dt, nblyr, &
enddo
endif
endif
if (icepack_warnings_aborted(subname)) return

end subroutine zbio

Expand Down Expand Up @@ -645,6 +649,7 @@ subroutine skl_biogeochemistry (dt, &
rphi_sk = c1/phi_sk
PVt = c0
iTin = Tf
ice_growth = (congel-meltb)/dt

do nn = 1, nbtrcr
cinit (nn) = c0
Expand All @@ -666,7 +671,6 @@ subroutine skl_biogeochemistry (dt, &
cling (nn) = c1
endif

ice_growth = (congel-meltb)/dt
cinit (nn) = trcrn(bio_index(nn)) * sk_l * rphi_sk
cinit_v(nn) = cinit(nn)/sk_l
if (cinit(nn) < c0) then
Expand Down Expand Up @@ -908,7 +912,7 @@ subroutine z_biogeochemistry (n_cat, dt, &
ocean_bio , & ! ocean concentrations (mmol/m^3)
bphin ! Porosity on the bgrid

real (kind=dbl_kind), dimension (:), intent(out) :: &
real (kind=dbl_kind), optional, dimension (:), intent(out) :: &
ocean_bio_dh ! ocean concentrations * hbrine * phi (mmol/m^2)

real (kind=dbl_kind), intent(in) :: &
Expand Down Expand Up @@ -1053,7 +1057,7 @@ subroutine z_biogeochemistry (n_cat, dt, &
darcyV = c0
C_top(:) = c0
C_bot(:) = c0
ocean_bio_dh(:) = c0
if (present(ocean_bio_dh)) ocean_bio_dh(:) = c0
mobile(:) = c0
conserve_C(:) = .true.
nitrification(:) = c0
Expand Down Expand Up @@ -1177,7 +1181,7 @@ subroutine z_biogeochemistry (n_cat, dt, &
endif

C_bot(m) = ocean_bio(m)*hbri_old*iphin_N(nblyr+1)
ocean_bio_dh(m) = C_bot(m)
if (present(ocean_bio_dh)) ocean_bio_dh(m) = C_bot(m)

enddo ! m

Expand Down
4 changes: 3 additions & 1 deletion columnphysics/icepack_parameters.F90
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ subroutine icepack_init_parameters( &
bgc_flux_type_in, z_tracers_in, scale_bgc_in, solve_zbgc_in, &
modal_aero_in, use_macromolecules_in, restartbgc_in, skl_bgc_in, &
solve_zsal_in, grid_o_in, l_sk_in, &
grid_oS_in, l_skS_in, dEdd_algae_in, &
initbio_frac_in, grid_oS_in, l_skS_in, dEdd_algae_in, &
phi_snow_in, T_max_in, fsal_in, &
fr_resp_in, algal_vel_in, R_dFe2dust_in, dustFe_sol_in, &
op_dep_min_in, fr_graze_s_in, fr_graze_e_in, fr_mort2min_in, &
Expand Down Expand Up @@ -882,6 +882,7 @@ subroutine icepack_init_parameters( &
grid_o_in , & ! for bottom flux
l_sk_in , & ! characteristic diffusive scale (zsalinity) (m)
grid_o_t_in , & ! top grid point length scale
initbio_frac_in, & ! fraction of ocean tracer concentration used to initialize tracer
phi_snow_in ! snow porosity at the ice/snow interface

real (kind=dbl_kind), intent(in), optional :: &
Expand Down Expand Up @@ -1359,6 +1360,7 @@ subroutine icepack_init_parameters( &
if (present(l_sk_in) ) l_sk = l_sk_in
if (present(grid_o_t_in) ) grid_o_t = grid_o_t_in
if (present(frazil_scav_in) ) frazil_scav = frazil_scav_in
if (present(initbio_frac_in) ) initbio_frac = initbio_frac_in
if (present(grid_oS_in) ) grid_oS = grid_oS_in
if (present(l_skS_in) ) l_skS = l_skS_in
if (present(phi_snow_in) ) phi_snow = phi_snow_in
Expand Down
Loading

0 comments on commit c1099ac

Please sign in to comment.