From 34d1cad2c2ec981f71ae3812de2d754a8f5f6d54 Mon Sep 17 00:00:00 2001 From: Evgeny Mortikov <evgeny.mortikov@gmail.com> Date: Sun, 22 Sep 2024 03:41:42 +0300 Subject: [PATCH] minor update in main driver --- srcF/sfx_main.f90 | 6 ++-- srcF/sfx_run.f90 | 70 ++++++++++++++++++++--------------------------- 2 files changed, 34 insertions(+), 42 deletions(-) diff --git a/srcF/sfx_main.f90 b/srcF/sfx_main.f90 index 0b3599e..ac25fec 100644 --- a/srcF/sfx_main.f90 +++ b/srcF/sfx_main.f90 @@ -1,4 +1,5 @@ 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 diff --git a/srcF/sfx_run.f90 b/srcF/sfx_run.f90 index 3a2eb33..a05706b 100644 --- a/srcF/sfx_run.f90 +++ b/srcF/sfx_run.f90 @@ -1,4 +1,5 @@ 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) -- GitLab