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

minor update in main driver

parent 809c181f
Branches
Tags
No related merge requests found
program sfx_main program sfx_main
!< @brief main driver
! modules used ! modules used
! -------------------------------------------------------------------------------- ! --------------------------------------------------------------------------------
...@@ -19,11 +20,12 @@ program sfx_main ...@@ -19,11 +20,12 @@ program sfx_main
! -------------------------------------------------------------------------------- ! --------------------------------------------------------------------------------
!< @brief run setup ! --- setting run
call set_run(filename_out, dataset, model) call set_run(filename_out, dataset, model)
!< @brief running main driver ! --- running main driver
call run_dataset(filename_out, dataset, model) call run_dataset(filename_out, dataset, model)
! *: explicit call to stop to print exceptions raised
stop stop
end program end program
module sfx_run module sfx_run
!< @brief sfx driver
! directives list ! directives list
! -------------------------------------------------------------------------------- ! --------------------------------------------------------------------------------
...@@ -14,7 +15,7 @@ module sfx_run ...@@ -14,7 +15,7 @@ module sfx_run
contains contains
!> @brief main run sfx on dataset subroutine !> @brief run sfx on dataset
! ---------------------------------------------------------------------------- ! ----------------------------------------------------------------------------
subroutine run_dataset(filename_out, dataset, model) subroutine run_dataset(filename_out, dataset, model)
...@@ -40,11 +41,6 @@ contains ...@@ -40,11 +41,6 @@ contains
numericsType_sheba => numericsType numericsType_sheba => numericsType
! -------------------------------------------------------------------------------- ! --------------------------------------------------------------------------------
! directives list
! --------------------------------------------------------------------------------
implicit none
! --------------------------------------------------------------------------------
character(len=*), intent(in) :: filename_out character(len=*), intent(in) :: filename_out
type(sfxDatasetType), intent(in) :: dataset type(sfxDatasetType), intent(in) :: dataset
integer, intent(in) :: model integer, intent(in) :: model
...@@ -82,7 +78,7 @@ contains ...@@ -82,7 +78,7 @@ contains
write(*, '(a,g0)') ' z0(h) = ', dataset%z0_h write(*, '(a,g0)') ' z0(h) = ', dataset%z0_h
!< @brief define number of cells ! --- define number of elements
open(newunit = io, file = dataset%filename, iostat = status, status ='old') open(newunit = io, file = dataset%filename, iostat = status, status ='old')
if (status /= 0) then if (status /= 0) then
write(*, *) ' FAILURE! > unable to open file: ', trim(dataset%filename) write(*, *) ' FAILURE! > unable to open file: ', trim(dataset%filename)
...@@ -107,16 +103,16 @@ contains ...@@ -107,16 +103,16 @@ contains
end if end if
!< @brief allocate input & output data ! --- allocate input & output data
call allocate_meteo_vec(meteo, num) call allocate_meteo_vec(meteo, num)
call allocate_sfx_vec(sfx, num) call allocate_sfx_vec(sfx, num)
!< @brief setting height & roughness ! --- setting height & roughness
meteo_cell%h = dataset%h meteo_cell%h = dataset%h
meteo_cell%z0_m = dataset%z0_m meteo_cell%z0_m = dataset%z0_m
!< @brief read input data ! --- read input data
open(newunit = io, file = dataset%filename, iostat = status, status = 'old') open(newunit = io, file = dataset%filename, iostat = status, status = 'old')
if (status /= 0) then if (status /= 0) then
write(*, *) ' FAILURE! > unable to open file: ', trim(dataset%filename) write(*, *) ' FAILURE! > unable to open file: ', trim(dataset%filename)
...@@ -135,7 +131,7 @@ contains ...@@ -135,7 +131,7 @@ contains
close(io) close(io)
!< @brief calling flux module ! --- calling flux module
if (model == model_esm) then if (model == model_esm) then
call get_surface_fluxes_vec_esm(sfx, meteo, numerics_esm, num) call get_surface_fluxes_vec_esm(sfx, meteo, numerics_esm, num)
else if (model == model_log) then else if (model == model_log) then
...@@ -147,7 +143,7 @@ contains ...@@ -147,7 +143,7 @@ contains
end if end if
!< @brief write output data ! --- write output data
call write_ascii_vec11(filename_out, & call write_ascii_vec11(filename_out, &
sfx%zeta, sfx%Rib, & sfx%zeta, sfx%Rib, &
sfx%Re, sfx%B, sfx%z0_m, sfx%z0_t, & sfx%Re, sfx%B, sfx%z0_m, sfx%z0_t, &
...@@ -155,32 +151,27 @@ contains ...@@ -155,32 +151,27 @@ contains
sfx%Cm,sfx%Ct, sfx%Km, sfx%Pr_t_inv, num, '(11(f10.4,3x))', status) sfx%Cm,sfx%Ct, sfx%Km, sfx%Pr_t_inv, num, '(11(f10.4,3x))', status)
!< @brief deallocate input & output data ! --- deallocate input & output data
call deallocate_meteo_vec(meteo) call deallocate_meteo_vec(meteo)
call deallocate_sfx_vec(sfx) call deallocate_sfx_vec(sfx)
end subroutine end subroutine
!> @brief main setup sfx & dataset subroutine !> @brief set sfx run on dataset
! ---------------------------------------------------------------------------- ! ----------------------------------------------------------------------------
subroutine set_run(filename_out, dataset, model) subroutine set_run(filename_out, dataset, model)
! modules used ! modules used
! -------------------------------------------------------------------------------- ! --------------------------------------------------------------------------------
#ifdef USE_CONFIG_PARSER #ifdef USE_CONFIG_PARSER
use config_parser
use iso_c_binding, only: C_NULL_CHAR use iso_c_binding, only: C_NULL_CHAR
use config_parser
#endif #endif
use sfx_common use sfx_common
use sfx_config use sfx_config
! -------------------------------------------------------------------------------- ! --------------------------------------------------------------------------------
! directives list
! --------------------------------------------------------------------------------
implicit none
! --------------------------------------------------------------------------------
character(len=:), allocatable, intent(out) :: filename_out character(len=:), allocatable, intent(out) :: filename_out
type(sfxDatasetType), intent(out) :: dataset type(sfxDatasetType), intent(out) :: dataset
integer, intent(out) :: model integer, intent(out) :: model
...@@ -202,8 +193,7 @@ contains ...@@ -202,8 +193,7 @@ contains
! local variables ! local variables
! -------------------------------------------------------------------------------- ! --------------------------------------------------------------------------------
integer :: i integer :: i, status
integer :: status
integer :: id, nmax integer :: id, nmax
#ifdef USE_CONFIG_PARSER #ifdef USE_CONFIG_PARSER
...@@ -212,12 +202,12 @@ contains ...@@ -212,12 +202,12 @@ contains
! -------------------------------------------------------------------------------- ! --------------------------------------------------------------------------------
!< define default model & dataset ! --- default model & dataset
model = model_esm !< default = ESM model = model_esm ! default = ESM
call set_dataset(dataset, dataset_mosaic) !< default = MOSAiC call set_dataset(dataset, dataset_mosaic) ! default = MOSAiC
is_output_set = 0 !< default = auto define output filename is_output_set = 0 ! default = auto define output filename
!< command line arguments processing ! --- command line arguments processing
num_args = command_argument_count() num_args = command_argument_count()
do i = 1, num_args do i = 1, num_args
call get_command_argument(i, arg) call get_command_argument(i, arg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment