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

Check if fluxes%salt_flux is associated #301

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Changes from all 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
110 changes: 56 additions & 54 deletions src/tracer/MARBL_tracers.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1392,67 +1392,69 @@ subroutine MARBL_tracers_column_physics(h_old, h_new, ea, eb, fluxes, dt, G, GV,
enddo
enddo

! convert salt flux to tracer fluxes and add to STF
do j=js,je ; do i=is,ie
net_salt_rate(i,j) = (1000.0*US%ppt_to_S * fluxes%salt_flux(i,j)) * GV%RZ_to_H
enddo ; enddo

! DIC related tracers
do j=js,je ; do i=is,ie
flux_from_salt_flux(i,j) = (CS%DIC_salt_ratio * GV%H_to_Z) * net_salt_rate(i,j)
enddo ; enddo
m = CS%tracer_inds%dic_ind
if (m > 0) then
if (associated(fluxes%salt_flux)) then
! convert salt flux to tracer fluxes and add to STF
do j=js,je ; do i=is,ie
CS%STF(i,j,m) = CS%STF(i,j,m) + flux_from_salt_flux(i,j)
net_salt_rate(i,j) = (1000.0*US%ppt_to_S * fluxes%salt_flux(i,j)) * GV%RZ_to_H
enddo ; enddo
if (CS%id_surface_flux_from_salt_flux(m) > 0) &
call post_data(CS%id_surface_flux_from_salt_flux(m), flux_from_salt_flux, CS%diag)
endif
m = CS%tracer_inds%dic_alt_co2_ind
if (m > 0) then
do j=js,je ; do i=is,ie
CS%STF(i,j,m) = CS%STF(i,j,m) + flux_from_salt_flux(i,j)
enddo ; enddo
if (CS%id_surface_flux_from_salt_flux(m) > 0) &
call post_data(CS%id_surface_flux_from_salt_flux(m), flux_from_salt_flux, CS%diag)
endif
m = CS%tracer_inds%abio_dic_ind
if (m > 0) then
do j=js,je ; do i=is,ie
CS%STF(i,j,m) = CS%STF(i,j,m) + flux_from_salt_flux(i,j)
enddo ; enddo
if (CS%id_surface_flux_from_salt_flux(m) > 0) &
call post_data(CS%id_surface_flux_from_salt_flux(m), flux_from_salt_flux, CS%diag)
endif
m = CS%tracer_inds%abio_di14c_ind
if (m > 0) then
do j=js,je ; do i=is,ie
CS%STF(i,j,m) = CS%STF(i,j,m) + flux_from_salt_flux(i,j)
enddo ; enddo
if (CS%id_surface_flux_from_salt_flux(m) > 0) &
call post_data(CS%id_surface_flux_from_salt_flux(m), flux_from_salt_flux, CS%diag)
endif

! ALK related tracers
do j=js,je ; do i=is,ie
flux_from_salt_flux(i,j) = (CS%ALK_salt_ratio * GV%H_to_Z) * net_salt_rate(i,j)
enddo ; enddo
m = CS%tracer_inds%alk_ind
if (m > 0) then
! DIC related tracers
do j=js,je ; do i=is,ie
CS%STF(i,j,m) = CS%STF(i,j,m) + flux_from_salt_flux(i,j)
flux_from_salt_flux(i,j) = (CS%DIC_salt_ratio * GV%H_to_Z) * net_salt_rate(i,j)
enddo ; enddo
if (CS%id_surface_flux_from_salt_flux(m) > 0) &
call post_data(CS%id_surface_flux_from_salt_flux(m), flux_from_salt_flux, CS%diag)
endif
m = CS%tracer_inds%alk_alt_co2_ind
if (m > 0) then
m = CS%tracer_inds%dic_ind
if (m > 0) then
do j=js,je ; do i=is,ie
CS%STF(i,j,m) = CS%STF(i,j,m) + flux_from_salt_flux(i,j)
enddo ; enddo
if (CS%id_surface_flux_from_salt_flux(m) > 0) &
call post_data(CS%id_surface_flux_from_salt_flux(m), flux_from_salt_flux, CS%diag)
endif
m = CS%tracer_inds%dic_alt_co2_ind
if (m > 0) then
do j=js,je ; do i=is,ie
CS%STF(i,j,m) = CS%STF(i,j,m) + flux_from_salt_flux(i,j)
enddo ; enddo
if (CS%id_surface_flux_from_salt_flux(m) > 0) &
call post_data(CS%id_surface_flux_from_salt_flux(m), flux_from_salt_flux, CS%diag)
endif
m = CS%tracer_inds%abio_dic_ind
if (m > 0) then
do j=js,je ; do i=is,ie
CS%STF(i,j,m) = CS%STF(i,j,m) + flux_from_salt_flux(i,j)
enddo ; enddo
if (CS%id_surface_flux_from_salt_flux(m) > 0) &
call post_data(CS%id_surface_flux_from_salt_flux(m), flux_from_salt_flux, CS%diag)
endif
m = CS%tracer_inds%abio_di14c_ind
if (m > 0) then
do j=js,je ; do i=is,ie
CS%STF(i,j,m) = CS%STF(i,j,m) + flux_from_salt_flux(i,j)
enddo ; enddo
if (CS%id_surface_flux_from_salt_flux(m) > 0) &
call post_data(CS%id_surface_flux_from_salt_flux(m), flux_from_salt_flux, CS%diag)
endif

! ALK related tracers
do j=js,je ; do i=is,ie
CS%STF(i,j,m) = CS%STF(i,j,m) + flux_from_salt_flux(i,j)
flux_from_salt_flux(i,j) = (CS%ALK_salt_ratio * GV%H_to_Z) * net_salt_rate(i,j)
enddo ; enddo
if (CS%id_surface_flux_from_salt_flux(m) > 0) &
call post_data(CS%id_surface_flux_from_salt_flux(m), flux_from_salt_flux, CS%diag)
m = CS%tracer_inds%alk_ind
if (m > 0) then
do j=js,je ; do i=is,ie
CS%STF(i,j,m) = CS%STF(i,j,m) + flux_from_salt_flux(i,j)
enddo ; enddo
if (CS%id_surface_flux_from_salt_flux(m) > 0) &
call post_data(CS%id_surface_flux_from_salt_flux(m), flux_from_salt_flux, CS%diag)
endif
m = CS%tracer_inds%alk_alt_co2_ind
if (m > 0) then
do j=js,je ; do i=is,ie
CS%STF(i,j,m) = CS%STF(i,j,m) + flux_from_salt_flux(i,j)
enddo ; enddo
if (CS%id_surface_flux_from_salt_flux(m) > 0) &
call post_data(CS%id_surface_flux_from_salt_flux(m), flux_from_salt_flux, CS%diag)
endif
endif

if (CS%debug) then
Expand Down
Loading