Skip to content

Commit

Permalink
Merge commit '3c3981894fe518d96bfb55087a06d2bc3f242b60' into HEAD
Browse files Browse the repository at this point in the history
-Bring Aakash's code up to date.
  • Loading branch information
brandon.reichl authored and brandon.reichl committed Dec 23, 2024
2 parents 821b83f + 3c39818 commit bf09c17
Show file tree
Hide file tree
Showing 54 changed files with 6,894 additions and 1,276 deletions.
6 changes: 3 additions & 3 deletions .testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,16 @@ $(BUILD)/timing/Makefile: MOM_ACFLAGS += --with-driver=timing_tests
# Build executables
.NOTPARALLEL:$(foreach e,$(UNIT_EXECS),$(BUILD)/unit/$(e))
$(BUILD)/unit/test_%: $(BUILD)/unit/Makefile FORCE
cd $(@D) && $(TIME) $(MAKE) $(@F) -j
cd $(@D) && $(TIME) $(MAKE) $(@F)
$(BUILD)/unit/Makefile: $(foreach e,$(UNIT_EXECS),../config_src/drivers/unit_tests/$(e).F90)

.NOTPARALLEL:$(foreach e,$(TIMING_EXECS),$(BUILD)/timing/$(e))
$(BUILD)/timing/time_%: $(BUILD)/timing/Makefile FORCE
cd $(@D) && $(TIME) $(MAKE) $(@F) -j
cd $(@D) && $(TIME) $(MAKE) $(@F)
$(BUILD)/timing/Makefile: $(foreach e,$(TIMING_EXECS),../config_src/drivers/timing_tests/$(e).F90)

$(BUILD)/%/MOM6: $(BUILD)/%/Makefile FORCE
cd $(@D) && $(TIME) $(MAKE) $(@F) -j
cd $(@D) && $(TIME) $(MAKE) $(@F)

# Target codebase should use its own build system
$(BUILD)/target/MOM6: $(BUILD)/target FORCE | $(TARGET_CODEBASE)
Expand Down
20 changes: 12 additions & 8 deletions config_src/drivers/solo_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ module MOM_surface_forcing
use user_surface_forcing, only : USER_surface_forcing_init, user_surface_forcing_CS
use user_revise_forcing, only : user_alter_forcing, user_revise_forcing_init
use user_revise_forcing, only : user_revise_forcing_CS
use idealized_hurricane, only : idealized_hurricane_wind_init
use idealized_hurricane, only : idealized_hurricane_wind_forcing, SCM_idealized_hurricane_wind_forcing
use idealized_hurricane, only : idealized_hurricane_CS
use idealized_hurricane, only : idealized_hurricane_wind_forcing
use idealized_hurricane, only : idealized_hurricane_wind_init, idealized_hurricane_CS
use SCM_CVmix_tests, only : SCM_CVmix_tests_surface_forcing_init
use SCM_CVmix_tests, only : SCM_CVmix_tests_wind_forcing
use SCM_CVmix_tests, only : SCM_CVmix_tests_buoyancy_forcing
Expand Down Expand Up @@ -297,7 +296,8 @@ subroutine set_forcing(sfc_state, forces, fluxes, day_start, day_interval, G, US
elseif (trim(CS%wind_config) == "ideal_hurr") then
call idealized_hurricane_wind_forcing(sfc_state, forces, day_center, G, US, CS%idealized_hurricane_CSp)
elseif (trim(CS%wind_config) == "SCM_ideal_hurr") then
call SCM_idealized_hurricane_wind_forcing(sfc_state, forces, day_center, G, US, CS%idealized_hurricane_CSp)
call MOM_error(FATAL, "MOM_surface_forcing (set_forcing): "//&
'WIND_CONFIG = "SCM_ideal_hurr" is a depricated option.')
elseif (trim(CS%wind_config) == "SCM_CVmix_tests") then
call SCM_CVmix_tests_wind_forcing(sfc_state, forces, day_center, G, US, CS%SCM_CVmix_tests_CSp)
elseif (trim(CS%wind_config) == "USER") then
Expand Down Expand Up @@ -1780,8 +1780,8 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, tracer_flow_C
call get_param(param_file, mdl, "WIND_CONFIG", CS%wind_config, &
"The character string that indicates how wind forcing is specified. Valid "//&
"options include (file), (data_override), (2gyre), (1gyre), (gyres), (zero), "//&
"(const), (Neverworld), (scurves), (ideal_hurr), (SCM_ideal_hurr), "//&
"(SCM_CVmix_tests) and (USER).", default="zero")
"(const), (Neverworld), (scurves), (ideal_hurr), (SCM_CVmix_tests) and (USER).", &
default="zero")
if (trim(CS%wind_config) == "file") then
call get_param(param_file, mdl, "WIND_FILE", CS%wind_file, &
"The file in which the wind stresses are found in "//&
Expand Down Expand Up @@ -1990,9 +1990,13 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, tracer_flow_C
call dumbbell_surface_forcing_init(Time, G, US, param_file, diag, CS%dumbbell_forcing_CSp)
elseif (trim(CS%wind_config) == "MESO" .or. trim(CS%buoy_config) == "MESO" ) then
call MESO_surface_forcing_init(Time, G, US, param_file, diag, CS%MESO_forcing_CSp)
elseif (trim(CS%wind_config) == "ideal_hurr" .or.&
trim(CS%wind_config) == "SCM_ideal_hurr") then
elseif (trim(CS%wind_config) == "ideal_hurr") then
call idealized_hurricane_wind_init(Time, G, US, param_file, CS%idealized_hurricane_CSp)
elseif (trim(CS%wind_config) == "SCM_ideal_hurr") then
call MOM_error(FATAL, "MOM_surface_forcing (surface_forcing_init): "//&
'WIND_CONFIG = "SCM_ideal_hurr" is a depricated option. '//&
'To obtain mathematically equivalent results set '//&
'WIND_CONFIG = "ideal_hurr", IDL_HURR_SCM = True and IDL_HURR_X0 = 6.48e+05.')
elseif (trim(CS%wind_config) == "const") then
call get_param(param_file, mdl, "CONST_WIND_TAUX", CS%tau_x0, &
"With wind_config const, this is the constant zonal wind-stress", &
Expand Down
33 changes: 26 additions & 7 deletions config_src/drivers/timing_tests/time_MOM_remapping.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,30 @@ program time_MOM_remapping
implicit none

type(remapping_CS) :: CS
integer, parameter :: nk=75, nij=20*20, nits=10, nsamp=100, nschemes = 2
character(len=10) :: scheme_labels(nschemes)
integer, parameter :: nk=75, nij=20*20, nits=10, nsamp=100, nschemes = 22
character(len=16) :: scheme_labels(nschemes) = [ character(len=16) :: &
'PCM', &
'C_PCM', &
'PLM', &
'C_MPLM_WA', &
'C_EMPLM_WA', &
'C_PLM_HYBGEN', &
'C_PLM_CW', &
'C_PLM_CWK', &
'C_MPLM_WA_POLY', &
'C_EMPLM_WA_POLY', &
'C_MPLM_CWK', &
'PPM_H4', &
'PPM_IH4', &
'PQM_IH4IH3', &
'PPM_CW', &
'PPM_HYBGEN', &
'C_PPM_H4_2018', &
'C_PPM_H4_2019', &
'C_PPM_HYBGEN', &
'C_PPM_CW', &
'C_PPM_CWK', &
'C_EPPM_CWK' ]
real, dimension(nschemes) :: timings ! Time for nits of nij calls for each scheme [s]
real, dimension(nschemes) :: tmean ! Mean time for a call [s]
real, dimension(nschemes) :: tstd ! Standard deviation of time for a call [s]
Expand All @@ -31,9 +53,6 @@ program time_MOM_remapping
seed(:) = 102030405
call random_seed(put=seed)

scheme_labels(1) = 'PCM'
scheme_labels(2) = 'PLM'

! Set up some test data (note: using k,i indexing rather than i,k)
allocate( u0(nk,nij), h0(nk,nij), u1(nk,nij), h1(nk,nij) )
call random_number(u0) ! In range 0-1
Expand Down Expand Up @@ -61,8 +80,8 @@ program time_MOM_remapping
do isamp = 1, nsamp
! Time reconstruction + remapping
do ischeme = 1, nschemes
call initialize_remapping(CS, remapping_scheme=trim(scheme_labels(ischeme)), &
h_neglect=h_neglect, h_neglect_edge=h_neglect)
call initialize_remapping(CS, remapping_scheme=trim(scheme_labels(ischeme)), nk=nk, &
h_neglect=h_neglect, h_neglect_edge=h_neglect)
call cpu_time(start)
do iter = 1, nits ! Make many passes to reduce sampling error
do ij = 1, nij ! Calling nij times to make similar to cost in MOM_ALE()
Expand Down
14 changes: 13 additions & 1 deletion config_src/drivers/unit_tests/test_MOM_remapping.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ program test_MOM_remapping

use MOM_remapping, only : remapping_unit_tests

if (remapping_unit_tests(.true.)) stop 1
integer :: n !< Number of arguments, or tests
character(len=12) :: cmd_ln_arg !< Command line argument (if any)

n = command_argument_count()

if (n==1) then
call get_command_argument(1, cmd_ln_arg)
read(cmd_ln_arg,*) n
else
n = 3000 ! Fallback value if no argument provided
endif

if (remapping_unit_tests(.true., num_comp_samp=n)) stop 1

end program test_MOM_remapping
7 changes: 7 additions & 0 deletions config_src/drivers/unit_tests/test_numerical_testing_type.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
program test_numerical_testing_type

use numerical_testing_type, only : testing_type_unit_test

if (testing_type_unit_test(.true.)) stop 1

end program test_numerical_testing_type
10 changes: 7 additions & 3 deletions config_src/infra/FMS1/MOM_constants.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ module MOM_constants

! This file is part of MOM6. See LICENSE.md for the license.

use constants_mod, only : HLV, HLF
use constants_mod, only : FMS_HLV => HLV
use constants_mod, only : FMS_HLF => HLF

implicit none ; private

!> The constant offset for converting temperatures in Kelvin to Celsius
real, public, parameter :: CELSIUS_KELVIN_OFFSET = 273.15
public :: HLV, HLF
!< The constant offset for converting temperatures in Kelvin to Celsius [K]
real, public, parameter :: HLV = real(FMS_HLV, kind=kind(1.0))
!< Latent heat of vaporization [J kg-1]
real, public, parameter :: HLF = real(FMS_HLF, kind=kind(1.0))
!< Latent heat of fusion [J kg-1]

end module MOM_constants
10 changes: 7 additions & 3 deletions config_src/infra/FMS2/MOM_constants.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ module MOM_constants

! This file is part of MOM6. See LICENSE.md for the license.

use constants_mod, only : HLV, HLF
use constants_mod, only : FMS_HLV => HLV
use constants_mod, only : FMS_HLF => HLF

implicit none ; private

!> The constant offset for converting temperatures in Kelvin to Celsius
real, public, parameter :: CELSIUS_KELVIN_OFFSET = 273.15
public :: HLV, HLF
!< The constant offset for converting temperatures in Kelvin to Celsius [K]
real, public, parameter :: HLV = real(FMS_HLV, kind=kind(1.0))
!< Latent heat of vaporization [J kg-1]
real, public, parameter :: HLF = real(FMS_HLF, kind=kind(1.0))
!< Latent heat of fusion [J kg-1]

end module MOM_constants
1 change: 1 addition & 0 deletions docs/discrete_space.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ algorithm.
api/generated/pages/Discrete_Coriolis
api/generated/pages/Discrete_PG
api/generated/pages/Energetic_Consistency
api/generated/pages/Vertical_Reconstruction
api/generated/pages/Discrete_OBC
14 changes: 14 additions & 0 deletions docs/zotero.bib
Original file line number Diff line number Diff line change
Expand Up @@ -2946,3 +2946,17 @@ @article{Young1994
pages={1812--1826},
year={1994}
}

@article{van_leer_1977,
title = {Towards the ultimate conservative difference scheme. {IV}. {A} new approach to numerical convection},
volume = {23},
issn = {0021-9991},
doi = {10.1016/0021-9991(77)90095-X},
number = {3},
journal = {Journal of Computational Physics},
author = {Van Leer, Bram},
month = mar,
year = {1977},
pages = {276--299},
}

4 changes: 2 additions & 2 deletions src/ALE/MOM_ALE.F90
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ subroutine ALE_init( param_file, GV, US, max_depth, CS)
h_neglect = GV%kg_m2_to_H * 1.0e-30 ; h_neglect_edge = GV%kg_m2_to_H * 1.0e-10
endif

call initialize_remapping( CS%remapCS, string, &
call initialize_remapping( CS%remapCS, string, nk=GV%ke, &
boundary_extrapolation=init_boundary_extrap, &
check_reconstruction=check_reconstruction, &
check_remapping=check_remapping, &
force_bounds_in_subcell=force_bounds_in_subcell, &
om4_remap_via_sub_cells=om4_remap_via_sub_cells, &
answer_date=CS%answer_date, &
h_neglect=h_neglect, h_neglect_edge=h_neglect_edge)
call initialize_remapping( CS%vel_remapCS, vel_string, &
call initialize_remapping( CS%vel_remapCS, vel_string, nk=GV%ke, &
boundary_extrapolation=init_boundary_extrap, &
check_reconstruction=check_reconstruction, &
check_remapping=check_remapping, &
Expand Down
Loading

0 comments on commit bf09c17

Please sign in to comment.