From 1ce09c4ecf8fab8118f2da67a075619a12acdfa4 Mon Sep 17 00:00:00 2001 From: Angus Gibson Date: Tue, 17 May 2016 11:04:48 +1000 Subject: [PATCH 1/2] Error if THICKNESS_CONFIG="coord" without ALE MOM_initialize_state passes an ALE_CS pointer to ALE_initThicknessToCoord without checking whether it's associated. If USE_REGRIDDING is False, this pointer will be unassociated and cause a crash during initialization. We fatally error with an informative message in this case. --- src/initialization/MOM_state_initialization.F90 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/initialization/MOM_state_initialization.F90 b/src/initialization/MOM_state_initialization.F90 index a9331f6698..d0963411fe 100644 --- a/src/initialization/MOM_state_initialization.F90 +++ b/src/initialization/MOM_state_initialization.F90 @@ -171,7 +171,6 @@ subroutine MOM_initialize_state(u, v, h, tv, Time, G, GV, PF, dirs, & use_temperature = ASSOCIATED(tv%T) useALE = associated(ALE_CSp) use_EOS = associated(tv%eqn_of_state) - useALE = associated(ALE_CSp) if (use_EOS) eos => tv%eqn_of_state !==================================================================== @@ -230,7 +229,13 @@ subroutine MOM_initialize_state(u, v, h, tv, Time, G, GV, PF, dirs, & select case (trim(config)) case ("file"); call initialize_thickness_from_file(h, G, GV, PF, .false.) case ("thickness_file"); call initialize_thickness_from_file(h, G, GV, PF, .true.) - case ("coord"); call ALE_initThicknessToCoord( ALE_CSp, G, h ) + case ("coord") + if (useALE) then + call ALE_initThicknessToCoord( ALE_CSp, G, h ) + else + call MOM_error(FATAL, "MOM_initialize_state: USE_REGRIDDING must be True "//& + "for THICKNESS_CONFIG of 'coord'") + endif case ("uniform"); call initialize_thickness_uniform(h, G, GV, PF) case ("DOME"); call DOME_initialize_thickness(h, G, GV, PF) case ("ISOMIP"); call ISOMIP_initialize_thickness(h, G, GV, PF, tv) From e2523fd9ecd70dd71187df07d91fa2bdd4265a10 Mon Sep 17 00:00:00 2001 From: Alistair Adcroft Date: Wed, 18 May 2016 17:05:24 -0400 Subject: [PATCH 2/2] Added WIND_STRESS_MULTIPLIER for experimentation - New run-time parameter to scale all wind stresses from coupler. - No answer changes. --- .../coupled_driver/MOM_surface_forcing.F90 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/config_src/coupled_driver/MOM_surface_forcing.F90 b/config_src/coupled_driver/MOM_surface_forcing.F90 index d46c79dc97..8f67191b39 100644 --- a/config_src/coupled_driver/MOM_surface_forcing.F90 +++ b/config_src/coupled_driver/MOM_surface_forcing.F90 @@ -94,6 +94,7 @@ module MOM_surface_forcing ! the winds that are being provided in calls to ! update_ocean_model. logical :: use_temperature ! If true, temp and saln used as state variables + real :: wind_stress_multiplier !< A multiplier applied to incoming wind stress (nondim). ! smg: remove when have A=B code reconciled logical :: bulkmixedlayer ! If true, model based on bulk mixed layer code @@ -419,14 +420,14 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, CS, state, do j=js,je ; do i=is,ie if (wind_stagger == BGRID_NE) then - if (ASSOCIATED(IOB%u_flux)) taux_at_q(I,J) = IOB%u_flux(i-i0,j-j0) - if (ASSOCIATED(IOB%v_flux)) tauy_at_q(I,J) = IOB%v_flux(i-i0,j-j0) + if (ASSOCIATED(IOB%u_flux)) taux_at_q(I,J) = IOB%u_flux(i-i0,j-j0) * CS%wind_stress_multiplier + if (ASSOCIATED(IOB%v_flux)) tauy_at_q(I,J) = IOB%v_flux(i-i0,j-j0) * CS%wind_stress_multiplier elseif (wind_stagger == AGRID) then - if (ASSOCIATED(IOB%u_flux)) taux_at_h(i,j) = IOB%u_flux(i-i0,j-j0) - if (ASSOCIATED(IOB%v_flux)) tauy_at_h(i,j) = IOB%v_flux(i-i0,j-j0) + if (ASSOCIATED(IOB%u_flux)) taux_at_h(i,j) = IOB%u_flux(i-i0,j-j0) * CS%wind_stress_multiplier + if (ASSOCIATED(IOB%v_flux)) tauy_at_h(i,j) = IOB%v_flux(i-i0,j-j0) * CS%wind_stress_multiplier else ! C-grid wind stresses. - if (ASSOCIATED(IOB%u_flux)) fluxes%taux(I,j) = IOB%u_flux(i-i0,j-j0) - if (ASSOCIATED(IOB%v_flux)) fluxes%tauy(i,J) = IOB%v_flux(i-i0,j-j0) + if (ASSOCIATED(IOB%u_flux)) fluxes%taux(I,j) = IOB%u_flux(i-i0,j-j0) * CS%wind_stress_multiplier + if (ASSOCIATED(IOB%v_flux)) fluxes%tauy(i,J) = IOB%v_flux(i-i0,j-j0) * CS%wind_stress_multiplier endif if (ASSOCIATED(IOB%lprec)) & @@ -893,6 +894,10 @@ subroutine surface_forcing_init(Time, G, param_file, diag, CS, restore_salt) elseif (uppercase(stagger(1:1)) == 'C') then ; CS%wind_stagger = CGRID_NE else ; call MOM_error(FATAL,"surface_forcing_init: WIND_STAGGER = "// & trim(stagger)//" is invalid.") ; endif + call get_param(param_file, mod, "WIND_STRESS_MULTIPLIER", CS%wind_stress_multiplier, & + "A factor multiplying the wind-stress given to the ocean by the\n"//& + "coupler. This is used for testing and should be =1.0 for any\n"//& + "production runs.", default=1.0) if (restore_salt) then call get_param(param_file, mod, "FLUXCONST", CS%Flux_const, &