My Project
adjust2d3d.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  SUBROUTINE adjust2d3d(ADJUST_TYPE)
41 !==============================================================================|
42 ! ADJUST 3D VELOCITY USING DEFECT BETWEEN UPDATED AND CURRENT VERTICALLY !
43 ! AVERAGED VELOCITIES !
44 ! !
45 ! FORMULA IS: !
46 ! !
47 ! U_adjusted = U_orig + eps*(U_avg_new - U_avg_current) !
48 ! eps = 0 : no adjustment !
49 ! eps = 1 : full adjustment !
50 !==============================================================================|
51  USE mod_wd
52  USE all_vars
53  USE mod_utils
54  IMPLICIT NONE
55  INTEGER, INTENT(IN) :: ADJUST_TYPE
56  INTEGER :: I,K
57  REAL(SP), PARAMETER :: EPS = 1.0_sp
58  REAL(SP) :: UAC,VAC,UTMP,VTMP
59 !==============================================================================!
60 
61  if(dbg_set(dbg_sbr)) write(ipt,*) "Start: adjust2d3d"
62 
63  SELECT CASE(adjust_type)
64 
65  CASE(1)
66  DO i=1,nt
67  uac = sum(u(i,1:kbm1)*dz1(i,1:kbm1))
68  vac = sum(v(i,1:kbm1)*dz1(i,1:kbm1))
69  u(i,1:kbm1) = u(i,1:kbm1) + eps*(ua(i) - uac)
70  v(i,1:kbm1) = v(i,1:kbm1) + eps*(va(i) - vac)
71  END DO
72 
73  CASE(2)
74  uard = uard/float(isplit)
75  vard = vard/float(isplit)
76 !!# if defined (1)
77 !! UARDS = UARDS/FLOAT(ISPLIT)
78 !! VARDS = VARDS/FLOAT(ISPLIT)
79 !!# endif
80 
81 
82  DO i=1,nt
83  IF(iswetct(i)*iswetc(i) == 1)THEN
84  utmp = 0.0_sp ; vtmp = 0.0_sp
85  DO k=1,kbm1
86  utmp = utmp + u(i,k)*dz1(i,k)
87  vtmp = vtmp + v(i,k)*dz1(i,k)
88  END DO
89  utmp = utmp*dt1(i)
90  vtmp = vtmp*dt1(i)
91  DO k=1,kbm1
92  u(i,k) = u(i,k) - (utmp-uard(i))/dt1(i)
93  v(i,k) = v(i,k) - (vtmp-vard(i))/dt1(i)
94  END DO
95  END IF
96  END DO
97 
98 !!# if defined (1)
99 !! DO I=1,NT
100 !! UTMP = 0.0_SP ; VTMP = 0.0_SP
101 !! DO K=1,KBM1
102 !! UTMP = UTMP + U(I,K)*DZ1(I,K)
103 !! VTMP = VTMP + V(I,K)*DZ1(I,K)
104 !! END DO
105 !! UTMP = UTMP*DT1(I)
106 !! VTMP = VTMP*DT1(I)
107 !! DO K=1,KBM1
108 !! US(I,K) = U(I,K) - (UTMP-UARDS(I))/DT1(I)
109 !! VS(I,K) = V(I,K) - (VTMP-VARDS(I))/DT1(I)
110 !! END DO
111 !! END DO
112 !!# endif
113 
114  END SELECT
115 
116  if(dbg_set(dbg_sbr)) write(ipt,*) "End: adjust2d3d"
117 
118  END SUBROUTINE adjust2d3d
119 !==============================================================================|
real(sp), dimension(:), allocatable, target va
Definition: mod_main.f90:1104
real(sp), dimension(:,:), allocatable, target v
Definition: mod_main.f90:1269
logical function dbg_set(vrb)
Definition: mod_utils.f90:182
integer, dimension(:), allocatable iswetct
Definition: mod_wd.f90:54
real(sp), dimension(:,:), allocatable, target u
Definition: mod_main.f90:1268
real(sp), dimension(:), allocatable, target vard
Definition: mod_main.f90:1111
real(sp), dimension(:), allocatable, target uard
Definition: mod_main.f90:1110
subroutine adjust2d3d(ADJUST_TYPE)
Definition: adjust2d3d.f90:41
real(sp), dimension(:), allocatable, target ua
Definition: mod_main.f90:1103
integer, dimension(:), allocatable iswetc
Definition: mod_wd.f90:52
real(sp), dimension(:), allocatable, target dt1
Definition: mod_main.f90:1117
real(sp), dimension(:,:), allocatable, target dz1
Definition: mod_main.f90:1096
integer, parameter dbg_sbr
Definition: mod_utils.f90:69