Skip to content

Commit

Permalink
Merge pull request #2051 from atgeirr/enable-onephase-revised-rebased
Browse files Browse the repository at this point in the history
Enable onephase
  • Loading branch information
atgeirr authored Oct 11, 2019
2 parents b0de207 + 8ef1958 commit 4ddb8e8
Show file tree
Hide file tree
Showing 18 changed files with 695 additions and 205 deletions.
24 changes: 23 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ cmake_minimum_required (VERSION 2.8)
option(SIBLING_SEARCH "Search for other modules in sibling directories?" ON)
set( USE_OPENMP_DEFAULT OFF ) # Use of OpenMP is considered experimental
option(BUILD_FLOW "Build the production oriented flow simulator?" ON)
option(BUILD_FLOW_VARIANTS "Build the variants for flow by default?" OFF)
option(BUILD_EBOS "Build the research oriented ebos simulator?" ON)
option(BUILD_EBOS_EXTENSIONS "Build the variants for various extensions of ebos by default?" OFF)
option(BUILD_EBOS_DEBUG_EXTENSIONS "Build the ebos variants which are purely for debugging by default?" OFF)
Expand Down Expand Up @@ -155,15 +156,36 @@ opm_add_test(flow
flow/flow_ebos_oilwater_polymer.cpp
flow/flow_ebos_oilwater_polymer_injectivity.cpp)

if (NOT BUILD_FLOW_VARIANTS)
set(FLOW_VARIANTS_DEFAULT_ENABLE_IF "FALSE")
else()
set(FLOW_VARIANTS_DEFAULT_ENABLE_IF "TRUE")
endif()

# Variant versions of Flow.
opm_add_test(flow_blackoil_dunecpr
ONLY_COMPILE
DEFAULT_ENABLE_IF ${FLOW_DEFAULT_ENABLE_IF}
DEFAULT_ENABLE_IF ${FLOW_VARIANTS_DEFAULT_ENABLE_IF}
SOURCES flow/flow_blackoil_dunecpr.cpp
EXE_NAME flow_blackoil_dunecpr
DEPENDS "opmsimulators"
LIBRARIES "opmsimulators")

opm_add_test(flow_onephase
ONLY_COMPILE
DEFAULT_ENABLE_IF ${FLOW_VARIANTS_DEFAULT_ENABLE_IF}
SOURCES flow/flow_onephase.cpp
EXE_NAME flow_onephase
DEPENDS "opmsimulators"
LIBRARIES "opmsimulators")

opm_add_test(flow_onephase_energy
ONLY_COMPILE
DEFAULT_ENABLE_IF ${FLOW_VARIANTS_DEFAULT_ENABLE_IF}
SOURCES flow/flow_onephase_energy.cpp
EXE_NAME flow_onephase_energy
DEPENDS "opmsimulators"
LIBRARIES "opmsimulators")

if (BUILD_FLOW)
install(TARGETS flow DESTINATION bin)
Expand Down
11 changes: 10 additions & 1 deletion ebos/ecloutputblackoilmodule.hh
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,16 @@ public:
}

if (oilPressure_.size() > 0) {
oilPressure_[globalDofIdx] = Opm::getValue(fs.pressure(oilPhaseIdx));
if (FluidSystem::phaseIsActive(oilPhaseIdx)) {
oilPressure_[globalDofIdx] = Opm::getValue(fs.pressure(oilPhaseIdx));
}else{
// put pressure in oil pressure for output
if (FluidSystem::phaseIsActive(waterPhaseIdx)) {
oilPressure_[globalDofIdx] = Opm::getValue(fs.pressure(waterPhaseIdx));
} else {
oilPressure_[globalDofIdx] = Opm::getValue(fs.pressure(gasPhaseIdx));
}
}
Opm::Valgrind::CheckDefined(oilPressure_[globalDofIdx]);
}

Expand Down
17 changes: 10 additions & 7 deletions ebos/eclproblem.hh
Original file line number Diff line number Diff line change
Expand Up @@ -665,17 +665,20 @@ public:
minTimeStepSize_ = tuning.getTSMINZ(0);
}

initFluidSystem_();

// deal with DRSDT
unsigned ntpvt = eclState.runspec().tabdims().getNumPVTTables();
maxDRs_.resize(ntpvt, 1e30);
dRsDtOnlyFreeGas_.resize(ntpvt, false);
size_t numDof = this->model().numGridDof();
lastRs_.resize(numDof, 0.0);
maxDRv_.resize(ntpvt, 1e30);
lastRv_.resize(numDof, 0.0);
maxOilSaturation_.resize(numDof, 0.0);
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) {
maxDRs_.resize(ntpvt, 1e30);
dRsDtOnlyFreeGas_.resize(ntpvt, false);
lastRs_.resize(numDof, 0.0);
maxDRv_.resize(ntpvt, 1e30);
lastRv_.resize(numDof, 0.0);
maxOilSaturation_.resize(numDof, 0.0);
}

initFluidSystem_();
updateElementDepths_();
readRockParameters_();
readMaterialParameters_();
Expand Down
10 changes: 4 additions & 6 deletions flow/flow_blackoil_dunecpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SET_PROP(EclFlowProblemSimple, FluidState)
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
static const bool compositionSwitchEnabled = Indices::gasEnabled;

public:
//typedef Opm::BlackOilFluidSystemSimple<Scalar> type;
typedef Opm::BlackOilFluidState<Evaluation, FluidSystem, enableTemperature, enableEnergy, compositionSwitchEnabled, Indices::numPhases > type;
Expand Down Expand Up @@ -89,7 +89,7 @@ namespace Opm {
#endif
SET_BOOL_PROP(EclFlowProblemSimple, EnableStorageCache, true);
SET_BOOL_PROP(EclFlowProblemSimple, EnableIntensiveQuantityCache, true);

//SET_INT_PROP(EclFlowProblemSimple, NumWellAdjoint, 1);
//SET_BOOL_PROP(EclFlowProblem, EnableStorageCache, true);
//SET_BOOL_PROP(EclFlowProblem, EnableIntensiveQuantityCache, true);
Expand All @@ -98,8 +98,6 @@ namespace Opm {

int main(int argc, char** argv)
{
typedef TTAG(EclFlowProblemSimple) TypeTag;
bool outputCout = true;
bool outputFiles = true;
return mainFlow<TypeTag>(argc, argv, outputCout, outputFiles);
typedef TTAG(EclFlowProblemSimple) TypeTag;
return mainFlow<TypeTag>(argc, argv);
}
91 changes: 91 additions & 0 deletions flow/flow_onephase.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
Copyright 2013, 2014, 2015 SINTEF ICT, Applied Mathematics.
Copyright 2014 Dr. Blatt - HPC-Simulation-Software & Services
Copyright 2015, 2017 IRIS AS
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "flow/flow_tag.hpp"
#include <opm/models/blackoil/blackoilonephaseindices.hh>


BEGIN_PROPERTIES
NEW_TYPE_TAG(EclFlowProblemSimple, INHERITS_FROM(EclFlowProblem));
NEW_PROP_TAG(FluidState);
NEW_PROP_TAG(FluidSystem);
//! The indices required by the model
SET_PROP(EclFlowProblemSimple, Indices)
{
private:
// it is unfortunately not possible to simply use 'TypeTag' here because this leads
// to cyclic definitions of some properties. if this happens the compiler error
// messages unfortunately are *really* confusing and not really helpful.
typedef TTAG(EclFlowProblem) BaseTypeTag;
typedef typename GET_PROP_TYPE(BaseTypeTag, FluidSystem) FluidSystem;

public:
typedef Ewoms::BlackOilOnePhaseIndices<GET_PROP_VALUE(TypeTag, EnableSolvent),
GET_PROP_VALUE(TypeTag, EnablePolymer),
GET_PROP_VALUE(TypeTag, EnableEnergy),
GET_PROP_VALUE(TypeTag, EnableFoam),
/*PVOffset=*/0,
/*enebledCompIdx=*/FluidSystem::waterCompIdx>
type;
};
SET_PROP(EclFlowProblemSimple, FluidState)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { enableTemperature = GET_PROP_VALUE(TypeTag, EnableTemperature) };
enum { enableSolvent = GET_PROP_VALUE(TypeTag, EnableSolvent) };
enum { enableEnergy = GET_PROP_VALUE(TypeTag, EnableEnergy) };
enum { numPhases = GET_PROP_VALUE(TypeTag, NumPhases) };
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
static const bool compositionSwitchEnabled = Indices::gasEnabled;

public:
// typedef Opm::BlackOilFluidSystemSimple<Scalar> type;
typedef Opm::BlackOilFluidState<Evaluation,
FluidSystem,
enableTemperature,
enableEnergy,
compositionSwitchEnabled,
Indices::numPhases>
type;
};

// SET_PROP(EclFlowProblemSimple, FluidSystem)
// {
// private:
// //typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
// typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
// typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
// typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;

// public:
// typedef Opm::BlackOilFluidSystem<Scalar,Indices> type;
// };
END_PROPERTIES

int
main(int argc, char** argv)
{
typedef TTAG(EclFlowProblemSimple) TypeTag;
return mainFlow<TypeTag>(argc, argv);
}
93 changes: 93 additions & 0 deletions flow/flow_onephase_energy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
Copyright 2013, 2014, 2015 SINTEF ICT, Applied Mathematics.
Copyright 2014 Dr. Blatt - HPC-Simulation-Software & Services
Copyright 2015, 2017 IRIS AS
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "flow/flow_tag.hpp"
#include <opm/models/blackoil/blackoilonephaseindices.hh>


BEGIN_PROPERTIES
NEW_TYPE_TAG(EclFlowProblemSimple, INHERITS_FROM(EclFlowProblem));
SET_BOOL_PROP(EclFlowProblemSimple, EnableEnergy, true);
NEW_PROP_TAG(FluidState);
NEW_PROP_TAG(FluidSystem);
//! The indices required by the model
SET_PROP(EclFlowProblemSimple, Indices)
{
private:
// it is unfortunately not possible to simply use 'TypeTag' here because this leads
// to cyclic definitions of some properties. if this happens the compiler error
// messages unfortunately are *really* confusing and not really helpful.
typedef TTAG(EclFlowProblem) BaseTypeTag;
typedef typename GET_PROP_TYPE(BaseTypeTag, FluidSystem) FluidSystem;

public:
typedef Ewoms::BlackOilOnePhaseIndices<GET_PROP_VALUE(TypeTag, EnableSolvent),
GET_PROP_VALUE(TypeTag, EnablePolymer),
GET_PROP_VALUE(TypeTag, EnableEnergy),
GET_PROP_VALUE(TypeTag, EnableFoam),
/*PVOffset=*/0,
/*enebledCompIdx=*/FluidSystem::waterCompIdx>
type;
};
SET_PROP(EclFlowProblemSimple, FluidState)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { enableTemperature = GET_PROP_VALUE(TypeTag, EnableTemperature) };
enum { enableSolvent = GET_PROP_VALUE(TypeTag, EnableSolvent) };
enum { enableEnergy = GET_PROP_VALUE(TypeTag, EnableEnergy) };
enum { numPhases = GET_PROP_VALUE(TypeTag, NumPhases) };
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
static const bool compositionSwitchEnabled = Indices::gasEnabled;

public:
// typedef Opm::BlackOilFluidSystemSimple<Scalar> type;
typedef Opm::BlackOilFluidState<Evaluation,
FluidSystem,
enableTemperature,
enableEnergy,
compositionSwitchEnabled,
Indices::numPhases>
type;
};

// SET_PROP(EclFlowProblemSimple, FluidSystem)
// {
// private:
// //typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
// typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
// typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
// typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;

// public:
// typedef Opm::BlackOilFluidSystem<Scalar,Indices> type;
// };
END_PROPERTIES


int
main(int argc, char** argv)
{
typedef TTAG(EclFlowProblemSimple) TypeTag;
return mainFlow<TypeTag>(argc, argv);
}
Loading

0 comments on commit 4ddb8e8

Please sign in to comment.