My Project
fct_q2.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 ! FLUX CONTROL FOR SALINITY |
42 !==============================================================================|
43 
44  SUBROUTINE fct_q2
45 !# if defined (1)
46 
47 !==============================================================================|
48  USE all_vars
49  USE mod_utils
50  USE bcs
51  USE mod_obcs
52  IMPLICIT NONE
53  REAL(SP):: Q2MAX,Q2MIN
54  INTEGER :: I,J,K
55 !==============================================================================|
56 
57  IF(heating_type == 'body') return
58 
59  IF(dbg_set(dbg_sbr)) write(ipt,*) "Start: fct_q2"
60 
61 
62 nodes:DO i=1,m
63 
64  IF(iobcn > 0)THEN
65  DO j=1,iobcn
66  IF(i == i_obc_n(j)) cycle nodes
67  END DO
68  END IF
69 
70  IF(numqbc > 0)THEN
71  DO j=1,numqbc
72  IF(river_inflow_location == 'node')THEN
73  IF(i == inodeq(j)) cycle nodes
74  END IF
75  IF(river_inflow_location == 'edge')THEN
76  IF(i == n_icellq(j,1) .OR. i == n_icellq(j,2)) cycle nodes
77  END IF
78  END DO
79  END IF
80  DO k=2,kbm1
81  q2max = maxval(q2(nbsn(i,1:ntsn(i)),k))
82  q2min = minval(q2(nbsn(i,1:ntsn(i)),k))
83 
84  IF(k == 2)THEN
85  q2max = max(q2max,(q2(i,k)*dzz(i,k)+q2(i,k+1)*dzz(i,k-1))/ &
86  (dzz(i,k)+dzz(i,k-1)))
87  q2min = min(q2min,(q2(i,k)*dzz(i,k)+q2(i,k+1)*dzz(i,k-1))/ &
88  (dzz(i,k)+dzz(i,k-1)))
89  ELSE IF(k == kbm1)THEN
90  q2max = max(q2max,(q2(i,k)*dzz(i,k-2)+q2(i,k-1)*dzz(i,k-1))/ &
91  (dzz(i,k-1)+dzz(i,k-2)))
92  q2min = min(q2min,(q2(i,k)*dzz(i,k-2)+q2(i,k-1)*dzz(i,k-1))/ &
93  (dzz(i,k-1)+dzz(i,k-2)))
94  ELSE
95  q2max = max(q2max,(q2(i,k)*dzz(i,k-2)+q2(i,k-1)*dzz(i,k-1))/ &
96  (dzz(i,k-1)+dzz(i,k-2)), &
97  (q2(i,k)*dzz(i,k)+q2(i,k+1)*dzz(i,k-1))/ &
98  (dzz(i,k)+dzz(i,k-1)))
99  q2min = min(q2min,(q2(i,k)*dzz(i,k-2)+q2(i,k-1)*dzz(i,k-1))/ &
100  (dzz(i,k-1)+dzz(i,k-2)), &
101  (q2(i,k)*dzz(i,k)+q2(i,k+1)*dzz(i,k-1))/ &
102  (dzz(i,k)+dzz(i,k-1)))
103  END IF
104 
105  IF(q2min-q2f(i,k) > 0.0_sp)q2f(i,k) = q2min
106  IF(q2f(i,k)-q2max > 0.0_sp)q2f(i,k) = q2max
107 
108  END DO
109 
110  END DO nodes
111 
112  IF(dbg_set(dbg_sbr)) write(ipt,*) "End: fct_q2"
113 
114  END SUBROUTINE fct_q2
115 !==============================================================================|
116 
117 
integer, dimension(:), allocatable, target ntsn
Definition: mod_main.f90:1023
real(sp), dimension(:,:), allocatable, target q2
Definition: mod_main.f90:1290
logical function dbg_set(vrb)
Definition: mod_utils.f90:182
integer iobcn
Definition: mod_main.f90:1777
subroutine fct_q2
Definition: fct_q2.f90:45
integer, dimension(:), allocatable i_obc_n
Definition: mod_main.f90:1779
integer, dimension(:,:), allocatable, target n_icellq
Definition: mod_main.f90:1216
real(sp), dimension(:,:), allocatable, target dzz
Definition: mod_main.f90:1093
real(sp), dimension(:,:), allocatable, target q2f
Definition: mod_main.f90:1297
integer, dimension(:,:), allocatable, target nbsn
Definition: mod_main.f90:1030
integer, parameter dbg_sbr
Definition: mod_utils.f90:69
integer, dimension(:), allocatable, target inodeq
Definition: mod_main.f90:1214