26 module monin_obukhov_mod
28 use constants_mod,
only: grav, vonkarm
29 use mpp_mod,
only: input_nml_file
35 use platform_mod,
only: r4_kind, r8_kind
40 public :: monin_obukhov_init
41 public :: monin_obukhov_end
51 module procedure mo_drag_0d_r4, mo_drag_0d_r8
52 module procedure mo_drag_1d_r4, mo_drag_1d_r8
53 module procedure mo_drag_2d_r4, mo_drag_2d_r8
59 module procedure mo_profile_0d_r4, mo_profile_0d_r8
60 module procedure mo_profile_1d_r4, mo_profile_1d_r8
61 module procedure mo_profile_2d_r4, mo_profile_2d_r8
62 module procedure mo_profile_0d_n_r4, mo_profile_0d_n_r8
63 module procedure mo_profile_1d_n_r4, mo_profile_1d_n_r8
64 module procedure mo_profile_2d_n_r4, mo_profile_2d_n_r8
69 module procedure mo_diff_0d_n_r4, mo_diff_0d_n_r8
70 module procedure mo_diff_0d_1_r4, mo_diff_0d_1_r8
71 module procedure mo_diff_1d_n_r4, mo_diff_1d_n_r8
72 module procedure mo_diff_1d_1_r4, mo_diff_1d_1_r8
73 module procedure mo_diff_2d_n_r4, mo_diff_2d_n_r8
74 module procedure mo_diff_2d_1_r4, mo_diff_2d_1_r8
79 module procedure stable_mix_0d_r4, stable_mix_0d_r8
80 module procedure stable_mix_1d_r4, stable_mix_1d_r8
81 module procedure stable_mix_2d_r4, stable_mix_2d_r8
82 module procedure stable_mix_3d_r4, stable_mix_3d_r8
86 module procedure mo_integral_m_r4, mo_integral_m_r8
90 module procedure mo_integral_tq_r4, mo_integral_tq_r8
94 module procedure mo_derivative_m_r4, mo_derivative_m_r8
98 module procedure mo_derivative_t_r4, mo_derivative_t_r8
106 #include<file_version.h>
112 real(kind=r8_kind) :: rich_crit = 2.0_r8_kind
113 real(kind=r8_kind) :: drag_min_heat = 1.0e-05_r8_kind
114 real(kind=r8_kind) :: drag_min_moist = 1.0e-05_r8_kind
115 real(kind=r8_kind) :: drag_min_mom = 1.0e-05_r8_kind
116 logical :: neutral = .false.
117 integer :: stable_option = 1
118 real(kind=r8_kind) :: zeta_trans = 0.5_r8_kind
119 logical :: new_mo_option = .false.
122 namelist /monin_obukhov_nml/ rich_crit, neutral, drag_min_heat, &
123 drag_min_moist, drag_min_mom, &
124 stable_option, zeta_trans, new_mo_option
130 real(kind=r8_kind),
parameter :: small = 1.0e-04_r8_kind
131 real(kind=r8_kind) :: b_stab, r_crit, lambda, rich_trans
132 real(kind=r8_kind) :: sqrt_drag_min_heat, sqrt_drag_min_moist, sqrt_drag_min_mom
133 logical :: module_is_initialized = .false.
140 subroutine monin_obukhov_init
142 integer :: ierr, io, logunit
146 read (input_nml_file, nml=monin_obukhov_nml, iostat=io)
151 if (
mpp_pe() == mpp_root_pe() )
then
154 write (logunit, nml=monin_obukhov_nml)
159 if(rich_crit.le.0.25_r8_kind)
call error_mesg( &
160 'MONIN_OBUKHOV_INIT in MONIN_OBUKHOV_MOD', &
161 'rich_crit in monin_obukhov_mod must be > 0.25', fatal)
163 if(drag_min_heat.le.0.0_r8_kind)
call error_mesg( &
164 'MONIN_OBUKHOV_INIT in MONIN_OBUKHOV_MOD', &
165 'drag_min_heat in monin_obukhov_mod must be >= 0.0', fatal)
167 if(drag_min_moist.le.0.0_r8_kind)
call error_mesg( &
168 'MONIN_OBUKHOV_INIT in MONIN_OBUKHOV_MOD', &
169 'drag_min_moist in monin_obukhov_mod must be >= 0.0', fatal)
171 if(drag_min_mom.le.0.0_r8_kind)
call error_mesg( &
172 'MONIN_OBUKHOV_INIT in MONIN_OBUKHOV_MOD', &
173 'drag_min_mom in monin_obukhov_mod must be >= 0.0', fatal)
175 if(stable_option < 1 .or. stable_option > 2)
call error_mesg( &
176 'MONIN_OBUKHOV_INIT in MONIN_OBUKHOV_MOD', &
177 'the only allowable values of stable_option are 1 and 2', fatal)
179 if(stable_option == 2 .and. zeta_trans < 0)
call error_mesg( &
180 'MONIN_OBUKHOV_INIT in MONIN_OBUKHOV_MOD', &
181 'zeta_trans must be positive', fatal)
183 b_stab = 1.0_r8_kind/rich_crit
184 r_crit = 0.95_r8_kind*rich_crit
187 sqrt_drag_min_heat = 0.0_r8_kind
188 if(drag_min_heat.ne.0.0_r8_kind) sqrt_drag_min_heat = sqrt(drag_min_heat)
190 sqrt_drag_min_moist = 0.0_r8_kind
191 if(drag_min_moist.ne.0.0_r8_kind) sqrt_drag_min_moist = sqrt(drag_min_moist)
193 sqrt_drag_min_mom = 0.0_r8_kind
194 if(drag_min_mom.ne.0.0_r8_kind) sqrt_drag_min_mom = sqrt(drag_min_mom)
196 lambda = 1.0_r8_kind + (5.0_r8_kind - b_stab)*zeta_trans
197 rich_trans = zeta_trans/(1.0_r8_kind + 5.0_r8_kind*zeta_trans)
199 module_is_initialized = .true.
202 end subroutine monin_obukhov_init
206 subroutine monin_obukhov_end
208 module_is_initialized = .false.
210 end subroutine monin_obukhov_end
214 #include "monin_obukhov_r4.fh"
215 #include "monin_obukhov_r8.fh"
217 end module monin_obukhov_mod
integer function, public check_nml_error(IOSTAT, NML_NAME)
Checks the iostat argument that is returned after reading a namelist and determines if the error code...
subroutine, public write_version_number(version, tag, unit)
Prints to the log file (or a specified unit) the version id string and tag name.
subroutine, public error_mesg(routine, message, level)
Print notes, warnings and error messages; terminates program for warning and error messages....
Compute surface drag coefficients.
integer function stdlog()
This function returns the current standard fortran unit numbers for log messages. Log messages,...
integer function mpp_pe()
Returns processor ID.