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
No related branches found
No related tags found
No related merge requests found
program sfx_main
!< @brief main driver
! modules used
! --------------------------------------------------------------------------------
......@@ -19,11 +20,12 @@ program sfx_main
! --------------------------------------------------------------------------------
!< @brief run setup
! --- setting run
call set_run(filename_out, dataset, model)
!< @brief running main driver
! --- running main driver
call run_dataset(filename_out, dataset, model)
! *: explicit call to stop to print exceptions raised
stop
end program
module sfx_run
!< @brief sfx driver
! directives list
! --------------------------------------------------------------------------------
......@@ -14,7 +15,7 @@ module sfx_run
contains
!> @brief main run sfx on dataset subroutine
!> @brief run sfx on dataset
! ----------------------------------------------------------------------------
subroutine run_dataset(filename_out, dataset, model)
......@@ -40,11 +41,6 @@ contains
numericsType_sheba => numericsType
! --------------------------------------------------------------------------------
! directives list
! --------------------------------------------------------------------------------
implicit none
! --------------------------------------------------------------------------------
character(len=*), intent(in) :: filename_out
type(sfxDatasetType), intent(in) :: dataset
integer, intent(in) :: model
......@@ -70,19 +66,19 @@ contains
integer :: io, status
! --------------------------------------------------------------------------------
write(*, *) ' Running SFX:'
write(*, '(a,a)') ' model = ', trim(get_model_tag(model))
write(*, '(a,a)') ' dataset = ', trim(get_dataset_tag(dataset%id))
write(*, '(a,a)') ' filename[IN] = ', trim(dataset%filename)
write(*, '(a,a)') ' filename[OUT] = ', trim(filename_out)
write(*, '(a, g0)') ' surface type = ', dataset%surface_type
write(*, '(a, g0)') ' h = ', dataset%h
write(*, '(a, g0)') ' z0(m) = ', dataset%z0_m
write(*, '(a, g0)') ' z0(h) = ', dataset%z0_h
write(*, '(a,a)') ' model = ', trim(get_model_tag(model))
write(*, '(a,a)') ' dataset = ', trim(get_dataset_tag(dataset%id))
write(*, '(a,a)') ' filename[IN] = ', trim(dataset%filename)
write(*, '(a,a)') ' filename[OUT] = ', trim(filename_out)
write(*, '(a,g0)') ' surface type = ', dataset%surface_type
write(*, '(a,g0)') ' h = ', dataset%h
write(*, '(a,g0)') ' z0(m) = ', dataset%z0_m
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')
if (status /= 0) then
write(*, *) ' FAILURE! > unable to open file: ', trim(dataset%filename)
......@@ -100,23 +96,23 @@ contains
close(io)
! --- print number of elements in dataset
write(*, '(a, g0)') ' size = ', num
write(*, '(a,g0)') ' size = ', num
if (dataset%nmax > 0) then
write(*, '(a, g0)') ' nmax = ', dataset%nmax
write(*, '(a,g0)') ' nmax = ', dataset%nmax
num = min(num, dataset%nmax)
end if
!< @brief allocate input & output data
! --- allocate input & output data
call allocate_meteo_vec(meteo, num)
call allocate_sfx_vec(sfx, num)
!< @brief setting height & roughness
! --- setting height & roughness
meteo_cell%h = dataset%h
meteo_cell%z0_m = dataset%z0_m
!< @brief read input data
! --- read input data
open(newunit = io, file = dataset%filename, iostat = status, status = 'old')
if (status /= 0) then
write(*, *) ' FAILURE! > unable to open file: ', trim(dataset%filename)
......@@ -135,7 +131,7 @@ contains
close(io)
!< @brief calling flux module
! --- calling flux module
if (model == model_esm) then
call get_surface_fluxes_vec_esm(sfx, meteo, numerics_esm, num)
else if (model == model_log) then
......@@ -147,7 +143,7 @@ contains
end if
!< @brief write output data
! --- write output data
call write_ascii_vec11(filename_out, &
sfx%zeta, sfx%Rib, &
sfx%Re, sfx%B, sfx%z0_m, sfx%z0_t, &
......@@ -155,32 +151,27 @@ contains
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_sfx_vec(sfx)
end subroutine
!> @brief main setup sfx & dataset subroutine
!> @brief set sfx run on dataset
! ----------------------------------------------------------------------------
subroutine set_run(filename_out, dataset, model)
! modules used
! --------------------------------------------------------------------------------
#ifdef USE_CONFIG_PARSER
use config_parser
use iso_c_binding, only: C_NULL_CHAR
use config_parser
#endif
use sfx_common
use sfx_config
! --------------------------------------------------------------------------------
! directives list
! --------------------------------------------------------------------------------
implicit none
! --------------------------------------------------------------------------------
character(len=:), allocatable, intent(out) :: filename_out
type(sfxDatasetType), intent(out) :: dataset
integer, intent(out) :: model
......@@ -202,22 +193,21 @@ contains
! local variables
! --------------------------------------------------------------------------------
integer :: i
integer :: status
integer :: i, status
integer :: id, nmax
#ifdef USE_CONFIG_PARSER
character, allocatable :: config_field(:)
#endif
! --------------------------------------------------------------------------------
! --- default model & dataset
model = model_esm ! default = ESM
call set_dataset(dataset, dataset_mosaic) ! default = MOSAiC
is_output_set = 0 ! default = auto define output filename
!< define default model & dataset
model = model_esm !< default = ESM
call set_dataset(dataset, dataset_mosaic) !< default = MOSAiC
is_output_set = 0 !< default = auto define output filename
!< command line arguments processing
! --- command line arguments processing
num_args = command_argument_count()
do i = 1, num_args
call get_command_argument(i, arg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment