My Project
extelpf_edge.f90
Go to the documentation of this file.
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 !/===========================================================================/
13 ! Copyright (c) 2007, The University of Massachusetts Dartmouth
14 ! Produced at the School of Marine Science & Technology
15 ! Marine Ecosystem Dynamics Modeling group
16 ! All rights reserved.
17 !
18 ! FVCOM has been developed by the joint UMASSD-WHOI research team. For
19 ! details of authorship and attribution of credit please see the FVCOM
20 ! technical manual or contact the MEDM group.
21 !
22 !
23 ! This file is part of FVCOM. For details, see http://fvcom.smast.umassd.edu
24 ! The full copyright notice is contained in the file COPYRIGHT located in the
25 ! root directory of the FVCOM code. This original header must be maintained
26 ! in all distributed versions.
27 !
28 ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29 ! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
30 ! THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31 ! PURPOSE ARE DISCLAIMED.
32 !
33 !/---------------------------------------------------------------------------/
34 ! CVS VERSION INFORMATION
35 ! $Id$
36 ! $Name$
37 ! $Revision$
38 !/===========================================================================/
39 
40 !==============================================================================|
41 ! CALCULATE n+1 time step perturbation water surface elevation |
42 !==============================================================================|
43  SUBROUTINE extelpf_edge(KKT)
44 !==============================================================================|
45  USE all_vars
46  USE bcs
47 
48  USE mod_obcs2
49  USE mod_obcs3
50 
51  IMPLICIT NONE
52  INTEGER, INTENT(IN) :: KKT
53  REAL(SP) :: XFLUX(0:MT)
54  REAL(SP) :: DIJ,UIJ,VIJ,DTK,EXFLUX,FXFLUX,FFLUX(1:IOBCN),TP,CC,CP
55  INTEGER :: I,J,I1,IA,IB,JJ,J1,J2,J3,II,JN
56 
57 !---------ACCUMULATE FLUX BY LOOPING OVER CONTROL VOLUME HALF EDGES------------!
58 
59  xflux = 0.0_sp
60  DO ii=1,nobcv
61  i = nobedge_lst(ii)
62  i1 = ntrg(i)
63  ia = niec(i,1)
64  ib = niec(i,2)
65  j1 = i_obc_node(nv(i1,1))
66  j2 = i_obc_node(nv(i1,2))
67  j3 = i_obc_node(nv(i1,3))
68  dij = h1(i1) + one_third*(elt(j1)+elt(j2)+elt(j3))
69  uij = uat(i_obc_cell(i1))
70  vij = vat(i_obc_cell(i1))
71  exflux = dij*(-uij*dltye(i) + vij*dltxe(i))
72 
73 
74  xflux(ia) = xflux(ia)-exflux
75  xflux(ib) = xflux(ib)+exflux
76  END DO
77 
78  DO i = 1, iobcn
79  j = i_obc_n(i)
80  j1= i_obc_node(j)
81  fxflux = -(eltf(j1)-elrkt(j1))*art1(j)/(alpha_rk(kkt)*dte) - xflux(j)
82  fflux(i)= fxflux / (h(j)+elt(j1)) * elp(j1)
83  END DO
84 
85  xflux = 0.0_sp
86  DO ii=1,nobcv
87  i = nobedge_lst(ii)
88  i1 = ntrg(i)
89  ia = niec(i,1)
90  ib = niec(i,2)
91  j1 = i_obc_node(nv(i1,1))
92  j2 = i_obc_node(nv(i1,2))
93  j3 = i_obc_node(nv(i1,3))
94  dij = one_third * (elp(j1)+elp(j2)+elp(j3))
95  uij = uat(i_obc_cell(i1))
96  vij = vat(i_obc_cell(i1))
97  exflux = dij*(-uij*dltye(i) + vij*dltxe(i))
98 
99 
100  xflux(ia) = xflux(ia)-exflux
101  xflux(ib) = xflux(ib)+exflux
102  END DO
103 
104  DO i = 1, iobcn
105  j = i_obc_n(i)
106  fflux(i) = fflux(i) + xflux(j)
107  END DO
108 
109  xflux = 0.0_sp
110  DO ii=1,nobcv
111  i = nobedge_lst(ii)
112  i1 = ntrg(i)
113  ia = niec(i,1)
114  ib = niec(i,2)
115  j1 = i_obc_node(nv(i1,1))
116  j2 = i_obc_node(nv(i1,2))
117  j3 = i_obc_node(nv(i1,3))
118  dij = h1(i1) + one_third*(elt(j1)+elt(j2)+elt(j3)+ &
119  elp(j1)+ elp(j2)+elp(j3))
120  uij = uap(i_obc_cell(i1))
121  vij = vap(i_obc_cell(i1))
122  exflux = dij*(-uij*dltye(i) + vij*dltxe(i))
123 
124 
125  xflux(ia) = xflux(ia)-exflux
126  xflux(ib) = xflux(ib)+exflux
127  END DO
128 
129  DO i = 1, iobcn
130  j = i_obc_n(i)
131  fflux(i) = fflux(i) + xflux(j) + fluxobn2(i)
132  END DO
133  fluxobn2 = 0.0_sp
134 
135  IF (ibcn(1) > 0) THEN
136  DO i = 1, ibcn(1)
137  jn = obc_lst(1,i)
138  j = i_obc_n(jn)
139  j1 = i_obc_node(j)
140  elpf(j1) = elrkp(j1) - alpha_rk(kkt)*dte*fflux(jn)/art1(j)
141  END DO
142  END IF
143 
144  tp = 10800.0_sp ! 3 hours
145  IF (ibcn(4) > 0) THEN
146  DO i = 1, ibcn(4)
147  jn = obc_lst(4,i)
148  j = i_obc_n(jn)
149  j1 = i_obc_node(j)
150 
151  i1 = i_obc_node(next_obc(jn))
152  cc = sqrt(grav_n(j)*d(j))*alpha_rk(kkt)*dte/dltn_obc(jn)
153  cp = cc + 1.0_sp
154 
155  elpf(j1) = (cc*elpf(i1) + elrkp(j1)*(1.0_sp-alpha_rk(kkt)*dte/tp))/cp
156  END DO
157  END IF
158 
159  IF((ibcn(2)>0).or.(ibcn(3)>0).or.(ibcn(5)>0)) print *,"error in EXTELPF_EDGE.F"
160 
161  RETURN
162  END SUBROUTINE extelpf_edge
163 !==============================================================================|
real(sp), dimension(:), allocatable fluxobn2
Definition: mod_obcs3.f90:53
real(sp), dimension(:), allocatable, target d
Definition: mod_main.f90:1132
integer, dimension(:), allocatable i_obc_cell
Definition: mod_obcs2.f90:55
real(sp), dimension(:), allocatable, target h
Definition: mod_main.f90:1131
real(sp), dimension(:), allocatable, target art1
Definition: mod_main.f90:1010
real(sp), dimension(:), allocatable elp
Definition: mod_obcs2.f90:59
integer, dimension(:), allocatable i_obc_node
Definition: mod_obcs2.f90:55
real(sp), dimension(:), allocatable elrkt
Definition: mod_obcs2.f90:58
integer, dimension(:), allocatable, target ntrg
Definition: mod_main.f90:1033
real(sp), dimension(:), allocatable elt
Definition: mod_obcs2.f90:58
integer, dimension(:,:), allocatable, target niec
Definition: mod_main.f90:1032
real(sp), dimension(:), allocatable uap
Definition: mod_obcs2.f90:61
real(sp), dimension(:), allocatable, target dltye
Definition: mod_main.f90:1051
integer, dimension(:), allocatable i_obc_n
Definition: mod_main.f90:1779
subroutine extelpf_edge(KKT)
integer nobcv
Definition: mod_obcs2.f90:53
integer, dimension(:,:), allocatable, target nv
Definition: mod_main.f90:1018
real(sp), dimension(:), allocatable elrkp
Definition: mod_obcs2.f90:59
real(sp), dimension(:), allocatable uat
Definition: mod_obcs2.f90:60
real(sp), dimension(:), allocatable elpf
Definition: mod_obcs2.f90:59
real(sp), dimension(:), allocatable, target h1
Definition: mod_main.f90:1115
real(sp), dimension(:), allocatable eltf
Definition: mod_obcs2.f90:58
real(sp), dimension(:), allocatable, target grav_n
Definition: mod_main.f90:1013
integer, dimension(:), allocatable nobedge_lst
Definition: mod_obcs2.f90:54
real(sp), dimension(:), allocatable, target dltxe
Definition: mod_main.f90:1050
real(sp), dimension(:), allocatable vat
Definition: mod_obcs2.f90:60
real(sp), dimension(:), allocatable vap
Definition: mod_obcs2.f90:61