Changeset 11160
- Timestamp:
- 01/19/12 14:55:37 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/Solverx/Solverx.cpp
r9830 r11160 16 16 void Solverx(Vec* puf, Mat Kff, Vec pf, Vec uf0,Vec df, Parameters* parameters){ 17 17 18 /* output: */18 /*Output: */ 19 19 Vec uf = NULL; 20 20 21 /* intermediary: */21 /*Intermediary: */ 22 22 int local_m,local_n,global_m,global_n; 23 23 int analysis_type; … … 35 35 #endif 36 36 37 /* stokes: */37 /*Stokes: */ 38 38 IS isv=NULL; 39 39 IS isp=NULL; … … 52 52 #endif 53 53 54 /*First, check that f-set is not NULL, i emodel is fully constrained: {{{*/54 /*First, check that f-set is not NULL, i.e. model is fully constrained: {{{*/ 55 55 _assert_(Kff); 56 56 MatGetSize(Kff,&global_m,&global_n); _assert_(global_m==global_m); … … 60 60 /*}}}*/ 61 61 /*Initial guess logic here: {{{1*/ 62 /*Now, check that we are not g etting an initial guess to the solver, if we are running a direct solver: */62 /*Now, check that we are not giving an initial guess to the solver, if we are running a direct solver: */ 63 63 #if _PETSC_MAJOR_ >= 3 64 64 PetscOptionsGetString(PETSC_NULL,"-ksp_type",ksp_type,49,&flg); … … 66 66 #endif 67 67 68 /*If initial guess for solution exists, use it to create uf, otherwise,69 * duplicate right hand side so that solution vector hassame structure*/68 /*If initial guess for the solution exists, use it to create uf, otherwise, 69 * duplicate the right hand side so that the solution vector has the same structure*/ 70 70 if(uf0){ 71 71 VecDuplicate(uf0,&uf); VecCopy(uf0,uf); … … 75 75 } 76 76 /*}}}*/ 77 /*Process petsc options to see if we are notusing special types of external solvers: {{{1*/77 /*Process petsc options to see if we are using special types of external solvers: {{{1*/ 78 78 PetscOptionsDetermineSolverType(&solver_type); 79 79 80 /*In serial mode, matrices have been loaded atMPIAIJ or AIJ matrices.80 /*In serial mode, the matrices have been loaded as MPIAIJ or AIJ matrices. 81 81 We need to convert them if we are going to run the solvers successfully: */ 82 82 #ifdef _SERIAL_ … … 114 114 115 115 #if defined(_SERIAL_) && _PETSC_VERSION_==3 116 /* specific solver?: */116 /*Specific solver?: */ 117 117 KSPGetPC(ksp,&pc); 118 118 if (solver_type==MUMPSPACKAGE_LU){ … … 137 137 138 138 /*}}}*/ 139 /*If initial guess forsolution, use it, except if we are using the MUMPS direct solver, where any initial guess will crash Petsc: {{{1*/139 /*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*/ 140 140 if (uf0){ 141 if( (solver_type!=MUMPSPACKAGE_LU) && (solver_type!=MUMPSPACKAGE_CHOL) && (solver_type!=SPOOLESPACKAGE_LU) && (solver_type!=SPOOLESPACKAGE_CHOL)&& (solver_type!=SUPERLUDISTPACKAGE)){141 if( (solver_type!=MUMPSPACKAGE_LU) && (solver_type!=MUMPSPACKAGE_CHOL) && (solver_type!=SPOOLESPACKAGE_LU) && (solver_type!=SPOOLESPACKAGE_CHOL) && (solver_type!=SUPERLUDISTPACKAGE)){ 142 142 KSPSetInitialGuessNonzero(ksp,PETSC_TRUE); 143 143 } … … 154 154 if (iteration_number<0) _error_("%s%i"," Solver diverged at iteration number: ",-iteration_number); 155 155 156 /*Free res sources:*/156 /*Free resources:*/ 157 157 KSPFree(&ksp); 158 158
Note:
See TracChangeset
for help on using the changeset viewer.