[358] | 1 | MODULE dynspg |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE dynspg *** |
---|
| 4 | !! Ocean dynamics: surface pressure gradient control |
---|
| 5 | !!====================================================================== |
---|
[1566] | 6 | !! History : 1.0 ! 2005-12 (C. Talandier, G. Madec, V. Garnier) Original code |
---|
| 7 | !! 3.2 ! 2009-07 (R. Benshila) Suppression of rigid-lid option |
---|
[503] | 8 | !!---------------------------------------------------------------------- |
---|
[358] | 9 | |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
| 11 | !! dyn_spg : update the dynamics trend with the lateral diffusion |
---|
| 12 | !! dyn_spg_ctl : initialization, namelist read, and parameters control |
---|
| 13 | !!---------------------------------------------------------------------- |
---|
| 14 | USE oce ! ocean dynamics and tracers variables |
---|
| 15 | USE dom_oce ! ocean space and time domain variables |
---|
[367] | 16 | USE obc_oce ! ocean open boundary conditions |
---|
| 17 | USE dynspg_oce ! surface pressure gradient variables |
---|
[358] | 18 | USE dynspg_exp ! surface pressure gradient (dyn_spg_exp routine) |
---|
| 19 | USE dynspg_ts ! surface pressure gradient (dyn_spg_ts routine) |
---|
| 20 | USE dynspg_flt ! surface pressure gradient (dyn_spg_flt routine) |
---|
[2338] | 21 | USE dynadv ! dynamics: vector invariant versus flux form |
---|
[358] | 22 | USE trdmod ! ocean dynamics trends |
---|
| 23 | USE trdmod_oce ! ocean variables trends |
---|
| 24 | USE prtctl ! Print control (prt_ctl routine) |
---|
| 25 | USE in_out_manager ! I/O manager |
---|
| 26 | |
---|
| 27 | IMPLICIT NONE |
---|
| 28 | PRIVATE |
---|
| 29 | |
---|
[2027] | 30 | PUBLIC dyn_spg ! routine called by step module |
---|
| 31 | PUBLIC dyn_spg_init ! routine called by opa module |
---|
[358] | 32 | |
---|
[503] | 33 | INTEGER :: nspg = 0 ! type of surface pressure gradient scheme defined from lk_dynspg_... |
---|
[358] | 34 | |
---|
| 35 | !! * Substitutions |
---|
| 36 | # include "domzgr_substitute.h90" |
---|
| 37 | # include "vectopt_loop_substitute.h90" |
---|
| 38 | !!---------------------------------------------------------------------- |
---|
[1566] | 39 | !! NEMO/OPA 3.2 , LODYC-IPSL (2009) |
---|
[1152] | 40 | !! $Id$ |
---|
[2287] | 41 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[358] | 42 | !!---------------------------------------------------------------------- |
---|
| 43 | |
---|
| 44 | CONTAINS |
---|
| 45 | |
---|
| 46 | SUBROUTINE dyn_spg( kt, kindic ) |
---|
| 47 | !!---------------------------------------------------------------------- |
---|
| 48 | !! *** ROUTINE dyn_spg *** |
---|
| 49 | !! |
---|
[1566] | 50 | !! ** Purpose : achieve the momentum time stepping by computing the |
---|
| 51 | !! last trend, the surface pressure gradient, and performing |
---|
| 52 | !! the Leap-Frog integration. |
---|
| 53 | !!gm In the current version only the filtered solution provide |
---|
| 54 | !!gm the after velocity, in the 2 other (ua,va) are still the trends |
---|
| 55 | !! |
---|
| 56 | !! ** Method : Three schemes: |
---|
| 57 | !! - explicit computation : the spg is evaluated at now |
---|
| 58 | !! - filtered computation : the Roulet & madec (2000) technique is used |
---|
| 59 | !! - split-explicit computation: a time splitting technique is used |
---|
| 60 | !! |
---|
| 61 | !! N.B. : When key_esopa is used all the scheme are tested, regardless |
---|
| 62 | !! of the physical meaning of the results. |
---|
[358] | 63 | !!---------------------------------------------------------------------- |
---|
[1566] | 64 | INTEGER, INTENT(in ) :: kt ! ocean time-step index |
---|
| 65 | INTEGER, INTENT( out) :: kindic ! solver flag |
---|
[503] | 66 | !! |
---|
[1566] | 67 | REAL(wp) :: z2dt ! temporary scalar |
---|
[503] | 68 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: ztrdu, ztrdv ! 3D workspace |
---|
[358] | 69 | !!---------------------------------------------------------------------- |
---|
| 70 | |
---|
[1566] | 71 | |
---|
| 72 | !!gm NOTA BENE : the dynspg_exp and dynspg_ts should be modified so that |
---|
| 73 | !!gm they return the after velocity, not the trends (as in trazdf_imp...) |
---|
| 74 | !!gm In this case, change/simplify dynnxt |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | |
---|
[358] | 78 | IF( l_trddyn ) THEN ! temporary save of ta and sa trends |
---|
| 79 | ztrdu(:,:,:) = ua(:,:,:) |
---|
| 80 | ztrdv(:,:,:) = va(:,:,:) |
---|
| 81 | ENDIF |
---|
| 82 | |
---|
| 83 | SELECT CASE ( nspg ) ! compute surf. pressure gradient trend and add it to the general trend |
---|
[789] | 84 | ! |
---|
[1566] | 85 | CASE ( 0 ) ; CALL dyn_spg_exp( kt ) ! explicit |
---|
| 86 | CASE ( 1 ) ; CALL dyn_spg_ts ( kt ) ! time-splitting |
---|
| 87 | CASE ( 2 ) ; CALL dyn_spg_flt( kt, kindic ) ! filtered |
---|
[789] | 88 | ! |
---|
[1566] | 89 | CASE ( -1 ) ! esopa: test all possibility with control print |
---|
| 90 | CALL dyn_spg_exp( kt ) |
---|
| 91 | CALL prt_ctl( tab3d_1=ua, clinfo1=' spg0 - Ua: ', mask1=umask, & |
---|
| 92 | & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' ) |
---|
| 93 | CALL dyn_spg_ts ( kt ) |
---|
| 94 | CALL prt_ctl( tab3d_1=ua, clinfo1=' spg1 - Ua: ', mask1=umask, & |
---|
| 95 | & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' ) |
---|
| 96 | CALL dyn_spg_flt( kt, kindic ) |
---|
| 97 | CALL prt_ctl( tab3d_1=ua, clinfo1=' spg2 - Ua: ', mask1=umask, & |
---|
| 98 | & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' ) |
---|
[358] | 99 | END SELECT |
---|
[503] | 100 | ! |
---|
[1566] | 101 | IF( l_trddyn ) THEN ! save the surface pressure gradient trends for further diagnostics |
---|
[358] | 102 | SELECT CASE ( nspg ) |
---|
[1528] | 103 | CASE ( 0, 1 ) |
---|
[358] | 104 | ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) |
---|
| 105 | ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) |
---|
[1528] | 106 | CASE( 2 ) |
---|
[358] | 107 | z2dt = 2. * rdt |
---|
| 108 | IF( neuler == 0 .AND. kt == nit000 ) z2dt = rdt |
---|
| 109 | ztrdu(:,:,:) = ( ua(:,:,:) - ub(:,:,:) ) / z2dt - ztrdu(:,:,:) |
---|
| 110 | ztrdv(:,:,:) = ( va(:,:,:) - vb(:,:,:) ) / z2dt - ztrdv(:,:,:) |
---|
| 111 | END SELECT |
---|
[503] | 112 | CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_spg, 'DYN', kt ) |
---|
[358] | 113 | ENDIF |
---|
| 114 | ! ! print mean trends (used for debugging) |
---|
| 115 | IF(ln_ctl) CALL prt_ctl( tab3d_1=ua, clinfo1=' spg - Ua: ', mask1=umask, & |
---|
| 116 | & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' ) |
---|
[503] | 117 | ! |
---|
[358] | 118 | END SUBROUTINE dyn_spg |
---|
| 119 | |
---|
| 120 | |
---|
[2027] | 121 | SUBROUTINE dyn_spg_init |
---|
[358] | 122 | !!--------------------------------------------------------------------- |
---|
[2027] | 123 | !! *** ROUTINE dyn_spg_init *** |
---|
[358] | 124 | !! |
---|
| 125 | !! ** Purpose : Control the consistency between cpp options for |
---|
[1566] | 126 | !! surface pressure gradient schemes |
---|
[358] | 127 | !!---------------------------------------------------------------------- |
---|
| 128 | INTEGER :: ioptio |
---|
| 129 | !!---------------------------------------------------------------------- |
---|
| 130 | |
---|
[1566] | 131 | IF(lwp) THEN ! Control print |
---|
[358] | 132 | WRITE(numout,*) |
---|
[2027] | 133 | WRITE(numout,*) 'dyn_spg_init : choice of the surface pressure gradient scheme' |
---|
[358] | 134 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 135 | WRITE(numout,*) ' Explicit free surface lk_dynspg_exp = ', lk_dynspg_exp |
---|
| 136 | WRITE(numout,*) ' Free surface with time splitting lk_dynspg_ts = ', lk_dynspg_ts |
---|
| 137 | WRITE(numout,*) ' Filtered free surface cst volume lk_dynspg_flt = ', lk_dynspg_flt |
---|
| 138 | ENDIF |
---|
| 139 | |
---|
[1566] | 140 | ! ! Control of surface pressure gradient scheme options |
---|
[358] | 141 | ioptio = 0 |
---|
| 142 | IF(lk_dynspg_exp) ioptio = ioptio + 1 |
---|
| 143 | IF(lk_dynspg_ts ) ioptio = ioptio + 1 |
---|
| 144 | IF(lk_dynspg_flt) ioptio = ioptio + 1 |
---|
[1566] | 145 | ! |
---|
[474] | 146 | IF( ( ioptio > 1 .AND. .NOT. lk_esopa ) .OR. ioptio == 0 ) & |
---|
| 147 | & CALL ctl_stop( ' Choose only one surface pressure gradient scheme with a key cpp' ) |
---|
[1566] | 148 | ! |
---|
[358] | 149 | IF( lk_esopa ) nspg = -1 |
---|
| 150 | IF( lk_dynspg_exp) nspg = 0 |
---|
| 151 | IF( lk_dynspg_ts ) nspg = 1 |
---|
| 152 | IF( lk_dynspg_flt) nspg = 2 |
---|
[1566] | 153 | ! |
---|
[372] | 154 | IF( lk_esopa ) nspg = -1 |
---|
[1566] | 155 | ! |
---|
| 156 | IF(lwp) THEN |
---|
[358] | 157 | WRITE(numout,*) |
---|
[1528] | 158 | IF( nspg == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' |
---|
[372] | 159 | IF( nspg == 0 ) WRITE(numout,*) ' explicit free surface' |
---|
| 160 | IF( nspg == 1 ) WRITE(numout,*) ' free surface with time splitting scheme' |
---|
| 161 | IF( nspg == 2 ) WRITE(numout,*) ' filtered free surface' |
---|
[358] | 162 | ENDIF |
---|
| 163 | |
---|
[1566] | 164 | ! ! Control of timestep choice |
---|
[1241] | 165 | IF( lk_dynspg_ts .OR. lk_dynspg_exp ) THEN |
---|
[2392] | 166 | IF( nn_cla == 1 ) CALL ctl_stop( 'Crossland advection not implemented for this free surface formulation' ) |
---|
[358] | 167 | ENDIF |
---|
| 168 | |
---|
[2392] | 169 | ! ! Control of momentum formulation |
---|
[2338] | 170 | IF( lk_dynspg_ts .AND. lk_vvl ) THEN |
---|
[2392] | 171 | IF( .NOT.ln_dynadv_vec ) CALL ctl_stop( 'Flux form not implemented for this free surface formulation' ) |
---|
[2338] | 172 | ENDIF |
---|
| 173 | |
---|
[1058] | 174 | #if defined key_obc |
---|
[1566] | 175 | ! ! Conservation of ocean volume (key_dynspg_flt) |
---|
| 176 | IF( lk_dynspg_flt ) ln_vol_cst = .true. |
---|
[367] | 177 | |
---|
[1566] | 178 | ! ! Application of Flather's algorithm at open boundaries |
---|
| 179 | IF( lk_dynspg_flt ) ln_obc_fla = .false. |
---|
| 180 | IF( lk_dynspg_exp ) ln_obc_fla = .true. |
---|
| 181 | IF( lk_dynspg_ts ) ln_obc_fla = .true. |
---|
[367] | 182 | #endif |
---|
[1566] | 183 | ! |
---|
[2027] | 184 | END SUBROUTINE dyn_spg_init |
---|
[358] | 185 | |
---|
| 186 | !!====================================================================== |
---|
| 187 | END MODULE dynspg |
---|