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 | |
---|
68 | found_year = .false. |
---|
69 | do ilask = last_ilask,2,-1 |
---|
70 | xa = yearlask(ilask) |
---|
71 | xb = yearlask(ilask - 1) |
---|
72 | if (xa <= Year .and. Year < xb) then |
---|
73 | ! Obliquity |
---|
74 | if (var_obl) then |
---|
75 | ya = obllask(ilask) |
---|
76 | yb = obllask(ilask - 1) |
---|
77 | obliquit = (Year - xa)*(yb - ya)/(xb - xa) + ya |
---|
78 | endif |
---|
79 | |
---|
80 | ! Eccentricity |
---|
81 | if (var_ecc) then |
---|
82 | ya = ecclask(ilask) |
---|
83 | yb = ecclask(ilask - 1) |
---|
84 | e_elips = (Year - xa)*(yb - ya)/(xb - xa) + ya |
---|
85 | endif |
---|
86 | |
---|
87 | ! Lsp |
---|
88 | if (var_lsp) then |
---|
89 | ya = lsplask(ilask) |
---|
90 | yb = lsplask(ilask - 1) |
---|
91 | if (abs(yb - ya) > 300.) then ! If modulo is "crossed" through the interval |
---|
92 | if (ya < yb) then ! Lsp should be decreasing |
---|
93 | ya = ya + 360. |
---|
94 | else ! Lsp should be increasing |
---|
95 | yb = yb + 360. |
---|
96 | endif |
---|
97 | endif |
---|
98 | Lsp = modulo((Year - xa)*(yb - ya)/(xb - xa) + ya,360.) |
---|
99 | endif |
---|
100 | found_year = .true. |
---|
101 | exit ! The loop is left as soon as the right interval is found |
---|
102 | endif |
---|
103 | enddo |
---|
104 | |
---|
105 | if (.not. found_year) error stop 'The new year could not be found in the file "obl_ecc_lsp.asc".' |
---|
106 | |
---|
107 | halfaxe = 227.94 |
---|
108 | Lsp = Lsp*pi/180. |
---|
109 | periheli = halfaxe*(1 - e_elips) |
---|
110 | aphelie = halfaxe*(1 + e_elips) |
---|
111 | unitastr = 149.597927 |
---|
112 | p_elips = 0.5*(periheli + aphelie)*(1. - e_elips*e_elips)/unitastr |
---|
113 | |
---|
114 | #ifndef CPP_STD |
---|
115 | call call_dayperi(Lsp,e_elips,peri_day,year_day) |
---|
116 | #endif |
---|
117 | |
---|
118 | write(*,*) 'recomp_orb_param, New year =', Year |
---|
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 | |
---|