/[MITgcm]/MITgcm/model/src/find_rho.F
ViewVC logotype

Annotation of /MITgcm/model/src/find_rho.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.15 - (hide annotations) (download)
Wed Sep 26 18:09:15 2001 UTC (22 years, 8 months ago) by cnh
Branch: MAIN
CVS Tags: checkpoint44e_post, release1_p13_pre, checkpoint44f_post, checkpoint43a-release1mods, release1_p13, chkpt44d_post, release1_p8, release1_p9, release1_p1, release1_p2, release1_p3, release1_p4, release1_p5, release1_p6, release1_p7, checkpoint44e_pre, release1_b1, checkpoint43, release1_chkpt44d_post, release1_p11, icebear5, icebear4, icebear3, icebear2, release1-branch_tutorials, checkpoint45d_post, chkpt44a_post, checkpoint44h_pre, checkpoint46a_post, chkpt44c_pre, checkpoint45a_post, ecco_c44_e19, ecco_c44_e18, ecco_c44_e17, ecco_c44_e16, release1_p12, release1_p10, release1_p16, release1_p17, release1_p14, release1_p15, checkpoint44g_post, checkpoint45b_post, checkpoint46b_pre, release1-branch-end, release1_final_v1, checkpoint46, checkpoint44b_post, checkpoint46a_pre, checkpoint45c_post, ecco_ice2, ecco_ice1, checkpoint44h_post, release1_p12_pre, ecco_c44_e22, ecco_c44_e25, chkpt44a_pre, ecco_c44_e23, ecco_c44_e20, ecco_c44_e21, ecco_c44_e26, ecco_c44_e27, ecco_c44_e24, ecco-branch-mod1, ecco-branch-mod2, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5, release1_beta1, checkpoint44b_pre, checkpoint42, checkpoint41, checkpoint44, checkpoint45, chkpt44c_post, checkpoint44f_pre, release1-branch_branchpoint
Branch point for: c24_e25_ice, release1_final, release1-branch, release1, ecco-branch, release1_50yr, icebear, release1_coupled
Changes since 1.14: +24 -13 lines
Bringing comments up to data and formatting for document extraction.

1 cnh 1.15 C $Header: /u/gcmpack/models/MITgcmUV/model/src/find_rho.F,v 1.14 2001/02/04 14:38:47 cnh Exp $
2     C $Name: $
3 cnh 1.1
4 cnh 1.9 #include "CPP_OPTIONS.h"
5 adcroft 1.5 #define USE_FACTORIZED_POLY
6 cnh 1.1
7 cnh 1.15 CBOP
8     C !ROUTINE: FIND_RHO
9     C !INTERFACE:
10 adcroft 1.4 subroutine FIND_RHO(
11     I bi, bj, iMin, iMax, jMin, jMax, k, kRef, eqn,
12 adcroft 1.13 I tFld, sFld,
13 adcroft 1.4 O rholoc,
14     I myThid )
15 cnh 1.15
16     C !DESCRIPTION: \bv
17     C *==========================================================*
18     C | o SUBROUTINE FIND_RHO
19     C | Calculates [rho(S,T,z)-Rhonil] of a slice
20     C *==========================================================*
21     C |
22     C | k - is the Theta/Salt level
23     C | kRef - determines pressure reference level
24     C | (not used in 'LINEAR' mode)
25     C | eqn - determines the eqn. of state: 'LINEAR' or 'POLY3'
26     C |
27     C *==========================================================*
28     C \ev
29    
30     C !USES:
31 cnh 1.1 implicit none
32 heimbach 1.12 C == Global variables ==
33 cnh 1.1 #include "SIZE.h"
34 cnh 1.7 #include "EEPARAMS.h"
35 cnh 1.1 #include "PARAMS.h"
36 heimbach 1.12
37 cnh 1.15 C !INPUT/OUTPUT PARAMETERS:
38 heimbach 1.12 C == Routine arguments ==
39 adcroft 1.4 integer bi,bj,iMin,iMax,jMin,jMax
40     integer k ! Level of Theta/Salt slice
41     integer kRef ! Pressure reference level
42     character*(*) eqn
43 adcroft 1.13 _RL tFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
44     _RL sFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
45 adcroft 1.4 _RL rholoc(1-Olx:sNx+Olx,1-Oly:sNy+Oly)
46     integer myThid
47 heimbach 1.12
48 cnh 1.15 C !LOCAL VARIABLES:
49 heimbach 1.12 C == Local variables ==
50 adcroft 1.4 integer i,j
51     _RL refTemp,refSalt,sigRef,tP,sP,deltaSig
52 adcroft 1.10 character*(max_len_mbuf) msgbuf
53 cnh 1.15 CEOP
54 heimbach 1.11
55     #ifdef ALLOW_AUTODIFF_TAMC
56     DO j=1-OLy,sNy+OLy
57     DO i=1-OLx,sNx+OLx
58     rholoc(i,j) = 0.0
59     ENDDO
60     ENDDO
61     #endif
62 cnh 1.1
63 adcroft 1.4 if (eqn.eq.'LINEAR') then
64    
65     C ***NOTE***
66     C In the linear EOS, to make the static stability calculation meaningful
67     C we alway calculate the perturbation with respect to the surface level.
68     C **********
69 adcroft 1.6 refTemp=tRef(kRef)
70     refSalt=sRef(kRef)
71 adcroft 1.4
72 cnh 1.1 do j=jMin,jMax
73     do i=iMin,iMax
74 adcroft 1.4 rholoc(i,j)=rhonil*(
75 adcroft 1.13 & sBeta*(sFld(i,j,k,bi,bj)-refSalt)
76     & -tAlpha*(tFld(i,j,k,bi,bj)-refTemp) )
77 cnh 1.1 enddo
78     enddo
79 cnh 1.8
80 adcroft 1.4 elseif (eqn.eq.'POLY3') then
81    
82     refTemp=eosRefT(kRef)
83     refSalt=eosRefS(kRef)
84 adcroft 1.5 sigRef=eosSig0(kRef) + (1000.-Rhonil)
85 adcroft 1.4
86     do j=jMin,jMax
87     do i=iMin,iMax
88 adcroft 1.13 tP=tFld(i,j,k,bi,bj)-refTemp
89     sP=sFld(i,j,k,bi,bj)-refSalt
90 adcroft 1.5 #ifdef USE_FACTORIZED_POLY
91 adcroft 1.4 deltaSig=
92 adcroft 1.5 & (( eosC(9,kRef)*sP + eosC(5,kRef) )*sP + eosC(2,kRef) )*sP
93     & + ( ( eosC(6,kRef)
94     & *tP
95     & +eosC(7,kRef)*sP + eosC(3,kRef)
96     & )*tP
97     & +(eosC(8,kRef)*sP + eosC(4,kRef) )*sP + eosC(1,kRef)
98     & )*tP
99     #else
100     deltaSig=
101     & eosC(1,kRef)*tP
102     & +eosC(2,kRef) *sP
103     & +eosC(3,kRef)*tP*tP
104     & +eosC(4,kRef)*tP *sP
105     & +eosC(5,kRef) *sP*sP
106     & +eosC(6,kRef)*tP*tP*tP
107     & +eosC(7,kRef)*tP*tP *sP
108     & +eosC(8,kRef)*tP *sP*sP
109     & +eosC(9,kRef) *sP*sP*sP
110     #endif
111     rholoc(i,j)=sigRef+deltaSig
112 adcroft 1.4 enddo
113     enddo
114    
115     else
116 adcroft 1.13 write(msgbuf,'(3a)') ' FIND_RHO: eqn = "',eqn,'"'
117 adcroft 1.10 call print_error( msgbuf, mythid )
118     stop 'ABNORMAL END: S/R FIND_RHO'
119 adcroft 1.4 endif
120 cnh 1.1
121     return
122     end

  ViewVC Help
Powered by ViewVC 1.1.22