diff --git a/.github/workflows/github_cmake_gnu.yml b/.github/workflows/github_cmake_gnu.yml index 6390e9af95..7a45fe80ce 100644 --- a/.github/workflows/github_cmake_gnu.yml +++ b/.github/workflows/github_cmake_gnu.yml @@ -18,25 +18,17 @@ jobs: container: image: ghcr.io/noaa-gfdl/fms/fms-ci-rocky-gnu:13.2.0 env: - CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }} -D64BIT=on" + CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }}" steps: - name: Checkout code uses: actions/checkout@v4.2.2 - name: Generate makefiles with CMake - run: cmake $CMAKE_FLAGS -DNetCDF_ROOT=/opt/view -DLIBYAML_ROOT=/opt/view - - name: Build the library - run: make - - name: Link with basic executable run: | - echo "program test" > test.F90 - echo " use fms_mod" >> test.F90 - echo " call fms_init" >> test.F90 - echo " call fms_end" >> test.F90 - echo "end program" >> test.F90 - mpifort -L/opt/view/lib -fopenmp `nf-config --flibs` -Iinclude_r4 -Iinclude_r8 test.F90 libfms_r4.a libfms_r8.a -o test.x - touch input.nml - - name: Run executable - run: ./test.x + mkdir build + cd build + cmake $CMAKE_FLAGS -DNetCDF_ROOT=/opt/view -DLIBYAML_ROOT=/opt/view .. + - name: Build the library + run: make -C build build_arm: runs-on: ubuntu-24.04-arm @@ -48,22 +40,14 @@ jobs: container: image: ghcr.io/noaa-gfdl/fms/fms-ci-rocky-gnu:13.2.0-arm env: - CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }} -D64BIT=on" + CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }}" steps: - name: Checkout code uses: actions/checkout@v4.2.2 - name: Generate makefiles with CMake - run: cmake $CMAKE_FLAGS -DNetCDF_ROOT=/opt/view -DLIBYAML_ROOT=/opt/view - - name: Build the library - run: make - - name: Link with basic executable run: | - echo "program test" > test.F90 - echo " use fms_mod" >> test.F90 - echo " call fms_init" >> test.F90 - echo " call fms_end" >> test.F90 - echo "end program" >> test.F90 - mpifort -L/opt/view/lib -fopenmp `nf-config --flibs` -Iinclude_r4 -Iinclude_r8 test.F90 libfms_r4.a libfms_r8.a -o test.x - touch input.nml - - name: Run executable - run: ./test.x \ No newline at end of file + mkdir build + cd build + cmake $CMAKE_FLAGS -DNetCDF_ROOT=/opt/view -DLIBYAML_ROOT=/opt/view .. + - name: Build the library + run: make -C build diff --git a/CMAKE_INSTRUCTIONS.md b/CMAKE_INSTRUCTIONS.md index 6eb014012e..cb6e927a24 100644 --- a/CMAKE_INSTRUCTIONS.md +++ b/CMAKE_INSTRUCTIONS.md @@ -1,42 +1,55 @@ \page cmake Building with CMake # Instructions for building FMS with cmake -## 1. Environment Variables +## 1. Configuring the build -### For GNU compilers on Linux with the bash shell: +### Environment Variables +#### For GNU compilers on Linux with the bash shell: ``` export FC=mpifort export CC=mpicc ``` - -### For Intel Compilers on Linux with the bash shell: - +#### For Intel Compilers on Linux with the bash shell: ``` export FC=mpiifort export CC=mpiicc ``` +MPI compiler wrappers may be named different on your system, so its best to ensure the compiler commands work prior to being set. -### NetCDF is provided via the `nc-config` command: +#### NetCDF is provided via the `nc-config` command: ``` export NetCDF_ROOT=`nc-config --prefix` ``` -### If building with yaml parser (-DWITH_YAML) +#### If building with yaml parser (-DWITH_YAML) ``` export LIBYAML_ROOT= ``` -### Setting custom flags with the bash shell -To override the default compiler flags: +### Running CMake +It's best to create a build directory inside of the FMS folder to avoid building on top of the source code. +Once that is done, CMake can be ran to generate the necessary build files: ``` -export FCFLAGS="" -export CFLAGS="" +mkdir build && cd build +cmake [-DWITH_YAML=on] .. ``` -In addition, the flag below must be included with the cmake command: + +### Setting a Build Type +CMake uses "build types" to set compiler flags. By default (.ie no -DCMAKE_BUILD_TYPE="Type" argument when cmake is run), it will use the "Release" build type which corresponds the the prod/opt flags used by the GFDL mkmf templates. + +Similarly "Repro" and "Debug" also correspond to whatever options would be set by theircorresponding mkmf template files. + +To reproduce the old behavior for the cmake build (2025.03 and prior), the "ReleaseUFS" and "DebugUFS" will use the same flags as before. + +Please open an issue in the FMS repository if you have any issues or would like to request any changes to the current build type options. + +### Setting custom flags +To override the default compiler flags, you can set them via CMake arguments: ``` -cmake -DCMAKE_BUILD_TYPE=Debug .. +cmake -DCMAKE_BUILD_TYPE="NoFlags" -DCMAKE_C_FLAGS="" -DCMAKE_Fortran_FLAGS="" ``` +By using the "NoFlags" build type, only necessary compilation flags will be added besides what is set via the cmake arguments. ## 2. Build and install FMS with CMake `` is the full install directory for FMS provided by user @@ -45,20 +58,25 @@ cmake -DCMAKE_BUILD_TYPE=Debug .. cd FMS mkdir -p build && cd build cmake -DCMAKE_INSTALL_PREFIX= .. -make -j4 +make -j make install ``` ### User configurable options: -By default, FMS is built without `OpenMP`, in `single precision (r4)` and delivered in static library files. +By default, FMS is built with `OpenMP` enabled and delivered in static library files. + +FMS has mixed precision real support for most interfaces. By default, one library will be created, +`libfms`, that is compiled with r8 defaults but also contains overloaded r4 routines. The 64BIT and 32BIT precision options will build distinct libraries when enabled with the given default -real size, libfms_r4 or libfms_r8. +real size, libfms_r4 or libfms_r8. These option are provided for backwards compatibility, but are no longer +supported by our development team, since mixed precision can now be used with a single library. +Unit tests currently only work when no precision option is specified. The following build options are available: ``` --DOPENMP "Build FMS with OpenMP support" DEFAULT: OFF --D32BIT "Build 32-bit (r4) FMS library" DEFAULT: ON +-DOPENMP "Build FMS with OpenMP support" DEFAULT: ON +-D32BIT "Build 32-bit (r4) FMS library" DEFAULT: OFF -D64BIT "Build 64-bit (r8) FMS library" DEFAULT: OFF -DFPIC "Build with position independent code" DEFAULT: OFF -DSHARED_LIBS "Build shared/dynamic libraries" DEFAULT: OFF @@ -74,10 +92,10 @@ The following build options are available: ## 3. Installation structure -When the above command finishes, the `` will have an `include_r4` and a `lib` directory. The `lib ` directory will have these files: +When the above command finishes, the `` will have an `include` and a `lib` directory. The `lib ` directory will have these files: ``` -libfms_r4.a +libfms.a cmake/fms/fms-targets.cmake cmake/fms/fms-targets-release.cmake cmake/fms/fms-config.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e269696344..e094455258 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,12 +30,12 @@ project(FMS include(GNUInstallDirs) -if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") +if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel|DebugUFS|ReleaseUFS)$") message(STATUS "Setting build type to 'Release' as none was specified.") set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "DebugUFS" "ReleaseUFS") endif() if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Intel|GNU|Clang|IntelLLVM)$") @@ -52,8 +52,8 @@ endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # Build options -option(OPENMP "Build FMS with OpenMP support" OFF) -option(32BIT "Build 32-bit (r4) FMS library" ON) +option(OPENMP "Build FMS with OpenMP support" ON) +option(32BIT "Build 32-bit (r4) FMS library" OFF) option(64BIT "Build 64-bit (r8) FMS library" OFF) option(FPIC "Build with position independent code" OFF) option(SHARED_LIBS "Build shared/dynamic libraries" OFF) @@ -76,7 +76,7 @@ endif() if(NOT kinds) message(STATUS "Single Precision 32BIT: ${32BIT}") message(STATUS "Double Precision 64BIT: ${64BIT}") - message(FATAL_ERROR "Either 32BIT or 64BIT should be ON") + message(STATUS "No kind specified, building default double precision (with mixed precision support). Real size will not be included in built library name.") endif() # Find dependencies @@ -89,7 +89,7 @@ if (OPENMP) endif() if (WITH_YAML) - find_package(libyaml REQUIRED) + find_package(libyaml REQUIRED COMPONENTS C) include_directories(${LIBYAML_INCLUDE_DIR}) endif () @@ -208,6 +208,7 @@ list(APPEND fms_c_src_files parser/yaml_parser_binding.c parser/yaml_output_functions.c string_utils/fms_string_utils_binding.c + test_fms/fms/test_fmsC.c # TODO just easier to lump this with the rest of the C src ) # Collect FMS header files @@ -290,6 +291,7 @@ IF(NOT NetCDF_PARALLEL) list(APPEND fms_defs NO_NC_PARALLEL4) ENDIF() +# TODO remove this section eventually, separate builds are no longer required foreach(kind ${kinds}) set(libTgt fms_${kind}) @@ -302,7 +304,6 @@ foreach(kind ${kinds}) target_include_directories(${libTgt}_c PRIVATE include grid_utils) target_compile_definitions(${libTgt}_c PRIVATE "${fms_defs}") - target_link_libraries(${libTgt}_c PRIVATE NetCDF::NetCDF_C MPI::MPI_C) @@ -340,22 +341,18 @@ foreach(kind ${kinds}) coupler/include data_override/include amip_interp/include) - target_compile_definitions(${libTgt}_f PRIVATE "${fms_defs}") target_compile_definitions(${libTgt}_f PRIVATE "${${kind}_defs}") - - set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS "${${kind}_flags}") - + set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS ${${kind}_flags}) set_target_properties(${libTgt}_f PROPERTIES Fortran_MODULE_DIRECTORY ${moduleDir}) - target_link_libraries(${libTgt}_f PRIVATE NetCDF::NetCDF_Fortran MPI::MPI_Fortran) - if(OpenMP_Fortran_FOUND) target_link_libraries(${libTgt}_f PRIVATE OpenMP::OpenMP_Fortran) endif() + # Check if gnu 10 or higher # this should only be needed with mpich, but wasn't able to find a good way to find the MPI flavor consistently if ( CMAKE_Fortran_COMPILER_VERSION MATCHES "1[0-9]\.[0-9]*\.[0-9]*" AND CMAKE_Fortran_COMPILER_ID MATCHES "GNU") @@ -409,7 +406,7 @@ foreach(kind ${kinds}) $ $ $) - + set(moduleDir "${CMAKE_CURRENT_BINARY_DIR}/${includeDir}") target_include_directories(${libTgt} INTERFACE $ $) @@ -433,6 +430,150 @@ foreach(kind ${kinds}) endforeach() +# default build, same as an r8 build just different name +if(NOT kinds) + message(STATUS "building default kind") + set(libTgt "fms") + set(includeDir "include") + set(moduleDir "${CMAKE_CURRENT_BINARY_DIR}/${includeDir}") + set(kind "r8") + + # C + add_library(${libTgt}_c OBJECT ${fms_c_src_files}) + + target_include_directories(${libTgt}_c PRIVATE include + grid_utils) + target_compile_definitions(${libTgt}_c PRIVATE "${fms_defs}") + target_link_libraries(${libTgt}_c PRIVATE NetCDF::NetCDF_C + MPI::MPI_C) + + if(OpenMP_C_FOUND) + target_link_libraries(${libTgt}_c PRIVATE OpenMP::OpenMP_C) + endif() + + if(WITH_YAML) + target_link_libraries(${libTgt}_c PRIVATE libyaml_C) + set_target_properties(${libTgt}_c PROPERTIES COMPILE_FLAGS "-L${LIBYAML_LIBRARIES} -lyaml") + endif() + + + # Fortran + add_library(${libTgt}_f OBJECT ${fms_fortran_src_files}) + + target_include_directories(${libTgt}_f PRIVATE include + fms + fms/include + fms2_io/include + string_utils/include + mpp/include + column_diagnostics/include + monin_obukhov/include + sat_vapor_pres/include + horiz_interp/include + diag_integral/include + random_numbers/include + diag_manager/include + constants4 + topography/include + axis_utils/include + mosaic2/include + constants + astronomy/include + field_manager/include + time_interp/include + tracer_manager/include + tridiagonal/include + interpolator/include + coupler/include + data_override/include + amip_interp/include) + target_compile_definitions(${libTgt}_f PRIVATE "${fms_defs}") + target_compile_definitions(${libTgt}_f PRIVATE "${${kind}_defs}") + set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS ${${kind}_flags}) + set_target_properties(${libTgt}_f PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + target_link_libraries(${libTgt}_f PRIVATE NetCDF::NetCDF_Fortran + MPI::MPI_Fortran) + if(OpenMP_Fortran_FOUND) + target_link_libraries(${libTgt}_f PRIVATE OpenMP::OpenMP_Fortran) + endif() + + # Check if gnu 10 or higher + # this should only be needed with mpich, but wasn't able to find a good way to find the MPI flavor consistently + if ( CMAKE_Fortran_COMPILER_VERSION MATCHES "1[0-9]\.[0-9]*\.[0-9]*" AND CMAKE_Fortran_COMPILER_ID MATCHES "GNU") + include(CheckFortranCompilerFlag) + check_fortran_compiler_flag("-fallow-argument-mismatch" _arg_mismatch_flag) + if(_arg_mismatch_flag) + message(STATUS "Adding -fallow-argument-mismatch flag to compile with GCC >=10 and MPICH") + target_compile_options(${libTgt}_f PRIVATE "-fallow-argument-mismatch;-w") + endif() + endif() + + # FMS (C + Fortran) + if (SHARED_LIBS) + message(STATUS "Shared library target: ${libTgt}") + add_library(${libTgt} SHARED $ + $) + else () + message(STATUS "Static library target: ${libTgt}") + add_library(${libTgt} STATIC $ + $) + endif () + + target_include_directories(${libTgt} PUBLIC + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $) + + set(moduleDir "${CMAKE_CURRENT_BINARY_DIR}/${includeDir}") + target_include_directories(${libTgt} INTERFACE + $ + $) + + target_compile_definitions(${libTgt} PRIVATE "${fms_defs}") + target_compile_definitions(${libTgt} PRIVATE "${${kind}_defs}") + set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS ${${kind}_flags}) + + target_link_libraries(${libTgt} PUBLIC NetCDF::NetCDF_C + NetCDF::NetCDF_Fortran + MPI::MPI_Fortran) + + if(OpenMP_Fortran_FOUND) + target_link_libraries(${libTgt} PRIVATE OpenMP::OpenMP_C OpenMP::OpenMP_Fortran) + endif() + + add_library(FMS::${libTgt} ALIAS ${libTgt}) + + list(APPEND LIB_TARGETS ${libTgt}) + install(DIRECTORY ${moduleDir} DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(FILES ${fms_header_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/${includeDir}) + + +endif() + install( TARGETS ${LIB_TARGETS} EXPORT FMSExports @@ -440,6 +581,306 @@ install( LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +### Unit Testing +include(CTest) + +# TODO autotools also checks if srun is available +set(MPI_LAUNCHER "mpirun") +# used in the test-lib.sh.in to make it behave differently when parsed by cmake +set(USING_CMAKE "true") + +# parse and add build info to test script util file +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test_fms/test-lib.sh.in ${CMAKE_CURRENT_SOURCE_DIR}/test-lib.sh + @ONLY) + +# build any helper modules that are used by unit tests +list(APPEND TEST_MODS_SRC + test_fms/diag_manager/testing_utils.F90 + test_fms/fms/test_fms.F90 + test_fms/fms2_io/argparse.F90 + test_fms/fms2_io/setup.F90 + test_fms/mosaic2/write_files.F90 + test_fms/mpp/compare_data_checksums.F90 + test_fms/mpp/compare_data_checksums_int.F90 + test_fms/mpp/fill_halo.F90 + test_fms/mpp/test_domains_utility_mod.F90 + test_fms/mpp/test_mpp_update_domains_int.F90 + test_fms/mpp/test_mpp_update_domains_real.F90 + test_fms/mpp/test_mpp_update_domains_ad.F90 + test_fms/mpp/test_system_clock.F90) + +add_library(testLibs "${TEST_MODS_SRC}") +target_link_libraries(testLibs FMS::fms) +target_compile_definitions(testLibs PRIVATE TEST_MOS_KIND_=r8_kind) +target_include_directories(testLibs PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/fms/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/data_override/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mosaic2 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +set_target_properties(testLibs PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + +# add all our test source code + +# this lists all source code that creates a single executable for unit testing (r8 default) +list(APPEND TEST_SRC_SINGLE_TARGET + test_fms/affinity/test_affinity.F90 + test_fms/block_control/test_block_control.F90 + test_fms/coupler/test_gex.F90 + test_fms/data_override/test_data_override_init.F90 + test_fms/data_override/test_data_override_ongrid.F90 + test_fms/diag_manager/test_output_every_freq.F90 + test_fms/diag_manager/test_dm_weights.F90 + test_fms/diag_manager/test_diag_manager.F90 + test_fms/diag_manager/test_diag_manager_time.F90 + test_fms/diag_manager/test_diag_update_buffer.F90 + test_fms/diag_manager/test_diag_yaml.F90 + test_fms/diag_manager/test_diag_ocean.F90 + test_fms/diag_manager/test_modern_diag.F90 + test_fms/diag_manager/test_diag_buffer.F90 + test_fms/diag_manager/test_flexible_time.F90 + test_fms/diag_manager/test_flush_nc_file.F90 + test_fms/diag_manager/test_diag_out_yaml.F90 + test_fms/diag_manager/test_reduction_methods.F90 + test_fms/diag_manager/testing_utils.F90 + test_fms/diag_manager/test_diag_diurnal.F90 + test_fms/diag_manager/check_time_none.F90 + test_fms/diag_manager/check_time_min.F90 + test_fms/diag_manager/check_time_max.F90 + test_fms/diag_manager/check_time_avg.F90 + test_fms/diag_manager/check_time_diurnal.F90 + test_fms/diag_manager/check_time_pow.F90 + test_fms/diag_manager/check_time_rms.F90 + test_fms/diag_manager/test_cell_measures.F90 + test_fms/diag_manager/check_subregional.F90 + test_fms/diag_manager/test_var_masks.F90 + test_fms/diag_manager/check_var_masks.F90 + test_fms/diag_manager/test_multiple_send_data.F90 + test_fms/diag_manager/test_prepend_date.F90 + test_fms/diag_manager/test_multi_file.F90 + test_fms/diag_manager/test_ens_runs.F90 + test_fms/diag_manager/test_diag_attribute_add.F90 + test_fms/diag_manager/check_new_file_freq.F90 + test_fms/drifters/test_cloud_interpolator.F90 + test_fms/drifters/test_drifters_io.F90 + test_fms/drifters/test_drifters_input.F90 + test_fms/drifters/test_drifters_comm.F90 + test_fms/drifters/test_drifters_core.F90 + test_fms/drifters/test_quicksort.F90 + test_fms/drifters/test_drifters.F90 + test_fms/exchange/test_xgrid.F90 + test_fms/field_manager/test_field_table_read.F90 + test_fms/fms2_io/test_get_is_valid.F90 + test_fms/fms2_io/test_fms2_io.F90 + test_fms/fms2_io/test_atmosphere_io.F90 + test_fms/fms2_io/test_io_simple.F90 + test_fms/fms2_io/setup.F90 + test_fms/fms2_io/argparse.F90 + test_fms/fms2_io/test_global_att.F90 + test_fms/fms2_io/test_io_with_mask.F90 + test_fms/fms2_io/test_bc_restart.F90 + test_fms/fms2_io/test_get_mosaic_tile_grid.F90 + test_fms/fms2_io/test_read_ascii_file.F90 + test_fms/fms2_io/test_file_appendix.F90 + test_fms/fms2_io/test_unlimit_compressed.F90 + test_fms/fms2_io/test_chunksizes.F90 + test_fms/fms2_io/test_packed_reads.F90 + test_fms/fms2_io/test_compressed_writes.F90 + test_fms/fms2_io/test_domain_io.F90 + test_fms/fms2_io/test_collective_io.F90 + test_fms/fms2_io/test_generalized_indices.F90 + test_fms/fms/test_fms.F90 + test_fms/interpolator/test_interpolator.F90 + test_fms/mpp/test_clock_init.F90 + test_fms/mpp/test_domains_simple.F90 + test_fms/mpp/test_domains_utility_mod.F90 + test_fms/mpp/test_global_arrays.F90 + test_fms/mpp/test_minmax.F90 + test_fms/mpp/test_mpp_alltoall.F90 + test_fms/mpp/test_mpp_broadcast.F90 + test_fms/mpp/test_mpp_chksum.F90 + test_fms/mpp/test_mpp_clock_begin_end_id.F90 + test_fms/mpp/test_mpp_domains.F90 + test_fms/mpp/test_mpp.F90 + test_fms/mpp/test_mpp_gatscat.F90 + test_fms/mpp/test_mpp_get_ascii_lines.F90 + test_fms/mpp/test_mpp_global_field.F90 + test_fms/mpp/test_mpp_global_field_ug.F90 + test_fms/mpp/test_mpp_global_sum_ad.F90 + test_fms/mpp/test_mpp_init_logfile.F90 + test_fms/mpp/test_mpp_mem_dump.F90 + test_fms/mpp/test_mpp_memuse.F90 + test_fms/mpp/test_mpp_memutils_begin_2x.F90 + test_fms/mpp/test_mpp_memutils_begin_end.F90 + test_fms/mpp/test_mpp_memutils_end_before_begin.F90 + test_fms/mpp/test_mpp_nesting.F90 + test_fms/mpp/test_mpp_npes.F90 + test_fms/mpp/test_mpp_pe.F90 + test_fms/mpp/test_mpp_print_memuse_stats_file.F90 + test_fms/mpp/test_mpp_print_memuse_stats_stderr.F90 + test_fms/mpp/test_mpp_root_pe.F90 + test_fms/mpp/test_mpp_sendrecv.F90 + test_fms/mpp/test_mpp_sum.F90 + test_fms/mpp/test_mpp_transmit.F90 + test_fms/mpp/test_mpp_update_domains.F90 + test_fms/mpp/test_mpp_update_domains_ad.F90 + test_fms/mpp/test_peset.F90 + test_fms/mpp/test_mpp_read_ascii_file.F90 + test_fms/mpp/test_read_input_nml.F90 + test_fms/mpp/test_redistribute_int.F90 + test_fms/mpp/test_stderr.F90 + test_fms/mpp/test_stdin.F90 + test_fms/mpp/test_stdlog.F90 + test_fms/mpp/test_stdout.F90 + test_fms/mpp/test_super_grid.F90 + test_fms/mpp/test_system_clock.F90 + test_fms/mpp/test_update_domains_performance.F90 + test_fms/parser/test_yaml_parser.F90 + test_fms/parser/check_crashes.F90 + test_fms/parser/parser_demo.F90 + test_fms/parser/parser_demo2.F90 + test_fms/parser/test_output_yaml.F90 + test_fms/parser/generic_blocks.F90 + test_fms/string_utils/test_string_utils.F90 + test_fms/time_manager/test_time_manager.F90 + ) +# list any test sources that are used for two executables (r4 and r8) +list(APPEND TEST_SRC_MULTI_TARGET + test_fms/astronomy/test_astronomy.F90 + test_fms/axis_utils/test_axis_utils.F90 + test_fms/column_diagnostics/test_column_diagnostics.F90 + test_fms/coupler/test_coupler_2d.F90 + test_fms/coupler/test_coupler_3d.F90 + test_fms/coupler/test_coupler_types.F90 + test_fms/coupler/test_atmos_ocean_fluxes.F90 + test_fms/data_override/test_data_override.F90 + test_fms/data_override/test_get_grid_v1.F90 + test_fms/diag_integral/test_diag_integral.F90 + test_fms/field_manager/test_field_manager.F90 + test_fms/horiz_interp/test_horiz_interp.F90 + test_fms/horiz_interp/test_create_xgrid_order2.F90 + test_fms/interpolator/test_interpolator2.F90 + test_fms/monin_obukhov/test_monin_obukhov.F90 + test_fms/mosaic2/test_mosaic2.F90 + test_fms/mosaic2/test_grid2.F90 + test_fms/random_numbers/test_random_numbers.F90 + test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 + test_fms/time_interp/test_time_interp.F90 + test_fms/time_interp/test_time_interp_external.F90 + test_fms/topography/test_topography.F90 + test_fms/tracer_manager/test_tracer_manager.F90 + test_fms/tridiagonal/test_tridiagonal.F90 + ) + +# add all the test executables and set up linking + compile flags +foreach (testFile ${TEST_SRC_SINGLE_TARGET}) + get_filename_component (TName ${testFile} NAME_WE) + + add_executable(${TName} ${testFile}) + target_compile_definitions(${TName} PRIVATE "${r8_defs}") + set_target_properties(${TName} PROPERTIES COMPILE_FLAGS ${r8_flags}) + target_link_libraries(${TName} PUBLIC FMS::fms + PRIVATE testLibs + ) + + if(WITH_YAML) + target_link_libraries(${TName} PRIVATE yaml ${LIBYAML_LIBRARIES}) + endif() + + if(OPENMP) + target_link_libraries(${TName} PRIVATE OpenMP::OpenMP_Fortran) + endif() + + set_target_properties(${TName} PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + target_include_directories(${TName} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/fms/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/data_override/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mosaic2 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +endforeach () + +foreach (testFile ${TEST_SRC_MULTI_TARGET}) + get_filename_component (TName ${testFile} NAME_WE) + + add_executable(${TName}_r8 ${testFile}) + target_compile_definitions(${TName}_r8 PRIVATE "${r8_defs}") + set_target_properties(${TName}_r8 PROPERTIES COMPILE_FLAGS ${r8_flags}) + target_link_libraries(${TName}_r8 PUBLIC FMS::fms + PRIVATE testLibs + ) + + add_executable(${TName}_r4 ${testFile}) + target_compile_definitions(${TName}_r4 PRIVATE "${r4_defs}") + # seems counterintuitive but r4 tests use r8 default + # they specify kind values explicitly with the preprocessor where needed (TEST_FMS_KIND_) + set_target_properties(${TName}_r4 PROPERTIES COMPILE_FLAGS ${r8_flags}) + target_link_libraries(${TName}_r4 PUBLIC FMS::fms + PRIVATE testLibs + ) + + if(WITH_YAML) + target_link_libraries(${TName}_r4 PRIVATE yaml ${LIBYAML_LIBRARIES}) + target_link_libraries(${TName}_r8 PRIVATE yaml ${LIBYAML_LIBRARIES}) + endif() + + if(OPENMP) + target_link_libraries(${TName}_r4 PRIVATE OpenMP::OpenMP_Fortran) + target_link_libraries(${TName}_r8 PRIVATE OpenMP::OpenMP_Fortran) + endif() + + set_target_properties(${TName}_r4 PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + set_target_properties(${TName}_r8 PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + target_include_directories(${TName}_r4 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/fms/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/data_override/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mosaic2 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + target_include_directories(${TName}_r8 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/fms/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/data_override/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mosaic2 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + #set macros used to test mixed precision + target_compile_definitions(${TName}_r8 PRIVATE TEST_FMS_KIND_=r8_kind) + target_compile_definitions(${TName}_r4 PRIVATE TEST_FMS_KIND_=r4_kind) + target_compile_definitions(${TName}_r8 PRIVATE FMS_TEST_BC_TYPE_=bc) + target_compile_definitions(${TName}_r4 PRIVATE FMS_TEST_BC_TYPE_=bc_r4) + target_compile_definitions(${TName}_r8 PRIVATE FMS_TEST_BC_TYPE_=bc) + target_compile_definitions(${TName}_r4 PRIVATE FMS_TEST_BC_TYPE_=bc_r4) + target_compile_definitions(${TName}_r8 PRIVATE WRITE_FILES_MOD_=write_files_r8) + target_compile_definitions(${TName}_r4 PRIVATE WRITE_FILES_MOD_=write_files_r4) +endforeach () + +# gather all test scripts +file(GLOB_RECURSE TEST_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/*/*.sh) +# leave out scripts that aren't tests +list(FILTER TEST_SCRIPTS EXCLUDE REGEX "check_crashes.*") +list(FILTER TEST_SCRIPTS EXCLUDE REGEX "test-lib*") +list(FILTER TEST_SCRIPTS EXCLUDE REGEX "tap-driver.*") + +# add scripts to ctest +foreach (testScript ${TEST_SCRIPTS}) + get_filename_component(testName ${testScript} NAME_WE) + get_filename_component(testDirNameFull ${testScript} DIRECTORY) + get_filename_component(testDirName ${testDirNameFull} NAME_WE) + add_test(NAME ${testName} + COMMAND ${testScript} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + # all tests are labeled with directory name + set_property(TEST ${testName} PROPERTY LABELS ${testDirName}) + # set an environment variable so the scripts know to skip tests that use libyaml + if(NOT WITH_YAML) + set_tests_properties(${testName} PROPERTIES + ENVIRONMENT "parser_skip=skip" + ) + endif() +endforeach() + +set(CMAKE_CTEST_ARGUMENTS "--output-on-failure") + ### Package config include(CMakePackageConfigHelpers) set(CONFIG_INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fms) diff --git a/cmake/compiler_flags_Clang_C.cmake b/cmake/compiler_flags_Clang_C.cmake index f8eaafb2fc..39a0751f9b 100644 --- a/cmake/compiler_flags_Clang_C.cmake +++ b/cmake/compiler_flags_Clang_C.cmake @@ -1,6 +1,6 @@ # Clang C set( CMAKE_C_FLAGS_RELEASE "-O3" ) -set( CMAKE_C_FLAGS_DEBUG "-O0 -g" ) +set( CMAKE_C_FLAGS_DEBUGUFS "-O0 -g" ) set( CMAKE_C_LINK_FLAGS "" ) diff --git a/cmake/compiler_flags_GNU_C.cmake b/cmake/compiler_flags_GNU_C.cmake index 1433f3efc3..8cd22e2188 100644 --- a/cmake/compiler_flags_GNU_C.cmake +++ b/cmake/compiler_flags_GNU_C.cmake @@ -1,6 +1,10 @@ # GNU C -set(CMAKE_C_FLAGS_RELEASE "-O3") - +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") +set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-O0 -g") set(CMAKE_C_LINK_FLAGS "") + +# ufs flags +set(CMAKE_C_FLAGS_RELEASEUFS "-O3") +set(CMAKE_C_FLAGS_DEBUGUFS "-O0 -g") diff --git a/cmake/compiler_flags_GNU_Fortran.cmake b/cmake/compiler_flags_GNU_Fortran.cmake index 79719f957d..cffa72cbf6 100644 --- a/cmake/compiler_flags_GNU_Fortran.cmake +++ b/cmake/compiler_flags_GNU_Fortran.cmake @@ -1,11 +1,15 @@ # Precision-based Fortran compiler flags set(r8_flags "-fdefault-real-8 -fdefault-double-8") # Fortran flags for 64BIT precision +set(r4_flags "-fdefault-real-4") # Fortran flags for 32BIT precision -# GNU Fortan -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer -fconvert=big-endian -ffree-line-length-none -fno-range-check -fbacktrace") +# GNU Fortran +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer -fallow-argument-mismatch -ffree-line-length-none") -set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -funroll-all-loops -finline-functions") - -set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -fcheck=bounds -ffpe-trap=invalid,zero,overflow,underflow" ) +set(CMAKE_Fortran_FLAGS_RELEASE "-O2") +set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g") set(CMAKE_Fortran_LINK_FLAGS "" ) + +#ufs flags +set(CMAKE_Fortran_FLAGS_RELEASEUFS "-O3 -funroll-all-loops -finline-functions") +set(CMAKE_Fortran_FLAGS_DEBUGUFS "-O0 -g -fcheck=bounds -ffpe-trap=invalid,zero,overflow,underflow" ) diff --git a/cmake/compiler_flags_IntelLLVM_C.cmake b/cmake/compiler_flags_IntelLLVM_C.cmake index dbeb7c5973..c17e0c8130 100644 --- a/cmake/compiler_flags_IntelLLVM_C.cmake +++ b/cmake/compiler_flags_IntelLLVM_C.cmake @@ -1,9 +1,13 @@ # Intel LLVM based C -set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -traceback") +set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -set( CMAKE_C_FLAGS_RELEASE "-qno-opt-dynamic-align -O2 -debug minimal") - -set( CMAKE_C_FLAGS_DEBUG "-O0 -g -ftrapuv") +set( CMAKE_C_FLAGS_RELEASE "-O2") +set( CMAKE_C_FLAGS_DEBUG "-O0 -g -traceback") set( CMAKE_C_LINK_FLAGS "") + +# sets of flags used by ufs +set( CMAKE_C_FLAGS_DEBUGUFS "-O0 -g -ftrapv -traceback") +set( CMAKE_C_FLAGS_RELEASEUFS "-qno-opt-dynamic-align -O2 -debug minimal") + diff --git a/cmake/compiler_flags_IntelLLVM_Fortran.cmake b/cmake/compiler_flags_IntelLLVM_Fortran.cmake index 88347aeeda..786cd1d3b3 100644 --- a/cmake/compiler_flags_IntelLLVM_Fortran.cmake +++ b/cmake/compiler_flags_IntelLLVM_Fortran.cmake @@ -2,10 +2,14 @@ set(r4_flags "-real-size 32") # Fortran flags for 32BIT precision set(r8_flags "-real-size 64") # Fortran flags for 64BIT precision -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -align array64byte -nowarn -traceback") +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -safe-cray-ptr") -set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -nowarn -qoverride-limits -qno-opt-dynamic-align") +set(CMAKE_Fortran_FLAGS_RELEASE "-O3") +set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -traceback") -set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv") +set(CMAKE_Fortran_LINK_FLAGS "-fuse-ld=lld") -set(CMAKE_Fortran_LINK_FLAGS "") +# ufs flags to repoduce old behavior +set(CMAKE_Fortran_SHARED_FLAGS "-fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -align array64byte -nowarn -traceback") +set(CMAKE_Fortran_FLAGS_RELEASEUFS "-O2 -debug minimal -nowarn -qoverride-limits -qno-opt-dynamic-align ${CMAKE_Fortran_SHARED_FLAGS}") +set(CMAKE_Fortran_FLAGS_DEBUGUFS "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv ${CMAKE_Fortran_SHARED_FLAGS}") diff --git a/cmake/compiler_flags_Intel_C.cmake b/cmake/compiler_flags_Intel_C.cmake index ae7bfaa452..c5ce9bae9d 100644 --- a/cmake/compiler_flags_Intel_C.cmake +++ b/cmake/compiler_flags_Intel_C.cmake @@ -1,8 +1,11 @@ # Intel C -set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -sox -traceback") +set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -set( CMAKE_C_FLAGS_RELEASE "-qno-opt-dynamic-align -O2 -debug minimal -fp-model source") - -set( CMAKE_C_FLAGS_DEBUG "-O0 -g -ftrapuv") +set( CMAKE_C_FLAGS_RELEASE "-O2") +set( CMAKE_C_FLAGS_DEBUG "-O0 -g -traceback") set( CMAKE_C_LINK_FLAGS "") + +# ufs flags +set( CMAKE_C_FLAGS_RELEASEUFS "-qno-opt-dynamic-align -O2 -debug minimal -fp-model source") +set( CMAKE_C_FLAGS_DEBUGUFS "-O0 -g -ftrapuv") diff --git a/cmake/compiler_flags_Intel_Fortran.cmake b/cmake/compiler_flags_Intel_Fortran.cmake index 95503a0b7d..eb73f25600 100644 --- a/cmake/compiler_flags_Intel_Fortran.cmake +++ b/cmake/compiler_flags_Intel_Fortran.cmake @@ -1,12 +1,16 @@ # Precision-based Fortran compiler flags set(r4_flags "-real-size 32") # Fortran flags for 32BIT precision set(r8_flags "-real-size 64") # Fortran flags for 64BIT precision -set(r8_flags "${r8_flags} -no-prec-div -no-prec-sqrt") -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -align array64byte -nowarn -sox -traceback") +# Minimal set of flags for stand release and debug build types +set(CMAKE_Fortran_FLAGS "${RELEASE} -safe-cray-ptr") +set(CMAKE_Fortran_FLAGS_RELEASE "-O3") +set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0") -set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -fp-model source -nowarn -qoverride-limits -qno-opt-dynamic-align -qopt-prefetch=3") +# ufs flags to reproduce past behavior +set(ufs_flags_base "${CMAKE_Fortran_FLAGS} -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -align array64byte -nowarn -sox -traceback") -set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv") +set(CMAKE_Fortran_FLAGS_RELEASE "${ufs_flags_base} -O2 -debug minimal -fp-model source -nowarn -qoverride-limits -qno-opt-dynamic-align -qopt-prefetch=3") +set(CMAKE_Fortran_FLAGS_DEBUGUFS "${ufs_flags_base} -g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv") set(CMAKE_Fortran_LINK_FLAGS "") diff --git a/configure.ac b/configure.ac index c8989a4e64..42eaae67ea 100644 --- a/configure.ac +++ b/configure.ac @@ -482,6 +482,10 @@ AC_SUBST([NOUNDEFINED]) # Used in Makefiles. AC_SUBST([MODDIR],[\$\(top_builddir\)/.mods]) +# Define CMake variables used in test-lib.sh.in as empty strings +AC_SUBST([CMAKE_CURRENT_SOURCE_DIR], []) +AC_SUBST([USING_CMAKE],[]) + # These files will be created when the configure script is run. AC_CONFIG_FILES([ Makefile diff --git a/test_fms/astronomy/Makefile.am b/test_fms/astronomy/Makefile.am index ff313aca26..61fdc8c522 100644 --- a/test_fms/astronomy/Makefile.am +++ b/test_fms/astronomy/Makefile.am @@ -38,8 +38,8 @@ test_astronomy_r4_SOURCES = test_astronomy.F90 test_astronomy_r8_SOURCES = test_astronomy.F90 # Set r4_kind and r8_kind -test_astronomy_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_AST_KIND_=r4_kind -test_astronomy_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_AST_KIND_=r8_kind +test_astronomy_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r4_kind +test_astronomy_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r8_kind # Run the test program. TESTS = test_astronomy.sh diff --git a/test_fms/astronomy/test_astronomy.F90 b/test_fms/astronomy/test_astronomy.F90 index 0b94a7f976..6dd3c989ca 100644 --- a/test_fms/astronomy/test_astronomy.F90 +++ b/test_fms/astronomy/test_astronomy.F90 @@ -53,9 +53,9 @@ subroutine test_set_get_orbital_parameters ! test that whatever values get sent into set_orbital_parameters ! are the same after calling get_orbital_parameters implicit none - real(kind=TEST_AST_KIND_) :: ecc_in, obliq_in, per_in - real(kind=TEST_AST_KIND_) :: ecc_out, obliq_out, per_out - integer, parameter :: lkind = TEST_AST_KIND_ + real(kind=TEST_FMS_KIND_) :: ecc_in, obliq_in, per_in + real(kind=TEST_FMS_KIND_) :: ecc_out, obliq_out, per_out + integer, parameter :: lkind = TEST_FMS_KIND_ ecc_in = 0.0_lkind obliq_in = 0.0_lkind @@ -76,12 +76,12 @@ subroutine test_diurnal_solar ! very simple test cases where all input arguments are set to 0.0, ! expected output --> cosz=0.0, fracday=0.0, and rrsun=1.0 implicit none - real(kind=TEST_AST_KIND_), dimension(1,1) :: lat2D, lon2D, cosz2D, fracday2D - real(kind=TEST_AST_KIND_), dimension(1) :: lat1D, lon1D, cosz1D, fracday1D - real(kind=TEST_AST_KIND_) :: lat0D, lon0D, cosz0D, fracday0D - real(kind=TEST_AST_KIND_) :: gmt, time_since_ae, rrsun + real(kind=TEST_FMS_KIND_), dimension(1,1) :: lat2D, lon2D, cosz2D, fracday2D + real(kind=TEST_FMS_KIND_), dimension(1) :: lat1D, lon1D, cosz1D, fracday1D + real(kind=TEST_FMS_KIND_) :: lat0D, lon0D, cosz0D, fracday0D + real(kind=TEST_FMS_KIND_) :: gmt, time_since_ae, rrsun type(time_type) :: time_in - integer, parameter :: lkind = TEST_AST_KIND_ + integer, parameter :: lkind = TEST_FMS_KIND_ time_since_ae = 0.0_lkind gmt = 0.0_lkind @@ -149,15 +149,15 @@ subroutine test_daily_mean_solar ! defined in the constants_mod, the expected values lose precision ! without the use of half_pi implicit none - real(kind=TEST_AST_KIND_), dimension(1,1) :: lat2D, cosz2D, h_out2D - real(kind=TEST_AST_KIND_), dimension(1) :: lat1D, cosz1D, h_out1D, solar1D - real(kind=TEST_AST_KIND_) :: lat0D, cosz0D, h_out0D - real(kind=TEST_AST_KIND_) :: time_since_ae, rr_out, solar_local + real(kind=TEST_FMS_KIND_), dimension(1,1) :: lat2D, cosz2D, h_out2D + real(kind=TEST_FMS_KIND_), dimension(1) :: lat1D, cosz1D, h_out1D, solar1D + real(kind=TEST_FMS_KIND_) :: lat0D, cosz0D, h_out0D + real(kind=TEST_FMS_KIND_) :: time_since_ae, rr_out, solar_local type(time_type) :: time_in - integer, parameter :: lkind = TEST_AST_KIND_ - real(kind=TEST_AST_KIND_), parameter :: half_pi = acos(0.0_lkind) - real(kind=TEST_AST_KIND_), parameter :: cosz_local = 1.0_lkind/half_pi - real(kind=TEST_AST_KIND_), parameter :: hout_local = half_pi/real(PI,TEST_AST_KIND_) + integer, parameter :: lkind = TEST_FMS_KIND_ + real(kind=TEST_FMS_KIND_), parameter :: half_pi = acos(0.0_lkind) + real(kind=TEST_FMS_KIND_), parameter :: cosz_local = 1.0_lkind/half_pi + real(kind=TEST_FMS_KIND_), parameter :: hout_local = half_pi/real(PI,TEST_FMS_KIND_) time_since_ae = 0.0_lkind time_in = set_time(seconds=0, days=1, ticks=0 ) @@ -166,14 +166,14 @@ subroutine test_daily_mean_solar lat2D = 0.0_lkind call daily_mean_solar(lat2D, time_since_ae, cosz2D, h_out2D, rr_out) call check_answers(cosz2D(1,1), 1.0_lkind/half_pi, 'test_daily_mean_solar_2D cosz2D') - call check_answers(h_out2D(1,1),half_pi/real(PI,TEST_AST_KIND_), 'test_diurnal_solar_2D h_out2D') + call check_answers(h_out2D(1,1),half_pi/real(PI,TEST_FMS_KIND_), 'test_diurnal_solar_2D h_out2D') call check_answers(rr_out, 1.0_lkind, 'test_dirunal_solar_2D rr_out') ! test daily_mean_solar_1d lat1D = 0.0_lkind call daily_mean_solar(lat1D, time_since_ae, cosz1D, h_out1D, rr_out) call check_answers(cosz1D(1), 1.0_lkind/half_pi, 'test_daily_mean_solar_1D cosz1D') - call check_answers(h_out1D(1),half_pi/real(PI,TEST_AST_KIND_), 'test_diurnal_solar_1D h_out1D') + call check_answers(h_out1D(1),half_pi/real(PI,TEST_FMS_KIND_), 'test_diurnal_solar_1D h_out1D') call check_answers(rr_out, 1.0_lkind, 'test_dirunal_solar_1D rr_out') @@ -181,7 +181,7 @@ subroutine test_daily_mean_solar lat0D = 0.0_lkind call daily_mean_solar(lat0D, time_since_ae, cosz0D, h_out0D, rr_out) call check_answers(cosz0D, 1.0_lkind/half_pi, 'test_daily_mean_solar_0D cosz0D') - call check_answers(h_out0D,half_pi/real(PI,TEST_AST_KIND_), 'test_diurnal_solar_0D h_out0D') + call check_answers(h_out0D,half_pi/real(PI,TEST_FMS_KIND_), 'test_diurnal_solar_0D h_out0D') call check_answers(rr_out, 1.0_lkind, 'test_dirunal_solar_0D rr_out') @@ -189,21 +189,21 @@ subroutine test_daily_mean_solar lat2D = 0.0_lkind call daily_mean_solar(lat2D, time_in, cosz2D, h_out2D, rr_out) call check_answers(cosz2D(1,1), 1.0_lkind/half_pi, 'test_daily_mean_solar_cal_2D cosz2D') - call check_answers(h_out2D(1,1),half_pi/real(PI,TEST_AST_KIND_), 'test_diurnal_solar_cal_2D h_out2D') + call check_answers(h_out2D(1,1),half_pi/real(PI,TEST_FMS_KIND_), 'test_diurnal_solar_cal_2D h_out2D') call check_answers(rr_out, 1.0_lkind, 'test_dirunal_solar_cal_2D rr_out') ! test daily_mean_solar_cal_1d lat1D = 0.0_lkind call daily_mean_solar(lat1D, time_in, cosz1D, h_out1D, rr_out) call check_answers(cosz1D(1), 1.0_lkind/half_pi, 'test_daily_mean_solar_cal_1D cosz1D') - call check_answers(h_out1D(1),half_pi/real(PI,TEST_AST_KIND_), 'test_diurnal_solar_cal_1D h_out1D') + call check_answers(h_out1D(1),half_pi/real(PI,TEST_FMS_KIND_), 'test_diurnal_solar_cal_1D h_out1D') call check_answers(rr_out, 1.0_lkind, 'test_dirunal_solar_cal_1D rr_out') ! test daily_mean_solar_cal_0d lat0D = 0.0_lkind call daily_mean_solar(lat0D, time_in, cosz0D, h_out0D, rr_out) call check_answers(cosz0D, 1.0_lkind/half_pi, 'test_daily_mean_solar_cal_0D cosz0D') - call check_answers(h_out0D,half_pi/real(PI,TEST_AST_KIND_), 'test_diurnal_solar_cal_0D h_out0D') + call check_answers(h_out0D,half_pi/real(PI,TEST_FMS_KIND_), 'test_diurnal_solar_cal_0D h_out0D') call check_answers(rr_out, 1.0_lkind, 'test_dirunal_solar_cal_0D rr_out') ! test daily_mean_solar_2level @@ -225,14 +225,14 @@ subroutine test_annual_mean_solar implicit none integer :: js, je - real(kind=TEST_AST_KIND_), dimension(1,1) :: lat2D, solar2D, cosz2D, fracday2D - real(kind=TEST_AST_KIND_), dimension(1) :: lat1D, solar1D, cosz1D, fracday1D - real(kind=TEST_AST_KIND_) :: rrsun - real(kind=TEST_AST_KIND_), parameter :: half_pi = acos(0.0_r8_kind) - integer, parameter :: lkind = TEST_AST_KIND_ - real(kind=TEST_AST_KIND_) :: cosz_local, solar_local - - solar_local = (1.0_lkind/half_pi)*(half_pi/real(PI, TEST_AST_KIND_)) + real(kind=TEST_FMS_KIND_), dimension(1,1) :: lat2D, solar2D, cosz2D, fracday2D + real(kind=TEST_FMS_KIND_), dimension(1) :: lat1D, solar1D, cosz1D, fracday1D + real(kind=TEST_FMS_KIND_) :: rrsun + real(kind=TEST_FMS_KIND_), parameter :: half_pi = acos(0.0_r8_kind) + integer, parameter :: lkind = TEST_FMS_KIND_ + real(kind=TEST_FMS_KIND_) :: cosz_local, solar_local + + solar_local = (1.0_lkind/half_pi)*(half_pi/real(PI, TEST_FMS_KIND_)) cosz_local = 1.0_lkind/half_pi*solar_local ! test annual_mean_solar_2d @@ -241,7 +241,7 @@ subroutine test_annual_mean_solar call annual_mean_solar(js, je, lat2D, cosz2D, solar2D, fracday2D, rrsun) call check_answers(cosz2D(1,1), cosz_local/solar_local, 'test_annual_mean_solar_2D cosz2D') call check_answers(solar2D(1,1), solar_local, 'test_annual_mean_solar_2D solar2D') - call check_answers(fracday2D(1,1), half_pi/real(PI,TEST_AST_KIND_), 'test_annual_mean_solar_2D fracday2D') + call check_answers(fracday2D(1,1), half_pi/real(PI,TEST_FMS_KIND_), 'test_annual_mean_solar_2D fracday2D') call check_answers(rrsun, 1.0_lkind, 'test_annual_mean_solar_2D rrsun') ! test annual_mean_solar_1d @@ -250,7 +250,7 @@ subroutine test_annual_mean_solar call annual_mean_solar(js, je, lat1D, cosz1D, solar1D, fracday1D, rrsun) call check_answers(cosz1D(1), cosz_local/solar_local, 'test_annual_mean_solar_1D cosz1D') call check_answers(solar1D(1), solar_local, 'test_annual_mean_solar_1D solar1D') - call check_answers(fracday1D(1), half_pi/real(PI,TEST_AST_KIND_), 'test_annual_mean_solar_1D fracday1D') + call check_answers(fracday1D(1), half_pi/real(PI,TEST_FMS_KIND_), 'test_annual_mean_solar_1D fracday1D') call check_answers(rrsun, 1.0_lkind, 'test_annual_mean_solar_1D rrsun') !call astronomy_end @@ -261,18 +261,21 @@ subroutine test_annual_mean_solar lat1D = 0.0_lkind call annual_mean_solar(lat1D, cosz1D, solar1D) call test_set_get_orbital_parameters - if (solar1D(1) .ne. solar_local) call mpp_error(FATAL, 'test_annual_mean_solar_2level solar1D') - if (cosz1D(1) .ne. 1.0_lkind/half_pi) call mpp_error(FATAL, 'test_annual_mean_solar_2level cosz1D') + if (abs(solar1D(1) - solar_local) .gt. 1.0e-5_lkind) & + call mpp_error(FATAL, 'test_annual_mean_solar_2level solar1D') + if (abs(cosz1D(1) - 1.0_lkind/half_pi) .gt. 1.0e-5_lkind) & + call mpp_error(FATAL, 'test_annual_mean_solar_2level cosz1D') end subroutine test_annual_mean_solar !---------------------------------------------! subroutine check_answers( results, answers, whoami ) implicit none - real(TEST_AST_KIND_) :: answers, results + real(TEST_FMS_KIND_) :: answers, results character(*) :: whoami + integer, parameter :: lkind = TEST_FMS_KIND_ - if (results.ne.answers) then + if (abs(results - answers) .gt. 1.0e-5_lkind) then write(*,*) 'EXPECTED ', answers, ' but computed ', results call mpp_error(FATAL, trim(whoami)) end if diff --git a/test_fms/axis_utils/Makefile.am b/test_fms/axis_utils/Makefile.am index 3db495ecd6..ed6882e8ee 100644 --- a/test_fms/axis_utils/Makefile.am +++ b/test_fms/axis_utils/Makefile.am @@ -37,8 +37,8 @@ check_PROGRAMS = \ test_axis_utils_r4_SOURCES = test_axis_utils.F90 test_axis_utils_r8_SOURCES = test_axis_utils.F90 -test_axis_utils_r4_CPPFLAGS = $(AM_CPPFLAGS) -DAU_TEST_KIND_=r4_kind -test_axis_utils_r8_CPPFLAGS = $(AM_CPPFLAGS) -DAU_TEST_KIND_=r8_kind +test_axis_utils_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r4_kind +test_axis_utils_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r8_kind TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ diff --git a/test_fms/axis_utils/test_axis_utils.F90 b/test_fms/axis_utils/test_axis_utils.F90 index 6304bac60c..2f032e6745 100644 --- a/test_fms/axis_utils/test_axis_utils.F90 +++ b/test_fms/axis_utils/test_axis_utils.F90 @@ -40,7 +40,7 @@ program test_axis_utils type(GetAxisCartTestCase_t), pointer :: next => NULL() end type -integer, parameter :: k = AU_TEST_KIND_ +integer, parameter :: k = TEST_FMS_KIND_ real(k), parameter :: pi = 4._k * atan(1._k) integer :: i @@ -376,7 +376,7 @@ subroutine frac_index_assert(fval, arr, ret_expected) ret_test = frac_index(fval, arr) - if (ret_test /= ret_expected) then + if (abs(ret_test - ret_expected) .gt. 1.0e-5_k) then write(stderr(), "(A)") "frac_index(" // string(fval) // ", " // stringify(arr) // & & ") returned erroneous value: " // string(ret_test) write(stderr(), "(A)") "Expected return value: " // string(ret_expected) diff --git a/test_fms/column_diagnostics/Makefile.am b/test_fms/column_diagnostics/Makefile.am index d8fb204ff5..7b3b31724c 100644 --- a/test_fms/column_diagnostics/Makefile.am +++ b/test_fms/column_diagnostics/Makefile.am @@ -34,8 +34,8 @@ check_PROGRAMS = test_column_diagnostics_r4 test_column_diagnostics_r8 test_column_diagnostics_r4_SOURCES = test_column_diagnostics.F90 test_column_diagnostics_r8_SOURCES = test_column_diagnostics.F90 -test_column_diagnostics_r4_CPPFLAGS=$(AM_CPPFLAGS) -DTEST_CD_KIND_=4 -test_column_diagnostics_r8_CPPFLAGS=$(AM_CPPFLAGS) -DTEST_CD_KIND_=8 +test_column_diagnostics_r4_CPPFLAGS=$(AM_CPPFLAGS) -DTEST_FMS_KIND_=r4_kind +test_column_diagnostics_r8_CPPFLAGS=$(AM_CPPFLAGS) -DTEST_FMS_KIND_=r8_kind TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(abs_top_srcdir)/test_fms/tap-driver.sh diff --git a/test_fms/column_diagnostics/test_column_diagnostics.F90 b/test_fms/column_diagnostics/test_column_diagnostics.F90 index 33ebc824aa..f66bc9ec38 100644 --- a/test_fms/column_diagnostics/test_column_diagnostics.F90 +++ b/test_fms/column_diagnostics/test_column_diagnostics.F90 @@ -39,22 +39,22 @@ program test_column_diagnostics integer, parameter :: num_diag_pts_ij=2 !< number of diagnostics column describes in terms of i/j indices integer :: global_i(num_diag_pts_ij) ! global i coordinates of the diagnostic column integer :: global_j(num_diag_pts_ij) ! global j coordinates of the diagnostic column - real(TEST_CD_KIND_) :: global_lat_latlon(num_diag_pts_latlon)!< latitude value for the diagnostic column - real(TEST_CD_KIND_) :: global_lon_latlon(num_diag_pts_latlon)!< longitude value for the diagnostic columns + real(TEST_FMS_KIND_) :: global_lat_latlon(num_diag_pts_latlon)!< latitude value for the diagnostic column + real(TEST_FMS_KIND_) :: global_lon_latlon(num_diag_pts_latlon)!< longitude value for the diagnostic columns integer, parameter :: nlatlon=6 !< number of latlon grid points - real(TEST_CD_KIND_) :: lonb_in(nlatlon,nlatlon) !< model longitude grid point - real(TEST_CD_KIND_) :: latb_in(nlatlon,nlatlon) !< model latitude point + real(TEST_FMS_KIND_) :: lonb_in(nlatlon,nlatlon) !< model longitude grid point + real(TEST_FMS_KIND_) :: latb_in(nlatlon,nlatlon) !< model latitude point logical :: do_column_diagnostics(nlatlon,nlatlon) !< out integer, parameter :: num_diag_pts=num_diag_pts_latlon + num_diag_pts_ij !< total number of diagnostics column integer :: diag_i(num_diag_pts) !< out integer :: diag_j(num_diag_pts) !< out - real(TEST_CD_KIND_) :: diag_lat(num_diag_pts) !< out - real(TEST_CD_KIND_) :: diag_lon(num_diag_pts) !< out + real(TEST_FMS_KIND_) :: diag_lat(num_diag_pts) !< out + real(TEST_FMS_KIND_) :: diag_lon(num_diag_pts) !< out integer :: diag_units(num_diag_pts) - integer, parameter :: lkind=TEST_CD_KIND_ !< local kind; either r4_kind or r8_kind + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind; either r4_kind or r8_kind call fms_init() call time_manager_init() @@ -108,7 +108,7 @@ subroutine test_initialize_diagnostic_columns integer :: i integer :: i_answers(num_diag_pts), j_answers(num_diag_pts) - real(TEST_CD_KIND_) :: lon_answers(num_diag_pts), lat_answers(num_diag_pts) + real(TEST_FMS_KIND_) :: lon_answers(num_diag_pts), lat_answers(num_diag_pts) call initialize_diagnostic_columns(mod_name, num_diag_pts_latlon, num_diag_pts_ij, & global_i, global_j, global_lat_latlon, global_lon_latlon, & diff --git a/test_fms/coupler/Makefile.am b/test_fms/coupler/Makefile.am index 3159a46503..2c9ed9f335 100644 --- a/test_fms/coupler/Makefile.am +++ b/test_fms/coupler/Makefile.am @@ -47,14 +47,14 @@ test_atmos_ocean_fluxes_r8_SOURCES = test_atmos_ocean_fluxes.F90 test_gex_SOURCES = test_gex.F90 # add macro flags for kind and r4/r8 child type -test_coupler_2d_r4_CPPFLAGS=-DFMS_CP_TEST_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) -test_coupler_2d_r8_CPPFLAGS=-DFMS_CP_TEST_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) -test_coupler_3d_r4_CPPFLAGS=-DFMS_CP_TEST_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) -test_coupler_3d_r8_CPPFLAGS=-DFMS_CP_TEST_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) -test_coupler_types_r4_CPPFLAGS=-DFMS_CP_TEST_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) -test_coupler_types_r8_CPPFLAGS=-DFMS_CP_TEST_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) -test_atmos_ocean_fluxes_r4_CPPFLAGS=-DFMS_CP_TEST_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) -test_atmos_ocean_fluxes_r8_CPPFLAGS=-DFMS_CP_TEST_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) +test_coupler_2d_r4_CPPFLAGS=-DTEST_FMS_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) +test_coupler_2d_r8_CPPFLAGS=-DTEST_FMS_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) +test_coupler_3d_r4_CPPFLAGS=-DTEST_FMS_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) +test_coupler_3d_r8_CPPFLAGS=-DTEST_FMS_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) +test_coupler_types_r4_CPPFLAGS=-DTEST_FMS_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) +test_coupler_types_r8_CPPFLAGS=-DTEST_FMS_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) +test_atmos_ocean_fluxes_r4_CPPFLAGS=-DTEST_FMS_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) +test_atmos_ocean_fluxes_r8_CPPFLAGS=-DTEST_FMS_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) test_gex_CPPFLAGS = -I$(MODDIR) TEST_EXTENSIONS = .sh @@ -64,12 +64,14 @@ SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ # Run the test program. TESTS = test_coupler.sh test_gex.sh -if ! USING_YAML - TESTS_ENVIRONMENT = skip_yaml=yes +if USING_YAML + TESTS_ENVIRONMENT = parser_skip="" +else + TESTS_ENVIRONMENT = parser_skip=skip endif # Include these files with the distribution. EXTRA_DIST = test_coupler.sh test_gex.sh # Clean up -CLEANFILES = input.nml *.nc* *.out *.dpi *.spi *.dyn *.spl *_table* INPUT/*.nc +CLEANFILES = input.nml *.nc* *.out *.dpi *.spi *.dyn *.spl *_table* INPUT/*.nc test_coupler-files/* test_gex-files/* test_coupler-files/*/* test_gex-files/*/* diff --git a/test_fms/coupler/test_atmos_ocean_fluxes.F90 b/test_fms/coupler/test_atmos_ocean_fluxes.F90 index 7eb50880df..1d3558329d 100644 --- a/test_fms/coupler/test_atmos_ocean_fluxes.F90 +++ b/test_fms/coupler/test_atmos_ocean_fluxes.F90 @@ -45,8 +45,8 @@ program test_atmos_ocean_fluxes character(8), dimension(num_bcs) :: flux_name !< flux name character(24), dimension(num_bcs) :: flux_type !< flux_type for the given flux name character(6), dimension(num_bcs) :: impl !< implementation type for a given flux_type - real(FMS_CP_TEST_KIND_), dimension(num_bcs) :: mol_wt !< value of mol_wt - real(FMS_CP_TEST_KIND_), dimension(num_bcs) :: param_array !< parameter array + real(TEST_FMS_KIND_), dimension(num_bcs) :: mol_wt !< value of mol_wt + real(TEST_FMS_KIND_), dimension(num_bcs) :: param_array !< parameter array !> The flux names are made up. flux_name=["vampires", & @@ -94,7 +94,7 @@ subroutine test_atmos_ocean_fluxes_init write(*,*) "*** TEST_ATMOS_OCEAN_FLUXES_INIT ***" call atmos_ocean_fluxes_init(gas_fluxes, gas_fields_atm, gas_fields_ice, & - use_r4_kind= FMS_CP_TEST_KIND_ .eq. r4_kind) + use_r4_kind= TEST_FMS_KIND_ .eq. r4_kind) end subroutine test_atmos_ocean_fluxes_init !-------------------------------------- @@ -105,7 +105,7 @@ subroutine test_aof_set_coupler_flux implicit none character(100) :: cresults, thelist - real(FMS_CP_TEST_KIND_) :: rresults, rresults2(num_bcs) + real(TEST_FMS_KIND_) :: rresults, rresults2(num_bcs) integer :: i, n logical :: success diff --git a/test_fms/coupler/test_coupler.sh b/test_fms/coupler/test_coupler.sh index 4512cca557..027231ddc7 100755 --- a/test_fms/coupler/test_coupler.sh +++ b/test_fms/coupler/test_coupler.sh @@ -26,6 +26,8 @@ # Set common test settings. . ../test-lib.sh +output_dir + rm -f input.nml touch input.nml @@ -106,11 +108,11 @@ mkdir INPUT test_expect_success "coupler types interfaces (r4_kind)" ' - mpirun -n 4 ./test_coupler_types_r4 + mpirun -n 4 ../test_coupler_types_r4 ' test_expect_success "coupler types interfaces (r8_kind)" ' - mpirun -n 4 ./test_coupler_types_r8 + mpirun -n 4 ../test_coupler_types_r8 ' # delete lines from the table to make sure we see the difference in the send_data return status @@ -125,36 +127,36 @@ _EOF test_expect_success "coupler types interfaces - check send_data return vals (r4_kind)" ' - mpirun -n 4 ./test_coupler_types_r4 + mpirun -n 4 ../test_coupler_types_r4 ' test_expect_success "coupler types interfaces - check send_data return vals (r8_kind)" ' - mpirun -n 4 ./test_coupler_types_r8 + mpirun -n 4 ../test_coupler_types_r8 ' mkdir RESTART test_expect_success "coupler register restart 2D(r4_kind)" ' - mpirun -n 1 ./test_coupler_2d_r4 + mpirun -n 1 ../test_coupler_2d_r4 ' test_expect_success "coupler register restart 2D(r8_kind)" ' - mpirun -n 1 ./test_coupler_2d_r8 + mpirun -n 1 ../test_coupler_2d_r8 ' test_expect_success "coupler register restart 3D (r4_kind)" ' - mpirun -n 1 ./test_coupler_3d_r4 + mpirun -n 1 ../test_coupler_3d_r4 ' test_expect_success "coupler register restart 3D (r8_kind)" ' - mpirun -n 1 ./test_coupler_3d_r8 + mpirun -n 1 ../test_coupler_3d_r8 ' test_expect_success "test atmos_ocean_fluxes (r4_kind)" ' - mpirun -n 1 ./test_atmos_ocean_fluxes_r4 + mpirun -n 1 ../test_atmos_ocean_fluxes_r4 ' test_expect_success "test atmos_ocean_fluxes (r8_kind)" ' - mpirun -n 1 ./test_atmos_ocean_fluxes_r8 + mpirun -n 1 ../test_atmos_ocean_fluxes_r8 ' rm -rf RESTART diff --git a/test_fms/coupler/test_coupler_2d.F90 b/test_fms/coupler/test_coupler_2d.F90 index 7e954be756..c751de7563 100644 --- a/test_fms/coupler/test_coupler_2d.F90 +++ b/test_fms/coupler/test_coupler_2d.F90 @@ -17,15 +17,6 @@ !* License along with FMS. If not, see . !*********************************************************************** -!! defaults to ensure compilation -#ifndef FMS_CP_TEST_KIND_ -#define FMS_CP_TEST_KIND_ r8_kind -#endif - -#ifndef FMS_TEST_BC_TYPE_ -#define FMS_TEST_BC_TYPE_ bc -#endif - !> @brief This programs tests the functionality in !! 1. coupler_type_register_restarts (CT_register_restarts_2d) !! 2. coupler_type_restore_state (CT_restore_state_2d) @@ -56,7 +47,7 @@ program test_coupler_2d integer :: num_rest_files !< Number of restart files integer :: i !< No description type(FmsNetcdfFile_t) :: fileobj !< fms2_io fileobjs -real(FMS_CP_TEST_KIND_), allocatable :: dummy_var(:,:) !< Dummy variable +real(TEST_FMS_KIND_), allocatable :: dummy_var(:,:) !< Dummy variable call fms_init() @@ -83,10 +74,10 @@ program test_coupler_2d call register_variable_attribute(fileobj, "laty", "axis", "y", str_len=1) allocate(dummy_var(nlon, nlat)) - dummy_var = real(1, kind=FMS_CP_TEST_KIND_) + dummy_var = real(1, kind=TEST_FMS_KIND_) call write_data(fileobj, "var_1", dummy_var) - dummy_var = real(2, kind=FMS_CP_TEST_KIND_) + dummy_var = real(2, kind=TEST_FMS_KIND_) call write_data(fileobj, "var_2", dummy_var) call close_file(fileobj) diff --git a/test_fms/coupler/test_coupler_3d.F90 b/test_fms/coupler/test_coupler_3d.F90 index dd1d481c51..3aeaf0cfed 100644 --- a/test_fms/coupler/test_coupler_3d.F90 +++ b/test_fms/coupler/test_coupler_3d.F90 @@ -17,15 +17,6 @@ !* License along with FMS. If not, see . !*********************************************************************** -!! defaults to ensure compilation -#ifndef FMS_CP_TEST_KIND_ -#define FMS_CP_TEST_KIND_ r8_kind -#endif - -#ifndef FMS_TEST_BC_TYPE_ -#define FMS_TEST_BC_TYPE_ bc -#endif - !> @brief This programs tests the functionality in !! 1. coupler_type_register_restarts (CT_register_restarts_3d) !! 2. coupler_type_restore_state (CT_restore_state_3d) @@ -41,7 +32,7 @@ program test_coupler_3d use coupler_types_mod, only: coupler_3d_bc_type, coupler_2d_bc_type, coupler_type_register_restarts, & coupler_type_restore_state use coupler_types_mod, only: coupler_1d_bc_type -use platform_mod, only: FMS_CP_TEST_KIND_ +use platform_mod, only: TEST_FMS_KIND_ implicit none @@ -57,7 +48,7 @@ program test_coupler_3d integer :: num_rest_files !< Number of restart files integer :: i !< No description type(FmsNetcdfFile_t) :: fileobj !< fms2_io fileobjs -real(FMS_CP_TEST_KIND_), allocatable :: dummy_var(:,:,:) !< Dummy variable +real(TEST_FMS_KIND_), allocatable :: dummy_var(:,:,:) !< Dummy variable call fms_init() @@ -89,10 +80,10 @@ program test_coupler_3d call register_variable_attribute(fileobj, "laty", "axis", "y", str_len=1) allocate(dummy_var(nlon, nlat, data_grid(5))) - dummy_var = real(1, kind=FMS_CP_TEST_KIND_) + dummy_var = real(1, kind=TEST_FMS_KIND_) call write_data(fileobj, "var_1", dummy_var) - dummy_var = real(2, kind=FMS_CP_TEST_KIND_) + dummy_var = real(2, kind=TEST_FMS_KIND_) call write_data(fileobj, "var_2", dummy_var) call close_file(fileobj) diff --git a/test_fms/coupler/test_coupler_types.F90 b/test_fms/coupler/test_coupler_types.F90 index 4204f768b6..55b048be90 100644 --- a/test_fms/coupler/test_coupler_types.F90 +++ b/test_fms/coupler/test_coupler_types.F90 @@ -18,15 +18,6 @@ !*********************************************************************** ! Ryan Mulhall 8/23 -!! defaults to ensure compilation -#ifndef FMS_CP_TEST_KIND_ -#define FMS_CP_TEST_KIND_ r8_kind -#endif - -#ifndef FMS_TEST_BC_TYPE_ -#define FMS_TEST_BC_TYPE_ bc -#endif - !> Tests for the coupler types interfaces not tested in test_coupler_2d/3d program test_coupler_types @@ -61,14 +52,14 @@ program test_coupler_types integer :: data_grid(5) !< i/j starting and ending indices for data domain character(len=3) :: appendix !< appoendix added to filename type(time_type) :: time_t -integer, parameter :: lkind = FMS_CP_TEST_KIND_ -real(FMS_CP_TEST_KIND_), allocatable :: array_2d(:,:), array_3d(:,:,:) +integer, parameter :: lkind = TEST_FMS_KIND_ +real(TEST_FMS_KIND_), allocatable :: array_2d(:,:), array_3d(:,:,:) integer, parameter :: num_bc = 2, num_fields = 2 !< these are set in set_up_coupler_type routines -real(FMS_CP_TEST_KIND_), allocatable :: lats(:), lons(:), nzs(:) !< arrays of coordinate values for diag_axis +real(TEST_FMS_KIND_), allocatable :: lats(:), lons(:), nzs(:) !< arrays of coordinate values for diag_axis !! initalization integer :: id_x, id_y, id_z, chksum_unit character(len=128) :: chksum_2d, chksum_3d -real(FMS_CP_TEST_KIND_), allocatable :: expected_2d(:,:), expected_3d(:,:,:) +real(TEST_FMS_KIND_), allocatable :: expected_2d(:,:), expected_3d(:,:,:) integer :: err, ncid, dim1D, varid, day logical, allocatable :: return_stats(:,:) @@ -258,7 +249,7 @@ program test_coupler_types err = nf90_close(ncid) endif call mpp_sync() -call data_override_init(Atm_domain_in=Domain, mode=FMS_CP_TEST_KIND_) +call data_override_init(Atm_domain_in=Domain, mode=TEST_FMS_KIND_) time_t = set_date(1, 1, 15) call coupler_type_data_override("ATM", bc_2d_new, time_t) @@ -305,8 +296,8 @@ program test_coupler_types subroutine check_field_data_2d(bc_2d, expected) type(coupler_2d_bc_type) :: bc_2d - real(FMS_CP_TEST_KIND_), intent(in) :: expected(:,:) - real(FMS_CP_TEST_KIND_), pointer :: values_ptr(:,:) + real(TEST_FMS_KIND_), intent(in) :: expected(:,:) + real(TEST_FMS_KIND_), pointer :: values_ptr(:,:) do i=1, bc_2d%num_bcs do j=1, bc_2d%FMS_TEST_BC_TYPE_(i)%num_fields @@ -322,8 +313,8 @@ subroutine check_field_data_2d(bc_2d, expected) subroutine check_field_data_3d(bc_3d, expected) type(coupler_3d_bc_type) :: bc_3d - real(FMS_CP_TEST_KIND_), intent(in) :: expected(:,:,:) - real(FMS_CP_TEST_KIND_), pointer :: values_ptr(:,:,:) + real(TEST_FMS_KIND_), intent(in) :: expected(:,:,:) + real(TEST_FMS_KIND_), pointer :: values_ptr(:,:,:) integer :: x, y, z, vals_start(3) !< need start point for indices, passed in will always be 1-n do i=1, bc_3d%num_bcs diff --git a/test_fms/coupler/test_coupler_utils.inc b/test_fms/coupler/test_coupler_utils.inc index 6c2ee91d77..0e9ffbe8e3 100644 --- a/test_fms/coupler/test_coupler_utils.inc +++ b/test_fms/coupler/test_coupler_utils.inc @@ -48,7 +48,7 @@ subroutine set_up_1d_coupler_type(bc_type, data_grid) write(field_num,'(i1)') j bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%name="var_"//field_num allocate(bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values(data_grid(1):data_grid(2))) - bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(j, kind=FMS_CP_TEST_KIND_) + bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(j, kind=TEST_FMS_KIND_) end do end do @@ -101,9 +101,9 @@ subroutine set_up_2d_coupler_type(bc_type, data_grid, appendix, to_read) bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%name="var_"//field_num allocate(bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values(data_grid(1):data_grid(2), data_grid(3):data_grid(4))) if (to_read) then - bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(999., kind=FMS_CP_TEST_KIND_) + bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(999., kind=TEST_FMS_KIND_) else - bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(j, kind=FMS_CP_TEST_KIND_) + bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(j, kind=TEST_FMS_KIND_) endif end do end do @@ -214,9 +214,9 @@ subroutine set_up_3d_coupler_type(bc_type, data_grid, appendix, to_read) data_grid(5))) if (to_read) then - bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(999., kind=FMS_CP_TEST_KIND_) + bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(999., kind=TEST_FMS_KIND_) else - bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(j, kind=FMS_CP_TEST_KIND_) + bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(j, kind=TEST_FMS_KIND_) endif end do end do diff --git a/test_fms/coupler/test_gex.sh b/test_fms/coupler/test_gex.sh index 5f8596155c..225c73a93b 100755 --- a/test_fms/coupler/test_gex.sh +++ b/test_fms/coupler/test_gex.sh @@ -22,12 +22,10 @@ # Set common test settings. . ../test-lib.sh -if [ ! -z $skip_yaml ] -then - SKIP_TESTS='test_gex.2' -fi +output_dir + -test_cmd="mpirun -n 1 ./test_gex" +test_cmd="mpirun -n 1 ../test_gex" # Create input.nml and field table (legacy field table) prepare_legacy () { @@ -83,8 +81,10 @@ EOF prepare_legacy default_test test_expect_success "Test gex with atm_to_lnd tracer (legacy field_table)" "$test_cmd" -prepare_yaml default_test -test_expect_success "Test gex with atm_to_lnd tracer (YAML field_table)" "$test_cmd" +if [ -z "$parser_skip" ]; then + prepare_yaml default_test + test_expect_success "Test gex with atm_to_lnd tracer (YAML field_table)" "$test_cmd" +fi prepare_legacy get_n_ex_invalid_model_src test_expect_failure "Test gex_get_n_ex with invalid model_src" "$test_cmd" diff --git a/test_fms/data_override/Makefile.am b/test_fms/data_override/Makefile.am index 2925304e89..3169fd3852 100644 --- a/test_fms/data_override/Makefile.am +++ b/test_fms/data_override/Makefile.am @@ -50,23 +50,23 @@ test_data_override_ongrid_SOURCES = test_data_override_ongrid.F90 \ test_get_grid_v1_r4_SOURCES = test_get_grid_v1.F90 test_get_grid_v1_r8_SOURCES = test_get_grid_v1.F90 -test_data_override_r4_CPPFLAGS = $(AM_CPPFLAGS) -DDO_TEST_KIND_=r4_kind -test_data_override_r8_CPPFLAGS = $(AM_CPPFLAGS) -DDO_TEST_KIND_=r8_kind +test_data_override_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r4_kind +test_data_override_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r8_kind + +test_get_grid_v1_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r4_kind +test_get_grid_v1_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r8_kind -test_get_grid_v1_r4_CPPFLAGS = $(AM_CPPFLAGS) -DDO_TEST_KIND_=r4_kind -test_get_grid_v1_r8_CPPFLAGS = $(AM_CPPFLAGS) -DDO_TEST_KIND_=r8_kind if USING_YAML -skipflag="" + TESTS_ENVIRONMENT = parser_skip="" else -skipflag="skip" + TESTS_ENVIRONMENT = parser_skip=skip endif TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ $(abs_top_srcdir)/test_fms/tap-driver.sh -TESTS_ENVIRONMENT= test_input_path="@TEST_INPUT_PATH@" \ - parser_skip=${skipflag} +TESTS_ENVIRONMENT+= test_input_path="@TEST_INPUT_PATH@" # Run the test program. diff --git a/test_fms/data_override/include/test_data_override_ongrid.inc b/test_fms/data_override/include/test_data_override_ongrid.inc index 16df212e79..9d174b8a1f 100644 --- a/test_fms/data_override/include/test_data_override_ongrid.inc +++ b/test_fms/data_override/include/test_data_override_ongrid.inc @@ -18,7 +18,7 @@ !*********************************************************************** subroutine COMPARE_DATA_ (Domain_in, actual_result, expected_result) - integer, parameter :: lkind = DO_TEST_KIND_ !< Real precision of the test + integer, parameter :: lkind = TEST_FMS_KIND_ !< Real precision of the test type(domain2d), intent(in) :: Domain_in !< Domain with mask table real(lkind), intent(in) :: expected_result !< Expected result from data_override real(lkind), dimension(:,:), intent(in) :: actual_result !< Result from data_override @@ -60,7 +60,7 @@ end subroutine COMPARE_DATA_ !! In the first case there is no time interpolation !! In the second case there is time interpolation subroutine ONGRID_TEST_ - integer, parameter :: lkind = DO_TEST_KIND_ !< Real precision of the test + integer, parameter :: lkind = TEST_FMS_KIND_ !< Real precision of the test real(lkind) :: expected_result !< Expected result from data_override type(time_type) :: Time !< Time real(lkind), allocatable, dimension(:,:) :: runoff !< Data to be written @@ -91,7 +91,7 @@ end subroutine ONGRID_TEST_ !> @brief Tests bilinear data_override with and increasing and decreasing grid case !! and comares the output betweeen the cases to ensure it is correct subroutine BILINEAR_TEST_ - integer, parameter :: lkind = DO_TEST_KIND_ !< Real precision of the test + integer, parameter :: lkind = TEST_FMS_KIND_ !< Real precision of the test type(time_type) :: Time !< Time real(lkind), allocatable, dimension(:,:) :: runoff_decreasing !< Data to be written real(lkind), allocatable, dimension(:,:) :: runoff_increasing !< Data to be written @@ -123,7 +123,7 @@ subroutine BILINEAR_TEST_ end subroutine BILINEAR_TEST_ subroutine WEIGHT_FILE_TEST_ - integer, parameter :: lkind = DO_TEST_KIND_ !< Real precision of the test + integer, parameter :: lkind = TEST_FMS_KIND_ !< Real precision of the test type(time_type) :: Time !< Time real(lkind), allocatable, dimension(:,:) :: runoff !< Data from normal override real(lkind), allocatable, dimension(:,:) :: runoff_weight !< Data from weight file override @@ -161,7 +161,7 @@ subroutine WEIGHT_FILE_TEST_ end subroutine WEIGHT_FILE_TEST_ subroutine SCALAR_TEST_ - integer, parameter :: lkind = DO_TEST_KIND_ !< Real precision of the test + integer, parameter :: lkind = TEST_FMS_KIND_ !< Real precision of the test real(lkind) :: expected_result !< Expected result from data_override type(time_type) :: Time !< Time real(lkind) :: co2 !< Data to be written @@ -186,7 +186,7 @@ subroutine SCALAR_TEST_ end subroutine SCALAR_TEST_ subroutine ENSEMBLE_TEST_ - integer, parameter :: lkind = DO_TEST_KIND_ !< Real precision of the test + integer, parameter :: lkind = TEST_FMS_KIND_ !< Real precision of the test real(lkind) :: expected_result !< Expected result from data_override type(time_type) :: Time !< Time real(lkind), allocatable, dimension(:,:) :: runoff !< Data to be written diff --git a/test_fms/data_override/include/test_data_override_ongrid_r4.fh b/test_fms/data_override/include/test_data_override_ongrid_r4.fh index 99613c6a87..65f35a0620 100644 --- a/test_fms/data_override/include/test_data_override_ongrid_r4.fh +++ b/test_fms/data_override/include/test_data_override_ongrid_r4.fh @@ -17,7 +17,7 @@ !* License along with FMS. If not, see . !*********************************************************************** -#undef DO_TEST_KIND_ +#undef TEST_FMS_KIND_ #undef COMPARE_DATA_ #undef ONGRID_TEST_ #undef BILINEAR_TEST_ @@ -25,7 +25,7 @@ #undef SCALAR_TEST_ #undef ENSEMBLE_TEST_ -#define DO_TEST_KIND_ r4_kind +#define TEST_FMS_KIND_ r4_kind #define COMPARE_DATA_ compare_data_r4 #define ONGRID_TEST_ ongrid_test_r4 #define BILINEAR_TEST_ bilinear_test_r4 diff --git a/test_fms/data_override/include/test_data_override_ongrid_r8.fh b/test_fms/data_override/include/test_data_override_ongrid_r8.fh index 1b07b482a2..322a9cc7cd 100644 --- a/test_fms/data_override/include/test_data_override_ongrid_r8.fh +++ b/test_fms/data_override/include/test_data_override_ongrid_r8.fh @@ -17,7 +17,7 @@ !* License along with FMS. If not, see . !*********************************************************************** -#undef DO_TEST_KIND_ +#undef TEST_FMS_KIND_ #undef COMPARE_DATA_ #undef ONGRID_TEST_ #undef BILINEAR_TEST_ @@ -25,7 +25,7 @@ #undef SCALAR_TEST_ #undef ENSEMBLE_TEST_ -#define DO_TEST_KIND_ r8_kind +#define TEST_FMS_KIND_ r8_kind #define COMPARE_DATA_ compare_data_r8 #define ONGRID_TEST_ ongrid_test_r8 #define BILINEAR_TEST_ bilinear_test_r8 diff --git a/test_fms/data_override/test_data_override.F90 b/test_fms/data_override/test_data_override.F90 index d3012ac4c7..8380bf4611 100644 --- a/test_fms/data_override/test_data_override.F90 +++ b/test_fms/data_override/test_data_override.F90 @@ -92,7 +92,7 @@ program test implicit none - integer, parameter :: lkind = DO_TEST_KIND_ + integer, parameter :: lkind = TEST_FMS_KIND_ integer :: stdoutunit integer :: num_threads = 1 integer :: isw, iew, jsw, jew diff --git a/test_fms/data_override/test_get_grid_v1.F90 b/test_fms/data_override/test_get_grid_v1.F90 index f199bacf21..a00ffa0722 100644 --- a/test_fms/data_override/test_get_grid_v1.F90 +++ b/test_fms/data_override/test_get_grid_v1.F90 @@ -35,7 +35,7 @@ program test_get_grid_v1 implicit none -integer, parameter :: lkind = DO_TEST_KIND_ !< r4_kind or r8_kind +integer, parameter :: lkind = TEST_FMS_KIND_ !< r4_kind or r8_kind type(domain2d) :: Domain !< 2D domain integer :: nlon, nlat !< Number of lat, lon in grid real(lkind) :: min_lon, max_lon !< Maximum lat and lon diff --git a/test_fms/diag_integral/Makefile.am b/test_fms/diag_integral/Makefile.am index f93787f492..0f0f1181d0 100644 --- a/test_fms/diag_integral/Makefile.am +++ b/test_fms/diag_integral/Makefile.am @@ -33,8 +33,8 @@ check_PROGRAMS = test_diag_integral_r4 test_diag_integral_r8 test_diag_integral_r4_SOURCES = test_diag_integral.F90 test_diag_integral_r8_SOURCES = test_diag_integral.F90 -test_diag_integral_r4_CPPFLAGS=-DTEST_DI_KIND_=4 -I$(MODDIR) -test_diag_integral_r8_CPPFLAGS=-DTEST_DI_KIND_=8 -I$(MODDIR) +test_diag_integral_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_diag_integral_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(abs_top_srcdir)/test_fms/tap-driver.sh diff --git a/test_fms/diag_integral/test_diag_integral.F90 b/test_fms/diag_integral/test_diag_integral.F90 index 909affe409..1c0d264217 100644 --- a/test_fms/diag_integral/test_diag_integral.F90 +++ b/test_fms/diag_integral/test_diag_integral.F90 @@ -51,11 +51,11 @@ program test_diag_integral character(9), parameter :: field_nameh='immadeuph' !> made up field name to test character(8), parameter :: std_digits = 'e23.15e3' !> write out precision for r8_kind data - real(TEST_DI_KIND_) :: immadeup2(nxy,nxy) !> array to test sum_field_2d - real(TEST_DI_KIND_) :: immadeup3(nxy,nxy,nxy) !> array to test sum_field_3d - real(TEST_DI_KIND_) :: immadeupw(nxy,nxy,nxy) !> array to test sum_field_wght_3d - real(TEST_DI_KIND_) :: weight(nxy,nxy,nxy) !> weights required to test sum_field_wght_3d - real(TEST_DI_KIND_) :: immadeuph(nxy,nxy) !> array to test sum_field_2d_hemi + real(TEST_FMS_KIND_) :: immadeup2(nxy,nxy) !> array to test sum_field_2d + real(TEST_FMS_KIND_) :: immadeup3(nxy,nxy,nxy) !> array to test sum_field_3d + real(TEST_FMS_KIND_) :: immadeupw(nxy,nxy,nxy) !> array to test sum_field_wght_3d + real(TEST_FMS_KIND_) :: weight(nxy,nxy,nxy) !> weights required to test sum_field_wght_3d + real(TEST_FMS_KIND_) :: immadeuph(nxy,nxy) !> array to test sum_field_2d_hemi real(r8_kind) :: lat(nxyp,nxyp), lon(nxyp,nxyp) real(r8_kind) :: area(nxy,nxy) @@ -71,7 +71,7 @@ program test_diag_integral real(r8_kind) :: field_avgw !> result from sum_field_avgw real(r8_kind) :: field_avgh !> result from field_avgh - integer, parameter :: lkind=TEST_DI_KIND_ !> local version of TEST_DI_KIND_ + integer, parameter :: lkind=TEST_FMS_KIND_ !> local version of TEST_FMS_KIND_ call fms_init call initialize_arrays diff --git a/test_fms/diag_manager/Makefile.am b/test_fms/diag_manager/Makefile.am index 614c2e5db3..a005913b5c 100644 --- a/test_fms/diag_manager/Makefile.am +++ b/test_fms/diag_manager/Makefile.am @@ -93,12 +93,10 @@ EXTRA_DIST = test_diag_manager2.sh check_crashes.sh test_time_none.sh test_time_ test_ens_runs.sh test_multi_file.sh test_diag_attribute_add.sh test_zbounds_limits.sh if USING_YAML -skipflag="" + TESTS_ENVIRONMENT = parser_skip="" else -skipflag="skip" + TESTS_ENVIRONMENT = parser_skip=skip endif -TESTS_ENVIRONMENT = skipflag=${skipflag} - CLEANFILES = *.yaml input.nml *.nc *.out diag_table* *-files/* *.dpi *.spi *.dyn *.spl *.mod diff --git a/test_fms/diag_manager/test_cell_measures.sh b/test_fms/diag_manager/test_cell_measures.sh index c97216fdb4..b47d11b61c 100755 --- a/test_fms/diag_manager/test_cell_measures.sh +++ b/test_fms/diag_manager/test_cell_measures.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_diag_attribute_add.sh b/test_fms/diag_manager/test_diag_attribute_add.sh index f7f9caf922..3767ebcc47 100755 --- a/test_fms/diag_manager/test_diag_attribute_add.sh +++ b/test_fms/diag_manager/test_diag_attribute_add.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_diag_manager2.sh b/test_fms/diag_manager/test_diag_manager2.sh index 1fc7c40da7..29adb0637c 100755 --- a/test_fms/diag_manager/test_diag_manager2.sh +++ b/test_fms/diag_manager/test_diag_manager2.sh @@ -510,7 +510,7 @@ test_expect_success "Test the diag update_buffer (test $my_test_count)" ' ## run tests that are ifdef'd out only if compiled with yaml ## otherwise just run the updated end to end to check for error -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then cat <<_EOF > diag_table.yaml title: test_diag_manager diff --git a/test_fms/diag_manager/test_dm_weights.sh b/test_fms/diag_manager/test_dm_weights.sh index 0f291180ae..ce38e68eb7 100755 --- a/test_fms/diag_manager/test_dm_weights.sh +++ b/test_fms/diag_manager/test_dm_weights.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_ens_runs.sh b/test_fms/diag_manager/test_ens_runs.sh index f73825d5bd..4d7b11e921 100755 --- a/test_fms/diag_manager/test_ens_runs.sh +++ b/test_fms/diag_manager/test_ens_runs.sh @@ -24,7 +24,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_flush_nc_file.sh b/test_fms/diag_manager/test_flush_nc_file.sh index 7337bd8499..5e9f1041ce 100755 --- a/test_fms/diag_manager/test_flush_nc_file.sh +++ b/test_fms/diag_manager/test_flush_nc_file.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_multi_file.sh b/test_fms/diag_manager/test_multi_file.sh index 1f23da3818..34ae5d59cc 100755 --- a/test_fms/diag_manager/test_multi_file.sh +++ b/test_fms/diag_manager/test_multi_file.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_multiple_send_data.sh b/test_fms/diag_manager/test_multiple_send_data.sh index 1240e1d414..5edc21470f 100755 --- a/test_fms/diag_manager/test_multiple_send_data.sh +++ b/test_fms/diag_manager/test_multiple_send_data.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_output_every_freq.sh b/test_fms/diag_manager/test_output_every_freq.sh index 37869a7d10..cd88e5445f 100755 --- a/test_fms/diag_manager/test_output_every_freq.sh +++ b/test_fms/diag_manager/test_output_every_freq.sh @@ -24,7 +24,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_prepend_date.sh b/test_fms/diag_manager/test_prepend_date.sh index 13bbf7c77a..6857176b8d 100755 --- a/test_fms/diag_manager/test_prepend_date.sh +++ b/test_fms/diag_manager/test_prepend_date.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_subregional.sh b/test_fms/diag_manager/test_subregional.sh index dcb1f5e9da..1e4357cece 100755 --- a/test_fms/diag_manager/test_subregional.sh +++ b/test_fms/diag_manager/test_subregional.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_time_avg.sh b/test_fms/diag_manager/test_time_avg.sh index e31e243fa5..0b125432f8 100755 --- a/test_fms/diag_manager/test_time_avg.sh +++ b/test_fms/diag_manager/test_time_avg.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_time_diurnal.sh b/test_fms/diag_manager/test_time_diurnal.sh index aef8a29e02..64df8ff565 100755 --- a/test_fms/diag_manager/test_time_diurnal.sh +++ b/test_fms/diag_manager/test_time_diurnal.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_time_max.sh b/test_fms/diag_manager/test_time_max.sh index d2a0fd7cdc..0315782a01 100755 --- a/test_fms/diag_manager/test_time_max.sh +++ b/test_fms/diag_manager/test_time_max.sh @@ -24,7 +24,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_time_min.sh b/test_fms/diag_manager/test_time_min.sh index f2969d47c9..d63ed25db7 100755 --- a/test_fms/diag_manager/test_time_min.sh +++ b/test_fms/diag_manager/test_time_min.sh @@ -24,7 +24,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_time_none.sh b/test_fms/diag_manager/test_time_none.sh index 74110a0340..f6267c75cb 100755 --- a/test_fms/diag_manager/test_time_none.sh +++ b/test_fms/diag_manager/test_time_none.sh @@ -24,7 +24,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_time_pow.sh b/test_fms/diag_manager/test_time_pow.sh index 5e343de9bb..b527acfee8 100755 --- a/test_fms/diag_manager/test_time_pow.sh +++ b/test_fms/diag_manager/test_time_pow.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_time_rms.sh b/test_fms/diag_manager/test_time_rms.sh index 8f3c526f77..011c3a5e0d 100755 --- a/test_fms/diag_manager/test_time_rms.sh +++ b/test_fms/diag_manager/test_time_rms.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_time_sum.sh b/test_fms/diag_manager/test_time_sum.sh index c7631217a4..428d8a06a9 100755 --- a/test_fms/diag_manager/test_time_sum.sh +++ b/test_fms/diag_manager/test_time_sum.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_var_masks.sh b/test_fms/diag_manager/test_var_masks.sh index 761fb345cf..283a5ba73f 100755 --- a/test_fms/diag_manager/test_var_masks.sh +++ b/test_fms/diag_manager/test_var_masks.sh @@ -22,7 +22,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_zbounds_limits.sh b/test_fms/diag_manager/test_zbounds_limits.sh index b0c37564dc..254e957851 100755 --- a/test_fms/diag_manager/test_zbounds_limits.sh +++ b/test_fms/diag_manager/test_zbounds_limits.sh @@ -37,7 +37,7 @@ test_expect_success "Test zbounds limits (legacy diag manager)" ' mpirun -n 6 ../test_zbounds_limits ' -if [ -z "${skipflag}" ] +if [ -z "${parser_skip}" ] then # Repeat the test with the modern diag_manager cat <<_EOF > input.nml diff --git a/test_fms/field_manager/Makefile.am b/test_fms/field_manager/Makefile.am index 01f10ed0dd..3ad4cc0aa4 100644 --- a/test_fms/field_manager/Makefile.am +++ b/test_fms/field_manager/Makefile.am @@ -36,18 +36,17 @@ test_field_manager_r4_SOURCES = test_field_manager.F90 test_field_manager_r8_SOURCES = test_field_manager.F90 test_field_table_read_SOURCES = test_field_table_read.F90 -test_field_manager_r4_CPPFLAGS=-DTEST_FM_KIND_=4 -I$(MODDIR) -test_field_manager_r8_CPPFLAGS=-DTEST_FM_KIND_=8 -I$(MODDIR) +test_field_manager_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_field_manager_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) if USING_YAML -skipflag="skip" + TESTS_ENVIRONMENT = parser_skip="" else -skipflag="" + TESTS_ENVIRONMENT = parser_skip=skip endif TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(abs_top_srcdir)/test_fms/tap-driver.sh -TESTS_ENVIRONMENT= parser_skip=${skipflag} # Run the test program. TESTS = test_field_manager2.sh diff --git a/test_fms/field_manager/test_field_manager.F90 b/test_fms/field_manager/test_field_manager.F90 index 7749a8647c..6754de0d0f 100644 --- a/test_fms/field_manager/test_field_manager.F90 +++ b/test_fms/field_manager/test_field_manager.F90 @@ -45,17 +45,17 @@ program test_field_manager integer :: i, j, nfields, num_methods, model character(len=fm_string_len) :: field_type, field_name, str, name_field_type, path character(len=512) :: method_name, method_control -real(TEST_FM_KIND_) :: param, param_out +real(TEST_FMS_KIND_) :: param, param_out integer :: flag, index logical :: success type(method_type), dimension(20) :: methods -real(TEST_FM_KIND_) :: slope_value -real(TEST_FM_KIND_) :: slope_value_array(2) -integer, parameter :: lkind=TEST_FM_KIND_ +real(TEST_FMS_KIND_) :: slope_value +real(TEST_FMS_KIND_) :: slope_value_array(2) +integer, parameter :: lkind=TEST_FMS_KIND_ integer, parameter :: array_size=4 -real(TEST_FM_KIND_) :: array_values(array_size), array_out(array_size) +real(TEST_FMS_KIND_) :: array_values(array_size), array_out(array_size) call mpp_init call field_manager_init(nfields) diff --git a/test_fms/field_manager/test_field_manager2.sh b/test_fms/field_manager/test_field_manager2.sh index 29b77ff19a..d83894b76d 100755 --- a/test_fms/field_manager/test_field_manager2.sh +++ b/test_fms/field_manager/test_field_manager2.sh @@ -100,9 +100,12 @@ cat <<_EOF > input.nml / _EOF -if [ ! $parser_skip ]; then +if [ ! -z "$parser_skip" ]; then + test_expect_failure "field table read with use_field_table.yaml = .true. but not compiling with yaml" 'mpirun -n 1 ./test_field_table_read' + else + test_expect_success "field table read with use_field_table.yaml = .true." 'mpirun -n 1 ./test_field_table_read' test_expect_success "field manager functional r4 with yaml table" 'mpirun -n 2 ./test_field_manager_r4' test_expect_success "field manager functional r8 with yaml table" 'mpirun -n 2 ./test_field_manager_r8' @@ -173,8 +176,8 @@ field_table: longname: bad radon! _EOF -rm -rf field_table.ens_01.yaml field_table.ens_02.yaml -test_expect_success "field manager test with 2 ensembles same yaml" 'mpirun -n 2 ./test_field_table_read' + rm -rf field_table.ens_01.yaml field_table.ens_02.yaml + test_expect_success "field manager test with 2 ensembles same yaml" 'mpirun -n 2 ./test_field_table_read' fi test_done diff --git a/test_fms/horiz_interp/Makefile.am b/test_fms/horiz_interp/Makefile.am index 8b24b804fd..44420df30c 100644 --- a/test_fms/horiz_interp/Makefile.am +++ b/test_fms/horiz_interp/Makefile.am @@ -36,9 +36,9 @@ test_horiz_interp_r4_SOURCES = test_horiz_interp.F90 test_horiz_interp_r8_SOURCES = test_horiz_interp.F90 test_create_xgrid_order2_r8_SOURCES = test_create_xgrid_order2.F90 -test_horiz_interp_r4_CPPFLAGS=-DHI_TEST_KIND_=4 -I$(MODDIR) -test_horiz_interp_r8_CPPFLAGS=-DHI_TEST_KIND_=8 -I$(MODDIR) -test_create_xgrid_order2_r8_CPPFLAGS=-DHI_TEST_KIND_=8 -I$(MODDIR) +test_horiz_interp_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_horiz_interp_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) +test_create_xgrid_order2_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ diff --git a/test_fms/horiz_interp/test_create_xgrid_order2.F90 b/test_fms/horiz_interp/test_create_xgrid_order2.F90 index 5a3252c303..7c133889b1 100644 --- a/test_fms/horiz_interp/test_create_xgrid_order2.F90 +++ b/test_fms/horiz_interp/test_create_xgrid_order2.F90 @@ -26,9 +26,10 @@ program test_create_xgrid_order2 use horiz_interp_mod use constants_mod, only: DEG_TO_RAD + use platform_mod implicit none - integer, parameter :: lkind = HI_TEST_KIND_ + integer, parameter :: lkind = TEST_FMS_KIND_ integer, parameter :: nlon_in = 10 !< number of input grid cells in lon direction integer, parameter :: nlat_in = 10 !< number of input grid cells in the lat direction @@ -38,19 +39,19 @@ program test_create_xgrid_order2 integer, parameter :: ngridpts_out = (nlon_out+1)*(nlat_out+1) !< number of output gridpoints integer, parameter :: nxgrid = nlon_out *nlat_out !< expected number of exchange grid cells - real(HI_TEST_KIND_) :: lon_in(ngridpts_in) !< longitudinal values of input grid cell vertices - real(HI_TEST_KIND_) :: lat_in(ngridpts_in) !< latitudinal values of input grid cell vertices - real(HI_TEST_KIND_) :: lon_out(ngridpts_out) !< longitudinal values of output grid cell vertices - real(HI_TEST_KIND_) :: lat_out(ngridpts_out) !< latitudinal values of output grid cell vertices - real(HI_TEST_KIND_) :: mask(nlon_in*nlat_in) !< mask to skip input grid cell + real(TEST_FMS_KIND_) :: lon_in(ngridpts_in) !< longitudinal values of input grid cell vertices + real(TEST_FMS_KIND_) :: lat_in(ngridpts_in) !< latitudinal values of input grid cell vertices + real(TEST_FMS_KIND_) :: lon_out(ngridpts_out) !< longitudinal values of output grid cell vertices + real(TEST_FMS_KIND_) :: lat_out(ngridpts_out) !< latitudinal values of output grid cell vertices + real(TEST_FMS_KIND_) :: mask(nlon_in*nlat_in) !< mask to skip input grid cell integer :: i_in(nxgrid) !< input parent cell indices integer :: j_in(nxgrid) !< input parent cell indices integer :: i_out(nxgrid) !< output parent cell indices integer :: j_out(nxgrid) !< output parent cell indices - real(HI_TEST_KIND_) :: xgrid_area(nxgrid) !< exchange grid cell areas - real(HI_TEST_KIND_) :: xgrid_clon(nxgrid) !< longitudinal values of exchange grid cell centroid point - real(HI_TEST_KIND_) :: xgrid_clat(nxgrid) !< latitudinal values of exchange grid cell centroid point + real(TEST_FMS_KIND_) :: xgrid_area(nxgrid) !< exchange grid cell areas + real(TEST_FMS_KIND_) :: xgrid_clon(nxgrid) !< longitudinal values of exchange grid cell centroid point + real(TEST_FMS_KIND_) :: xgrid_clat(nxgrid) !< latitudinal values of exchange grid cell centroid point mask = 1.0_lkind @@ -68,20 +69,20 @@ subroutine get_grid(nlon, nlat, lon, lat) implicit none integer, intent(in) :: nlon, nlat !< number of cell in lon and lat direction - real(HI_TEST_KIND_), intent(out) :: lon(:), lat(:) !< lon and lat values at cell vertices + real(TEST_FMS_KIND_), intent(out) :: lon(:), lat(:) !< lon and lat values at cell vertices integer :: ilon, ilat, igridpt real :: dlat=0.0_lkind, dlon=0.0_lkind real :: lon_start=0.0_lkind, lat_start=-90.0_lkind*DEG_TO_RAD - dlat = 180._lkind/real(nlat, HI_TEST_KIND_) * DEG_TO_RAD - dlon = 360._lkind/real(nlon, HI_TEST_KIND_) * DEG_TO_RAD + dlat = 180._lkind/real(nlat, TEST_FMS_KIND_) * DEG_TO_RAD + dlon = 360._lkind/real(nlon, TEST_FMS_KIND_) * DEG_TO_RAD igridpt = 1 do ilat=1, nlat+1 do ilon=1, nlon+1 - lon(igridpt) = lon_start + real(ilon-1, HI_TEST_KIND_)*dlon - lat(igridpt) = lat_start + real(ilat-1, HI_TEST_KIND_)*dlat + lon(igridpt) = lon_start + real(ilon-1, TEST_FMS_KIND_)*dlon + lat(igridpt) = lat_start + real(ilat-1, TEST_FMS_KIND_)*dlat igridpt = igridpt + 1 end do end do @@ -97,9 +98,9 @@ subroutine test_create_xgrid_2dx2d_order2(nlon_inl, nlat_inl, nlon_outl, nlat_ou implicit none integer, intent(in) :: nlon_inl, nlat_inl, nlon_outl, nlat_outl, nxgridl !< number of grid cells integer, intent(inout) :: i_inl(:), j_inl(:), i_outl(:), j_outl(:) !< parent cell indices - real(HI_TEST_KIND_), intent(in) :: lon_inl(:), lat_inl(:), lon_outl(:), lat_outl(:) !< lon and lat - real(HI_TEST_KIND_), intent(in) :: maskl(:) !< input grid cell mask - real(HI_TEST_KIND_), intent(out) :: xgrid_areal(:), xgrid_clonl(:), xgrid_clatl(:) !< returned xgrid info + real(TEST_FMS_KIND_), intent(in) :: lon_inl(:), lat_inl(:), lon_outl(:), lat_outl(:) !< lon and lat + real(TEST_FMS_KIND_), intent(in) :: maskl(:) !< input grid cell mask + real(TEST_FMS_KIND_), intent(out) :: xgrid_areal(:), xgrid_clonl(:), xgrid_clatl(:) !< returned xgrid info integer :: create_xgrid_2dx2d_order2 integer :: nxgrid_out diff --git a/test_fms/horiz_interp/test_horiz_interp.F90 b/test_fms/horiz_interp/test_horiz_interp.F90 index efeddd882a..578c7dbc7a 100644 --- a/test_fms/horiz_interp/test_horiz_interp.F90 +++ b/test_fms/horiz_interp/test_horiz_interp.F90 @@ -61,7 +61,7 @@ program horiz_interp_test integer :: id1, id2, id3, id4 integer :: isc, iec, jsc, jec, i, j integer :: io, ierr, layout(2) - integer, parameter :: lkind = HI_TEST_KIND_ + integer, parameter :: lkind = TEST_FMS_KIND_ call fms_init call mpp_init @@ -105,49 +105,49 @@ program horiz_interp_test !! for finding the nearest points and distances so this gets run for both subroutine test_horiz_interp_spherical !! grid data - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lat_in_2D, lon_in_2D + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lat_in_2D, lon_in_2D type(horiz_interp_type) :: interp_t, interp_copy !! input data - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: data_src, data_dst + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: data_src, data_dst !! output data - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lat_out_2D, lon_out_2D - real(HI_TEST_KIND_), allocatable, dimension(:,:,:) :: wghts + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lat_out_2D, lon_out_2D + real(TEST_FMS_KIND_), allocatable, dimension(:,:,:) :: wghts !! array sizes and number of lat/lon per index - real(HI_TEST_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst + real(TEST_FMS_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst !! parameters for lon/lat setup - real(HI_TEST_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind - real(HI_TEST_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind - real(HI_TEST_KIND_) :: lon_dst_beg = -280._lkind, lon_dst_end = 80._lkind - real(HI_TEST_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind - real(HI_TEST_KIND_) :: D2R = real(PI,HI_TEST_KIND_)/180._lkind - real(HI_TEST_KIND_) :: tolerance - - if(HI_TEST_KIND_ == r8_kind) then + real(TEST_FMS_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind + real(TEST_FMS_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind + real(TEST_FMS_KIND_) :: lon_dst_beg = -280._lkind, lon_dst_end = 80._lkind + real(TEST_FMS_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind + real(TEST_FMS_KIND_) :: D2R = real(PI,TEST_FMS_KIND_)/180._lkind + real(TEST_FMS_KIND_) :: tolerance + + if(TEST_FMS_KIND_ == r8_kind) then tolerance = 1.0e-10_lkind else tolerance = 1.0e-5_lkind endif ! set up longitude and latitude of source/destination grid. - dlon_src = (lon_src_end-lon_src_beg)/real(ni_src, HI_TEST_KIND_) - dlat_src = (lat_src_end-lat_src_beg)/real(nj_src, HI_TEST_KIND_) - dlon_dst = (lon_dst_end-lon_dst_beg)/real(ni_dst, HI_TEST_KIND_) - dlat_dst = (lat_dst_end-lat_dst_beg)/real(nj_dst, HI_TEST_KIND_) + dlon_src = (lon_src_end-lon_src_beg)/real(ni_src, TEST_FMS_KIND_) + dlat_src = (lat_src_end-lat_src_beg)/real(nj_src, TEST_FMS_KIND_) + dlon_dst = (lon_dst_end-lon_dst_beg)/real(ni_dst, TEST_FMS_KIND_) + dlat_dst = (lat_dst_end-lat_dst_beg)/real(nj_dst, TEST_FMS_KIND_) ! set up 2d lon/lat allocate(lon_in_2D(ni_src, nj_src), lat_in_2D(ni_src, nj_src)) do i = 1, ni_src - lon_in_2D(i,:) = lon_src_beg + real(i-1, HI_TEST_KIND_)*dlon_src + lon_in_2D(i,:) = lon_src_beg + real(i-1, TEST_FMS_KIND_)*dlon_src end do do j = 1, nj_src - lat_in_2D(:,j) = lat_src_beg + real(j-1, HI_TEST_KIND_)*dlat_src + lat_in_2D(:,j) = lat_src_beg + real(j-1, TEST_FMS_KIND_)*dlat_src end do allocate(lon_out_2D(ni_dst, nj_dst), lat_out_2D(ni_dst, nj_dst)) do i = 1, ni_dst - lon_out_2D(i,:) = lon_dst_beg + real(i-1, HI_TEST_KIND_)*dlon_dst + lon_out_2D(i,:) = lon_dst_beg + real(i-1, TEST_FMS_KIND_)*dlon_dst end do do j = 1, nj_dst - lat_out_2D(:,j) = lat_src_beg + real(j-1, HI_TEST_KIND_)*dlat_dst + lat_out_2D(:,j) = lat_src_beg + real(j-1, TEST_FMS_KIND_)*dlat_dst end do ! scale to radians @@ -199,13 +199,13 @@ subroutine test_horiz_interp_spherical !> Tests bilinear module interpolation with each dimension conversion !! test without passing in the type when test_solo is true subroutine test_horiz_interp_bilinear - real(HI_TEST_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst - real(HI_TEST_KIND_), allocatable, dimension(:) :: lon1D_src, lat1D_src, lon1D_dst, lat1D_dst - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lon2D_src, lat2d_src, lon2D_dst, lat2D_dst - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: data_src, data_dst - real(HI_TEST_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360.0_lkind - real(HI_TEST_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind - real(HI_TEST_KIND_), parameter :: D2R = real(PI,lkind)/180._lkind + real(TEST_FMS_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst + real(TEST_FMS_KIND_), allocatable, dimension(:) :: lon1D_src, lat1D_src, lon1D_dst, lat1D_dst + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lon2D_src, lat2d_src, lon2D_dst, lat2D_dst + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: data_src, data_dst + real(TEST_FMS_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360.0_lkind + real(TEST_FMS_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind + real(TEST_FMS_KIND_), parameter :: D2R = real(PI,lkind)/180._lkind type(horiz_interp_type) :: interp, interp_copy @@ -224,24 +224,24 @@ subroutine test_horiz_interp_bilinear allocate( data_dst(ni_src,nj_src) ) ! set up longitude and latitude of source/destination grid. - dlon_src = (lon_src_end-lon_src_beg)/real(ni_src,HI_TEST_KIND_) ; dlon_dst = dlon_src - dlat_src = (lat_src_end-lat_src_beg)/real(nj_src,HI_TEST_KIND_) ; dlat_dst = dlat_src + dlon_src = (lon_src_end-lon_src_beg)/real(ni_src,TEST_FMS_KIND_) ; dlon_dst = dlon_src + dlat_src = (lat_src_end-lat_src_beg)/real(nj_src,TEST_FMS_KIND_) ; dlat_dst = dlat_src ! set up 1d source grid do i = 1, ni_src - lon1D_src(i) = ( lon_src_beg + real(i-1,HI_TEST_KIND_)*dlon_src ) * D2R + lon1D_src(i) = ( lon_src_beg + real(i-1,TEST_FMS_KIND_)*dlon_src ) * D2R end do - lon1D_src(ni_src+1) = ( lon_src_beg + real(ni_src,HI_TEST_KIND_)*dlon_src ) * D2R + lon1D_src(ni_src+1) = ( lon_src_beg + real(ni_src,TEST_FMS_KIND_)*dlon_src ) * D2R do j = 1, nj_src - lat1D_src(j) = ( lat_src_beg + real(j-1,HI_TEST_KIND_)*dlat_src ) * D2R + lat1D_src(j) = ( lat_src_beg + real(j-1,TEST_FMS_KIND_)*dlat_src ) * D2R end do - lat1D_src(nj_src+1) = ( lat_src_beg + real(nj_src,HI_TEST_KIND_)*dlat_src ) * D2R + lat1D_src(nj_src+1) = ( lat_src_beg + real(nj_src,TEST_FMS_KIND_)*dlat_src ) * D2R !--- set up the source data do j = 1, nj_src do i = 1, ni_src - data_src(i,j) = real(i,HI_TEST_KIND_) + real(j,HI_TEST_KIND_)*0.001_lkind + data_src(i,j) = real(i,TEST_FMS_KIND_) + real(j,TEST_FMS_KIND_)*0.001_lkind end do end do @@ -633,27 +633,27 @@ end subroutine test_horiz_interp_bilinear !! test without passing in the type when test_solo is true subroutine test_horiz_interp_bicubic !! grid data - real(HI_TEST_KIND_), allocatable, dimension(:) :: lat_in_1D, lon_in_1D + real(TEST_FMS_KIND_), allocatable, dimension(:) :: lat_in_1D, lon_in_1D type(horiz_interp_type) :: interp_t, interp_copy !! input data - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: data_src, data_dst + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: data_src, data_dst !! output data - real(HI_TEST_KIND_), allocatable, dimension(:) :: lat_out_1D, lon_out_1D - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lat_out_2D, lon_out_2D + real(TEST_FMS_KIND_), allocatable, dimension(:) :: lat_out_1D, lon_out_1D + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lat_out_2D, lon_out_2D !! array sizes and number of lat/lon per index - real(HI_TEST_KIND_) :: nlon_in, nlat_in - real(HI_TEST_KIND_) :: nlon_out, nlat_out - real(HI_TEST_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst + real(TEST_FMS_KIND_) :: nlon_in, nlat_in + real(TEST_FMS_KIND_) :: nlon_out, nlat_out + real(TEST_FMS_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst !! parameters for lon/lat setup - real(HI_TEST_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind - real(HI_TEST_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind - real(HI_TEST_KIND_) :: lon_dst_beg = -280._lkind, lon_dst_end = 80._lkind - real(HI_TEST_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind - real(HI_TEST_KIND_) :: D2R = real(PI,HI_TEST_KIND_)/180._lkind - real(HI_TEST_KIND_) :: SMALL + real(TEST_FMS_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind + real(TEST_FMS_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind + real(TEST_FMS_KIND_) :: lon_dst_beg = -280._lkind, lon_dst_end = 80._lkind + real(TEST_FMS_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind + real(TEST_FMS_KIND_) :: D2R = real(PI,TEST_FMS_KIND_)/180._lkind + real(TEST_FMS_KIND_) :: SMALL ! adjust tolerance used in checks based on kind size - if(HI_TEST_KIND_ == r8_kind) then + if(TEST_FMS_KIND_ == r8_kind) then small = 1.0e-10_lkind else small = 1.0e-3_lkind @@ -805,16 +805,16 @@ end subroutine test_horiz_interp_bicubic !> Tests conservative (default) interpolation module and checks grids reproduce across 1/2d versions subroutine test_horiz_interp_conserve - real(HI_TEST_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst - real(HI_TEST_KIND_), allocatable, dimension(:) :: lon1D_src, lat1D_src, lon1D_dst, lat1D_dst - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lon2D_src, lat2D_src, lon2D_dst, lat2D_dst - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: data_src, data1_dst, data2_dst, data3_dst, data4_dst - real(HI_TEST_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind - real(HI_TEST_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind - real(HI_TEST_KIND_) :: lon_dst_beg = -280._lkind, lon_dst_end = 80._lkind - real(HI_TEST_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind - real(HI_TEST_KIND_) :: D2R = real(PI,HI_TEST_KIND_)/180._lkind - real(HI_TEST_KIND_), parameter :: SMALL = 1.0e-10_lkind + real(TEST_FMS_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst + real(TEST_FMS_KIND_), allocatable, dimension(:) :: lon1D_src, lat1D_src, lon1D_dst, lat1D_dst + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lon2D_src, lat2D_src, lon2D_dst, lat2D_dst + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: data_src, data1_dst, data2_dst, data3_dst, data4_dst + real(TEST_FMS_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind + real(TEST_FMS_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind + real(TEST_FMS_KIND_) :: lon_dst_beg = -280._lkind, lon_dst_end = 80._lkind + real(TEST_FMS_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind + real(TEST_FMS_KIND_) :: D2R = real(PI,TEST_FMS_KIND_)/180._lkind + real(TEST_FMS_KIND_), parameter :: SMALL = 1.0e-10_lkind type(horiz_interp_type) :: interp_conserve, interp_copy allocate(lon2D_src(ni_src+1, nj_src+1), lat2D_src(ni_src+1, nj_src+1) ) @@ -1003,24 +1003,24 @@ subroutine test_horiz_interp_conserve !! they can be created/deleted without allocation errors. subroutine test_assignment() type(horiz_interp_type) :: Interp_new1, Interp_new2, Interp_cp - real(HI_TEST_KIND_), allocatable, dimension(:) :: lat_in_1D, lon_in_1D !< 1D grid data points - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lat_in_2D, lon_in_2D !< 2D grid data points - real(HI_TEST_KIND_), allocatable, dimension(:) :: lat_out_1D, lon_out_1D !< 1D grid output points - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lat_out_2D, lon_out_2D !< 2D grid output points + real(TEST_FMS_KIND_), allocatable, dimension(:) :: lat_in_1D, lon_in_1D !< 1D grid data points + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lat_in_2D, lon_in_2D !< 2D grid data points + real(TEST_FMS_KIND_), allocatable, dimension(:) :: lat_out_1D, lon_out_1D !< 1D grid output points + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lat_out_2D, lon_out_2D !< 2D grid output points integer :: nlon_in, nlat_in !< array sizes for input grids integer :: nlon_out, nlat_out !< array sizes for output grids - real(HI_TEST_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst !< lon/lat size per data point - real(HI_TEST_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind!< source grid starting/ending + real(TEST_FMS_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst !< lon/lat size per data point + real(TEST_FMS_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind!< source grid starting/ending !! longitudes - real(HI_TEST_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind !< source grid starting/ending + real(TEST_FMS_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind !< source grid starting/ending !! latitudes - real(HI_TEST_KIND_) :: lon_dst_beg = 0.0_lkind, lon_dst_end = 360._lkind !< destination grid + real(TEST_FMS_KIND_) :: lon_dst_beg = 0.0_lkind, lon_dst_end = 360._lkind !< destination grid !! starting/ending longitudes - real(HI_TEST_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind !< destination grid + real(TEST_FMS_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind !< destination grid !! starting/ending latitudes - real(HI_TEST_KIND_) :: D2R = real(PI,HI_TEST_KIND_)/180._lkind !< radians per degree - real(HI_TEST_KIND_), allocatable :: lon_src_1d(:), lat_src_1d(:) !< src data used for bicubic test - real(HI_TEST_KIND_), allocatable :: lon_dst_1d(:), lat_dst_1d(:) !< destination data used for bicubic test + real(TEST_FMS_KIND_) :: D2R = real(PI,TEST_FMS_KIND_)/180._lkind !< radians per degree + real(TEST_FMS_KIND_), allocatable :: lon_src_1d(:), lat_src_1d(:) !< src data used for bicubic test + real(TEST_FMS_KIND_), allocatable :: lon_dst_1d(:), lat_dst_1d(:) !< destination data used for bicubic test integer :: icount !< index for setting the output array when taking midpoints for bilinear @@ -1033,16 +1033,16 @@ subroutine test_assignment() allocate(lon_in_1D(ni_src+1), lat_in_1D(nj_src+1)) allocate(lon_out_1D(isc:iec+1), lat_out_1D(jsc:jec+1)) do i = 1, ni_src+1 - lon_in_1D(i) = lon_src_beg + real(i-1,HI_TEST_KIND_)*dlon_src + lon_in_1D(i) = lon_src_beg + real(i-1,TEST_FMS_KIND_)*dlon_src end do do j = 1, nj_src+1 - lat_in_1D(j) = lat_src_beg + real(j-1,HI_TEST_KIND_)*dlat_src + lat_in_1D(j) = lat_src_beg + real(j-1,TEST_FMS_KIND_)*dlat_src end do do i = isc, iec+1 - lon_out_1D(i) = lon_dst_beg + real(i-1,HI_TEST_KIND_)*dlon_dst + lon_out_1D(i) = lon_dst_beg + real(i-1,TEST_FMS_KIND_)*dlon_dst end do do j = jsc, jec+1 - lat_out_1D(j) = lat_dst_beg + real(j-1, HI_TEST_KIND_)*dlat_dst + lat_out_1D(j) = lat_dst_beg + real(j-1, TEST_FMS_KIND_)*dlat_dst end do lon_in_1D = lon_in_1D * D2R @@ -1168,16 +1168,16 @@ subroutine test_assignment() allocate(lon_out_2D(ni_dst, nj_dst), lat_out_2D(ni_dst, nj_dst)) allocate(lon_in_2D(ni_src, nj_src), lat_in_2D(ni_src, nj_src)) do i = 1, ni_dst - lon_out_2D(i,:) = lon_dst_beg + real(i-1, HI_TEST_KIND_)*dlon_dst + lon_out_2D(i,:) = lon_dst_beg + real(i-1, TEST_FMS_KIND_)*dlon_dst end do do j = 1, nj_dst - lat_out_2D(:,j) = lat_dst_beg + real(j-1, HI_TEST_KIND_)*dlat_dst + lat_out_2D(:,j) = lat_dst_beg + real(j-1, TEST_FMS_KIND_)*dlat_dst end do do i = 1, ni_src - lon_in_2D(i,:) = lon_src_beg + real(i-1, HI_TEST_KIND_)*dlon_src + lon_in_2D(i,:) = lon_src_beg + real(i-1, TEST_FMS_KIND_)*dlon_src end do do j = 1, nj_src - lat_in_2D(:,j) = lat_src_beg + real(j-1, HI_TEST_KIND_)*dlat_src + lat_in_2D(:,j) = lat_src_beg + real(j-1, TEST_FMS_KIND_)*dlat_src end do ! scale to radians lat_in_2D = lat_in_2D * D2R @@ -1225,10 +1225,10 @@ subroutine test_assignment() deallocate(lon_out_1D, lat_out_1D) allocate(lon_out_1D(ni_dst), lat_out_1D(nj_dst)) do i=1, ni_dst - lon_out_1d(i) = real(i-1, HI_TEST_KIND_) * dlon_dst + lon_dst_beg + lon_out_1d(i) = real(i-1, TEST_FMS_KIND_) * dlon_dst + lon_dst_beg enddo do j=1, nj_dst - lat_out_1d(j) = real(j-1, HI_TEST_KIND_) * dlat_dst + lat_dst_beg + lat_out_1d(j) = real(j-1, TEST_FMS_KIND_) * dlat_dst + lat_dst_beg enddo lat_out_1d = lat_out_1D * D2R lon_out_1d = lon_out_1D * D2R diff --git a/test_fms/interpolator/Makefile.am b/test_fms/interpolator/Makefile.am index f795c3f597..da7da4a7e7 100644 --- a/test_fms/interpolator/Makefile.am +++ b/test_fms/interpolator/Makefile.am @@ -36,8 +36,8 @@ test_interpolator_SOURCES = test_interpolator.F90 test_interpolator2_r4_SOURCES = test_interpolator2.F90 test_interpolator_write_climatology.inc test_interpolator2_r8_SOURCES = test_interpolator2.F90 test_interpolator_write_climatology.inc -test_interpolator2_r4_CPPFLAGS=-DTEST_INTP_KIND_=4 -I$(MODDIR) -test_interpolator2_r8_CPPFLAGS=-DTEST_INTP_KIND_=8 -I$(MODDIR) +test_interpolator2_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_interpolator2_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) # Run the test program. TESTS = test_interpolator2.sh diff --git a/test_fms/interpolator/test_interpolator2.F90 b/test_fms/interpolator/test_interpolator2.F90 index b202eb8b82..b03ae3af23 100644 --- a/test_fms/interpolator/test_interpolator2.F90 +++ b/test_fms/interpolator/test_interpolator2.F90 @@ -46,7 +46,7 @@ program test_interpolator2 implicit none character(100), parameter :: ncfile='immadeup.o3.climatology.nc' !< fake climatology file - integer, parameter :: lkind=TEST_INTP_KIND_ + integer, parameter :: lkind=TEST_FMS_KIND_ !> the interpolation methods are not perfect.Will not get perfectly agreeing answers real(r8_kind), parameter :: tol=0.1_lkind integer :: calendar_type @@ -57,21 +57,21 @@ program test_interpolator2 integer :: ntime !< number of time slices integer :: npfull !< number of p levels integer :: nphalf !< number of half p levels - real(TEST_INTP_KIND_), allocatable :: lat(:) !< climatology coordinates - real(TEST_INTP_KIND_), allocatable :: lon(:) !< climatology coordinates - real(TEST_INTP_KIND_), allocatable :: latb(:) !< climatology coordinates - real(TEST_INTP_KIND_), allocatable :: lonb(:) !< climatology coordinates + real(TEST_FMS_KIND_), allocatable :: lat(:) !< climatology coordinates + real(TEST_FMS_KIND_), allocatable :: lon(:) !< climatology coordinates + real(TEST_FMS_KIND_), allocatable :: latb(:) !< climatology coordinates + real(TEST_FMS_KIND_), allocatable :: lonb(:) !< climatology coordinates real(r8_kind), allocatable :: clim_time (:) !< climatology time - real(TEST_INTP_KIND_), allocatable :: pfull(:) !< climatology p level - real(TEST_INTP_KIND_), allocatable :: phalf(:) !< climatology p half level - real(TEST_INTP_KIND_), allocatable :: ozone(:,:,:,:) !< climatology ozone data + real(TEST_FMS_KIND_), allocatable :: pfull(:) !< climatology p level + real(TEST_FMS_KIND_), allocatable :: phalf(:) !< climatology p half level + real(TEST_FMS_KIND_), allocatable :: ozone(:,:,:,:) !< climatology ozone data !> model related variables and arrays integer :: nlonlat_mod, nlonlatb_mod !< number of latitude and longitude coordinates in the model - real(TEST_INTP_KIND_), allocatable :: lat_mod(:,:) !< model coordinates - real(TEST_INTP_KIND_), allocatable :: lon_mod(:,:) !< model coordinates - real(TEST_INTP_KIND_), allocatable :: latb_mod(:,:) !< model coordinates - real(TEST_INTP_KIND_), allocatable :: lonb_mod(:,:) !< model coordinates + real(TEST_FMS_KIND_), allocatable :: lat_mod(:,:) !< model coordinates + real(TEST_FMS_KIND_), allocatable :: lon_mod(:,:) !< model coordinates + real(TEST_FMS_KIND_), allocatable :: latb_mod(:,:) !< model coordinates + real(TEST_FMS_KIND_), allocatable :: lonb_mod(:,:) !< model coordinates !> array holding model times type(time_type), allocatable :: model_time_julian(:), model_time_noleap(:) @@ -155,11 +155,11 @@ subroutine test_interpolator(clim_type, model_time) type(interpolate_type), intent(inout) :: clim_type type(time_type), dimension(ntime), intent(in) :: model_time type(time_type) :: test_time - real(TEST_INTP_KIND_), dimension(nlonlat_mod,nlonlat_mod,npfull,1) :: interp_data ! convert from degrees to radians - lon_mod = lon_mod*real(PI,TEST_INTP_KIND_)/180.0_lkind - lat_mod = lat_mod*real(PI,TEST_INTP_KIND_)/180.0_lkind - lonb_mod = lonb_mod*real(PI,TEST_INTP_KIND_)/180.0_lkind - latb_mod = latb_mod*real(PI,TEST_INTP_KIND_)/180.0_lkind + lon_mod = lon_mod*real(PI,TEST_FMS_KIND_)/180.0_lkind + lat_mod = lat_mod*real(PI,TEST_FMS_KIND_)/180.0_lkind + lonb_mod = lonb_mod*real(PI,TEST_FMS_KIND_)/180.0_lkind + latb_mod = latb_mod*real(PI,TEST_FMS_KIND_)/180.0_lkind end subroutine set_latlon_b_mod @@ -339,7 +339,7 @@ subroutine set_pfullhalf() allocate(pfull(npfull), phalf(nphalf)) do i=1, npfull - pfull(i) = 0.0001_lkind * real(i-1,TEST_INTP_KIND_) + pfull(i) = 0.0001_lkind * real(i-1,TEST_FMS_KIND_) end do phalf(1)=0.0_lkind @@ -364,7 +364,7 @@ subroutine set_ozone() do j=1, npfull do k=1, nlonlat do l=1, nlonlat - ozone(l,k,j,i)= real(i,TEST_INTP_KIND_) + ozone(l,k,j,i)= real(i,TEST_FMS_KIND_) end do end do end do diff --git a/test_fms/monin_obukhov/Makefile.am b/test_fms/monin_obukhov/Makefile.am index af2127cfdf..84e74e2a8d 100644 --- a/test_fms/monin_obukhov/Makefile.am +++ b/test_fms/monin_obukhov/Makefile.am @@ -35,8 +35,8 @@ check_PROGRAMS = test_monin_obukhov_r4 test_monin_obukhov_r8 test_monin_obukhov_r4_SOURCES = test_monin_obukhov.F90 test_monin_obukhov_r8_SOURCES = test_monin_obukhov.F90 -test_monin_obukhov_r4_CPPFLAGS = $(AM_CPPFLAGS) -DMO_TEST_KIND_=4 -test_monin_obukhov_r8_CPPFLAGS = $(AM_CPPFLAGS) -DMO_TEST_KIND_=8 +test_monin_obukhov_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=4 +test_monin_obukhov_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=8 TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ diff --git a/test_fms/monin_obukhov/test_monin_obukhov.F90 b/test_fms/monin_obukhov/test_monin_obukhov.F90 index 27b386a250..b133b51d62 100644 --- a/test_fms/monin_obukhov/test_monin_obukhov.F90 +++ b/test_fms/monin_obukhov/test_monin_obukhov.F90 @@ -39,13 +39,8 @@ program test_monin_obukhov implicit none -#if MO_TEST_KIND_ == 4 - integer, parameter :: kr = r4_kind - integer, parameter :: ki = i4_kind -#else - integer, parameter :: kr = r8_kind - integer, parameter :: ki = i8_kind -#endif + integer, parameter :: kr = TEST_FMS_KIND_ + integer, parameter :: ki = TEST_FMS_KIND_ integer(ki), parameter :: mi = 0_ki !< Mold for transfer() intrinsic @@ -180,7 +175,7 @@ subroutine write_answers character(:), allocatable :: filename integer :: fh - filename = "OUT.r" // string(MO_TEST_KIND_) // ".nml" + filename = "OUT.r" // string(TEST_FMS_KIND_) // ".nml" print "(A)", "Writing newly generated answer key to " // filename n_answers = n_answers + 1 diff --git a/test_fms/mosaic2/Makefile.am b/test_fms/mosaic2/Makefile.am index 7f2d6143ab..a7c3115804 100644 --- a/test_fms/mosaic2/Makefile.am +++ b/test_fms/mosaic2/Makefile.am @@ -23,7 +23,7 @@ # uramirez, Ed Hartnett # Find the needed mod and include files. -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(MODDIR) -I./INPUT -I$(top_srcdir)/mosaic -I./ +AM_CPPFLAGS = -I$(abs_top_srcdir)/test_fms/mosaic2 -I$(top_srcdir)/include -I$(MODDIR) # Link to the FMS library. LDADD = $(top_builddir)/libFMS/libFMS.la @@ -32,17 +32,26 @@ LDADD = $(top_builddir)/libFMS/libFMS.la check_PROGRAMS = test_mosaic2_r4 test_mosaic2_r8 test_grid2_r4 test_grid2_r8 # This is the source code for the test -test_mosaic2_r4_SOURCES = test_mosaic2.F90 write_files.inc -test_grid2_r4_SOURCES = test_grid2.F90 write_files.inc +test_mosaic2_r4_SOURCES = write_files.F90 write_files.inc test_mosaic2.F90 +test_grid2_r4_SOURCES = write_files.F90 write_files.inc test_mosaic2.F90 -test_mosaic2_r8_SOURCES = test_mosaic2.F90 write_files.inc -test_grid2_r8_SOURCES = test_grid2.F90 write_files.inc +test_mosaic2_r8_SOURCES = test_mosaic2.F90 write_files.inc write_files.F90 +test_grid2_r8_SOURCES = test_grid2.F90 write_files.inc write_files.F90 -test_mosaic2_r4_CPPFLAGS=-DTEST_MOS_KIND_=4 $(AM_CPPFLAGS) -test_grid2_r4_CPPFLAGS =-DTEST_MOS_KIND_=4 $(AM_CPPFLAGS) +test_mosaic2_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -DWRITE_FILES_MOD_=write_files_r4 $(AM_CPPFLAGS) +test_grid2_r4_CPPFLAGS =-DTEST_FMS_KIND_=4 -DWRITE_FILES_MOD_=write_files_r4 $(AM_CPPFLAGS) -test_mosaic2_r8_CPPFLAGS=-DTEST_MOS_KIND_=8 $(AM_CPPFLAGS) -test_grid2_r8_CPPFLAGS =-DTEST_MOS_KIND_=8 $(AM_CPPFLAGS) +test_mosaic2_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -DWRITE_FILES_MOD_=write_files_r8 $(AM_CPPFLAGS) +test_grid2_r8_CPPFLAGS =-DTEST_FMS_KIND_=8 -DWRITE_FILES_MOD_=write_files_r8 $(AM_CPPFLAGS) + +# compile helper module as well +%.o: %.mod +write_files_r8.mod: write_files.$(OBJEXT) +write_files_r4.mod: write_files.$(OBJEXT) +test_mosaic2_r4.$(OBJEXT): write_files_r4.mod +test_mosaic2_r8.$(OBJEXT): write_files_r8.mod +test_grid2_r4.$(OBJEXT): write_files_r4.mod +test_grid2_r8.$(OBJEXT): write_files_r8.mod # These files are also included in the distribution. EXTRA_DIST = test_mosaic2.sh @@ -51,7 +60,7 @@ EXTRA_DIST = test_mosaic2.sh TESTS = test_mosaic2.sh if SKIP_MOSAIC_TESTS - TESTS_ENVIRONMENT = SKIP_TESTS="test_mosaic2.1 test_mosaic2.2 test_mosaic2.3 test_mosaic2.4" + TESTS_ENVIRONMENT = parser_skip=${skipflag} endif TEST_EXTENSIONS = .sh diff --git a/test_fms/mosaic2/test_grid2.F90 b/test_fms/mosaic2/test_grid2.F90 index b9d9b2f560..271f931aba 100644 --- a/test_fms/mosaic2/test_grid2.F90 +++ b/test_fms/mosaic2/test_grid2.F90 @@ -20,9 +20,6 @@ !! get_mosaic_grid_sizes, get_mosaic_contact. All subroutines here are tested !! with C1 tiles where tiles 1-6 are identical. The tile points are made up with !! values that result in simple answers. See write_files module for grid details. - -#include "write_files.inc" !> including write_files.mod because I don't know how to compile when write_files.mod is - !! in a separate file. program test_mosaic use mpp_mod, only : mpp_init, mpp_error, FATAL, mpp_npes, mpp_pe, mpp_root_pe @@ -32,7 +29,7 @@ program test_mosaic use fms_mod, only : fms_init, fms_end use platform_mod, only : r4_kind, r8_kind use grid2_mod -use write_files +use WRITE_FILES_MOD_ implicit none @@ -71,10 +68,10 @@ subroutine test_get_cell_vertices implicit none - real(TEST_MOS_KIND_) :: lonb_2d(c1_nx,c1_ny) !< returned values for lon 2d - real(TEST_MOS_KIND_) :: latb_2d(c1_nx,c1_ny) !< returned values for lat 2d - real(TEST_MOS_KIND_) :: answer_lon_2d(c1_nx,c1_ny) !< answers for lon 2d - real(TEST_MOS_KIND_) :: answer_lat_2d(c1_nx,c1_ny) !< answers for lat 2d + real(TEST_FMS_KIND_) :: lonb_2d(c1_nx,c1_ny) !< returned values for lon 2d + real(TEST_FMS_KIND_) :: latb_2d(c1_nx,c1_ny) !< returned values for lat 2d + real(TEST_FMS_KIND_) :: answer_lon_2d(c1_nx,c1_ny) !< answers for lon 2d + real(TEST_FMS_KIND_) :: answer_lat_2d(c1_nx,c1_ny) !< answers for lat 2d integer :: i,j @@ -103,10 +100,10 @@ subroutine test_get_cell_centers integer, parameter :: nx = c1_nx/2 !< number of center points integer, parameter :: ny = c1_ny/2 !< number of center points - real(TEST_MOS_KIND_) :: glon_2d(nx,ny) !< results from grid_cell_centers - real(TEST_MOS_KIND_) :: glat_2d(nx,ny) !< results from grid_cell_centers - real(TEST_MOS_KIND_) :: answer_glon_2d(nx,ny) !< answers for glon - real(TEST_MOS_KIND_) :: answer_glat_2d(nx,ny) !< answers for glat + real(TEST_FMS_KIND_) :: glon_2d(nx,ny) !< results from grid_cell_centers + real(TEST_FMS_KIND_) :: glat_2d(nx,ny) !< results from grid_cell_centers + real(TEST_FMS_KIND_) :: answer_glon_2d(nx,ny) !< answers for glon + real(TEST_FMS_KIND_) :: answer_glat_2d(nx,ny) !< answers for glat integer :: i, j @@ -133,8 +130,8 @@ subroutine test_get_grid_cell_area_sg implicit none type(domain2D) :: SG_domain - real(TEST_MOS_KIND_) :: area_out2(1,1) - real(TEST_MOS_KIND_) :: answer + real(TEST_FMS_KIND_) :: area_out2(1,1) + real(TEST_FMS_KIND_) :: answer answer = real(2.0_r8_kind*PI*RADIUS*RADIUS,lkind) @@ -161,8 +158,8 @@ subroutine test_get_grid_cell_area_ug implicit none type(domain2D) :: SG_domain type(domainUG) :: UG_domain !< UG_domain is the same as SG_domain - real(TEST_MOS_KIND_) :: area_out1(1) - real(TEST_MOS_KIND_) :: answer + real(TEST_FMS_KIND_) :: area_out1(1) + real(TEST_FMS_KIND_) :: answer integer :: i integer :: npts_tile(1),grid_nlevel(1), ndivs, grid_index(1) @@ -171,7 +168,7 @@ subroutine test_get_grid_cell_area_ug ndivs=1 grid_index=1 - answer = real( 4.0_r8_kind * area(1,1), TEST_MOS_KIND_) + answer = real( 4.0_r8_kind * area(1,1), TEST_FMS_KIND_) !> The unstructured grid is the same as the structured grid; there's only one center point in the tile. call mpp_define_domains((/1,1,1,1/), (/1,1/), SG_domain) @@ -193,10 +190,10 @@ subroutine test_get_grid_comp_area_sg implicit none type(domain2D) :: SG_domain - real(TEST_MOS_KIND_) :: area_out2(1,1) - real(TEST_MOS_KIND_) :: answer + real(TEST_FMS_KIND_) :: area_out2(1,1) + real(TEST_FMS_KIND_) :: answer - answer = real( 4.0_r8_kind * area(1,1), TEST_MOS_KIND_) + answer = real( 4.0_r8_kind * area(1,1), TEST_FMS_KIND_) call mpp_define_domains((/1,1,1,1/), (/1,1/), SG_domain) @@ -222,13 +219,13 @@ subroutine test_get_grid_comp_area_ug type(domain2D) :: SG_domain type(domainUG) :: UG_domain !< UG_domain is the same as SG_domain integer :: npts_tile(1), ntiles_grid(1), grid_index(1) - real(TEST_MOS_KIND_) :: answer - real(TEST_MOS_KIND_) :: area_out1(1) + real(TEST_FMS_KIND_) :: answer + real(TEST_FMS_KIND_) :: area_out1(1) npts_tile=1 ntiles_grid=1 grid_index(1)=1 - answer = real( 4.0_r8_kind * area(1,1), TEST_MOS_KIND_) + answer = real( 4.0_r8_kind * area(1,1), TEST_FMS_KIND_) !> the unstructured grid is the same as the structured grid call mpp_define_domains((/1,1,1,1/), (/1,1/), SG_domain) @@ -244,8 +241,8 @@ end subroutine test_get_grid_comp_area_ug subroutine check_answer(answer, myvalue, whoami) implicit none - real(TEST_MOS_KIND_) :: answer - real(TEST_MOS_KIND_) :: myvalue + real(TEST_FMS_KIND_) :: answer + real(TEST_FMS_KIND_) :: myvalue character(*) :: whoami if( answer .ne. myvalue ) then diff --git a/test_fms/mosaic2/test_mosaic2.F90 b/test_fms/mosaic2/test_mosaic2.F90 index 95cf1abe78..18f94e69df 100644 --- a/test_fms/mosaic2/test_mosaic2.F90 +++ b/test_fms/mosaic2/test_mosaic2.F90 @@ -20,14 +20,11 @@ !> @brief This programs tests calls to get_mosaic_ntiles, get_mosaic_ncontacts, !! get_mosaic_grid_sizes, get_mosaic_contact. The subroutines are tested with !! made up C1 grids and exchange grids. See write_files mod for grid details. - -#include "write_files.inc" !> including write_files.mod because I don't know how to compile when write_files.mod is - !! in a separate file. program test_mosaic use mosaic2_mod use grid2_mod -use write_files +use WRITE_FILES_MOD_ use mpp_mod, only : mpp_init, mpp_error, FATAL, mpp_pe, mpp_root_pe use fms2_io_mod, only : open_file, close_file, FmsNetcdfFile_t, fms2_io_init, read_data use fms_mod, only : fms_init, fms_end @@ -168,14 +165,14 @@ subroutine test_calc_mosaic_grid_area implicit none - real(TEST_MOS_KIND_) :: x_rad(c1_nx, c1_ny), y_rad(c1_nx, c1_ny) !< x and y in radians - real(TEST_MOS_KIND_) :: area_out(1,1) !< area to be computed + real(TEST_FMS_KIND_) :: x_rad(c1_nx, c1_ny), y_rad(c1_nx, c1_ny) !< x and y in radians + real(TEST_FMS_KIND_) :: area_out(1,1) !< area to be computed !> x_rad and y_rad can be set to be be the entire cell !! x_rad = x(1:3:2, 1:3:2) and y_rad = y(1:3:2, 1:3:2) !! The answer will then be 4.0*area(1,1) - x_rad = real( real(x(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_MOS_KIND_) !< set coordinates - y_rad = real( real(y(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_MOS_KIND_) !< set coordinates + x_rad = real( real(x(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_FMS_KIND_) !< set coordinates + y_rad = real( real(y(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_FMS_KIND_) !< set coordinates call calc_mosaic_grid_area(x_rad, y_rad, area_out) call check_answer(area(1,1), area_out(1,1), 'TEST_CALC_MOSAIC_GRID_AREA') @@ -188,14 +185,14 @@ subroutine test_get_grid_great_circle_area implicit none - real(TEST_MOS_KIND_) :: x_rad(c1_nx, c1_ny), y_rad(c1_nx, c1_ny) !< x and y in radians - real(TEST_MOS_KIND_) :: area_out(1,1) !< area to be computed + real(TEST_FMS_KIND_) :: x_rad(c1_nx, c1_ny), y_rad(c1_nx, c1_ny) !< x and y in radians + real(TEST_FMS_KIND_) :: area_out(1,1) !< area to be computed !> x_rad and y_rad can be set to be be the entire cell !! x_rad = x(1:3:2, 1:3:2) and y_rad = y(1:3:2, 1:3:2) !! The answer will then be 4.0*area(1,1) - x_rad = real( real(x(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_MOS_KIND_) !< set coordinates - y_rad = real( real(y(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_MOS_KIND_) !< set coordinates + x_rad = real( real(x(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_FMS_KIND_) !< set coordinates + y_rad = real( real(y(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_FMS_KIND_) !< set coordinates call calc_mosaic_grid_great_circle_area(x_rad, y_rad, area_out) call check_answer(area(1,1), area_out(1,1), 'TEST_GET_GRID_GREAT_CIRCLE_AREA') @@ -208,7 +205,7 @@ subroutine test_get_mosaic_xgrid implicit none integer, dimension(ncells) :: i1, j1, i2, j2 !< indices of parent cells - real(TEST_MOS_KIND_), dimension(ncells) :: area !< area to be returned + real(TEST_FMS_KIND_), dimension(ncells) :: area !< area to be returned real(r8_kind) :: garea, get_global_area !< global area integer :: i !< counter @@ -243,11 +240,11 @@ subroutine test_is_inside_polygon integer, parameter :: n=5 integer :: i - real(TEST_MOS_KIND_) :: lat1, lon1, x1, y1, z1, r - real(TEST_MOS_KIND_), dimension(n) :: lon2, lat2, x2, y2, z2 + real(TEST_FMS_KIND_) :: lat1, lon1, x1, y1, z1, r + real(TEST_FMS_KIND_), dimension(n) :: lon2, lat2, x2, y2, z2 logical :: answer, is_inside - integer, parameter :: lkind=TEST_MOS_KIND_ !< local kind + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind !> polygon x2=0.0_lkind diff --git a/test_fms/mosaic2/test_mosaic2.sh b/test_fms/mosaic2/test_mosaic2.sh index 93d0b357c7..74f03e7630 100755 --- a/test_fms/mosaic2/test_mosaic2.sh +++ b/test_fms/mosaic2/test_mosaic2.sh @@ -32,6 +32,10 @@ touch input.nml rm -rf INPUT mkdir INPUT +if [ ! $parser_skip ]; then + SKIP_TESTS='test_mosaic2.[1-4]' +fi + # The tests are skipped if FMS is compiled in r4 via ./configure --enable-mixedmode # because answers differ when FMS is compiled in r4. test_expect_success "test mosaic2 r4" 'mpirun -n 1 ./test_mosaic2_r4' diff --git a/test_fms/mosaic2/write_files.F90 b/test_fms/mosaic2/write_files.F90 new file mode 100644 index 0000000000..d06c2c1606 --- /dev/null +++ b/test_fms/mosaic2/write_files.F90 @@ -0,0 +1,14 @@ +module write_files_r4 + +#define TEST_FMS_KIND_ r4_kind +#include "write_files.inc" + +end module + + +module write_files_r8 + +#define TEST_FMS_KIND_ r8_kind +#include "write_files.inc" + +end module diff --git a/test_fms/mosaic2/write_files.inc b/test_fms/mosaic2/write_files.inc index 537f26ea30..6c93087fee 100644 --- a/test_fms/mosaic2/write_files.inc +++ b/test_fms/mosaic2/write_files.inc @@ -16,8 +16,8 @@ !* You should have received a copy of the GNU Lesser General Public !* License along with FMS. If not, see . !*********************************************************************** -module write_files - +!! Helper routines for generating input files for test_mosaic2/grid2 +!! This portion of code is included in two modules, one for each real precision use fms2_io_mod, only: fms2_io_init, open_file, close_file, FmsNetcdfFile_t use fms2_io_mod, only: register_axis, register_field, write_data use mpp_mod, only: mpp_init, mpp_sync, mpp_npes, mpp_get_current_pelist @@ -58,15 +58,15 @@ module write_files ! variables for tile1 character(5) :: tile - real(TEST_MOS_KIND_), dimension(c1_nxp,c1_nyp) :: x - real(TEST_MOS_KIND_), dimension(c1_nxp,c1_nyp) :: y - real(TEST_MOS_KIND_), dimension(c1_nx,c1_ny) :: area + real(TEST_FMS_KIND_), dimension(c1_nxp,c1_nyp) :: x + real(TEST_FMS_KIND_), dimension(c1_nxp,c1_nyp) :: y + real(TEST_FMS_KIND_), dimension(c1_nx,c1_ny) :: area !variables for exchange grid cells - real(TEST_MOS_KIND_), dimension(2,ncells) :: tile1_cell, tile2_cell - real(TEST_MOS_KIND_), dimension(ncells) :: xgrid_area + real(TEST_FMS_KIND_), dimension(2,ncells) :: tile1_cell, tile2_cell + real(TEST_FMS_KIND_), dimension(ncells) :: xgrid_area - integer, parameter :: lkind=TEST_MOS_KIND_ !< local kind parameter + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind parameter contains !---------------------------------! @@ -181,7 +181,7 @@ contains implicit none character(5) :: tile - real(TEST_MOS_KIND_), parameter :: area_value = real(PI*RADIUS*RADIUS/2.0_r8_kind, TEST_MOS_KIND_) + real(TEST_FMS_KIND_), parameter :: area_value = real(PI*RADIUS*RADIUS/2.0_r8_kind, TEST_FMS_KIND_) real(r8_kind) :: xtmp(c1_nxp, c1_nyp), ytmp(c1_nxp, c1_nyp) xtmp(1,1)=0.0_r8_kind ; xtmp(2,1)=90.0_r8_kind ; xtmp(3,1)=180.0_r8_kind @@ -214,8 +214,8 @@ contains character(*) :: filename character(*) :: tile - real(TEST_MOS_KIND_), dimension(c1_nxp,c1_nyp), intent(in) :: x_in, y_in - real(TEST_MOS_KIND_), dimension(c1_nx,c1_ny), intent(in) :: area_in + real(TEST_FMS_KIND_), dimension(c1_nxp,c1_nyp), intent(in) :: x_in, y_in + real(TEST_FMS_KIND_), dimension(c1_nx,c1_ny), intent(in) :: area_in type(FmsNetcdfFile_t) :: fileobj integer, allocatable :: pes(:) @@ -311,7 +311,7 @@ contains end do do i=1, ncells - xgrid_area(i) = real(get_global_area(), TEST_MOS_KIND_) + xgrid_area(i) = real(get_global_area(), TEST_FMS_KIND_) end do allocate(pes(mpp_npes())) @@ -365,5 +365,3 @@ contains call write_exchange() end subroutine write_all - !---------------------------------! -end module write_files diff --git a/test_fms/mpp/Makefile.am b/test_fms/mpp/Makefile.am index c131f99545..89717a6450 100644 --- a/test_fms/mpp/Makefile.am +++ b/test_fms/mpp/Makefile.am @@ -37,7 +37,7 @@ check_PROGRAMS = test_mpp \ test_mpp_print_memuse_stats_file \ test_mpp_memutils_begin_2x \ test_mpp_memutils_end_before_begin \ - test_read_ascii_file \ + test_mpp_read_ascii_file \ test_read_input_nml \ test_stdout \ test_stderr \ @@ -87,7 +87,7 @@ test_mpp_print_memuse_stats_stderr_SOURCES = test_mpp_print_memuse_stats_stderr. test_mpp_print_memuse_stats_file_SOURCES = test_mpp_print_memuse_stats_file.F90 test_mpp_memutils_begin_2x_SOURCES = test_mpp_memutils_begin_2x.F90 test_mpp_memutils_end_before_begin_SOURCES = test_mpp_memutils_end_before_begin.F90 -test_read_ascii_file_SOURCES = test_read_ascii_file.F90 +test_mpp_read_ascii_file_SOURCES = test_mpp_read_ascii_file.F90 test_read_input_nml_SOURCES = test_read_input_nml.F90 test_stdout_SOURCES = test_stdout.F90 test_stderr_SOURCES = test_stderr.F90 @@ -106,7 +106,7 @@ test_mpp_update_domains_SOURCES = \ compare_data_checksums_int.F90 \ test_mpp_update_domains_real.F90 \ test_mpp_update_domains_int.F90 \ - test_mpp_update_domains_main.F90 + test_mpp_update_domains.F90 test_mpp_gatscat_SOURCES = test_mpp_gatscat.F90 test_mpp_sendrecv_SOURCES = test_mpp_sendrecv.F90 test_mpp_sum_SOURCES = test_mpp_sum.F90 @@ -150,7 +150,7 @@ TESTS = test_mpp_domains2.sh \ test_mpp_memuse.sh \ test_mpp_mem_dump.sh \ test_mpp_memutils_mod.sh \ - test_read_ascii_file.sh \ + test_mpp_read_ascii_file.sh \ test_read_input_nml2.sh \ test_stdout.sh \ test_stderr.sh \ @@ -193,7 +193,7 @@ EXTRA_DIST = test_mpp_domains2.sh \ test_mpp_memuse.sh \ test_mpp_mem_dump.sh \ test_mpp_memutils_mod.sh \ - test_read_ascii_file.sh \ + test_mpp_read_ascii_file.sh \ test_read_input_nml2.sh \ test_stdout.sh \ test_stderr.sh \ @@ -237,7 +237,7 @@ test_domains_utility_mod.mod: test_domains_utility_mod.$(OBJEXT) test_mpp_update_domains_real.$(OBJEXT): compare_data_checksums.mod fill_halo.mod test_mpp_update_domains test_mpp_update_domains_int.$(OBJEXT): compare_data_checksums_int.mod fill_halo.mod -test_mpp_update_domains_main.$(OBJEXT): test_mpp_update_domains_real.mod test_mpp_update_domains_int.mod +test_mpp_update_domains.$(OBJEXT): test_mpp_update_domains_real.mod test_mpp_update_domains_int.mod test_update_domains_performance.$(OBJEXT): compare_data_checksums_int.mod compare_data_checksums.mod test_mpp_global_field.$(OBJEXT): compare_data_checksums_int.mod compare_data_checksums.mod test_mpp_global_field_ug.$(OBJEXT): compare_data_checksums_int.mod compare_data_checksums.mod diff --git a/test_fms/mpp/test_mpp_init_logfile.sh b/test_fms/mpp/test_mpp_init_logfile.sh index 1ae48b6bfd..2258432cb8 100755 --- a/test_fms/mpp/test_mpp_init_logfile.sh +++ b/test_fms/mpp/test_mpp_init_logfile.sh @@ -1,5 +1,3 @@ -!/bin/sh - #*********************************************************************** # GNU Lesser General Public License # diff --git a/test_fms/mpp/test_read_ascii_file.F90 b/test_fms/mpp/test_mpp_read_ascii_file.F90 similarity index 98% rename from test_fms/mpp/test_read_ascii_file.F90 rename to test_fms/mpp/test_mpp_read_ascii_file.F90 index 48d6e2716b..720b76b1f9 100644 --- a/test_fms/mpp/test_read_ascii_file.F90 +++ b/test_fms/mpp/test_mpp_read_ascii_file.F90 @@ -22,7 +22,7 @@ !! @author Colin Gladue !! @email gfdl.climate.model.info@noaa.gov -program test_read_ascii_file +program test_mpp_read_ascii_file use mpp_mod, only : mpp_init, mpp_init_test_peset_allocated use mpp_mod, only : mpp_error, FATAL, NOTE @@ -111,4 +111,4 @@ program test_read_ascii_file end if end if call MPI_FINALIZE(ierr) -end program test_read_ascii_file +end program test_mpp_read_ascii_file diff --git a/test_fms/mpp/test_read_ascii_file.sh b/test_fms/mpp/test_mpp_read_ascii_file.sh similarity index 90% rename from test_fms/mpp/test_read_ascii_file.sh rename to test_fms/mpp/test_mpp_read_ascii_file.sh index ef06f9c8ea..afdf868888 100755 --- a/test_fms/mpp/test_read_ascii_file.sh +++ b/test_fms/mpp/test_mpp_read_ascii_file.sh @@ -47,21 +47,21 @@ echo "/" >> test_numb_base_ascii.nml # Normal Usage sed "s/test_numb = [0-9]/test_numb = 1/" test_numb_base_ascii.nml>test_numb_ascii.nml test_expect_success "normal ascii usage" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 2 # get_ascii_file_num_lines not called before, fatal error sed "s/test_numb = [0-9]/test_numb = 2/" test_numb_base_ascii.nml>test_numb_ascii.nml test_expect_failure "failure caught if get_ascii_file_num_lines not called before" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 3 # File does not exist, fatal error sed "s/test_numb = [0-9]/test_numb = 3/" test_numb_base_ascii.nml>test_numb_ascii.nml test_expect_failure "failure caught if file does not exist" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 4 @@ -69,27 +69,27 @@ test_expect_failure "failure caught if file does not exist" ' sed "s/test_numb = [0-9]/test_numb = 4/" test_numb_base_ascii.nml>test_numb_ascii.nml echo "" > empty.nml test_expect_failure "failure caught from too few input lines" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 5 # Length of output string is too small, fatal error sed "s/test_numb = [0-9]/test_numb = 5/" test_numb_base_ascii.nml>test_numb_ascii.nml test_expect_failure "failure caught from too small output string" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 6 # Number of lines in file does not equal to size(Content(:)), fatal error sed "s/test_numb = [0-9]/test_numb = 6/" test_numb_base_ascii.nml>test_numb_ascii.nml test_expect_failure "failure caught from mismatching numbers of lines" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 7 # Normal usage, with optional PELIST argument passed in sed "s/test_numb = [0-9]/test_numb = 7/" test_numb_base_ascii.nml>test_numb_ascii.nml test_expect_success "normal ascii usage with PELIST" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 8 @@ -97,7 +97,7 @@ test_expect_success "normal ascii usage with PELIST" ' sed "s/test_numb = [0-9]/test_numb = 8/" test_numb_base_ascii.nml>test_numb_ascii.nml touch empty.nml test_expect_success "normal ascii usage with empty file" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' test_done diff --git a/test_fms/mpp/test_mpp_update_domains_main.F90 b/test_fms/mpp/test_mpp_update_domains.F90 similarity index 98% rename from test_fms/mpp/test_mpp_update_domains_main.F90 rename to test_fms/mpp/test_mpp_update_domains.F90 index b47bdff5a9..03a64d2687 100644 --- a/test_fms/mpp/test_mpp_update_domains_main.F90 +++ b/test_fms/mpp/test_mpp_update_domains.F90 @@ -20,7 +20,7 @@ !> @brief run mpp_domains tests on arrays of integers and real numbers !! using different layouts and data precision !> @note This test calls extensions of the routine test_halo_upate in test_mpp_domains. -program test_mpp_update_domains_main +program test_mpp_update_domains use test_mpp_update_domains_real, only : test_halo_update_r8, test_halo_update_r4 use test_mpp_update_domains_real, only : test_subset_update_r8, test_subset_update_r4 @@ -94,4 +94,4 @@ program test_mpp_update_domains_main call mpp_domains_exit() !> Finalize mpp call MPI_FINALIZE(ierr) -end program test_mpp_update_domains_main +end program test_mpp_update_domains diff --git a/test_fms/parser/Makefile.am b/test_fms/parser/Makefile.am index 569f64e901..0c6eb992b3 100644 --- a/test_fms/parser/Makefile.am +++ b/test_fms/parser/Makefile.am @@ -52,11 +52,10 @@ SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ $(abs_top_srcdir)/test_fms/tap-driver.sh if USING_YAML -skipflag="" + TESTS_ENVIRONMENT = parser_skip="" else -skipflag="skip" + TESTS_ENVIRONMENT = parser_skip=skip endif -TESTS_ENVIRONMENT = parser_skip=${skipflag} # Clean up CLEANFILES = input.nml *.nc* *.out *.yaml *.dpi *.spi *.dyn *.spl diff --git a/test_fms/random_numbers/Makefile.am b/test_fms/random_numbers/Makefile.am index e365ed80bf..6a0e0414c2 100644 --- a/test_fms/random_numbers/Makefile.am +++ b/test_fms/random_numbers/Makefile.am @@ -35,8 +35,8 @@ check_PROGRAMS = \ test_random_numbers_r4_SOURCES = test_random_numbers.F90 test_random_numbers_r8_SOURCES = test_random_numbers.F90 -test_random_numbers_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_RN_KIND_=r4_kind -test_random_numbers_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_RN_KIND_=r8_kind +test_random_numbers_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r4_kind +test_random_numbers_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r8_kind TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ diff --git a/test_fms/random_numbers/test_random_numbers.F90 b/test_fms/random_numbers/test_random_numbers.F90 index a4243f21fc..855e80586d 100644 --- a/test_fms/random_numbers/test_random_numbers.F90 +++ b/test_fms/random_numbers/test_random_numbers.F90 @@ -32,7 +32,7 @@ program test_random_numbers integer, parameter :: n0_2d = 50 !> Initial dimensions of 2D random sample array integer, parameter :: seeds(*) = [0, -5, 3] !> Seed constants -integer, parameter :: k = TEST_RN_KIND_ !> Either r4_kind or r8_kind +integer, parameter :: k = TEST_FMS_KIND_ !> Either r4_kind or r8_kind real(k), dimension(n_moments) :: moment_mu !> Expected moment values real(k), dimension(n_moments) :: moment_sigma !> Standard deviations of sample moments diff --git a/test_fms/sat_vapor_pres/Makefile.am b/test_fms/sat_vapor_pres/Makefile.am index a00109247b..629301888f 100644 --- a/test_fms/sat_vapor_pres/Makefile.am +++ b/test_fms/sat_vapor_pres/Makefile.am @@ -34,8 +34,8 @@ check_PROGRAMS = test_sat_vapor_pres_r4 test_sat_vapor_pres_r8 test_sat_vapor_pres_r4_SOURCES = test_sat_vapor_pres.F90 test_sat_vapor_pres_r8_SOURCES = test_sat_vapor_pres.F90 -test_sat_vapor_pres_r4_CPPFLAGS=-DTEST_SVP_KIND_=4 -I$(MODDIR) -test_sat_vapor_pres_r8_CPPFLAGS=-DTEST_SVP_KIND_=8 -I$(MODDIR) +test_sat_vapor_pres_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_sat_vapor_pres_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(abs_top_srcdir)/test_fms/tap-driver.sh diff --git a/test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 b/test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 index 853de63d9d..d6bdb5727b 100644 --- a/test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 +++ b/test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 @@ -102,14 +102,14 @@ subroutine test_compute_qs() implicit none - real(kind=TEST_SVP_KIND_) :: temp, press, answer, qsat - real(kind=TEST_SVP_KIND_), dimension(1) :: temp_1d, press_1d, answer_1d, qsat_1d - real(kind=TEST_SVP_KIND_), dimension(1,1) :: temp_2d, press_2d, answer_2d, qsat_2d - real(kind=TEST_SVP_KIND_), dimension(1,1,1) :: temp_3d, press_3d, answer_3d, qsat_3d + real(kind=TEST_FMS_KIND_) :: temp, press, answer, qsat + real(kind=TEST_FMS_KIND_), dimension(1) :: temp_1d, press_1d, answer_1d, qsat_1d + real(kind=TEST_FMS_KIND_), dimension(1,1) :: temp_2d, press_2d, answer_2d, qsat_2d + real(kind=TEST_FMS_KIND_), dimension(1,1,1) :: temp_3d, press_3d, answer_3d, qsat_3d real(kind=r8_kind), parameter :: EPSILO=real(RDGAS,r8_kind)/real(RVGAS, r8_kind) - integer, parameter :: lkind=TEST_SVP_KIND_ !< local kind value; using TEST_SVP_KIND_ in cases - !! such as 1.0_TEST_SVP_KIND_ cannot be compiled with + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind value; using TEST_FMS_KIND_ in cases + !! such as 1.0_TEST_FMS_KIND_ cannot be compiled with !! with gcc compilers. !---- 0d ----! @@ -144,39 +144,39 @@ subroutine test_compute_mrs() !! The tests for this section is not comprehensive and more tests should be added. implicit none - real(kind=TEST_SVP_KIND_) :: temp, press, answer, mrsat - real(kind=TEST_SVP_KIND_), dimension(1) :: temp_1d, press_1d, answer_1d, mrsat_1d - real(kind=TEST_SVP_KIND_), dimension(1,1) :: temp_2d, press_2d, answer_2d, mrsat_2d - real(kind=TEST_SVP_KIND_), dimension(1,1,1) :: temp_3d, press_3d, answer_3d, mrsat_3d + real(kind=TEST_FMS_KIND_) :: temp, press, answer, mrsat + real(kind=TEST_FMS_KIND_), dimension(1) :: temp_1d, press_1d, answer_1d, mrsat_1d + real(kind=TEST_FMS_KIND_), dimension(1,1) :: temp_2d, press_2d, answer_2d, mrsat_2d + real(kind=TEST_FMS_KIND_), dimension(1,1,1) :: temp_3d, press_3d, answer_3d, mrsat_3d real(kind=r8_kind), parameter :: EPSILO=real(RDGAS,r8_kind)/real(RVGAS, r8_kind) - integer, parameter :: lkind=TEST_SVP_KIND_ !< local kind value; using TEST_SVP_KIND_ in cases - !! such as 1.0_TEST_SVP_KIND_ cannot be compiled with + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind value; using TEST_FMS_KIND_ in cases + !! such as 1.0_TEST_FMS_KIND_ cannot be compiled with !! with gcc compilers. !--------0d--------! !> press is 0. Therefore the answer should be eps=EPSILO=RDGAS/RVGAS temp= 270.0_lkind ; press= 0.0_lkind ; answer=real(EPSILO,lkind) call compute_mrs(temp, press, mrsat) - call check_answer_0d(answer,mrsat,'test_compute_mrs_0d precision=TEST_SVP_KIND_') + call check_answer_0d(answer,mrsat,'test_compute_mrs_0d precision=TEST_FMS_KIND_') !--------1d--------! !> press is 0. Therefore the answer should be eps=EPSILO=RDGAS/RVGAS temp_1d = 270.0_lkind ; press_1d = 0.0_lkind ; answer_1d=real(EPSILO,lkind) call compute_mrs(temp_1d, press_1d, mrsat_1d) - call check_answer_1d(answer_1d,mrsat_1d,'test_compute_mrs_1d precision=TEST_SVP_KIND_') + call check_answer_1d(answer_1d,mrsat_1d,'test_compute_mrs_1d precision=TEST_FMS_KIND_') !--------2d--------! !> press is 0. Therefore the answer should be eps=EPSILO=RDGAS/RVGAS temp_2d = 270.0_lkind ; press_2d = 0.0_lkind ; answer_2d=real(EPSILO,lkind) call compute_mrs(temp_2d, press_2d, mrsat_2d) - call check_answer_2d(answer_2d,mrsat_2d,'test_compute_mrs_2d precision=TEST_SVP_KIND_') + call check_answer_2d(answer_2d,mrsat_2d,'test_compute_mrs_2d precision=TEST_FMS_KIND_') !--------3d--------! !> press is 0. Therefore the answer should be eps=EPSILO=RDGAS/RVGAS temp_3d = 270.0_lkind ; press_3d = 0.0_lkind ; answer_3d=real(EPSILO,lkind) call compute_mrs(temp_3d, press_3d, mrsat_3d) - call check_answer_3d(answer_3d,mrsat_3d,'test_compute_mrs_3d precision=TEST_SVP_KIND_') + call check_answer_3d(answer_3d,mrsat_3d,'test_compute_mrs_3d precision=TEST_FMS_KIND_') end subroutine test_compute_mrs !----------------------------------------------------------------------- @@ -186,13 +186,13 @@ subroutine test_lookup_es_des !! TEST: at the maximum temperature (TCMAX), the pressures should correspond to the last element in the (D)TABLE implicit none - real(kind=TEST_SVP_KIND_) :: temp, esat, desat, esat_answer, desat_answer - real(kind=TEST_SVP_KIND_), dimension(1) :: temp_1d, esat_1d, desat_1d, esat_answer_1d, desat_answer_1d - real(kind=TEST_SVP_KIND_), dimension(1,1) :: temp_2d, esat_2d, desat_2d, esat_answer_2d, desat_answer_2d - real(kind=TEST_SVP_KIND_), dimension(1,1,1) :: temp_3d, esat_3d, desat_3d, esat_answer_3d, desat_answer_3d + real(kind=TEST_FMS_KIND_) :: temp, esat, desat, esat_answer, desat_answer + real(kind=TEST_FMS_KIND_), dimension(1) :: temp_1d, esat_1d, desat_1d, esat_answer_1d, desat_answer_1d + real(kind=TEST_FMS_KIND_), dimension(1,1) :: temp_2d, esat_2d, desat_2d, esat_answer_2d, desat_answer_2d + real(kind=TEST_FMS_KIND_), dimension(1,1,1) :: temp_3d, esat_3d, desat_3d, esat_answer_3d, desat_answer_3d - integer, parameter :: lkind=TEST_SVP_KIND_ !< local kind value; using TEST_SVP_KIND_ in cases - !! such as 1.0_TEST_SVP_KIND_ cannot be compiled with + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind value; using TEST_FMS_KIND_ in cases + !! such as 1.0_TEST_FMS_KIND_ cannot be compiled with !! with gcc compilers !-----0d test-------! @@ -386,13 +386,13 @@ subroutine test_lookup_es2_des2 !! TEST: at the maximum temperature (TCMAX), the pressures should correspond to the last element in the (D)TABLE2 implicit none - real(kind=TEST_SVP_KIND_) :: temp, esat, desat, esat_answer, desat_answer - real(kind=TEST_SVP_KIND_), dimension(1) :: temp_1d, esat_1d, desat_1d, esat_answer_1d, desat_answer_1d - real(kind=TEST_SVP_KIND_), dimension(1,1) :: temp_2d, esat_2d, desat_2d, esat_answer_2d, desat_answer_2d - real(kind=TEST_SVP_KIND_), dimension(1,1,1) :: temp_3d, esat_3d, desat_3d, esat_answer_3d, desat_answer_3d + real(kind=TEST_FMS_KIND_) :: temp, esat, desat, esat_answer, desat_answer + real(kind=TEST_FMS_KIND_), dimension(1) :: temp_1d, esat_1d, desat_1d, esat_answer_1d, desat_answer_1d + real(kind=TEST_FMS_KIND_), dimension(1,1) :: temp_2d, esat_2d, desat_2d, esat_answer_2d, desat_answer_2d + real(kind=TEST_FMS_KIND_), dimension(1,1,1) :: temp_3d, esat_3d, desat_3d, esat_answer_3d, desat_answer_3d - integer, parameter :: lkind=TEST_SVP_KIND_ !< local kind value; using TEST_SVP_KIND_ in cases - !! such as 1.0_TEST_SVP_KIND_ cannot be compiled with + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind value; using TEST_FMS_KIND_ in cases + !! such as 1.0_TEST_FMS_KIND_ cannot be compiled with !! with gcc compilers. !-----0d test-------! @@ -578,13 +578,13 @@ subroutine test_lookup_es3_des3 !! TEST: at the maximum temperature (TCMAX), the pressures should correspond to the last element in the (D)TABLE3 implicit none - real(kind=TEST_SVP_KIND_) :: temp, esat, desat, esat_answer, desat_answer - real(kind=TEST_SVP_KIND_), dimension(1) :: temp_1d, esat_1d, desat_1d, esat_answer_1d, desat_answer_1d - real(kind=TEST_SVP_KIND_), dimension(1,1) :: temp_2d, esat_2d, desat_2d, esat_answer_2d, desat_answer_2d - real(kind=TEST_SVP_KIND_), dimension(1,1,1) :: temp_3d, esat_3d, desat_3d, esat_answer_3d, desat_answer_3d + real(kind=TEST_FMS_KIND_) :: temp, esat, desat, esat_answer, desat_answer + real(kind=TEST_FMS_KIND_), dimension(1) :: temp_1d, esat_1d, desat_1d, esat_answer_1d, desat_answer_1d + real(kind=TEST_FMS_KIND_), dimension(1,1) :: temp_2d, esat_2d, desat_2d, esat_answer_2d, desat_answer_2d + real(kind=TEST_FMS_KIND_), dimension(1,1,1) :: temp_3d, esat_3d, desat_3d, esat_answer_3d, desat_answer_3d - integer, parameter :: lkind=TEST_SVP_KIND_ !< local kind value; using TEST_SVP_KIND_ in cases - !! such as 1.0_TEST_SVP_KIND_ cannot be compiled with + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind value; using TEST_FMS_KIND_ in cases + !! such as 1.0_TEST_FMS_KIND_ cannot be compiled with !! with gcc compilers. !-----0d test-------! @@ -764,10 +764,11 @@ end subroutine test_lookup_es3_des3 subroutine check_answer_0d(answer,fms_result,whoami) implicit none - real(TEST_SVP_KIND_), intent(in) :: answer, fms_result + real(TEST_FMS_KIND_), intent(in) :: answer, fms_result character(len=*), intent(in) :: whoami + real(TEST_FMS_KIND_), parameter :: tol = 1.0e-6 - if(answer .ne. fms_result) then + if(abs(answer - fms_result) .gt. tol) then write(*,*) 'Expected ', answer, ' but got ', fms_result call mpp_error(FATAL,'ERROR:'//trim(whoami) ) end if @@ -777,7 +778,7 @@ end subroutine check_answer_0d subroutine check_answer_1d(answer,fms_result,whoami) implicit none - real(TEST_SVP_KIND_), dimension(:), intent(in) :: answer, fms_result + real(TEST_FMS_KIND_), dimension(:), intent(in) :: answer, fms_result character(len=*), intent(in) :: whoami if(answer(1) .ne. fms_result(1)) then @@ -790,7 +791,7 @@ end subroutine check_answer_1d subroutine check_answer_2d(answer,fms_result,whoami) implicit none - real(TEST_SVP_KIND_), dimension(:,:), intent(in) :: answer, fms_result + real(TEST_FMS_KIND_), dimension(:,:), intent(in) :: answer, fms_result character(len=*), intent(in) :: whoami if(answer(1,1) .ne. fms_result(1,1)) then @@ -803,7 +804,7 @@ end subroutine check_answer_2d subroutine check_answer_3d(answer,fms_result,whoami) implicit none - real(TEST_SVP_KIND_), dimension(:,:,:), intent(in) :: answer, fms_result + real(TEST_FMS_KIND_), dimension(:,:,:), intent(in) :: answer, fms_result character(len=*), intent(in) :: whoami if(answer(1,1,1) .ne. fms_result(1,1,1)) then diff --git a/test_fms/test-lib.sh.in b/test_fms/test-lib.sh.in index 93ba65d08e..f2e46a98e3 100644 --- a/test_fms/test-lib.sh.in +++ b/test_fms/test-lib.sh.in @@ -26,8 +26,8 @@ # Thank you Junio. # Useful locations -top_srcdir='@abs_top_srcdir@' -top_buildir='@abs_top_builddir@' +top_srcdir='@abs_top_srcdir@@CMAKE_CURRENT_SOURCE_DIR@' +top_buildir='@abs_top_builddir@@CMAKE_CURRENT_SOURCE_DIR@' TEST_NAME="$(basename "$0" .sh)" TEST_NUMBER="${TEST_NAME%%-*}" @@ -146,6 +146,7 @@ test_failure_ () { test_known_broken_ok_ () { test_fixed=$(($test_fixed+1)) + test_failure=$(($test_failure + 1)) say_color error "ok $test_count - $@ # TODO known breakage vanished" } @@ -319,6 +320,15 @@ test_expect_success () { test_done () { EXIT_OK=t + cmake="@USING_CMAKE@" + if test $cmake + then + if test $test_failure != 0 + then + echo "$test_failure tests failed in $TEST_NAME. Exiting.." + exit 1 + fi + fi say "1..$test_count" } # creates and enters output dir and deletes previous if present diff --git a/test_fms/time_interp/Makefile.am b/test_fms/time_interp/Makefile.am index 92156b6841..89e5468f77 100644 --- a/test_fms/time_interp/Makefile.am +++ b/test_fms/time_interp/Makefile.am @@ -39,10 +39,10 @@ test_time_interp_external_r8_SOURCES = test_time_interp_external.F90 # filter out any added precision flags # adds r8 flag, otherwise no-flag default is 4 -test_time_interp_r4_CPPFLAGS=-DTI_TEST_KIND_=4 -I$(MODDIR) -test_time_interp_r8_CPPFLAGS=-DTI_TEST_KIND_=8 -I$(MODDIR) -test_time_interp_external_r4_CPPFLAGS=-DTI_TEST_KIND_=4 -I$(MODDIR) -test_time_interp_external_r8_CPPFLAGS=-DTI_TEST_KIND_=8 -I$(MODDIR) +test_time_interp_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_time_interp_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) +test_time_interp_external_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_time_interp_external_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) # Run the test programs. TESTS = test_time_interp2.sh diff --git a/test_fms/time_interp/test_time_interp.F90 b/test_fms/time_interp/test_time_interp.F90 index 387d0e1807..f55d44d3ac 100644 --- a/test_fms/time_interp/test_time_interp.F90 +++ b/test_fms/time_interp/test_time_interp.F90 @@ -28,16 +28,16 @@ program test_time_interp implicit none - integer, parameter :: num_Time=6, kindl = TI_TEST_KIND_ + integer, parameter :: num_Time=6, kindl = TEST_FMS_KIND_ type(time_type) :: Time_beg, Time_end, Time(num_Time) type(time_type), allocatable, dimension(:) :: Timelist integer :: index1, index2, mo, yr, outunit, ntest, nline - real(TI_TEST_KIND_) :: weight - real(TI_TEST_KIND_) :: ref_weights(num_Time), ref_weights_leap(num_Time) - real(TI_TEST_KIND_), parameter :: SMALL = 1.0e-7_kindl ! r4 will fail with 8 - real(TI_TEST_KIND_), parameter :: midpoint = 0.483870967741935_kindl - real(TI_TEST_KIND_), parameter :: day_before_leap_day = 0.964285714285714_kindl - real(TI_TEST_KIND_), parameter :: day_before_leap_day_with_ly = 0.931034482758621_kindl + real(TEST_FMS_KIND_) :: weight + real(TEST_FMS_KIND_) :: ref_weights(num_Time), ref_weights_leap(num_Time) + real(TEST_FMS_KIND_), parameter :: SMALL = 1.0e-7_kindl ! r4 will fail with 8 + real(TEST_FMS_KIND_), parameter :: midpoint = 0.483870967741935_kindl + real(TEST_FMS_KIND_), parameter :: day_before_leap_day = 0.964285714285714_kindl + real(TEST_FMS_KIND_), parameter :: day_before_leap_day_with_ly = 0.931034482758621_kindl integer :: nmin, nmax @@ -357,7 +357,7 @@ end subroutine diagram logical function is_valid_indices(ind1, ind2, tList, tintv, res_weight, mtime) integer, intent(in) :: ind1, ind2 type(time_type), intent(in) :: tList(:), tintv - real(TI_TEST_KIND_), intent(in) :: res_weight + real(TEST_FMS_KIND_), intent(in) :: res_weight integer, intent(in) :: mtime integer :: i diff --git a/test_fms/time_interp/test_time_interp_external.F90 b/test_fms/time_interp/test_time_interp_external.F90 index c933dbddca..de12c74cf7 100644 --- a/test_fms/time_interp/test_time_interp_external.F90 +++ b/test_fms/time_interp/test_time_interp_external.F90 @@ -38,6 +38,7 @@ program test_time_interp_external use axis_utils2_mod, only : axis_edges use fms2_io_mod, only : FmsNetcdfFile_t, fms2_io_init, open_file, close_file, write_data, register_axis use fms2_io_mod, only : register_field, unlimited, register_variable_attribute +use platform_mod implicit none @@ -47,25 +48,25 @@ program test_time_interp_external character(len=128) :: filename='INPUT/aerosol.climatology.nc' character(len=128) :: fieldname='so4_anthro' type(time_type) :: time !< "model" time -integer, parameter :: kindl = TI_TEST_KIND_ -real(TI_TEST_KIND_) :: data_d_0d = 1.0_kindl !< interpolated data in compute domain -real(TI_TEST_KIND_) :: data_g_0d = 1.0_kindl !< interpolated global data +integer, parameter :: kindl = TEST_FMS_KIND_ +real(TEST_FMS_KIND_) :: data_d_0d = 1.0_kindl !< interpolated data in compute domain +real(TEST_FMS_KIND_) :: data_g_0d = 1.0_kindl !< interpolated global data type(domain2d) :: domain ! input.nml &field_manager_nml diff --git a/test_fms/tridiagonal/Makefile.am b/test_fms/tridiagonal/Makefile.am index 211869202b..41e684e65c 100644 --- a/test_fms/tridiagonal/Makefile.am +++ b/test_fms/tridiagonal/Makefile.am @@ -35,8 +35,8 @@ check_PROGRAMS = test_tridiagonal_r4 test_tridiagonal_r8 test_tridiagonal_r4_SOURCES=test_tridiagonal.F90 test_tridiagonal_r8_SOURCES=test_tridiagonal.F90 -test_tridiagonal_r4_CPPFLAGS=-DTRID_REAL_TYPE=tridiag_r4 -DTEST_TRIDIAG_REAL=r4_kind -I$(MODDIR) -test_tridiagonal_r8_CPPFLAGS=-DTRID_REAL_TYPE=tridiag_r8 -DTEST_TRIDIAG_REAL=r8_kind -I$(MODDIR) +test_tridiagonal_r4_CPPFLAGS=-DTEST_FMS_KIND_=r4_kind -I$(MODDIR) +test_tridiagonal_r8_CPPFLAGS=-DTEST_FMS_KIND_=r8_kind -I$(MODDIR) # Run the test program. TESTS = test_tridiagonal.sh diff --git a/test_fms/tridiagonal/test_tridiagonal.F90 b/test_fms/tridiagonal/test_tridiagonal.F90 index 18200a8c77..1b2002cbc9 100644 --- a/test_fms/tridiagonal/test_tridiagonal.F90 +++ b/test_fms/tridiagonal/test_tridiagonal.F90 @@ -16,10 +16,6 @@ !* You should have received a copy of the GNU Lesser General Public !* License along with FMS. If not, see . !*********************************************************************** -#ifndef TEST_TRIDIAG_KIND -#define TEST_TRIDIAG_KIND 8 -#endif - !> Tests the tridiagonal module routines (tri_invert and close_tridiagonal) !! Tests reals with the kind value set above, program test_tridiagonal @@ -32,16 +28,16 @@ program test_tridiagonal implicit none integer, parameter :: IN_LEN = 8 !< length of input arrays - integer, parameter :: kindl = TEST_TRIDIAG_KIND !< kind value for all reals in this test - !! set by TEST_TRIDIAG_KIND cpp macro - real(TEST_TRIDIAG_KIND), allocatable :: d(:,:,:), x(:,:,:), ref_array(:,:,:) - real(TEST_TRIDIAG_KIND), allocatable :: a(:,:,:), b(:,:,:), c(:,:,:) + integer, parameter :: kindl = TEST_FMS_KIND_ !< kind value for all reals in this test + !! set by TEST_FMS_KIND_ cpp macro + real(TEST_FMS_KIND_), allocatable :: d(:,:,:), x(:,:,:), ref_array(:,:,:) + real(TEST_FMS_KIND_), allocatable :: a(:,:,:), b(:,:,:), c(:,:,:) real(r4_kind), allocatable :: d_r4(:,:,:), x_r4(:,:,:) real(r4_kind), allocatable :: a_r4(:,:,:), b_r4(:,:,:), c_r4(:,:,:) real(r8_kind), allocatable :: d_r8(:,:,:), x_r8(:,:,:) real(r8_kind), allocatable :: a_r8(:,:,:), b_r8(:,:,:), c_r8(:,:,:) integer :: i, end, ierr, io - real(TEST_TRIDIAG_KIND) :: k + real(TEST_FMS_KIND_) :: k ! nml logical :: do_error_check = .false. namelist / test_tridiagonal_nml/ do_error_check @@ -96,7 +92,7 @@ program test_tridiagonal ref_array = ref_array * k ! check do i=1, IN_LEN - if(ABS(x(1,1,i) - ref_array(1,1,i)) .gt. 0.1e-12_kindl) then + if(ABS(x(1,1,i) - ref_array(1,1,i)) .gt. 1.0e-6_kindl) then print *, i, x(1,1,i), ref_array(1,1,i) call mpp_error(FATAL, "test_tridiagonal: failed reference check for tri_invert") endif @@ -106,7 +102,7 @@ program test_tridiagonal ref_array = ref_array * -1.0_kindl call tri_invert(x, d) do i=1, IN_LEN - if(ABS(x(1,1,i) - ref_array(1,1,i)) .gt. 0.1e-12_kindl) then + if(ABS(x(1,1,i) - ref_array(1,1,i)) .gt. 1.0e-6_kindl) then print *, i, x(1,1,i), ref_array(1,1,i) call mpp_error(FATAL, "test_tridiagonal: failed reference check for tri_invert with saved values") endif @@ -170,4 +166,4 @@ program test_tridiagonal call mpp_exit -end program \ No newline at end of file +end program