From 1fa947d089825bf5f3b24b0f8d606fe0cf6a3d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Tue, 26 Oct 2010 12:30:42 +0200 Subject: [PATCH 1/7] Fixed include guards. --- fsh_common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fsh_common.h b/fsh_common.h index 9ba62402..3abdf83b 100644 --- a/fsh_common.h +++ b/fsh_common.h @@ -17,8 +17,8 @@ along with OPM. If not, see . */ -#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 */ From 94b4cbbe79f19f50dac2b6744e83d34d6833557f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Tue, 26 Oct 2010 12:31:10 +0200 Subject: [PATCH 2/7] Now includes fsh_common.h for fsh_destroy(). --- fsh.h | 3 ++- ifsh.h | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fsh.h b/fsh.h index 4bc5b58b..0fb5c8cb 100644 --- a/fsh.h +++ b/fsh.h @@ -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 */ diff --git a/ifsh.h b/ifsh.h index 8a51799e..e4878fdc 100644 --- a/ifsh.h +++ b/ifsh.h @@ -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. From 3c5af2693160965ec2cca0f761f702c9e372e8b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Tue, 26 Oct 2010 12:31:58 +0200 Subject: [PATCH 3/7] Fixed name of declared function. --- fsh_common_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsh_common_impl.h b/fsh_common_impl.h index 04992770..6139e642 100644 --- a/fsh_common_impl.h +++ b/fsh_common_impl.h @@ -74,6 +74,6 @@ void fsh_define_cell_wells(size_t nc, well_t *W, struct fsh_impl *pimpl); void -fsh_define_sys_arrays(struct fsh_data *h); +fsh_define_linsys_arrays(struct fsh_data *h); #endif /* OPM_FSH_COMMON_IMPL_HEADER_INCLUDED */ From e78b1580a51c7287b8bd0890af604351c1bd6135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Tue, 26 Oct 2010 12:32:30 +0200 Subject: [PATCH 4/7] Fixed const-correctness warning. --- trans_tpfa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trans_tpfa.c b/trans_tpfa.c index 86cfa75c..4fbcae70 100644 --- a/trans_tpfa.c +++ b/trans_tpfa.c @@ -16,7 +16,7 @@ tpfa_htrans_compute(grid_t *G, const double *perm, double *htrans) double Kn[3]; double *cc, *fc, *n; - double *K; + const double *K; MAT_SIZE_T nrows, ncols, ldA, incx, incy; double a1, a2; From fd1e772b76df3ee94c2087b3bc1b6b43e1db2dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Tue, 26 Oct 2010 12:33:13 +0200 Subject: [PATCH 5/7] Temporary commit. Transition to new ifsh interface unfinished. --- HybridPressureSolver.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/HybridPressureSolver.hpp b/HybridPressureSolver.hpp index 5c433be2..11e97360 100644 --- a/HybridPressureSolver.hpp +++ b/HybridPressureSolver.hpp @@ -22,6 +22,7 @@ #define OPM_HYBRIDPRESSURESOLVER_HEADER_INCLUDED #include "ifsh.h" +#include "sparse_sys.h" #include "mimetic.h" #include "GridAdapter.hpp" #include @@ -44,7 +45,7 @@ public: /// Destructor. ~HybridPressureSolver() { - ifsh_destroy(data_); + fsh_destroy(data_); } /// @brief @@ -216,13 +217,15 @@ public: "You must call assemble() (and solve the linear system) " "prior to calling computePressuresAndFluxes()."); } + const double* Binv = &Binv_[0]; + const double* gpress = &gpress_[0]; int num_cells = grid_.c_grid()->number_of_cells; int num_faces = grid_.c_grid()->number_of_faces; cell_pressures.clear(); 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, gpress, data_, &cell_pressures[0], &face_fluxes[0], 0, 0); } /// @brief @@ -273,7 +276,7 @@ private: State state_; // Solver data. - ifsh_data* data_; + fsh_data* data_; // Grid. GridAdapter grid_; // Number of faces per cell. From 9315bae82fe58c2e46a7fedb832f665df950a69f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Tue, 26 Oct 2010 12:35:27 +0200 Subject: [PATCH 6/7] For some reason, weird stuff happened in merging .hgignore, removed duplicates. --- .hgignore | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.hgignore b/.hgignore index 94722d69..a56ad5f7 100644 --- a/.hgignore +++ b/.hgignore @@ -10,10 +10,6 @@ syntax: glob *.pc stamp-* -Makefile -Makefile.in -Doxyfile -Doxyfile.in Makefile Makefile.in Doxyfile From 8fee3b3963f06313547f18178e8100c6f89bd219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Tue, 26 Oct 2010 12:51:34 +0200 Subject: [PATCH 7/7] Fixed to conform with new interface (ifsh now wants effective inner products etc.). --- HybridPressureSolver.hpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/HybridPressureSolver.hpp b/HybridPressureSolver.hpp index 11e97360..5859b064 100644 --- a/HybridPressureSolver.hpp +++ b/HybridPressureSolver.hpp @@ -143,19 +143,20 @@ public: // Source terms from user. double* src = const_cast(&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(&total_mobilities[0]); - double* omega = const_cast(&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); @@ -164,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; } @@ -217,15 +219,14 @@ public: "You must call assemble() (and solve the linear system) " "prior to calling computePressuresAndFluxes()."); } - const double* Binv = &Binv_[0]; - const double* gpress = &gpress_[0]; int num_cells = grid_.c_grid()->number_of_cells; int num_faces = grid_.c_grid()->number_of_faces; cell_pressures.clear(); cell_pressures.resize(num_cells, 0.0); face_fluxes.clear(); face_fluxes.resize(num_faces, 0.0); - ifsh_press_flux(grid_.c_grid(), Binv, gpress, 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 @@ -283,8 +284,10 @@ private: std::vector ncf_; // B^{-1} storage. std::vector Binv_; + std::vector Binv_mobilityweighted_; // Gravity contributions. std::vector gpress_; + std::vector gpress_omegaweighted_; // Total mobilities. std::vector totmob_; // Gravity coefficients (\omega = sum_{i = 1}^{num phases}f_i \rho_i[TODO: check this]).