mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-28 02:00:59 -06:00
Merge pull request #1549 from akva2/use_builtin_analysis
changed: use the built-in analysis in the comparison programs
This commit is contained in:
commit
6642df7a8c
@ -1,69 +0,0 @@
|
||||
#!/bin/bash
|
||||
# This will perform some analysis on a failed restart/init
|
||||
# comparisons in a regression tests.
|
||||
|
||||
# Analyze restart/init test failure.
|
||||
# - Print failed keywords
|
||||
# - Print maximum deviations for each keyword
|
||||
analyzeEclFailure() {
|
||||
kwds=`cat $KWTMPFILE | tr '\n' ' ' | sed -e 's/.*Common keywords for the two cases:\(.*\)Uncommon.*/\1/'`
|
||||
TMPFILE=$(mktemp)
|
||||
allok=1
|
||||
for kwd in $kwds
|
||||
do
|
||||
${COMPARE_ECL_COMMAND} -n -l -k ${kwd} ${FILE1} ${FILE2} ${ABS_TOL} ${REL_TOL} &> ${TMPFILE}
|
||||
nfailure=`cat ${TMPFILE} | grep "Deviations exceed tolerances" | wc -l`
|
||||
if [ ${nfailure} -ne 0 ]
|
||||
then
|
||||
allok=0
|
||||
echo "Failure for keyword ${kwd}"
|
||||
echo -e "\t Fails for ${nfailure} entries"
|
||||
alines=`cat $TMPFILE | grep "The absolute deviation is"`
|
||||
IFS=$'\n'
|
||||
abs=0
|
||||
for line in $alines
|
||||
do
|
||||
abs_new=`echo $line| awk -F ' ' '{print $5}'`
|
||||
abs_new=`echo ${abs_new} | sed -e 's/\.$//g' | awk '{printf sprintf("%.16f", $1); }'`
|
||||
if [ `bc <<< "$abs_new>$abs"` -eq 1 ]
|
||||
then
|
||||
abs=$abs_new
|
||||
fi
|
||||
done
|
||||
rlines=`cat $TMPFILE | grep "The relative deviation is"`
|
||||
rel=0
|
||||
for line in $rlines
|
||||
do
|
||||
rel_new=`echo $line| awk -F ' ' '{print $5}'`
|
||||
rel_new=`echo ${rel_new} | sed -e 's/\.$//g' | awk '{printf sprintf("%.16f", $1); }'`
|
||||
if [ `bc <<< "$rel_new>$rel"` -eq 1 ]
|
||||
then
|
||||
rel=$rel_new
|
||||
fi
|
||||
done
|
||||
echo -e "\t Largest absolute deviation: `echo $abs | awk '{printf sprintf("%e", $1); }'`"
|
||||
echo -e "\t Largest relative deviation: `echo $rel | awk '{printf sprintf("%e", $1); }'`"
|
||||
fi
|
||||
done
|
||||
if [ $allok -eq 1 ]
|
||||
then
|
||||
echo "Comparisons pass for all common keywords."
|
||||
fi
|
||||
}
|
||||
|
||||
COMPARE_ECL_COMMAND=$1
|
||||
TYPE=$2
|
||||
FILE1=$3
|
||||
FILE2=$4
|
||||
ABS_TOL=$5
|
||||
REL_TOL=$6
|
||||
|
||||
KWTMPFILE=$(mktemp)
|
||||
${COMPARE_ECL_COMMAND} -t ${TYPE} -l -P ${FILE1} ${FILE2} ${ABS_TOL} ${REL_TOL} &> $KWTMPFILE
|
||||
|
||||
cat $KWTMPFILE
|
||||
echo ""
|
||||
|
||||
analyzeEclFailure
|
||||
|
||||
rm -f $KWTMPFILE
|
@ -1,63 +0,0 @@
|
||||
#!/bin/bash
|
||||
# This will perform some analysis on a failed summary
|
||||
# comparisons in a regression tests.
|
||||
|
||||
# Analyze summary test failure.
|
||||
# - Print number of failed keywords
|
||||
# - Print number of levels each keyword failed at
|
||||
# - Print maximum deviations for each keyword
|
||||
analyzeSummaryFailure() {
|
||||
lines=`cat $TMPFILE | grep "For keyword"`
|
||||
IFS=$'\n'
|
||||
kwds=""
|
||||
for line in $lines
|
||||
do
|
||||
kwds+="`echo $line | awk -F ' ' '{print $3}'`\n"
|
||||
done
|
||||
unique_kwds=`echo -e $kwds | uniq`
|
||||
kws_failed=`echo -e "$unique_kwds" | wc -l`
|
||||
echo "$kws_failed summary keyword(s) exhibit failures"
|
||||
numsteps=`cat $TMPFILE | grep "Comparing " | grep steps | awk -F ' ' '{print $2}'`
|
||||
|
||||
for kwd in $unique_kwds
|
||||
do
|
||||
lines=`cat $TMPFILE | grep -n "For keyword $kwd$"`
|
||||
echo -e "\t $kwd"
|
||||
echo -e "\t \t Fails for: `cat $TMPFILE | grep -n "$kwd$" | wc -l` / $numsteps steps."
|
||||
abs=0
|
||||
rel=0
|
||||
for line in $lines
|
||||
do
|
||||
ln=`echo $line | awk -F ':' '{print $1'}`
|
||||
abs_line=$(($ln+2))
|
||||
rel_line=$(($ln+3))
|
||||
abs_new=`sed "${abs_line}q;d" $TMPFILE | awk -F ' ' '{print $5}'`
|
||||
rel_new=`sed "${rel_line}q;d" $TMPFILE | awk -F ' ' '{print $5}'`
|
||||
abs_new=`echo ${abs_new} | sed -e 's/\.$//g' | awk '{printf sprintf("%.16f", $1); }'`
|
||||
rel_new=`echo ${rel_new} | sed -e 's/\.$//g' | awk '{printf sprintf("%.16f", $1); }'`
|
||||
if [ `bc <<< "$abs_new>$abs"` -eq 1 ]
|
||||
then
|
||||
abs=$abs_new
|
||||
fi
|
||||
if [ `bc <<< "$rel_new>$rel"` -eq 1 ]
|
||||
then
|
||||
rel=$rel_new
|
||||
fi
|
||||
done
|
||||
echo -e "\t\t Largest absolute error: `echo $abs | awk '{printf sprintf("%e", $1); }'`"
|
||||
echo -e "\t\t Largest relative error: `echo $rel | awk '{printf sprintf("%e", $1); }'`"
|
||||
done
|
||||
}
|
||||
|
||||
COMPARE_SUMMARY_COMMAND=$1
|
||||
PARAM=$2
|
||||
FILE1=$3
|
||||
FILE2=$4
|
||||
ABS_TOL=$5
|
||||
REL_TOL=$6
|
||||
|
||||
TMPFILE=$(mktemp)
|
||||
${COMPARE_SUMMARY_COMMAND} -p -n ${PARAM} ${FILE1} ${FILE2} ${ABS_TOL} ${REL_TOL} &> $TMPFILE
|
||||
|
||||
analyzeSummaryFailure
|
||||
rm -f $TMPFILE
|
@ -29,7 +29,7 @@ ${COMPARE_ECL_COMMAND} -t INIT ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
ecode=1
|
||||
`dirname $0`/analyze_ecl_failure.sh ${COMPARE_ECL_COMMAND} INIT ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-simulation-reference/${EXE_NAME}/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
${COMPARE_ECL_COMMAND} -a -t INIT ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-simulation-reference/${EXE_NAME}/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
fi
|
||||
|
||||
exit $ecode
|
||||
|
@ -33,7 +33,7 @@ ${COMPARE_SUMMARY_COMMAND} -R ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/mpi/${FI
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
ecode=1
|
||||
`dirname $0`/analyze_summary_failure.sh ${COMPARE_SUMMARY_COMMAND} -R ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/mpi/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
${COMPARE_SUMMARY_COMMAND} -a -R ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/mpi/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
fi
|
||||
|
||||
echo "=== Executing comparison for restart file ==="
|
||||
@ -41,7 +41,7 @@ ${COMPARE_ECL_COMMAND} -l ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/mpi/${FILENA
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
ecode=1
|
||||
`dirname $0`/analyze_ecl_failure.sh ${COMPARE_ECL_COMMAND} UNRST ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/mpi/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
${COMPARE_ECL_COMMAND} -a -l ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/mpi/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
fi
|
||||
|
||||
exit $ecode
|
||||
|
@ -29,7 +29,7 @@ ${COMPARE_ECL_COMMAND} -t INIT -k PORV ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_P
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
ecode=1
|
||||
`dirname $0`/analyze_ecl_failure.sh ${COMPARE_ECL_COMMAND} INIT ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-porevolume-reference/${EXE_NAME}/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
${COMPARE_ECL_COMMAND} -a -t INIT -k PORV ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-porevolume-reference/${EXE_NAME}/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
fi
|
||||
|
||||
exit $ecode
|
||||
|
@ -27,7 +27,7 @@ ${COMPARE_SUMMARY_COMMAND} -r ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
ecode=1
|
||||
`dirname $0`/analyze_summary_failure.sh ${COMPARE_SUMMARY_COMMAND} -r ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-simulation-reference/${EXE_NAME}/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
${COMPARE_SUMMARY_COMMAND} -a -r ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-simulation-reference/${EXE_NAME}/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
fi
|
||||
|
||||
echo "=== Executing comparison for restart file ==="
|
||||
@ -35,7 +35,7 @@ ${COMPARE_ECL_COMMAND} ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-simula
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
ecode=1
|
||||
`dirname $0`/analyze_ecl_failure.sh ${COMPARE_ECL_COMMAND} UNRST ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-simulation-reference/${EXE_NAME}/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
${COMPARE_ECL_COMMAND} -a ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-simulation-reference/${EXE_NAME}/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
fi
|
||||
|
||||
echo "=== Executing comparison for init file ==="
|
||||
@ -43,7 +43,7 @@ ${COMPARE_ECL_COMMAND} -t INIT ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
ecode=1
|
||||
`dirname $0`/analyze_ecl_failure.sh ${COMPARE_ECL_COMMAND} INIT ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-simulation-reference/${EXE_NAME}/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
${COMPARE_ECL_COMMAND} -a -t INIT ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-simulation-reference/${EXE_NAME}/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
fi
|
||||
|
||||
exit $ecode
|
||||
|
@ -42,7 +42,7 @@ ${COMPARE_SUMMARY_COMMAND} -R ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/${FILENA
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
ecode=1
|
||||
`dirname $0`/analyze_summary_failure.sh ${COMPARE_SUMMARY_COMMAND} -R ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/${FILENAME}_RESTART ${ABS_TOL} ${REL_TOL}
|
||||
${COMPARE_SUMMARY_COMMAND} -a -R ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/${FILENAME}_RESTART ${ABS_TOL} ${REL_TOL}
|
||||
fi
|
||||
|
||||
echo "=== Executing comparison for restart file ==="
|
||||
@ -50,7 +50,7 @@ ${COMPARE_ECL_COMMAND} -l ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/${FILENAME}_
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
ecode=1
|
||||
`dirname $0`/analyze_ecl_failure.sh ${COMPARE_ECL_COMMAND} UNRST ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/${FILENAME}_RESTART ${ABS_TOL} ${REL_TOL}
|
||||
${COMPARE_ECL_COMMAND} -a -l ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/${FILENAME}_RESTART ${ABS_TOL} ${REL_TOL}
|
||||
fi
|
||||
|
||||
exit $ecode
|
||||
|
Loading…
Reference in New Issue
Block a user