Changeset 12021
- Timestamp:
- 04/17/12 07:07:23 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/modules/Solverx/SolverxPetsc.cpp ¶
r12018 r12021 43 43 #endif 44 44 45 46 45 /*Display message*/ 47 46 _printf_(VerboseModule()," Solving\n"); … … 52 51 #endif 53 52 54 /*First, check that f-set is not NULL, i.e. model is fully constrained: {{{*/53 /*First, check that f-set is not NULL, i.e. model is fully constrained:*/ 55 54 _assert_(Kff); 56 55 MatGetSize(Kff,&global_m,&global_n); _assert_(global_m==global_m); … … 58 57 *puf=NULL; return; 59 58 } 60 /*}}}*/ 61 /*Initial guess logic here: {{{1*/59 60 /*Initial guess */ 62 61 /*Now, check that we are not giving an initial guess to the solver, if we are running a direct solver: */ 63 62 #if _PETSC_MAJOR_ >= 3 … … 74 73 MatGetLocalSize(Kff,&local_m,&local_n);uf=NewVec(local_n,fromlocalsize); 75 74 } 76 /*}}}*/ 77 /*Process petsc options to see if we are using special types of external solvers : {{{1*/75 76 /*Process petsc options to see if we are using special types of external solvers*/ 78 77 PetscOptionsDetermineSolverType(&solver_type); 79 78 80 /*}}}*/ 81 /*Check the solver is available: {{{1*/ 79 /*Check the solver is available*/ 82 80 if(solver_type==MUMPSPACKAGE_LU || solver_type==MUMPSPACKAGE_CHOL){ 83 #if _PETSC_MAJOR_ >=3 84 #ifndef _HAVE_MUMPS_ 85 _error_("requested MUMPS solver, which was not compiled into ISSM!\n"); 81 #if _PETSC_MAJOR_ >=3 82 #ifndef _HAVE_MUMPS_ 83 _error_("requested MUMPS solver, which was not compiled into ISSM!\n"); 84 #endif 86 85 #endif 86 } 87 87 88 #endif 89 } 90 /*}}}*/ 91 /*Prepare solver:{{{1*/ 88 /*Prepare solver*/ 92 89 KSPCreate(MPI_COMM_WORLD,&ksp); 93 90 KSPSetOperators(ksp,Kff,Kff,DIFFERENT_NONZERO_PATTERN); … … 124 121 #endif 125 122 126 /*}}}*/ 127 /*If there is an initial guess for the solution, use it, except if we are using the MUMPS direct solver, where any initial guess will crash Petsc: {{{1*/ 123 /*If there is an initial guess for the solution, use it 124 * except if we are using the MUMPS direct solver 125 * where any initial guess will crash Petsc*/ 128 126 if (uf0){ 129 if( 127 if((solver_type!=MUMPSPACKAGE_LU) && (solver_type!=MUMPSPACKAGE_CHOL) && (solver_type!=SPOOLESPACKAGE_LU) && (solver_type!=SPOOLESPACKAGE_CHOL) && (solver_type!=SUPERLUDISTPACKAGE)){ 130 128 KSPSetInitialGuessNonzero(ksp,PETSC_TRUE); 131 129 } 132 130 } 133 /*}}}*/134 135 if(VerboseSolver())KSPView(ksp,PETSC_VIEWER_STDOUT_WORLD);136 131 137 132 /*Solve: */ 133 if(VerboseSolver())KSPView(ksp,PETSC_VIEWER_STDOUT_WORLD); 138 134 KSPSolve(ksp,pf,uf); 139 135
Note:
See TracChangeset
for help on using the changeset viewer.