当前位置: 首页>>代码示例>>C++>>正文


C++ GridType::readEclipseFormat方法代码示例

本文整理汇总了C++中GridType::readEclipseFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ GridType::readEclipseFormat方法的具体用法?C++ GridType::readEclipseFormat怎么用?C++ GridType::readEclipseFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GridType的用法示例。


在下文中一共展示了GridType::readEclipseFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

//! \brief Main driver
int main(int argc, char** argv)
try
{
    try {
        static const int dim = 3;

        typedef Dune::CpGrid GridType;

        if (argc < 2 || strcmp(argv[1],"-h") == 0
                || strcmp(argv[1],"--help") == 0
                || strcmp(argv[1],"-?") == 0) {
            syntax(argv);
            exit(1);
        }
        Params p;
        parseCommandLine(argc,argv,p);

        Opm::time::StopWatch watch;
        watch.start();

        GridType grid;
        if (p.file == "uniform") {
            std::array<int,3> cells;
            cells[0] = p.cellsx;
            cells[1] = p.cellsy;
            cells[2] = p.cellsz;
            std::array<double,3> cellsize;
            cellsize[0] = cellsize[1] = cellsize[2] = 1.f;
            grid.createCartesian(cells,cellsize);
        } else
            grid.readEclipseFormat(p.file,p.ctol,false);

        typedef GridType::ctype ctype;
        Opm::Elasticity::ElasticityUpscale<GridType> upscale(grid, p.ctol,
                p.Emin, p.file,
                p.rocklist,
                p.verbose);
        if (p.max[0] < 0 || p.min[0] < 0) {
            std::cout << "determine side coordinates..." << std::endl;
            upscale.findBoundaries(p.min,p.max);
            std::cout << "  min " << p.min[0] << " " << p.min[1] << " " << p.min[2] << std::endl;
            std::cout << "  max " << p.max[0] << " " << p.max[1] << " " << p.max[2] << std::endl;
        }
        if (p.n1 == -1 || p.n2 == -1) {
            p.n1 = grid.logicalCartesianSize()[0];
            p.n2 = grid.logicalCartesianSize()[1];
        }
        if (p.linsolver.zcells == -1) {
            double lz = p.max[2]-p.min[2];
            int nz = grid.logicalCartesianSize()[2];
            double hz = lz/nz;
            double lp = sqrt((double)(p.max[0]-p.min[0])*(p.max[1]-p.min[1]));
            int np = std::max(grid.logicalCartesianSize()[0],
                              grid.logicalCartesianSize()[1]);
            double hp = lp/np;
            p.linsolver.zcells = (int)(2*hp/hz+0.5);
        }
        std::cout << "logical dimension: " << grid.logicalCartesianSize()[0]
                  << "x"                   << grid.logicalCartesianSize()[1]
                  << "x"                   << grid.logicalCartesianSize()[2]
                  << std::endl;

        if (p.method == UPSCALE_MPC) {
            std::cout << "using MPC couplings in all directions..." << std::endl;
            upscale.periodicBCs(p.min, p.max);
            std::cout << "preprocessing grid..." << std::endl;
            upscale.A.initForAssembly();
        } else if (p.method == UPSCALE_MORTAR) {
            std::cout << "using Mortar couplings.." << std::endl;
            upscale.periodicBCsMortar(p.min, p.max, p.n1, p.n2,
                                      p.lambda[0], p.lambda[1]);
        } else if (p.method == UPSCALE_NONE) {
            std::cout << "no periodicity approach applied.." << std::endl;
            upscale.fixCorners(p.min, p.max);
            upscale.A.initForAssembly();
        }
        Dune::FieldMatrix<double,6,6> C;
        Dune::VTKWriter<GridType::LeafGridView>* vtkwriter=0;
        if (!p.vtufile.empty())
            vtkwriter = new Dune::VTKWriter<GridType::LeafGridView>(grid.leafView());
        Opm::Elasticity::Vector field[6];
        std::cout << "assembling elasticity operator..." << "\n";
        upscale.assemble(-1,true);
        std::cout << "setting up linear solver..." << std::endl;
        upscale.setupSolvers(p.linsolver);

//#pragma omp parallel for schedule(static)
        for (int i=0; i<6; ++i) {
            std::cout << "processing case " << i+1 << "..." << std::endl;
            std::cout << "\tassembling load vector..." << std::endl;
            upscale.assemble(i,false);
            std::cout << "\tsolving..." << std::endl;
            upscale.solve(i);
            upscale.A.expandSolution(field[i],upscale.u[i]);
#define CLAMP(x) (fabs(x)<1.e-4?0.0:x)
            for (size_t j=0; j<field[i].size(); ++j) {
                double val = field[i][j];
                field[i][j] = CLAMP(val);
            }
//.........这里部分代码省略.........
开发者ID:berland,项目名称:opm-upscaling,代码行数:101,代码来源:upscale_elasticity.cpp


注:本文中的GridType::readEclipseFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。