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

User/aja/fluxes diags cleanup #20

Merged
merged 3 commits into from
Jun 16, 2014
Merged
Show file tree
Hide file tree
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
311 changes: 75 additions & 236 deletions config_src/coupled_driver/MOM_surface_forcing.F90

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions config_src/coupled_driver/ocean_model_MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module ocean_model_mod
use MOM_error_handler, only : MOM_error, FATAL, WARNING, is_root_pe
use MOM_error_handler, only : callTree_enter, callTree_leave
use MOM_file_parser, only : get_param, log_version, close_param_file, param_file_type
use MOM_forcing_type, only : forcing
use MOM_forcing_type, only : forcing, forcing_diagnostics
use MOM_get_input, only : Get_MOM_Input, directories
use MOM_grid, only : ocean_grid_type
use MOM_io, only : close_file, file_exists, read_data, write_version_number
Expand All @@ -52,7 +52,7 @@ module ocean_model_mod
use MOM_sum_output, only : MOM_sum_output_init, sum_output_CS
use MOM_string_functions, only : uppercase
use MOM_surface_forcing, only : surface_forcing_init, convert_IOB_to_fluxes
use MOM_surface_forcing, only : average_forcing, ice_ocn_bnd_type_chksum
use MOM_surface_forcing, only : ice_ocn_bnd_type_chksum
use MOM_surface_forcing, only : ice_ocean_boundary_type, surface_forcing_CS
use MOM_surface_forcing, only : forcing_save_restart
use MOM_time_manager, only : time_type, get_time, set_time, operator(>)
Expand Down Expand Up @@ -156,7 +156,7 @@ module ocean_model_mod
! restore salinity to a specified value.
real :: press_to_z ! A conversion factor between pressure and ocean
! depth in m, usually 1/(rho_0*g), in m Pa-1.
real :: C_p ! The heat capacity of seawater, in J K-1 kg-1.
real :: C_p ! The heat capacity of seawater, in J K-1 kg-1.

type(directories) :: dirs ! A structure containing several relevant directory paths.
type(forcing) :: fluxes ! A structure containing pointers to
Expand All @@ -166,8 +166,8 @@ module ocean_model_mod
type(ocean_grid_type), pointer :: grid => NULL() ! A pointer to a grid structure
! containing metrics and related information.
type(MOM_control_struct), pointer :: MOM_CSp => NULL()
type(surface_forcing_CS), pointer :: forcing_CSp => NULL()
type(sum_output_CS), pointer :: sum_output_CSp => NULL()
type(surface_forcing_CS), pointer :: forcing_CSp => NULL()
type(sum_output_CS), pointer :: sum_output_CSp => NULL()
end type ocean_state_type

contains
Expand Down Expand Up @@ -371,7 +371,7 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &
OS%nstep = OS%nstep + 1

call enable_averaging(time_step, OS%Time, OS%MOM_CSp%diag)
call average_forcing(OS%fluxes, time_step, OS%grid, OS%forcing_CSp)
call forcing_diagnostics(OS%fluxes, OS%state, time_step, OS%grid, OS%MOM_CSp%diag, OS%forcing_CSp%handles)
call accumulate_net_input(OS%fluxes, OS%state, time_step, OS%grid, OS%sum_output_CSp)
call disable_averaging(OS%MOM_CSp%diag)

Expand Down
38 changes: 25 additions & 13 deletions config_src/ice_solo_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module MOM_surface_forcing

#include <MOM_memory.h>

public set_forcing, surface_forcing_init, average_forcing, forcing_save_restart
public set_forcing, surface_forcing_init, forcing_diagnostics, forcing_save_restart

type, public :: surface_forcing_CS ; private
logical :: use_temperature ! If true, temperature and salinity are used as
Expand Down Expand Up @@ -165,7 +165,7 @@ module MOM_surface_forcing
character(len=80) :: stress_x_var, stress_y_var

integer :: id_taux = -1, id_tauy = -1, id_ustar = -1
integer :: id_PminusE = -1, id_evap = -1, id_precip = -1
integer :: id_pmepr = -1, id_evap = -1, id_precip = -1
integer :: id_liq_precip = -1, id_froz_precip = -1, id_virt_precip = -1
integer :: id_liq_runoff = -1, id_froz_runoff = -1
integer :: id_runoff_hflx = -1, id_calving_hflx = -1
Expand Down Expand Up @@ -669,6 +669,10 @@ subroutine buoyancy_forcing_from_files(state, fluxes, day, dt, G, CS)
allocate(fluxes%virt_precip(isd:ied,jsd:jed))
fluxes%virt_precip(:,:) = 0.0
endif
if (.not.associated(fluxes%seaice_melt)) then
allocate(fluxes%seaice_melt(isd:ied,jsd:jed))
fluxes%seaice_melt(:,:) = 0.0
endif

! Specify the fresh water forcing by setting the following, all in units
! of W m-2 and positive for heat fluxes into the ocean.
Expand Down Expand Up @@ -904,6 +908,10 @@ subroutine buoyancy_forcing_zero(state, fluxes, day, dt, G, CS)
allocate(fluxes%virt_precip(G%isd:G%ied,G%jsd:G%jed))
fluxes%virt_precip(:,:) = 0.0
endif
if (.not.associated(fluxes%seaice_melt)) then
allocate(fluxes%seaice_melt(G%isd:G%ied,G%jsd:G%jed))
fluxes%seaice_melt(:,:) = 0.0
endif

! Specify the heat fluxes by setting the following, all in units
! of W m-2 and positive for heat fluxes into the ocean.
Expand Down Expand Up @@ -1000,6 +1008,10 @@ subroutine buoyancy_forcing_linear(state, fluxes, day, dt, G, CS)
allocate(fluxes%virt_precip(G%isd:G%ied,G%jsd:G%jed))
fluxes%virt_precip(:,:) = 0.0
endif
if (.not.associated(fluxes%seaice_melt)) then
allocate(fluxes%seaice_melt(G%isd:G%ied,G%jsd:G%jed))
fluxes%seaice_melt(:,:) = 0.0
endif

! Specify the heat fluxes by setting the following, all in units
! of W m-2 and positive for heat fluxes into the ocean.
Expand Down Expand Up @@ -1084,7 +1096,7 @@ subroutine buoyancy_forcing_linear(state, fluxes, day, dt, G, CS)

end subroutine buoyancy_forcing_linear

subroutine average_forcing(fluxes, dt, G, CS)
subroutine forcing_diagnostics(fluxes, dt, G, CS)
type(forcing), intent(in) :: fluxes
real, intent(in) :: dt
type(ocean_grid_type), intent(in) :: G
Expand Down Expand Up @@ -1113,15 +1125,15 @@ subroutine average_forcing(fluxes, dt, G, CS)
if ((CS%id_ustar > 0) .and. ASSOCIATED(fluxes%ustar)) &
call post_data(CS%id_ustar, fluxes%ustar, CS%diag)

if (CS%id_PminusE > 0) then
if (CS%id_pmepr > 0) then
sum(:,:) = 0.0
if (ASSOCIATED(fluxes%liq_precip)) sum(:,:) = sum(:,:)+fluxes%liq_precip(:,:)
if (ASSOCIATED(fluxes%froz_precip)) sum(:,:) = sum(:,:)+fluxes%froz_precip(:,:)
if (ASSOCIATED(fluxes%evap)) sum(:,:) = sum(:,:)+fluxes%evap(:,:)
if (ASSOCIATED(fluxes%liq_runoff)) sum(:,:) = sum(:,:)+fluxes%liq_runoff(:,:)
if (ASSOCIATED(fluxes%froz_runoff)) sum(:,:) = sum(:,:)+fluxes%froz_runoff(:,:)
if (ASSOCIATED(fluxes%virt_precip)) sum(:,:) = sum(:,:)+fluxes%virt_precip(:,:)
call post_data(CS%id_PminusE, sum, CS%diag)
if (ASSOCIATED(fluxes%liq_precip)) sum(:,:) = sum(:,:)+fluxes%liq_precip(:,:)
if (ASSOCIATED(fluxes%froz_precip)) sum(:,:) = sum(:,:)+fluxes%froz_precip(:,:)
if (ASSOCIATED(fluxes%evap)) sum(:,:) = sum(:,:)+fluxes%evap(:,:)
if (ASSOCIATED(fluxes%liq_runoff)) sum(:,:) = sum(:,:)+fluxes%liq_runoff(:,:)
if (ASSOCIATED(fluxes%froz_runoff)) sum(:,:) = sum(:,:)+fluxes%froz_runoff(:,:)
if (ASSOCIATED(fluxes%virt_precip)) sum(:,:) = sum(:,:)+fluxes%virt_precip(:,:)
call post_data(CS%id_pmepr, sum, CS%diag)
endif

if ((CS%id_evap > 0) .and. ASSOCIATED(fluxes%evap)) &
Expand Down Expand Up @@ -1185,7 +1197,7 @@ subroutine average_forcing(fluxes, dt, G, CS)
endif

call cpu_clock_end(id_clock_forcing)
end subroutine average_forcing
end subroutine forcing_diagnostics

subroutine forcing_save_restart(CS, G, Time, directory, time_stamped, &
filename_suffix)
Expand Down Expand Up @@ -1437,7 +1449,7 @@ subroutine surface_forcing_init(Time, G, param_file, diag, CS, tracer_flow_CSp)
'Surface friction velocity', 'meter second-1')

if (CS%use_temperature) then
CS%id_PminusE = register_diag_field('ocean_model', 'PmE', diag%axesT1, Time, &
CS%id_pmepr = register_diag_field('ocean_model', 'PmEpR', diag%axesT1, Time, &
'Net fresh water flux (P-E+C+R)', 'kilogram meter-2 second-1')
CS%id_evap = register_diag_field('ocean_model', 'evap', diag%axesT1, Time, &
'Evaporation at ocean surface (usually negative)', 'kilogram meter-2 second-1')
Expand Down
6 changes: 3 additions & 3 deletions config_src/solo_driver/MOM_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ program MOM_main
use MOM_error_handler, only : callTree_enter, callTree_leave, callTree_waypoint
use MOM_file_parser, only : read_param, get_param, log_param, log_version, param_file_type
use MOM_file_parser, only : close_param_file
use MOM_forcing_type, only : forcing
use MOM_forcing_type, only : forcing, forcing_diagnostics
use MOM_get_input, only : directories
use MOM_grid, only : ocean_grid_type
use MOM_io, only : file_exists, open_file, close_file
Expand All @@ -61,7 +61,7 @@ program MOM_main
use MOM_restart, only : save_restart
use MOM_sum_output, only : write_energy, accumulate_net_input
use MOM_sum_output, only : MOM_sum_output_init, sum_output_CS
use MOM_surface_forcing, only : set_forcing, average_forcing, forcing_save_restart
use MOM_surface_forcing, only : set_forcing, forcing_save_restart
use MOM_surface_forcing, only : surface_forcing_init, surface_forcing_CS
use MOM_time_manager, only : time_type, set_date, set_time, get_date, time_type_to_real
use MOM_time_manager, only : operator(+), operator(-), operator(*), operator(/)
Expand Down Expand Up @@ -416,7 +416,7 @@ program MOM_main
Time = Master_Time

call enable_averaging(time_step,Time,MOM_CSp%diag)
call average_forcing(fluxes, time_step, grid, surface_forcing_CSp)
call forcing_diagnostics(fluxes, state, time_step, grid, MOM_CSp%diag, surface_forcing_CSp%handles)
call accumulate_net_input(fluxes, state, time_step, grid, sum_output_CSp)
call disable_averaging(MOM_CSp%diag)

Expand Down
Loading