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


C++ Domain::getMaxStencilRadius方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
        // Implies initial conditions are generated
        // true here indicates the weights are computed.
        pde = new HeatPDE(subdomain, der, comm_unit, uniformDiffusion, true);
    }
    // This should not influence anything.
    pde->setStartEndTime(start_time, end_time);

    pde->fillInitialConditions(exact);

    // Broadcast updates for timestep, initial conditions for ghost nodes, etc.
    tm["updates"]->start();
    comm_unit->broadcastObjectUpdates(pde);
    comm_unit->barrier();
    tm["updates"]->stop();

    tm["heat_init"]->stop();

    //TODO:    pde->setRelErrTol(max_global_rel_error);

    // Setup a logging class that will monitor our iteration and dump intermediate files
#if USE_VTK
    // TODO: update VtuPDEWriter for the new PDE classes
    PDEWriter* writer = new VtuPDEWriter(subdomain, pde, comm_unit, local_sol_dump_frequency, global_sol_dump_frequency);
#else
    PDEWriter* writer = new PDEWriter(subdomain, pde, comm_unit, local_sol_dump_frequency, global_sol_dump_frequency);
#endif

    // Test DT:
    // 1) get the minimum avg stencil radius (for stencil area--i.e., dx^2)
    double avgdx = 1000.;
    std::vector<StencilType>& sten = subdomain->getStencils();
    for (size_t i=0; i < sten.size(); i++) {
        // In FD stencils we divide by h^2 for the laplacian. That is the
        double dx = subdomain->getMaxStencilRadius(i);
        if (dx < avgdx) {
            avgdx = dx;
        }
    }
    // Laplacian = d^2/dx^2
    double sten_area = avgdx*avgdx;

    double max_dt = (0.5*sten_area)/ddecay;

    // Not sure where Gordon came up with this parameter.
    // for second centered difference and euler time we have nu = 0.5
    //          dt <= nu/dx^2
    // is valid for stability in some FD schemes.
    // double max_dt = 0.2*(sten_area);
    printf("dt = %f, min h=%f\n", dt, avgdx);
    printf("(FD suggested max_dt(0.5*dx^2/K)= %f; 0.5dx^2 = %f)\n", max_dt, 0.5*sten_area);

    // Only use the CFL dt if our current choice is greater and we insist it be used
    if (use_cfl_dt && dt > max_dt) {
        dt = 0.9999*max_dt;
    }

    // This appears to be consistent with Chinchipatnam2006 (Thesis)
    // TODO: get more details on CFL for RBFFD
    // note: checking stability only works if we have all weights for all
    // nodes, so we dont do it in parallel
    if (compute_eigenvalues && (comm_unit->getSize() == 1)) {
        RBFFD::EigenvalueOutput eigs = der->getEigenvalues();
        // Not sure why this is 2
        max_dt = 2. / eigs.max_neg_eig;
        printf("Suggested max_dt based on eigenvalues (2/lambda_max)= %f\n", max_dt);
开发者ID:,项目名称:,代码行数:66,代码来源:


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