My Project
extuv_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 ! ACCUMLATE FLUXES FOR EXTERNAL MODE |
42 !==============================================================================|
43 
44  SUBROUTINE extuv_edge(K)
45 
46 !==============================================================================|
47  USE all_vars
48  USE mod_utils
49  USE mod_wd
50 
51  USE mod_northpole
52 
53 
54 
55 
56  IMPLICIT NONE
57  INTEGER, INTENT(IN) :: K
58  REAL(SP), DIMENSION(0:NT) :: RESX,RESY,TMP
59  REAL(SP) :: UAFT,VAFT
60  INTEGER :: I
61 
62 !==============================================================================|
63 
64  if(dbg_set(dbg_sbr)) write(ipt,*) "Start: extuv_edge.F"
65 
66 !
67 !--ACCUMULATE RESIDUALS FOR EXTERNAL MODE EQUATIONS----------------------------|
68 !
69  uaft = uaf(0)
70  vaft = vaf(0)
71 
72  ! THIS APPEARS TO BE TO PREVENT DIVISION BY ZERO, BUT IT IS A
73  ! STRANGE WAY TO DO IT!
74  h1(0)= h1(1)
75 
76 !!# if defined (1)
77 !! IF(K == 3)THEN
78 
79 !!# if !defined (NH)
80 !! RESX = ADX2D + ADVUA + DRX2D + PSTX - COR*VA*D1*ART &
81 !! -(WUSURF2 + WUBOT)*ART
82 !! RESY = ADY2D + ADVVA + DRY2D + PSTY + COR*UA*D1*ART &
83 !! -(WVSURF2 + WVBOT)*ART
84 !!# else
85 !! RESX = ADX2D + ADVUA + DRX2D + PSTX - COR*VA*D1*ART &
86 !! -(WUSURF2 + WUBOT)*ART + NHQ2DX
87 !! RESY = ADY2D + ADVVA + DRY2D + PSTY + COR*UA*D1*ART &
88 !! -(WVSURF2 + WVBOT)*ART + NHQ2DY
89 !!# endif
90 
91 !!# if defined (SPHERICAL)
92 !! RESX = RESX -UA*VA/REARTH*TAN(DEG2RAD*YC)*D1*ART
93 !! RESY = RESY +UA*UA/REARTH*TAN(DEG2RAD*YC)*D1*ART
94 !!# endif
95 
96 !!!
97 !!!--UPDATE----------------------------------------------------------------------|
98 !!!
99 
100 !! UAF = (UARK*(H1+ELRK1)-ALPHA_RK(K)*DTE*RESX/ART)/(H1+ELF1)
101 !! VAF = (VARK*(H1+ELRK1)-ALPHA_RK(K)*DTE*RESY/ART)/(H1+ELF1)
102 !! UAS = UAF
103 !! VAS = VAF
104 !! END IF
105 !!# endif
106 
107  DO i=1,nt
108  IF(iswetce(i)*iswetc(i) == 1)THEN
109 
110  resx(i) = adx2d(i)+advua(i)+drx2d(i)+pstx(i)-cor(i)*va(i)*d1(i)*art(i) &
111  -(wusurf2(i)+wubot(i))*art(i)
112  resy(i) = ady2d(i)+advva(i)+dry2d(i)+psty(i)+cor(i)*ua(i)*d1(i)*art(i) &
113  -(wvsurf2(i)+wvbot(i))*art(i)
114 
115 
116 
117 !
118 !--UPDATE----------------------------------------------------------------------|
119 !
120 
121  uaf(i) = (uark(i)*(h1(i)+elrk1(i))-alpha_rk(k)*dte*resx(i)/art(i))/(h1(i)+elf1(i))
122  vaf(i) = (vark(i)*(h1(i)+elrk1(i))-alpha_rk(k)*dte*resy(i)/art(i))/(h1(i)+elf1(i))
123  ELSE
124  uaf(i) = 0.0_sp
125  vaf(i) = 0.0_sp
126  END IF
127  END DO
128 
129 
130  vaf(0) = vaft
131  uaf(0) = uaft
132 
133 !
134 !--ADJUST EXTERNAL VELOCITY IN SPONGE REGION-----------------------------------|
135 !
136 !old: UAF = UAF-CC_SPONGE*UAF
137 !old: VAF = VAF-CC_SPONGE*VAF
138 ! ---- new: Karsten Lettmann: 2012.06.25 -------
139  uaf = uaf/(1.0_sp+cc_sponge*uaf**2.0_sp)
140  vaf = vaf/(1.0_sp+cc_sponge*vaf**2.0_sp)
141 ! ------- end new -------------------------------
142 
143 
144 !
145 !--STORE VARIABLES FOR MOMENTUM BALANCE CHECK----------------------------------|
146 !
147 
148  if(dbg_set(dbg_sbr)) write(ipt,*) "End: extuv_edge.F"
149 
150  END SUBROUTINE extuv_edge
151 !==============================================================================|
real(sp), dimension(:), allocatable, target elrk1
Definition: mod_main.f90:1121
real(sp), dimension(:), allocatable, target va
Definition: mod_main.f90:1104
real(sp), dimension(:), allocatable, target cor
Definition: mod_main.f90:1113
real(sp), dimension(:), allocatable, target d1
Definition: mod_main.f90:1116
real(sp), dimension(:), allocatable, target adx2d
Definition: mod_main.f90:1258
integer, dimension(:), allocatable iswetce
Definition: mod_wd.f90:55
real(sp), dimension(:), allocatable, target psty
Definition: mod_main.f90:1255
real(sp), dimension(:), allocatable, target art
Definition: mod_main.f90:1009
real(sp), dimension(:), allocatable, target uark
Definition: mod_main.f90:1108
real(sp), dimension(:), allocatable, target advua
Definition: mod_main.f90:1256
logical function dbg_set(vrb)
Definition: mod_utils.f90:182
real(sp), dimension(:), allocatable, target wubot
Definition: mod_main.f90:1185
real(sp), dimension(:), allocatable, target pstx
Definition: mod_main.f90:1254
real(sp), dimension(:), allocatable, target wvbot
Definition: mod_main.f90:1186
real(sp), dimension(:), allocatable, target wvsurf2
Definition: mod_main.f90:1183
real(sp), dimension(:), allocatable, target vaf
Definition: mod_main.f90:1106
real(sp), dimension(:), allocatable, target wusurf2
Definition: mod_main.f90:1182
real(sp), dimension(:), allocatable, target ua
Definition: mod_main.f90:1103
real(sp), dimension(:), allocatable, target ady2d
Definition: mod_main.f90:1259
integer, dimension(:), allocatable iswetc
Definition: mod_wd.f90:52
real(sp), dimension(:), allocatable, target h1
Definition: mod_main.f90:1115
real(sp), dimension(:), allocatable, target uaf
Definition: mod_main.f90:1105
real(sp), dimension(:), allocatable, target dry2d
Definition: mod_main.f90:1261
real(sp), dimension(:), allocatable, target elf1
Definition: mod_main.f90:1123
real(sp), dimension(:), allocatable, target cc_sponge
Definition: mod_main.f90:1127
subroutine extuv_edge(K)
Definition: extuv_edge.f90:45
integer, parameter dbg_sbr
Definition: mod_utils.f90:69
real(sp), dimension(:), allocatable, target vark
Definition: mod_main.f90:1109
real(sp), dimension(:), allocatable, target advva
Definition: mod_main.f90:1257
real(sp), dimension(:), allocatable, target drx2d
Definition: mod_main.f90:1260