2017-09-27 09:11:39 -05:00
|
|
|
/*
|
|
|
|
Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
|
|
|
|
Copyright 2017 Statoil ASA.
|
2020-07-23 03:31:37 -05:00
|
|
|
Copyright 2020 Equinor ASA.
|
2017-09-27 09:11:39 -05:00
|
|
|
|
|
|
|
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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef OPM_MSWELLHELPERS_HEADER_INCLUDED
|
|
|
|
#define OPM_MSWELLHELPERS_HEADER_INCLUDED
|
|
|
|
|
2022-08-29 08:59:28 -05:00
|
|
|
#include <dune/istl/matrix.hh>
|
2021-06-03 08:34:14 -05:00
|
|
|
|
2022-08-29 08:59:28 -05:00
|
|
|
namespace Dune {
|
|
|
|
template<class Matrix> class UMFPack;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <memory>
|
2017-09-27 09:11:39 -05:00
|
|
|
|
|
|
|
namespace Opm {
|
|
|
|
|
2022-08-29 08:59:28 -05:00
|
|
|
class DeferredLogger;
|
|
|
|
class SICD;
|
|
|
|
|
2017-09-27 09:11:39 -05:00
|
|
|
namespace mswellhelpers
|
|
|
|
{
|
2020-07-23 03:31:37 -05:00
|
|
|
|
|
|
|
/// Applies umfpack and checks for singularity
|
2017-10-14 01:50:44 -05:00
|
|
|
template <typename MatrixType, typename VectorType>
|
|
|
|
VectorType
|
2022-12-01 04:14:55 -06:00
|
|
|
applyUMFPack(Dune::UMFPack<MatrixType>& linsolver,
|
2022-08-29 08:59:28 -05:00
|
|
|
VectorType x);
|
2020-10-29 06:57:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Applies umfpack and checks for singularity
|
2022-11-30 16:05:29 -06:00
|
|
|
template <typename VectorType, typename MatrixType>
|
2020-11-17 05:53:04 -06:00
|
|
|
Dune::Matrix<typename MatrixType::block_type>
|
2022-12-01 04:14:55 -06:00
|
|
|
invertWithUMFPack(const int size,
|
|
|
|
const int bsize,
|
|
|
|
Dune::UMFPack<MatrixType>& linsolver);
|
2017-10-14 01:50:44 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// obtain y = D^-1 * x with a BICSSTAB iterative solver
|
2017-09-28 08:12:09 -05:00
|
|
|
template <typename MatrixType, typename VectorType>
|
2017-09-27 09:11:39 -05:00
|
|
|
VectorType
|
2022-08-29 08:59:28 -05:00
|
|
|
invDX(const MatrixType& D, VectorType x, DeferredLogger& deferred_logger);
|
2017-09-27 11:16:45 -05:00
|
|
|
|
2017-10-03 07:57:41 -05:00
|
|
|
// calculating the friction pressure loss
|
2017-09-27 11:16:45 -05:00
|
|
|
// l is the segment length
|
|
|
|
// area is the segment cross area
|
|
|
|
// diameter is the segment inner diameter
|
|
|
|
// w is mass flow rate through the segment
|
2017-09-28 04:00:10 -05:00
|
|
|
// density is density
|
2017-09-27 11:16:45 -05:00
|
|
|
// roughness is the absolute roughness
|
|
|
|
// mu is the average phase viscosity
|
2017-09-28 08:12:09 -05:00
|
|
|
template <typename ValueType>
|
2022-08-29 08:59:28 -05:00
|
|
|
ValueType frictionPressureLoss(const double l, const double diameter,
|
|
|
|
const double area, const double roughness,
|
|
|
|
const ValueType& density,
|
|
|
|
const ValueType& w, const ValueType& mu);
|
2017-09-28 08:12:09 -05:00
|
|
|
|
2019-11-24 04:11:50 -06:00
|
|
|
|
|
|
|
template <typename ValueType>
|
2022-08-29 08:59:28 -05:00
|
|
|
ValueType valveContrictionPressureLoss(const ValueType& mass_rate,
|
|
|
|
const ValueType& density,
|
|
|
|
const double area_con, const double cv);
|
2019-11-24 04:11:50 -06:00
|
|
|
|
|
|
|
|
|
|
|
template <typename ValueType>
|
2022-08-29 08:59:28 -05:00
|
|
|
ValueType velocityHead(const double area, const ValueType& mass_rate,
|
|
|
|
const ValueType& density);
|
2019-11-24 04:11:50 -06:00
|
|
|
|
|
|
|
|
|
|
|
// calculating the viscosity of oil-water emulsion at local conditons
|
|
|
|
template <typename ValueType>
|
2022-08-29 08:59:28 -05:00
|
|
|
ValueType emulsionViscosity(const ValueType& water_fraction,
|
|
|
|
const ValueType& water_viscosity,
|
|
|
|
const ValueType& oil_fraction,
|
|
|
|
const ValueType& oil_viscosity,
|
|
|
|
const SICD& sicd);
|
2019-11-24 04:11:50 -06:00
|
|
|
|
2017-09-27 09:11:39 -05:00
|
|
|
} // namespace mswellhelpers
|
2022-08-29 08:59:28 -05:00
|
|
|
} // namespace Opm
|
2017-09-27 09:11:39 -05:00
|
|
|
|
|
|
|
#endif
|