merge
This commit is contained in:
commit
6b20238c13
@ -166,16 +166,16 @@ namespace Opm
|
||||
}
|
||||
|
||||
void SinglePvtLiveGas::evalBDeriv(const double press, const double* surfvol,
|
||||
double& B, double& dBdp) const
|
||||
double& Bval, double& dBdpval) const
|
||||
{
|
||||
if (surfvol[phase_pos_[Vapour]] == 0.0) {
|
||||
// To handle no-gas case.
|
||||
B = 1.0;
|
||||
dBdp = 0.0;
|
||||
Bval = 1.0;
|
||||
dBdpval = 0.0;
|
||||
return;
|
||||
}
|
||||
B = miscible_gas(press, surfvol, 1, false);
|
||||
dBdp = miscible_gas(press, surfvol, 1, true);
|
||||
Bval = miscible_gas(press, surfvol, 1, false);
|
||||
dBdpval = miscible_gas(press, surfvol, 1, true);
|
||||
}
|
||||
|
||||
double SinglePvtLiveGas::evalR(const double press, const double* surfvol) const
|
||||
@ -197,12 +197,12 @@ namespace Opm
|
||||
}
|
||||
|
||||
void SinglePvtLiveGas::evalRDeriv(const double press, const double* surfvol,
|
||||
double& R, double& dRdp) const
|
||||
double& Rval, double& dRdpval) const
|
||||
{
|
||||
if (surfvol[phase_pos_[Liquid]] == 0.0) {
|
||||
// To handle no-gas case.
|
||||
R = 0.0;
|
||||
dRdp = 0.0;
|
||||
Rval = 0.0;
|
||||
dRdpval = 0.0;
|
||||
return;
|
||||
}
|
||||
double satR = linearInterpolationExtrap(saturated_gas_table_[0],
|
||||
@ -210,14 +210,14 @@ namespace Opm
|
||||
double maxR = surfvol[phase_pos_[Liquid]]/surfvol[phase_pos_[Vapour]];
|
||||
if (satR < maxR ) {
|
||||
// Saturated case
|
||||
R = satR;
|
||||
dRdp = linearInterpolDerivative(saturated_gas_table_[0],
|
||||
Rval = satR;
|
||||
dRdpval = linearInterpolDerivative(saturated_gas_table_[0],
|
||||
saturated_gas_table_[3],
|
||||
press);
|
||||
} else {
|
||||
// Undersaturated case
|
||||
R = maxR;
|
||||
dRdp = 0.0;
|
||||
Rval = maxR;
|
||||
dRdpval = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,12 +227,12 @@ namespace Opm
|
||||
const bool deriv) const
|
||||
{
|
||||
int section;
|
||||
double R = linearInterpolationExtrap(saturated_gas_table_[0],
|
||||
saturated_gas_table_[3], press,
|
||||
section);
|
||||
double Rval = linearInterpolationExtrap(saturated_gas_table_[0],
|
||||
saturated_gas_table_[3], press,
|
||||
section);
|
||||
double maxR = surfvol[phase_pos_[Liquid]]/surfvol[phase_pos_[Vapour]];
|
||||
if (deriv) {
|
||||
if (R < maxR ) { // Saturated case
|
||||
if (Rval < maxR ) { // Saturated case
|
||||
return linearInterpolDerivative(saturated_gas_table_[0],
|
||||
saturated_gas_table_[item],
|
||||
press);
|
||||
@ -258,7 +258,7 @@ namespace Opm
|
||||
return val;
|
||||
}
|
||||
} else {
|
||||
if (R < maxR ) { // Saturated case
|
||||
if (Rval < maxR ) { // Saturated case
|
||||
return linearInterpolationExtrap(saturated_gas_table_[0],
|
||||
saturated_gas_table_[item],
|
||||
press);
|
||||
|
@ -243,10 +243,10 @@ namespace Opm
|
||||
|
||||
|
||||
void SinglePvtLiveOil::evalBDeriv(const double press, const double* surfvol,
|
||||
double& B, double& dBdp) const
|
||||
double& Bval, double& dBdpval) const
|
||||
{
|
||||
B = evalB(press, surfvol);
|
||||
dBdp = -B*B*miscible_oil(press, surfvol, 1, true);
|
||||
Bval = evalB(press, surfvol);
|
||||
dBdpval = -Bval*Bval*miscible_oil(press, surfvol, 1, true);
|
||||
}
|
||||
|
||||
double SinglePvtLiveOil::evalR(double press, const double* surfvol) const
|
||||
@ -254,36 +254,36 @@ namespace Opm
|
||||
if (surfvol[phase_pos_[Vapour]] == 0.0) {
|
||||
return 0.0;
|
||||
}
|
||||
double R = linearInterpolationExtrap(saturated_oil_table_[0],
|
||||
double Rval = linearInterpolationExtrap(saturated_oil_table_[0],
|
||||
saturated_oil_table_[3], press);
|
||||
double maxR = surfvol[phase_pos_[Vapour]]/surfvol[phase_pos_[Liquid]];
|
||||
if (R < maxR ) { // Saturated case
|
||||
return R;
|
||||
if (Rval < maxR ) { // Saturated case
|
||||
return Rval;
|
||||
} else {
|
||||
return maxR; // Undersaturated case
|
||||
}
|
||||
}
|
||||
|
||||
void SinglePvtLiveOil::evalRDeriv(const double press, const double* surfvol,
|
||||
double& R, double& dRdp) const
|
||||
double& Rval, double& dRdpval) const
|
||||
{
|
||||
if (surfvol[phase_pos_[Vapour]] == 0.0) {
|
||||
R = 0.0;
|
||||
dRdp = 0.0;
|
||||
Rval = 0.0;
|
||||
dRdpval = 0.0;
|
||||
return;
|
||||
}
|
||||
R = linearInterpolationExtrap(saturated_oil_table_[0],
|
||||
Rval = linearInterpolationExtrap(saturated_oil_table_[0],
|
||||
saturated_oil_table_[3], press);
|
||||
double maxR = surfvol[phase_pos_[Vapour]]/surfvol[phase_pos_[Liquid]];
|
||||
if (R < maxR ) {
|
||||
if (Rval < maxR ) {
|
||||
// Saturated case
|
||||
dRdp = linearInterpolDerivative(saturated_oil_table_[0],
|
||||
dRdpval = linearInterpolDerivative(saturated_oil_table_[0],
|
||||
saturated_oil_table_[3],
|
||||
press);
|
||||
} else {
|
||||
// Undersaturated case
|
||||
R = maxR;
|
||||
dRdp = 0.0;
|
||||
Rval = maxR;
|
||||
dRdpval = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,12 +294,12 @@ namespace Opm
|
||||
const bool deriv) const
|
||||
{
|
||||
int section;
|
||||
double R = linearInterpolationExtrap(saturated_oil_table_[0],
|
||||
saturated_oil_table_[3],
|
||||
press, section);
|
||||
double Rval = linearInterpolationExtrap(saturated_oil_table_[0],
|
||||
saturated_oil_table_[3],
|
||||
press, section);
|
||||
double maxR = (surfvol[phase_pos_[Liquid]] == 0.0) ? 0.0 : surfvol[phase_pos_[Vapour]]/surfvol[phase_pos_[Liquid]];
|
||||
if (deriv) {
|
||||
if (R < maxR ) { // Saturated case
|
||||
if (Rval < maxR ) { // Saturated case
|
||||
return linearInterpolDerivative(saturated_oil_table_[0],
|
||||
saturated_oil_table_[item],
|
||||
press);
|
||||
@ -321,7 +321,7 @@ namespace Opm
|
||||
return val;
|
||||
}
|
||||
} else {
|
||||
if (R < maxR ) { // Saturated case
|
||||
if (Rval < maxR ) { // Saturated case
|
||||
return linearInterpolationExtrap(saturated_oil_table_[0],
|
||||
saturated_oil_table_[item],
|
||||
press);
|
||||
|
@ -431,7 +431,7 @@ coarse_topology_build_final(int ncoarse_f, int nblk,
|
||||
int *subfacepos, int *subfaces)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
{
|
||||
int coarse_f, b1, b2, n, subpos, subface_valid;
|
||||
int coarse_f, b1, b2, n, subpos, subface_valid = 1;
|
||||
size_t i;
|
||||
struct hash_set *set;
|
||||
|
||||
@ -451,8 +451,6 @@ coarse_topology_build_final(int ncoarse_f, int nblk,
|
||||
coarse_f = 0;
|
||||
subpos = 0;
|
||||
|
||||
subface_valid = 1;
|
||||
|
||||
for (b1 = 0; (b1 < nblk) && subface_valid; b1++) {
|
||||
if (bns[b1] != NULL) {
|
||||
for (n = 0; n < bns[b1]->nneigh; n++) {
|
||||
|
@ -718,7 +718,7 @@ blkdof_fill(struct coarse_topology *ct,
|
||||
struct coarse_sys *sys)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
{
|
||||
int p, ret, dof;
|
||||
int p, ret = 0, dof;
|
||||
size_t b, nb;
|
||||
|
||||
nb = ct->nblocks;
|
||||
@ -749,7 +749,6 @@ blkdof_fill(struct coarse_topology *ct,
|
||||
if (sys->blkdof == NULL) {
|
||||
free(sys->blkdof_pos);
|
||||
sys->blkdof_pos = NULL;
|
||||
ret = 0;
|
||||
} else {
|
||||
sys->blkdof_pos[0] = 0;
|
||||
|
||||
|
@ -296,7 +296,7 @@ ifsh_ms_impl_construct(struct UnstructuredGrid *G ,
|
||||
LocalSolver linsolve)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
{
|
||||
int max_nconn, nb, nconn_tot;
|
||||
int max_nconn = -1, nb, nconn_tot;
|
||||
int expected_nconn, alloc_ok;
|
||||
|
||||
struct ifsh_ms_impl *new;
|
||||
|
@ -785,7 +785,7 @@ assemble_completion_to_well(int w, int c, int nc, int np,
|
||||
{
|
||||
int wdof;
|
||||
size_t jc, jw;
|
||||
double res, w2c, w2w;
|
||||
double res = 0.0, w2c = 0.0, w2w = 0.0;
|
||||
|
||||
switch (W->ctrl->ctrl[w]) {
|
||||
case BHP :
|
||||
|
@ -723,28 +723,3 @@ fill_cart_geometry_2d(struct UnstructuredGrid *G,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if UNIT_TEST
|
||||
int main(void)
|
||||
{
|
||||
|
||||
struct UnstructuredGrid *g = create_cart_grid_2d(2,2);
|
||||
int i;
|
||||
int k;
|
||||
for(i=0; i<g->number_of_cells; ++i)
|
||||
{
|
||||
fprintf(stderr, "%d: ", i);
|
||||
for (k=g->cell_facepos[i]; k<g->cell_facepos[i+1]; ++k)
|
||||
{
|
||||
fprintf(stderr, "%d ", g->cell_faces[k]);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
free_grid(g);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -85,9 +85,9 @@ namespace Opm {
|
||||
return path_;
|
||||
}
|
||||
|
||||
ParameterGroup::ParameterGroup(const std::string& path,
|
||||
ParameterGroup::ParameterGroup(const std::string& patharg,
|
||||
const ParameterGroup* parent)
|
||||
: path_(path), parent_(parent), output_is_enabled_(true)
|
||||
: path_(patharg), parent_(parent), output_is_enabled_(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,8 @@ namespace Opm {
|
||||
namespace parameter {
|
||||
|
||||
namespace tinyxml {
|
||||
std::string getProperty(const std::string& property,
|
||||
const TiXmlElement* node_ptr);
|
||||
void read_xml(ParameterGroup& pg, const std::string filename);
|
||||
void fill_tree(ParameterGroup& pg,
|
||||
const TiXmlNode* root,
|
||||
|
@ -667,7 +667,7 @@ int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const
|
||||
}
|
||||
|
||||
|
||||
int TiXmlElement::QueryUnsignedAttribute( const char* name, unsigned* value ) const
|
||||
int TiXmlElement::QueryUnsignedAttribute( const char* name, unsigned* valuearg ) const
|
||||
{
|
||||
const TiXmlAttribute* node = attributeSet.Find( name );
|
||||
if ( !node )
|
||||
@ -675,7 +675,7 @@ int TiXmlElement::QueryUnsignedAttribute( const char* name, unsigned* value ) co
|
||||
|
||||
int ival = 0;
|
||||
int result = node->QueryIntValue( &ival );
|
||||
*value = (unsigned)ival;
|
||||
*valuearg = (unsigned)ival;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ monotcubicinterpolator_test \
|
||||
param_test \
|
||||
sparsetable_test \
|
||||
sparsevector_test \
|
||||
test_cartgrid \
|
||||
test_column_extract \
|
||||
test_lapack \
|
||||
test_readpolymer \
|
||||
@ -30,6 +31,7 @@ sparsetable_test_SOURCES = sparsetable_test.cpp
|
||||
sparsetable_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LDADD)
|
||||
sparsevector_test_SOURCES = sparsevector_test.cpp
|
||||
sparsevector_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LDADD)
|
||||
test_cartgrid_SOURCES = test_cartgrid.cpp
|
||||
test_column_extract_SOURCES = test_column_extract.cpp
|
||||
test_column_extract_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LDADD)
|
||||
test_lapack_SOURCES = test_lapack.cpp
|
||||
|
41
tests/test_cartgrid.cpp
Normal file
41
tests/test_cartgrid.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
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/utility/cpgpreprocess/cgridinterface.h>
|
||||
#include <opm/core/utility/cart_grid.h>
|
||||
#include <opm/core/grid.h>
|
||||
#include <cstdio>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
using namespace std;
|
||||
struct UnstructuredGrid *g = create_cart_grid_2d(2, 2);
|
||||
int i;
|
||||
int k;
|
||||
for (i = 0; i < g->number_of_cells; ++i) {
|
||||
fprintf(stderr, "%d: ", i);
|
||||
for (k = g->cell_facepos[i]; k < g->cell_facepos[i + 1]; ++k) {
|
||||
fprintf(stderr, "%d ", g->cell_faces[k]);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
free_grid(g);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user