本文整理汇总了C++中DiscreteProblem::add_matrix_form_surf方法的典型用法代码示例。如果您正苦于以下问题:C++ DiscreteProblem::add_matrix_form_surf方法的具体用法?C++ DiscreteProblem::add_matrix_form_surf怎么用?C++ DiscreteProblem::add_matrix_form_surf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscreteProblem
的用法示例。
在下文中一共展示了DiscreteProblem::add_matrix_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;
}
示例2: main
int main() {
// create space
Space Space(A, B, NELEM, DIR_BC_LEFT, DIR_BC_RIGHT, P_INIT, NEQ);
info("N_dof = %d", Space::get_num_dofs(&space));
// Initialize the weak formulation.
WeakForm wf;
// Initialize the FE problem.
DiscreteProblem *dp = new DiscreteProblem();
dp->add_matrix_form(0, 0, jacobian_1_1);
dp->add_matrix_form(0, 2, jacobian_1_3);
dp->add_matrix_form(0, 3, jacobian_1_4);
dp->add_matrix_form(1, 1, jacobian_2_2);
dp->add_matrix_form(1, 2, jacobian_2_3);
dp->add_matrix_form(1, 3, jacobian_2_4);
dp->add_matrix_form(2, 0, jacobian_3_1);
dp->add_matrix_form(2, 1, jacobian_3_2);
dp->add_matrix_form(2, 2, jacobian_3_3);
dp->add_matrix_form(3, 0, jacobian_4_1);
dp->add_matrix_form(3, 1, jacobian_4_2);
dp->add_matrix_form(3, 3, jacobian_4_4);
dp->add_vector_form(0, residual_1);
dp->add_vector_form(1, residual_2);
dp->add_vector_form(2, residual_3);
dp->add_vector_form(3, residual_4);
dp->add_matrix_form_surf(0, 0, jacobian_surf_right_U_Re, BOUNDARY_RIGHT);
dp->add_matrix_form_surf(0, 2, jacobian_surf_right_U_Im, BOUNDARY_RIGHT);
dp->add_matrix_form_surf(1, 1, jacobian_surf_right_I_Re, BOUNDARY_RIGHT);
dp->add_matrix_form_surf(1, 3, jacobian_surf_right_I_Im, BOUNDARY_RIGHT);
// Newton's loop
newton(dp, space, MATRIX_SOLVER, MATRIX_SOLVER_TOL, MATRIX_SOLVER_MAXITER,
NEWTON_TOL, NEWTON_MAXITER);
// Plot the solution.
Linearizer l(&space);
l.plot_solution("solution.gp");
info("Done.");
return 1;
}