Merge from upstream.

This commit is contained in:
Bård Skaflestad 2012-03-07 19:18:57 +01:00
commit a8df219344
7 changed files with 181 additions and 11 deletions

View File

@ -31,7 +31,7 @@ namespace Opm
class EclipseGridParser;
/// This class manages an Wells in the sense that it
/// This class manages a Wells struct in the sense that it
/// encapsulates creation and destruction of the wells
/// data structure.
/// The resulting Wells is available through the c_wells() method.

View File

@ -0,0 +1,87 @@
/*
Copyright 2012 SINTEF ICT, Applied Mathematics.
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 <opm/core/pressure/FlowBCManager.hpp>
#include <opm/core/utility/ErrorMacros.hpp>
namespace Opm
{
/// Default constructor sets up empty boundary conditions.
/// By convention, this is equivalent to all-noflow conditions.
FlowBCManager::FlowBCManager()
: bc_(0)
{
bc_ = flow_conditions_construct(0);
if (!bc_) {
THROW("Failed to construct FlowBoundaryConditions struct.");
}
}
/// Destructor.
FlowBCManager::~FlowBCManager()
{
flow_conditions_destroy(bc_);
}
/// Remove all appended BCs.
/// By convention, BCs are now equivalent to all-noflow conditions.
void FlowBCManager::clear()
{
flow_conditions_clear(bc_);
}
/// Append a single boundary condition.
/// If the type is BC_NOFLOW the value argument is not used.
/// If the type is BC_PRESSURE the value argument is a pressure value.
/// If the type is BC_FLUX_TOTVOL the value argument is a total flux value (m^3/s).
/// Note: unset boundary conditions are noflow by convention,
/// so it is normally not necessary to explicitly append
/// BC_NOFLOW conditions. However, it may make sense to do so
/// if the bc will change during a simulation run.
/// Note: if normal velocity bcs are desired, convert to
/// fluxes by multiplying with face area.
void FlowBCManager::append(const FlowBCType type,
const int face,
const double value)
{
int ok = flow_conditions_append(type, face, value, bc_);
if (!ok) {
THROW("Failed to append boundary condition for face " << face);
}
}
/// Access the managed boundary conditions.
/// The method is named similarly to c_str() in std::string,
/// to make it clear that we are returning a C-compatible struct.
const FlowBoundaryConditions* FlowBCManager::c_bcs() const
{
return bc_;
}
} // namespace Opm

View File

@ -0,0 +1,75 @@
/*
Copyright 2012 SINTEF ICT, Applied Mathematics.
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_FLOWBCMANAGER_HEADER_INCLUDED
#define OPM_FLOWBCMANAGER_HEADER_INCLUDED
#include <opm/core/pressure/flow_bc.h>
namespace Opm
{
/// This class manages a FlowBoundaryConditions struct in the
/// sense that it encapsulates creation and destruction of the
/// data structure.
/// The resulting struct is available through the c_bcs() method.
class FlowBCManager
{
public:
/// Default constructor sets up empty boundary conditions.
/// By convention, this is equivalent to all-noflow conditions.
FlowBCManager();
/// Destructor.
~FlowBCManager();
/// Remove all appended BCs.
/// By convention, BCs are now equivalent to all-noflow conditions.
void clear();
/// Append a single boundary condition.
/// If the type is BC_NOFLOW the value argument is not used.
/// If the type is BC_PRESSURE the value argument is a pressure value.
/// If the type is BC_FLUX_TOTVOL the value argument is a total flux value (m^3/s).
/// Note: unset boundary conditions are noflow by convention,
/// so it is normally not necessary to explicitly append
/// BC_NOFLOW conditions. However, it may make sense to do so
/// if the bc will change during a simulation run.
/// Note: if normal velocity bcs are desired, convert to
/// fluxes by multiplying with face area.
void append(const FlowBCType type,
const int face,
const double value);
/// Access the managed boundary conditions.
/// The method is named similarly to c_str() in std::string,
/// to make it clear that we are returning a C-compatible struct.
const FlowBoundaryConditions* c_bcs() const;
private:
// Disable copying and assignment.
FlowBCManager(const FlowBCManager& other);
FlowBCManager& operator=(const FlowBCManager& other);
// The managed struct.
FlowBoundaryConditions* bc_;
};
} // namespace Opm
#endif // OPM_FLOWBCMANAGER_HEADER_INCLUDED

View File

@ -21,8 +21,10 @@
#include <opm/core/pressure/tpfa/ifs_tpfa.h>
#include <opm/core/pressure/tpfa/trans_tpfa.h>
#include <opm/core/pressure/mimetic/mimetic.h>
#include <opm/core/pressure/flow_bc.h>
#include <opm/core/linalg/LinearSolverInterface.hpp>
#include <opm/core/utility/ErrorMacros.hpp>
#include <opm/core/pressure/flow_bc.h>
namespace Opm
{
@ -81,13 +83,16 @@ namespace Opm
/// \param[in] src Must contain N source rates (one per cell).
/// Positive values represent total inflow rates,
/// negative values represent total outflow rates.
/// \param[in] bcs If non-null, specifies boundary conditions.
/// If null, noflow conditions are assumed.
/// \param[out] pressure Will contain N cell-pressure values.
/// \param[out] faceflux Will contain F signed face flux values.
void IncompTpfa::solve(const std::vector<double>& totmob,
const std::vector<double>& omega,
const std::vector<double>& src,
std::vector<double>& pressure,
std::vector<double>& faceflux)
const std::vector<double>& omega,
const std::vector<double>& src,
const FlowBoundaryConditions* bcs,
std::vector<double>& pressure,
std::vector<double>& faceflux)
{
UnstructuredGrid* gg = const_cast<UnstructuredGrid*>(&grid_);
tpfa_eff_trans_compute(gg, &totmob[0], &htrans_[0], &trans_[0]);
@ -105,9 +110,9 @@ namespace Opm
}
}
ifs_tpfa_forces F;
F.src = &src[0];
F.bc = 0; // No boundary conditions.
const ifs_tpfa_forces F = { &src[0], bcs };
//F.src = &src[0];
//F.bc = bcs;
ifs_tpfa_assemble(gg, &F, &trans_[0], &gpress_omegaweighted_[0], h_);

View File

@ -25,7 +25,7 @@
struct UnstructuredGrid;
struct ifs_tpfa_data;
struct FlowBoundaryConditions;
namespace Opm
{
@ -64,11 +64,14 @@ namespace Opm
/// \param[in] src Must contain N source rates (one per cell).
/// Positive values represent total inflow rates,
/// negative values represent total outflow rates.
/// \param[in] bcs If non-null, specifies boundary conditions.
/// If null, noflow conditions are assumed.
/// \param[out] pressure Will contain N cell-pressure values.
/// \param[out] faceflux Will contain F signed face flux values.
void solve(const std::vector<double>& totmob,
const std::vector<double>& omega,
const std::vector<double>& src,
const FlowBoundaryConditions* bcs,
std::vector<double>& pressure,
std::vector<double>& faceflux);

View File

@ -153,7 +153,7 @@ compute_grav_term(struct UnstructuredGrid *G, const double *gpress,
/* ---------------------------------------------------------------------- */
static int
assemble_bc_contrib(struct UnstructuredGrid *G ,
struct FlowBoundaryConditions *bc ,
const struct FlowBoundaryConditions *bc ,
const double *trans,
struct ifs_tpfa_data *h )
/* ---------------------------------------------------------------------- */

View File

@ -41,7 +41,7 @@ struct ifs_tpfa_data {
struct ifs_tpfa_forces {
const double *src;
struct FlowBoundaryConditions *bc;
const struct FlowBoundaryConditions *bc;
};