1 | MODULE recomp_orb_param_mod |
---|
2 | !======================================================================= |
---|
3 | ! |
---|
4 | ! Purpose: Recompute orbit parameters based on values by Laskar et al., |
---|
5 | ! |
---|
6 | ! Author: RV, JBC |
---|
7 | !======================================================================= |
---|
8 | |
---|
9 | implicit none |
---|
10 | |
---|
11 | !======================================================================= |
---|
12 | contains |
---|
13 | !======================================================================= |
---|
14 | |
---|
15 | SUBROUTINE recomp_orb_param(i_myear,i_myear_leg) |
---|
16 | |
---|
17 | use time_evol_mod, only: year_bp_ini, var_obl, var_ecc, var_lsp |
---|
18 | use lask_param_mod, only: yearlask, obllask, ecclask, lsplask, end_lask_param_mod, last_ilask |
---|
19 | #ifndef CPP_STD |
---|
20 | use comcstfi_h, only: pi |
---|
21 | use planete_h, only: e_elips, obliquit, lsperi, periheli, aphelie, p_elips, peri_day, year_day |
---|
22 | #else |
---|
23 | use comcstfi_mod, only: pi |
---|
24 | use planete_mod, only: e_elips, obliquit, lsperi, periastr, apoastr, p_elips, peri_day, year_day |
---|
25 | #endif |
---|
26 | |
---|
27 | implicit none |
---|
28 | |
---|
29 | !-------------------------------------------------------- |
---|
30 | ! Input Variables |
---|
31 | !-------------------------------------------------------- |
---|
32 | real, intent(in) :: i_myear ! Number of simulated Martian years |
---|
33 | real, intent(in) :: i_myear_leg ! Number of iterations of the PEM |
---|
34 | |
---|
35 | !-------------------------------------------------------- |
---|
36 | ! Output Variables |
---|
37 | !-------------------------------------------------------- |
---|
38 | |
---|
39 | !-------------------------------------------------------- |
---|
40 | ! Local variables |
---|
41 | !-------------------------------------------------------- |
---|
42 | real :: Year ! Year of the simulation |
---|
43 | real :: Lsp ! Ls perihelion |
---|
44 | integer :: ilask ! Loop variable |
---|
45 | real :: halfaxe ! Million of km |
---|
46 | real :: unitastr |
---|
47 | real :: xa, xb, ya, yb ! Variables for interpolation |
---|
48 | logical :: found_year ! Flag variable |
---|
49 | |
---|
50 | ! ********************************************************************** |
---|
51 | ! 0. Initializations |
---|
52 | ! ********************************************************************** |
---|
53 | #ifdef CPP_STD |
---|
54 | real :: aphelie, periheli |
---|
55 | |
---|
56 | aphelie = apoastr |
---|
57 | periheli = periastr |
---|
58 | #endif |
---|
59 | |
---|
60 | Year = year_bp_ini + i_myear ! We compute the current year |
---|
61 | Lsp = lsperi*180./pi ! We convert in degree |
---|
62 | |
---|
63 | write(*,*) 'recomp_orb_param, Old year =', Year - i_myear_leg |
---|
64 | write(*,*) 'recomp_orb_param, Old obl. =', obliquit |
---|
65 | write(*,*) 'recomp_orb_param, Old ecc. =', e_elips |
---|
66 | write(*,*) 'recomp_orb_param, Old Lsp =', Lsp |
---|
67 | write(*,*) 'recomp_orb_param, New year =', Year |
---|
68 | |
---|
69 | found_year = .false. |
---|
70 | do ilask = last_ilask,2,-1 |
---|
71 | xa = yearlask(ilask) |
---|
72 | xb = yearlask(ilask - 1) |
---|
73 | if (xa <= Year .and. Year < xb) then |
---|
74 | ! Obliquity |
---|
75 | if (var_obl) then |
---|
76 | ya = obllask(ilask) |
---|
77 | yb = obllask(ilask - 1) |
---|
78 | obliquit = (Year - xa)*(yb - ya)/(xb - xa) + ya |
---|
79 | endif |
---|
80 | |
---|
81 | ! Eccentricity |
---|
82 | if (var_ecc) then |
---|
83 | ya = ecclask(ilask) |
---|
84 | yb = ecclask(ilask - 1) |
---|
85 | e_elips = (Year - xa)*(yb - ya)/(xb - xa) + ya |
---|
86 | endif |
---|
87 | |
---|
88 | ! Lsp |
---|
89 | if (var_lsp) then |
---|
90 | ya = lsplask(ilask) |
---|
91 | yb = lsplask(ilask - 1) |
---|
92 | if (abs(yb - ya) > 300.) then ! If modulo is "crossed" through the interval |
---|
93 | if (ya < yb) then ! Lsp should be decreasing |
---|
94 | ya = ya + 360. |
---|
95 | else ! Lsp should be increasing |
---|
96 | yb = yb + 360. |
---|
97 | endif |
---|
98 | endif |
---|
99 | Lsp = modulo((Year - xa)*(yb - ya)/(xb - xa) + ya,360.) |
---|
100 | endif |
---|
101 | found_year = .true. |
---|
102 | exit ! The loop is left as soon as the right interval is found |
---|
103 | endif |
---|
104 | enddo |
---|
105 | |
---|
106 | if (.not. found_year) error stop 'The new year could not be found in the file "obl_ecc_lsp.asc".' |
---|
107 | |
---|
108 | halfaxe = 227.94 |
---|
109 | Lsp = Lsp*pi/180. |
---|
110 | periheli = halfaxe*(1 - e_elips) |
---|
111 | aphelie = halfaxe*(1 + e_elips) |
---|
112 | unitastr = 149.597927 |
---|
113 | p_elips = 0.5*(periheli + aphelie)*(1. - e_elips*e_elips)/unitastr |
---|
114 | |
---|
115 | #ifndef CPP_STD |
---|
116 | call call_dayperi(Lsp,e_elips,peri_day,year_day) |
---|
117 | #endif |
---|
118 | |
---|
119 | write(*,*) 'recomp_orb_param, New obl. =', obliquit |
---|
120 | write(*,*) 'recomp_orb_param, New ecc. =', e_elips |
---|
121 | write(*,*) 'recomp_orb_param, New Lsp =', Lsp |
---|
122 | |
---|
123 | END SUBROUTINE recomp_orb_param |
---|
124 | |
---|
125 | !******************************************************************************** |
---|
126 | |
---|
127 | END MODULE recomp_orb_param_mod |
---|
128 | |
---|