Further changes to implement group data (IGRP and SGRP)
Plus updating source code to the latest github version of the rest of the OPM code
This commit is contained in:
@@ -40,7 +40,6 @@ namespace Opm { namespace RestartIO { namespace Helpers {
|
||||
class AggregateGroupData
|
||||
{
|
||||
public:
|
||||
//std::vector< const Group* > currentGroups(Opm::Schedule& sched, size_t reportStep);
|
||||
explicit AggregateGroupData(const std::vector<int>& inteHead);
|
||||
|
||||
void captureDeclaredGroupData( const Schedule& sched,
|
||||
|
||||
@@ -72,6 +72,17 @@ namespace RestartIO {
|
||||
the report step argument '99'.
|
||||
*/
|
||||
|
||||
/*void save(const std::string& filename,
|
||||
int report_step,
|
||||
double seconds_elapsed,
|
||||
data::Solution cells,
|
||||
data::Wells wells,
|
||||
const EclipseState& es,
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& schedule,
|
||||
std::map<std::string, std::vector<double>> extra_data = {},
|
||||
bool write_double = false);
|
||||
*/
|
||||
void save(const std::string& filename,
|
||||
int report_step,
|
||||
double seconds_elapsed,
|
||||
@@ -81,7 +92,6 @@ void save(const std::string& filename,
|
||||
const Schedule& schedule,
|
||||
bool write_double = false);
|
||||
|
||||
|
||||
RestartValue load( const std::string& filename,
|
||||
int report_step,
|
||||
const std::vector<RestartKey>& solution_keys,
|
||||
|
||||
@@ -57,8 +57,7 @@ namespace Opm { namespace RestartIO { namespace Helpers {
|
||||
const Schedule& sched,
|
||||
const double simTime,
|
||||
const int num_solver_steps,
|
||||
const int lookup_step, // The integer index used to look up dynamic properties, e.g. the number of well.
|
||||
const int report_step); // The integer number this INTEHEAD keyword will be saved to, typically report_step = lookup_step + 1.
|
||||
const int lookup_step); // The integer index used to look up dynamic properties, e.g. the number of well.
|
||||
|
||||
std::vector<bool>
|
||||
createLogiHead(const EclipseState& es);
|
||||
|
||||
@@ -968,7 +968,7 @@ void ecl_kw_iset_type(::Opm::RestartIO::ecl_kw_type * ecl_kw, ::Opm::RestartIO::
|
||||
#undef ECL_DOUBLE
|
||||
#undef ECL_BOOL
|
||||
#undef ECL_CHAR
|
||||
#undef ECL_MESS
|
||||
//#undef ECL_MESS
|
||||
#undef ECL_STRING
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -978,7 +978,7 @@ void ecl_kw_iset_type(::Opm::RestartIO::ecl_kw_type * ecl_kw, ::Opm::RestartIO::
|
||||
#define ECL_DOUBLE ::Opm::RestartIO::ecl_data_type{ ECL_DOUBLE_TYPE, sizeof(double)}
|
||||
#define ECL_BOOL ::Opm::RestartIO::ecl_data_type{ ECL_BOOL_TYPE, sizeof(int)}
|
||||
#define ECL_CHAR ::Opm::RestartIO::ecl_data_type{ ECL_CHAR_TYPE, ECL_STRING8_LENGTH + 1}
|
||||
#define ECL_MESS ::Opm::RestartIO::ecl_data_type{ ECL_MESS_TYPE, 0}
|
||||
#define ECL_MESS_2 ::Opm::RestartIO::ecl_data_type{ ECL_MESS_TYPE, 0}
|
||||
#define ECL_STRING(size) ::Opm::RestartIO::ecl_data_type{ECL_STRING_TYPE, (size) + 1}
|
||||
|
||||
}
|
||||
@@ -990,7 +990,7 @@ void ecl_kw_iset_type(::Opm::RestartIO::ecl_kw_type * ecl_kw, ::Opm::RestartIO::
|
||||
#define ECL_FLOAT (::Opm::RestartIO::ecl_data_type) {.type = ECL_FLOAT_TYPE, .element_size = sizeof(float)}
|
||||
#define ECL_DOUBLE (::Opm::RestartIO::ecl_data_type) {.type = ECL_DOUBLE_TYPE, .element_size = sizeof(double)}
|
||||
#define ECL_BOOL (::Opm::RestartIO::ecl_data_type) {.type = ECL_BOOL_TYPE, .element_size = sizeof(int)}
|
||||
#define ECL_MESS (::Opm::RestartIO::ecl_data_type) {.type = ECL_MESS_TYPE, .element_size = 0}
|
||||
#define ECL_MESS_2 (::Opm::RestartIO::ecl_data_type) {.type = ECL_MESS_TYPE, .element_size = 0}
|
||||
#define ECL_STRING(size) (::Opm::RestartIO::ecl_data_type) {.type = ECL_STRING_TYPE, .element_size = (size) + 1}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
@@ -374,9 +374,10 @@ namespace {
|
||||
if (childWells.size() != 0) {
|
||||
//group has child wells
|
||||
//std::cout << "IGrpArray - staticContrib: childwells for group.name(): " << group.name() << "childWells - size: " << childWells.size() << std::endl;
|
||||
for (const auto well : childWells ) {
|
||||
//std::cout << "Child well name: " << well->name() << " Well seqIndex(): " << well->seqIndex() << std::endl;
|
||||
igrp[igrpCount] = well->seqIndex()+1;
|
||||
//for (const auto well : childWells ) {
|
||||
for ( auto it = childWells.begin() ; it != childWells.end(); it++) {
|
||||
//std::cout << "Child well name: " << it->name() << " Well seqIndex(): " << it->seqIndex() << std::endl;
|
||||
igrp[igrpCount] = (*it)->seqIndex()+1;
|
||||
igrpCount+=1;
|
||||
//std::cout << "childWells: igrpCount after increment: " << igrpCount << std::endl;
|
||||
}
|
||||
@@ -386,9 +387,10 @@ namespace {
|
||||
//The field group always has seqIndex = 0 because it is always defined first
|
||||
//Hence the all groups except the Field group uses the seqIndex assigned
|
||||
//std::cout << "IGrpArray - staticContrib: childGroups for group.name(): " << group.name() << "childGroups - size: " << childGroups.size() << std::endl;
|
||||
for (const auto grp : childGroups ) {
|
||||
//std::cout << "Child Group name: " << grp->name() << " Group seqIndex(): " << grp->seqIndex()-1 << std::endl;
|
||||
igrp[igrpCount] = grp->seqIndex();
|
||||
//for (const auto grp : childGroups ) {
|
||||
for ( auto it = childGroups.begin() ; it != childGroups.end(); it++) {
|
||||
//std::cout << "Child Group name: " << it->name() << " Group seqIndex(): " << it->seqIndex()-1 << std::endl;
|
||||
igrp[igrpCount] = (*it)->seqIndex();
|
||||
igrpCount+=1;
|
||||
//std::cout << "childGroups: igrpCount after increment: " << igrpCount << std::endl;
|
||||
}
|
||||
|
||||
@@ -198,8 +198,7 @@ namespace {
|
||||
getNoGroups(const ::Opm::Schedule& sched,
|
||||
const std::size_t step)
|
||||
{
|
||||
const std::size_t simStep = step == 0 ? 0 : step - 1;
|
||||
const auto ngroups = sched.numGroups(simStep)-1;
|
||||
const auto ngroups = sched.numGroups(step)-1;
|
||||
|
||||
return {
|
||||
ngroups
|
||||
@@ -218,8 +217,8 @@ createInteHead(const EclipseState& es,
|
||||
const Schedule& sched,
|
||||
const double simTime,
|
||||
const int num_solver_steps,
|
||||
const int lookup_step,
|
||||
const int report_step)
|
||||
const int lookup_step
|
||||
)
|
||||
{
|
||||
const auto& rspec = es.runspec();
|
||||
const auto& tdim = es.getTableManager();
|
||||
@@ -242,12 +241,12 @@ createInteHead(const EclipseState& es,
|
||||
// n{isx}aaqz: number of data elements per aquifer in {ISX}AAQ
|
||||
// n{isa}caqz: number of data elements per aquifer connection in {ISA}CAQ
|
||||
.params_NAAQZ (1, 18, 24, 10, 7, 2, 4)
|
||||
.stepParam (num_solver_steps, report_step)
|
||||
.stepParam (num_solver_steps, lookup_step)
|
||||
.tuningParam (getTuningPars(sched.getTuning(), lookup_step))
|
||||
.wellSegDimensions (getWellSegDims(rspec, sched, lookup_step))
|
||||
.regionDimensions (getRegDims(tdim, rdim))
|
||||
.ngroups(getNoGroups(sched, report_step))
|
||||
.variousParam (2014, 100) // Output should be compatible with Eclipse 100, 2014 version.
|
||||
.ngroups(getNoGroups(sched, lookup_step))
|
||||
.variousParam (2014, 100) // Output should be compatible with Eclipse 100, 2014 version.
|
||||
;
|
||||
|
||||
return ih.data();
|
||||
|
||||
@@ -593,10 +593,10 @@ params_NAAQZ(const int ncamax,
|
||||
|
||||
Opm::RestartIO::InteHEAD&
|
||||
Opm::RestartIO::InteHEAD::
|
||||
stepParam(const int num_solver_steps, const int report_step)
|
||||
stepParam(const int num_solver_steps, const int sim_step)
|
||||
{
|
||||
this -> data_[NUM_SOLVER_STEPS] = num_solver_steps;
|
||||
this -> data_[REPORT_STEP] = report_step;
|
||||
this -> data_[REPORT_STEP] = sim_step+1;
|
||||
|
||||
|
||||
|
||||
@@ -623,7 +623,7 @@ Opm::RestartIO::InteHEAD::variousParam(const int version,
|
||||
this->data_[VERSION] = version;
|
||||
this->data_[IPROG] = iprog;
|
||||
// ih_076: Usage unknown, experiments fails (zero determinant in well message) with too low numbers. 5 is highest observed across reference cases.
|
||||
this->data_[ih_076] = 5;
|
||||
this->data_[ih_076] = 2;
|
||||
// ih_101: Usage unknown, value fixed across reference cases.
|
||||
this->data_[ih_101] = 1;
|
||||
// ih_103: Usage unknown, value not fixed across reference cases, experiments generate warning with 0 but not with 1.
|
||||
|
||||
@@ -148,18 +148,18 @@ variousParam(const bool e300_radial, const bool e100_radial, const int nswlmx)
|
||||
this -> data_[lh_001] = true;
|
||||
this -> data_[lh_003] = e300_radial;
|
||||
this -> data_[lh_004] = e100_radial;
|
||||
this -> data_[lh_016] = true;
|
||||
this -> data_[lh_018] = true;
|
||||
this -> data_[lh_031] = true;
|
||||
this -> data_[lh_044] = true;
|
||||
//this -> data_[lh_016] = true;
|
||||
//this -> data_[lh_018] = true;
|
||||
//this -> data_[lh_031] = true;
|
||||
//this -> data_[lh_044] = true;
|
||||
this -> data_[lh_075] = nswlmx >= 1; // True if MS Wells exist.
|
||||
this -> data_[lh_076] = true;
|
||||
this -> data_[lh_087] = true;
|
||||
this -> data_[lh_099] = true;
|
||||
this -> data_[lh_113] = true;
|
||||
this -> data_[lh_114] = true;
|
||||
this -> data_[lh_115] = true;
|
||||
this -> data_[lh_117] = true;
|
||||
//this -> data_[lh_076] = true;
|
||||
//this -> data_[lh_087] = true;
|
||||
//this -> data_[lh_099] = true;
|
||||
//this -> data_[lh_113] = true;
|
||||
//this -> data_[lh_114] = true;
|
||||
//this -> data_[lh_115] = true;
|
||||
//this -> data_[lh_117] = true;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ writeHeader(::Opm::RestartIO::ecl_rst_file_type* rst_file,
|
||||
::Opm::RestartIO::ecl_rst_file_fwrite_SEQNUM(rst_file, report_step);
|
||||
|
||||
// write INTEHEAD to restart file
|
||||
const auto ih = Helpers::createInteHead(es, grid, schedule, simTime, sim_step);
|
||||
const auto ih = Helpers::createInteHead(es, grid, schedule, simTime, sim_step, sim_step);
|
||||
|
||||
write_kw(rst_file, EclKW<int>("INTEHEAD", ih));
|
||||
|
||||
@@ -676,6 +676,7 @@ void writeGroup(::Opm::RestartIO::ecl_rst_file_type * rst_file,
|
||||
}
|
||||
// temporarily comment out jals original version
|
||||
/*void writeSolution(::Opm::RestartIO::ecl_rst_file_type* rst_file, const data::Solution& solution, bool write_double) {
|
||||
void writeSolution(::Opm::RestartIO::ecl_rst_file_type* rst_file, const data::Solution& solution, bool write_double) {
|
||||
::Opm::RestartIO::ecl_rst_file_start_solution( rst_file );
|
||||
for (const auto& elm: solution) {
|
||||
if (elm.second.target == data::TargetType::RESTART_SOLUTION)
|
||||
|
||||
@@ -4217,13 +4217,13 @@ void ecl_rst_file_fwrite_header( ::Opm::RestartIO::ecl_rst_file_type * rst_file
|
||||
}
|
||||
|
||||
void ecl_rst_file_start_solution( Opm::RestartIO::ecl_rst_file_type * rst_file ) {
|
||||
::Opm::RestartIO::ecl_kw_type * startsol_kw = ::Opm::RestartIO::ecl_kw_alloc( STARTSOL_KW , 0 , ECL_MESS );
|
||||
::Opm::RestartIO::ecl_kw_type * startsol_kw = ::Opm::RestartIO::ecl_kw_alloc( STARTSOL_KW , 0 , ECL_MESS_2 );
|
||||
::Opm::RestartIO::ecl_kw_fwrite( startsol_kw , rst_file->fortio );
|
||||
::Opm::RestartIO::ecl_kw_free( startsol_kw );
|
||||
}
|
||||
|
||||
void ecl_rst_file_end_solution( ::Opm::RestartIO::ecl_rst_file_type * rst_file ) {
|
||||
::Opm::RestartIO::ecl_kw_type * endsol_kw = ::Opm::RestartIO::ecl_kw_alloc( ENDSOL_KW , 0 , ECL_MESS );
|
||||
::Opm::RestartIO::ecl_kw_type * endsol_kw = ::Opm::RestartIO::ecl_kw_alloc( ENDSOL_KW , 0 , ECL_MESS_2 );
|
||||
::Opm::RestartIO::ecl_kw_fwrite( endsol_kw , rst_file->fortio );
|
||||
::Opm::RestartIO::ecl_kw_free( endsol_kw );
|
||||
}
|
||||
@@ -4497,7 +4497,7 @@ static size_t get_ecl_string_length(const char * type_name) {
|
||||
else if (::Opm::RestartIO::is_ecl_string_name(type_name))
|
||||
return ECL_STRING(::Opm::RestartIO::get_ecl_string_length(type_name));
|
||||
else if (strncmp( type_name , ECL_TYPE_NAME_MESSAGE , ECL_TYPE_LENGTH) == 0)
|
||||
return ECL_MESS;
|
||||
return ECL_MESS_2;
|
||||
else if (strncmp( type_name , ECL_TYPE_NAME_BOOL , ECL_TYPE_LENGTH) == 0)
|
||||
return ECL_BOOL;
|
||||
else {
|
||||
@@ -4617,7 +4617,7 @@ void * ecl_kw_get_ptr(const ::Opm::RestartIO::ecl_kw_type *ecl_kw) {
|
||||
case(ECL_BOOL_TYPE):
|
||||
return ECL_BOOL;
|
||||
case(ECL_MESS_TYPE):
|
||||
return ECL_MESS;
|
||||
return ECL_MESS_2;
|
||||
case(ECL_STRING_TYPE):
|
||||
util_abort("%s: Variable length string type cannot be created"
|
||||
" from type alone!\n" , __func__);
|
||||
|
||||
@@ -78,10 +78,15 @@ std::vector< std::string > GroupTree::children( const std::string& other_parent
|
||||
throw std::out_of_range( "Node '" + other_parent + "' does not exist." );
|
||||
|
||||
std::vector< std::string > kids;
|
||||
for( const auto& node : this->groups ) {
|
||||
/* for( const auto& node : this->groups ) {
|
||||
if( node.parent != other_parent ) continue;
|
||||
kids.push_back( node.name );
|
||||
}
|
||||
*/
|
||||
for( auto it = this->groups.begin(); it != this->groups.end(); it++ ) {
|
||||
if( (*it).parent != other_parent ) continue;
|
||||
kids.push_back( (*it).name );
|
||||
}
|
||||
|
||||
return kids;
|
||||
}
|
||||
|
||||
@@ -1545,8 +1545,9 @@ namespace Opm {
|
||||
if (group.hasBeenDefined( timeStep )) {
|
||||
const GroupTree& group_tree = getGroupTree( timeStep );
|
||||
const auto& ch_grps = group_tree.children( group_name );
|
||||
for (const std::string& group_name : ch_grps) {
|
||||
child_groups.push_back( &getGroup(group_name));
|
||||
//for (const std::string& group_name : ch_grps) {
|
||||
for ( auto it = ch_grps.begin() ; it != ch_grps.end(); it++) {
|
||||
child_groups.push_back( &getGroup(*it));
|
||||
}
|
||||
}
|
||||
return child_groups;
|
||||
@@ -1565,8 +1566,10 @@ namespace Opm {
|
||||
const auto& child_groups = group_tree.children( group_name );
|
||||
|
||||
if (!child_groups.size()) {
|
||||
for (const auto& well_name : group.getWells( timeStep )) {
|
||||
wells.push_back( getWell( well_name ));
|
||||
//for (const auto& well_name : group.getWells( timeStep )) {
|
||||
const auto& ch_wells = group.getWells( timeStep );
|
||||
for (auto it= ch_wells.begin(); it != ch_wells.end(); it++) {
|
||||
wells.push_back( getWell( *it ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user