Loading...
Searching...
No Matches
multiphasebaseextensivequantities.hh
Go to the documentation of this file.
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
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 2 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/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef EWOMS_MULTI_PHASE_BASE_EXTENSIVE_QUANTITIES_HH
#define EWOMS_MULTI_PHASE_BASE_EXTENSIVE_QUANTITIES_HH
#include <dune/common/fvector.hh>
#include <opm/material/common/Valgrind.hpp>
#include <opm/models/common/multiphasebaseproperties.hh>
#include <opm/models/common/quantitycallbacks.hh>
#include <opm/models/discretization/common/fvbaseextensivequantities.hh>
#include <opm/models/utils/parametersystem.hpp>
#include <array>
namespace Opm {
template <class TypeTag>
class MultiPhaseBaseExtensiveQuantities
: public GetPropType<TypeTag, Properties::DiscExtensiveQuantities>
, public GetPropType<TypeTag, Properties::FluxModule>::FluxExtensiveQuantities
{
using ParentType = GetPropType<TypeTag, Properties::DiscExtensiveQuantities>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using ElementContext = GetPropType<TypeTag, Properties::ElementContext>;
enum { numPhases = getPropValue<TypeTag, Properties::NumPhases>() };
using FluxModule = GetPropType<TypeTag, Properties::FluxModule>;
using FluxExtensiveQuantities = typename FluxModule::FluxExtensiveQuantities;
public:
static void registerParameters()
{
FluxModule::registerParameters();
}
void update(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
{
ParentType::update(elemCtx, scvfIdx, timeIdx);
// compute the pressure potential gradients
FluxExtensiveQuantities::calculateGradients_(elemCtx, scvfIdx, timeIdx);
// Check whether the pressure potential is in the same direction as the face
// normal or in the opposite one
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
if (!elemCtx.model().phaseIsConsidered(phaseIdx)) {
Valgrind::SetUndefined(upstreamScvIdx_[phaseIdx]);
Valgrind::SetUndefined(downstreamScvIdx_[phaseIdx]);
continue;
}
upstreamScvIdx_[phaseIdx] = FluxExtensiveQuantities::upstreamIndex_(phaseIdx);
downstreamScvIdx_[phaseIdx] = FluxExtensiveQuantities::downstreamIndex_(phaseIdx);
}
FluxExtensiveQuantities::calculateFluxes_(elemCtx, scvfIdx, timeIdx);
}
template <class Context, class FluidState>
void updateBoundary(const Context& context,
unsigned bfIdx,
unsigned timeIdx,
const FluidState& fluidState)
{
ParentType::updateBoundary(context, bfIdx, timeIdx, fluidState);
FluxExtensiveQuantities::calculateBoundaryGradients_(context.elementContext(),
bfIdx,
timeIdx,
fluidState);
FluxExtensiveQuantities::calculateBoundaryFluxes_(context.elementContext(),
bfIdx,
timeIdx);
}
short upstreamIndex(unsigned phaseIdx) const
{ return upstreamScvIdx_[phaseIdx]; }
short downstreamIndex(unsigned phaseIdx) const
{ return downstreamScvIdx_[phaseIdx]; }
Scalar upstreamWeight(unsigned) const
{ return 1.0; }
Scalar downstreamWeight(unsigned phaseIdx) const
{ return 1.0 - upstreamWeight(phaseIdx); }
private:
std::array<short, numPhases> upstreamScvIdx_{};
std::array<short, numPhases> downstreamScvIdx_{};
};
} // namespace Opm
#endif
Opm::MultiPhaseBaseExtensiveQuantities
This class calculates the pressure potential gradients and the filter velocities for multi-phase flow...
Definition multiphasebaseextensivequantities.hh:53
Opm::MultiPhaseBaseExtensiveQuantities::updateBoundary
void updateBoundary(const Context &context, unsigned bfIdx, unsigned timeIdx, const FluidState &fluidState)
Update the extensive quantities for a given boundary face.
Definition multiphasebaseextensivequantities.hh:114
Opm::MultiPhaseBaseExtensiveQuantities::downstreamWeight
Scalar downstreamWeight(unsigned phaseIdx) const
Return the weight of the downstream control volume for a given phase as a function of the normal flux...
Definition multiphasebaseextensivequantities.hh:165
Opm::MultiPhaseBaseExtensiveQuantities::upstreamWeight
Scalar upstreamWeight(unsigned) const
Return the weight of the upstream control volume for a given phase as a function of the normal flux.
Definition multiphasebaseextensivequantities.hh:156
Opm::MultiPhaseBaseExtensiveQuantities::upstreamIndex
short upstreamIndex(unsigned phaseIdx) const
Return the local index of the upstream control volume for a given phase as a function of the normal f...
Definition multiphasebaseextensivequantities.hh:137
Opm::MultiPhaseBaseExtensiveQuantities::update
void update(const ElementContext &elemCtx, unsigned scvfIdx, unsigned timeIdx)
Update the extensive quantities for a given sub-control-volume-face.
Definition multiphasebaseextensivequantities.hh:80
Opm::MultiPhaseBaseExtensiveQuantities::downstreamIndex
short downstreamIndex(unsigned phaseIdx) const
Return the local index of the downstream control volume for a given phase as a function of the normal...
Definition multiphasebaseextensivequantities.hh:147
Opm::MultiPhaseBaseExtensiveQuantities::registerParameters
static void registerParameters()
Register all run-time parameters for the extensive quantities.
Definition multiphasebaseextensivequantities.hh:67
fvbaseextensivequantities.hh
Provide the properties at a face which make sense independently of the conserved quantities.
multiphasebaseproperties.hh
Defines the common properties required by the porous medium multi-phase models.
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
Opm::GetPropType
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition propertysystem.hh:233
Opm::getPropValue
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:240
parametersystem.hpp
This file provides the infrastructure to retrieve run-time parameters.
quantitycallbacks.hh
This method contains all callback classes for quantities that are required by some extensive quantiti...