| 1 | MODULE 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 | ! ----------- |
|---|
| 18 | implicit none |
|---|
| 19 | |
|---|
| 20 | ! MODULE VARIABLES |
|---|
| 21 | ! ---------------- |
|---|
| 22 | integer :: iPCM_qh2o ! Index for H2O vapor tracer from PCM |
|---|
| 23 | real, dimension(:), allocatable :: mmol ! Molar masses of tracers [g/mol] |
|---|
| 24 | |
|---|
| 25 | contains |
|---|
| 26 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|---|
| 27 | |
|---|
| 28 | !======================================================================= |
|---|
| 29 | SUBROUTINE 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 | ! ----------- |
|---|
| 46 | implicit none |
|---|
| 47 | |
|---|
| 48 | ! ARGUMENTS |
|---|
| 49 | ! --------- |
|---|
| 50 | integer, intent(in) :: nqtot ! Total number of tracers |
|---|
| 51 | character(*), dimension(nqtot), intent(in) :: noms ! Names of tracers |
|---|
| 52 | |
|---|
| 53 | ! LOCAL VARIABLES |
|---|
| 54 | ! --------------- |
|---|
| 55 | integer :: i |
|---|
| 56 | |
|---|
| 57 | ! CODE |
|---|
| 58 | ! ---- |
|---|
| 59 | ! Allocation |
|---|
| 60 | call ini_tracers(nqtot) |
|---|
| 61 | |
|---|
| 62 | ! Initialization |
|---|
| 63 | iPCM_qh2o = -1 |
|---|
| 64 | |
|---|
| 65 | ! Getting the index |
|---|
| 66 | do i = 1,nqtot |
|---|
| 67 | if (noms(i) == "h2o_vap") then |
|---|
| 68 | iPCM_qh2o = i |
|---|
| 69 | mmol(i) = 18. |
|---|
| 70 | endif |
|---|
| 71 | enddo |
|---|
| 72 | |
|---|
| 73 | ! Checking if everything has been found |
|---|
| 74 | if (iPCM_qh2o < 0) error stop 'ini_frost_id: H2O vapour index not found!' |
|---|
| 75 | |
|---|
| 76 | END SUBROUTINE ini_tracers_id |
|---|
| 77 | !======================================================================= |
|---|
| 78 | |
|---|
| 79 | !======================================================================= |
|---|
| 80 | SUBROUTINE 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 | ! ----------- |
|---|
| 97 | implicit none |
|---|
| 98 | |
|---|
| 99 | ! ARGUMENTS |
|---|
| 100 | ! --------- |
|---|
| 101 | integer, intent(in) :: nqtot ! Total number of tracers |
|---|
| 102 | |
|---|
| 103 | ! CODE |
|---|
| 104 | ! ---- |
|---|
| 105 | if (.not. allocated(mmol)) allocate(mmol(nqtot)) |
|---|
| 106 | |
|---|
| 107 | END SUBROUTINE ini_tracers |
|---|
| 108 | !======================================================================= |
|---|
| 109 | |
|---|
| 110 | !======================================================================= |
|---|
| 111 | SUBROUTINE 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 | ! ----------- |
|---|
| 128 | implicit none |
|---|
| 129 | |
|---|
| 130 | ! CODE |
|---|
| 131 | ! ---- |
|---|
| 132 | if (allocated(mmol)) deallocate(mmol) |
|---|
| 133 | |
|---|
| 134 | END SUBROUTINE end_tracers |
|---|
| 135 | !======================================================================= |
|---|
| 136 | |
|---|
| 137 | END MODULE tracers |
|---|