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

Scalar diag conversion; Q and R dimension scaling #1103

Merged
merged 1 commit into from
May 4, 2020
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
14 changes: 9 additions & 5 deletions .testing/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SHELL = bash
.SUFFIXES:

# User-defined configuration
-include config.mk
Expand Down Expand Up @@ -30,9 +31,9 @@ MKMF_CPP = "-Duse_libMPI -Duse_netCDF -DSPMD"

# Environment
# TODO: This info ought to be determined by CMake, automake, etc.
#MKMF_TEMPLATE ?= .testing/linux-ubuntu-xenial-gnu.mk
MKMF_TEMPLATE ?= build/mkmf/templates/ncrc-gnu.mk
#MKMF_TEMPLATE ?= build/mkmf/templates/ncrc-intel.mk
#MKMF_TEMPLATE ?= linux-ubuntu-xenial-gnu.mk
MKMF_TEMPLATE ?= deps/mkmf/templates/ncrc-gnu.mk
#MKMF_TEMPLATE ?= deps/mkmf/templates/ncrc-intel.mk

#---
# Test configuration
Expand All @@ -41,6 +42,7 @@ MKMF_TEMPLATE ?= build/mkmf/templates/ncrc-gnu.mk
BUILDS = symmetric asymmetric repro openmp
CONFIGS := $(wildcard tc*)
TESTS = grids layouts restarts nans dims openmps rotations
DIMS = t l h z q r

# REPRO tests enable reproducibility with optimization, and often do not match
# the DEBUG results in older GCCs and vendor compilers, so we can optionally
Expand Down Expand Up @@ -199,7 +201,7 @@ test.restarts: $(foreach c,$(CONFIGS),$(c).restart)
test.repros: $(foreach c,$(CONFIGS),$(c).repro $(c).repro.diag)
test.openmps: $(foreach c,$(CONFIGS),$(c).openmp $(c).openmp.diag)
test.nans: $(foreach c,$(CONFIGS),$(c).nan $(c).nan.diag)
test.dims: $(foreach c,$(CONFIGS),$(foreach d,t l h z,$(c).dim.$(d) $(c).dim.$(d).diag))
test.dims: $(foreach c,$(CONFIGS),$(foreach d,$(DIMS),$(c).dim.$(d) $(c).dim.$(d).diag))

test.regressions: $(foreach c,$(CONFIGS),$(c).regression $(c).regression.diag)
! ls -1 results/*/*.reg
Expand All @@ -220,7 +222,7 @@ $(eval $(call CMP_RULE,rotate,symmetric rotate))
$(eval $(call CMP_RULE,repro,symmetric repro))
$(eval $(call CMP_RULE,openmp,symmetric openmp))
$(eval $(call CMP_RULE,nan,symmetric nan))
$(foreach d,t l h z,$(eval $(call CMP_RULE,dim.$(d),symmetric dim.$(d))))
$(foreach d,$(DIMS),$(eval $(call CMP_RULE,dim.$(d),symmetric dim.$(d))))

# Custom comparison rules

Expand Down Expand Up @@ -295,6 +297,8 @@ $(eval $(call STAT_RULE,dim.t,symmetric,,T_RESCALE_POWER=11,,1))
$(eval $(call STAT_RULE,dim.l,symmetric,,L_RESCALE_POWER=11,,1))
$(eval $(call STAT_RULE,dim.h,symmetric,,H_RESCALE_POWER=11,,1))
$(eval $(call STAT_RULE,dim.z,symmetric,,Z_RESCALE_POWER=11,,1))
$(eval $(call STAT_RULE,dim.q,symmetric,,Q_RESCALE_POWER=11,,1))
$(eval $(call STAT_RULE,dim.r,symmetric,,R_RESCALE_POWER=11,,1))

# Restart tests require significant preprocessing, and are handled separately.
results/%/ocean.stats.restart: build/symmetric/MOM6
Expand Down
12 changes: 9 additions & 3 deletions src/framework/MOM_diag_mediator.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,7 @@ subroutine post_data_0d(diag_field_id, field, diag_cs, is_static)
logical, optional, intent(in) :: is_static !< If true, this is a static field that is always offered.

! Local variables
real :: locfield
logical :: used, is_stat
type(diag_type), pointer :: diag => null()

Expand All @@ -1223,13 +1224,18 @@ subroutine post_data_0d(diag_field_id, field, diag_cs, is_static)
call assert(diag_field_id < diag_cs%next_free_diag_id, &
'post_data_0d: Unregistered diagnostic id')
diag => diag_cs%diags(diag_field_id)

do while (associated(diag))
locfield = field
if (diag%conversion_factor /= 0.) &
locfield = locfield * diag%conversion_factor

if (diag_cs%diag_as_chksum) then
call chksum0(field, diag%debug_str, logunit=diag_cs%chksum_iounit)
call chksum0(locfield, diag%debug_str, logunit=diag_cs%chksum_iounit)
else if (is_stat) then
used = send_data(diag%fms_diag_id, field)
used = send_data(diag%fms_diag_id, locfield)
elseif (diag_cs%ave_enabled) then
used = send_data(diag%fms_diag_id, field, diag_cs%time_end)
used = send_data(diag%fms_diag_id, locfield, diag_cs%time_end)
endif
diag => diag%next
enddo
Expand Down