diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 5ab278db..3e592fd9 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -223,15 +223,10 @@ list (APPEND EXAMPLE_SOURCE_FILES # originally generated with the command: # find attic -name '*.c*' -printf '\t%p\n' | sort list (APPEND ATTIC_FILES - attic/bo_resprop_test.cpp - attic/pvt_test.cpp - attic/relperm_test.cpp attic/test_cfs_tpfa.c - attic/test_ert.cpp attic/test_jacsys.cpp attic/test_lapack.cpp attic/test_read_grid.c - attic/test_readpolymer.cpp attic/test_read_vag.cpp attic/test_writeVtkData.cpp ) diff --git a/attic/bo_resprop_test.cpp b/attic/bo_resprop_test.cpp deleted file mode 100644 index 98a25306..00000000 --- a/attic/bo_resprop_test.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - 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 . -*/ - -#include "config.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -int main(int argc, char** argv) -{ - // Parameters. - Opm::parameter::ParameterGroup param(argc, argv); - - // Parser. - std::string ecl_file = param.get("filename"); - Opm::EclipseGridParser deck(ecl_file); - UnstructuredGrid grid; - grid.number_of_cells = 1; - grid.global_cell = NULL; - Opm::BlackoilPropertiesFromDeck props(deck, grid, param); - - const int n = 1; - double p[n] = { 150e5 }; - double z[3*n] = { 1.0, 1.0, 1.0 }; - int cells[n] = { 0 }; - double A[9*n]; - props.matrix(n, p, z, cells, A, 0); - std::copy(A, A + 9, std::ostream_iterator(std::cout, " ")); - std::cout << std::endl; -} diff --git a/attic/pvt_test.cpp b/attic/pvt_test.cpp deleted file mode 100644 index f1963c83..00000000 --- a/attic/pvt_test.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - 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 . -*/ - -#if HAVE_CONFIG_H -#include "config.h" -#endif // HAVE_CONFIG_H - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -int main(int argc, char** argv) -{ - using namespace std; - // Parameters. - Opm::parameter::ParameterGroup param(argc, argv); - - // Parser. - std::string ecl_file = param.get("deck_filename"); - std::string input_file = param.get("input_filename"); - std::string matrix_output = param.get("matrix_output"); - std::string rs_output = param.get("rs_output"); - std::string b_output = param.get("b_output"); - std::string mu_output = param.get("mu_output"); - Opm::EclipseGridParser deck(ecl_file); - UnstructuredGrid grid; - grid.number_of_cells = 1; - grid.global_cell = NULL; - grid.dimensions = 3; - grid.cartdims[0] = 1; - grid.cartdims[1] = 1; - grid.cartdims[2] = 1; - Opm::BlackoilPropertiesFromDeck props(deck, grid, param); - Opm::BlackoilPvtProperties pvt; - int samples = param.getDefault("dead_tab_size", 1025); - pvt.init(deck, samples); - - - const int n = 1; - std::fstream inos(input_file.c_str()); - if(!inos.good()){ - std::cout << "Could not open :" << input_file << std::endl; - exit(3); - } - std::fstream aos(matrix_output.c_str(), std::fstream::out | std::fstream::trunc); - aos << setiosflags(ios::scientific) << setprecision(12); - if(!(aos.good())){ - std::cout << "Could not open"<< matrix_output << std::endl; - exit(3); - } - std::fstream bos(b_output.c_str(), std::fstream::out | std::fstream::trunc); - bos << setiosflags(ios::scientific) << setprecision(12); - if(!(bos.good())){ - std::cout << "Could not open"<< b_output << std::endl; - exit(3); - } - std::fstream rsos(rs_output.c_str(), std::fstream::out | std::fstream::trunc); - rsos << setiosflags(ios::scientific) << setprecision(12); - if(!(rsos.good())){ - std::cout << "Could not open"<< rs_output << std::endl; - exit(3); - } - std::fstream muos(mu_output.c_str(), std::fstream::out | std::fstream::trunc); - if(!(muos.good())){ - std::cout << "Could not open"<< rs_output << std::endl; - exit(3); - } - - - - const int np = props.numPhases(); - const int max_np = 3; - if (np > max_np) { - OPM_THROW(std::runtime_error, "Max #phases is 3."); - } - while((inos.good()) && (!inos.eof())){ - double p[n]; - double z[max_np*n]; - int cells[n] = { 0 }; - inos >> p[0]; - for(int i=0; i < np; ++i){ - inos >> z[i]; - } - - if(inos.good()){ - double A[max_np*max_np*n]; - double dA[max_np*max_np*n]; - props.matrix(n, p, z, cells, A, dA); - std::copy(A, A + np*np*n, std::ostream_iterator(aos, " ")); - std::copy(dA, dA + np*np*n, std::ostream_iterator(aos, " ")); - aos << std::endl; - double mu[max_np]; - //double dmu[max_np];//not implemented - props.viscosity(n, p, z, cells, mu, 0); - std::copy(mu, mu + np*n, std::ostream_iterator(muos, " ")); - //std::copy(dmu, dmu + np*n, std::ostream_iterator(muos, " ")); - aos << std::endl; - - double b[max_np]; - double dbdp[max_np]; - pvt.dBdp(n, p, z, b, dbdp); - std::copy(b, b + np*n, std::ostream_iterator(bos, " ")); - std::copy(dbdp, dbdp + np*n, std::ostream_iterator(bos, " ")); - bos << std::endl; - - double rs[max_np]; - double drs[max_np]; - //pvt.R(n, p, z, rs); - pvt.dRdp(n, p, z, rs,drs); - std::copy(rs, rs + np*n, std::ostream_iterator(rsos, " ")); - std::copy(drs, drs + np*n, std::ostream_iterator(rsos, " ")); - rsos << std::endl; - } - } - if (param.anyUnused()) { - std::cout << "-------------------- Unused parameters: --------------------\n"; - param.displayUsage(); - std::cout << "----------------------------------------------------------------" << std::endl; - } -} diff --git a/attic/relperm_test.cpp b/attic/relperm_test.cpp deleted file mode 100644 index b8e7ea9b..00000000 --- a/attic/relperm_test.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - 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 . -*/ - - -#if HAVE_CONFIG_H -#include "config.h" -#endif // HAVE_CONFIG_H - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -int main(int argc, char** argv) -{ - // Parameters. - Opm::parameter::ParameterGroup param(argc, argv); - - // Parser. - std::string ecl_file = param.get("deck_filename"); - std::string input_file = param.get("input_filename"); - std::string relperm_output = param.get("relperm_output"); - //std::string relperm_output = param.get("relperm_outout"); - Opm::EclipseGridParser deck(ecl_file); - UnstructuredGrid grid; - grid.number_of_cells = 1; - grid.global_cell = NULL; - grid.dimensions = 3; - grid.cartdims[0] = 1; - grid.cartdims[1] = 1; - grid.cartdims[2] = 1; - Opm::BlackoilPropertiesFromDeck props(deck, grid, param); - - std::fstream inos(input_file.c_str());//, std::fstream::in); - if(!inos.good()){ - std::cout << "Could not open :" << input_file << std::endl; - exit(3); - } - std::fstream kros(relperm_output.c_str(), std::fstream::out | std::fstream::trunc); - if(!kros.good()){ - std::cout << "Could not open :" << input_file << std::endl; - exit(3); - } - const int np = props.numPhases(); - const int max_np = 3; - if (np > max_np) { - OPM_THROW(std::runtime_error, "Max #phases is 3."); - } - while((inos.good()) && (!inos.eof())){ - double s[max_np]; - for(int i=0; i < np; ++i){ - inos >> s[i]; - } - if(inos.good()){ - double kr[max_np]; - double dkr[max_np*max_np]; - int cell[1]; - cell[0]=1; - props.relperm(1,s, cell, kr, dkr); - std::copy(s, s + np, std::ostream_iterator(kros, " ")); - kros << " "; - std::copy(kr, kr + np, std::ostream_iterator(kros, " ")); - kros << " "; - std::copy(dkr, dkr + np*np, std::ostream_iterator(kros, " ")); - kros << "\n"; - } - } - if (param.anyUnused()) { - std::cout << "-------------------- Unused parameters: --------------------\n"; - param.displayUsage(); - std::cout << "----------------------------------------------------------------" << std::endl; - } -} diff --git a/attic/test_ert.cpp b/attic/test_ert.cpp deleted file mode 100644 index bdd63431..00000000 --- a/attic/test_ert.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/* - 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 . -*/ - - -#include "config.h" -#include -#include -#include -#include -#include -#include - - -#include - -#include -#include -#include - -using namespace std; - -#if 0 -static -void cell_nodes(const UnstructuredGrid * c_grid , int cell , std::vector& nodes) { - int face_offset = c_grid->cell_facepos[cell]; - int num_faces = c_grid->cell_facepos[cell + 1] - face_offset; - - nodes.clear(); - //printf("cell: %d \n",cell); - for (int iface = 0; iface < num_faces; iface++) { - int face = c_grid->cell_faces[ face_offset + iface]; - //printf("face[%d] = %d \n",iface , face ); - - { - int node_offset = c_grid->face_nodepos[ face ]; - int num_nodes = c_grid->face_nodepos[ face + 1] - node_offset; - for (int inode = 0; inode < num_nodes; inode++) { - int node = c_grid->face_nodes[ inode + node_offset ]; - //printf(" node[%d] = %d \n",inode , node); - nodes.push_back( node ); - } - } - } - - { - /*for (int i =0; i < nodes.size(); i++) - std::cout << nodes[i] << " "; - std::cout << "\n"; - */ - sort( nodes.begin() , nodes.end()); - /*for (int i =0; i < nodes.size(); i++) - std::cout << nodes[i] << " "; - std::cout << "\n"; - */ - unique( nodes.begin() , nodes.end() ); - /*for (int i =0; i < nodes.size(); i++) - std::cout << nodes[i] << " "; - std::cout << "\n"; - */ - nodes.resize( 8 ); - /*for (int i =0; i < nodes.size(); i++) - std::cout << nodes[i] << " "; - std::cout << "\n"; - */ - } -} -#endif - -/* -static -void eclExport(Opm::GridManager& grid) { - const UnstructuredGrid * c_grid = grid.c_grid(); - - printf("dimensions : %d \n",c_grid->dimensions); - printf("number of cells : %d \n",c_grid->number_of_cells); - printf("number of nodes : %d \n",c_grid->number_of_nodes); - printf("number of faces : %d \n",c_grid->number_of_faces); - printf("length(face_nodes) : %d \n",c_grid->face_nodepos[ c_grid->number_of_faces ]); - printf("cartdims : %d %d %d \n", - c_grid->cartdims[0] , - c_grid->cartdims[1] , - c_grid->cartdims[2]); - - printf("global_cell : %d %d %d %d %d\n", - c_grid->global_cell[0] , - c_grid->global_cell[1] , - c_grid->global_cell[2] , - c_grid->global_cell[3] , - c_grid->global_cell[4]); - - { - std::vector nodes; - cell_nodes( c_grid , 10 , nodes ); - cell_nodes( c_grid , 15 , nodes ); - cell_nodes( c_grid , 20 , nodes ); - cell_nodes( c_grid , 25 , nodes ); - } - - { - ecl_grid_type * ecl_grid; - int num_coords = c_grid->number_of_cells; - int coords_size = 4; - int nx = c_grid->cartdims[0]; - int ny = c_grid->cartdims[1]; - int nz = c_grid->cartdims[2]; - - int ** coords; - float ** corners; - // float * mapaxes = NULL; - std::vector nodes; - - corners = (float **) malloc( num_coords * sizeof * corners ); - coords = (int **) malloc( num_coords * sizeof * coords ); - - { - int c; - for (c=0; c < num_coords; c++) { - corners[c] = (float *) malloc( 24 * sizeof * corners[c] ); - coords[c] = (int *) malloc( coords_size * sizeof * coords[c] ); - } - - for (c=0; c < num_coords; c++) { - cell_nodes( c_grid , c , nodes ); - for (int p=0; p < 8; p++) { - int n = nodes[p]; - for (int d=0; d < c_grid->dimensions; d++) - corners[c][3*p + d] = c_grid->node_coordinates[ c_grid->dimensions * n + d ]; - } - - { - int i,j,k; - { - int g = c_grid->global_cell[ c ]; - k = g / nx*ny; g -= k * nx*ny; - j = g / nx; g -= j * nx; - i = g; - } - - coords[c][0] = i + 1; - coords[c][1] = j + 1; - coords[c][2] = k + 1; - coords[c][3] = c_grid->global_cell[ c ] + 1; - } - } - } - - ecl_grid = ecl_grid_alloc( "/private/joaho/ERT/NR/libenkf/src/Gurbat/EXAMPLE_01_BASE.EGRID" ); - printf("Grid loaded ... \n"); - ecl_grid_free( ecl_grid ); - - printf("Grid discarded ... \n"); - - ecl_grid = ecl_grid_alloc_GRID_data( num_coords , nx , ny , nz , coords_size , coords , corners , NULL ); - ecl_grid_fwrite_GRID( ecl_grid , "/tmp/test.GRID" ); - - { - FILE * stream = fopen( "/tmp/test.grdecl" , "w"); - ecl_grid_fprintf_grdecl( ecl_grid , stream ); - fclose( stream ); - } - - ecl_grid_free( ecl_grid ); - - { - for (int c=0; c < num_coords; c++) { - free(corners[c]); - free(coords[c]); - } - } - free( corners ); - free( coords ); - } -} -*/ - - -/* - - #ifdef HAVE_ERT -ecl_grid_type * create_ecl_grid( const struct UnstructuredGrid * g) { - int num_coords = g->number_of_cells; - int nx = g->cartdims[0]; - int ny = g->cartdims[1]; - int nz = g->cartdims[2]; - int coords_size = 4; - int ** coords; - float ** corners; - float * mapaxes = NULL; - - corners = malloc( num_coords * sizeof * corners ); - coords = malloc( num_coords * sizeof * coords ); - - { - for (int c=0; c < num_coords; c++) { - corners[c] = malloc( 24 * sizeof * corners[0] ); - coords[c] = malloc( coords_size * sizeof * coords[0] ); - } - } - - { - for (int k=0; k < nz; k++) { - for (int j=0; j < ny; j++) { - for (int i=0; i < nx; i++) { - int global_index = i + j*nx + k*nx*ny; - - coords[global_index][0] = i; - coords[global_index][1] = j; - coords[global_index][2] = k; - coords[global_index][3] = 1; - - } - } - } - } - { - for (int c=0; c < num_coords; c++) { - free(corners[c]); - free(coords[c]); - } - } - free( corners ); - free( coords ); -} -#endif - - - */ - -// struct grdecl : opm/core/grid/cpgpreprocess/preprocess.h -// struct processes_grid : opm/core/grid/cpgpreprocess/preprocess.h - - - -int main(int /*argc*/ , char **argv) -{ - std::string filename( argv[1] ); - const std::unique_ptr grid; - const std::unique_ptr props; - Opm::EclipseGridParser eclParser(filename , false); - - //eclParser.saveEGRID_INIT("/tmp" , "OPM" ); - - grid.reset(new Opm::GridManager(eclParser)); - - props.reset(new Opm::IncompPropertiesFromDeck(eclParser , *grid->c_grid())); -} diff --git a/attic/test_readpolymer.cpp b/attic/test_readpolymer.cpp deleted file mode 100644 index ac045a34..00000000 --- a/attic/test_readpolymer.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//=========================================================================== -// -// File: test_readpolymer.cpp -// -// Created: Thu Jan 12 15:18:46 2012 -// -// Author: Bjørn Spjelkavik -// -// Revision: $Id$ -// -//=========================================================================== - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include - -// Test program for reading Eclipse Polymer keywords. - -int main(int argc, char** argv) -{ - using namespace std; - - std::string ecl_filename; - if (argc == 2) { - ecl_filename = argv[1]; - } else { - std::cout << "\nUsage: test_readpolymer filename.grdecl\n"; - exit( 1 ); - } - - - bool convert_to_SI = true; - Opm::EclipseGridParser parser(ecl_filename, convert_to_SI); - - std::cout << "\n Polymer fields\n\n"; - - if (parser.hasField("PLYVISC")) { - parser.getPLYVISC().write(std::cout); - } - if (parser.hasField("PLYROCK")) { - parser.getPLYROCK().write(std::cout); - } - if (parser.hasField("PLYADS")) { - parser.getPLYADS().write(std::cout); - } - if (parser.hasField("TLMIXPAR")) { - parser.getTLMIXPAR().write(std::cout); - } - if (parser.hasField("PLYMAX")) { - parser.getPLYMAX().write(std::cout); - } - if (parser.hasField("WPOLYMER")) { - parser.getWPOLYMER().write(std::cout); - } - -} - -