-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathcoupled.f90
More file actions
87 lines (64 loc) · 3.07 KB
/
Copy pathcoupled.f90
File metadata and controls
87 lines (64 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
!-----------------------------------------------------------------------------
! (C) Crown copyright 2025 Met Office. All rights reserved.
! The file LICENCE, distributed with this code, contains details of the terms
! under which the code may be used.
!-----------------------------------------------------------------------------
!> @page Miniapp coupled program
!> @brief Main program used to illustrate how to write and test a coupled
!> LFRic application.
!> @details Calls init, step and finalise routines from a driver module
program coupled
use cli_mod, only: parse_command_line
use constants_mod, only: precision_real
use driver_collections_mod, only: init_collections, final_collections
use driver_comm_mod, only: init_comm, final_comm
use driver_config_mod, only: init_config, final_config
use driver_log_mod, only: init_logger, final_logger
use driver_modeldb_mod, only: modeldb_type
use driver_time_mod, only: init_time, final_time
use log_mod, only: log_event, &
log_level_trace, &
log_scratch_space
use lfric_mpi_mod, only: global_mpi
use coupled_mod, only: coupled_required_namelists
use coupled_driver_mod, only: initialise, step, finalise
implicit none
! The technical and scientific state
type(modeldb_type) :: modeldb
character(*), parameter :: program_name = "coupled"
character(:), allocatable :: cpl_component_name
character(:), allocatable :: filename
call parse_command_line( filename, component_name=cpl_component_name )
call modeldb%values%initialise( 'values', 5 )
call modeldb%config%initialise( program_name )
call modeldb%values%add_key_value('cpl_name', cpl_component_name)
modeldb%mpi => global_mpi
call init_comm( "coupled", modeldb )
call init_config( filename, coupled_required_namelists, &
config=modeldb%config )
call init_logger( modeldb%config, &
modeldb%mpi%get_comm(), &
program_name//"_"//cpl_component_name )
write(log_scratch_space,'(A)') &
'Application built with '// trim(precision_real) // &
'-bit real numbers.'
call log_event( log_scratch_space, log_level_trace )
call init_collections()
call init_time( modeldb )
deallocate( filename )
! Create the depository field collection and place it in modeldb
call modeldb%fields%add_empty_field_collection("depository")
call modeldb%io_contexts%initialise(program_name, 100)
call log_event( 'Initialising ' // program_name // ' ...', log_level_trace )
call initialise( program_name, modeldb, modeldb%calendar )
do while (modeldb%clock%tick())
call step( program_name, modeldb )
end do
call log_event( 'Finalising ' // program_name // ' ...', log_level_trace )
call finalise( program_name, modeldb )
call final_time( modeldb )
call final_collections()
call final_logger( program_name )
call final_config()
call final_comm( modeldb )
end program coupled