diff --git a/.gitignore b/.gitignore index 7d4937541..825372ca6 100644 --- a/.gitignore +++ b/.gitignore @@ -199,6 +199,8 @@ test_quad_irreg_interp test_quad_reg_interp test_table_read test_ran_unif +test_get_close_init_zero_dist +test_get_close_init_zero_dists # Directories to NOT IGNORE ... same as executable names # as far as I know, these must be listed after the executables diff --git a/developer_tests/get_close/test_get_close_init_zero_dist.f90 b/developer_tests/get_close/test_get_close_init_zero_dist.f90 new file mode 100644 index 000000000..e2b5f2cdf --- /dev/null +++ b/developer_tests/get_close/test_get_close_init_zero_dist.f90 @@ -0,0 +1,20 @@ +program test_get_close_zero_dist + +use location_mod, only : get_close_init, get_close_type, location_type +use types_mod, only : r8 +use utilities_mod, only : initialize_utilities, finalize_utilities + +implicit none + +integer, parameter :: n = 10 +type(get_close_type) :: gc +type(location_type) :: locs(n) +real(r8) :: max_dist = 0.0_r8 + +call initialize_utilities('test_get_close') + +call get_close_init(gc, n, max_dist, locs) + +call finalize_utilities() + +end program test_get_close_zero_dist diff --git a/developer_tests/get_close/test_get_close_init_zero_dists.f90 b/developer_tests/get_close/test_get_close_init_zero_dists.f90 new file mode 100644 index 000000000..8781a1b6b --- /dev/null +++ b/developer_tests/get_close/test_get_close_init_zero_dists.f90 @@ -0,0 +1,21 @@ +program test_get_close_zero_dist + +use location_mod, only : get_close_init, get_close_type, location_type +use types_mod, only : r8 +use utilities_mod, only : initialize_utilities, finalize_utilities + +implicit none + +integer, parameter :: n = 10 +type(get_close_type) :: gc +type(location_type) :: locs(n) +real(r8) :: max_dist = 1.0_r8 +real(r8) :: max_dists(n) = 0.0_r8 + +call initialize_utilities('test_get_close') + +call get_close_init(gc, n, max_dist, locs, max_dists) + +call finalize_utilities() + +end program test_get_close_zero_dist diff --git a/developer_tests/get_close/work/input.nml b/developer_tests/get_close/work/input.nml new file mode 100644 index 000000000..b0376ea48 --- /dev/null +++ b/developer_tests/get_close/work/input.nml @@ -0,0 +1,23 @@ + +&location_nml + / + +&preprocess_nml + overwrite_output = .true. + input_obs_qty_mod_file = '../../../assimilation_code/modules/observations/DEFAULT_obs_kind_mod.F90' + output_obs_qty_mod_file = '../../../assimilation_code/modules/observations/obs_kind_mod.f90' + input_obs_def_mod_file = '../../../observations/forward_operators/DEFAULT_obs_def_mod.F90' + output_obs_def_mod_file = '../../../observations/forward_operators/obs_def_mod.f90' + obs_type_files = '../../../observations/forward_operators/obs_def_reanalysis_bufr_mod.f90' + quantity_files = '../../../assimilation_code/modules/observations/default_quantities_mod.f90' + / + +&obs_kind_nml + / + +&utilities_nml + TERMLEVEL = 2 + module_details = .false. + logfilename = 'dart_log.out' + nmlfilename = 'dart_log.nml' + / diff --git a/developer_tests/get_close/work/quickbuild.sh b/developer_tests/get_close/work/quickbuild.sh new file mode 100755 index 000000000..394d4077a --- /dev/null +++ b/developer_tests/get_close/work/quickbuild.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +main() { + +export DART=$(git rev-parse --show-toplevel) +source "$DART"/build_templates/buildfunctions.sh + +MODEL="none" +EXTRA="$DART"/models/template/threed_model_mod.f90 +TEST=get_close +dev_test=1 +LOCATION="threed_cartesian" + +programs=( +) + +serial_programs=( +test_get_close_init_zero_dist +test_get_close_init_zero_dists +) + +arguments "$@" + +# clean the directory +\rm -f -- *.o *.mod Makefile .cppdefs + +# build and run preprocess before making any other DART executables +buildpreprocess + +# build DART +buildit + +# clean up +\rm -f -- *.o *.mod + +} + +main "$@" diff --git a/developer_tests/get_close/work/runall.sh b/developer_tests/get_close/work/runall.sh new file mode 100755 index 000000000..e61318b70 --- /dev/null +++ b/developer_tests/get_close/work/runall.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# DART software - Copyright UCAR. This open source software is provided +# by UCAR, "as is", without charge, subject to all terms of use at +# http://www.image.ucar.edu/DAReS/DART/DART_download + +# Usage: +# ./runall.sh +# ./runall.sh | grep FAIL +# ./runall.sh | grep PASS + +should_pass () { +if [[ $? -ne 0 ]]; then + echo $1: "FAIL" +else + echo $1: "PASS" +fi +} + +function run_test () { + ./$1 > out.$1 2>&1 + grep "$2" out.$1 + res=$? + return $res +} + +# for three_sphere +# Use sed to replace the line (compatible with both macOS and Linux) +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' 's/^LOCATION=".*"/LOCATION="threed_sphere"/' quickbuild.sh +else + sed -i 's/^LOCATION=".*"/LOCATION="threed_sphere"/' quickbuild.sh +fi + +./quickbuild.sh + +run_test test_get_close_init_zero_dist "bad maxdist value"; should_pass "3d sphere max dist <=0" +run_test test_get_close_init_zero_dists "bad maxdist_list value"; should_pass "3d sphere max dists <=0" + + +# for threed_cartesian +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' 's/^LOCATION=".*"/LOCATION="threed_cartesian"/' quickbuild.sh +else + sed -i 's/^LOCATION=".*"/LOCATION="threed_cartesian"/' quickbuild.sh +fi + +./quickbuild.sh + +run_test test_get_close_init_zero_dist "bad maxdist value"; should_pass "3d cart max dist <=0" +run_test test_get_close_init_zero_dists "bad maxdist_list value"; should_pass "3d cart max dists <=0" +