1 | MODULE bdytra |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE bdytra *** |
---|
4 | !! Ocean tracers: Apply boundary conditions for tracers |
---|
5 | !!====================================================================== |
---|
6 | !! History : 1.0 ! 2005-01 (J. Chanut, A. Sellar) Original code |
---|
7 | !! 3.0 ! 2008-04 (NEMO team) add in the reference version |
---|
8 | !! 3.4 ! 2011 (D. Storkey) rewrite in preparation for OBC-BDY merge |
---|
9 | !! 3.5 ! 2012 (S. Mocavero, I. Epicoco) Optimization of BDY communications |
---|
10 | !! 4.0 ! 2016 (T. Lovato) Generalize OBC structure |
---|
11 | !!---------------------------------------------------------------------- |
---|
12 | !! bdy_tra : Apply open boundary conditions & damping to T and S |
---|
13 | !!---------------------------------------------------------------------- |
---|
14 | USE oce ! ocean dynamics and tracers variables |
---|
15 | USE dom_oce ! ocean space and time domain variables |
---|
16 | USE bdy_oce ! ocean open boundary conditions |
---|
17 | USE bdylib ! for orlanski library routines |
---|
18 | ! |
---|
19 | USE in_out_manager ! I/O manager |
---|
20 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
21 | USE lib_mpp, ONLY: ctl_stop |
---|
22 | USE timing ! Timing |
---|
23 | |
---|
24 | IMPLICIT NONE |
---|
25 | PRIVATE |
---|
26 | |
---|
27 | ! Local structure to rearrange tracers data |
---|
28 | TYPE, PUBLIC :: ztrabdy |
---|
29 | REAL(wp), POINTER, DIMENSION(:,:) :: tra |
---|
30 | END TYPE |
---|
31 | |
---|
32 | PUBLIC bdy_tra ! called in tranxt.F90 |
---|
33 | PUBLIC bdy_tra_dmp ! called in step.F90 |
---|
34 | |
---|
35 | !!---------------------------------------------------------------------- |
---|
36 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
37 | !! $Id$ |
---|
38 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
39 | !!---------------------------------------------------------------------- |
---|
40 | CONTAINS |
---|
41 | |
---|
42 | SUBROUTINE bdy_tra( kt, Kbb, pts, Kaa ) |
---|
43 | !!---------------------------------------------------------------------- |
---|
44 | !! *** SUBROUTINE bdy_tra *** |
---|
45 | !! |
---|
46 | !! ** Purpose : - Apply open boundary conditions for temperature and salinity |
---|
47 | !! |
---|
48 | !!---------------------------------------------------------------------- |
---|
49 | INTEGER , INTENT(in) :: kt ! Main time step counter |
---|
50 | INTEGER , INTENT(in) :: Kbb, Kaa ! time level indices |
---|
51 | REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts ! tracer fields |
---|
52 | ! |
---|
53 | INTEGER :: ib_bdy, jn, igrd ! Loop indices |
---|
54 | TYPE(ztrabdy), DIMENSION(jpts) :: zdta ! Temporary data structure |
---|
55 | !!---------------------------------------------------------------------- |
---|
56 | igrd = 1 |
---|
57 | |
---|
58 | DO ib_bdy=1, nb_bdy |
---|
59 | ! |
---|
60 | zdta(1)%tra => dta_bdy(ib_bdy)%tem |
---|
61 | zdta(2)%tra => dta_bdy(ib_bdy)%sal |
---|
62 | ! |
---|
63 | DO jn = 1, jpts |
---|
64 | ! |
---|
65 | SELECT CASE( TRIM(cn_tra(ib_bdy)) ) |
---|
66 | CASE('none' ) ; CYCLE |
---|
67 | CASE('frs' ) ; CALL bdy_frs ( idx_bdy(ib_bdy), pts(:,:,:,jn,Kaa), zdta(jn)%tra ) |
---|
68 | CASE('specified' ) ; CALL bdy_spe ( idx_bdy(ib_bdy), pts(:,:,:,jn,Kaa), zdta(jn)%tra ) |
---|
69 | CASE('neumann' ) ; CALL bdy_nmn ( idx_bdy(ib_bdy), igrd , pts(:,:,:,jn,Kaa) ) |
---|
70 | CASE('orlanski' ) ; CALL bdy_orl ( idx_bdy(ib_bdy), pts(:,:,:,jn,Kbb), pts(:,:,:,jn,Kaa), zdta(jn)%tra, ll_npo=.false. ) |
---|
71 | CASE('orlanski_npo') ; CALL bdy_orl ( idx_bdy(ib_bdy), pts(:,:,:,jn,Kbb), pts(:,:,:,jn,Kaa), zdta(jn)%tra, ll_npo=.true. ) |
---|
72 | CASE('runoff' ) ; CALL bdy_rnf ( idx_bdy(ib_bdy), pts(:,:,:,jn,Kaa), jn ) |
---|
73 | CASE DEFAULT ; CALL ctl_stop( 'bdy_tra : unrecognised option for open boundaries for T and S' ) |
---|
74 | END SELECT |
---|
75 | ! Boundary points should be updated |
---|
76 | CALL lbc_bdy_lnk( 'bdytra', pts(:,:,:,jn,Kaa), 'T', 1., ib_bdy ) |
---|
77 | ! |
---|
78 | END DO |
---|
79 | END DO |
---|
80 | ! |
---|
81 | END SUBROUTINE bdy_tra |
---|
82 | |
---|
83 | |
---|
84 | SUBROUTINE bdy_rnf( idx, pt, jpa ) |
---|
85 | !!---------------------------------------------------------------------- |
---|
86 | !! *** SUBROUTINE bdy_rnf *** |
---|
87 | !! |
---|
88 | !! ** Purpose : Specialized routine to apply TRA runoff values at OBs: |
---|
89 | !! - duplicate the neighbour value for the temperature |
---|
90 | !! - specified to 0.1 PSU for the salinity |
---|
91 | !! |
---|
92 | !!---------------------------------------------------------------------- |
---|
93 | TYPE(OBC_INDEX), INTENT(in) :: idx ! OBC indices |
---|
94 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pt ! tracer trend |
---|
95 | INTEGER, INTENT(in) :: jpa ! TRA index |
---|
96 | ! |
---|
97 | REAL(wp) :: zwgt ! boundary weight |
---|
98 | INTEGER :: ib, ik, igrd ! dummy loop indices |
---|
99 | INTEGER :: ii, ij, ip, jp ! 2D addresses |
---|
100 | !!---------------------------------------------------------------------- |
---|
101 | ! |
---|
102 | igrd = 1 ! Everything is at T-points here |
---|
103 | DO ib = 1, idx%nblenrim(igrd) |
---|
104 | ii = idx%nbi(ib,igrd) |
---|
105 | ij = idx%nbj(ib,igrd) |
---|
106 | DO ik = 1, jpkm1 |
---|
107 | ip = bdytmask(ii+1,ij ) - bdytmask(ii-1,ij ) |
---|
108 | jp = bdytmask(ii ,ij+1) - bdytmask(ii ,ij-1) |
---|
109 | if (jpa == jp_tem) pt(ii,ij,ik) = pt(ii+ip,ij+jp,ik) * tmask(ii,ij,ik) |
---|
110 | if (jpa == jp_sal) pt(ii,ij,ik) = 0.1 * tmask(ii,ij,ik) |
---|
111 | END DO |
---|
112 | END DO |
---|
113 | ! |
---|
114 | END SUBROUTINE bdy_rnf |
---|
115 | |
---|
116 | |
---|
117 | SUBROUTINE bdy_tra_dmp( kt, Kbb, pts, Krhs ) |
---|
118 | !!---------------------------------------------------------------------- |
---|
119 | !! *** SUBROUTINE bdy_tra_dmp *** |
---|
120 | !! |
---|
121 | !! ** Purpose : Apply damping for tracers at open boundaries. |
---|
122 | !! |
---|
123 | !!---------------------------------------------------------------------- |
---|
124 | INTEGER , INTENT(in) :: kt ! time step |
---|
125 | INTEGER , INTENT(in) :: Kbb, Krhs ! time level indices |
---|
126 | REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts ! active tracers and RHS of tracer equation |
---|
127 | ! |
---|
128 | REAL(wp) :: zwgt ! boundary weight |
---|
129 | REAL(wp) :: zta, zsa, ztime |
---|
130 | INTEGER :: ib, ik, igrd ! dummy loop indices |
---|
131 | INTEGER :: ii, ij ! 2D addresses |
---|
132 | INTEGER :: ib_bdy ! Loop index |
---|
133 | !!---------------------------------------------------------------------- |
---|
134 | ! |
---|
135 | IF( ln_timing ) CALL timing_start('bdy_tra_dmp') |
---|
136 | ! |
---|
137 | DO ib_bdy = 1, nb_bdy |
---|
138 | IF( ln_tra_dmp(ib_bdy) ) THEN |
---|
139 | igrd = 1 ! Everything is at T-points here |
---|
140 | DO ib = 1, idx_bdy(ib_bdy)%nblen(igrd) |
---|
141 | ii = idx_bdy(ib_bdy)%nbi(ib,igrd) |
---|
142 | ij = idx_bdy(ib_bdy)%nbj(ib,igrd) |
---|
143 | zwgt = idx_bdy(ib_bdy)%nbd(ib,igrd) |
---|
144 | DO ik = 1, jpkm1 |
---|
145 | zta = zwgt * ( dta_bdy(ib_bdy)%tem(ib,ik) - pts(ii,ij,ik,jp_tem,Kbb) ) * tmask(ii,ij,ik) |
---|
146 | zsa = zwgt * ( dta_bdy(ib_bdy)%sal(ib,ik) - pts(ii,ij,ik,jp_sal,Kbb) ) * tmask(ii,ij,ik) |
---|
147 | pts(ii,ij,ik,jp_tem,Krhs) = pts(ii,ij,ik,jp_tem,Krhs) + zta |
---|
148 | pts(ii,ij,ik,jp_sal,Krhs) = pts(ii,ij,ik,jp_sal,Krhs) + zsa |
---|
149 | END DO |
---|
150 | END DO |
---|
151 | ENDIF |
---|
152 | END DO |
---|
153 | ! |
---|
154 | IF( ln_timing ) CALL timing_stop('bdy_tra_dmp') |
---|
155 | ! |
---|
156 | END SUBROUTINE bdy_tra_dmp |
---|
157 | |
---|
158 | !!====================================================================== |
---|
159 | END MODULE bdytra |
---|