Skip to content

Commit

Permalink
Enhance the logic for Z-initializing generic tracers
Browse files Browse the repository at this point in the history
- Allow a way to totally bypass Z-init for some genertic tracers
  If(has source in field_table) initialize
  Elseif(must be in an IC file) initialize  (this should be deprecated)
  Else do not initialize (the tracer package is responsible for Z-initialization)
  • Loading branch information
nikizadehgfdl committed Aug 8, 2024
1 parent c4a72df commit 9a7075c
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/tracer/MOM_generic_tracer.F90
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ subroutine initialize_MOM_generic_tracer(restart, day, G, GV, US, h, tv, param_f

if (.not.restart .or. (CS%tracers_may_reinit .and. &
.not.query_initialized(tr_ptr, g_tracer_name, CS%restart_CSp))) then

if (g_tracer%requires_src_info ) then
!Initialize from source file provided by the tracer package
if (g_tracer%has_src_info ) then
call MOM_error(NOTE,"initialize_MOM_generic_tracer: "//&
"initializing generic tracer "//trim(g_tracer_name)//&
" using MOM_initialize_tracer_from_Z ")
Expand Down Expand Up @@ -374,12 +374,9 @@ subroutine initialize_MOM_generic_tracer(restart, day, G, GV, US, h, tv, param_f
endif
enddo ; enddo ; enddo
endif
elseif(.not. g_tracer%requires_restart) then
!Do nothing for this tracer, it is initialized by the tracer package
call MOM_error(NOTE,"initialize_MOM_generic_tracer: "//&
"skip initialization of generic tracer "//trim(g_tracer_name))
else !Do it old way if the tracer is not registered to start from a specific source file.
!This path should be deprecated if all generic tracers are required to start from specified sources.
!Do it old way if the tracer is not registered to start from a specific source file.
!This path should be deprecated if all generic tracers are required to start from specified sources.
elseif (g_tracer%requires_z_init) then
if (len_trim(CS%IC_file) > 0) then
! Read the tracer concentrations from a netcdf file.
if (.not.file_exists(CS%IC_file)) call MOM_error(FATAL, &
Expand All @@ -402,12 +399,10 @@ subroutine initialize_MOM_generic_tracer(restart, day, G, GV, US, h, tv, param_f
" for tracer "//trim(g_tracer_name))
call MOM_read_data(CS%IC_file, trim(g_tracer_name), tr_ptr, G%Domain)
endif
else
call MOM_error(FATAL,"initialize_MOM_generic_tracer: "//&
"check Generic Tracer IC filename "//trim(CS%IC_file)//&
" for tracer "//trim(g_tracer_name))
endif

else !Do nothing for this tracer, it is initialized by the tracer package
call MOM_error(NOTE,"initialize_MOM_generic_tracer: "//&
"skip initialization of generic tracer "//trim(g_tracer_name))
endif

call set_initialized(tr_ptr, g_tracer_name, CS%restart_CSp)
Expand Down Expand Up @@ -582,15 +577,17 @@ subroutine MOM_generic_tracer_column_physics(h_old, h_new, ea, eb, fluxes, Hml,
call generic_tracer_source(tv%T, tv%S, rho_dzt, dzt, dz_ml, G%isd, G%jsd, 1, dt, &
G%areaT, get_diag_time_end(CS%diag), &
optics%nbands, optics%max_wavelength_band, optics%sw_pen_band, optics%opacity_band, &
internal_heat=tv%internal_heat, frunoff=fluxes%frunoff, sosga=sosga)
internal_heat=tv%internal_heat, frunoff=fluxes%frunoff, sosga=sosga, &
geolat=G%geolatT, eqn_of_state=tv%eqn_of_state)
else
call generic_tracer_source(US%C_to_degC*tv%T, US%S_to_ppt*tv%S, rho_dzt, dzt, dz_ml, G%isd, G%jsd, 1, dt, &
G%US%L_to_m**2*G%areaT(:,:), get_diag_time_end(CS%diag), &
optics%nbands, optics%max_wavelength_band, &
sw_pen_band=G%US%QRZ_T_to_W_m2*optics%sw_pen_band(:,:,:), &
opacity_band=G%US%m_to_Z*optics%opacity_band(:,:,:,:), &
internal_heat=G%US%RZ_to_kg_m2*US%C_to_degC*tv%internal_heat(:,:), &
frunoff=G%US%RZ_T_to_kg_m2s*fluxes%frunoff(:,:), sosga=sosga)
frunoff=G%US%RZ_T_to_kg_m2s*fluxes%frunoff(:,:), sosga=sosga, &
geolat=G%geolatT, eqn_of_state=tv%eqn_of_state)
endif

! This uses applyTracerBoundaryFluxesInOut to handle the change in tracer due to freshwater fluxes
Expand Down

0 comments on commit 9a7075c

Please sign in to comment.