31 |
#include "PARAMS.h" |
#include "PARAMS.h" |
32 |
#include "STREAMICE.h" |
#include "STREAMICE.h" |
33 |
#include "STREAMICE_CG.h" |
#include "STREAMICE_CG.h" |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
#ifdef ALLOW_PETSC |
#ifdef ALLOW_PETSC |
38 |
#include "finclude/petsc.h" |
#include "finclude/petsc.h" |
39 |
!#include "finclude/petscvec.h" |
#include "finclude/petscvec.h" |
40 |
!#include "finclude/petscmat.h" |
#include "finclude/petscmat.h" |
41 |
!#include "finclude/petscksp.h" |
#include "finclude/petscksp.h" |
42 |
!#include "finclude/petscpc.h" |
#include "finclude/petscpc.h" |
43 |
#endif |
#endif |
44 |
C === Global variables === |
C === Global variables === |
45 |
|
|
93 |
|
|
94 |
#ifdef ALLOW_STREAMICE |
#ifdef ALLOW_STREAMICE |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
CALL TIMER_START ('STREAMICE_CG_SOLVE',myThid) |
CALL TIMER_START ('STREAMICE_CG_SOLVE',myThid) |
99 |
|
#ifndef STREAMICE_SERIAL_TRISOLVE |
100 |
|
|
101 |
#ifdef ALLOW_PETSC |
#ifdef ALLOW_PETSC |
102 |
|
|
192 |
call VecAssemblyEnd(solution, ierr) |
call VecAssemblyEnd(solution, ierr) |
193 |
|
|
194 |
|
|
195 |
call MatCreateAIJ (PETSC_COMM_WORLD, |
call MatCreateMPIAIJ (PETSC_COMM_WORLD, |
196 |
& local_dofs, local_dofs, |
& local_dofs, local_dofs, |
197 |
& global_dofs, global_dofs, |
& global_dofs, global_dofs, |
198 |
& 18, PETSC_NULL_INTEGER, |
& 18, PETSC_NULL_INTEGER, |
199 |
& 18, PETSC_NULL_INTEGER, |
& 18, PETSC_NULL_INTEGER, |
200 |
& matrix, ierr) |
& matrix, ierr) |
201 |
|
|
202 |
|
|
203 |
! populate petsc matrix |
! populate petsc matrix |
204 |
|
|
205 |
DO bj = myByLo(myThid), myByHi(myThid) |
DO bj = myByLo(myThid), myByHi(myThid) |
374 |
|
|
375 |
|
|
376 |
|
|
377 |
#else |
#else /* ALLOW_PETSC */ |
378 |
|
|
379 |
|
|
380 |
iters = streamice_max_cg_iter |
iters = streamice_max_cg_iter |
766 |
! _EXCH_XY_RL( cg_Uin, myThid ) |
! _EXCH_XY_RL( cg_Uin, myThid ) |
767 |
! _EXCH_XY_RL( cg_Vin, myThid ) |
! _EXCH_XY_RL( cg_Vin, myThid ) |
768 |
|
|
769 |
|
#endif /* ifndef ALLOW_PETSC */ |
770 |
|
|
771 |
|
#else /* STREAMICE_SERIAL_TRISOLVE */ |
772 |
|
|
773 |
|
CALL STREAMICE_TRIDIAG_SOLVE( |
774 |
|
U cg_Uin, ! x-velocities |
775 |
|
U cg_Vin, |
776 |
|
U cg_Bu, ! force in x dir |
777 |
|
I A_uu, ! section of matrix that multiplies u and projects on u |
778 |
|
I STREAMICE_umask, |
779 |
|
I myThid ) |
780 |
|
|
781 |
#endif |
#endif |
782 |
|
|
783 |
CALL TIMER_STOP ('STREAMICE_CG_SOLVE',myThid) |
CALL TIMER_STOP ('STREAMICE_CG_SOLVE',myThid) |