Addressing review comments.

This commit is contained in:
Vegard Kippe 2023-06-30 12:21:25 +02:00
parent 7a0074f0e9
commit 7fc9a2eef3
2 changed files with 14 additions and 42 deletions

View File

@ -38,37 +38,9 @@ function(add_test_runSimulator)
-n ${PARAM_PROCS}
TEST_ARGS ${TEST_ARGS}
CONFIGURATION ${PARAM_CONFIGURATION})
set_tests_properties(runSimulator/${PARAM_CASENAME} PROPERTIES PROCESSORS ${PARAM_PROCS})
endfunction()
###########################################################################
# TEST: runSimulatorAlways - Run as default test (not only with the EXTRA conf)
###########################################################################
# Input:
# - casename: basename (no extension)
#
# Details:
# - This test class simply runs a simulation
function(add_test_runSimulatorAlways)
set(oneValueArgs CASENAME FILENAME SIMULATOR DIR DIR_PREFIX PROCS)
set(multiValueArgs TEST_ARGS)
cmake_parse_arguments(PARAM "$" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if(NOT PARAM_DIR)
set(PARAM_DIR ${PARAM_CASENAME})
endif()
set(RESULT_PATH ${BASE_RESULT_PATH}${PARAM_DIR_PREFIX}/${PARAM_SIMULATOR}+${PARAM_CASENAME})
set(TEST_ARGS ${PARAM_TEST_ARGS})
opm_add_test(runSimulator/${PARAM_CASENAME} NO_COMPILE
EXE_NAME ${PARAM_SIMULATOR}
DRIVER_ARGS -i ${OPM_TESTS_ROOT}/${PARAM_DIR}
-r ${RESULT_PATH}
-b ${PROJECT_BINARY_DIR}/bin
-f ${PARAM_FILENAME}
-n ${PARAM_PROCS}
TEST_ARGS ${TEST_ARGS})
endfunction()
###########################################################################
# TEST: compareECLFiles
###########################################################################
@ -307,14 +279,14 @@ add_test_runSimulator(CASENAME norne
FILENAME NORNE_ATW2013
SIMULATOR flow
PROCS 1
CONFIGURATION extra)
CONFIGURATION extra)
add_test_runSimulator(CASENAME norne_parallel
FILENAME NORNE_ATW2013
SIMULATOR flow
DIR norne
PROCS 4
CONFIGURATION extra)
CONFIGURATION extra)
# Tests that are run based on simulator results, but not necessarily direct comparison to reference results
@ -323,14 +295,14 @@ add_test_runSimulator(CASENAME run_tuning_xxxmbe
SIMULATOR flow
DIR tuning
PROCS 1
TEST_ARGS --output-extra-convergence-info=iterations --enable-tuning=true)
TEST_ARGS --output-extra-convergence-info=iterations --enable-tuning=true)
add_test_runSimulator(CASENAME run_notuning_xxxmbe
FILENAME 01_TUNING_XXXMBE
SIMULATOR flow
DIR tuning
PROCS 1
TEST_ARGS --output-extra-convergence-info=iterations --enable-tuning=false)
TEST_ARGS --output-extra-convergence-info=iterations --enable-tuning=false)
set_tests_properties(tuning_XXXMBE PROPERTIES DEPENDS "runSimulator/run_tuning_xxxmbe")

View File

@ -44,7 +44,7 @@ struct Column : public std::vector<std::string> {
const auto& conv_func = [](const std::string& strval) {
int ival;
try {
ival = static_cast<int>(std::stod(strval));
ival = std::stoi(strval);
} catch (std::invalid_argument& exc) {
ival = std::numeric_limits<int>::min();
}
@ -88,7 +88,7 @@ struct ColumnData {
raw_columns[i].push_back(colname);
++i;
}
if (i > num_columns) {
if (i >= num_columns && iss >> colname) {
std::cout << "Warning:Ignoring extra column(s) on line " << lineno << std::endl;
}
++lineno;
@ -96,10 +96,10 @@ struct ColumnData {
}
// Get data vectors of different types
std::vector<double> get_dvector(const std::string& colname) { return columns[colname]->dvalues(); }
std::vector<int> get_ivector(const std::string& colname) { return columns[colname]->ivalues(); }
std::vector<double> get_dvector(const std::string& colname) const { return columns.at(colname)->dvalues(); }
std::vector<int> get_ivector(const std::string& colname) const { return columns.at(colname)->ivalues(); }
// Default is to return double values
std::vector<double> operator[](const std::string& colname) { return columns[colname]->dvalues(); }
std::vector<double> operator[](const std::string& colname) const { return columns.at(colname)->dvalues(); }
std::vector<std::string> column_names;
std::vector<Column> raw_columns;
@ -142,11 +142,11 @@ BOOST_AUTO_TEST_CASE(CheckMassBalanceWithinXXXMBE)
}
max_mb.push_back( std::max({mbo.back(), mbw.back(), mbg.back(), max_mb_step}) );
std::cout << "---------------------------------------------------------------------------" << std::endl;
std::cout << "Found the following converged max mass balance error (per report step):" << std::endl;
BOOST_TEST_MESSAGE("---------------------------------------------------------------------------");
BOOST_TEST_MESSAGE("Found the following converged max mass balance error (per report step):");
for (auto& val : max_mb)
std::cout << val << std::endl;
std::cout << "---------------------------------------------------------------------------" << std::endl;
BOOST_TEST_MESSAGE(val);
BOOST_TEST_MESSAGE("---------------------------------------------------------------------------");
BOOST_CHECK( max_mb[0] < 1.0e-6 );