SCALE-RM
scale_atmos_sub_solarins.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
15 !-------------------------------------------------------------------------------
17  !-----------------------------------------------------------------------------
18  !
19  !++ used modules
20  !
21  use scale_precision
22  use scale_stdio
23  use scale_prof
24  !-----------------------------------------------------------------------------
25  implicit none
26  private
27  !-----------------------------------------------------------------------------
28  !
29  !++ Public procedure
30  !
31  public :: atmos_solarins_setup
32  public :: atmos_solarins_orbit
33  public :: atmos_solarins_insolation
34 
35  interface atmos_solarins_insolation
36  module procedure atmos_solarins_insolation_0d
37  module procedure atmos_solarins_insolation_2d
38  end interface atmos_solarins_insolation
39 
40  !-----------------------------------------------------------------------------
41  !
42  !++ Public parameters & variables
43  !
44  real(RP), public :: atmos_solarins_constant = 1360.250117_rp ! Solar constant [W/m2]
45  logical, public :: atmos_solarins_fixedlatlon = .false. ! Latitude/Longitude is fixed?
46  logical, public :: atmos_solarins_fixeddate = .false. ! Date is fixed?
47  real(RP), public :: atmos_solarins_lon ! Longitude for radiation [rad]
48  real(RP), public :: atmos_solarins_lat ! Latitude for radiation [rad]
49  integer, public :: atmos_solarins_date(6) ! Date for radiation [Y,M,D,H,M,S]
50 
51  !-----------------------------------------------------------------------------
52  !
53  !++ Private procedure
54  !
55  !-----------------------------------------------------------------------------
56  !
57  !++ Private parameters & variables
58  !
59  real(RP), private :: obliquity ! obliquity [rad]
60  real(RP), private :: e ! eccentricity
61  real(RP), private :: omega ! longitude of perigee [rad]
62  real(RP), private :: lambda_m0 ! longitude at the vernal equinox [rad]
63 
64  integer, private, parameter :: year_ref = 1950 ! reference year [year]
65  integer, private :: ve_date(6) ! reference date of vernal equinox
66  data ve_date / 1950, 3, 21, 0, 0, 0 /
67 
68  real(RP), private, parameter :: obliquity_ref = 23.320556_rp ! initial condition of obliquity (epsilon_star)
69  real(RP), private, parameter :: psi_bar = 50.439273_rp ! parameter for general precession [second of arc]
70  real(RP), private, parameter :: zeta = 3.392506_rp ! parameter for general precession [degree]
71 
72  !-----< Parameter tables from Berger(1978b) >-----
73  integer, private, parameter :: nobliq = 47 ! # of terms of the series expansion of epsilon
74  real(RP), private :: obliq_amp (nobliq) ! amplitude [second of arc]
75  real(RP), private :: obliq_rate (nobliq) ! mean rate [second of arc/year]
76  real(RP), private :: obliq_phase(nobliq) ! phase [degree of arc]
77 
78  data obliq_amp / &
79  -2462.2214466_rp, & ! 1
80  -857.3232075_rp, & ! 2
81  -629.3231835_rp, & ! 3
82  -414.2804924_rp, & ! 4
83  -311.7632587_rp, & ! 5
84  308.9408604_rp, & ! 6
85  -162.5533601_rp, & ! 7
86  -116.1077911_rp, & ! 8
87  101.1189923_rp, & ! 9
88  -67.6856209_rp, & ! 10
89  24.9079067_rp, & ! 11
90  22.5811241_rp, & ! 12
91  -21.1648355_rp, & ! 13
92  -15.6549876_rp, & ! 14
93  15.3936813_rp, & ! 15
94  14.6660938_rp, & ! 16
95  -11.7273029_rp, & ! 17
96  10.2742696_rp, & ! 18
97  6.4914588_rp, & ! 19
98  5.8539148_rp, & ! 20
99  -5.4872205_rp, & ! 21
100  -5.4290191_rp, & ! 22
101  5.1609570_rp, & ! 23
102  5.0786314_rp, & ! 24
103  -4.0735782_rp, & ! 25
104  3.7227167_rp, & ! 26
105  3.3971932_rp, & ! 27
106  -2.8347004_rp, & ! 28
107  -2.6550721_rp, & ! 29
108  -2.5717867_rp, & ! 30
109  -2.4712188_rp, & ! 31
110  2.4625410_rp, & ! 32
111  2.2464112_rp, & ! 33
112  -2.0755511_rp, & ! 34
113  -1.9713669_rp, & ! 35
114  -1.8813061_rp, & ! 36
115  -1.8468785_rp, & ! 37
116  1.8186742_rp, & ! 38
117  1.7601888_rp, & ! 39
118  -1.5428851_rp, & ! 40
119  1.4738838_rp, & ! 41
120  -1.4593669_rp, & ! 42
121  1.4192259_rp, & ! 43
122  -1.1818980_rp, & ! 44
123  1.1756474_rp, & ! 45
124  -1.1316126_rp, & ! 46
125  1.0896928_rp / ! 47
126 
127  data obliq_rate / &
128  31.609974_rp, & ! 1
129  32.620504_rp, & ! 2
130  24.172203_rp, & ! 3
131  31.983787_rp, & ! 4
132  44.828336_rp, & ! 5
133  30.973257_rp, & ! 6
134  43.668246_rp, & ! 7
135  32.246691_rp, & ! 8
136  30.599444_rp, & ! 9
137  42.681324_rp, & ! 10
138  43.836462_rp, & ! 11!
139  47.439436_rp, & ! 12
140  63.219948_rp, & ! 13
141  64.230478_rp, & ! 14
142  1.010530_rp, & ! 15
143  7.437771_rp, & ! 16
144  55.782177_rp, & ! 17
145  0.373813_rp, & ! 18
146  13.218362_rp, & ! 19
147  62.583231_rp, & ! 20
148  63.593761_rp, & ! 21
149  76.438310_rp, & ! 22
150  45.815258_rp, & ! 23
151  8.448301_rp, & ! 24
152  56.792707_rp, & ! 25
153  49.747842_rp, & ! 26
154  12.058272_rp, & ! 27
155  75.278220_rp, & ! 28
156  65.241008_rp, & ! 29
157  64.604291_rp, & ! 30
158  1.647247_rp, & ! 31
159  7.811584_rp, & ! 32
160  12.207832_rp, & ! 33
161  63.856665_rp, & ! 34
162  56.155990_rp, & ! 35
163  77.448840_rp, & ! 36
164  6.801054_rp, & ! 37
165  62.209418_rp, & ! 38
166  20.656133_rp, & ! 39
167  48.344406_rp, & ! 40
168  55.145460_rp, & ! 41
169  69.000539_rp, & ! 42
170  11.071350_rp, & ! 43
171  74.291298_rp, & ! 44
172  11.047742_rp, & ! 45
173  0.636717_rp, & ! 46
174  12.844549_rp / ! 47
175 
176  data obliq_phase / &
177  251.9025_rp, & ! 1
178  280.8325_rp, & ! 2
179  128.3057_rp, & ! 3
180  292.7252_rp, & ! 4
181  15.3747_rp, & ! 5
182  263.7951_rp, & ! 6
183  308.4258_rp, & ! 7
184  240.0099_rp, & ! 8
185  222.9725_rp, & ! 9
186  268.7809_rp, & ! 10
187  316.7998_rp, & ! 11
188  319.6024_rp, & ! 12
189  143.8050_rp, & ! 13
190  172.7351_rp, & ! 14
191  28.9300_rp, & ! 15
192  123.5968_rp, & ! 16
193  20.2082_rp, & ! 17
194  40.8226_rp, & ! 18
195  123.4722_rp, & ! 19
196  155.6977_rp, & ! 20
197  184.6277_rp, & ! 21
198  267.2772_rp, & ! 22
199  55.0196_rp, & ! 23
200  152.5268_rp, & ! 24
201  49.1382_rp, & ! 25
202  204.6609_rp, & ! 26
203  56.5233_rp, & ! 27
204  200.3284_rp, & ! 28
205  201.6651_rp, & ! 29
206  213.5577_rp, & ! 30
207  17.0374_rp, & ! 31
208  164.4194_rp, & ! 32
209  94.5422_rp, & ! 33
210  131.9124_rp, & ! 34
211  61.0309_rp, & ! 35
212  296.2073_rp, & ! 36
213  135.4894_rp, & ! 37
214  114.8750_rp, & ! 38
215  247.0691_rp, & ! 39
216  256.6114_rp, & ! 40
217  32.1008_rp, & ! 41
218  143.6804_rp, & ! 42
219  16.8784_rp, & ! 43
220  160.6835_rp, & ! 44
221  27.5932_rp, & ! 45
222  348.1074_rp, & ! 46
223  82.6496_rp / ! 47
224 
225  integer, private, parameter :: neclip = 19 ! # of terms of the series expansion of ecliptic
226  real(RP), private :: eclip_amp (neclip) ! amplitude
227  real(RP), private :: eclip_rate (neclip) ! mean rate [second of arc/year]
228  real(RP), private :: eclip_phase(neclip) ! phase [degree of arc]
229 
230  data eclip_amp / &
231  0.01860798_rp, & ! 1
232  0.01627522_rp, & ! 2
233  -0.01300660_rp, & ! 3
234  0.00988829_rp, & ! 4
235  -0.00336700_rp, & ! 5
236  0.00333077_rp, & ! 6
237  -0.00235400_rp, & ! 7
238  0.00140015_rp, & ! 8
239  0.00100700_rp, & ! 9
240  0.00085700_rp, & ! 10
241  0.00064990_rp, & ! 11
242  0.00059900_rp, & ! 12
243  0.00037800_rp, & ! 13
244  -0.00033700_rp, & ! 14
245  0.00027600_rp, & ! 15
246  0.00018200_rp, & ! 16
247  -0.00017400_rp, & ! 17
248  -0.00012400_rp, & ! 18
249  0.00001250_rp / ! 19
250 
251  data eclip_rate / &
252  4.2072050_rp, & ! 1
253  7.3460910_rp, & ! 2
254  17.8572630_rp, & ! 3
255  17.2205460_rp, & ! 4
256  16.8467330_rp, & ! 5
257  5.1990790_rp, & ! 6
258  18.2310760_rp, & ! 7
259  26.2167580_rp, & ! 8
260  6.3591690_rp, & ! 9
261  16.2100160_rp, & ! 10
262  3.0651810_rp, & ! 11
263  16.5838290_rp, & ! 12
264  18.4939800_rp, & ! 13
265  6.1909530_rp, & ! 14
266  18.8677930_rp, & ! 15
267  17.4255670_rp, & ! 16
268  6.1860010_rp, & ! 17
269  18.4174410_rp, & ! 18
270  0.6678630_rp / ! 19
271 
272  data eclip_phase / &
273  28.620089_rp, & ! 1
274  193.788772_rp, & ! 2
275  308.307024_rp, & ! 3
276  320.199637_rp, & ! 4
277  279.376984_rp, & ! 5
278  87.195000_rp, & ! 6
279  349.129677_rp, & ! 7
280  128.443387_rp, & ! 8
281  154.143880_rp, & ! 9
282  291.269597_rp, & ! 10
283  114.860583_rp, & ! 11
284  332.092251_rp, & ! 12
285  296.414411_rp, & ! 13
286  145.769910_rp, & ! 14
287  337.237063_rp, & ! 15
288  152.092288_rp, & ! 16
289  126.839891_rp, & ! 17
290  210.667199_rp, & ! 18
291  72.108838_rp / ! 19
292 
293  integer, private, parameter :: nprece = 78 ! # of terms of the series expansion of general precession
294  real(RP), private :: prece_amp (nprece) ! amplitude
295  real(RP), private :: prece_rate (nprece) ! mean rate [second of arc/year]
296  real(RP), private :: prece_phase(nprece) ! phase [degree of arc]
297 
298  data prece_amp / &
299  7391.0225890_rp, & ! 1
300  2555.1526947_rp, & ! 2
301  2022.7629188_rp, & ! 3
302  -1973.6517951_rp, & ! 4
303  1240.2321818_rp, & ! 5
304  953.8679112_rp, & ! 6
305  -931.7537108_rp, & ! 7
306  872.3795383_rp, & ! 8
307  606.3544732_rp, & ! 9
308  -496.0274038_rp, & ! 10
309  456.9608039_rp, & ! 11
310  346.9462320_rp, & ! 12
311  -305.8412902_rp, & ! 13
312  249.6173246_rp, & ! 14
313  -199.1027200_rp, & ! 15
314  191.0560889_rp, & ! 16
315  -175.2936572_rp, & ! 17
316  165.9068833_rp, & ! 18
317  161.1285917_rp, & ! 19
318  139.7878093_rp, & ! 20
319  -133.5228399_rp, & ! 21
320  117.0673811_rp, & ! 22
321  104.6907281_rp, & ! 23
322  95.3227476_rp, & ! 24
323  86.7824524_rp, & ! 25
324  86.0857729_rp, & ! 26
325  70.5893698_rp, & ! 27
326  -69.9719343_rp, & ! 28
327  -62.5817473_rp, & ! 29
328  61.5450059_rp, & ! 30
329  -57.9364011_rp, & ! 31
330  57.1899832_rp, & ! 32
331  -57.0236109_rp, & ! 33
332  -54.2119253_rp, & ! 34
333  53.2834147_rp, & ! 35
334  52.1223575_rp, & ! 36
335  -49.0059908_rp, & ! 37
336  -48.3118757_rp, & ! 38
337  -45.4191685_rp, & ! 39
338  -42.2357920_rp, & ! 40
339  -34.7971099_rp, & ! 41
340  34.4623613_rp, & ! 42
341  -33.8356643_rp, & ! 43
342  33.6689362_rp, & ! 44
343  -31.2521586_rp, & ! 45
344  -30.8798701_rp, & ! 46
345  28.4640769_rp, & ! 47
346  -27.1960802_rp, & ! 48
347  27.0860736_rp, & ! 49
348  -26.3437456_rp, & ! 50
349  24.7253740_rp, & ! 51
350  24.6732126_rp, & ! 52
351  24.4272733_rp, & ! 53
352  24.0127327_rp, & ! 54
353  21.7150294_rp, & ! 55
354  -21.5375347_rp, & ! 56
355  18.1148363_rp, & ! 57
356  -16.9603104_rp, & ! 58
357  -16.1765215_rp, & ! 59
358  15.5567653_rp, & ! 60
359  15.4846529_rp, & ! 61
360  15.2150632_rp, & ! 62
361  14.5047426_rp, & ! 63
362  -14.3873316_rp, & ! 64
363  13.1351419_rp, & ! 65
364  12.8776311_rp, & ! 66
365  11.9867234_rp, & ! 67
366  11.9385578_rp, & ! 68
367  11.7030822_rp, & ! 69
368  11.6018181_rp, & ! 70
369  -11.2617293_rp, & ! 71
370  -10.4664199_rp, & ! 72
371  10.4333970_rp, & ! 73
372  -10.2377466_rp, & ! 74
373  10.1934446_rp, & ! 75
374  -10.1280191_rp, & ! 76
375  10.0289441_rp, & ! 77
376  -10.0034259_rp / ! 78
377 
378  data prece_rate / &
379  31.609974_rp, & ! 1
380  32.620504_rp, & ! 2
381  24.172203_rp, & ! 3
382  0.636717_rp, & ! 4
383  31.983787_rp, & ! 5
384  3.138886_rp, & ! 6
385  30.973257_rp, & ! 7
386  44.828336_rp, & ! 8
387  0.991874_rp, & ! 9
388  0.373813_rp, & ! 10
389  43.668246_rp, & ! 11
390  32.246691_rp, & ! 12
391  30.599444_rp, & ! 13
392  2.147012_rp, & ! 14
393  10.511172_rp, & ! 15
394  42.681324_rp, & ! 16
395  13.650058_rp, & ! 17
396  0.986922_rp, & ! 18
397  9.874455_rp, & ! 19
398  13.013341_rp, & ! 20
399  0.262904_rp, & ! 21
400  0.004952_rp, & ! 22
401  1.142024_rp, & ! 23
402  63.219948_rp, & ! 24
403  0.205021_rp, & ! 25
404  2.151964_rp, & ! 26
405  64.230478_rp, & ! 27
406  43.836462_rp, & ! 28
407  47.439436_rp, & ! 29
408  1.384343_rp, & ! 30
409  7.437771_rp, & ! 31
410  18.829299_rp, & ! 32
411  9.500642_rp, & ! 33
412  0.431696_rp, & ! 34
413  1.160090_rp, & ! 35
414  55.782177_rp, & ! 36
415  12.639528_rp, & ! 37
416  1.155138_rp, & ! 38
417  0.168216_rp, & ! 39
418  1.647247_rp, & ! 40
419  10.884985_rp, & ! 41
420  5.610937_rp, & ! 42
421  12.658184_rp, & ! 43
422  1.010530_rp, & ! 44
423  1.983748_rp, & ! 45
424  14.023871_rp, & ! 46
425  0.560178_rp, & ! 47
426  1.273434_rp, & ! 48
427  12.021467_rp, & ! 49
428  62.583231_rp, & ! 50
429  63.593761_rp, & ! 51
430  76.438310_rp, & ! 52
431  4.280910_rp, & ! 53
432  13.218362_rp, & ! 54
433  17.818769_rp, & ! 55
434  8.359495_rp, & ! 56
435  56.792707_rp, & ! 57
436  8.448301_rp, & ! 58
437  1.978796_rp, & ! 59
438  8.863925_rp, & ! 60
439  0.186365_rp, & ! 61
440  8.996212_rp, & ! 62
441  6.771027_rp, & ! 63
442  45.815258_rp, & ! 64
443  12.002811_rp, & ! 65
444  75.278220_rp, & ! 66
445  65.241008_rp, & ! 67
446  18.870667_rp, & ! 68
447  22.009553_rp, & ! 69
448  64.604291_rp, & ! 70
449  11.498094_rp, & ! 71
450  0.578834_rp, & ! 72
451  9.237738_rp, & ! 73
452  49.747842_rp, & ! 74
453  2.147012_rp, & ! 75
454  1.196895_rp, & ! 76
455  2.133898_rp, & ! 77
456  0.173168_rp / ! 78
457 
458  data prece_phase / &
459  251.9025_rp, & ! 1
460  280.8325_rp, & ! 2
461  128.3057_rp, & ! 3
462  348.1074_rp, & ! 4
463  292.7252_rp, & ! 5
464  165.1686_rp, & ! 6
465  263.7951_rp, & ! 7
466  15.3747_rp, & ! 8
467  58.5749_rp, & ! 9
468  40.8226_rp, & ! 10
469  308.4258_rp, & ! 11
470  240.0099_rp, & ! 12
471  222.9725_rp, & ! 13
472  106.5937_rp, & ! 14
473  114.5182_rp, & ! 15
474  268.7809_rp, & ! 16
475  279.6869_rp, & ! 17
476  39.6448_rp, & ! 18
477  126.4108_rp, & ! 19
478  291.5795_rp, & ! 20
479  307.2848_rp, & ! 21
480  18.9300_rp, & ! 22
481  273.7596_rp, & ! 23
482  143.8050_rp, & ! 24
483  191.8927_rp, & ! 25
484  125.5237_rp, & ! 26
485  172.7351_rp, & ! 27
486  316.7998_rp, & ! 28
487  319.6024_rp, & ! 29
488  69.7526_rp, & ! 30
489  123.5968_rp, & ! 31
490  217.6432_rp, & ! 32
491  85.5882_rp, & ! 33
492  156.2147_rp, & ! 34
493  66.9489_rp, & ! 35
494  20.2082_rp, & ! 36
495  250.7568_rp, & ! 37
496  48.0188_rp, & ! 38
497  8.3739_rp, & ! 39
498  17.0374_rp, & ! 40
499  155.3409_rp, & ! 41
500  94.1709_rp, & ! 42
501  221.1120_rp, & ! 43
502  28.9300_rp, & ! 44
503  117.1498_rp, & ! 45
504  320.5095_rp, & ! 46
505  262.3602_rp, & ! 47
506  336.2148_rp, & ! 48
507  233.0046_rp, & ! 49
508  155.6977_rp, & ! 50
509  184.6277_rp, & ! 51
510  267.2772_rp, & ! 52
511  78.9281_rp, & ! 53
512  123.4722_rp, & ! 54
513  188.7132_rp, & ! 55
514  180.1364_rp, & ! 56
515  49.1382_rp, & ! 57
516  152.5268_rp, & ! 58
517  98.2198_rp, & ! 59
518  97.4808_rp, & ! 60
519  221.5376_rp, & ! 61
520  168.2438_rp, & ! 62
521  161.1199_rp, & ! 63
522  55.0196_rp, & ! 64
523  262.6495_rp, & ! 65
524  200.3284_rp, & ! 66
525  201.6651_rp, & ! 67
526  294.6547_rp, & ! 68
527  99.8233_rp, & ! 69
528  213.5577_rp, & ! 70
529  154.1631_rp, & ! 71
530  232.7153_rp, & ! 72
531  138.3034_rp, & ! 73
532  204.6609_rp, & ! 74
533  106.5938_rp, & ! 75
534  250.4676_rp, & ! 76
535  332.3345_rp, & ! 77
536  27.3039_rp / ! 78
537 
538  real(RP), private :: arcsec2d, arcsec2r ! unit converter
539 
540  !-----------------------------------------------------------------------------
541 contains
542  !-----------------------------------------------------------------------------
544  !-----------------------------------------------------------------------------
545  subroutine atmos_solarins_setup( &
546  iyear )
547  use scale_process, only: &
549  use scale_const, only: &
550  const_d2r
551  use scale_grid_real, only: &
554  implicit none
555 
556  integer, intent(in) :: iyear ! year at setup
557 
558  namelist / param_atmos_solarins / &
565 
566  real(RP) :: dyear ! delta t [year]
567  integer :: year ! used year
568 
569  integer :: ierr
570  !---------------------------------------------------------------------------
571 
572  if( io_l ) write(io_fid_log,*)
573  if( io_l ) write(io_fid_log,*) '++++++ Module[SOLARINS] / Categ[ATMOS SHARE] / Origin[SCALElib]'
574 
577  atmos_solarins_date(:) = -1
578 
579  !--- read namelist
580  rewind(io_fid_conf)
581  read(io_fid_conf,nml=param_atmos_solarins,iostat=ierr)
582  if( ierr < 0 ) then !--- missing
583  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
584  elseif( ierr > 0 ) then !--- fatal error
585  write(*,*) 'xxx Not appropriate names in namelist PARAM_ATMOS_SOLARINS. Check!'
586  call prc_mpistop
587  endif
588  if( io_nml ) write(io_fid_nml,nml=param_atmos_solarins)
589 
590  arcsec2d = 1.0_rp / (60.0_rp*60.0_rp)
591  arcsec2r = arcsec2d * const_d2r
592 
593  year = iyear
594 
595  if ( atmos_solarins_fixeddate ) then
596  if( atmos_solarins_date(1) >= 0 ) year = atmos_solarins_date(1)
597  endif
598 
599  call atmos_solarins_orbit( year )
600 
601  dyear = real( year-year_ref, kind=rp )
602 
603  !----- report data -----
604  if( io_l ) write(io_fid_log,*)
605  if( io_l ) write(io_fid_log,'(1x,A)') '*** Solar insolation parameters ***'
606  if( io_l ) write(io_fid_log,'(1x,A,I7)') '*** Reference year : ', year_ref
607  if( io_l ) write(io_fid_log,'(1x,A,I7)') '*** Current year : ', iyear
608  if( io_l ) write(io_fid_log,'(1x,A,I7)') '*** Difference from ref. : ', int(dyear)
609  if( io_l ) write(io_fid_log,*)
610  if( io_l ) write(io_fid_log,'(1x,A,F12.7)') '*** Solar constant [W/m2] : ', atmos_solarins_constant
611  if( io_l ) write(io_fid_log,'(1x,A,F12.7)') '*** Obliquity [deg] : ', obliquity / const_d2r
612  if( io_l ) write(io_fid_log,'(1x,A,F12.7)') '*** Eccentricity : ', e
613  if( io_l ) write(io_fid_log,'(1x,A,F12.7)') '*** Longitude of perihelion [deg] : ', omega / const_d2r
614  if( io_l ) write(io_fid_log,'(1x,A,F12.7)') '*** Longitude at the vernal equinox [deg] : ', lambda_m0 / const_d2r
615  if( io_l ) write(io_fid_log,*)
616 
617  if( io_l ) write(io_fid_log,*) '*** Latitude/Longitude is fixed? : ', atmos_solarins_fixedlatlon
618  if ( atmos_solarins_fixedlatlon ) then
619  if( io_l ) write(io_fid_log,*) '*** Longitude [deg] : ', atmos_solarins_lon
620  if( io_l ) write(io_fid_log,*) '*** Latitude [deg] : ', atmos_solarins_lat
623  endif
624 
625  if( io_l ) write(io_fid_log,*) '*** Date is fixed? : ', atmos_solarins_fixeddate
626  if ( atmos_solarins_fixeddate ) then
627  if( io_l ) write(io_fid_log,*) '*** Date : ', atmos_solarins_date
628  endif
629 
630  return
631  end subroutine atmos_solarins_setup
632 
633  !-----------------------------------------------------------------------------
635  !-----------------------------------------------------------------------------
636  subroutine atmos_solarins_orbit( &
637  iyear )
638  use scale_const, only: &
639  pi => const_pi, &
640  const_d2r
641  implicit none
642 
643  integer, intent(in) :: iyear ! year at setup
644 
645  real(RP) :: dyear ! delta t [year]
646 
647  real(RP) :: esinomg ! e * sin(w) : ecliptic parameter
648  real(RP) :: ecosomg ! e * cos(w) : ecliptic parameter
649  real(RP) :: perih_pi ! pi : longitude of fixed perihelion [rad]
650  real(RP) :: perih_psi ! psi : general precession [degree]
651  real(RP) :: perih_omega ! omega_bar : longitude of perihelion [degree]
652 
653  real(RP) :: temp, beta, ecosomg_mod
654  integer :: i
655  !---------------------------------------------------------------------------
656 
657  ! time from reference year(1950.0 AD)
658  dyear = real( iyear-year_ref, kind=rp )
659 
660  ! obliquity
661  temp = 0.0_rp
662  do i = 1, nobliq
663  temp = temp + obliq_amp(i)*arcsec2d * cos( obliq_rate(i)*arcsec2r*dyear + obliq_phase(i)*const_d2r )
664  enddo
665  obliquity = ( obliquity_ref + temp ) * const_d2r
666 
667  ! eccentricity
668  esinomg = 0.0_rp
669  ecosomg = 0.0_rp
670  do i = 1, neclip
671  esinomg = esinomg + eclip_amp(i) * sin( eclip_rate(i)*arcsec2r*dyear + eclip_phase(i)*const_d2r )
672  ecosomg = ecosomg + eclip_amp(i) * cos( eclip_rate(i)*arcsec2r*dyear + eclip_phase(i)*const_d2r )
673  enddo
674  e = sqrt( esinomg*esinomg + ecosomg*ecosomg )
675 
676  ! longitude of fixed perihelion
677  if ( ecosomg == 0.0_rp ) then
678  ecosomg_mod = 1.e-30_rp
679  else
680  ecosomg_mod = ecosomg
681  endif
682  perih_pi = atan(esinomg/ecosomg_mod) + pi * ( 0.5_rp - sign(0.5_rp, ecosomg) )
683 
684 ! if( abs(EcosOMG) < 1.E-8_RP ) then
685 ! if ( EsinOMG == 0.0_RP ) then
686 ! Perih_pi = 0.0_RP
687 ! elseif( EsinOMG < 0.0_RP ) then
688 ! Perih_pi = 1.5_RP * PI
689 ! elseif( EsinOMG > 0.0_RP ) then
690 ! Perih_pi = 0.5_RP * PI
691 ! endif
692 !
693 ! elseif( EcosOMG < 0.0_RP ) then
694 !
695 ! Perih_pi = atan(EsinOMG/EcosOMG) + PI
696 !
697 ! elseif( EcosOMG > 0.0_RP ) then
698 !
699 ! if ( EsinOMG < 0.0_RP ) then
700 ! Perih_pi = atan(EsinOMG/EcosOMG) + 2.0_RP * PI
701 ! else
702 ! Perih_pi = atan(EsinOMG/EcosOMG)
703 ! endif
704 !
705 ! endif
706  perih_pi = perih_pi / const_d2r ! [rad]->[degree]
707 
708  ! general precession
709  temp = 0.0_rp
710  do i = 1, nprece
711  temp = temp + prece_amp(i)*arcsec2d * sin( prece_rate(i)*arcsec2r*dyear + prece_phase(i)*const_d2r )
712  enddo
713  perih_psi = psi_bar * arcsec2d * dyear + zeta + temp
714 
715  ! longitude of perihelion
716  perih_omega = perih_pi + perih_psi
717 
718  do i = 1, 1000
719  if ( perih_omega + 180.0_rp < 0.0_rp ) then
720  perih_omega = perih_omega + 360.0_rp
721  elseif( perih_omega + 180.0_rp >= 360.0_rp ) then
722  perih_omega = perih_omega - 360.0_rp
723  else
724  exit
725  endif
726  enddo
727 
728  ! longitude of perigee (see berger et al.(1993))
729  omega = ( perih_omega + 180.0_rp ) * const_d2r
730 
731  beta = sqrt( 1.0_rp - e*e )
732 
733  ! longitude at the vernal equinox
734  lambda_m0 = 2.0_rp * ( ( 1.0_rp/2.0_rp*e + 1.0_rp/8.0_rp*e*e*e ) * ( 1.0_rp + beta ) * sin( omega) &
735  - ( 1.0_rp/4.0_rp*e*e ) * ( 1.0_rp/2.0_rp + beta ) * sin(2.0_rp*omega) &
736  + ( 1.0_rp/8.0_rp*e*e*e ) * ( 1.0_rp/3.0_rp + beta ) * sin(3.0_rp*omega) )
737 
738  return
739  end subroutine atmos_solarins_orbit
740 
741  !-----------------------------------------------------------------------------
743  subroutine atmos_solarins_insolation_0d( &
744  solins, &
745  cosSZA, &
746  Re_factor, &
747  real_lon, &
748  real_lat, &
749  now_date, &
750  offset_year )
751  use scale_const, only: &
752  pi => const_pi, &
753  eps => const_eps
754  use scale_calendar, only: &
758  i_year, i_month, i_day, &
759  i_hour, i_min, i_sec
760  implicit none
761 
762  real(RP), intent(out) :: solins ! solar insolation
763  real(RP), intent(out) :: cosSZA ! cos(Solar Zenith Angle)
764  real(RP), intent(out) :: Re_factor ! factor of the distance of Earth from the sun (1/rho2)
765  real(RP), intent(in) :: real_lon ! longitude
766  real(RP), intent(in) :: real_lat ! latitude
767  integer, intent(in) :: now_date(6) ! date(yyyy,mm,dd,hh,mm,ss)
768  integer, intent(in) :: offset_year ! year offset
769 
770  real(RP) :: lon
771  real(RP) :: lat
772  integer :: date(6)
773  integer :: oyear
774 
775  real(RP) :: lambda_m ! mean longitude from vernal equinox
776  real(RP) :: lambda !
777  real(RP) :: sinDEC, cosDEC ! sin/cos(solar declination)
778  real(RP) :: hourangle ! hour angle: relative longitude of subsolar point
779 
780  integer :: absday, absday_ve
781  real(DP) :: DayOfYear, abssec
782  real(RP) :: nu
783  !---------------------------------------------------------------------------
784 
785  lon = real_lon
786  lat = real_lat
787  if ( atmos_solarins_fixedlatlon ) then
788  lon = atmos_solarins_lon
789  lat = atmos_solarins_lat
790  endif
791 
792  date(:) = now_date(:)
793  oyear = offset_year
794  if ( atmos_solarins_fixeddate ) then
795  if( atmos_solarins_date(1) >= 0 ) oyear = 0
796  if( atmos_solarins_date(1) >= 0 ) date(1) = atmos_solarins_date(1)
797  if( atmos_solarins_date(2) >= 1 ) date(2) = atmos_solarins_date(2)
798  if( atmos_solarins_date(3) >= 1 ) date(3) = atmos_solarins_date(3)
799  if( atmos_solarins_date(4) >= 0 ) date(4) = atmos_solarins_date(4)
800  if( atmos_solarins_date(5) >= 0 ) date(5) = atmos_solarins_date(5)
801  if( atmos_solarins_date(6) >= 0 ) date(6) = atmos_solarins_date(6)
802  endif
803 
804  call calendar_getdayofyear( dayofyear, date(i_year) )
805 
806  call calendar_ymd2absday( absday, & ! [OUT]
807  date(i_year), & ! [IN]
808  date(i_month), & ! [IN]
809  date(i_day), & ! [IN]
810  oyear ) ! [IN]
811 
812  call calendar_ymd2absday( absday_ve, & ! [OUT]
813  date(i_year), & ! [IN]
814  ve_date(i_month), & ! [IN]
815  ve_date(i_day), & ! [IN]
816  oyear ) ! [IN]
817 
818  call calendar_hms2abssec( abssec, & ! [OUT]
819  date(i_hour), & ! [IN]
820  date(i_min), & ! [IN]
821  date(i_sec), & ! [IN]
822  0.0_dp ) ! [IN]
823 
824  lambda_m = lambda_m0 + 2.0_rp * pi * real(absday-absday_ve,kind=RP) / DayOfYear
825 
826  nu = lambda_m - omega
827 
828  ! actual longitude from vernal equinox
829  lambda = lambda_m &
830  + ( 2.0_rp*e - 1.0_rp/ 4.0_rp*e*e*e ) * sin( nu ) &
831  + ( 5.0_rp/ 4.0_rp*e*e ) * sin( 2.0_rp*nu ) &
832  + ( 13.0_rp/12.0_rp*e*e*e ) * sin( 3.0_rp*nu )
833 
834  ! solar declination
835  sindec = sin(lambda) * sin(obliquity)
836  cosdec = sqrt( 1.0_rp - sindec*sindec )
837 
838  ! hour angle
839  hourangle = lon + 2.0_rp * pi * abssec / (24.0_rp*60.0_rp*60.0_rp)
840 
841  ! cos(Solar Zenith Angle)
842  cossza = sin(lat)*sindec - cos(lat)*cosdec*cos(hourangle)
843 
844  ! 1 / (rho*rho)
845  re_factor = 1.0_rp &
846  + 2.0_rp*e * cos( nu ) &
847  + 0.5_rp*e*e * cos( 2.0_rp*nu ) &
848  + 2.5_rp*e*e &
849  + 4.0_rp*e*e*e * cos( 3.0_rp*nu )
850 
851 ! solins = ATMOS_SOLARINS_constant * Re_factor * max(cosSZA,0.0_RP)
852  solins = atmos_solarins_constant * re_factor * ( 0.5_rp + sign(0.5_rp,cossza-eps) )
853 
854  return
855  end subroutine atmos_solarins_insolation_0d
856 
857  !-----------------------------------------------------------------------------
859  subroutine atmos_solarins_insolation_2d( &
860  solins, &
861  cosSZA, &
862  real_lon, &
863  real_lat, &
864  now_date, &
865  offset_year )
867  use scale_const, only: &
868  pi => const_pi, &
869  eps => const_eps
870  use scale_calendar, only: &
874  i_year, i_month, i_day, &
875  i_hour, i_min, i_sec
876  implicit none
877 
878  real(RP), intent(out) :: solins (IA,JA) ! solar insolation
879  real(RP), intent(out) :: cosSZA (IA,JA) ! cos(Solar Zenith Angle)
880  real(RP), intent(in) :: real_lon(IA,JA) ! longitude [rad]
881  real(RP), intent(in) :: real_lat(IA,JA) ! latitude [rad]
882  integer, intent(in) :: now_date(6) ! date(yyyy,mm,dd,hh,mm,ss)
883  integer, intent(in) :: offset_year ! year offset
884 
885  real(RP) :: lon(IA,JA)
886  real(RP) :: lat(IA,JA)
887  integer :: date(6)
888  integer :: oyear
889 
890  real(RP) :: lambda_m ! mean longitude from vernal equinox
891  real(RP) :: lambda !
892  real(RP) :: sinDEC, cosDEC ! sin/cos(solar declination)
893  real(RP) :: hourangle(IA,JA) ! hour angle: relative longitude of subsolar point
894 
895  integer :: absday, absday_ve
896  real(DP) :: DayOfYear, abssec
897  real(RP) :: nu
898  real(RP) :: Re_factor ! factor of the distance of Earth from the sun (1/rho2)
899 
900  integer :: i, j
901  !---------------------------------------------------------------------------
902 
903  lon(:,:) = real_lon(:,:)
904  lat(:,:) = real_lat(:,:)
905  if ( atmos_solarins_fixedlatlon ) then
906  lon(:,:) = atmos_solarins_lon
907  lat(:,:) = atmos_solarins_lat
908  endif
909 
910  date(:) = now_date(:)
911  oyear = offset_year
912  if ( atmos_solarins_fixeddate ) then
913  if( atmos_solarins_date(1) >= 0 ) oyear = 0
914  if( atmos_solarins_date(1) >= 0 ) date(1) = atmos_solarins_date(1)
915  if( atmos_solarins_date(2) >= 1 ) date(2) = atmos_solarins_date(2)
916  if( atmos_solarins_date(3) >= 1 ) date(3) = atmos_solarins_date(3)
917  if( atmos_solarins_date(4) >= 0 ) date(4) = atmos_solarins_date(4)
918  if( atmos_solarins_date(5) >= 0 ) date(5) = atmos_solarins_date(5)
919  if( atmos_solarins_date(6) >= 0 ) date(6) = atmos_solarins_date(6)
920  endif
921 
922  call calendar_getdayofyear( dayofyear, date(i_year) )
923 
924  call calendar_ymd2absday( absday, & ! [OUT]
925  date(i_year), & ! [IN]
926  date(i_month), & ! [IN]
927  date(i_day), & ! [IN]
928  oyear ) ! [IN]
929 
930  call calendar_ymd2absday( absday_ve, & ! [OUT]
931  date(i_year), & ! [IN]
932  ve_date(i_month), & ! [IN]
933  ve_date(i_day), & ! [IN]
934  oyear ) ! [IN]
935 
936  call calendar_hms2abssec( abssec, & ! [OUT]
937  date(i_hour), & ! [IN]
938  date(i_min), & ! [IN]
939  date(i_sec), & ! [IN]
940  0.0_dp ) ! [IN]
941 
942  lambda_m = lambda_m0 + 2.0_rp * pi * real(absday-absday_ve,kind=RP) / DayOfYear
943 
944  nu = lambda_m - omega
945 
946  ! 1 / (rho*rho)
947  re_factor = 1.0_rp &
948  + 2.0_rp*e * cos( nu ) &
949  + 0.5_rp*e*e * cos( 2.0_rp*nu ) &
950  + 2.5_rp*e*e &
951  + 4.0_rp*e*e*e * cos( 3.0_rp*nu )
952 
953  ! actual longitude from vernal equinox
954  lambda = lambda_m &
955  + ( 2.0_rp*e - 1.0_rp/ 4.0_rp*e*e*e ) * sin( nu ) &
956  + ( 5.0_rp/ 4.0_rp*e*e ) * sin( 2.0_rp*nu ) &
957  + ( 13.0_rp/12.0_rp*e*e*e ) * sin( 3.0_rp*nu )
958 
959  ! solar declination
960  sindec = sin(lambda) * sin(obliquity)
961  cosdec = sqrt( 1.0_rp - sindec*sindec )
962 
963  do j = js, je
964  do i = is, ie
965  ! hour angle
966  hourangle(i,j) = lon(i,j) + 2.0_rp * pi * abssec / (24.0_rp*60.0_rp*60.0_rp)
967  enddo
968  enddo
969 
970  do j = js, je
971  do i = is, ie
972  ! cos(Solar Zenith Angle)
973  cossza(i,j) = sin(lat(i,j))*sindec - cos(lat(i,j))*cosdec*cos(hourangle(i,j))
974  enddo
975  enddo
976 
977  do j = js, je
978  do i = is, ie
979 ! solins(i,j) = ATMOS_SOLARINS_constant * Re_factor * max(cosSZA(i,j),0.0_RP)
980  solins(i,j) = atmos_solarins_constant * re_factor * ( 0.5_rp + sign(0.5_rp,cossza(i,j)-eps) )
981  enddo
982  enddo
983 
984  return
985  end subroutine atmos_solarins_insolation_2d
986 
987 end module scale_atmos_solarins
integer, public is
start point of inner domain: x, local
integer, parameter, public i_month
[index] month
integer, parameter, public i_year
[index] year
integer, public je
end point of inner domain: y, local
real(rp), public atmos_solarins_constant
subroutine, public prc_mpistop
Abort MPI.
subroutine, public calendar_ymd2absday(absday, gyear, gmonth, gday, oyear)
Convert from gregorian date to absolute day, DAY 0 is AD1/1/1.
real(rp), public real_basepoint_lat
position of base point in real world [rad,-pi,pi]
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:61
module STDIO
Definition: scale_stdio.F90:12
logical, public atmos_solarins_fixeddate
real(rp), public const_d2r
degree to radian
Definition: scale_const.F90:35
subroutine, public atmos_solarins_orbit(iyear)
setup solar incidence module
module grid index
logical, public atmos_solarins_fixedlatlon
logical, public io_nml
output log or not? (for namelist, this process)
Definition: scale_stdio.F90:62
subroutine atmos_solarins_insolation_2d(solins, cosSZA, real_lon, real_lat, now_date, offset_year)
calc factor of Earths solar insolation
module GRID (real space)
subroutine, public atmos_solarins_setup(iyear)
setup solar incidence module
integer, parameter, public i_min
[index] minute
integer, public js
start point of inner domain: y, local
module PROCESS
integer, parameter, public i_sec
[index] second
module CONSTANT
Definition: scale_const.F90:14
integer, parameter, public i_hour
[index] hour
integer, parameter, public i_day
[index] day
module profiler
Definition: scale_prof.F90:10
integer, public ie
end point of inner domain: x, local
real(rp), public const_eps
small number
Definition: scale_const.F90:36
subroutine atmos_solarins_insolation_0d(solins, cosSZA, Re_factor, real_lon, real_lat, now_date, offset_year)
calc factor of Earths solar insolation
module PRECISION
real(rp), public const_pi
pi
Definition: scale_const.F90:34
module CALENDAR
integer, public io_fid_conf
Config file ID.
Definition: scale_stdio.F90:55
integer, dimension(6), public atmos_solarins_date
subroutine, public calendar_getdayofyear(DayOfYear, iyear)
Get day of year.
subroutine, public calendar_hms2abssec(abssec, hour, minute, second, subsec)
Hour, minute, second, subsecond -> absolute second.
integer, public io_fid_log
Log file ID.
Definition: scale_stdio.F90:56
integer, parameter, public rp
integer, public io_fid_nml
Log file ID (only for output namelist)
Definition: scale_stdio.F90:57
real(rp), public real_basepoint_lon
position of base point in real world [rad,0-2pi]