int main(int argc, char** argv) { Opm::parameter::ParameterGroup param(argc, argv); CpGrid grid; grid.init(param); typedef CpGrid::LeafGridView View; View g = grid.leafView(); typedef FieldVector<double, 3> Pt; int c_local = 0; for (View::Codim<0>::Iterator c_it = g.begin<0>(); c_it != g.end<0>(); ++c_it, ++c_local) { Pt cell_centroid = c_it->geometry().center(); int f_local = 0; bool trouble = false; for (View::IntersectionIterator f_it = g.ibegin(*c_it); f_it != g.iend(*c_it); ++f_it, ++f_local) { Pt face_centroid = f_it->geometry().center(); Pt face_normal = f_it->centerUnitOuterNormal(); if (face_normal*(face_centroid - cell_centroid) < 0.0) { trouble = true; std::cout << "Encountered troublesome geometry (centroid difference dot normal is negative) " "in cell " << c_local << " local face " << f_local << std::endl; } } if (trouble) { std::cout << "Cell " << c_local << " had a total of " << f_local << " faces." << std::endl; } } }
int main(int argc, char** argv) { // Create a grid. Opm::parameter::ParameterGroup param(argc, argv); CpGrid grid; grid.init(param); }
int main(int argc, char** argv) { parameter::ParameterGroup param(argc, argv); CpGrid grid; grid.init(param); grid.setUniqueBoundaryIds(true); GridInterfaceEuler<CpGrid> gi(grid); typedef FlowBC FBC; boost::array<FBC, 6> fcond = {{ FBC(FBC::Periodic, 1.0e5), FBC(FBC::Periodic, -1.0e5), FBC(FBC::Periodic, 0.0), FBC(FBC::Periodic, 0.0), FBC(FBC::Neumann, 0.0), FBC(FBC::Neumann, 0.0) }}; typedef SatBC SBC; boost::array<SBC, 6> scond = {{ SBC(SBC::Periodic, 0.0), SBC(SBC::Periodic, 0.0), SBC(SBC::Periodic, 0.0), SBC(SBC::Periodic, 0.0), SBC(SBC::Dirichlet, 0.0), SBC(SBC::Dirichlet, 0.0) }}; BasicBoundaryConditions<true, true> bcs; createPeriodic(bcs, gi, fcond, scond); std::cout << bcs; }
int main(int argc, char** argv) { typedef Dune::GridInterfaceEuler<CpGrid> GI; typedef GI ::CellIterator CI; typedef CI ::FaceIterator FI; typedef Dune::BasicBoundaryConditions<true, false> BCs; typedef Dune::ReservoirPropertyCapillary<3> RI; typedef Dune::IncompFlowSolverHybrid<GI, RI, BCs, Dune::MimeticIPEvaluator> FlowSolver; Opm::parameter::ParameterGroup param(argc, argv); CpGrid grid; grid.init(param); //grid.setUniqueBoundaryIds(true); GridInterfaceEuler<CpGrid> g(grid); typedef Dune::FlowBC BC; BCs flow_bc(7); #define BCDIR 4 #if BCDIR == 1 flow_bc.flowCond(1) = BC(BC::Dirichlet, 1.0*Opm::unit::barsa); flow_bc.flowCond(2) = BC(BC::Dirichlet, 0.0*Opm::unit::barsa); #elif BCDIR == 2 flow_bc.flowCond(3) = BC(BC::Dirichlet, 1.0*Opm::unit::barsa); flow_bc.flowCond(4) = BC(BC::Dirichlet, 0.0*Opm::unit::barsa); #elif BCDIR == 3 flow_bc.flowCond(5) = BC(BC::Dirichlet, 1.0*Opm::unit::barsa); flow_bc.flowCond(6) = BC(BC::Dirichlet, 0.0*Opm::unit::barsa); #elif BCDIR == 4 flow_bc.flowCond(5) = BC(BC::Dirichlet, 1.0*Opm::unit::barsa); #endif RI r; r.init(g.numberOfCells()); std::vector<double> permdata; fill_perm(permdata); ASSERT (int(permdata.size()) == 3 * 60 * 220 * 85); Dune::SharedFortranMatrix Perm(60 * 220 * 85, 3, &permdata[0]); const int imin = param.get<int>("imin"); const int jmin = param.get<int>("jmin"); const int kmin = param.get<int>("kmin"); for (int c = 0; c < g.numberOfCells(); ++c) { boost::array<int,3> ijk; grid.getIJK(c, ijk); ijk[0] += imin; ijk[1] += jmin; ijk[2] += kmin; const int gc = ijk[0] + 60*(ijk[1] + 220*ijk[2]); RI::SharedPermTensor K = r.permeabilityModifiable(c); K(0,0) = 0*0.1*Opm::unit::darcy + 1*Perm(gc,0); K(1,1) = 0*0.1*Opm::unit::darcy + 1*Perm(gc,1); K(2,2) = 0*0.1*Opm::unit::darcy + 1*Perm(gc,2); } #if 1 CI::Vector gravity; gravity[0] = gravity[1] = gravity[2] = 0.0; #if 1 gravity[2] = Opm::unit::gravity; gravity[2] = 10; //Opm::unit::gravity; #endif #endif FlowSolver solver; solver.init(g, r, gravity, flow_bc); #if 1 std::vector<double> src(g.numberOfCells(), 0.0); std::vector<double> sat(g.numberOfCells(), 0.0); #if 0 const int nx = param.get<int>("nx"); const int ny = param.get<int>("ny"); const int nz = param.get<int>("nz"); const int i = 0 + nz*(nx/2 + nx*ny/2 ), p1 = 0 + nz*(0 + nx*0 ), p2 = 0 + nz*((nx-1) + nx*0 ), p3 = 0 + nz*(0 + nx*(ny-1)), p4 = 0 + nz*((nx-1) + nx*(ny-1)); const double bbl = 0.159 * unit::cubic(unit::meter); const double irate = 1.0e4 * bbl / unit::day; for (int z = 0; z < nz; ++z) { src[i + z] = irate / nz; src[p1 + z] = -(irate / nz) / 4; src[p2 + z] = -(irate / nz) / 4; src[p3 + z] = -(irate / nz) / 4; src[p4 + z] = -(irate / nz) / 4; } #endif solver.solve(r, sat, flow_bc, src, 5.0e-8, 3); #endif #if 1 std::vector<GI::Vector> cell_velocity; estimateCellVelocity(cell_velocity, g, solver.getSolution()); // Dune's vtk writer wants multi-component data to be flattened. std::vector<double> cell_velocity_flat(&*cell_velocity.front().begin(), &*cell_velocity.back().end()); std::vector<double> cell_pressure; getCellPressure(cell_pressure, g, solver.getSolution()); Dune::VTKWriter<CpGrid::LeafGridView> vtkwriter(grid.leafView()); vtkwriter.addCellData(cell_velocity_flat, "velocity", 3); vtkwriter.addCellData(cell_pressure, "pressure"); vtkwriter.write("spe10_test_output", Dune::VTKOptions::ascii); #endif return 0; }