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

Last change on this file since 3995 was 3991, checked in by jbclement, 4 weeks 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
Line 
1MODULE tracers
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!-----------------------------------------------------------------------
15
16! DECLARATION
17! -----------
18implicit none
19
20! MODULE VARIABLES
21! ----------------
22integer                         :: iPCM_qh2o ! Index for H2O vapor tracer from PCM
23real, dimension(:), allocatable :: mmol      ! Molar masses of tracers [g/mol]
24
25contains
26!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
27
28!=======================================================================
29SUBROUTINE ini_tracers_id(nqtot,noms)
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!-----------------------------------------------------------------------
43
44! DECLARATION
45! -----------
46implicit none
47
48! ARGUMENTS
49! ---------
50integer,                        intent(in) :: nqtot ! Total number of tracers
51character(*), dimension(nqtot), intent(in) :: noms  ! Names of tracers
52
53! LOCAL VARIABLES
54! ---------------
55integer :: i
56
57! CODE
58! ----
59! Allocation
60call ini_tracers(nqtot)
61
62! Initialization
63iPCM_qh2o = -1
64
65! Getting the index
66do i = 1,nqtot
67    if (noms(i) == "h2o_vap") then
68        iPCM_qh2o = i
69        mmol(i) = 18.
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
76END SUBROUTINE ini_tracers_id
77!=======================================================================
78
79!=======================================================================
80SUBROUTINE ini_tracers(nqtot)
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!-----------------------------------------------------------------------
94
95! DECLARATION
96! -----------
97implicit none
98
99! ARGUMENTS
100! ---------
101integer, intent(in) :: nqtot ! Total number of tracers
102
103! CODE
104! ----
105if (.not. allocated(mmol)) allocate(mmol(nqtot))
106
107END SUBROUTINE ini_tracers
108!=======================================================================
109
110!=======================================================================
111SUBROUTINE end_tracers()
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!-----------------------------------------------------------------------
125
126! DECLARATION
127! -----------
128implicit none
129
130! CODE
131! ----
132if (allocated(mmol)) deallocate(mmol)
133
134END SUBROUTINE end_tracers
135!=======================================================================
136
137END MODULE tracers
Note: See TracBrowser for help on using the repository browser.