My Project
viscofh.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 Advection and Horizontal Diffusion Terms for Temperature |
42 !==============================================================================|
43 
44  SUBROUTINE viscof_h
45 
46 !------------------------------------------------------------------------------|
47  USE mod_utils
48  USE all_vars
49 
50  IMPLICIT NONE
51  REAL(SP) :: PUPX,PUPY,PVPX,PVPY
52  REAL(SP) :: tmp1,tmp2
53  INTEGER :: I,I1,K,J
54 
55 
56  IF(dbg_set(dbg_sbr)) WRITE(ipt,*) "Start: viscofh"
57 
58  SELECT CASE(horizontal_mixing_type)
59  CASE ('closure')
60  ! Run Subroutine
61  CASE('constant')
62  IF(dbg_set(dbg_sbr)) WRITE(ipt,*) "End: viscofh (constant)"
63  CASE DEFAULT
64  CALL fatal_error("UNKNOW HORIZONTAL MIXING TYPE:",&
65  & trim(horizontal_mixing_type) )
66  END SELECT
67 
68 
69  DO k=1,kbm1
70  DO i=1,m
71  pupx=0.0_sp
72  pupy=0.0_sp
73  pvpx=0.0_sp
74  pvpy=0.0_sp
75 
76  j=1
77  i1=nbve(i,j)
78 
79 
80  pupx=pupx+u(i1,k)*dltyecec(i,j)
81  pupy=pupy+u(i1,k)*dltxecec(i,j)
82  pvpx=pvpx+v(i1,k)*dltyecec(i,j)
83  pvpy=pvpy+v(i1,k)*dltxecec(i,j)
84 
85 
86  IF(isonb(i) /= 0) THEN
87 
88  pupx=pupx+u(i1,k)*dltynec(i,j)
89  pupy=pupy+u(i1,k)*dltxnec(i,j)
90  pvpx=pvpx+v(i1,k)*dltynec(i,j)
91  pvpy=pvpy+v(i1,k)*dltxnec(i,j)
92 
93  END IF
94 
95  DO j=2,ntve(i)-1
96  i1=nbve(i,j)
97 
98  pupx=pupx+u(i1,k)*dltyecec(i,j)
99  pupy=pupy+u(i1,k)*dltxecec(i,j)
100  pvpx=pvpx+v(i1,k)*dltyecec(i,j)
101  pvpy=pvpy+v(i1,k)*dltxecec(i,j)
102 
103  END DO
104 
105  j=ntve(i)
106  i1=nbve(i,j)
107 
108 
109  pupx=pupx+u(i1,k)*dltyecec(i,j)
110  pupy=pupy+u(i1,k)*dltxecec(i,j)
111  pvpx=pvpx+v(i1,k)*dltyecec(i,j)
112  pvpy=pvpy+v(i1,k)*dltxecec(i,j)
113 
114 
115  IF(isonb(i) /= 0) THEN
116 
117  pupx=pupx+u(i1,k)*(-dltynec(i,j))
118  pupy=pupy+u(i1,k)*(-dltxnec(i,j))
119  pvpx=pvpx+v(i1,k)*(-dltynec(i,j))
120  pvpy=pvpy+v(i1,k)*(-dltxnec(i,j))
121 
122  END IF
123 
124  pupx=pupx/art1(i)
125  pupy=pupy/art1(i)
126  pvpx=pvpx/art1(i)
127  pvpy=pvpy/art1(i)
128  tmp1=pupx**2+pvpy**2
129  tmp2=0.5_sp*(pupy+pvpx)**2
130  viscofh(i,k)=sqrt(tmp1+tmp2)*art1(i)
131 
132  END DO
133  END DO
134 
135 
136  IF(dbg_set(dbg_sbr)) WRITE(ipt,*) "End: viscofh"
137 
138  END SUBROUTINE viscof_h
139 !==============================================================================|
real(sp), dimension(:,:), allocatable, target viscofh
Definition: mod_main.f90:1359
real(sp), dimension(:,:), allocatable, target v
Definition: mod_main.f90:1269
logical function dbg_set(vrb)
Definition: mod_utils.f90:182
real(sp), dimension(:,:), allocatable, target dltxnec
Definition: mod_main.f90:1069
real(sp), dimension(:), allocatable, target art1
Definition: mod_main.f90:1010
real(sp), dimension(:,:), allocatable, target u
Definition: mod_main.f90:1268
integer, dimension(:), allocatable, target ntve
Definition: mod_main.f90:1022
real(sp), dimension(:,:), allocatable, target dltyecec
Definition: mod_main.f90:1067
real(sp), dimension(:,:), allocatable, target dltynec
Definition: mod_main.f90:1070
subroutine viscof_h
Definition: viscofh.f90:45
integer, dimension(:,:), allocatable, target nbve
Definition: mod_main.f90:1034
subroutine fatal_error(ER1, ER2, ER3, ER4)
Definition: mod_utils.f90:230
real(sp), dimension(:,:), allocatable, target dltxecec
Definition: mod_main.f90:1066
integer, parameter dbg_sbr
Definition: mod_utils.f90:69
integer, dimension(:), allocatable, target isonb
Definition: mod_main.f90:1024