Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Infrastructure for Geomechanical Analysis #5801

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
47 changes: 43 additions & 4 deletions CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,40 @@ list (APPEND TEST_DATA_FILES
# originally generated with the command:
# find opm -name '*.h*' -a ! -name '*-pch.hpp' -printf '\t%p\n' | sort
list (APPEND PUBLIC_HEADER_FILES
flow/flow_blackoil.hpp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these (mostly) contain prototypes for functions that are never installed, ie not in the library. if we need need these in downstreams there is more work to be done, this achieves nothing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this achieves nothing.

That's mostly true. They're used directly in Main.hpp so we either need the headers, or the include statements in Main.hpp must go away.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i am aware of that but Main.hpp is also not structured to be installed, it's only meant to end up in simulators, which again are not meant to be downstream accessible.

my point is that if we really want to prepare the code for downstreams we have a lot of things that need to be addressed, not just in the code but also in the build system., e.g. how we handle gpu stuff.

i'm not really opposing this change, it makes thing no worse than it already was and helps a little so...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i am aware of that but Main.hpp is also not structured to be installed, it's only meant to end up in simulators, which again are not meant to be downstream accessible.

True. I guess it slipped through in #2532 (8c2ba0b) then.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my point is that if we really want to prepare the code for downstreams we have a lot of things that need to be addressed, not just in the code but also in the build system., e.g. how we handle gpu stuff.

I think we may getting to a point where a careful review of the full OPM build system is in order anyway.

flow/flow_blackoil_legacyassembly.hpp
flow/flow_brine.hpp
flow/flow_brine_precsalt_vapwat.hpp
flow/flow_brine_saltprecipitation.hpp
flow/flow_energy.hpp
flow/flow_extbo.hpp
flow/flow_foam.hpp
flow/flow_gasoil.hpp
flow/flow_gasoil_energy.hpp
flow/flow_gasoildiffuse.hpp
flow/flow_gaswater.hpp
flow/flow_gaswater_brine.hpp
flow/flow_gaswater_dissolution.hpp
flow/flow_gaswater_dissolution_diffuse.hpp
flow/flow_gaswater_energy.hpp
flow/flow_gaswater_saltprec_energy.hpp
flow/flow_gaswater_saltprec_vapwat.hpp
flow/flow_gaswater_solvent.hpp
flow/flow_micp.hpp
flow/flow_oilwater.hpp
flow/flow_oilwater_brine.hpp
flow/flow_oilwater_polymer.hpp
flow/flow_oilwater_polymer_injectivity.hpp
flow/flow_onephase.hpp
flow/flow_onephase_energy.hpp
flow/flow_polymer.hpp
flow/flow_solvent.hpp
flow/flow_solvent_foam.hpp

opm/models/blackoil/blackoilboundaryratevector.hh
opm/models/blackoil/blackoilbrinemodules.hh
opm/models/blackoil/blackoilbrineparams.hpp
opm/models/blackoil/blackoilconvectivemixingmodule.hh
opm/models/blackoil/blackoildarcyfluxmodule.hh
opm/models/blackoil/blackoildiffusionmodule.hh
opm/models/blackoil/blackoildispersionmodule.hh
Expand Down Expand Up @@ -905,17 +936,21 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/linalg/overlaptypes.hh
opm/simulators/linalg/OwningBlockPreconditioner.hpp
opm/simulators/linalg/OwningTwoLevelPreconditioner.hpp
opm/simulators/linalg/MILU.hpp
opm/simulators/linalg/parallelamgbackend.hh
opm/simulators/linalg/parallelbasebackend.hh
opm/simulators/linalg/parallelbicgstabbackend.hh
opm/simulators/linalg/parallelistlbackend.hh
opm/simulators/linalg/ParallelIstlInformation.hpp
opm/simulators/linalg/ParallelOverlappingILU0.hpp
opm/simulators/linalg/ParallelRestrictedAdditiveSchwarz.hpp
opm/simulators/linalg/PressureSolverPolicy.hpp
opm/simulators/linalg/PressureTransferPolicy.hpp
opm/simulators/linalg/PreconditionerFactoryGPUIncludeWrapper.hpp
opm/simulators/linalg/PreconditionerFactory.hpp
opm/simulators/linalg/PreconditionerFactory_impl.hpp
opm/simulators/linalg/PreconditionerWithUpdate.hpp
opm/simulators/linalg/PressureBhpTransferPolicy.hpp
opm/simulators/linalg/PressureSolverPolicy.hpp
opm/simulators/linalg/PressureTransferPolicy.hpp
opm/simulators/linalg/PropertyTree.hpp
opm/simulators/linalg/residreductioncriterion.hh
opm/simulators/linalg/SmallDenseMatrixUtils.hpp
Expand Down Expand Up @@ -952,6 +987,8 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/utils/gatherDeferredLogger.hpp
opm/simulators/utils/moduleVersion.hpp
opm/simulators/utils/phaseUsageFromDeck.hpp
opm/simulators/utils/ParallelCommunication.hpp
opm/simulators/utils/ParallelSerialization.hpp
opm/simulators/utils/readDeck.hpp
opm/simulators/utils/satfunc/RelpermDiagnostics.hpp
opm/simulators/wells/ALQState.hpp
Expand Down Expand Up @@ -1015,14 +1052,16 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/wells/WellGroupControls.hpp
opm/simulators/wells/WellGroupHelpers.hpp
opm/simulators/wells/WellHelpers.hpp
opm/simulators/wells/WellInterface.hpp
opm/simulators/wells/WellInterfaceFluidSystem.hpp
opm/simulators/wells/WellInterfaceGeneric.hpp
opm/simulators/wells/WellInterface.hpp
opm/simulators/wells/WellInterface_impl.hpp
opm/simulators/wells/WellInterfaceIndices.hpp
opm/simulators/wells/WellProdIndexCalculator.hpp
opm/simulators/wells/WellState.hpp
opm/simulators/wells/WellTest.hpp
opm/simulators/wells/WGState.hpp
)
)
if (USE_GPU_BRIDGE)
list (APPEND PUBLIC_HEADER_FILES
opm/simulators/linalg/gpubridge/amgclSolverBackend.hpp
Expand Down
2 changes: 0 additions & 2 deletions opm/models/blackoil/blackoilintensivequantities.hh
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
#include <cstring>
#include <utility>

#include <fmt/format.h>

namespace Opm {
/*!
* \ingroup BlackOilModel
Expand Down
16 changes: 8 additions & 8 deletions opm/models/discretization/common/fvbaseprimaryvariables.hh
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ namespace Dune {
};


/** Specialization of FieldTraits for all PrimaryVariables derived from Opm::FvBasePrimaryVariables */
template<class TypeTag, template <class> class EwomsPrimaryVariable>
struct FieldTraits< EwomsPrimaryVariable< TypeTag > >
: public FieldTraitsImpl< TypeTag,
std::is_base_of< Opm::FvBasePrimaryVariables< TypeTag >,
EwomsPrimaryVariable< TypeTag > > :: value >
{
};
// /** Specialization of FieldTraits for all PrimaryVariables derived from Opm::FvBasePrimaryVariables */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this commented out?

// template<class TypeTag, template <class> class EwomsPrimaryVariable>
// struct FieldTraits< EwomsPrimaryVariable< TypeTag > >
// : public FieldTraitsImpl< TypeTag,
// std::is_base_of< Opm::FvBasePrimaryVariables< TypeTag >,
// EwomsPrimaryVariable< TypeTag > > :: value >
// {
// };
}

#endif
2 changes: 1 addition & 1 deletion opm/simulators/flow/ActionHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class ActionHandler
void evalUDQAssignments(const unsigned episodeIdx,
UDQState& udq_state);

private:
/// Convey dynamic updates triggered by an action block back to the
/// running simulator.
///
Expand All @@ -125,6 +124,7 @@ class ActionHandler
const TransFunc& updateTrans,
bool& commit_wellstate);

private:
/// Static properties such as permeability and transmissibility.
EclipseState& ecl_state_;

Expand Down
1 change: 1 addition & 0 deletions opm/simulators/flow/CpGridVanguard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ class CpGridVanguard : public FlowBaseVanguard<TypeTag>
}

this->doLoadBalance_(this->edgeWeightsMethod(), this->ownersFirst(),
this->addCorners(),this->numOverlap(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space

this->partitionMethod(), this->serialPartitioning(),
this->enableDistributedWells(),
this->allow_splitting_inactive_wells_,
Expand Down
2 changes: 2 additions & 0 deletions opm/simulators/flow/FlowBaseVanguard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ class FlowBaseVanguard : public BaseVanguard<TypeTag>,

ownersFirst_ = Parameters::Get<Parameters::OwnerCellsFirst>();
#if HAVE_MPI
numOverlap_ = Parameters::Get<Parameters::NumOverlap>();
addCorners_ = Parameters::Get<Parameters::AddCorners>();
partitionMethod_ = Dune::PartitionMethod(Parameters::Get<Parameters::PartitionMethod>());
serialPartitioning_ = Parameters::Get<Parameters::SerialPartitioning>();
imbalanceTol_ = Parameters::Get<Parameters::ImbalanceTol<Scalar>>();
Expand Down
4 changes: 4 additions & 0 deletions opm/simulators/flow/FlowGenericVanguard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,10 @@ void FlowGenericVanguard::registerParameters_()
Parameters::Register<Parameters::OwnerCellsFirst>
("Order cells owned by rank before ghost/overlap cells.");
#if HAVE_MPI
Parameters::Register<Parameters::AddCorners>
("Add corners to partion.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partition

Parameters::Register<Parameters::NumOverlap>
("Numbers of layers overlap in parallel partition");
Parameters::Register<Parameters::PartitionMethod>
("Choose partitioning strategy: 0=simple, 1=Zoltan, 2=METIS.");
Parameters::Register<Parameters::SerialPartitioning>
Expand Down
11 changes: 11 additions & 0 deletions opm/simulators/flow/FlowGenericVanguard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ struct ActionParsingStrictness { static constexpr auto value = "normal"; };

// 0: simple, 1: Zoltan, 2: METIS, see GridEnums.hpp
struct PartitionMethod { static constexpr int value = 1; };
struct AddCorners { static constexpr bool value = false; };
struct NumOverlap { static constexpr int value = 1; };

struct SchedRestart{ static constexpr bool value = false; };
struct SerialPartitioning{ static constexpr bool value = false; };
Expand Down Expand Up @@ -253,7 +255,14 @@ class FlowGenericVanguard {
bool ownersFirst() const
{ return ownersFirst_; }


#if HAVE_MPI
bool addCorners() const
{ return addCorners_; }

int numOverlap() const
{ return numOverlap_; }

/*!
* \brief Parameter deciding which partition method to use
*/
Expand Down Expand Up @@ -349,6 +358,8 @@ class FlowGenericVanguard {

bool ownersFirst_;
#if HAVE_MPI
bool addCorners_;
int numOverlap_;
Dune::PartitionMethod partitionMethod_;
bool serialPartitioning_;
double imbalanceTol_;
Expand Down
8 changes: 5 additions & 3 deletions opm/simulators/flow/FlowProblem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1676,9 +1676,8 @@ class FlowProblem : public GetPropType<TypeTag, Properties::BaseProblem>

return this->rockCompTransMultWc_[tableIdx].eval(effectivePressure, SwDeltaMax, /*extrapolation=*/true);
}

protected:
typename Vanguard::TransmissibilityType transmissibilities_;

std::shared_ptr<EclMaterialLawManager> materialLawManager_;
std::shared_ptr<EclThermalLawManager> thermalLawManager_;

Expand All @@ -1694,6 +1693,8 @@ class FlowProblem : public GetPropType<TypeTag, Properties::BaseProblem>
PffGridVector<GridView, Stencil, PffDofData_, DofMapper> pffDofData_;
TracerModel tracerModel_;


private:
template<class T>
struct BCData
{
Expand Down Expand Up @@ -1726,8 +1727,9 @@ class FlowProblem : public GetPropType<TypeTag, Properties::BaseProblem>
virtual void handleSolventBC(const BCProp::BCFace&, RateVector&) const = 0;

virtual void handlePolymerBC(const BCProp::BCFace&, RateVector&) const = 0;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want this blank line.

protected:
BCData<int> bcindex_;
private:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add blank line

bool nonTrivialBoundaryConditions_ = false;
bool explicitRockCompaction_ = false;
bool first_step_ = true;
Expand Down
8 changes: 6 additions & 2 deletions opm/simulators/flow/FlowProblemBlackoil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ template <class TypeTag>
class FlowProblemBlackoil : public FlowProblem<TypeTag>
{
// TODO: the naming of the Types might be able to be adjusted
public:
using FlowProblemType = FlowProblem<TypeTag>;

private:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want the blank line.

using typename FlowProblemType::Scalar;
using typename FlowProblemType::Simulator;
using typename FlowProblemType::GridView;
Expand Down Expand Up @@ -436,7 +437,10 @@ class FlowProblemBlackoil : public FlowProblem<TypeTag>
void endTimeStep() override
{
FlowProblemType::endTimeStep();

this->endStepApplyAction();
}
void endStepApplyAction()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newlines.

{
// after the solution is updated, the values in output module needs also updated
this->eclWriter()->mutableOutputModule().invalidateLocalData();

Expand Down
16 changes: 12 additions & 4 deletions opm/simulators/flow/GenericCpGridVanguard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ template<class ElementMapper, class GridView, class Scalar>
void GenericCpGridVanguard<ElementMapper, GridView, Scalar>::
doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
const bool ownersFirst,
const bool addCorners,
const int numOverlap,
const Dune::PartitionMethod partitionMethod,
const bool serialPartitioning,
const bool enableDistributedWells,
Expand Down Expand Up @@ -205,7 +207,9 @@ doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
const auto& possibleFutureConnections = schedule.getPossibleFutureConnections();
// Distribute the grid and switch to the distributed view.
if (mpiSize > 1) {
this->distributeGrid(edgeWeightsMethod, ownersFirst, partitionMethod,
this->distributeGrid(edgeWeightsMethod, ownersFirst,
addCorners, numOverlap,
partitionMethod,
serialPartitioning, enableDistributedWells,
imbalanceTol, loadBalancerSet != 0,
faceTrans, wells,
Expand Down Expand Up @@ -333,6 +337,8 @@ void
GenericCpGridVanguard<ElementMapper, GridView, Scalar>::
distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
const bool ownersFirst,
const bool addCorners,
const int numOverlap,
const Dune::PartitionMethod partitionMethod,
const bool serialPartitioning,
const bool enableDistributedWells,
Expand All @@ -347,7 +353,7 @@ distributeGrid(const Dune::EdgeWeightMethod edgeWeights
if (auto* eclState = dynamic_cast<ParallelEclipseState*>(&eclState1);
eclState != nullptr)
{
this->distributeGrid(edgeWeightsMethod, ownersFirst, partitionMethod,
this->distributeGrid(edgeWeightsMethod, ownersFirst, addCorners, numOverlap, partitionMethod,
serialPartitioning, enableDistributedWells,
imbalanceTol, loadBalancerSet, faceTrans,
wells, possibleFutureConnections, eclState, parallelWells);
Expand All @@ -371,6 +377,8 @@ void
GenericCpGridVanguard<ElementMapper, GridView, Scalar>::
distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
const bool ownersFirst,
const bool addCorners,
const int numOverlap,
const Dune::PartitionMethod partitionMethod,
const bool serialPartitioning,
const bool enableDistributedWells,
Expand All @@ -389,8 +397,8 @@ distributeGrid(const Dune::EdgeWeightMethod edgeWeights
*this->grid_, *eclState
};

const auto addCornerCells = false;
const auto overlapLayers = 1;
const auto addCornerCells = addCorners;
const auto overlapLayers = numOverlap;

if (loadBalancerSet) {
auto parts = isIORank
Expand Down
6 changes: 6 additions & 0 deletions opm/simulators/flow/GenericCpGridVanguard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ class GenericCpGridVanguard {
#if HAVE_MPI
void doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
const bool ownersFirst,
const bool addCorners,
const int numOverlap,
const Dune::PartitionMethod partitionMethod,
const bool serialPartitioning,
const bool enableDistributedWells,
Expand All @@ -176,6 +178,8 @@ class GenericCpGridVanguard {

void distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
const bool ownersFirst,
const bool addCorners,
const int numOverlap,
const Dune::PartitionMethod partitionMethod,
const bool serialPartitioning,
const bool enableDistributedWells,
Expand All @@ -189,6 +193,8 @@ class GenericCpGridVanguard {

void distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
const bool ownersFirst,
const bool addCorners,
const int numOverlap,
const Dune::PartitionMethod partitionMethod,
const bool serialPartitioning,
const bool enableDistributedWells,
Expand Down
Loading