MAIC-2  Revision 19
 All Classes Files Functions Variables
get_psi_tab.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Subroutine : g e t _ p s i _ t a b
4 !
5 !> @file
6 !!
7 !! Computation of the table of true anomalies (orbital positions
8 !! with respect to perihelion) over a Martian year.
9 !!
10 !! @section Copyright
11 !!
12 !! Copyright 2010-2013 Ralf Greve, Bjoern Grieger, Oliver J. Stenzel
13 !!
14 !! @section License
15 !!
16 !! This file is part of MAIC-2.
17 !!
18 !! MAIC-2 is free software: you can redistribute it and/or modify
19 !! it under the terms of the GNU General Public License as published by
20 !! the Free Software Foundation, either version 3 of the License, or
21 !! (at your option) any later version.
22 !!
23 !! MAIC-2 is distributed in the hope that it will be useful,
24 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
25 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 !! GNU General Public License for more details.
27 !!
28 !! You should have received a copy of the GNU General Public License
29 !! along with MAIC-2. If not, see <http://www.gnu.org/licenses/>.
30 !<
31 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
32 
33 !-------------------------------------------------------------------------------
34 !> Computation of the table of true anomalies (orbital positions
35 !! with respect to perihelion) over a Martian year.
36 !<------------------------------------------------------------------------------
37 subroutine get_psi_tab(ecc, ave)
38 
39 use maic2_types
41 
42 implicit none
43 
44 real(dp), intent(in) :: ecc, ave
45 
46 integer(i4b) :: iter, n
47 real(dp) :: dtime_psi, factor, misfit
48 
49 dtime_psi = mars_year / real(ntime,dp)
50 factor = 2.0_dp*pi / mars_year
51 
52 ls_tab(0) = 0 ! corresponds to the vernal equinox
53 
54 !-------- Iteration loop --------
55 
56 do iter=1, 5
57 
58 ! ------ Integration over one Martian year
59 
60  do n=0, ntime-1
61  ls_tab(n+1) = ls_tab(n) &
62  + dtime_psi*factor*(1.0_dp+ecc*cos(ls_tab(n)+ave))**2
63  end do
64 
65 ! ------ Adjustment of the factor in order to get the orbit closed
66 
67  misfit = 2.0_dp*pi/ls_tab(ntime)
68  factor = factor*misfit
69 
70 end do
71 
72 !-------- Final scaling --------
73 
74 if ((misfit > 0.99_dp).and.(misfit < 1.01_dp)) then
75  ls_tab = ls_tab*misfit
76 else
77  stop ' Subroutine get_psi_tab: Bad convergence of ls_tab!'
78 end if
79 
80 psi_tab = ls_tab + ave ! not normalized to the interval [0, 2*pi)
81 
82 end subroutine get_psi_tab
83 !