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

minor setup update

parent c4824763
No related branches found
No related tags found
No related merge requests found
......@@ -19,51 +19,53 @@ module obl_config
public
!> @brief setup enum def.
integer, parameter :: setup_kato = 0 !< Kato-Phillips setup
integer, parameter :: setup_papa_fluxes = 1 !< Papa-station (fluxes) setup
integer, parameter :: setup_papa_meteo = 2 !< Papa-station (meteo) setup
integer, parameter :: obl_config_kato = 0 !< Kato-Phillips setup
integer, parameter :: obl_config_papa_fluxes = 1 !< Papa-station (fluxes) setup
integer, parameter :: obl_config_papa_meteo = 2 !< Papa-station (meteo) setup
character(len = 16), parameter :: setup_kato_tag = 'kato'
character(len = 16), parameter :: setup_papa_fluxes_tag = 'papa-fluxes'
character(len = 16), parameter :: setup_papa_meteo_tag = 'papa-meteo'
character(len = 16), parameter :: obl_config_kato_tag = 'kato'
character(len = 16), parameter :: obl_config_papa_fluxes_tag = 'papa-fluxes'
character(len = 16), parameter :: obl_config_papa_meteo_tag = 'papa-meteo'
contains
function get_setup_id(tag) result(id)
! --------------------------------------------------------------------------------
function get_obl_config_id(tag) result(id)
implicit none
character(len=*), intent(in) :: tag
integer :: id
id = - 1
if (trim(tag) == trim(setup_kato_tag)) then
id = setup_kato
else if (trim(tag) == trim(setup_papa_fluxes_tag)) then
id = setup_papa_fluxes
else if (trim(tag) == trim(setup_papa_meteo_tag)) then
id = setup_papa_meteo
if (trim(tag) == trim(obl_config_kato_tag)) then
id = obl_config_kato
else if (trim(tag) == trim(obl_config_papa_fluxes_tag)) then
id = obl_config_papa_fluxes
else if (trim(tag) == trim(obl_config_papa_meteo_tag)) then
id = obl_config_papa_meteo
end if
end function
function get_setup_tag(id) result(tag)
! --------------------------------------------------------------------------------
function get_obl_config_tag(id) result(tag)
implicit none
integer :: id
character(len=:), allocatable :: tag
tag = 'undefined'
if (id == setup_kato) then
tag = setup_kato_tag
else if (id == setup_papa_fluxes) then
tag = setup_papa_fluxes_tag
else if (id == setup_papa_meteo) then
tag = setup_papa_meteo_tag
if (id == obl_config_kato) then
tag = obl_config_kato_tag
else if (id == obl_config_papa_fluxes) then
tag = obl_config_papa_fluxes_tag
else if (id == obl_config_papa_meteo) then
tag = obl_config_papa_meteo_tag
end if
end function
! --------------------------------------------------------------------------------
subroutine set_grid(grid, setup_id, ierr)
subroutine set_grid(grid, config_id, ierr)
!> @brief grid parameters setup
! ----------------------------------------------------------------------------
use obl_grid
......@@ -72,21 +74,22 @@ contains
use obl_run_papa_meteo, only : set_grid_papa_meteo => set_grid
type (gridDataType), intent(inout) :: grid
integer, intent(in) :: setup_id
integer, intent(in) :: config_id
integer, intent(out) :: ierr
! ----------------------------------------------------------------------------
ierr = 0 ! = OK
if (setup_id == setup_kato) then
!< bultin modes
if (config_id == obl_config_kato) then
call set_grid_kato(grid)
return
endif
if (setup_id == setup_papa_fluxes) then
if (config_id == obl_config_papa_fluxes) then
call set_grid_papa_fluxes(grid)
return
endif
if (setup_id == setup_papa_meteo) then
if (config_id == obl_config_papa_meteo) then
call set_grid_papa_meteo(grid)
return
endif
......@@ -113,13 +116,13 @@ contains
call set_uniform_grid(grid, -depth, depth, cz)
end block
#else
!> unable to define without config
!> unable to define without configuration file
ierr = 1
#endif
end subroutine set_grid
! --------------------------------------------------------------------------------
subroutine set_time(time_begin, time_end, dt, setup_id, ierr)
subroutine set_time(time_begin, time_end, dt, config_id, ierr)
!> @brief time parameters setup
! ----------------------------------------------------------------------------
use obl_run_kato, only : set_time_kato => set_time
......@@ -127,21 +130,22 @@ contains
use obl_run_papa_meteo, only : set_time_papa_meteo => set_time
real, intent(out) :: time_begin, time_end, dt
integer, intent(in) :: setup_id
integer, intent(in) :: config_id
integer, intent(out) :: ierr
! ----------------------------------------------------------------------------
ierr = 0 ! = OK
if (setup_id == setup_kato) then
!< bultin modes
if (config_id == obl_config_kato) then
call set_time_kato(time_begin, time_end, dt)
return
endif
if (setup_id == setup_papa_fluxes) then
if (config_id == obl_config_papa_fluxes) then
call set_time_papa_fluxes(time_begin, time_end, dt)
return
endif
if (setup_id == setup_papa_meteo) then
if (config_id == obl_config_papa_meteo) then
call set_time_papa_meteo(time_begin, time_end, dt)
return
endif
......@@ -170,13 +174,13 @@ contains
end block
#else
!> unable to define without config
!> unable to define without configuration file
ierr = 1
#endif
end subroutine set_time
! --------------------------------------------------------------------------------
subroutine set_phys(setup_id, ierr)
subroutine set_phys(config_id, ierr)
!> @brief phys parameters setup
! ----------------------------------------------------------------------------
use obl_scm
......@@ -184,21 +188,21 @@ contains
use obl_run_papa_fluxes, only : set_phys_papa_fluxes => set_phys
use obl_run_papa_meteo, only : set_phys_papa_meteo => set_phys
integer, intent(in) :: setup_id
integer, intent(in) :: config_id
integer, intent(out) :: ierr
! ----------------------------------------------------------------------------
ierr = 0 ! = OK
if (setup_id == setup_kato) then
if (config_id == obl_config_kato) then
call set_phys_kato
return
endif
if (setup_id == setup_papa_fluxes) then
if (config_id == obl_config_papa_fluxes) then
call set_phys_papa_fluxes
return
endif
if (setup_id == setup_papa_meteo) then
if (config_id == obl_config_papa_meteo) then
call set_phys_papa_meteo
return
endif
......@@ -239,41 +243,41 @@ contains
end block
#else
!> unable to define without config
!> unable to define without configuration file
ierr = 1
#endif
end subroutine set_phys
! --------------------------------------------------------------------------------
subroutine set_forcing(setup_id, ierr)
subroutine set_forcing(config_id, ierr)
!> @brief phys parameters setup
! ----------------------------------------------------------------------------
use obl_fluxes
use obl_tforcing
use obl_math !< using char_array2str()
use obl_run_kato, only : set_forcing_kato => set_forcing
use obl_run_papa_fluxes, only : set_forcing_papa_fluxes => set_forcing
use obl_run_papa_meteo, only : set_forcing_papa_meteo => set_forcing
integer, intent(in) :: setup_id
integer, intent(in) :: config_id
integer, intent(out) :: ierr
! ----------------------------------------------------------------------------
ierr = 0 ! = OK
if (setup_id == setup_kato) then
if (config_id == obl_config_kato) then
call set_forcing_kato
return
endif
if (setup_id == setup_papa_fluxes) then
if (config_id == obl_config_papa_fluxes) then
call set_forcing_papa_fluxes
return
endif
if (setup_id == setup_papa_meteo) then
if (config_id == obl_config_papa_meteo) then
call set_forcing_papa_meteo
return
endif
!< assuming that forcing def. is optional
block
call set_config_tforcing(tau_x_surf, "atm.tau_x", ierr)
if (ierr /= 0) return
......@@ -346,7 +350,7 @@ contains
end subroutine set_forcing
! --------------------------------------------------------------------------------
subroutine set_initial_conditions(grid, setup_id, ierr)
subroutine set_initial_conditions(grid, config_id, ierr)
!> @brief initial conditions setup
! ----------------------------------------------------------------------------
use obl_state
......@@ -358,26 +362,28 @@ contains
type (gridDataType), intent(in) :: grid
integer, intent(in) :: setup_id
integer, intent(in) :: config_id
integer, intent(out) :: ierr
! ----------------------------------------------------------------------------
ierr = 0 ! = OK
if (setup_id == setup_kato) then
if (config_id == obl_config_kato) then
call set_initial_conditions_kato(grid)
return
endif
if (setup_id == setup_papa_fluxes) then
if (config_id == obl_config_papa_fluxes) then
call set_initial_conditions_papa_fluxes(grid)
return
endif
if (setup_id == setup_papa_meteo) then
if (config_id == obl_config_papa_meteo) then
call set_initial_conditions_papa_meteo(grid)
return
endif
block
!< *: will fail without configuration file
call set_config_profile(Theta, "initial_conditions.Theta", grid, ierr)
if (ierr /= 0) then
return
......
......@@ -45,10 +45,10 @@ program obl_main
! model data
! --------------------------------------------------------------------------------
integer :: obl_setup ! --- OBL builtin setup
! = setup_kato: Kato-Phillips
! = setup_papa_fluxes: Papa-station (fluxes)
! = setup_papa_meteo: Papa-station (meteo)
integer :: obl_config_id ! --- OBL builtin configs
! = obl_config_kato: Kato-Phillips
! = obl_config_papa_fluxes: Papa-station (fluxes)
! = obl_config_papa_meteo: Papa-station (meteo)
integer :: closure_mode ! --- OBL closure def.
! = 1 - pacanowski-philander
......@@ -105,12 +105,12 @@ program obl_main
! --------------------------------------------------------------------------------
!< default setup = setup_kato (Kato-Phiilps)
!< default config = obl_config_kato (Kato-Phiilps)
!< possible values:
!< setup_kato
!< setup_papa_fluxes
!< setup_papa_meteo
obl_setup = setup_kato
!< obl_config_kato
!< obl_config_papa_fluxes
!< obl_config_papa_meteo
obl_config_id = obl_config_kato
!< default closure = 4, k-epsilon (implicit)
!< poissible values:
......@@ -150,8 +150,8 @@ program obl_main
end if
call get_command_argument(i + 1, arg)
obl_setup = get_setup_id(arg)
if (obl_setup == -1) then
obl_config_id = get_obl_config_id(arg)
if (obl_config_id == -1) then
#ifdef USE_CONFIG_PARSER
!< try reading configuration file
call c_config_run(trim(arg)//C_NULL_CHAR, status)
......@@ -162,7 +162,7 @@ program obl_main
end if
!< forcing configuration file setup
obl_setup = 999
obl_config_id = 999
#else
write(*, *) ' FAILURE! > unknown config [key]: ', trim(arg)
ierr = 1 ! signal ERROR
......@@ -174,7 +174,7 @@ program obl_main
!< setting grid
! ----------------------------------------------------------------------------
call set_grid(grid, obl_setup, ierr)
call set_grid(grid, obl_config_id, ierr)
if (ierr /= 0) then
write(*, *) ' FAILURE! > unable to set grid '
return
......@@ -186,7 +186,7 @@ program obl_main
!< setting model time
! ----------------------------------------------------------------------------
call set_time(time_begin, time_end, dt, obl_setup, ierr)
call set_time(time_begin, time_end, dt, obl_config_id, ierr)
if (ierr /= 0) then
write(*, *) ' FAILURE! > unable to set time '
return
......@@ -207,7 +207,7 @@ program obl_main
!< setting phys
! ----------------------------------------------------------------------------
call set_phys(obl_setup, ierr)
call set_phys(obl_config_id, ierr)
if (ierr /= 0) then
write(*, *) ' FAILURE! > unable to set phys parameters '
return
......@@ -216,7 +216,7 @@ program obl_main
!< setting forcing
! ----------------------------------------------------------------------------
call set_forcing(obl_setup, ierr)
call set_forcing(obl_config_id, ierr)
if (ierr /= 0) then
write(*, *) ' FAILURE! > unable to set forcing '
return
......@@ -225,7 +225,7 @@ program obl_main
!< initialization of main fields
! ----------------------------------------------------------------------------
call set_initial_conditions(grid, obl_setup, ierr)
call set_initial_conditions(grid, obl_config_id, ierr)
if (ierr /= 0) then
write(*, *) ' FAILURE! > unable to set initial conditions '
return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment