From 82027fc7769a5c439de41daced9346df05ddb0b8 Mon Sep 17 00:00:00 2001 From: Uriel Ramirez Date: Tue, 27 Oct 2020 15:37:14 -0400 Subject: [PATCH 1/6] Adds test to reproduce the UFS model crash --- configure.ac | 1 + test_fms/Makefile.am | 2 +- test_fms/ufs_crash/diag_table | 8 ++ test_fms/ufs_crash/input.nml | 3 + test_fms/ufs_crash/test_diag_manager2.sh | 29 ++++++++ test_fms/ufs_crash/test_diag_manager_time.F90 | 74 +++++++++++++++++++ 6 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 test_fms/ufs_crash/diag_table create mode 100644 test_fms/ufs_crash/input.nml create mode 100755 test_fms/ufs_crash/test_diag_manager2.sh create mode 100644 test_fms/ufs_crash/test_diag_manager_time.F90 diff --git a/configure.ac b/configure.ac index a1be16e7b2..329852f28e 100644 --- a/configure.ac +++ b/configure.ac @@ -320,6 +320,7 @@ AC_CONFIG_FILES([Makefile docs/Makefile test_fms/test_common.sh test_fms/Makefile + test_fms/ufs_crash/Makefile test_fms/diag_manager/Makefile test_fms/data_override/Makefile test_fms/exchange/Makefile diff --git a/test_fms/Makefile.am b/test_fms/Makefile.am index e266245c2c..82f1d1b36e 100644 --- a/test_fms/Makefile.am +++ b/test_fms/Makefile.am @@ -24,7 +24,7 @@ ACLOCAL_AMFLAGS = -I m4 # Make targets will be run in each subdirectory. Order is significant. -SUBDIRS = diag_manager data_override exchange monin_obukhov drifters \ +SUBDIRS = ufs_crash diag_manager data_override exchange monin_obukhov drifters \ mosaic interpolator fms fms2_io mpp mpp_io time_interp time_manager \ horiz_interp field_manager axis_utils affinity diff --git a/test_fms/ufs_crash/diag_table b/test_fms/ufs_crash/diag_table new file mode 100644 index 0000000000..dffadb3878 --- /dev/null +++ b/test_fms/ufs_crash/diag_table @@ -0,0 +1,8 @@ +test_diag_manager +2 1 1 0 0 0 + +#output files +"ocn%4yr%2mo%2dy%2hr", 1, "days", 1, "days", "time", 1, "days", "2 1 1 0 0 0" + +#output variables + "test_diag_manager_mod", "sst", "sst", "ocn%4yr%2mo%2dy%2hr", "all", .true., "none", 2 diff --git a/test_fms/ufs_crash/input.nml b/test_fms/ufs_crash/input.nml new file mode 100644 index 0000000000..74920fcb56 --- /dev/null +++ b/test_fms/ufs_crash/input.nml @@ -0,0 +1,3 @@ +&diag_manager_nml +use_mpp_io = .false. +/ diff --git a/test_fms/ufs_crash/test_diag_manager2.sh b/test_fms/ufs_crash/test_diag_manager2.sh new file mode 100755 index 0000000000..ceb85a1e78 --- /dev/null +++ b/test_fms/ufs_crash/test_diag_manager2.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +#*********************************************************************** +#* GNU Lesser General Public License +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* FMS is free software: you can redistribute it and/or modify it under +#* the terms of the GNU Lesser General Public License as published by +#* the Free Software Foundation, either version 3 of the License, or (at +#* your option) any later version. +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +#* for more details. +#* +#* You should have received a copy of the GNU Lesser General Public +#* License along with FMS. If not, see . +#*********************************************************************** + +# This is part of the GFDL FMS package. This is a shell script to +# execute tests in the test_fms/data_override directory. + +# Ed Hartnett 11/26/19 + +# Set common test settings. +. ../test_common.sh +run_test test_diag_manager_time 1 diff --git a/test_fms/ufs_crash/test_diag_manager_time.F90 b/test_fms/ufs_crash/test_diag_manager_time.F90 new file mode 100644 index 0000000000..540f0e83b2 --- /dev/null +++ b/test_fms/ufs_crash/test_diag_manager_time.F90 @@ -0,0 +1,74 @@ +program test_diag_manager + +use mpp_domains_mod +use diag_manager_mod +use fms_mod +use time_manager_mod, only: time_type, set_calendar_type, set_date, NOLEAP, JULIAN, operator(+), set_time, print_time + +implicit none + +type(time_type) :: Time +integer, dimension(2) :: layout = (/1,1/) +integer :: nlon, nlat, nz +type(domain2d) :: Domain +real, dimension(:), allocatable :: x, y, z +integer :: i, j +integer :: is, ie, js, je +real, allocatable, dimension(:,:,:) :: sst, ice +integer :: id_x, id_y, id_z, id_sst, id_ice +integer :: used + +call fms_init +call set_calendar_type(JULIAN) +call diag_manager_init + +nlon = 20 +nlat = 20 +nz = 5 + +call mpp_domains_set_stack_size(17280000) +call mpp_define_domains( (/1,nlon,1,nlat/), layout, Domain, name='test_diag_manager') +call mpp_define_io_domain(Domain, (/1,1/)) +call mpp_get_compute_domain(Domain, is, ie, js, je) + +! Set up the data +allocate(x(nlon), y(nlat), z(nz)) +allocate(sst(is:ie,js:je,1:nz), ice(is:ie,js:je,1:nz)) + +do i=1,nlon + x(i) = i +enddo +do j=1,nlat + y(j) = j +enddo +do i=1,nz + z(i) = i +enddo + +sst = 666.66 +ice = 619.0 + +! Set up the intial time +Time = set_date(2,1,1,0,0,0) + +! Register the diags +id_x = diag_axis_init('x', x, 'point_E', 'x', long_name='point_E', Domain2=Domain) +id_y = diag_axis_init('y', y, 'point_N', 'y', long_name='point_N', Domain2=Domain) +id_z = diag_axis_init('z', z, 'point_Z', 'z', long_name='point_Z') +id_sst = register_diag_field ('test_diag_manager_mod', 'sst', (/id_x,id_y,id_z/), Time, 'SST', 'K') + +! Send the axis data +used = send_data(id_x, x, Time) +used = send_data(id_y, y, Time) +used = send_data(id_z, z, Time) + +! Increase the time and send data +do i=1,20 +Time = set_date(2,1,i,0,0,0) +if(id_sst > 0) used = send_data(id_sst, sst, Time) +enddo + +call diag_manager_end(Time) +call fms_end + +end program test_diag_manager From 41e78a2dc83f1d8865cb4076d3b861acaf920055 Mon Sep 17 00:00:00 2001 From: Uriel Ramirez Date: Tue, 27 Oct 2020 15:43:25 -0400 Subject: [PATCH 2/6] Forgot to add the Makefile! --- test_fms/ufs_crash/Makefile.am | 49 ++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 test_fms/ufs_crash/Makefile.am diff --git a/test_fms/ufs_crash/Makefile.am b/test_fms/ufs_crash/Makefile.am new file mode 100644 index 0000000000..d33414ccba --- /dev/null +++ b/test_fms/ufs_crash/Makefile.am @@ -0,0 +1,49 @@ +#*********************************************************************** +#* GNU Lesser General Public License +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* FMS is free software: you can redistribute it and/or modify it under +#* the terms of the GNU Lesser General Public License as published by +#* the Free Software Foundation, either version 3 of the License, or (at +#* your option) any later version. +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +#* for more details. +#* +#* You should have received a copy of the GNU Lesser General Public +#* License along with FMS. If not, see . +#*********************************************************************** + +# This is an automake file for the test_fms/diag_manager directory of the FMS +# package. +# uramirez, Ed Hartnett + +# Find the needed mod and .inc files. +AM_CPPFLAGS = -I${top_srcdir}/include \ + -I${top_builddir}/mpp \ + -I${top_builddir}/fms \ + -I${top_builddir}/axis_utils \ + -I${top_builddir}/diag_manager \ + -I${top_builddir}/time_manager \ + -I${top_builddir}/constants \ + -I${top_builddir}/platform + +# Link to the FMS library. +LDADD = ${top_builddir}/libFMS/libFMS.la + +# Build this test program. +check_PROGRAMS = test_diag_manager_time + +# This is the source code for the test. +test_diag_manager_time_SOURCES = test_diag_manager_time.F90 + +# Run the test. +TESTS = test_diag_manager2.sh + +# Copy over other needed files to the srcdir +EXTRA_DIST = input.nml_base input.nml_base_mppio diagTables test_diag_manager2.sh + +CLEANFILES = input.nml *.nc *.out diag_table From 5bd55b87eb6f5b5d6a6bbcd63acb587bcffe9f9d Mon Sep 17 00:00:00 2001 From: Uriel Ramirez Date: Tue, 27 Oct 2020 15:53:40 -0400 Subject: [PATCH 3/6] Correction for makecheck --- test_fms/ufs_crash/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_fms/ufs_crash/Makefile.am b/test_fms/ufs_crash/Makefile.am index d33414ccba..1fb5affc97 100644 --- a/test_fms/ufs_crash/Makefile.am +++ b/test_fms/ufs_crash/Makefile.am @@ -44,6 +44,6 @@ test_diag_manager_time_SOURCES = test_diag_manager_time.F90 TESTS = test_diag_manager2.sh # Copy over other needed files to the srcdir -EXTRA_DIST = input.nml_base input.nml_base_mppio diagTables test_diag_manager2.sh +EXTRA_DIST = input.nml diag_table test_diag_manager2.sh -CLEANFILES = input.nml *.nc *.out diag_table +CLEANFILES = *.nc *.out From 0b06b3dbf359b30b3672a909ae808960e2d73bb0 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Tue, 3 Nov 2020 09:38:39 -0500 Subject: [PATCH 4/6] Updates the ufs_crash test script --- test_fms/ufs_crash/test_diag_manager2.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test_fms/ufs_crash/test_diag_manager2.sh b/test_fms/ufs_crash/test_diag_manager2.sh index ceb85a1e78..643db1e2fc 100755 --- a/test_fms/ufs_crash/test_diag_manager2.sh +++ b/test_fms/ufs_crash/test_diag_manager2.sh @@ -26,4 +26,6 @@ # Set common test settings. . ../test_common.sh +cp $top_srcdir/test_fms/ufs_crash/input.nml input.nml +cp $top_srcdir/test_fms/ufs_crash/diag_table diag_table run_test test_diag_manager_time 1 From 7628f8e109fe023dc7a99c9643f2ca27b1c8b721 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Wed, 4 Nov 2020 08:42:29 -0500 Subject: [PATCH 5/6] Adds check for time variable in diag files to determine whether or not to register the time asix/variable --- diag_manager/diag_output.F90 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/diag_manager/diag_output.F90 b/diag_manager/diag_output.F90 index b990b724d0..2c8afd5b9d 100644 --- a/diag_manager/diag_output.F90 +++ b/diag_manager/diag_output.F90 @@ -579,7 +579,11 @@ SUBROUTINE write_axis_meta_data_fms2_io(file_unit, axes, fileob, time_ops, time_ endif ELSE - if ( allocated(fptr%pelist) .and. .not. is_time_axis_registered) then +!> @note Check if the time variable is registered. It's possible that is_time_axis_registered is set to true if using +!! time-templated files because they aren't closed when done writing. An alternative to this set up would be to put +!! variable_exists into the if statement with an .or. so that it gets registered. + is_time_axis_registered = variable_exists(fptr,trim(axis_name),.true.) + if (allocated(fptr%pelist) .and. .not. is_time_axis_registered) then select type (fptr) type is (FmsNetcdfDomainFile_t) call register_axis(fptr, trim(axis_name), unlimited ) From 7b1be953ab5c5451b93d840d1368f511364fef5d Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Wed, 4 Nov 2020 09:23:45 -0500 Subject: [PATCH 6/6] Cleans up files in ufs_crash test for distcheck --- test_fms/ufs_crash/test_diag_manager2.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test_fms/ufs_crash/test_diag_manager2.sh b/test_fms/ufs_crash/test_diag_manager2.sh index 643db1e2fc..6ce07884e1 100755 --- a/test_fms/ufs_crash/test_diag_manager2.sh +++ b/test_fms/ufs_crash/test_diag_manager2.sh @@ -29,3 +29,4 @@ cp $top_srcdir/test_fms/ufs_crash/input.nml input.nml cp $top_srcdir/test_fms/ufs_crash/diag_table diag_table run_test test_diag_manager_time 1 +rm -f input.nml diag_table