| 1 | MODULE slopes |
|---|
| 2 | !----------------------------------------------------------------------- |
|---|
| 3 | ! NAME |
|---|
| 4 | ! slopes |
|---|
| 5 | ! |
|---|
| 6 | ! DESCRIPTION |
|---|
| 7 | ! Contains global parameters used for the slopes. |
|---|
| 8 | ! |
|---|
| 9 | ! AUTHORS & DATE |
|---|
| 10 | ! JB Clement, 12/2025 |
|---|
| 11 | ! |
|---|
| 12 | ! NOTES |
|---|
| 13 | ! |
|---|
| 14 | !----------------------------------------------------------------------- |
|---|
| 15 | |
|---|
| 16 | ! DEPENDENCIES |
|---|
| 17 | ! ------------ |
|---|
| 18 | use numerics, only: dp, di |
|---|
| 19 | |
|---|
| 20 | ! DECLARATION |
|---|
| 21 | ! ----------- |
|---|
| 22 | implicit none |
|---|
| 23 | |
|---|
| 24 | ! PARAMETERS |
|---|
| 25 | ! ---------- |
|---|
| 26 | real(dp), dimension(:), allocatable, protected :: def_slope_mean ! Mean slople of each bin [degree] |
|---|
| 27 | real(dp), dimension(:,:), allocatable, protected :: subslope_dist ! Distribution of the slopes |
|---|
| 28 | integer(di), protected :: iflat ! Index of the flat slope |
|---|
| 29 | |
|---|
| 30 | contains |
|---|
| 31 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|---|
| 32 | |
|---|
| 33 | !======================================================================= |
|---|
| 34 | SUBROUTINE ini_slopes() |
|---|
| 35 | !----------------------------------------------------------------------- |
|---|
| 36 | ! NAME |
|---|
| 37 | ! ini_slopes |
|---|
| 38 | ! |
|---|
| 39 | ! DESCRIPTION |
|---|
| 40 | ! Initialize the parameters of module 'slopes'. |
|---|
| 41 | ! |
|---|
| 42 | ! AUTHORS & DATE |
|---|
| 43 | ! JB Clement, 12/2025 |
|---|
| 44 | ! |
|---|
| 45 | ! NOTES |
|---|
| 46 | ! |
|---|
| 47 | !----------------------------------------------------------------------- |
|---|
| 48 | |
|---|
| 49 | ! DEPENDENCIES |
|---|
| 50 | ! ------------ |
|---|
| 51 | use geometry, only: nslope, ngrid |
|---|
| 52 | |
|---|
| 53 | ! DECLARATION |
|---|
| 54 | ! ----------- |
|---|
| 55 | implicit none |
|---|
| 56 | |
|---|
| 57 | ! CODE |
|---|
| 58 | ! ---- |
|---|
| 59 | if (.not. allocated(def_slope_mean)) allocate(def_slope_mean(nslope)) |
|---|
| 60 | if (.not. allocated(subslope_dist)) allocate(subslope_dist(ngrid,nslope)) |
|---|
| 61 | def_slope_mean(:) = 0._dp |
|---|
| 62 | subslope_dist(:,:) = 1._dp |
|---|
| 63 | |
|---|
| 64 | END SUBROUTINE ini_slopes |
|---|
| 65 | !======================================================================= |
|---|
| 66 | |
|---|
| 67 | !======================================================================= |
|---|
| 68 | SUBROUTINE end_slopes() |
|---|
| 69 | !----------------------------------------------------------------------- |
|---|
| 70 | ! NAME |
|---|
| 71 | ! end_slopes |
|---|
| 72 | ! |
|---|
| 73 | ! DESCRIPTION |
|---|
| 74 | ! Deallocate slopes arrays. |
|---|
| 75 | ! |
|---|
| 76 | ! AUTHORS & DATE |
|---|
| 77 | ! JB Clement, 12/2025 |
|---|
| 78 | ! |
|---|
| 79 | ! NOTES |
|---|
| 80 | ! |
|---|
| 81 | !----------------------------------------------------------------------- |
|---|
| 82 | |
|---|
| 83 | ! DECLARATION |
|---|
| 84 | ! ----------- |
|---|
| 85 | implicit none |
|---|
| 86 | |
|---|
| 87 | ! CODE |
|---|
| 88 | ! ---- |
|---|
| 89 | if (allocated(def_slope_mean)) deallocate(def_slope_mean) |
|---|
| 90 | if (allocated(subslope_dist)) deallocate(subslope_dist) |
|---|
| 91 | |
|---|
| 92 | END SUBROUTINE end_slopes |
|---|
| 93 | !======================================================================= |
|---|
| 94 | |
|---|
| 95 | !======================================================================= |
|---|
| 96 | SUBROUTINE set_def_slope_mean(def_slope_mean_in) |
|---|
| 97 | !----------------------------------------------------------------------- |
|---|
| 98 | ! NAME |
|---|
| 99 | ! set_def_slope_mean |
|---|
| 100 | ! |
|---|
| 101 | ! DESCRIPTION |
|---|
| 102 | ! Setter for 'def_slope_mean'. |
|---|
| 103 | ! |
|---|
| 104 | ! AUTHORS & DATE |
|---|
| 105 | ! JB Clement, 12/2025 |
|---|
| 106 | ! |
|---|
| 107 | ! NOTES |
|---|
| 108 | ! |
|---|
| 109 | !----------------------------------------------------------------------- |
|---|
| 110 | |
|---|
| 111 | ! DECLARATION |
|---|
| 112 | ! ----------- |
|---|
| 113 | implicit none |
|---|
| 114 | |
|---|
| 115 | ! ARGUMENTS |
|---|
| 116 | ! --------- |
|---|
| 117 | real(dp), dimension(:), intent(in) :: def_slope_mean_in |
|---|
| 118 | |
|---|
| 119 | ! CODE |
|---|
| 120 | ! ---- |
|---|
| 121 | def_slope_mean(:) = def_slope_mean_in(:) |
|---|
| 122 | |
|---|
| 123 | END SUBROUTINE set_def_slope_mean |
|---|
| 124 | !======================================================================= |
|---|
| 125 | |
|---|
| 126 | !======================================================================= |
|---|
| 127 | SUBROUTINE set_subslope_dist(subslope_dist_in) |
|---|
| 128 | !----------------------------------------------------------------------- |
|---|
| 129 | ! NAME |
|---|
| 130 | ! set_subslope_dist |
|---|
| 131 | ! |
|---|
| 132 | ! DESCRIPTION |
|---|
| 133 | ! Setter for 'subslope_dist'. |
|---|
| 134 | ! |
|---|
| 135 | ! AUTHORS & DATE |
|---|
| 136 | ! JB Clement, 12/2025 |
|---|
| 137 | ! |
|---|
| 138 | ! NOTES |
|---|
| 139 | ! |
|---|
| 140 | !----------------------------------------------------------------------- |
|---|
| 141 | |
|---|
| 142 | ! DECLARATION |
|---|
| 143 | ! ----------- |
|---|
| 144 | implicit none |
|---|
| 145 | |
|---|
| 146 | ! ARGUMENTS |
|---|
| 147 | ! --------- |
|---|
| 148 | real(dp), dimension(:,:), intent(in) :: subslope_dist_in |
|---|
| 149 | |
|---|
| 150 | ! CODE |
|---|
| 151 | ! ---- |
|---|
| 152 | subslope_dist(:,:) = subslope_dist_in(:,:) |
|---|
| 153 | |
|---|
| 154 | END SUBROUTINE set_subslope_dist |
|---|
| 155 | !======================================================================= |
|---|
| 156 | |
|---|
| 157 | !======================================================================= |
|---|
| 158 | SUBROUTINE set_iflat() |
|---|
| 159 | !----------------------------------------------------------------------- |
|---|
| 160 | ! NAME |
|---|
| 161 | ! set_iflat |
|---|
| 162 | ! |
|---|
| 163 | ! DESCRIPTION |
|---|
| 164 | ! Setter for 'iflat'. |
|---|
| 165 | ! |
|---|
| 166 | ! AUTHORS & DATE |
|---|
| 167 | ! JB Clement, 12/2025 |
|---|
| 168 | ! |
|---|
| 169 | ! NOTES |
|---|
| 170 | ! |
|---|
| 171 | !----------------------------------------------------------------------- |
|---|
| 172 | |
|---|
| 173 | ! DEPENDENCIES |
|---|
| 174 | ! ------------ |
|---|
| 175 | use geometry, only: nslope |
|---|
| 176 | use display, only: print_msg |
|---|
| 177 | use utility, only: int2str, real2str |
|---|
| 178 | |
|---|
| 179 | ! DECLARATION |
|---|
| 180 | ! ----------- |
|---|
| 181 | implicit none |
|---|
| 182 | |
|---|
| 183 | ! LOCAL VARIABLES |
|---|
| 184 | ! --------------- |
|---|
| 185 | integer(di) :: islope |
|---|
| 186 | |
|---|
| 187 | ! CODE |
|---|
| 188 | ! ---- |
|---|
| 189 | iflat = 1 |
|---|
| 190 | do islope = 2,nslope |
|---|
| 191 | if (abs(def_slope_mean(islope)) < abs(def_slope_mean(iflat))) iflat = islope |
|---|
| 192 | end do |
|---|
| 193 | call print_msg('Flat slope for islope = '//int2str(iflat)) |
|---|
| 194 | call print_msg('Corresponding criterium = '//real2str(def_slope_mean(iflat))) |
|---|
| 195 | |
|---|
| 196 | END SUBROUTINE set_iflat |
|---|
| 197 | !======================================================================= |
|---|
| 198 | |
|---|
| 199 | END MODULE slopes |
|---|