-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathcmue_nemo.F90
More file actions
89 lines (86 loc) · 2.72 KB
/
cmue_nemo.F90
File metadata and controls
89 lines (86 loc) · 2.72 KB
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
#include"cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !ROUTINE: The NEMO stability function\label{sec:stabNEMO}
!
! !INTERFACE:
subroutine cmue_nemo(nlev)
!
! !DESCRIPTION:
! This subroutine computes stability functions according to
! \begin{equation}
! c_{\mu}=c_{\mu}^{0}=0.1,\qquad c'_{\mu}=c_{\mu}^0 Pr_t^{-1}
! \end{equation}
! with constant $c_{\mu}^0 = 0.1$ and $Pr_t$ the turbulent Prandtl number.
! The empirical relation for the inverse turbulent Prandtl--number is
! \begin{equation}
! Pr_t^{-1} = \max\left( 0.1, \mathrm{Ri}_c / \max( \mathrm{Ri}, \mathrm{Ri}_c ) \right)
! \comma
! \end{equation}
! where $Ri$ is the gradient Richardson--number and \mathrm{Ri}_c its critical
! value. This value is estimated from the local equilibrium $P+G = \epsilon$,
! which translates into (considering $l_\epsilon=\sqrt{2k/N^2}$):
!\[
!\mathrm{num} S^2 - \mathrm{nuh} N^2 = c_\epsilon \frac{k \sqrt{N^2}}{\sqrt{2}}
!\]
!which amounts to
!\[
!c_{\mu}^0 l_k \sqrt{k} \left( S^2 - Pr_t^{-1} N^2 \right) = c_\epsilon \frac{k \sqrt{N^2}}{\sqrt{2}}
!\]
!Considering that $l_k=\sqrt{2k/N^2}$ and $\mathrm{Ri} = N^2 / S^2$ we get
!\[
!1 - Pr_t^{-1} \mathrm{Ri} = \frac{c_\epsilon}{2 c_{\mu}^0} \mathrm{Ri} \qquad \longrightarrow \qquad \mathrm{Ri}_c = \frac{1}{1+\frac{1}{2}\frac{c_\epsilon}{c_{\mu}^0}} \approx 0.22
!\]
!
! !USES:
use turbulence, only: cmue1,cmue2
use turbulence, only: P,B
use turbulence, only: num,nuh
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: nlev
!
! !REVISION HISTORY:
! Original author(s): Florian Lemarié
!
!EOP
!
! !LOCAL VARIABLES:
integer :: i
REALTYPE :: Ri(0:nlev)
REALTYPE :: Ri_loc,Ri_cri,Denom
REALTYPE,parameter :: limit=0.1
REALTYPE,parameter :: bshear=1.e-16
!
!-----------------------------------------------------------------------
!BOC
cmue1(0:nlev) = 0.1
Ri_cri = 2.*cmue1(1)/( 2.*cmue1(1) + 0.5*SQRT(2.) )
do i=1,nlev-1
if( B(i) >= 0.0 ) then
Ri(i) = 0.
else
Denom = nuh(i)*P(i)
if (Denom == 0.0) then
Ri(i) = -B(i)*num(i) / bshear
else
Ri(i) = -B(i)*num(i) / Denom
endif
endif
end do
!
Ri(0)=Ri(1); Ri(nlev)=Ri(nlev-1)
!
do i=1,nlev-1
Ri_loc = 0.25*(2.*Ri(i)+Ri(i+1)+Ri(i-1))
cmue2(i) = cmue1(i)*MAX( limit, Ri_cri / MAX( Ri_cri , Ri_loc ) )
enddo
!
return
end subroutine cmue_nemo
!EOC
!-----------------------------------------------------------------------
! Copyright by the GOTM-team under the GNU Public License - www.gnu.org
!-----------------------------------------------------------------------