Merge from Atgeirr.

This commit is contained in:
Bård Skaflestad 2010-10-26 13:16:27 +02:00
commit e073bfa081
5 changed files with 27 additions and 18 deletions

View File

@ -14,6 +14,7 @@ Makefile.in
Doxyfile
Doxyfile.in
aclocal.m4
am
autom4te.cache
config.*
configure

View File

@ -22,6 +22,7 @@
#define OPM_HYBRIDPRESSURESOLVER_HEADER_INCLUDED
#include "ifsh.h"
#include "sparse_sys.h"
#include "mimetic.h"
#include "GridAdapter.hpp"
#include <stdexcept>
@ -44,7 +45,7 @@ public:
/// Destructor.
~HybridPressureSolver()
{
ifsh_destroy(data_);
fsh_destroy(data_);
}
/// @brief
@ -142,19 +143,20 @@ public:
// Source terms from user.
double* src = const_cast<double*>(&sources[0]); // Ugly? Yes. Safe? I think so.
// Inner products are precomputed.
double* Binv = &Binv_[0];
// Gravity contribs are precomputed.
double* gpress = &gpress_[0];
// All well related things are zero.
well_control_t* wctrl = 0;
double* WI = 0;
double* wdp = 0;
double* totmob = const_cast<double*>(&total_mobilities[0]);
double* omega = const_cast<double*>(&omegas[0]);
// Scale inner products and gravity terms by saturation-dependent factors.
grid_t* g = grid_.c_grid();
Binv_mobilityweighted_.resize(Binv_.size());
mim_ip_mobility_update(g->number_of_cells, g->cell_facepos, &total_mobilities[0],
&Binv_[0], &Binv_mobilityweighted_[0]);
gpress_omegaweighted_.resize(gpress_.size());
mim_ip_density_update(g->number_of_cells, g->cell_facepos, &omegas[0],
&gpress_[0], &gpress_omegaweighted_[0]);
// Zero the linalg structures.
csrmatrix_zero(data_->A);
@ -163,7 +165,8 @@ public:
}
// Assemble the embedded linear system.
ifsh_assemble(&bc, src, Binv, gpress, wctrl, WI, wdp, totmob, omega, data_);
ifsh_assemble(&bc, src, &Binv_mobilityweighted_[0], &gpress_omegaweighted_[0],
wctrl, WI, wdp, data_);
state_ = Assembled;
}
@ -222,7 +225,8 @@ public:
cell_pressures.resize(num_cells, 0.0);
face_fluxes.clear();
face_fluxes.resize(num_faces, 0.0);
ifsh_press_flux(grid_.c_grid(), data_, &cell_pressures[0], &face_fluxes[0], 0, 0);
ifsh_press_flux(grid_.c_grid(), &Binv_mobilityweighted_[0], &gpress_omegaweighted_[0],
data_, &cell_pressures[0], &face_fluxes[0], 0, 0);
}
/// @brief
@ -273,15 +277,17 @@ private:
State state_;
// Solver data.
ifsh_data* data_;
fsh_data* data_;
// Grid.
GridAdapter grid_;
// Number of faces per cell.
std::vector<int> ncf_;
// B^{-1} storage.
std::vector<double> Binv_;
std::vector<double> Binv_mobilityweighted_;
// Gravity contributions.
std::vector<double> gpress_;
std::vector<double> gpress_omegaweighted_;
// Total mobilities.
std::vector<double> totmob_;
// Gravity coefficients (\omega = sum_{i = 1}^{num phases}f_i \rho_i[TODO: check this]).

3
fsh.h
View File

@ -20,6 +20,7 @@
#ifndef OPM_FSH_HEADER_INCLUDED
#define OPM_FHS_HEADER_INCLUDED
#include "fsh_common.h"
#include "grid.h"
#include "well.h"
#include "flow_bc.h"
@ -68,4 +69,4 @@ fsh_press_flux(grid_t *G,
#endif
#endif /* OPM_IFSH_HEADER_INCLUDED */
#endif /* OPM_FSH_HEADER_INCLUDED */

View File

@ -17,8 +17,8 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_IFSH_HEADER_INCLUDED
#define OPM_IFHS_HEADER_INCLUDED
#ifndef OPM_FSH_COMMON_HEADER_INCLUDED
#define OPM_FSH_COMMON_HEADER_INCLUDED
#ifdef __cplusplus
extern "C" {
@ -58,4 +58,4 @@ fsh_destroy(struct fsh_data *h);
#endif
#endif /* OPM_IFSH_HEADER_INCLUDED */
#endif /* OPM_FSH_COMMON_HEADER_INCLUDED */

5
ifsh.h
View File

@ -23,6 +23,7 @@
#include "grid.h"
#include "well.h"
#include "flow_bc.h"
#include "fsh_common.h"
#ifdef __cplusplus
extern "C" {
@ -72,7 +73,7 @@ ifsh_construct(grid_t *G, well_t *W);
* @param wdp \TODO
* @param totmob Cell-wise total mobilities to use for this assembly.
* @param omega Cell-wise phase densities weighted by fractional flow.
* @param h The ifsh_data object to use (and whose linear system will
* @param h The fsh_data object to use (and whose linear system will
* be modified). Must already be constructed.
*/
void
@ -89,7 +90,7 @@ ifsh_assemble(flowbc_t *bc,
* fluxes from face pressures.
*
* @param G The grid.
* @param h The ifsh_data object. You must have called ifsh_assemble()
* @param h The fsh_data object. You must have called ifsh_assemble()
* prior to this, and solved the embedded linear system of
* this object before you call ifsh_press_flux().
* @param cpress[out] Cell pressures.