[3] | 1 | MODULE solver |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE solver *** |
---|
| 4 | !! Ocean solver : initialization of ocean solver |
---|
| 5 | !!===================================================================== |
---|
| 6 | |
---|
| 7 | !!---------------------------------------------------------------------- |
---|
| 8 | !! solver_init: solver initialization |
---|
| 9 | !!---------------------------------------------------------------------- |
---|
| 10 | !! * Modules used |
---|
| 11 | USE oce ! ocean dynamics and tracers variables |
---|
| 12 | USE dom_oce ! ocean space and time domain variables |
---|
| 13 | USE zdf_oce ! ocean vertical physics variables |
---|
| 14 | USE sol_oce ! solver variables |
---|
| 15 | USE solmat ! ??? |
---|
| 16 | USE obc_oce ! Lateral open boundary condition |
---|
| 17 | USE in_out_manager ! I/O manager |
---|
| 18 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
[16] | 19 | USE lib_mpp |
---|
[367] | 20 | USE dynspg_oce ! choice/control of key cpp for surface pressure gradient |
---|
[3] | 21 | |
---|
| 22 | IMPLICIT NONE |
---|
| 23 | |
---|
| 24 | !!---------------------------------------------------------------------- |
---|
[247] | 25 | !! OPA 9.0 , LOCEAN-IPSL (2005) |
---|
[1152] | 26 | !! $Id$ |
---|
[247] | 27 | !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt |
---|
[3] | 28 | !!---------------------------------------------------------------------- |
---|
| 29 | |
---|
| 30 | CONTAINS |
---|
| 31 | |
---|
[413] | 32 | SUBROUTINE solver_init( kt ) |
---|
[3] | 33 | !!---------------------------------------------------------------------- |
---|
| 34 | !! *** ROUTINE solver_init *** |
---|
| 35 | !! |
---|
| 36 | !! ** Purpose : Initialization for the solver of the elliptic equation: |
---|
[1528] | 37 | !! * lk_dynspg_flt = T : transport divergence system. |
---|
[3] | 38 | !! |
---|
| 39 | !! ** Method : |
---|
| 40 | !! - Compute the local depth of the water column at u- and v-point |
---|
| 41 | !! The local depth of the water column is computed by summing |
---|
| 42 | !! the vertical scale factors. For its inverse, the thickness of |
---|
| 43 | !! the first model level is imposed as lower bound. The inverse of |
---|
| 44 | !! this depth is THEN taken and masked, so that the inverse of the |
---|
| 45 | !! local depth is zero when the local depth is zero. |
---|
| 46 | !! |
---|
| 47 | !! ** Action : - hur, hvr : masked inverse of the local depth at |
---|
[1528] | 48 | !! u- and v-point. |
---|
[3] | 49 | !! - hu, hv : masked local depth at u- and v- points |
---|
[16] | 50 | !! - c_solver_pt : nature of the gridpoint at which the |
---|
| 51 | !! solver is applied |
---|
[3] | 52 | !! References : |
---|
| 53 | !! Jensen, 1986: adv. phys. oceanogr. num. mod.,ed. o brien,87-110. |
---|
| 54 | !! Madec & Marti, 1990: internal rep. LODYC, 90/03., 29pp. |
---|
| 55 | !! |
---|
| 56 | !! History : |
---|
| 57 | !! ! 90-10 (G. Madec) Original code |
---|
| 58 | !! ! 93-02 (O. Marti) |
---|
| 59 | !! ! 97-02 (G. Madec) local depth inverse computation |
---|
| 60 | !! ! 98-10 (G. Roullet, G. Madec) free surface |
---|
| 61 | !! 9.0 ! 03-07 (G. Madec) free form, F90 |
---|
[359] | 62 | !! " ! 05-11 (V. Garnier) Surface pressure gradient organization |
---|
[3] | 63 | !!---------------------------------------------------------------------- |
---|
[413] | 64 | !! * Arguments |
---|
| 65 | INTEGER, INTENT(in) :: kt |
---|
| 66 | |
---|
[1528] | 67 | NAMELIST/namsol/ nsolv, nsol_arp, nmin, nmax, nmod, eps, resmax, sor, rnu |
---|
[3] | 68 | !!---------------------------------------------------------------------- |
---|
| 69 | |
---|
[1581] | 70 | IF(lwp) THEN |
---|
| 71 | WRITE(numout,*) |
---|
| 72 | WRITE(numout,*) 'solver_init : solver to compute the surface pressure gradient' |
---|
| 73 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 74 | |
---|
| 75 | ! open elliptic solver statistics file |
---|
| 76 | CALL ctl_opn( numsol, 'solver.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) |
---|
| 77 | ENDIF |
---|
[3] | 78 | |
---|
| 79 | |
---|
| 80 | ! 0. Define the solver parameters |
---|
| 81 | ! ---------------------------- |
---|
[1528] | 82 | ! Namelist namsol : elliptic solver / free surface |
---|
[3] | 83 | REWIND( numnam ) |
---|
| 84 | READ ( numnam, namsol ) |
---|
| 85 | |
---|
| 86 | ! 0. Parameter control and print |
---|
| 87 | ! --------------------------- |
---|
| 88 | |
---|
| 89 | ! Control print |
---|
| 90 | IF(lwp) WRITE(numout,*) ' Namelist namsol : set solver parameters' |
---|
| 91 | |
---|
| 92 | IF(lwp) THEN |
---|
[111] | 93 | WRITE(numout,*) ' type of elliptic solver nsolv = ', nsolv |
---|
[120] | 94 | WRITE(numout,*) ' absolute/relative (0/1) precision nsol_arp = ', nsol_arp |
---|
[111] | 95 | WRITE(numout,*) ' minimum iterations for solver nmin = ', nmin |
---|
| 96 | WRITE(numout,*) ' maximum iterations for solver nmax = ', nmax |
---|
| 97 | WRITE(numout,*) ' frequency for test nmod = ', nmod |
---|
| 98 | WRITE(numout,*) ' absolute precision of solver eps = ', eps |
---|
[120] | 99 | WRITE(numout,*) ' absolute precision for SOR solver resmax = ', resmax |
---|
[111] | 100 | WRITE(numout,*) ' optimal coefficient of sor sor = ', sor |
---|
[3] | 101 | WRITE(numout,*) ' free surface parameter rnu = ', rnu |
---|
| 102 | WRITE(numout,*) |
---|
| 103 | ENDIF |
---|
| 104 | |
---|
[359] | 105 | IF( lk_dynspg_flt ) THEN |
---|
[3] | 106 | IF(lwp) WRITE(numout,*) |
---|
[79] | 107 | IF(lwp) WRITE(numout,*) ' free surface formulation' |
---|
[16] | 108 | ELSE |
---|
[1528] | 109 | CALL ctl_stop( ' Choose only one surface pressure gradient calculation: filtered ', & |
---|
[474] | 110 | & ' Should not call this routine if dynspg_exp or dynspg_ts has been chosen' ) |
---|
[16] | 111 | ENDIF |
---|
[3] | 112 | |
---|
| 113 | SELECT CASE ( nsolv ) |
---|
| 114 | |
---|
| 115 | CASE ( 1 ) ! preconditioned conjugate gradient solver |
---|
[79] | 116 | IF(lwp) WRITE(numout,*) ' a preconditioned conjugate gradient solver is used' |
---|
[474] | 117 | IF( jpr2di /= 0 .AND. jpr2dj /= 0 ) & |
---|
| 118 | CALL ctl_stop( ' jpr2di and jpr2dj should be equal to zero' ) |
---|
[3] | 119 | |
---|
| 120 | CASE ( 2 ) ! successive-over-relaxation solver |
---|
[784] | 121 | IF(lwp) WRITE(numout,*) ' a successive-over-relaxation solver with extra outer halo is used' |
---|
| 122 | IF(lwp) WRITE(numout,*) ' with jpr2di =', jpr2di, ' and jpr2dj =', jpr2dj |
---|
| 123 | IF( .NOT. lk_mpp .AND. jpr2di /= 0 .AND. jpr2dj /= 0 ) THEN |
---|
| 124 | CALL ctl_stop( ' jpr2di and jpr2dj are not equal to zero', & |
---|
| 125 | & ' In this case this algorithm should be used only with the key_mpp_... option' ) |
---|
| 126 | ELSE |
---|
| 127 | IF( ( ( jperio == 1 .OR. jperio == 4 .OR. jperio == 6 ) .OR. ( jpni /= 1 ) ) & |
---|
| 128 | & .AND. ( jpr2di /= jpr2dj ) ) CALL ctl_stop( ' jpr2di should be equal to jpr2dj' ) |
---|
| 129 | ENDIF |
---|
[3] | 130 | |
---|
| 131 | CASE DEFAULT |
---|
[474] | 132 | WRITE(ctmp1,*) ' bad flag value for nsolv = ', nsolv |
---|
| 133 | CALL ctl_stop( ctmp1 ) |
---|
[3] | 134 | |
---|
| 135 | END SELECT |
---|
| 136 | |
---|
[784] | 137 | IF( nbit_cmp == 1 ) THEN |
---|
| 138 | IF( nsolv /= 2 ) THEN |
---|
| 139 | CALL ctl_stop( ' Reproductibility tests (nbit_cmp=1) require the SOR solver: nsolv = 2' ) |
---|
| 140 | ELSE IF( MAX( jpr2di, jpr2dj ) > 0 ) THEN |
---|
| 141 | CALL ctl_stop( ' Reproductibility tests (nbit_cmp=1) require jpr2di = jpr2dj = 0' ) |
---|
| 142 | END IF |
---|
[531] | 143 | END IF |
---|
| 144 | |
---|
[16] | 145 | ! Grid-point at which the solver is applied |
---|
| 146 | ! ----------------------------------------- |
---|
[3] | 147 | |
---|
[1528] | 148 | IF( lk_mpp ) THEN |
---|
| 149 | c_solver_pt = 'S' ! S=T with special staff ??? which one? |
---|
| 150 | ELSE |
---|
| 151 | c_solver_pt = 'T' |
---|
[16] | 152 | ENDIF |
---|
| 153 | |
---|
[3] | 154 | ! Construction of the elliptic system matrix |
---|
| 155 | ! ------------------------------------------ |
---|
| 156 | |
---|
[413] | 157 | CALL sol_mat( kt ) |
---|
[1556] | 158 | ! |
---|
[3] | 159 | END SUBROUTINE solver_init |
---|
| 160 | |
---|
| 161 | !!====================================================================== |
---|
| 162 | END MODULE solver |
---|