38 get_date_julian, set_date_julian, &
41 operator(-),
operator(+), &
42 operator( // ),
operator(<)
44 use constants_mod,
only: constants_init, pi
45 use mpp_mod,
only: input_nml_file
46 use platform_mod,
only: r4_kind, r8_kind, i4_kind, i8_kind
57 #include<file_version.h>
71 module procedure set_orbital_parameters_r4, set_orbital_parameters_r8
75 module procedure get_orbital_parameters_r4, get_orbital_parameters_r8
149 module procedure diurnal_solar_2d_r4, diurnal_solar_2d_r8
150 module procedure diurnal_solar_1d_r4, diurnal_solar_1d_r8
151 module procedure diurnal_solar_0d_r4, diurnal_solar_0d_r8
152 module procedure diurnal_solar_cal_2d_r4, diurnal_solar_cal_2d_r8
153 module procedure diurnal_solar_cal_1d_r4, diurnal_solar_cal_1d_r8
154 module procedure diurnal_solar_cal_0d_r4, diurnal_solar_cal_0d_r8
207 module procedure daily_mean_solar_2d_r4, daily_mean_solar_2d_r8
208 module procedure daily_mean_solar_1d_r4, daily_mean_solar_1d_r8
209 module procedure daily_mean_solar_2level_r4, daily_mean_solar_2level_r8
210 module procedure daily_mean_solar_0d_r4, daily_mean_solar_0d_r8
211 module procedure daily_mean_solar_cal_2d_r4, daily_mean_solar_cal_2d_r8
212 module procedure daily_mean_solar_cal_1d_r4, daily_mean_solar_cal_1d_r8
213 module procedure daily_mean_solar_cal_2level_r4, daily_mean_solar_cal_2level_r8
214 module procedure daily_mean_solar_cal_0d_r4, daily_mean_solar_cal_0d_r8
254 module procedure annual_mean_solar_2d_r4, annual_mean_solar_2d_r8
255 module procedure annual_mean_solar_1d_r4, annual_mean_solar_1d_r8
256 module procedure annual_mean_solar_2level_r4, annual_mean_solar_2level_r8
308 module procedure r_inv_squared_r4, r_inv_squared_r8
312 module procedure angle_r4, angle_r8
316 module procedure declination_r4, declination_r8
343 module procedure half_day_2d_r4, half_day_2d_r8
344 module procedure half_day_0d_r4, half_day_0d_r8
354 real(r8_kind) ::
ecc = 0.01671_r8_kind
355 real(r8_kind) ::
obliq = 23.439_r8_kind
356 real(r8_kind) ::
per = 102.932_r8_kind
401 real(r8_kind),
dimension(:,:),
allocatable :: &
402 cosz_ann, & !< annual mean cos of zenith angle
433 class(*),
dimension(:,:),
intent(in),
optional :: latb
434 class(*),
dimension(:,:),
intent(in),
optional :: lonb
440 integer :: iunit, ierr, io, seconds, days, jd, id
441 character(len=17) :: err_str
459 read (input_nml_file, astronomy_nml, iostat=io)
465 if (
mpp_pe() == mpp_root_pe() )
then
467 write (iunit, nml=astronomy_nml)
473 if (
ecc < 0.0_r8_kind .or.
ecc > 0.99_r8_kind) &
475 'ecc must be between 0 and 0.99', fatal)
476 if (
obliq < -90.0_r8_kind .or.
obliq > 90.0_r8_kind) &
478 'obliquity must be between -90 and 90 degrees', fatal)
479 if (
per < 0.0_r8_kind .or.
per > 360.0_r8_kind) &
481 'perihelion must be between 0 and 360 degrees', fatal)
503 twopi = 2.0_r8_kind * pi
522 if (
present(latb) .and.
present(lonb))
then
524 type is (real(r4_kind))
526 type is (real(r4_kind))
530 call error_mesg(
'astronomy_mod',
'kind mismatch, argument latb is real(r4_kind) but lonb has type: '// &
533 type is (real(r8_kind))
535 type is (real(r8_kind))
539 call error_mesg(
'astronomy_mod',
'kind mismatch, argument latb is real(r8_kind) but lonb has type: '//&
544 jd =
size(latb,2) - 1
545 id =
size(lonb,1) - 1
551 call error_mesg(
'astronomy_mod',
'latb has unsupported kind size.' // &
552 'latb and lonb should both be real(r4_kind) or real(r8_kind)', fatal)
554 elseif ( (
present(latb) .and. .not.
present(lonb)) .or. (
present(lonb) .and. .not.
present(latb)) )
then
555 call error_mesg (
'astronomy_mod',
'lat and lon must both be present', fatal)
574 integer,
intent(out) :: period_out
579 integer :: seconds, days
585 call error_mesg (
'astronomy_mod',
' module has not been initialized', fatal)
602 type(
time_type),
intent(inout) :: period_out
608 call error_mesg (
'astronomy_mod',
'module has not been initialized', fatal)
623 integer,
intent(in) :: period_in
629 call error_mesg (
'astronomy_mod',
'module has not been initialized', fatal)
652 call error_mesg (
'astronomy_mod',
'module has not been initialized', fatal)
684 second_in,minute_in,hour_in)
686 integer,
intent(in) :: day_in, month_in, year_in
687 integer,
intent(in),
optional :: second_in, minute_in, hour_in
693 call error_mesg (
'astronomy_mod',
'module has not been initialized', fatal)
703 if (
present(second_in))
then
734 second_out,minute_out,hour_out)
736 integer,
intent(out) :: day_out, month_out, year_out, &
737 second_out, minute_out, hour_out
743 call error_mesg (
'astronomy_mod',
'module has not been initialized', fatal)
799 real(kind=r8_kind) :: d1, d2, d3, d4, d5, dt, norm
810 norm = sqrt(1.0_r8_kind -
ecc**2)
822 d5 = d1/6.0_r8_kind + d2/3.0_r8_kind + d3/3.0_r8_kind + d4/6.0_r8_kind
840 real(kind=r8_kind) :: t
843 t =
twopi*(t - real(floor(t), r8_kind))
854 real(kind=r8_kind) :: t
859 integer :: seconds, days
866 #include "astronomy_r4.fh"
867 #include "astronomy_r8.fh"
869 end module astronomy_mod
real(r8_kind) ecc
Eccentricity of Earth's orbit [dimensionless].
integer second_ae
Second of specified autumnal equinox.
subroutine, public astronomy_end
astronomy_end is the destructor for astronomy_mod.
subroutine, public astronomy_init(latb, lonb)
astronomy_init is the constructor for astronomy_mod.
type(time_type) autumnal_eq_ref
time_type variable containing specified time of reference NH autumnal equinox
integer minute_ae
Minute of specified autumnal equinox.
real(kind=r8_kind) function, public orbital_time(time)
Orbital time returns the time (1 year = 2*pi) since autumnal equinox.
integer period
Specified length of year [seconds]; must be specified to override default value given by length_of_ye...
real(r8_kind), dimension(:), allocatable orb_angle
table of orbital positions (0 to 2*pi) as a function of time used to find actual orbital position via...
real(r8_kind), dimension(:,:), allocatable fracday_ann
annual mean daylight fraction
subroutine, public set_ref_date_of_ae(day_in, month_in, year_in, second_in, minute_in, hour_in)
set_ref_date_of_ae provides a means of specifying the reference date of the NH autumnal equinox for a...
real(kind=r8_kind) function, public universal_time(time)
universal_time returns the time of day at longitude = 0.0 (1 day = 2*pi)
integer total_pts
number of grid boxes owned by the processor
subroutine set_period_time_type(period_in)
Set_period_time_type saves the length of the year (input as a time_type variable) into a time_type mo...
integer num_angles
Number of intervals into which the year is divided to compute orbital positions.
real(r8_kind), dimension(:,:), allocatable cosz_ann
annual mean cos of zenith angle
integer num_pts
count of grid_boxes for which annual mean astronomy values have been calculated
integer year_ae
Year of specified autumnal equinox.
real(r8_kind) obliq
Obliquity [degrees].
subroutine, private orbit
Orbit computes and stores a table of value of orbital angles as a function of orbital time (both the ...
integer month_ae
Month of specified autumnal equinox.
real(r8_kind) seconds_per_day
seconds in a day
subroutine set_period_integer(period_in)
set_period_integer saves as the input length of the year (an integer) in a time_type module variable.
real(r8_kind) rrsun_ann
annual mean earth-sun distance
real(r8_kind), dimension(:,:), allocatable solar_ann
annual mean solar factor
integer day_ae
Day of specified autumnal equinox.
real(r8_kind) deg_to_rad
conversion from degrees to radians
real(r8_kind) per
Longitude of perihelion with respect to autumnal equinox in NH [degrees].
integer hour_ae
Hour of specified autumnal equinox.
logical module_is_initialized
has the module been initialized ?
subroutine, public get_ref_date_of_ae(day_out, month_out, year_out, second_out, minute_out, hour_out)
get_ref_date_of_ae retrieves the reference date of the autumnal equinox as integer variables.
subroutine get_period_time_type(period_out)
get_period_time_type returns the length of the year as a time_type variable.
subroutine get_period_integer(period_out)
get_period_integer returns the length of the year as an integer number of seconds.
type(time_type) period_time_type
time_type variable containing period of one orbit
logical annual_mean_calculated
have the annual mean values been calculated?
Calculates the annual mean of solar information for a given latitude and time.
Calculates the daily mean solar information for a given time and latitude.
Calculates solar information for the given location(lat & lon) and time.
Gets the length of year for current calendar.
Private interface for internal use by dirunal_solar and daily_mean_solar.
Sets the length of a year for the calendar in use.
integer function, public check_nml_error(IOSTAT, NML_NAME)
Checks the iostat argument that is returned after reading a namelist and determines if the error code...
subroutine, public write_version_number(version, tag, unit)
Prints to the log file (or a specified unit) the version id string and tag name.
subroutine, public fms_init(localcomm, alt_input_nml_path)
Initializes the FMS module and also calls the initialization routines for all modules in the MPP pack...
subroutine, public error_mesg(routine, message, level)
Print notes, warnings and error messages; terminates program for warning and error messages....
integer function stdlog()
This function returns the current standard fortran unit numbers for log messages. Log messages,...
integer function mpp_pe()
Returns processor ID.
type(time_type) function, public length_of_year()
Returns the mean length of the year in the default calendar setting.
subroutine, public get_time(Time, seconds, days, ticks, err_msg)
Returns days and seconds ( < 86400 ) corresponding to a time. err_msg should be checked for any error...
subroutine, public time_manager_init()
Initialization routine. Writes the version information to the log file.
Given an input date in year, month, days, etc., creates a time_type that represents this time interva...
Given some number of seconds and days, returns the corresponding time_type.
Type to represent amounts of time. Implemented as seconds and days to allow for larger intervals.