fix: improve modern diag manager performance (#1634)
[FMS.git] / test_fms / diag_manager / test_subregional.sh
blobdcb1f5e9da009293b3a9b3caa2894a8ea7a0dc75
1 #!/bin/sh
3 #***********************************************************************
4 #* GNU Lesser General Public License
5 #*
6 #* This file is part of the GFDL Flexible Modeling System (FMS).
7 #*
8 #* FMS is free software: you can redistribute it and/or modify it under
9 #* the terms of the GNU Lesser General Public License as published by
10 #* the Free Software Foundation, either version 3 of the License, or (at
11 #* your option) any later version.
13 #* FMS is distributed in the hope that it will be useful, but WITHOUT
14 #* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 #* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 #* for more details.
18 #* You should have received a copy of the GNU Lesser General Public
19 #* License along with FMS. If not, see <http://www.gnu.org/licenses/>.
20 #***********************************************************************
22 # Set common test settings.
23 . ../test-lib.sh
25 if [ -z "${skipflag}" ]; then
26 # create and enter directory for in/output files
27 output_dir
29 cat <<_EOF > diag_table.yaml
30 title: test_subregional
31 base_date: 2 1 1 0 0 0
33 diag_files:
34 # This is to test a file with multiple z axis
35 - file_name: test_subZaxis
36 freq: 6 hours
37 time_units: hours
38 unlimdim: time
39 varlist:
40 - module: ocn_mod
41 var_name: var3
42 output_name: var3_Z1
43 reduction: none
44 kind: r4
45 zbounds: 2. 3.
46 - module: ocn_mod
47 var_name: var3
48 output_name: var3_Z2
49 reduction: none
50 kind: r4
51 zbounds: 3. 5.
52 - file_name: test_subregional
53 freq: 6 hours
54 time_units: hours
55 unlimdim: time
56 sub_region:
57 - grid_type: latlon
58 corner1: 60. 60.
59 corner2: 60. 65.
60 corner3: 65. 65.
61 corner4: 65. 60.
62 varlist:
63 - module: ocn_mod
64 var_name: var3
65 output_name: var3_min
66 reduction: min
67 kind: r4
68 - module: ocn_mod
69 var_name: var3
70 output_name: var3_max
71 reduction: max
72 kind: r4
73 - file_name: test_subregional2
74 freq: 6 hours
75 time_units: hours
76 unlimdim: time
77 sub_region:
78 - grid_type: index
79 corner1: 60 60
80 corner2: 60 65
81 corner3: 65 65
82 corner4: 65 60
83 tile: 1
84 varlist:
85 - module: ocn_mod
86 var_name: var3
87 output_name: var3_min
88 reduction: min
89 kind: r4
90 - module: ocn_mod
91 var_name: var3
92 output_name: var3_max
93 reduction: max
94 kind: r4
95 _EOF
97 # remove any existing files that would result in false passes during checks
98 rm -f *.nc
100 my_test_count=1
101 printf "&diag_manager_nml \n use_modern_diag=.true. \n/" | cat > input.nml
102 test_expect_success "Running diag_manager with different subregions (test $my_test_count)" '
103 mpirun -n 6 ../test_reduction_methods
106 cat <<_EOF > diag_table.yaml
107 title: test_corner_subregional
108 base_date: 2 1 1 0 0 0
109 diag_files:
110 - file_name: test_corner1
111 time_units: hours
112 unlimdim: time
113 freq: 6 hours
114 varlist:
115 - module: ocn_mod
116 var_name: var2c
117 output_name: var2c_avg
118 reduction: average
119 kind: r4
120 sub_region:
121 - grid_type: latlon
122 corner1: 17. 17.
123 corner2: 17. 20.
124 corner3: 20. 17.
125 corner4: 20. 20.
126 - file_name: test_corner2
127 time_units: hours
128 unlimdim: time
129 freq: 6 hours
130 varlist:
131 - module: ocn_mod
132 var_name: var2c
133 output_name: var2c_avg
134 reduction: average
135 kind: r4
136 sub_region:
137 - grid_type: latlon
138 corner1: 17. 17.
139 corner2: 20. 17.
140 corner3: 17. 17.
141 corner4: 20. 17.
142 - file_name: test_corner3
143 time_units: hours
144 unlimdim: time
145 freq: 6 hours
146 varlist:
147 - module: ocn_mod
148 var_name: var2c
149 output_name: var2c_avg
150 reduction: average
151 kind: r4
152 sub_region:
153 - grid_type: latlon
154 corner1: 17. 17.
155 corner2: 20. 17.
156 corner3: 17. 33.
157 corner4: 20. 33.
158 _EOF
160 my_test_count=`expr $my_test_count + 1`
161 printf "&diag_manager_nml \n use_modern_diag=.true. \n/" | cat > input.nml
162 test_expect_success "Running diag_manager with corner diagnotics (test $my_test_count)" '
163 mpirun -n 6 ../test_reduction_methods
166 my_test_count=`expr $my_test_count + 1`
167 test_expect_success "Checking results from diag_manager with different subregions (test $my_test_count)" '
168 mpirun -n 1 ../check_subregional
172 test_done