3 int main(
int argc,
char** argv) {
6 libMesh::LibMeshInit init(argc, argv);
9 libMesh::PerfLog perf_log(
"Main program");
12 libMesh::Parallel::Communicator& WorldComm = init.comm();
15 int rank = WorldComm.rank();
16 int nodes = WorldComm.size();
21 GetPot command_line(argc, argv);
27 std::string input_filename;
28 if (command_line.search(2,
"--inputfile",
"-i")) {
29 input_filename = command_line.next(input_filename);
30 field_parser.parse_input_file(input_filename,
"#",
"\n",
" \t\n");
32 field_parser = command_line;
39 const unsigned int dim = 3;
41 libmesh_example_requires(dim == LIBMESH_DIM,
"3D support");
47 Vec sys_rhs_vec_PETSC;
49 MatCreate(WorldComm.get(),&sys_mat_PETSC);
50 VecCreate(WorldComm.get(),&sys_rhs_vec_PETSC);
57 libMesh::PetscMatrix<libMesh::Number> sys_mat(sys_mat_PETSC,WorldComm);
58 libMesh::PetscVector<libMesh::Number> sys_rhs_vec(sys_rhs_vec_PETSC,WorldComm);
59 libMesh::PetscVector<libMesh::Number> sys_sol_vec(WorldComm);
60 sys_sol_vec.init(sys_rhs_vec);
63 MatGetLocalSize(sys_mat_PETSC,NULL,&local_N);
66 libMesh::PetscLinearSolver<libMesh::Number> KSP_solver(WorldComm);
67 KSP_solver.init(
"sys");
72 std::cout <<
" > Using the " << input_params.
nb_of_rb_vectors <<
" RB modes vectors!" << std::endl;
74 std::cout <<
" > Attached the RB modes vectors!" << std::endl;
78 KSP_solver.solve(sys_mat,sys_sol_vec,sys_rhs_vec,input_params.
sys_eps,input_params.
sys_iter_div);
80 KSP_solver.print_converged_reason();
83 #ifdef PRINT_MATLAB_DEBUG
84 sys_sol_vec.print_matlab(input_params.
output_base +
"_sys_sol_vec.m");
91 MatDestroy(&sys_mat_PETSC);
92 VecDestroy(&sys_rhs_vec_PETSC);
void get_input_params(GetPot &field_parser, feti_iterate_params &input_params)
Parser function for the coupled solver test programs.
void write_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename, int dim=1)
void attach_rigid_body_mode_vectors(libMesh::PetscMatrix< libMesh::Number > &mat_sys, const std::string &filename_base, int nb_of_vecs, int dimension)
void read_PETSC_matrix(Mat input_mat, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
int main(int argc, char **argv)
void read_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename)