Merge remote-tracking branch 'origin/master' into frankenstein

This commit is contained in:
Andreas Lauser 2016-08-28 15:36:11 +02:00
commit 49f13e6664
12 changed files with 170 additions and 160 deletions

View File

@ -1,41 +1,32 @@
# opm-simulators jenkins build scripts:
**build-opm-simulators.sh**:
This is a helper script which contains functions for building,
testing and cloning opm-simulators and its dependencies.
**build.sh**:
This script will build dependencies, then build opm-simulators and execute its tests.
It is intended for post-merge builds of the master branch.
**build-pr.sh**:
This script will build dependencies, then build opm-simulators and execute its tests.
It inspects the $ghbPrBuildComment environmental variable to obtain a pull request
to use for ert, opm-common, opm-parser, opm-material, opm-core and
opm-grid (defaults to master) and then builds $sha1 of opm-simulators.
It also inspects the $ghbPrBuildComment environmental variable and builds
downstreams if requested. It inspects the $ghbPrBuildComment
environmental variable to obtain a pull request to use for the modules.
It is intended for pre-merge builds of pull requests.
You can optionally specify a given pull request to use for ert, opm-common,
opm-parser, opm-material, opm-core and opm-grid through the trigger.
The trigger line needs to contain ert=<pull request number> and/or
opm-common=<pull request number> and/or opm-parser=<pull request number>
and/or opm-material=<pull request number>
and/or opm-core=<pull request number>
and/or opm-grid=<pull request number>
and/or opm-output=<pull request number>.
To specify a given pull request to use for upstreams and downstreams,
trigger line needs to contain <module-name>=<pull request number>.
To build with downstreams the trigger line needs to contain 'with downstreams'.
**run-spe.sh**:
This script will execute the SPE1, SPE3 and SPE9 cases, then compare against
OPM and Eclipse reference results. It is meant to be executed after either
of the two build scripts above.
OPM and Eclipse reference results. It is meant to be executed after a build.
The binary used used is from the build identified by the configuration
environment variable.
**run-norne.sh**:
This script will execute the Norne case, and generate a document with
plots of the results. It is meant to be executed after either
of the two build scripts above.
plots of the results. It is meant to be executed after a build.
The binary used used is from the build identified by the configuration
environment variable.
**run-polymer.sh**:
This script will execute the simple2D polymer case, then compare against
Eclipse reference results. It is meant to be executed after either
of the two build scripts above.
Eclipse reference results. It is meant to be executed after a build.
The binary used used is from the build identified by the configuration
environment variable.

View File

@ -1,54 +0,0 @@
#!/bin/bash
function build_opm_simulators {
# Build ERT
pushd .
mkdir -p $WORKSPACE/deps/ert
cd $WORKSPACE/deps/ert
git init .
git remote add origin https://github.com/Ensembles/ert
git fetch --depth 1 origin $ERT_REVISION:branch_to_build
test $? -eq 0 || exit 1
git checkout branch_to_build
popd
pushd .
mkdir -p serial/build-ert
cd serial/build-ert
cmake $WORKSPACE/deps/ert/devel -DBUILD_APPLICATIONS=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install
cmake --build . --target install
popd
# Build opm-common
pushd .
mkdir -p $WORKSPACE/deps/opm-common
cd $WORKSPACE/deps/opm-common
git init .
git remote add origin https://github.com/OPM/opm-common
git fetch --depth 1 origin $OPM_COMMON_REVISION:branch_to_build
test $? -eq 0 || exit 1
git checkout branch_to_build
popd
source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh
pushd .
mkdir serial/build-opm-common
cd serial/build-opm-common
build_module "-DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install" 0 $WORKSPACE/deps/opm-common
test $? -eq 0 || exit 1
popd
# Build upstreams
build_upstreams
# Setup opm-data
source $WORKSPACE/deps/opm-common/jenkins/setup-opm-data.sh
# Build opm-simulators
pushd .
mkdir serial/build-opm-simulators
cd serial/build-opm-simulators
build_module "-DCMAKE_PREFIX_PATH=$WORKSPACE/serial/install -DOPM_DATA_ROOT=$OPM_DATA_ROOT" 1 $WORKSPACE
test $? -eq 0 || exit 1
popd
}

View File

@ -1,45 +0,0 @@
#!/bin/bash
source `dirname $0`/build-opm-simulators.sh
declare -a upstreams
upstreams=(opm-parser
opm-output
opm-material
opm-core
opm-grid)
declare -A upstreamRev
upstreamRev[opm-parser]=master
upstreamRev[opm-material]=master
upstreamRev[opm-core]=master
upstreamRev[opm-grid]=master
upstreamRev[opm-output]=master
ERT_REVISION=master
OPM_COMMON_REVISION=master
if grep -q "ert=" <<< $ghprbCommentBody
then
ERT_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*ert=([0-9]+).*/\1/g'`/merge
fi
if grep -q "opm-common=" <<< $ghprbCommentBody
then
OPM_COMMON_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-common=([0-9]+).*/\1/g'`/merge
fi
for upstream in ${upstreams[*]}
do
if grep -q "$upstream=" <<< $ghprbCommentBody
then
upstreamRev[$upstream]=pull/`echo $ghprbCommentBody | sed -r "s/.*$upstream=([0-9]+).*/\1/g"`/merge
fi
done
echo "Building with ert=$ERT_REVISION opm-common=$OPM_COMMON_REVISION opm-parser=${upstreamRev[opm-parser]} opm-material=${upstreamRev[opm-material]} opm-core=${upstreamRev[opm-core]} opm-grid=${upstreamRev[opm-grid]} opm-output=${upstreamRev[opm-output]} opm-simulators=$sha1"
build_opm_simulators
test $? -eq 0 || exit 1
cp serial/build-opm-simulators/testoutput.xml .

View File

@ -1,25 +1,49 @@
#!/bin/bash
source `dirname $0`/build-opm-simulators.sh
declare -a upstreams
upstreams=(opm-parser
upstreams=(opm-common
ert
opm-parser
opm-output
opm-material
opm-core
opm-grid)
declare -A upstreamRev
upstreamRev[opm-common]=master
upstreamRev[ert]=master
upstreamRev[opm-parser]=master
upstreamRev[opm-material]=master
upstreamRev[opm-core]=master
upstreamRev[opm-grid]=master
upstreamRev[opm-output]=master
ERT_REVISION=master
OPM_COMMON_REVISION=master
if grep -q "opm-common=" <<< $ghprbCommentBody
then
upstreamRev[opm-common]=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-common=([0-9]+).*/\1/g'`/merge
fi
build_opm_simulators
# No downstreams currently
declare -a downstreams
declare -A downstreamRev
# Clone opm-common
pushd .
mkdir -p $WORKSPACE/deps/opm-common
cd $WORKSPACE/deps/opm-common
git init .
git remote add origin https://github.com/OPM/opm-common
git fetch --depth 1 origin ${upstreamRev[opm-common]}:branch_to_build
test $? -eq 0 || exit 1
git checkout branch_to_build
popd
cp serial/build-opm-simulators/testoutput.xml .
source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh
parseRevisions
printHeader opm-simulators
# Setup opm-data
source $WORKSPACE/deps/opm-common/jenkins/setup-opm-data.sh
build_module_full opm-simulators

View File

@ -5,8 +5,8 @@ cd deps/opm-data
# Run the norne case
cd norne
$WORKSPACE/serial/build-opm-simulators/bin/flow deck_filename=NORNE_ATW2013.DATA output_dir=OPM
$WORKSPACE/$configuration/build-opm-simulators/bin/flow deck_filename=NORNE_ATW2013.DATA output_dir=OPM
test $? -eq 0 || exit 1
PATH=$WORKSPACE/serial/install/bin:$PATH ./plotwells.sh
PATH=$WORKSPACE/$configuration/install/bin:$PATH ./plotwells.sh
popd

View File

@ -5,12 +5,12 @@ cd deps/opm-data
# Run the simple2D polymer case
cd polymer_test_suite/simple2D
$WORKSPACE/serial/build-opm-simulators/bin/flow_polymer run.param
$WORKSPACE/$configuration/build-opm-simulators/bin/flow_polymer run.param
test $? -eq 0 || exit 1
cd ../..
# Compare OPM with eclipse reference
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py polymer_test_suite/simple2D/eclipse-simulation/ polymer_test_suite/simple2D/opm-simulation/ 2D_THREEPHASE_POLY_HETER 0.0006 0.004
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py polymer_test_suite/simple2D/eclipse-simulation/ polymer_test_suite/simple2D/opm-simulation/ 2D_THREEPHASE_POLY_HETER 0.0006 0.004
test $? -eq 0 || exit 1
popd

View File

@ -5,32 +5,32 @@ cd deps/opm-data
# Run the SPE1/3/9 cases
cd spe1
$WORKSPACE/serial/build-opm-simulators/bin/flow deck_filename=SPE1CASE2.DATA
$WORKSPACE/$configuration/build-opm-simulators/bin/flow deck_filename=SPE1CASE2.DATA
test $? -eq 0 || exit 1
cd ..
cd spe3
$WORKSPACE/serial/build-opm-simulators/bin/flow max_iter=50 deck_filename=SPE3CASE1.DATA
$WORKSPACE/$configuration/build-opm-simulators/bin/flow max_iter=50 deck_filename=SPE3CASE1.DATA
test $? -eq 0 || exit 1
cd ..
cd spe9
$WORKSPACE/serial/build-opm-simulators/bin/flow max_iter=50 deck_filename=SPE9_CP.DATA
$WORKSPACE/$configuration/build-opm-simulators/bin/flow max_iter=50 deck_filename=SPE9_CP.DATA
test $? -eq 0 || exit 1
cd ..
# Compare OPM with eclipse reference
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe1/eclipse-simulation/ spe1/ SPE1CASE2 0.01 0.01
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe1/eclipse-simulation/ spe1/ SPE1CASE2 0.01 0.01
test $? -eq 0 || exit 1
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe3/eclipse-simulation/ spe3/ SPE3CASE1 0.02 0.02
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe3/eclipse-simulation/ spe3/ SPE3CASE1 0.02 0.02
test $? -eq 0 || exit 1
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe9/eclipse-simulation/ spe9/ SPE9_CP 0.002 0.001
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe9/eclipse-simulation/ spe9/ SPE9_CP 0.002 0.001
test $? -eq 0 || exit 1
# Compare OPM with OPM reference
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe1/opm-simulation-reference/ spe1/ SPE1CASE2 0.001 0.001
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe1/opm-simulation-reference/ spe1/ SPE1CASE2 0.001 0.001
test $? -eq 0 || exit 1
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe3/opm-simulation-reference/ spe3/ SPE3CASE1 0.001 0.001
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe3/opm-simulation-reference/ spe3/ SPE3CASE1 0.001 0.001
test $? -eq 0 || exit 1
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe9/opm-simulation-reference/ spe9/ SPE9_CP 0.002 0.007
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe9/opm-simulation-reference/ spe9/ SPE9_CP 0.002 0.007
test $? -eq 0 || exit 1
popd

View File

@ -427,8 +427,7 @@ namespace Opm
// Possibly override IOConfig setting (from deck) for how often RESTART files should get written to disk (every N report step)
if (param_.has("output_interval")) {
const int output_interval = param_.get<int>("output_interval");
IOConfigPtr ioConfig = eclipse_state_->getIOConfig();
ioConfig->overrideRestartWriteInterval(static_cast<size_t>(output_interval));
eclipse_state_->getRestartConfig().overrideRestartWriteInterval( size_t( output_interval ) );
}
// Possible to force initialization only behavior (NOSIM).

View File

@ -17,17 +17,51 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/C.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/E.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/P.hpp>
#include <opm/autodiff/MissingFeatures.hpp>
#include <unordered_set>
#include <string>
#include <map>
#include <boost/lexical_cast.hpp>
namespace Opm {
namespace MissingFeatures {
template <typename Keyword, typename Item, typename T>
void addSupported(std::multimap<std::string, PartiallySupported<T> >& map, T itemValue)
{
std::pair<std::string,PartiallySupported<T> > pair({Keyword::keywordName, PartiallySupported<T>{Item::itemName , itemValue}});
map.insert(pair);
}
template <typename T>
void checkOptions(const DeckKeyword& keyword, std::multimap<std::string , PartiallySupported<T> >& map)
{
// check for partially supported keywords.
typename std::multimap<std::string, PartiallySupported<T> >::iterator it, itlow, itup;
itlow = map.lower_bound(keyword.name());
itup = map.upper_bound(keyword.name());
for (it = itlow; it != itup; ++it) {
const auto& record = keyword.getRecord(0);
if (record.getItem(it->second.item).template get<T>(0) != it->second.item_value) {
std::string msg = "For keyword '" + it->first + "' only value " + boost::lexical_cast<std::string>(it->second.item_value)
+ " in item " + it->second.item + " is supported by flow.\n"
+ "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n";
OpmLog::warning(msg);
}
}
}
void checkKeywords(const Deck& deck)
{
// These keywords are supported by opm-parser, but are not supported
@ -55,6 +89,14 @@ namespace MissingFeatures {
"VAPPARS", "VISCREF", "WATVISCT",
"WPAVE", "WPIMULT", "WPITAB", "WTEMP",
"WTEST", "WTRACER", "ZIPPY2" };
std::multimap<std::string, PartiallySupported<std::string> > string_options;
std::multimap<std::string, PartiallySupported<int> > int_options;
addSupported<ParserKeywords::COMPORD, ParserKeywords::COMPORD::ORDER_TYPE, std::string>(string_options , "DEPTH");
addSupported<ParserKeywords::ENDSCALE, ParserKeywords::ENDSCALE::DIRECT, std::string>(string_options, "NODIR");
addSupported<ParserKeywords::ENDSCALE, ParserKeywords::ENDSCALE::IRREVERS, std::string>(string_options, "REVER");
addSupported<ParserKeywords::PINCH, ParserKeywords::PINCH::CONTROL_OPTION, std::string>(string_options, "GAP");
addSupported<ParserKeywords::PINCH, ParserKeywords::PINCH::PINCHOUT_OPTION, std::string>(string_options, "TOPBOT");
addSupported<ParserKeywords::EHYSTR, ParserKeywords::EHYSTR::relative_perm_hyst, int>(int_options , 0);
// check deck and keyword for flow and parser.
for (size_t idx = 0; idx < deck.size(); ++idx) {
@ -64,8 +106,10 @@ namespace MissingFeatures {
if (it != unsupported_keywords.end()) {
std::string msg = "Keyword '" + keyword.name() + "' is not supported by flow.\n"
+ "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n";
OpmLog::error(msg);
OpmLog::warning(msg);
}
checkOptions<std::string>(keyword, string_options);
checkOptions<int>(keyword, int_options);
}
}
} // namespace MissingFeatures

View File

@ -24,6 +24,18 @@ namespace Opm {
namespace MissingFeatures {
template <typename T>
struct PartiallySupported {
std::string item;
T item_value;
};
template <typename Keyword, typename Item, typename T>
void addSupported(std::multimap<std::string, PartiallySupported<T> >& map, T itemValue);
template <typename T>
void checkOptions(const DeckKeyword& keyword, std::multimap<std::string , PartiallySupported<T> >& map);
void checkKeywords(const Deck& deck);
}

View File

@ -24,7 +24,7 @@
#include <opm/common/data/SimulationDataContainer.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
#include <opm/output/Cells.hpp>
#include <opm/core/simulator/BlackoilState.hpp>
#include <opm/core/utility/DataMap.hpp>
#include <opm/core/utility/Compat.hpp>
@ -344,11 +344,38 @@ namespace Opm
if (initConfig.restartRequested() && ((initConfig.getRestartStep()) == (timer.currentStepNum()))) {
std::cout << "Skipping restart write in start of step " << timer.currentStepNum() << std::endl;
} else {
std::vector<data::CellData> simProps;
/*
The simProps vector can be passed to the writeTimestep routine
to add more properties to the restart file. Examples of the
elements for the simProps vector can be the relative
permeabilites KRO, KRG and KRW and the fluxes.
Which properties are requested are configured with the RPTRST
keyword, which is internalized in the RestartConfig class in
EclipseState.
*/
/*
Assuming we already have correctly initialized
std::vector<double> instances kro,krw and krg with the oil,
water and gas relative permeabilities. Then we can write those
to the restart file with:
std::vector<data::CellData> simProps;
simProps.emplace_back( {"KRO" , UnitSystem::measure::identity , kro} );
simProps.emplace_back( {"KRG" , UnitSystem::measure::identity , krg} );
simProps.emplace_back( {"KRW" , UnitSystem::measure::identity , krw} );
*/
eclWriter_->writeTimeStep(timer.currentStepNum(),
substep,
timer.simulationTimeElapsed(),
simToSolution( state, phaseUsage_ ),
wellState.report(),
substep );
simProps);
}
}

View File

@ -73,15 +73,27 @@ namespace Opm
{
ScheduleConstPtr schedule = eclipseState->getSchedule();
for (const auto& well : schedule->getWells(currentStep)) {
if (well->isInjector(currentStep)) {
WellInjectionProperties injection = well->getInjectionProperties(currentStep);
if (injection.injectorType == WellInjector::WATER) {
WellPolymerProperties polymer = well->getPolymerProperties(currentStep);
if (well->isInjector(currentStep)) {
if (well->getStatus(currentStep) != WellCommon::SHUT) {
if (injection.injectorType == WellInjector::WATER) {
wellPolymerRate_.insert(std::make_pair(well->name(), polymer.m_polymerConcentration));
} else {
OPM_THROW(std::logic_error, "For polymer injector you must have a water injector");
if (polymer.m_polymerConcentration > 0) {
OpmLog::error("Inject polymer through non-water injector '" + well->name() + "'");
}
}
} else {
if (polymer.m_polymerConcentration > 0) {
OpmLog::error("Inject polymer through a shut injector '" + well->name() + "'");
}
}
}
if (well->isProducer(currentStep) && polymer.m_polymerConcentration > 0) {
OpmLog::error("Inject polymer through a producer '" + well->name() + "'");
}
}
}