Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
NOCSurfaceProcesses
AirSeaFluxCode
Commits
813c7f3a
Commit
813c7f3a
authored
3 years ago
by
Richard Cornes
Browse files
Options
Download
Email Patches
Plain Diff
Changed ninter to maxiter
parent
419d0a27
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
Code/AirSeaFluxCode.py
Code/AirSeaFluxCode.py
+8
-8
No files found.
Code/AirSeaFluxCode.py
View file @
813c7f3a
...
...
@@ -186,11 +186,11 @@ class S88:
self
.
tsr
=
(
self
.
dt
-
self
.
dter
*
self
.
cskin
-
self
.
dtwl
*
self
.
wl
)
*
kappa
/
(
np
.
log
(
self
.
h_in
[
1
]
/
self
.
zot
)
-
psit_calc
(
self
.
h_in
[
1
]
/
self
.
monob
,
self
.
meth
))
self
.
qsr
=
(
self
.
dq
-
self
.
dqer
*
self
.
cskin
)
*
kappa
/
(
np
.
log
(
self
.
h_in
[
2
]
/
self
.
zoq
)
-
psit_calc
(
self
.
h_in
[
2
]
/
self
.
monob
,
self
.
meth
))
def
iterate
(
self
,
n
iter
=
30
,
tol
=
None
):
def
iterate
(
self
,
max
iter
=
30
,
tol
=
None
):
if
n
iter
<
5
:
if
max
iter
<
5
:
warnings
.
warn
(
"Iteration number <5 - resetting to 5."
)
n
iter
=
5
max
iter
=
5
# Decide which variables to use in tolerances based on tolerance specification
tol
=
[
'all'
,
0.01
,
0.01
,
1e-05
,
1e-3
,
0.1
,
0.1
]
if
tol
is
None
else
tol
...
...
@@ -219,7 +219,7 @@ class S88:
ii
=
True
while
ii
:
it
+=
1
if
it
>
n
iter
:
break
if
it
>
max
iter
:
break
# Set the old variables (for comparison against "new")
old
=
np
.
array
([
np
.
copy
(
getattr
(
self
,
i
))
for
i
in
old_vars
])
...
...
@@ -314,7 +314,7 @@ class S88:
# End of iteration loop
self
.
itera
[
ind
]
=
-
1
self
.
itera
=
np
.
where
(
self
.
itera
>
n
iter
,
-
1
,
self
.
itera
)
self
.
itera
=
np
.
where
(
self
.
itera
>
max
iter
,
-
1
,
self
.
itera
)
logging
.
info
(
'method %s | # of iterations:%s'
,
self
.
meth
,
it
)
logging
.
info
(
'method %s | # of points that did not converge :%s
\n
'
,
self
.
meth
,
self
.
ind
[
0
].
size
)
...
...
@@ -596,7 +596,7 @@ class Beljaars(C30):
def
AirSeaFluxCode
(
spd
,
T
,
SST
,
lat
=
None
,
hum
=
None
,
P
=
None
,
hin
=
18
,
hout
=
10
,
Rl
=
None
,
Rs
=
None
,
cskin
=
None
,
skin
=
"C35"
,
wl
=
0
,
gust
=
None
,
meth
=
"S88"
,
qmeth
=
"Buck2"
,
tol
=
None
,
n
iter
=
30
,
out
=
0
,
L
=
None
):
meth
=
"S88"
,
qmeth
=
"Buck2"
,
tol
=
None
,
max
iter
=
30
,
out
=
0
,
L
=
None
):
"""
Calculates turbulent surface fluxes using different parameterizations
Calculates height adjusted values for spd, T, q
...
...
@@ -657,7 +657,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
option : 'all' to set tolerance limits for both fluxes and height
adjustment lim1-6
default is tol=['all', 0.01, 0.01, 1e-05, 1e-3, 0.1, 0.1]
n
iter : int
max
iter : int
number of iterations (defautl = 10)
out : int
set 0 to set points that have not converged, negative values of
...
...
@@ -732,7 +732,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
iclass
.
get_heights
(
hin
,
hout
)
iclass
.
get_specHumidity
(
qmeth
=
qmeth
)
iclass
.
set_coolskin_warmlayer
(
wl
=
wl
,
cskin
=
cskin
,
skin
=
skin
,
Rl
=
Rl
,
Rs
=
Rs
)
iclass
.
iterate
(
tol
=
tol
,
n
iter
=
n
iter
)
iclass
.
iterate
(
tol
=
tol
,
max
iter
=
max
iter
)
resAll
=
iclass
.
get_output
(
out
=
out
)
return
resAll
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment