-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsteves_fluxes_seq.f
180 lines (147 loc) · 4.36 KB
/
steves_fluxes_seq.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
SUBROUTINE fluxes
IMPLICIT NONE
INTEGER nuout,nuerr
PARAMETER (nuout=6,nuerr=0)
#ifdef COUPLE
#ifdef CFS
include 'parameter.cfs_coupled.inc'
#else
include 'parameter.oasis2.inc'
#endif
#else
#ifdef CFS
include 'parameter.cfs_forced.inc'
#else
include 'parameter.forced.inc'
#endif
#endif
include 'flx_sfc.com'
include 'ocn_paras.com'
include 'flx_paras.com'
include 'flx_in.com'
include 'local_pt.com'
include 'times.com'
include 'couple.com'
REAL taux(NPTS),tauy(NPTS),
$ swf(NPTS),lwf(NPTS),lhf(NPTS),shf(NPTS),
$ rain(NPTS),snow(NPTS)
IF (.NOT. L_COUPLE) THEN
IF (.NOT. L_FLUXDATA) THEN
DO ipt=1,npts
taux(ipt)=0.01
tauy(ipt)=0.0
swf(ipt)=200.0
lwf(ipt)=0.0
lhf(ipt)=-150.0
shf(ipt)=0.0
rain(ipt)=6e-5
snow(ipt)=0.0
ENDDO
ELSE
call read_fluxes(taux,tauy,swf,lwf,lhf,shf,rain,snow)
ENDIF
DO ipt=1,npts
IF ((taux(ipt) .EQ. 0.0) .AND. (tauy(ipt) .EQ. 0.0)) THEN
taux(ipt)=1.e-10
ENDIF
sflux(ipt,1,5,0)=taux(ipt)
sflux(ipt,2,5,0)=tauy(ipt)
sflux(ipt,3,5,0)=swf(ipt)
sflux(ipt,4,5,0)=lwf(ipt)+lhf(ipt)+shf(ipt)-snow(ipt)*FLSN
sflux(ipt,5,5,0)=0.0 ! Melting of sea-ice = 0.0
sflux(ipt,6,5,0)=(rain(ipt)+snow(ipt)+(lhf(ipt)/EL))
call ntflx
ENDDO
ELSE
call coupled_flux(swf,lwf,rain,ntime+ndtocn-1)
call coupled_stress(taux,tauy,ntime+ndtocn-1)
DO ipt=1,npts
IF ((taux(ipt) .EQ. 0.0) .AND. (tauy(ipt) .EQ. 0.0)) THEN
taux(ipt)=1.e-10
ENDIF
sflux(ipt,1,5,0)=taux(ipt)
sflux(ipt,2,5,0)=tauy(ipt)
sflux(ipt,3,5,0)=swf(ipt)
sflux(ipt,4,5,0)=lwf(ipt)
sflux(ipt,5,5,0)=0.0 ! Melting of sea-ice = 0.0
sflux(ipt,6,5,0)=rain(ipt) ! assuming rain = P-E
call ntflx
ENDDO
ENDIF
RETURN
END
************************************************************************
SUBROUTINE ntflx
IMPLICIT NONE
INTEGER nuout,nuerr
PARAMETER (nuout=6,nuerr=0)
#ifdef COUPLE
#ifdef CFS
include 'parameter.cfs_coupled.inc'
#else
include 'parameter.oasis2.inc'
#endif
#else
#ifdef CFS
include 'parameter.cfs_forced.inc'
#else
include 'parameter.forced.inc'
#endif
#endif
include 'times.com'
include 'flx_sfc.com'
include 'flx_profs.com'
include 'vert_pgrid.com'
include 'ocn_paras.com'
include 'local_pt.com'
INTEGER k
REAL SWDK
REAL SWDK_OPT(NPTS,0:NZ)
EXTERNAL SWDK
COMMON /SWDK_SAVE/SWDK_OPT
IF (ntime .eq. 1) THEN
DO k=0,NZ
swdk_opt(ipt,k)=swdk(-dm(k))
ENDDO
ENDIF
DO k=0,NZ
wXNT(ipt,k,1)=-sflux(ipt,3,5,0)*swdk_opt(ipt,k)
& /(rho(ipt,0)*CP(ipt,0))
ENDDO
c DO k=0,NZ
c wXNT(ipt,k,1)=-sflux(ipt,3,5,0)*swdk(-dm(k))
c & /(rho(ipt,0)*CP(ipt,0))
c ENDDO
RETURN
END
*******************************************************************
REAL FUNCTION SWDK(z)
#ifdef COUPLE
#ifdef CFS
include 'parameter.cfs_coupled.inc'
#else
include 'parameter.oasis2.inc'
#endif
#else
#ifdef CFS
include 'parameter.cfs_forced.inc'
#else
include 'parameter.forced.inc'
#endif
#endif
include 'proc_pars.com'
include 'local_pt.com'
parameter(max=5)
real Rfac(max),a1(max),a2(max)
c types = I IA IB II III
c j = 1 2 3 4 5
data Rfac / 0.58 , 0.62 , 0.67 , 0.77 , 0.78 /
data a1 / 0.35 , 0.6 , 1.0 , 1.5 , 1.4 /
data a2 / 23.0 , 20.0 , 17.0 , 14.0 , 7.9 /
j = jerlov(ipt)
c write(nuout,*) 'time=',ftime,' mon=',mon,' j=',j
SWDK = Rfac(j) * dexp(dble(z/a1(j)))
> + (1.0-Rfac(j)) * dexp(dble(z/a2(j)))
return
end
**************************************************************