source: dynamico_lmdz/simple_physics/phyparam/physics/read_param_mod.F90 @ 4225

Last change on this file since 4225 was 4223, checked in by dubos, 6 years ago

simple_physics : cleanup phyparam and iniphyparam

File size: 2.5 KB
Line 
1MODULE read_param_mod
2  IMPLICIT NONE
3  PRIVATE
4  SAVE
5
6  INTERFACE
7
8     ! each of these plugins reads a parameter of a certain type and stores the value in 'val'
9     ! a typical implementation reads from a configuration file containing 'name = value' statements
10     ! if 'name' is not present in the config file, defval is used as default value
11     ! 'comment' can be used for logging purposes
12
13     SUBROUTINE plugin_read_paramr(name, defval, val, comment)
14       CHARACTER(*), INTENT(IN) :: name, comment
15       REAL, INTENT(IN)         :: defval
16       REAL, INTENT(OUT)        :: val
17     END SUBROUTINE plugin_read_paramr
18
19     SUBROUTINE plugin_read_parami(name, defval, val, comment)
20       CHARACTER(*), INTENT(IN) :: name, comment
21       INTEGER, INTENT(IN)      :: defval
22       INTEGER, INTENT(OUT)     :: val
23     END SUBROUTINE plugin_read_parami
24
25     SUBROUTINE plugin_read_paramb(name, defval, val, comment)
26       CHARACTER(*), INTENT(IN) :: name, comment
27       LOGICAL, INTENT(IN)      :: defval
28       LOGICAL, INTENT(OUT)     :: val
29     END SUBROUTINE plugin_read_paramb
30
31  END INTERFACE
32
33  PROCEDURE(plugin_read_paramr), POINTER :: read_paramr_plugin => read_paramr_unset
34  PROCEDURE(plugin_read_parami), POINTER :: read_parami_plugin => read_parami_unset
35  PROCEDURE(plugin_read_paramb), POINTER :: read_paramb_plugin => read_paramb_unset
36
37  INTERFACE read_param
38     PROCEDURE read_paramr_plugin, read_parami_plugin, read_paramb_plugin
39  END INTERFACE read_param
40
41  PUBLIC :: read_param, read_paramr_plugin, read_parami_plugin, read_paramb_plugin
42
43CONTAINS
44
45  SUBROUTINE abort_unset(name)
46    CHARACTER(*), INTENT(IN) :: name
47    PRINT *, 'FATAL : plugin ', name, ' not provided by the driver program'
48    PRINT *, '        see read_param_mod'
49    STOP
50  END SUBROUTINE abort_unset
51
52  SUBROUTINE read_paramr_unset(name, defval, val, comment)
53    CHARACTER(*), INTENT(IN) :: name, comment
54    REAL, INTENT(IN)         :: defval
55    REAL, INTENT(OUT)        :: val
56    CALL abort_unset('read_paramr')
57  END SUBROUTINE read_paramr_unset
58
59  SUBROUTINE read_parami_unset(name, defval, val, comment)
60    CHARACTER(*), INTENT(IN) :: name, comment
61    INTEGER, INTENT(IN)      :: defval
62    INTEGER, INTENT(OUT)     :: val
63    CALL abort_unset('read_parami')
64  END SUBROUTINE read_parami_unset
65 
66  SUBROUTINE read_paramb_unset(name, defval, val, comment)
67    CHARACTER(*), INTENT(IN) :: name, comment
68    LOGICAL, INTENT(IN)      :: defval
69    LOGICAL, INTENT(OUT)     :: val
70    CALL abort_unset('read_paramb')
71  END SUBROUTINE read_paramb_unset
72 
73END MODULE read_param_mod
Note: See TracBrowser for help on using the repository browser.