Skip to content

Commit 638e8ae

Browse files
committed
clean up initialize_global
1 parent f0a404b commit 638e8ae

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/fabm.F90

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,11 @@ subroutine start(self)
908908
call cache_create(self%domain, self%cache_fill_values, self%cache_hz)
909909
call cache_create(self%domain, self%cache_fill_values, self%cache_vert)
910910

911-
call initialize_global(self%root)
911+
if (self%seconds_per_time_unit == 0.0_rke) then
912+
call initialize_global(self%root)
913+
else
914+
call initialize_global(self%root, self%seconds_per_time_unit)
915+
end if
912916

913917
! For diagnostics that are not needed, set their write index to 0 (rubbish bin)
914918
if (self%log) then
@@ -1001,24 +1005,21 @@ subroutine flag_variables_with_data(variable_list, data_sources)
10011005
end do
10021006
end subroutine
10031007

1004-
recursive subroutine initialize_global(model)
1008+
recursive subroutine initialize_global(model, seconds_per_time_unit)
10051009
class (type_base_model), intent(inout) :: model
1010+
real(rke), optional, intent(in) :: seconds_per_time_unit
10061011

10071012
type (type_model_list_node), pointer :: child
10081013

10091014
select type (model)
10101015
class is (type_global_model)
1011-
if (self%seconds_per_time_unit == 0.0_rke) then
1012-
call model%set_data(self%store)
1013-
else
1014-
call model%set_data(self%store, self%seconds_per_time_unit)
1015-
end if
1016+
call model%set_data(self%store, seconds_per_time_unit)
10161017
end select
10171018

10181019
! Process children
10191020
child => model%children%first
10201021
do while (associated(child))
1021-
call initialize_global(child%model)
1022+
call initialize_global(child%model, seconds_per_time_unit)
10221023
child => child%next
10231024
end do
10241025
end subroutine

0 commit comments

Comments
 (0)