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


C++ DiscreteProblem::add_vector_form_surf方法代码示例

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


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

示例1: main

int main() {
  // Create coarse mesh, set Dirichlet BC, enumerate 
  // basis functions
  Mesh *mesh = new Mesh(A, B, N_elem, P_init, N_eq);
  printf("N_dof = %d\n", mesh->assign_dofs());

  // Register weak forms
  DiscreteProblem *dp = new DiscreteProblem();
  dp->add_matrix_form(0, 0, jacobian_vol);
  dp->add_vector_form(0, residual_vol);
  dp->add_matrix_form_surf(0, 0, jacobian_surf_left, BOUNDARY_LEFT);
  dp->add_vector_form_surf(0, residual_surf_left, BOUNDARY_LEFT);
  dp->add_matrix_form_surf(0, 0, jacobian_surf_right, BOUNDARY_RIGHT);
  dp->add_vector_form_surf(0, residual_surf_right, BOUNDARY_RIGHT);

  // Newton's loop
  newton(dp, mesh, NULL, NEWTON_TOL, NEWTON_MAXITER);

  // Plot the solution
  Linearizer l(mesh);
  l.plot_solution("solution.gp");

  printf("Done.\n");
  return 1;
}
开发者ID:MathPhys,项目名称:hermes,代码行数:25,代码来源:main.cpp

示例2: main

int main() {
// Create coarse mesh
    MeshData *md = new MeshData();		// transform input data to the format used by the "Mesh" constructor
    Mesh *mesh = new Mesh(md->N_macroel, md->interfaces, md->poly_orders, md->material_markers, md->subdivisions, N_GRP, N_SLN);
    delete md;

    printf("N_dof = %d\n", mesh->assign_dofs());
    mesh->plot("mesh.gp");

    for (int g = 0; g < N_GRP; g++)  {
        mesh->set_bc_right_dirichlet(g, flux_right_surf[g]);
    }

    // Register weak forms
    DiscreteProblem *dp = new DiscreteProblem();

    dp->add_matrix_form(0, 0, jacobian_fuel_0_0, fuel);
    dp->add_matrix_form(0, 1, jacobian_fuel_0_1, fuel);
    dp->add_matrix_form(1, 0, jacobian_fuel_1_0, fuel);
    dp->add_matrix_form(1, 1, jacobian_fuel_1_1, fuel);

    dp->add_vector_form(0, residual_fuel_0, fuel);
    dp->add_vector_form(1, residual_fuel_1, fuel);

    dp->add_vector_form_surf(0, residual_surf_left_0, BOUNDARY_LEFT);
    dp->add_vector_form_surf(1, residual_surf_left_1, BOUNDARY_LEFT);

    // Newton's loop
    newton(dp, mesh, NULL, NEWTON_TOL, NEWTON_MAXITER, verbose);

    // Plot the resulting neutron flux
    Linearizer l(mesh);
    l.plot_solution("solution.gp");

    // Calculate flux integral for comparison with the reference value
    double I = calc_integrated_flux(mesh, 1, 60., 80.);
    double Iref = 134.9238787715397;
    printf("I = %.13f, err = %.13f%%\n", I, 100.*(I - Iref)/Iref );

    printf("Done.\n");
    return 1;
}
开发者ID:hpfem,项目名称:hermes1d,代码行数:42,代码来源:main.cpp


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