My Project
extel_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 FLUXES OF FREE SURFACE ELEVATION (CONTINUITY) EQUATION |
42 !==============================================================================|
43  SUBROUTINE extel_edge(K)
44 !==============================================================================|
45  USE all_vars
46  USE bcs
47  USE mod_obcs
48 
49 
50 
51 ! ggao 0903/2007
52 
53 
54 
55  IMPLICIT NONE
56  INTEGER, INTENT(IN) :: K
57  REAL(SP) :: XFLUX(0:MT)
58  REAL(SP) :: DIJ,UIJ,VIJ,DTK,UN,EXFLUX
59  INTEGER :: I,J,I1,IA,IB,JJ,J1,J2
60 
61 
62 !==============================================================================|
63  IF(dbg_set(dbg_sbr)) WRITE(ipt,*) "Start: extel_edge.F",k
64 !----------INITIALIZE FLUX ARRAY ----------------------------------------------!
65 
66  xflux = 0.0_sp
67 
68 !---------ACCUMULATE FLUX BY LOOPING OVER CONTROL VOLUME HALF EDGES------------!
69 
70  DO i=1,ncv
71  i1 = ntrg(i)
72  ia = niec(i,1)
73  ib = niec(i,2)
74  dij = d1(i1)
75 
76  uij = ua(i1)
77  vij = va(i1)
78  exflux = dij*(-uij*dltye(i) + vij*dltxe(i))
79 
80 
81  xflux(ia) = xflux(ia)-exflux
82  xflux(ib) = xflux(ib)+exflux
83 
84 
85  END DO
86 
87 ! write(ipt,*) "after control volume flux",maxval(xflux),minval(xflux)
88 ! write(ipt,*) "after control volume flux",maxloc(xflux),minloc(xflux)
89 
90 
91 !--ADD EVAPORATION AND PRECIPITATION TERMS-------------------------------------!
92  IF (precipitation_on) THEN
93 
94 !qxu XFLUX = XFLUX+(QEVAP2-QPREC2)*ROFVROS*ART1
95 !qxu---the evap is negative for evaporating in ocean
96  xflux = xflux-(qevap2+qprec2)*rofvros*art1
97  END IF
98 
99 !--ADD GROUND WATER TERM-------------------------------------------------------!
100 
101  IF(groundwater_on) THEN
102  xflux = xflux - bfwdis2
103  END IF
104 
105 !--SAVE ACCUMULATED FLUX ON OPEN BOUNDARY NODES AND ZERO OUT OPEN BOUNDARY FLUX!
106 
107  IF(iobcn > 0) THEN
108  DO i=1,iobcn
109  xflux_obcn(i)=xflux(i_obc_n(i))
110  xflux(i_obc_n(i)) = 0.0_sp
111  END DO
112  END IF
113 
114 
115 !---------ADJUST FLUX FOR FRESH WATER DISCHARGE--------------------------------!
116 
117  IF(numqbc >= 1) THEN
118  IF(river_inflow_location == 'node') THEN
119  DO j=1,numqbc
120  jj=inodeq(j)
121  xflux(jj)=xflux(jj)-qdis(j)
122  END DO
123  ELSE IF(river_inflow_location == 'edge') THEN
124  DO j=1,numqbc
125  j1=n_icellq(j,1)
126  j2=n_icellq(j,2)
127  xflux(j1)=xflux(j1)-qdis(j)*rdisq(j,1)
128  xflux(j2)=xflux(j2)-qdis(j)*rdisq(j,2)
129  END DO
130  END IF
131  END IF
132 
133 
134 !----------PERFORM UPDATE ON ELF-----------------------------------------------!
135 
136  dtk = alpha_rk(k)*dte
137  elf = elrk - dtk*xflux/art1
138 !!# if defined (THIN_DAM)
139 !! DO I=1,NODE_DAM1_N
140 !! JN=I_NODE_DAM1_N(I,1)
141 !! ELF(JN)=ELRK(JN)-DTK*(XFLUX(JN)+XFLUX(I_NODE_DAM1_N(I,2)))&
142 !! &/(ART1(JN)+ART1(I_NODE_DAM1_N(I,2)))
143 !! ELF(I_NODE_DAM1_N(I,2))=ELF(JN)
144 !! END DO
145 !! DO I=1,NODE_DAM2_N
146 !! JN=I_NODE_DAM2_N(I,1)
147 !! ELF(JN)=ELRK(JN)-DTK*(XFLUX(JN)+XFLUX(I_NODE_DAM2_N(I,2))&
148 !! &+XFLUX(I_NODE_DAM2_N(I,3)) )&
149 !! &/(ART1(JN)+ART1(I_NODE_DAM2_N(I,2))+ART1(I_NODE_DAM2_N(I,3)))
150 !! ELF(I_NODE_DAM2_N(I,2))=ELF(JN)
151 !! ELF(I_NODE_DAM2_N(I,3))=ELF(JN)
152 !! END DO
153 !! DO I=1,NODE_DAM3_N
154 !! JN=I_NODE_DAM3_N(I,1)
155 !! ELF(JN)=ELRK(JN)-DTK*(XFLUX(JN)+XFLUX(I_NODE_DAM3_N(I,2))&
156 !! &+XFLUX(I_NODE_DAM3_N(I,3))+XFLUX(I_NODE_DAM3_N(I,4)) )&
157 !! &/(ART1(JN)+ART1(I_NODE_DAM3_N(I,2))+ART1(I_NODE_DAM3_N(I&
158 !! &,3))+ART1(I_NODE_DAM3_N(I,4)))
159 !! ELF(I_NODE_DAM3_N(I,2))=ELF(JN)
160 !! ELF(I_NODE_DAM3_N(I,3))=ELF(JN)
161 !! ELF(I_NODE_DAM3_N(I,4))=ELF(JN)
162 !! END DO
163 !!# endif
164 
165 !
166 !--STORE VARIABLES FOR MOMENTUM BALANCE CHECK----------------------------------|
167 !
168 
169  IF(dbg_set(dbg_sbr)) WRITE(ipt,*) "END: extel_edge.F"
170 
171  RETURN
172  END SUBROUTINE extel_edge
173 !==============================================================================|
real(sp), dimension(:), allocatable, target va
Definition: mod_main.f90:1104
real(sp), dimension(:), allocatable, target d1
Definition: mod_main.f90:1116
real(sp), dimension(:), allocatable, target elrk
Definition: mod_main.f90:1138
real(sp), dimension(:), allocatable, target qevap2
Definition: mod_main.f90:1237
real(sp), dimension(:), allocatable, target art1
Definition: mod_main.f90:1010
real(sp), dimension(:), allocatable, target qdis
Definition: mod_main.f90:1220
real(sp), dimension(:), allocatable, target bfwdis2
Definition: mod_main.f90:1198
integer, dimension(:), allocatable, target ntrg
Definition: mod_main.f90:1033
integer, dimension(:,:), allocatable, target niec
Definition: mod_main.f90:1032
real(sp), dimension(:,:), allocatable, target rdisq
Definition: mod_main.f90:1227
real(sp), dimension(:), allocatable, target dltye
Definition: mod_main.f90:1051
integer iobcn
Definition: mod_main.f90:1777
integer, dimension(:), allocatable i_obc_n
Definition: mod_main.f90:1779
real(sp), dimension(:), allocatable, target elf
Definition: mod_main.f90:1140
real(sp), dimension(:), allocatable xflux_obcn
Definition: mod_obcs.f90:111
integer, dimension(:,:), allocatable, target n_icellq
Definition: mod_main.f90:1216
real(sp), dimension(:), allocatable, target ua
Definition: mod_main.f90:1103
subroutine extel_edge(K)
Definition: extel_edge.f90:44
real(sp), dimension(:), allocatable, target qprec2
Definition: mod_main.f90:1236
real(sp), dimension(:), allocatable, target dltxe
Definition: mod_main.f90:1050
integer, dimension(:), allocatable, target inodeq
Definition: mod_main.f90:1214