Skip to content
Snippets Groups Projects
Commit fb358340 authored by Evgeny Mortikov's avatar Evgeny Mortikov
Browse files

removing redundant forcing setup code

parent 419fe261
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,6 @@ set(SOURCES
obl_math.f90
obl_state_eq.f90
obl_initial_conditions.f90
obl_forcing_and_boundary.f90
obl_boundary.f90
obl_turb_closure.f90
obl_diag.f90
......
......@@ -35,6 +35,14 @@ module obl_boundary
contains
subroutine get_dyn_velocity(dyn_velocity, flux_u, flux_v)
!< @brief get dynamic velocity
real, intent(out) :: dyn_velocity
real, intent(in) :: flux_u, flux_v
! ----------------------------------------------------------------------------
dyn_velocity = (flux_u**(2.0) + flux_v**(2.0))**(1.0/4.0)
end subroutine
subroutine set_bottom_friction(flux_u_bot, flux_v_bot, U, V, nz)
!< @brief set bottom u-momentum flux
real, intent(out) :: flux_u_bot, flux_v_bot !< u_dyn0**2, v_dyn0**2,[(m/s)**2] (?)
......
module obl_forcing_and_boundary
!< @brief boundary conditions module
! modules used
use obl_state_eq
use obl_math
! directives list
implicit none
contains
subroutine set_Flux_heat_bot (Flux_heat_bot, Time_flux_heat_bot, nf, df)
!< @brief set bottom heat flux
use obl_common_phys
integer, intent(in) :: nf !< number of timesteps
real, intent(in) :: df
real, intent(out) :: Flux_heat_bot(nf) !< bottom heat flux, input: [W/m**2], output: [K*m/s]
real, intent(out) :: Time_flux_heat_bot(nf) !< Time array
real :: Flux_heat_bot_tmp !< temporary bottom heat flux
integer :: i !< counter
integer :: status, num !< for file input
integer :: set_Flux !< how to set: 1 - const || 2 - function || 3 - file
set_Flux = 1
open (444, file= 'Kato-Phillips/Flux_heat_bottom.txt', status ='old')
status = 0
num = 0
if (set_Flux.eq.1) then
do i = 1, nf
Flux_heat_bot(i) = 0
Time_flux_heat_bot(i) = i * df
end do
else if (set_Flux.eq.3) then
do while (status.eq.0)
read (444, *, iostat = status) Flux_heat_bot_tmp
num = num + 1
Flux_heat_bot(num) = Flux_heat_bot_tmp/Rho_ref/cp_water
Time_flux_heat_bot(num) = num * df
if (num >= nf) then
exit
endif
end do
endif
close (444)
end subroutine
subroutine set_Flux_heat_surf (Flux_heat_surf, Time_flux_heat_surf, nf, df)
!< @brief set surface heat flux
use obl_common_phys
integer, intent(in) :: nf !< number of timesteps
real, intent(in) :: df
real, intent(out) :: Flux_heat_surf(nf) !< surface heat flux, output: [K*m/s]
real, intent(out) :: Time_flux_heat_surf(nf) !< Time array
real :: Flux_heat_surf_tmp !< temporary surface heat flux
integer :: i !< counter
integer :: status, num !< for file input
integer :: set_Flux !< how to set: 1 - const || 2 - function || 3 - file
set_Flux = 1
!open (555, file= 'Kato-Phillips/Flux_heat_surface.txt', status ='old') !'Flux_heat_surface_PAPA.txt'
open (555, file= 'PAPA_06_2017/Flux_heat_surface_PAPA.txt', status ='old')
status = 0
num = 0
if (set_Flux.eq.1) then
do i = 1, nf
Flux_heat_surf(i) = 0.0
Time_flux_heat_surf(i) = i * df
end do
else if (set_Flux.eq.3) then
do while (status.eq.0)
read (555, *, iostat = status) Flux_heat_surf_tmp
num = num + 1
Flux_heat_surf(num) = - Flux_heat_surf_tmp/Rho_ref/cp_water
Time_flux_heat_surf(num) = num * df
if (num >= nf) then
exit
endif
end do
endif
close (555)
end subroutine
subroutine set_Tau_x_surf(Tau_x_surf, flux_u_surf, Time_flux_u_surf, nf, df)
!< @brief set surface u-momentum flux
integer, intent(in) :: nf !< number of timesteps
real, intent(in) :: df
real, intent(out) :: Tau_x_surf(nf) !< [N/m**2]
real, intent(out) :: flux_u_surf(nf) !< u_dyn**2, [(m/s)**2] (?)
real, intent(out) :: Time_flux_u_surf(nf) !< Time array
real :: Tau_x_surf_tmp !< temporary surface u-momentum flux
integer :: i !< counter
integer :: status, num !< for file input
integer :: set_Tau !< how to set: 1 - const || 2 - function || 3 - file
set_Tau = 1
!open (188, file= 'Kato-Phillips/Tau_x.txt', status ='old')
open (188, file= 'PAPA_06_2017/Tau_x_PAPA.txt', status ='old')
status = 0
num = 0
if (set_Tau.eq.1) then
do i = 1, nf
Tau_x_surf(i) = 0.1 !0.1
end do
else if (set_Tau.eq.2) then
read (188, *, iostat = status) Tau_x_surf_tmp
do i = 1, nf
Tau_x_surf(i) = Tau_x_surf_tmp
end do
else if (set_Tau.eq.3) then
do while (status.eq.0)
read (188, *, iostat = status) Tau_x_surf_tmp
num = num + 1
Tau_x_surf(num) = Tau_x_surf_tmp
if (num >= nf) then
exit
endif
end do
endif
close (188)
do i = 1, nf
flux_u_surf(i) = Tau_x_surf(i) / Rho_ref
Time_flux_u_surf(i) = i * df
end do
end subroutine
subroutine set_Tau_y_surf(Tau_y_surf, flux_v_surf, Time_flux_v_surf, nf, df)
!< @brief set surface v-momentum flux
integer, intent(in) :: nf !< number of timesteps
real, intent(in) :: df
real, intent(out) :: Tau_y_surf(nf) !< [N/m**2]
real, intent(out) :: flux_v_surf(nf) !< v_dyn**2, [(m/s)**2]
real, intent(out) :: Time_flux_v_surf(nf) !< Time array
real :: Tau_y_surf_tmp !< temporary surface v-momentum flux
integer :: i !< counter
integer :: status, num !< for file input
integer :: set_Tau !< how to set: 1 - const || 2 - function || 3 - file
set_Tau = 1
!open (177, file= 'Kato-Phillips/Tau_y.txt', status ='old')
open (177, file= 'PAPA_06_2017/Tau_y_PAPA.txt', status ='old')
status = 0
num = 0
if (set_Tau.eq.1) then
do i = 1, nf
Tau_y_surf(i) = 0.0
end do
else if (set_Tau.eq.2) then
read (177, *, iostat = status) Tau_y_surf_tmp
do i = 1, nf
Tau_y_surf(i) = Tau_y_surf_tmp
end do
else if (set_Tau.eq.3) then
do while (status.eq.0)
read (177, *, iostat = status) Tau_y_surf_tmp
num = num + 1
Tau_y_surf(num) = Tau_y_surf_tmp
if (num >= nf) then
exit
endif
end do
endif
close (177)
do i = 1, nf
flux_v_surf(i) = Tau_y_surf(i) / Rho_ref
Time_flux_v_surf(i) = i * df
end do
end subroutine
subroutine set_Tau_x_bot(Tau_x_bot, flux_u_bot, Time_flux_u_bot, nf, df)
!< @brief set bottom u-momentum flux
integer, intent(in) :: nf !< number of timesteps
real, intent(in) :: df
real, intent(out) :: Tau_x_bot(nf) !< [N/m**2]
real, intent(out) :: flux_u_bot(nf) !< u_dyn**2, [(m/s)**2] (?)
real, intent(out) :: Time_flux_u_bot(nf) !< Time array
real :: Tau_x_bot_tmp !< temporary surface u-momentum flux
integer :: i !< counter
integer :: status, num !< for file input
integer :: set_Tau !< how to set: 1 - const || 2 - function || 3 - file
set_Tau = 1
do i = 1, nf
Tau_x_bot(i) = 0.0
end do
do i = 1, nf
flux_u_bot(i) = Tau_x_bot(i) / Rho_ref
Time_flux_u_bot(i) = i * df
end do
end subroutine
subroutine set_Tau_y_bot(Tau_y_bot, flux_v_bot, Time_flux_v_bot, nf, df)
!< @brief set bottom v-momentum flux
integer, intent(in) :: nf !< number of timesteps
real, intent(in) :: df
real, intent(out) :: Tau_y_bot(nf) !< [N/m**2]
real, intent(out) :: flux_v_bot(nf) !< u_dyn**2, [(m/s)**2] (?)
real, intent(out) :: Time_flux_v_bot(nf) !< Time array
real :: Tau_y_bot_tmp !< temporary surface u-momentum flux
integer :: i !< counter
integer :: status, num !< for file input
integer :: set_Tau !< how to set: 1 - const || 2 - function || 3 - file
set_Tau = 1
do i = 1, nf
Tau_y_bot(i) = 0.0
end do
do i = 1, nf
flux_v_bot(i) = Tau_y_bot(i) / Rho_ref
Time_flux_v_bot(i) = i * df
end do
end subroutine
subroutine set_Flux_sal_surf(Flux_sal_surf, Time_flux_sal_surf, nf, df)
!< @brief setsurface salinity flux
integer, intent(in) :: nf !< number of timesteps
real, intent(in) :: df
real, intent(out) :: Flux_sal_surf(nf) ! [PSU*m/s] ???
real, intent(out) :: Time_flux_sal_surf(nf) !< Time array
integer :: i !< counter
do i = 1, nf
Flux_sal_surf(i) = 0.0
Time_flux_sal_surf(i) = i * df
end do
end subroutine
subroutine set_Flux_sal_bot(Flux_sal_bot, Time_flux_sal_bot, nf, df)
!< @brief set bottom salinity flux
integer, intent(in) :: nf !< number of timesteps
real, intent(in) :: df
real, intent(out) :: Flux_sal_bot(nf) ! [???]
real, intent(out) :: Time_flux_sal_bot(nf) !< Time array
integer :: i !< counter
do i = 1, nf
Flux_sal_bot(i) = 0.0
Time_flux_sal_bot(i) = i * df
end do
end subroutine
subroutine get_dyn_velocity(dyn_velocity, flux_u, flux_v)
!< @brief get dynamic velocity
real, intent(out) :: dyn_velocity
real, intent(in) :: flux_u, flux_v
! ----------------------------------------------------------------------------
dyn_velocity = (flux_u**(2.0) + flux_v**(2.0))**(1.0/4.0)
end subroutine
end module
\ No newline at end of file
......@@ -17,7 +17,6 @@ program obl_main
use obl_tseries
use obl_output
use obl_initial_conditions
use obl_forcing_and_boundary
use obl_scm
use obl_diag
use obl_boundary
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment