source: trunk/LMDZ.COMMON/libf/evolution/tracers.F90 @ 4011

Last change on this file since 4011 was 3991, checked in by jbclement, 2 months ago

PEM:
Apply documentation template everywhere: standardized headers format with short description, separators between functions/subroutines, normalized code sections, aligned dependencies/arguments/variables declaration.
JBC

File size: 3.0 KB
RevLine 
[3984]1MODULE tracers
[3991]2!-----------------------------------------------------------------------
3! NAME
4!     tracers
5!
6! DESCRIPTION
7!     Tracer species management for tracking.
8!
9! AUTHORS & DATE
10!     JB Clement, 12/2025
11!
12! NOTES
13!
14!-----------------------------------------------------------------------
[3984]15
[3991]16! DECLARATION
17! -----------
[3984]18implicit none
19
[3991]20! MODULE VARIABLES
21! ----------------
22integer                         :: iPCM_qh2o ! Index for H2O vapor tracer from PCM
23real, dimension(:), allocatable :: mmol      ! Molar masses of tracers [g/mol]
[3984]24
25contains
[3991]26!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[3984]27
[3989]28!=======================================================================
[3984]29SUBROUTINE ini_tracers_id(nqtot,noms)
[3991]30!-----------------------------------------------------------------------
31! NAME
32!     ini_tracers_id
33!
34! DESCRIPTION
35!     Initialize tracer indices from PCM tracer names.
36!
37! AUTHORS & DATE
38!     JB Clement, 12/2025
39!
40! NOTES
41!
42!-----------------------------------------------------------------------
[3984]43
[3991]44! DECLARATION
45! -----------
[3984]46implicit none
47
[3991]48! ARGUMENTS
49! ---------
50integer,                        intent(in) :: nqtot ! Total number of tracers
51character(*), dimension(nqtot), intent(in) :: noms  ! Names of tracers
[3984]52
[3991]53! LOCAL VARIABLES
54! ---------------
[3984]55integer :: i
56
[3991]57! CODE
58! ----
[3985]59! Allocation
60call ini_tracers(nqtot)
61
[3984]62! Initialization
63iPCM_qh2o = -1
64
65! Getting the index
66do i = 1,nqtot
[3985]67    if (noms(i) == "h2o_vap") then
68        iPCM_qh2o = i
69        mmol(i) = 18.
[3984]70    endif
71enddo
72
73! Checking if everything has been found
74if (iPCM_qh2o < 0) error stop 'ini_frost_id: H2O vapour index not found!'
75
[3985]76END SUBROUTINE ini_tracers_id
77!=======================================================================
[3984]78
[3989]79!=======================================================================
[3985]80SUBROUTINE ini_tracers(nqtot)
[3991]81!-----------------------------------------------------------------------
82! NAME
83!     ini_tracers
84!
85! DESCRIPTION
86!     Allocate tracer molar mass array.
87!
88! AUTHORS & DATE
89!     JB Clement, 12/2025
90!
91! NOTES
92!
93!-----------------------------------------------------------------------
[3985]94
[3991]95! DECLARATION
96! -----------
[3985]97implicit none
98
[3991]99! ARGUMENTS
100! ---------
101integer, intent(in) :: nqtot ! Total number of tracers
[3985]102
[3991]103! CODE
104! ----
[3985]105if (.not. allocated(mmol)) allocate(mmol(nqtot))
106
107END SUBROUTINE ini_tracers
108!=======================================================================
109
[3989]110!=======================================================================
[3985]111SUBROUTINE end_tracers()
[3991]112!-----------------------------------------------------------------------
113! NAME
114!     end_tracers
115!
116! DESCRIPTION
117!     Deallocate tracer molar mass array.
118!
119! AUTHORS & DATE
120!     JB Clement, 12/2025
121!
122! NOTES
123!
124!-----------------------------------------------------------------------
[3985]125
[3991]126! DECLARATION
127! -----------
[3985]128implicit none
129
[3991]130! CODE
131! ----
[3985]132if (allocated(mmol)) deallocate(mmol)
133
134END SUBROUTINE end_tracers
[3989]135!=======================================================================
[3985]136
[3984]137END MODULE tracers
Note: See TracBrowser for help on using the repository browser.