diff --git a/tests/Makefile b/tests/Makefile index 42a0bd6..486426f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,5 +1,5 @@ FC = gfortran -FCFLAGS = -Dstandalone -fdefault-real-8 -fdefault-double-8 +FCFLAGS = -Dstandalone -fdefault-real-8 -fdefault-double-8 -g -fbacktrace SRC=machine.F90 ccpp_kind_types.F90 physcons.F90 ../module_sf_mynnsfc.F90 module_sf_mynnsfc_ccpp_tests.F90 module_state_description.F90 module_model_constants.F90 ../WRF/module_sf_mynnsfc_common.F90 ../module_sf_mynnsfc_land.F90 ../module_sf_mynnsfc_water.F90 ../module_sf_mynnsfc_ice.F90 ../WRF/module_sf_mynnsfc_driver.F90 module_sf_mynnsfc_wrf_tests.F90 driver.F90 OBJ=machine.o ccpp_kind_types.o physcons.o module_sf_mynnsfc.o module_sf_mynnsfc_ccpp_tests.o module_state_description.o module_model_constants.o module_sf_mynnsfc_common.o module_sf_mynnsfc_land.o module_sf_mynnsfc_water.o module_sf_mynnsfc_ice.o module_sf_mynnsfc_driver.o module_sf_mynnsfc_wrf_tests.o driver.o diff --git a/tests/README b/tests/README deleted file mode 100644 index 9092bcf..0000000 --- a/tests/README +++ /dev/null @@ -1,12 +0,0 @@ -CI tests for MYNN SFC include the following cases: - -ccpp_test(), on July 13, 2019 at SGP site -wrf_test('lnd'), on Aug 23, 2024 near (41.91, -73.12) -wrf_test('wat'), on Aug 23, 2024 near (41.78, -67.61) -wrf_test('icy'), on Feb 28, 2024 near (46.54, -73.53) - -To run the CI tests offline: - -cd tests -make -./driver diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..f232f82 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,23 @@ +## CI tests for MYNN-SFC + +* Cases include: + * ccpp_test(), on July 13, 2019 at SGP site over land + * wrf_test('lnd'), on Aug 23, 2024 near (41.91, -73.12) over land + * wrf_test('wat'), on Aug 23, 2024 near (41.78, -67.61) over water + * wrf_test('icy'), on Feb 28, 2024 near (46.54, -73.53) over land covered with snow + +* Input: + + * Input file for ccpp_test() is generated using CCPP SCM + * Input files for wrf_test() is generated using WRFv4.5.1 + +* Output: + * The CI test generates output files under ```tests/data``` dir + +* To run the CI tests offline: + + ``` + cd tests + make + ./driver + ``` \ No newline at end of file diff --git a/tests/data/output_icy.txt b/tests/data/output_icy.txt index d725836..41b9a9a 100644 --- a/tests/data/output_icy.txt +++ b/tests/data/output_icy.txt @@ -1,11 +1,11 @@ itime T2 Q2 TH2 U10 V10 HFX LH UST PBLH - 1 275.75 0.00 280.37 -1.70 2.31 -11.44 -20.66 0.31 155.22 - 2 275.80 0.00 280.50 -1.79 2.50 -12.44 -25.33 0.37 226.96 - 3 276.07 0.00 280.77 -1.56 3.05 -14.58 -30.15 0.43 266.45 - 4 276.22 0.00 281.01 -1.81 3.30 -18.60 -34.74 0.49 301.53 - 5 276.82 0.01 281.74 -2.47 3.26 -5.51 39.10 0.56 280.62 - 6 277.36 0.01 282.32 -1.83 4.27 -0.80 42.95 0.64 341.55 - 7 277.38 0.01 282.41 -2.46 3.75 -22.80 44.54 0.67 326.60 + 1 275.75 0.00 280.37 -1.70 2.31 -11.44 -21.03 0.32 163.09 + 2 275.80 0.00 280.50 -1.79 2.50 -12.44 -25.52 0.37 226.96 + 3 276.07 0.00 280.77 -1.56 3.05 -14.58 -30.24 0.43 266.45 + 4 276.22 0.00 281.01 -1.81 3.30 -18.60 -34.79 0.49 301.53 + 5 276.82 0.01 281.74 -2.47 3.26 -5.51 39.12 0.56 280.62 + 6 277.36 0.01 282.32 -1.83 4.27 -0.80 42.96 0.64 341.55 + 7 277.38 0.01 282.41 -2.46 3.75 -22.80 44.55 0.67 326.60 8 277.66 0.01 282.71 -2.39 3.90 -30.16 43.21 0.68 326.41 9 278.30 0.01 283.46 -1.66 4.55 -38.70 42.52 0.71 317.40 10 279.00 0.01 284.26 -2.26 4.68 -41.44 41.54 0.75 327.18 diff --git a/tests/data/output_lnd.txt b/tests/data/output_lnd.txt index 89bc9ab..e1eb6a2 100644 --- a/tests/data/output_lnd.txt +++ b/tests/data/output_lnd.txt @@ -1,49 +1,49 @@ itime T2 Q2 TH2 U10 V10 HFX LH UST PBLH - 1 290.17 0.01 291.76 2.01 -1.40 -6.78 125.83 0.24 66.57 - 2 290.92 0.01 292.55 2.26 -1.58 38.62 148.53 0.35 289.92 - 3 291.64 0.01 293.22 2.45 -1.75 74.47 161.66 0.44 370.66 - 4 292.17 0.01 293.79 2.76 -1.75 110.90 168.38 0.52 465.42 - 5 292.73 0.01 294.31 2.75 -1.49 136.30 172.77 0.57 583.38 - 6 293.20 0.01 294.83 2.87 -1.16 164.14 160.83 0.60 882.24 - 7 293.58 0.01 295.24 2.72 -0.87 195.54 1185.15 0.64 1256.67 - 8 294.13 0.01 295.78 2.31 -0.86 211.79 1220.79 0.68 1541.13 - 9 294.57 0.01 296.20 2.03 -1.12 204.36 1226.01 0.70 1691.51 - 10 294.85 0.01 296.48 1.91 -1.54 196.37 1257.65 0.72 1765.42 - 11 295.03 0.01 296.68 1.66 -1.79 172.58 1266.84 0.73 1795.23 - 12 295.18 0.01 296.90 1.29 -1.96 173.05 1238.08 0.72 1772.69 - 13 295.37 0.01 297.10 1.18 -1.91 162.91 1214.13 0.71 1720.50 - 14 295.56 0.01 297.27 1.09 -2.07 140.62 1204.12 0.70 1744.57 - 15 295.68 0.01 297.36 1.23 -2.02 110.33 1179.04 0.69 1792.89 - 16 295.70 0.01 297.43 1.15 -1.86 79.38 1142.62 0.67 1810.04 - 17 295.74 0.01 297.45 0.84 -1.62 47.08 164.40 0.62 1814.74 - 18 295.68 0.01 297.38 0.67 -1.48 18.87 122.10 0.53 1824.39 - 19 295.51 0.01 297.24 0.35 -1.47 -0.92 92.11 0.44 1830.92 - 20 295.24 0.01 296.97 0.17 -0.83 -6.38 44.30 0.30 1852.08 - 21 294.51 0.01 296.20 0.09 1.55 -7.76 -2.86 0.24 1836.00 - 22 293.26 0.01 294.94 0.37 1.88 -13.70 -20.13 0.21 770.41 - 23 292.65 0.01 294.35 0.92 1.69 -12.43 -16.11 0.18 420.60 - 24 292.17 0.01 293.83 1.32 1.91 -23.89 -22.85 0.19 308.69 - 25 291.81 0.01 293.41 1.46 1.95 -28.74 -20.80 0.20 235.84 - 26 291.43 0.01 293.06 1.41 1.96 -29.01 -14.23 0.21 178.68 - 27 291.14 0.01 292.77 1.35 2.00 -29.31 -9.57 0.21 138.77 - 28 290.90 0.01 292.51 1.58 1.95 -34.30 -5.35 0.22 124.96 - 29 290.77 0.01 292.37 1.45 1.90 -30.22 0.03 0.23 97.91 - 30 290.46 0.01 292.09 1.50 1.82 -28.94 0.03 0.23 88.75 - 31 290.27 0.01 291.90 1.89 1.45 -30.21 2.93 0.23 93.07 - 32 290.03 0.01 291.66 1.96 1.42 -32.37 8.96 0.24 86.92 - 33 289.68 0.01 291.32 2.12 0.58 -24.30 10.51 0.22 78.39 - 34 289.49 0.01 291.16 2.57 0.11 -39.21 16.40 0.25 75.81 - 35 289.50 0.01 291.16 2.60 -0.57 -42.94 13.66 0.27 203.36 - 36 289.51 0.01 291.16 2.29 -1.14 -38.59 12.27 0.26 132.86 - 37 289.34 0.01 290.97 2.12 -1.36 -36.32 11.61 0.25 87.16 - 38 289.25 0.01 290.88 2.03 -1.52 -36.70 13.89 0.24 69.40 - 39 289.18 0.01 290.79 2.12 -1.47 -38.67 16.34 0.24 70.05 - 40 289.02 0.01 290.62 2.16 -1.36 -37.44 18.29 0.23 62.04 - 41 288.78 0.01 290.42 2.09 -1.39 -35.35 20.02 0.22 55.05 - 42 288.65 0.01 290.29 2.10 -1.37 -34.91 21.64 0.22 55.70 - 43 288.61 0.01 290.22 2.13 -1.34 -35.62 25.85 0.21 66.08 - 44 288.54 0.01 290.12 2.14 -1.42 -37.69 28.11 0.21 69.09 - 45 288.51 0.01 290.06 2.17 -1.46 -41.45 32.46 0.22 65.05 - 46 288.86 0.01 290.43 1.98 -1.48 -36.67 35.10 0.22 57.93 - 47 289.73 0.01 291.32 1.66 -1.35 -24.62 32.84 0.23 57.50 - 48 290.92 0.01 292.51 1.29 -1.01 -8.55 24.78 0.22 66.36 + 1 290.18 0.01 291.77 2.01 -1.40 -5.05 108.05 0.28 117.89 + 2 290.89 0.01 292.52 2.26 -1.58 30.06 121.62 0.37 289.92 + 3 291.59 0.01 293.17 2.45 -1.75 58.21 129.28 0.45 370.66 + 4 292.10 0.01 293.72 2.76 -1.75 86.75 133.00 0.52 465.42 + 5 292.65 0.01 294.22 2.75 -1.49 105.74 134.86 0.55 583.38 + 6 293.10 0.01 294.74 2.87 -1.16 126.66 124.70 0.59 882.24 + 7 293.48 0.01 295.15 2.72 -0.87 148.06 903.67 0.62 1256.67 + 8 294.02 0.01 295.67 2.31 -0.86 158.84 924.21 0.64 1541.13 + 9 294.47 0.01 296.10 2.03 -1.12 153.14 924.24 0.66 1691.51 + 10 294.75 0.01 296.38 1.91 -1.54 147.94 948.12 0.67 1765.42 + 11 294.94 0.01 296.59 1.66 -1.79 130.28 955.09 0.68 1795.23 + 12 295.09 0.01 296.81 1.29 -1.96 130.47 931.86 0.67 1772.69 + 13 295.28 0.01 297.02 1.18 -1.91 122.71 913.33 0.66 1720.50 + 14 295.49 0.01 297.19 1.09 -2.07 106.35 908.03 0.66 1744.57 + 15 295.62 0.01 297.30 1.23 -2.02 83.84 892.23 0.65 1792.89 + 16 295.66 0.01 297.38 1.15 -1.86 60.29 865.17 0.63 1810.04 + 17 295.71 0.01 297.41 0.84 -1.62 35.98 125.48 0.58 1814.74 + 18 295.66 0.01 297.36 0.67 -1.48 14.60 93.76 0.49 1824.39 + 19 295.51 0.01 297.24 0.35 -1.47 -0.73 71.90 0.41 1830.92 + 20 295.27 0.01 297.00 0.17 -0.83 -5.35 36.38 0.29 1852.08 + 21 294.55 0.01 296.23 0.09 1.55 -7.41 -2.56 0.23 1836.00 + 22 293.33 0.01 295.00 0.37 1.88 -13.62 -19.15 0.22 770.41 + 23 292.74 0.01 294.44 0.92 1.69 -13.53 -16.63 0.19 420.60 + 24 292.29 0.01 293.95 1.32 1.91 -24.84 -23.46 0.20 308.69 + 25 291.94 0.01 293.55 1.46 1.95 -29.65 -21.33 0.22 235.84 + 26 291.57 0.01 293.20 1.41 1.96 -29.65 -14.52 0.23 178.68 + 27 291.28 0.01 292.92 1.35 2.00 -30.12 -9.80 0.23 138.77 + 28 291.04 0.01 292.66 1.58 1.95 -34.21 -5.36 0.24 124.96 + 29 290.90 0.01 292.51 1.45 1.90 -29.89 0.03 0.25 97.91 + 30 290.59 0.01 292.22 1.50 1.82 -28.78 0.03 0.24 88.75 + 31 290.39 0.01 292.02 1.89 1.45 -29.65 2.89 0.25 93.07 + 32 290.16 0.01 291.79 1.96 1.42 -31.71 8.79 0.26 86.92 + 33 289.80 0.01 291.44 2.12 0.58 -24.27 10.45 0.24 78.39 + 34 289.62 0.01 291.29 2.57 0.11 -37.32 15.75 0.27 75.81 + 35 289.64 0.01 291.30 2.60 -0.57 -40.92 13.05 0.28 203.36 + 36 289.67 0.01 291.32 2.29 -1.14 -38.03 12.01 0.28 132.86 + 37 289.50 0.01 291.13 2.12 -1.36 -36.19 11.49 0.27 87.16 + 38 289.43 0.01 291.06 2.03 -1.52 -37.52 14.06 0.26 69.40 + 39 289.36 0.01 290.97 2.12 -1.47 -39.77 16.69 0.26 70.05 + 40 289.20 0.01 290.80 2.16 -1.36 -38.58 18.78 0.25 62.04 + 41 288.97 0.01 290.60 2.09 -1.39 -36.74 20.72 0.25 55.05 + 42 288.84 0.01 290.48 2.10 -1.37 -36.98 22.77 0.24 55.70 + 43 288.80 0.01 290.41 2.13 -1.34 -37.67 27.26 0.24 66.08 + 44 288.74 0.01 290.33 2.14 -1.42 -40.26 29.91 0.24 69.09 + 45 288.71 0.01 290.27 2.17 -1.46 -43.03 33.88 0.24 65.05 + 46 289.03 0.01 290.60 1.98 -1.48 -36.78 35.60 0.25 57.93 + 47 289.83 0.01 291.42 1.66 -1.35 -23.47 31.85 0.24 57.50 + 48 290.94 0.01 292.54 1.29 -1.01 -7.51 22.34 0.23 66.36 diff --git a/tests/driver.F90 b/tests/driver.F90 index eb4d15d..fab08d6 100644 --- a/tests/driver.F90 +++ b/tests/driver.F90 @@ -6,9 +6,21 @@ program driver use module_sf_mynnsfc_common,only: kind_phys,cp,lsm_ruc => ruclsmscheme use module_sf_mynnsfc_ccpp_tests use module_sf_mynnsfc_wrf_tests + implicit none - call ccpp_test() - call wrf_test(case='wat') - call wrf_test(case='lnd') - call wrf_test(case='icy') + + call ccpp_test(saveoutput=.true.) + + call wrf_test(case='wat', sf_mynn_sfcflux_water=1, sf_mynn_sfcflux_land=1, saveoutput=.true.) + call wrf_test(case='wat', sf_mynn_sfcflux_water=0, sf_mynn_sfcflux_land=1, saveoutput=.false.) + call wrf_test(case='wat', sf_mynn_sfcflux_water=2, sf_mynn_sfcflux_land=1, saveoutput=.false.) + call wrf_test(case='wat', sf_mynn_sfcflux_water=3, sf_mynn_sfcflux_land=1, saveoutput=.false.) + call wrf_test(case='wat', sf_mynn_sfcflux_water=4, sf_mynn_sfcflux_land=1, saveoutput=.false.) + + call wrf_test(case='lnd', sf_mynn_sfcflux_water=1, sf_mynn_sfcflux_land=1, saveoutput=.true.) + call wrf_test(case='lnd', sf_mynn_sfcflux_water=1, sf_mynn_sfcflux_land=0, saveoutput=.false.) + call wrf_test(case='lnd', sf_mynn_sfcflux_water=1, sf_mynn_sfcflux_land=2, saveoutput=.false.) + + call wrf_test(case='icy', sf_mynn_sfcflux_water=1, sf_mynn_sfcflux_land=0, saveoutput=.true.) + end program driver diff --git a/tests/module_sf_mynnsfc_ccpp_tests.F90 b/tests/module_sf_mynnsfc_ccpp_tests.F90 index a7c4653..ad7f2d5 100644 --- a/tests/module_sf_mynnsfc_ccpp_tests.F90 +++ b/tests/module_sf_mynnsfc_ccpp_tests.F90 @@ -10,7 +10,8 @@ subroutine init_mynn_sfc_flags_for_test_all_true() ! for future use end subroutine init_mynn_sfc_flags_for_test_all_true !================================================================================================================= - subroutine init_input_data_for_test() + subroutine init_input_data_for_test(saveoutput) + logical, intent(in) :: saveoutput integer :: iostat, line_num character(len=2000) :: input_line integer, parameter :: input_unit = 10 @@ -18,7 +19,7 @@ subroutine init_input_data_for_test() write(*,*) '--- opening data files ---' ! Open input file - open(unit=input_unit, file='./data/input_lnd.txt', status='old', action='read', iostat=iostat) + open(unit=input_unit, file='./data/ccpp_input_lnd.txt', status='old', action='read', iostat=iostat) if (iostat /= 0) then print *, 'Error opening input file' @@ -26,13 +27,15 @@ subroutine init_input_data_for_test() end if ! Open output file - open(unit=output_unit, file='./data/ccpp_output_lnd.txt', status='replace', action='write', iostat=iostat) - write(output_unit,'(A5, A5, A10, A10, A10, A10, A10, A10, A10, A10, A10)') & - 'itimestep', 'iter', 'T2', 'Q2', 'TH2', 'U10', 'V10', 'HFX', 'LH', 'UST_lnd','PBLH' - if (iostat /= 0) then - print *, 'Error opening output file' - close(output_unit) - stop + if (saveoutput) then + open(unit=output_unit, file='./data/ccpp_output_lnd.txt', status='replace', action='write', iostat=iostat) + write(output_unit,'(A5, A5, A10, A10, A10, A10, A10, A10, A10, A10, A10)') & + 'itimestep', 'iter', 'T2', 'Q2', 'TH2', 'U10', 'V10', 'HFX', 'LH', 'UST_lnd','PBLH' + if (iostat /= 0) then + print *, 'Error opening output file' + close(output_unit) + stop + end if end if end subroutine init_input_data_for_test @@ -183,15 +186,17 @@ subroutine process_line(line, out_unit, line_number, flag_iter, & ! Debug: print the line being read write(0,*) "Line length:", len_trim(line) - write(0,*) "U1D=",U1D, "flag_iter=",flag_iter, "V1D=", V1D," ZNT", ZNT_lnd, "WSPD=",WSPD + write(0,*) "U1D=",U1D !, "flag_iter=",flag_iter, "V1D=", V1D," ZNT", ZNT_lnd, "WSPD=",WSPD end subroutine process_line !================================================================================================================= - subroutine ccpp_test() + subroutine ccpp_test(saveoutput) !use module_sf_mynnsfc_driver, only : SFCLAY1D_mynn use module_sf_mynnsfc, only : SFCLAY1D_mynn + + logical, intent(in) :: saveoutput integer :: iostat, line_num integer, parameter :: ids=1, ide=1, jds=1, jde=1, kds=1,kde=1 integer, parameter :: ims=1, ime=1, jms=1, jme=1, kms=1,kme=1 @@ -241,7 +246,7 @@ subroutine ccpp_test() write(*,*) '--- entering ccpp_test subroutine' ! Initialize input data for tests - call init_input_data_for_test() + call init_input_data_for_test(saveoutput) ! Read header read(input_unit, '(A)', iostat=iostat) input_line @@ -342,9 +347,11 @@ subroutine ccpp_test() write(0,*) "T2=",T2 write(0,*) "Read status:", read_stat - open(output_unit, file = './data/ccpp_output_lnd.txt') - write(output_unit,'(I5, I5, F10.2,F10.2,F10.2,F10.2,F10.2,F10.2,F10.2,F15.2,F10.2)') itimestep, & - iter,T2,Q2,TH2,U10,V10,HFX,LH,UST_lnd,PBLH + if (saveoutput) then + open(output_unit, file = './data/ccpp_output_lnd.txt') + write(output_unit,'(I5, I5, F10.2,F10.2,F10.2,F10.2,F10.2,F10.2,F10.2,F15.2,F10.2)') itimestep, & + iter,T2,Q2,TH2,U10,V10,HFX,LH,UST_lnd,PBLH + end if end do end subroutine ccpp_test diff --git a/tests/module_sf_mynnsfc_wrf_tests.F90 b/tests/module_sf_mynnsfc_wrf_tests.F90 index 2589288..650a437 100644 --- a/tests/module_sf_mynnsfc_wrf_tests.F90 +++ b/tests/module_sf_mynnsfc_wrf_tests.F90 @@ -5,7 +5,7 @@ module module_sf_mynnsfc_wrf_tests !================================================================================================================= implicit none logical :: cycling,restart,flag_iter - integer :: initflag, spp_pbl, isfflx,sf_mynn_sfcflux_water,sf_mynn_sfcflux_land,flag_lsm,lsm + integer :: initflag, spp_pbl, isfflx, flag_lsm,lsm real,dimension(1) :: pattern_spp_pbl contains @@ -17,17 +17,16 @@ subroutine init_mynn_sfc_flags() restart=.false. pattern_spp_pbl=0.0 isfflx =1 - sf_mynn_sfcflux_water=1 - sf_mynn_sfcflux_land=1 flag_lsm=3 lsm=3 flag_iter = .true. end subroutine init_mynn_sfc_flags !================================================================================================================= - subroutine init_input_data_for_test(case) + subroutine init_input_data_for_test(case,saveoutput) integer :: iostat, line_num character(len=*),intent(in) :: case + logical,intent(in) :: saveoutput character(len=2000) :: input_line integer, parameter :: input_unit = 10 integer, parameter :: output_unit = 20 @@ -43,14 +42,16 @@ subroutine init_input_data_for_test(case) end if ! Open output file - close(unit=output_unit) - open(unit=output_unit, file='./data/output_'//trim(case)//'.txt', status='replace', action='write', iostat=iostat) - write(output_unit,'(A5, A10, A10, A10, A10, A10, A10, A10, A10, A10)') & - 'itimestep', 'T2', 'Q2', 'TH2', 'U10', 'V10', 'HFX', 'LH', 'UST','PBLH' - if (iostat /= 0) then - print *, 'Error opening output file' - close(output_unit) - stop + if (saveoutput) then + close(unit=output_unit) + open(unit=output_unit, file='./data/output_'//trim(case)//'.txt', status='replace', action='write', iostat=iostat) + write(output_unit,'(A5, A10, A10, A10, A10, A10, A10, A10, A10, A10)') & + 'itimestep', 'T2', 'Q2', 'TH2', 'U10', 'V10', 'HFX', 'LH', 'UST','PBLH' + if (iostat /= 0) then + print *, 'Error opening output file' + close(output_unit) + stop + end if end if end subroutine init_input_data_for_test @@ -158,9 +159,11 @@ subroutine process_line_wrf(line, out_unit, line_number, & end subroutine process_line_wrf !================================================================================================================= - subroutine wrf_test (case) + subroutine wrf_test (case, sf_mynn_sfcflux_water, sf_mynn_sfcflux_land, saveoutput) - character(len=*), intent(in) ::case + character(len=*), intent(in) :: case + integer, intent(in) :: sf_mynn_sfcflux_water, sf_mynn_sfcflux_land + logical, intent(in) :: saveoutput integer :: iostat, line_num integer, parameter :: i=1, j=1 @@ -223,7 +226,7 @@ subroutine wrf_test (case) call init_mynn_sfc_flags () ! Initialize input data for tests - call init_input_data_for_test(case) + call init_input_data_for_test(case,saveoutput) ! Read header read(input_unit, '(A)', iostat=iostat) input_line @@ -313,9 +316,11 @@ subroutine wrf_test (case) write(0,*) "flag_iter",flag_iter,"T2=",t2,'chs=',ch,'ust=',UST,'hfx=',hfx_mod,'lh=',lh_mod,'xland=',xland, 'tsk', tsk write(0,*) "Read status:", read_stat - open(output_unit, file = './data/output_'//trim(case)//'.txt') - write(output_unit,'(I5, F10.2,F10.2,F10.2,F10.2,F10.2,F10.2,F10.2,F10.2,F10.2)') & - itimestep,t2_mod,q2_mod,th2_mod,u10_mod,v10_mod,hfx_mod,lh_mod,ust_mod,pblh + if (saveoutput) then + open(output_unit, file = './data/output_'//trim(case)//'.txt') + write(output_unit,'(I5, F10.2,F10.2,F10.2,F10.2,F10.2,F10.2,F10.2,F10.2,F10.2)') & + itimestep,t2_mod,q2_mod,th2_mod,u10_mod,v10_mod,hfx_mod,lh_mod,ust_mod,pblh + end if end do end subroutine wrf_test