My Project
depth_grad.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 THE GRADIENT OF THE WATER DEPTH WITH X ANDY |
42 !==============================================================================|
43 
44  SUBROUTINE depth_gradient
45 
46 !==============================================================================|
47  USE all_vars
48  USE mod_par
49 
50  IMPLICIT NONE
51  REAL(SP) :: PHPX,PHPY,F1
52  INTEGER :: I,J,I1,I2
53 !==============================================================================|
54 
55 !----------CALCULATE DERIVATIVES OF DEPTH WITH X AND Y AT NODES----------------!
56 
57  DO i=1,m
58  phpx = 0.0_sp ; phpy = 0.0_sp
59  DO j=1,ntsn(i)-1
60  i1 = nbsn(i,j)
61  i2 = nbsn(i,j+1)
62  f1 = 0.50_sp*(h(i1)+h(i2))
63  phpx = phpx + f1*(vy(i1)-vy(i2))
64  phpy = phpy + f1*(vx(i2)-vx(i1))
65  END DO
66  phpx = phpx/art2(i)
67  phpy = phpy/art2(i)
68 
69  IF(phpx==0.0_sp .AND. phpy ==0.0_sp)THEN
70  sita_gd(i) = 0.0_sp ; phpn(i) = 0.0_sp
71  ELSE
72  sita_gd(i) = atan2(phpy,phpx)
73  phpn(i) = sqrt(phpy*phpy+phpx*phpx)
74  END IF
75 
76  END DO
77 
78 
79  RETURN
80  END SUBROUTINE depth_gradient
81 !==============================================================================|
integer, dimension(:), allocatable, target ntsn
Definition: mod_main.f90:1023
real(sp), dimension(:), allocatable, target h
Definition: mod_main.f90:1131
real(sp), dimension(:), allocatable, target art2
Definition: mod_main.f90:1011
real(sp), dimension(:), allocatable, target vx
Definition: mod_main.f90:1001
real(sp), dimension(:), allocatable, target phpn
Definition: mod_main.f90:1341
real(sp), dimension(:), allocatable, target vy
Definition: mod_main.f90:1002
real(sp), dimension(:), allocatable, target sita_gd
Definition: mod_main.f90:1344
integer, dimension(:,:), allocatable, target nbsn
Definition: mod_main.f90:1030
subroutine depth_gradient
Definition: depth_grad.f90:45