27 module monin_obukhov_mod
29 use constants_mod,
only: grav, vonkarm
30 use mpp_mod,
only: input_nml_file
36 use platform_mod,
only: r4_kind, r8_kind
41 public :: monin_obukhov_init
42 public :: monin_obukhov_end
52 module procedure mo_drag_0d_r4, mo_drag_0d_r8
53 module procedure mo_drag_1d_r4, mo_drag_1d_r8
54 module procedure mo_drag_2d_r4, mo_drag_2d_r8
60 module procedure mo_profile_0d_r4, mo_profile_0d_r8
61 module procedure mo_profile_1d_r4, mo_profile_1d_r8
62 module procedure mo_profile_2d_r4, mo_profile_2d_r8
63 module procedure mo_profile_0d_n_r4, mo_profile_0d_n_r8
64 module procedure mo_profile_1d_n_r4, mo_profile_1d_n_r8
65 module procedure mo_profile_2d_n_r4, mo_profile_2d_n_r8
70 module procedure mo_diff_0d_n_r4, mo_diff_0d_n_r8
71 module procedure mo_diff_0d_1_r4, mo_diff_0d_1_r8
72 module procedure mo_diff_1d_n_r4, mo_diff_1d_n_r8
73 module procedure mo_diff_1d_1_r4, mo_diff_1d_1_r8
74 module procedure mo_diff_2d_n_r4, mo_diff_2d_n_r8
75 module procedure mo_diff_2d_1_r4, mo_diff_2d_1_r8
80 module procedure stable_mix_0d_r4, stable_mix_0d_r8
81 module procedure stable_mix_1d_r4, stable_mix_1d_r8
82 module procedure stable_mix_2d_r4, stable_mix_2d_r8
83 module procedure stable_mix_3d_r4, stable_mix_3d_r8
87 module procedure mo_integral_m_r4, mo_integral_m_r8
91 module procedure mo_integral_tq_r4, mo_integral_tq_r8
95 module procedure mo_derivative_m_r4, mo_derivative_m_r8
99 module procedure mo_derivative_t_r4, mo_derivative_t_r8
107 #include<file_version.h>
113 real(kind=r8_kind) :: rich_crit = 2.0_r8_kind
114 real(kind=r8_kind) :: drag_min_heat = 1.0e-05_r8_kind
115 real(kind=r8_kind) :: drag_min_moist = 1.0e-05_r8_kind
116 real(kind=r8_kind) :: drag_min_mom = 1.0e-05_r8_kind
117 logical :: neutral = .false.
118 integer :: stable_option = 1
119 real(kind=r8_kind) :: zeta_trans = 0.5_r8_kind
120 logical :: new_mo_option = .false.
123 namelist /monin_obukhov_nml/ rich_crit, neutral, drag_min_heat, &
124 drag_min_moist, drag_min_mom, &
125 stable_option, zeta_trans, new_mo_option
131 real(kind=r8_kind),
parameter :: small = 1.0e-04_r8_kind
132 real(kind=r8_kind) :: b_stab, r_crit, lambda, rich_trans
133 real(kind=r8_kind) :: sqrt_drag_min_heat, sqrt_drag_min_moist, sqrt_drag_min_mom
134 logical :: module_is_initialized = .false.
141 subroutine monin_obukhov_init
143 integer :: ierr, io, logunit
147 read (input_nml_file, nml=monin_obukhov_nml, iostat=io)
152 if (
mpp_pe() == mpp_root_pe() )
then
155 write (logunit, nml=monin_obukhov_nml)
160 if(rich_crit.le.0.25_r8_kind)
call error_mesg( &
161 'MONIN_OBUKHOV_INIT in MONIN_OBUKHOV_MOD', &
162 'rich_crit in monin_obukhov_mod must be > 0.25', fatal)
164 if(drag_min_heat.le.0.0_r8_kind)
call error_mesg( &
165 'MONIN_OBUKHOV_INIT in MONIN_OBUKHOV_MOD', &
166 'drag_min_heat in monin_obukhov_mod must be >= 0.0', fatal)
168 if(drag_min_moist.le.0.0_r8_kind)
call error_mesg( &
169 'MONIN_OBUKHOV_INIT in MONIN_OBUKHOV_MOD', &
170 'drag_min_moist in monin_obukhov_mod must be >= 0.0', fatal)
172 if(drag_min_mom.le.0.0_r8_kind)
call error_mesg( &
173 'MONIN_OBUKHOV_INIT in MONIN_OBUKHOV_MOD', &
174 'drag_min_mom in monin_obukhov_mod must be >= 0.0', fatal)
176 if(stable_option < 1 .or. stable_option > 2)
call error_mesg( &
177 'MONIN_OBUKHOV_INIT in MONIN_OBUKHOV_MOD', &
178 'the only allowable values of stable_option are 1 and 2', fatal)
180 if(stable_option == 2 .and. zeta_trans < 0)
call error_mesg( &
181 'MONIN_OBUKHOV_INIT in MONIN_OBUKHOV_MOD', &
182 'zeta_trans must be positive', fatal)
184 b_stab = 1.0_r8_kind/rich_crit
185 r_crit = 0.95_r8_kind*rich_crit
188 sqrt_drag_min_heat = 0.0_r8_kind
189 if(drag_min_heat.ne.0.0_r8_kind) sqrt_drag_min_heat = sqrt(drag_min_heat)
191 sqrt_drag_min_moist = 0.0_r8_kind
192 if(drag_min_moist.ne.0.0_r8_kind) sqrt_drag_min_moist = sqrt(drag_min_moist)
194 sqrt_drag_min_mom = 0.0_r8_kind
195 if(drag_min_mom.ne.0.0_r8_kind) sqrt_drag_min_mom = sqrt(drag_min_mom)
197 lambda = 1.0_r8_kind + (5.0_r8_kind - b_stab)*zeta_trans
198 rich_trans = zeta_trans/(1.0_r8_kind + 5.0_r8_kind*zeta_trans)
200 module_is_initialized = .true.
203 end subroutine monin_obukhov_init
207 subroutine monin_obukhov_end
209 module_is_initialized = .false.
211 end subroutine monin_obukhov_end
215 #include "monin_obukhov_r4.fh"
216 #include "monin_obukhov_r8.fh"
218 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.