| 1 | ce107 | 1.1 | CStartOfInterface | 
| 2 |  |  | SUBROUTINE INI_CG2D | 
| 3 |  |  | C     /==========================================================\ | 
| 4 |  |  | C     | SUBROUTINE INI_CG2D                                      | | 
| 5 |  |  | C     | o Initialise 2d conjugate gradient solver operators.     | | 
| 6 |  |  | C     |==========================================================| | 
| 7 |  |  | C     | These arrays are purely a function of the basin geom.    | | 
| 8 |  |  | C     | We set then here once and them use then repeatedly.      | | 
| 9 |  |  | C     | In this example we hard code a periodic channel with a   | | 
| 10 |  |  | C     | grid spacing on 1.                                       | | 
| 11 |  |  | C     \==========================================================/ | 
| 12 |  |  | IMPLICIT NONE | 
| 13 |  |  |  | 
| 14 |  |  | C     === Global variables === | 
| 15 |  |  | #include "SIZE.h" | 
| 16 |  |  | #include "EEPARAMS.h" | 
| 17 |  |  | #include "PARAMS.h" | 
| 18 |  |  | #include "CG2D.h" | 
| 19 |  |  |  | 
| 20 |  |  | C     === Routine arguments === | 
| 21 |  |  | C     myThid - Thread no. that called this routine. | 
| 22 |  |  | INTEGER myThid | 
| 23 |  |  | CEndOfInterface | 
| 24 |  |  |  | 
| 25 |  |  | C     === Local variables === | 
| 26 |  |  | C     xG, yG - Global coordinate location. | 
| 27 |  |  | C     zG | 
| 28 |  |  | C     iG, jG - Global coordinate index | 
| 29 |  |  | C     bi,bj  - Loop counters | 
| 30 |  |  | C     faceArea - Temporary used to hold cell face areas. | 
| 31 |  |  | C     I,J,K | 
| 32 |  |  | INTEGER  I,  J, K | 
| 33 |  |  | INTEGER iG, jG | 
| 34 |  |  |  | 
| 35 |  |  | C--   Initialise laplace operator | 
| 36 |  |  | C     aW2d: integral Ax/dX | 
| 37 |  |  | C     aS2d: integral Ay/dY | 
| 38 |  |  | DO J=1-OLy,sNy+OLy | 
| 39 |  |  | DO I=1-OLx,sNx+OLx | 
| 40 |  |  | iG = myXGlobalLo+I-1 | 
| 41 |  |  | jG = myYGlobalLo+J-1 | 
| 42 |  |  | aW2d(I,J) = 1. _d 0 | 
| 43 |  |  | aS2d(I,J) = 1. _d 0 | 
| 44 |  |  | IF ( jG .EQ. 1 .OR. jG .EQ. nY+1 ) THEN | 
| 45 |  |  | aS2d(I,J) = 0. | 
| 46 |  |  | ENDIF | 
| 47 |  |  | ENDDO | 
| 48 |  |  | ENDDO | 
| 49 |  |  | C     CALL PLOT_FIELD_XYR8( aW2d, 'AW2D INI_CG2D') | 
| 50 |  |  | C     CALL PLOT_FIELD_XYR8( aS2d, 'AS2D INI_CG2D') | 
| 51 |  |  |  | 
| 52 |  |  | C--   Initialise preconditioner | 
| 53 |  |  | DO J=1,sNy | 
| 54 |  |  | DO I=1,sNx | 
| 55 |  |  | pC(I,J) = 1. _d 0 | 
| 56 |  |  | IF ( | 
| 57 |  |  | &   aW2d(I,J) + aW2d(I+1,J) | 
| 58 |  |  | &  +aS2d(I,J) + aS2D(I,J+1) | 
| 59 |  |  | &   .EQ. 0. | 
| 60 |  |  | &     )  pC(I,J) = 0. _d 0 | 
| 61 |  |  | pW(I,J) = 0. | 
| 62 |  |  | pS(I,J) = 0. | 
| 63 |  |  | ENDDO | 
| 64 |  |  | ENDDO | 
| 65 |  |  | C--   Update overlap regions | 
| 66 |  |  | CALL EXCH_XY_R8(pC) | 
| 67 |  |  | CALL EXCH_XY_R8(pW) | 
| 68 |  |  | CALL EXCH_XY_R8(pS) | 
| 69 |  |  |  | 
| 70 |  |  | C--   Set default values for initial guess | 
| 71 |  |  | DO J=1,sNy | 
| 72 |  |  | DO I=1,sNx | 
| 73 |  |  | cg2d_x(I,J) = 0. _d 0 | 
| 74 |  |  | ENDDO | 
| 75 |  |  | ENDDO | 
| 76 |  |  | C--   Update overlap regions | 
| 77 |  |  | CALL EXCH_XY_R8(cg2d_x) | 
| 78 |  |  |  | 
| 79 |  |  | RETURN | 
| 80 |  |  | END |