-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: test harness for get_close_init zero maxdist
- Loading branch information
1 parent
75cf8dc
commit 179b869
Showing
6 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
developer_tests/get_close/test_get_close_init_zero_dist.f90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
21 changes: 21 additions & 0 deletions
21
developer_tests/get_close/test_get_close_init_zero_dists.f90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
|