2013-07-30 05:30:25 -05:00
|
|
|
/* Copyright (c) 2013 Uni Research AS.
|
|
|
|
This file is licensed under the GNU General Public License v3.0 or later. */
|
|
|
|
#ifndef OPM_INCOMPPROPERTIESSHADOW_HEADER_INCLUDED
|
|
|
|
#error Do not include IncompPropertiesShadow_impl.hpp directly!
|
|
|
|
#endif /* OPM_INCOMPPROPERTIESSHADOW_HEADER_INCLUDED */
|
|
|
|
|
2015-10-08 04:42:15 -05:00
|
|
|
#include <opm/common/ErrorMacros.hpp>
|
2013-09-10 11:01:16 -05:00
|
|
|
|
2013-07-30 05:30:25 -05:00
|
|
|
namespace Opm
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Initialize so that all properties are retrieved from original.
|
|
|
|
*/
|
|
|
|
inline IncompPropertiesShadow::IncompPropertiesShadow (const IncompPropertiesInterface& original)
|
2013-07-30 06:24:57 -05:00
|
|
|
: prototype_ (original)
|
|
|
|
, shadowed_ (0)
|
2013-07-30 05:30:25 -05:00
|
|
|
, poro_ (0)
|
|
|
|
, perm_ (0)
|
|
|
|
, visc_ (0)
|
|
|
|
, dens_ (0)
|
|
|
|
, surf_ (0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The format of the prototype and the shadow must be the same,
|
|
|
|
* so these methods should always be forwarded directly.
|
|
|
|
*/
|
|
|
|
inline int IncompPropertiesShadow::numDimensions () const
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
return prototype_.numDimensions();
|
2013-07-30 05:30:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline int IncompPropertiesShadow::numCells () const
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
return prototype_.numCells();
|
2013-07-30 05:30:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline int IncompPropertiesShadow::numPhases () const
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
return prototype_.numPhases();
|
2013-07-30 05:30:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* These methods are sufficiently advanced (the s parameter is a
|
|
|
|
* non-integral index) for there not to be a trivial implementation,
|
|
|
|
* so they are not overridden yet.
|
|
|
|
*/
|
|
|
|
inline void IncompPropertiesShadow::relperm (const int n,
|
|
|
|
const double* s,
|
|
|
|
const int* cells,
|
|
|
|
double* kr,
|
|
|
|
double* dkrds) const
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
prototype_.relperm (n, s, cells, kr, dkrds);
|
2013-07-30 05:30:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void IncompPropertiesShadow::capPress (const int n,
|
|
|
|
const double* s,
|
|
|
|
const int* cells,
|
|
|
|
double* pc,
|
|
|
|
double* dpcds) const
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
prototype_.capPress (n, s, cells, pc, dpcds);
|
2013-07-30 05:30:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void IncompPropertiesShadow::satRange (const int n,
|
|
|
|
const int* cells,
|
|
|
|
double* smin,
|
|
|
|
double* smax) const
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
prototype_.satRange (n, cells, smin, smax);
|
2013-07-30 05:30:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the new value if indicated in the bitfield, otherwise
|
|
|
|
* use the original value from the other object.
|
|
|
|
*/
|
|
|
|
inline const double* IncompPropertiesShadow::porosity () const
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
return (shadowed_ & POROSITY) ? poro_ : prototype_.porosity ();
|
2013-07-30 05:30:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline const double* IncompPropertiesShadow::permeability () const
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
return (shadowed_ & PERMEABILITY) ? perm_ : prototype_.permeability ();
|
2013-07-30 05:30:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline const double* IncompPropertiesShadow::viscosity () const
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
return (shadowed_ & VISCOSITY) ? visc_ : prototype_.viscosity ();
|
2013-07-30 05:30:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline const double* IncompPropertiesShadow::density () const
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
return (shadowed_ & DENSITY) ? dens_ : prototype_.density ();
|
2013-07-30 05:30:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline const double* IncompPropertiesShadow::surfaceDensity () const
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
return (shadowed_ & SURFACE_DENSITY) ? surf_ : prototype_.surfaceDensity ();
|
2013-07-30 05:30:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Store the pointer and indicate that the new value should be used.
|
|
|
|
*/
|
|
|
|
inline IncompPropertiesShadow& IncompPropertiesShadow::usePorosity (const double* poro)
|
|
|
|
{
|
|
|
|
this->poro_ = poro;
|
2013-07-30 06:24:57 -05:00
|
|
|
shadowed_ |= POROSITY;
|
2013-07-30 05:30:25 -05:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline IncompPropertiesShadow& IncompPropertiesShadow::usePermeability (const double* perm)
|
|
|
|
{
|
|
|
|
this->perm_ = perm;
|
2013-07-30 06:24:57 -05:00
|
|
|
shadowed_ |= PERMEABILITY;
|
2013-07-30 05:30:25 -05:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline IncompPropertiesShadow& IncompPropertiesShadow::useViscosity (const double* visc)
|
|
|
|
{
|
|
|
|
this->visc_ = visc;
|
2013-07-30 06:24:57 -05:00
|
|
|
shadowed_ |= VISCOSITY;
|
2013-07-30 05:30:25 -05:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline IncompPropertiesShadow& IncompPropertiesShadow::useDensity (const double* dens)
|
|
|
|
{
|
|
|
|
this->dens_ = dens;
|
2013-07-30 06:24:57 -05:00
|
|
|
shadowed_ |= DENSITY;
|
2013-07-30 05:30:25 -05:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline IncompPropertiesShadow& IncompPropertiesShadow::useSurfaceDensity (const double* surf)
|
|
|
|
{
|
|
|
|
this->surf_ = surf;
|
2013-07-30 06:24:57 -05:00
|
|
|
shadowed_ |= SURFACE_DENSITY;
|
2013-07-30 05:30:25 -05:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copy the pointer from another property interface, after checking
|
|
|
|
* that they are compatible.
|
|
|
|
*/
|
|
|
|
inline IncompPropertiesShadow& IncompPropertiesShadow::usePorosity (const IncompPropertiesInterface& other)
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
assert (prototype_.numCells() == other.numCells());
|
2013-07-30 05:30:25 -05:00
|
|
|
return usePorosity (other.porosity());
|
|
|
|
}
|
|
|
|
|
|
|
|
inline IncompPropertiesShadow& IncompPropertiesShadow::usePermeability (const IncompPropertiesInterface& other)
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
assert (prototype_.numCells() == other.numCells());
|
|
|
|
assert (prototype_.numDimensions() == other.numDimensions());
|
2013-07-30 05:30:25 -05:00
|
|
|
return usePermeability (other.permeability());
|
|
|
|
}
|
|
|
|
|
|
|
|
inline IncompPropertiesShadow& IncompPropertiesShadow::useViscosity (const IncompPropertiesInterface& other)
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
assert (prototype_.numPhases() == other.numPhases());
|
2013-07-30 05:30:25 -05:00
|
|
|
return useViscosity (other.viscosity());
|
|
|
|
}
|
|
|
|
|
|
|
|
inline IncompPropertiesShadow& IncompPropertiesShadow::useDensity (const IncompPropertiesInterface& other)
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
assert (prototype_.numPhases() == other.numPhases());
|
2013-07-30 05:30:25 -05:00
|
|
|
return useDensity (other.density());
|
|
|
|
}
|
|
|
|
|
|
|
|
inline IncompPropertiesShadow& IncompPropertiesShadow::useSurfaceDensity (const IncompPropertiesInterface& other)
|
|
|
|
{
|
2013-07-30 06:24:57 -05:00
|
|
|
assert (prototype_.numPhases() == other.numPhases());
|
2013-07-30 05:30:25 -05:00
|
|
|
return useSurfaceDensity (other.surfaceDensity());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convenience methods to set several set of properties at once.
|
|
|
|
*/
|
|
|
|
inline IncompPropertiesShadow& IncompPropertiesShadow::useRockProps (const IncompPropertiesInterface& other)
|
|
|
|
{
|
|
|
|
return usePorosity (other).usePermeability (other);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline IncompPropertiesShadow& IncompPropertiesShadow::useFluidProps (const IncompPropertiesInterface& other)
|
|
|
|
{
|
|
|
|
return useViscosity (other).useDensity (other).useSurfaceDensity (other);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline IncompPropertiesShadow& IncompPropertiesShadow::useRockAndFluidProps (const IncompPropertiesInterface& other)
|
|
|
|
{
|
|
|
|
return useRockProps (other).useFluidProps (other);
|
|
|
|
}
|
|
|
|
} /* namespace Opm */
|