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

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

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


Revision 1.10 - (show annotations) (download)
Fri Aug 6 15:01:27 1999 UTC (24 years, 10 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint25, checkpoint27, checkpoint26
Changes since 1.9: +5 -3 lines
Replaced write(0,*) with print_error. Spotted by C.E.

1 C $Header: /u/gcmpack/models/MITgcmUV/model/src/find_rho.F,v 1.9 1998/11/06 22:44:46 cnh Exp $
2
3 #include "CPP_OPTIONS.h"
4 #define USE_FACTORIZED_POLY
5
6 ! ================================================================
7 subroutine FIND_RHO(
8 I bi, bj, iMin, iMax, jMin, jMax, k, kRef, eqn,
9 O rholoc,
10 I myThid )
11 C /==========================================================\
12 C | o SUBROUTINE FIND_RHO |
13 C | Calculates [rho(S,T,z)-Rhonil] of a slice |
14 C |==========================================================|
15 C | |
16 C | k - is the Theta/Salt level |
17 C | kRef - determines pressure reference level |
18 C | (not used in 'LINEAR' mode) |
19 C | eqn - determines the eqn. of state: 'LINEAR' or 'POLY3' |
20 C | |
21 C \==========================================================/
22 implicit none
23 ! Common
24 #include "SIZE.h"
25 #include "DYNVARS.h"
26 #include "EEPARAMS.h"
27 #include "PARAMS.h"
28 ! Arguments
29 integer bi,bj,iMin,iMax,jMin,jMax
30 integer k ! Level of Theta/Salt slice
31 integer kRef ! Pressure reference level
32 character*(*) eqn
33 _RL rholoc(1-Olx:sNx+Olx,1-Oly:sNy+Oly)
34 integer myThid
35 ! Local
36 integer i,j
37 _RL refTemp,refSalt,sigRef,tP,sP,deltaSig
38 character*(max_len_mbuf) msgbuf
39 ! -----------------------------------------------------------------
40
41 if (eqn.eq.'LINEAR') then
42
43 C ***NOTE***
44 C In the linear EOS, to make the static stability calculation meaningful
45 C we alway calculate the perturbation with respect to the surface level.
46 C **********
47 refTemp=tRef(kRef)
48 refSalt=sRef(kRef)
49
50 do j=jMin,jMax
51 do i=iMin,iMax
52 rholoc(i,j)=rhonil*(
53 & sBeta*( salt(i,j,k,bi,bj)-refSalt)
54 & -tAlpha*(theta(i,j,k,bi,bj)-refTemp) )
55 enddo
56 enddo
57
58 elseif (eqn.eq.'POLY3') then
59
60 refTemp=eosRefT(kRef)
61 refSalt=eosRefS(kRef)
62 sigRef=eosSig0(kRef) + (1000.-Rhonil)
63
64 do j=jMin,jMax
65 do i=iMin,iMax
66 tP=theta(i,j,k,bi,bj)-refTemp
67 sP=salt(i,j,k,bi,bj)-refSalt
68 #ifdef USE_FACTORIZED_POLY
69 deltaSig=
70 & (( eosC(9,kRef)*sP + eosC(5,kRef) )*sP + eosC(2,kRef) )*sP
71 & + ( ( eosC(6,kRef)
72 & *tP
73 & +eosC(7,kRef)*sP + eosC(3,kRef)
74 & )*tP
75 & +(eosC(8,kRef)*sP + eosC(4,kRef) )*sP + eosC(1,kRef)
76 & )*tP
77 #else
78 deltaSig=
79 & eosC(1,kRef)*tP
80 & +eosC(2,kRef) *sP
81 & +eosC(3,kRef)*tP*tP
82 & +eosC(4,kRef)*tP *sP
83 & +eosC(5,kRef) *sP*sP
84 & +eosC(6,kRef)*tP*tP*tP
85 & +eosC(7,kRef)*tP*tP *sP
86 & +eosC(8,kRef)*tP *sP*sP
87 & +eosC(9,kRef) *sP*sP*sP
88 #endif
89 rholoc(i,j)=sigRef+deltaSig
90 enddo
91 enddo
92
93 else
94 write(msgbuf,'(a,a)') ' FIND_RHO: eqn = ',eqn
95 call print_error( msgbuf, mythid )
96 stop 'ABNORMAL END: S/R FIND_RHO'
97 endif
98
99 ! ------------------------------------------------------------------------------
100 return
101 end
102 ! ==============================================================================

  ViewVC Help
Powered by ViewVC 1.1.22