Changeset 3047 for trunk/LMDZ.COMMON/libf
- Timestamp:
- Sep 21, 2023, 11:56:12 AM (21 months ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/LMDZ.COMMON/libf/evolution/orbit_param_criterion_mod.F90 ¶
r3040 r3047 52 52 integer :: max_obl_iter, max_ecc_iter, max_lsp_iter ! Maximum year iteration before reaching an inadmissible value of orbit param 53 53 integer :: ilask, iylask ! Loop variables 54 real :: xa, xb, ya, yb, yc_obl, yc_ecc, yc_lsp ! Variables for interpolation 54 real :: xa, xb, ya, yb ! Variables for interpolation 55 logical :: found_obl, found_ecc, found_lsp ! Flag variables for orbital parameters 56 logical :: crossed_modulo_d, crossed_modulo_i ! Flag variables for modulo of Lsp 55 57 56 58 ! ********************************************************************** … … 69 71 ! We read the file 70 72 open(73,file = 'obl_ecc_lsp.asc') 73 last_ilask = 0 71 74 do ilask = 1,size(yearlask,1) 72 75 read(73,*) yearlask(ilask), obllask(ilask), ecclask(ilask), lsplask(ilask) … … 75 78 enddo 76 79 close(73) 77 write(*,*) 'Corresponding line in the obl_ecc_lsp.asc file =', last_ilask 80 if (last_ilask == 0 .or. last_ilask == size(yearlask,1) + 1) then 81 write(*,*) 'The current year could not be find in the file "obl_ecc_lsp.asc".' 82 stop 83 else 84 write(*,*) 'The current year in the "obl_ecc_lsp.asc" file is at line:', last_ilask 85 endif 78 86 79 87 ! Constant max change case … … 82 90 max_change_lsp = 18. 83 91 84 call getin('max_change_obl', 92 call getin('max_change_obl',max_change_obl) 85 93 max_obl = obliquit + max_change_obl 86 94 min_obl = obliquit - max_change_obl … … 88 96 write(*,*) 'Minimum obliquity accepted =', min_obl 89 97 90 call getin('max_change_ecc', 98 call getin('max_change_ecc',max_change_ecc) 91 99 max_ecc = min(e_elips + max_change_ecc,1. - 1.e-10) ! ex < 1. 92 100 min_ecc = max(e_elips - max_change_ecc,0.) ! ex >= 0. … … 94 102 write(*,*) 'Minimum eccentricity accepted =', min_ecc 95 103 96 call getin('max_change_lsp', 104 call getin('max_change_lsp',max_change_lsp) 97 105 max_lsp = Lsp + max_change_lsp 98 106 min_lsp = Lsp - max_change_lsp … … 107 115 max_lsp_iter = 1000000 108 116 109 ! Tendency of the orbital parameter for the considered year gives the limitation between min and max 117 ! The maximum reachable year is found by interpolation according to the maximum admissible change of orbital parameters 118 found_obl = .false. 119 found_ecc = .false. 120 found_lsp = .false. 121 if (.not. var_obl) found_obl = .true. 122 if (.not. var_ecc) found_ecc = .true. 123 if (.not. var_lsp) found_lsp = .true. 124 crossed_modulo_d = .false. 125 crossed_modulo_i = .false. 126 110 127 do ilask = last_ilask,2,-1 111 128 xa = yearlask(ilask) 112 129 xb = yearlask(ilask - 1) 113 if (xa <= Year .and. Year < xb) then 114 ! Obliquity 115 if (var_obl) then 116 ya = obllask(ilask) 117 yb = obllask(ilask - 1) 118 if (ya < yb) then ! Increasing -> max is the limitation 119 yc_obl = max_obl 120 else ! Decreasing -> min is the limitation 121 yc_obl = min_obl 122 endif 123 endif 124 125 ! Eccentricity 126 if (var_ecc) then 127 ya = ecclask(ilask) 128 yb = ecclask(ilask - 1) 129 if (ya < yb) then ! Increasing -> max is the limitation 130 yc_ecc = max_ecc 131 else ! Decreasing -> min is the limitation 132 yc_ecc = min_ecc 133 endif 134 endif 135 136 ! Lsp 137 if (var_lsp) then 138 ya = lsplask(ilask) 139 yb = lsplask(ilask - 1) 140 if (ya < yb) then ! Increasing -> max is the limitation 141 if (yb - ya > 300.) then ! If modulo is "crossed" then it is the other way around 142 yc_lsp = min_lsp 130 131 ! Obliquity 132 if (var_obl .and. .not. found_obl) then 133 ya = obllask(ilask) 134 yb = obllask(ilask - 1) 135 if (yb < min_obl) then ! The minimum accepted is overtaken 136 max_obl_iter = floor((min_obl - ya)*(xb - xa)/(yb - ya) + xa) - Year 137 found_obl = .true. 138 else if (max_obl < yb) then ! The maximum accepted is overtaken 139 max_obl_iter = floor((max_obl - ya)*(xb - xa)/(yb - ya) + xa) - Year 140 found_obl = .true. 141 endif 142 endif 143 144 ! Eccentricity 145 if (var_ecc .and. .not. found_ecc) then 146 ya = ecclask(ilask) 147 yb = ecclask(ilask - 1) 148 if (yb < min_ecc) then ! The minimum accepted is overtaken 149 max_ecc_iter = floor((min_ecc - ya)*(xb - xa)/(yb - ya) + xa) - Year 150 found_ecc = .true. 151 else if (max_ecc < yb) then ! The maximum accepted is overtaken 152 max_ecc_iter = floor((max_ecc - ya)*(xb - xa)/(yb - ya) + xa) - Year 153 found_ecc = .true. 154 endif 155 endif 156 157 ! Lsp 158 if (var_lsp .and. .not. found_lsp) then 159 ya = lsplask(ilask) 160 yb = lsplask(ilask - 1) 161 if (abs(yb - ya) > 300.) then ! If modulo is "crossed" through the interval 162 if (ya < yb) then ! Lsp should be decreasing 163 if (.not. crossed_modulo_i) then 164 yb = yb - 360. 165 if (min_lsp < 0.) crossed_modulo_d = .true. 143 166 else 144 yc_lsp = max_lsp167 crossed_modulo_i = .false. 145 168 endif 146 else ! Decreasing -> min is the limitation 147 if (ya - yb > 300.) then ! If modulo is "crossed" then it is the other way around 148 yc_lsp = max_lsp 169 else ! Lsp should be increasing 170 if (.not. crossed_modulo_d) then 171 yb = yb + 360. 172 if (max_lsp > 360.) crossed_modulo_i = .true. 149 173 else 150 yc_lsp = min_lsp174 crossed_modulo_d = .false. 151 175 endif 152 176 endif 153 endif 154 iylask = ilask 155 exit ! The loop is left as soon as the right interval is found 177 else 178 if (crossed_modulo_d) then ! If decreasing Lsp "crossed" the modulo but min_lsp has not been met yet 179 ya = ya - 360. 180 yb = yb - 360. 181 else if (crossed_modulo_i) then ! If increasing Lsp "crossed" the modulo but max_lsp has not been met yet 182 ya = ya + 360. 183 yb = yb + 360. 184 endif 185 endif 186 if (yb < min_lsp) then ! The minimum accepted is overtaken 187 max_lsp_iter = floor((min_lsp - ya)*(xb - xa)/(yb - ya) + xa) - Year 188 found_lsp = .true. 189 else if (max_lsp < yb) then ! The maximum accepted is overtaken 190 max_lsp_iter = floor((max_lsp - ya)*(xb - xa)/(yb - ya) + xa) - Year 191 found_lsp = .true. 192 endif 156 193 endif 194 195 if (found_obl .and. found_ecc .and. found_lsp) exit ! The loop is left as soon as everything is found 157 196 enddo 158 197 159 if (ilask == 1) then 160 write(*,*) 'The year does not match with Laskar data in the file obl_ecc_lsp.asc.' 161 stop 162 endif 163 164 ! Linear interpolation gives the maximum reachable year according to the limitation 165 ! Obliquity 166 if (var_obl) then 167 do ilask = iylask,2,-1 168 ya = obllask(ilask) 169 yb = obllask(ilask - 1) 170 if (min(ya,yb) <= yc_obl .and. yc_obl < max(ya,yb)) then 171 xa = yearlask(ilask) 172 xb = yearlask(ilask - 1) 173 max_obl_iter = floor((yc_obl - ya)*(xb - xa)/(yb - ya) + xa) - Year 174 exit ! The loop is left as soon as the right interval is found 175 endif 176 enddo 177 endif 178 ! Eccentricity 179 if (var_ecc) then 180 do ilask = iylask,2,-1 181 ya = ecclask(ilask) 182 yb = ecclask(ilask - 1) 183 if (min(ya,yb) <= yc_ecc .and. yc_ecc < max(ya,yb)) then 184 xa = yearlask(ilask) 185 xb = yearlask(ilask - 1) 186 max_ecc_iter = floor((yc_ecc - ya)*(xb - xa)/(yb - ya) + xa) - Year 187 exit ! The loop is left as soon as the right interval is found 188 endif 189 enddo 190 endif 191 ! Lsp 192 if (var_lsp) then 193 do ilask = iylask,2,-1 194 ya = lsplask(ilask) 195 yb = lsplask(ilask - 1) 196 if (min(ya,yb) <= yc_lsp .and. yc_lsp < max(ya,yb)) then 197 xa = yearlask(ilask) 198 xb = yearlask(ilask - 1) 199 max_lsp_iter = floor((yc_lsp - ya)*(xb - xa)/(yb - ya) + xa) - Year 200 exit ! The loop is left as soon as the right interval is found 201 endif 202 enddo 203 endif 198 if (.not. found_obl) write(*,*) 'The maximum reachable year for obl. could not be find in the file "obl_ecc_lsp.asc".' 199 if (.not. found_ecc) write(*,*) 'The maximum reachable year for ecc. could not be find in the file "obl_ecc_lsp.asc".' 200 if (.not. found_lsp) write(*,*) 'The maximum reachable year for Lsp could not be find in the file "obl_ecc_lsp.asc".' 204 201 205 202 write(*,*) 'Max. number of iterations for the obl. parameter =', max_obl_iter … … 208 205 209 206 year_iter_max = min(max_obl_iter,max_ecc_iter,max_lsp_iter) 210 if (year_iter_max > 0) then 211 write(*,*) 'So the max. number of iterations for the orbital criteria =', year_iter_max 212 else 213 write(*,*) 'The max. number of iterations is not compatible with Laskar data in the file obl_ecc_lsp.asc.' 214 stop 215 endif 207 write(*,*) 'So the max. number of iterations for the orbital criteria =', year_iter_max 216 208 217 209 END SUBROUTINE orbit_param_criterion -
TabularUnified trunk/LMDZ.COMMON/libf/evolution/recomp_orb_param_mod.F90 ¶
r3040 r3047 44 44 real :: unitastr 45 45 real :: xa, xb, ya, yb ! Variables for interpolation 46 logical :: found_year ! Flag variable 46 47 47 48 ! ********************************************************************** … … 64 65 write(*,*) 'recomp_orb_param, Old Lsp =', Lsp 65 66 67 found_year = .false. 66 68 do ilask = last_ilask,2,-1 67 69 xa = yearlask(ilask) … … 86 88 ya = lsplask(ilask) 87 89 yb = lsplask(ilask - 1) 88 if ( yb - ya > 300.) then ! If modulo is "crossed"89 if (ya < yb) then ! Increasing90 y b = yb -360.91 else ! Decreasing90 if (abs(yb - ya) > 300.) then ! If modulo is "crossed" through the interval 91 if (ya < yb) then ! Lsp should be decreasing 92 ya = ya + 360. 93 else ! Lsp should be increasing 92 94 yb = yb + 360. 93 95 endif 94 96 endif 95 Lsp = (Year - xa)*(yb - ya)/(xb - xa) + ya 96 Lsp = modulo(Lsp,360.) 97 Lsp = modulo((Year - xa)*(yb - ya)/(xb - xa) + ya,360.) 97 98 endif 99 found_year = .true. 98 100 exit ! The loop is left as soon as the right interval is found 99 101 endif 100 102 enddo 103 104 if (.not. found_year) then 105 write(*,*) 'The new year could not be found in the file "obl_ecc_lsp.asc".' 106 stop 107 endif 108 101 109 halfaxe = 227.94 102 110 Lsp = Lsp*pi/180.
Note: See TracChangeset
for help on using the changeset viewer.