-
Notifications
You must be signed in to change notification settings - Fork 0
/
dust_temperature_module.f90
700 lines (599 loc) · 36.1 KB
/
dust_temperature_module.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
!******************************************************************************
! MODULE: dust_temperature_module
!******************************************************************************
!
! DESCRIPTION:
!> @brief Module that contains all the routines needed to compute consistently
!! the dust temperature. Only dust_temp is public.
!!\n\n The grain temperature is only a function of UV flux and visual extinction
!!. If those parameters are constant, you only need to calculate the grain
!! temperature once, during initialisation.
!
!******************************************************************************
module dust_temperature_module
use iso_fortran_env, only : error_unit
use global_variables
implicit none
integer, parameter :: nb_wavelengths=500
real(double_precision), dimension(nb_wavelengths) :: wavelength = [& !< Wavelength [Angstrom]
9.118d+02, 9.433d+02, 9.759d+02, 1.010d+03, 1.045d+03, 1.081d+03, 1.118d+03, 1.157d+03, 1.197d+03, 1.238d+03, 1.281d+03, &
1.325d+03, 1.371d+03, 1.418d+03, 1.468d+03, 1.518d+03, 1.571d+03, 1.625d+03, 1.681d+03, 1.739d+03, 1.800d+03, 1.862d+03, &
1.926d+03, 1.993d+03, 2.062d+03, 2.133d+03, 2.207d+03, 2.283d+03, 2.362d+03, 2.444d+03, 2.528d+03, 2.616d+03, 2.706d+03, &
2.800d+03, 2.897d+03, 2.997d+03, 3.100d+03, 3.208d+03, 3.319d+03, 3.433d+03, 3.552d+03, 3.675d+03, 3.802d+03, 3.933d+03, &
4.070d+03, 4.210d+03, 4.356d+03, 4.506d+03, 4.662d+03, 4.824d+03, 4.990d+03, 5.163d+03, 5.342d+03, 5.526d+03, 5.717d+03, &
5.915d+03, 6.120d+03, 6.331d+03, 6.550d+03, 6.777d+03, 7.011d+03, 7.254d+03, 7.504d+03, 7.764d+03, 8.032d+03, 8.310d+03, &
8.598d+03, 8.895d+03, 9.202d+03, 9.521d+03, 9.850d+03, 1.019d+04, 1.054d+04, 1.091d+04, 1.128d+04, 1.168d+04, 1.208d+04, &
1.250d+04, 1.293d+04, 1.338d+04, 1.384d+04, 1.432d+04, 1.481d+04, 1.532d+04, 1.585d+04, 1.640d+04, 1.697d+04, 1.756d+04, &
1.816d+04, 1.879d+04, 1.944d+04, 2.011d+04, 2.081d+04, 2.153d+04, 2.227d+04, 2.304d+04, 2.384d+04, 2.467d+04, 2.552d+04, &
2.640d+04, 2.731d+04, 2.826d+04, 2.924d+04, 3.025d+04, 3.129d+04, 3.238d+04, 3.349d+04, 3.465d+04, 3.585d+04, 3.709d+04, &
3.837d+04, 3.970d+04, 4.107d+04, 4.249d+04, 4.396d+04, 4.548d+04, 4.706d+04, 4.868d+04, 5.037d+04, 5.211d+04, 5.391d+04, &
5.578d+04, 5.771d+04, 5.970d+04, 6.177d+04, 6.390d+04, 6.611d+04, 6.840d+04, 7.076d+04, 7.321d+04, 7.574d+04, 7.836d+04, &
8.107d+04, 8.388d+04, 8.678d+04, 8.978d+04, 9.288d+04, 9.609d+04, 9.942d+04, 1.029d+05, 1.064d+05, 1.101d+05, 1.139d+05, &
1.178d+05, 1.219d+05, 1.261d+05, 1.305d+05, 1.350d+05, 1.397d+05, 1.445d+05, 1.495d+05, 1.547d+05, 1.600d+05, 1.656d+05, &
1.713d+05, 1.772d+05, 1.833d+05, 1.897d+05, 1.962d+05, 2.030d+05, 2.100d+05, 2.173d+05, 2.248d+05, 2.326d+05, 2.406d+05, &
2.490d+05, 2.576d+05, 2.665d+05, 2.757d+05, 2.852d+05, 2.951d+05, 3.053d+05, 3.158d+05, 3.268d+05, 3.381d+05, 3.498d+05, &
3.619d+05, 3.744d+05, 3.873d+05, 4.007d+05, 4.146d+05, 4.289d+05, 4.437d+05, 4.591d+05, 4.750d+05, 4.914d+05, 5.084d+05, &
5.260d+05, 5.441d+05, 5.630d+05, 5.824d+05, 6.026d+05, 6.234d+05, 6.450d+05, 6.673d+05, 6.904d+05, 7.142d+05, 7.389d+05, &
7.645d+05, 7.909d+05, 8.183d+05, 8.466d+05, 8.758d+05, 9.061d+05, 9.375d+05, 9.699d+05, 1.003d+06, 1.038d+06, 1.074d+06, &
1.111d+06, 1.150d+06, 1.189d+06, 1.230d+06, 1.273d+06, 1.317d+06, 1.363d+06, 1.410d+06, 1.458d+06, 1.509d+06, 1.561d+06, &
1.615d+06, 1.671d+06, 1.729d+06, 1.789d+06, 1.850d+06, 1.914d+06, 1.981d+06, 2.049d+06, 2.120d+06, 2.193d+06, 2.269d+06, &
2.348d+06, 2.429d+06, 2.513d+06, 2.600d+06, 2.690d+06, 2.783d+06, 2.879d+06, 2.978d+06, 3.081d+06, 3.188d+06, 3.298d+06, &
3.412d+06, 3.530d+06, 3.652d+06, 3.779d+06, 3.909d+06, 4.044d+06, 4.184d+06, 4.329d+06, 4.479d+06, 4.634d+06, 4.794d+06, &
4.960d+06, 5.131d+06, 5.309d+06, 5.492d+06, 5.682d+06, 5.879d+06, 6.082d+06, 6.292d+06, 6.510d+06, 6.735d+06, 6.968d+06, &
7.209d+06, 7.458d+06, 7.716d+06, 7.983d+06, 8.259d+06, 8.544d+06, 8.840d+06, 9.146d+06, 9.462d+06, 9.789d+06, 1.013d+07, &
1.048d+07, 1.084d+07, 1.122d+07, 1.160d+07, 1.200d+07, 1.242d+07, 1.285d+07, 1.329d+07, 1.375d+07, 1.423d+07, 1.472d+07, &
1.523d+07, 1.576d+07, 1.630d+07, 1.687d+07, 1.745d+07, 1.805d+07, 1.868d+07, 1.932d+07, 1.999d+07, 2.068d+07, 2.140d+07, &
2.214d+07, 2.290d+07, 2.369d+07, 2.451d+07, 2.536d+07, 2.624d+07, 2.715d+07, 2.808d+07, 2.906d+07, 3.006d+07, 3.110d+07, &
3.218d+07, 3.329d+07, 3.444d+07, 3.563d+07, 3.686d+07, 3.814d+07, 3.946d+07, 4.082d+07, 4.223d+07, 4.369d+07, 4.520d+07, &
4.677d+07, 4.838d+07, 5.006d+07, 5.179d+07, 5.358d+07, 5.543d+07, 5.735d+07, 5.933d+07, 6.138d+07, 6.351d+07, 6.570d+07, &
6.798d+07, 7.033d+07, 7.276d+07, 7.528d+07, 7.788d+07, 8.057d+07, 8.336d+07, 8.624d+07, 8.922d+07, 9.231d+07, 9.550d+07, &
9.880d+07, 1.022d+08, 1.058d+08, 1.094d+08, 1.132d+08, 1.171d+08, 1.212d+08, 1.254d+08, 1.297d+08, 1.342d+08, 1.388d+08, &
1.436d+08, 1.486d+08, 1.537d+08, 1.590d+08, 1.645d+08, 1.702d+08, 1.761d+08, 1.822d+08, 1.885d+08, 1.950d+08, 2.018d+08, &
2.087d+08, 2.160d+08, 2.234d+08, 2.312d+08, 2.391d+08, 2.474d+08, 2.560d+08, 2.648d+08, 2.740d+08, 2.835d+08, 2.933d+08, &
3.034d+08, 3.139d+08, 3.248d+08, 3.360d+08, 3.476d+08, 3.596d+08, 3.721d+08, 3.849d+08, 3.982d+08, 4.120d+08, 4.263d+08, &
4.410d+08, 4.562d+08, 4.720d+08, 4.883d+08, 5.052d+08, 5.227d+08, 5.408d+08, 5.595d+08, 5.788d+08, 5.989d+08, 6.196d+08, &
6.410d+08, 6.632d+08, 6.861d+08, 7.098d+08, 7.344d+08, 7.598d+08, 7.860d+08, 8.132d+08, 8.413d+08, 8.704d+08, 9.005d+08, &
9.317d+08, 9.639d+08, 9.972d+08, 1.032d+09, 1.067d+09, 1.104d+09, 1.143d+09, 1.182d+09, 1.223d+09, 1.265d+09, 1.309d+09, &
1.354d+09, 1.401d+09, 1.449d+09, 1.500d+09, 1.551d+09, 1.605d+09, 1.661d+09, 1.718d+09, 1.777d+09, 1.839d+09, 1.903d+09, &
1.968d+09, 2.036d+09, 2.107d+09, 2.180d+09, 2.255d+09, 2.333d+09, 2.414d+09, 2.497d+09, 2.584d+09, 2.673d+09, 2.765d+09, &
2.861d+09, 2.960d+09, 3.062d+09, 3.168d+09, 3.278d+09, 3.391d+09, 3.508d+09, 3.630d+09, 3.755d+09, 3.885d+09, 4.019d+09, &
4.158d+09, 4.302d+09, 4.451d+09, 4.605d+09, 4.764d+09, 4.929d+09, 5.099d+09, 5.276d+09, 5.458d+09, 5.647d+09, 5.842d+09, &
6.044d+09, 6.253d+09, 6.470d+09, 6.693d+09, 6.925d+09, 7.164d+09, 7.412d+09, 7.668d+09, 7.934d+09, 8.208d+09, 8.492d+09, &
8.785d+09, 9.089d+09, 9.404d+09, 9.729d+09, 1.007d+10, 1.041d+10, 1.077d+10, 1.115d+10, 1.153d+10, 1.193d+10, 1.234d+10, &
1.277d+10, 1.321d+10, 1.367d+10, 1.414d+10, 1.463d+10, 1.514d+10, 1.566d+10, 1.620d+10, 1.676d+10, 1.734d+10, 1.794d+10, &
1.856d+10, 1.920d+10, 1.987d+10, 2.055d+10, 2.126d+10]
real(double_precision), dimension(nb_wavelengths) :: incident_dust_flux = [& !< incident dust flux [erg.cm-2.s-1.A-1.sr-1]
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 5.888d-10, 1.222d-09, 6.861d-10, 4.963d-10, 5.079d-10, 6.569d-10, &
9.016d-10, 8.933d-10, 7.119d-10, 5.954d-10, 5.372d-10, 5.085d-10, 4.942d-10, 4.871d-10, 4.836d-10, 4.801d-10, 4.733d-10, &
4.543d-10, 4.145d-10, 4.165d-10, 4.551d-10, 4.763d-10, 4.863d-10, 4.920d-10, 4.950d-10, 4.973d-10, 4.996d-10, 5.014d-10, &
5.041d-10, 5.087d-10, 5.183d-10, 5.394d-10, 5.960d-10, 8.052d-10, 3.220d-09, 4.763d-09, 8.774d-10, 6.064d-10, 5.304d-10, &
4.990d-10, 4.842d-10, 4.776d-10, 4.766d-10, 4.812d-10, 4.927d-10, 5.141d-10, 5.552d-10, 6.561d-10, 1.143d-09, 1.052d-09, &
1.397d-09, 2.041d-09, 2.426d-09, 1.120d-08, 4.654d-09, 3.403d-09, 3.383d-09, 3.913d-09, 6.347d-09, 1.307d-08, 1.244d-08, &
6.131d-09, 4.507d-09, 4.921d-09, 2.088d-09, 1.457d-09, 1.246d-09, 1.168d-09, 1.193d-09, 1.422d-09, 2.722d-09, 6.300d-09, &
2.909d-09, 2.923d-09, 3.828d-09, 2.029d-09, 1.929d-09, 1.410d-09, 1.226d-09, 1.120d-09, 1.100d-09, 1.157d-09, 1.524d-09, &
1.441d-09, 1.125d-09, 9.238d-10, 8.874d-10, 7.588d-10, 6.986d-10, 6.503d-10, 6.084d-10, 5.721d-10, 5.410d-10, 5.146d-10, &
4.928d-10, 4.747d-10, 4.608d-10, 4.504d-10, 4.427d-10, 4.381d-10, 4.356d-10, 4.344d-10, 4.341d-10, 4.338d-10, 4.338d-10, &
4.335d-10, 4.331d-10, 4.331d-10, 4.334d-10, 4.353d-10, 4.393d-10, 4.456d-10, 4.548d-10, 4.675d-10, 4.838d-10, 5.040d-10, &
5.285d-10, 5.567d-10, 5.886d-10, 6.239d-10, 6.625d-10, 7.034d-10, 7.464d-10, 7.900d-10, 8.346d-10, 8.777d-10, 9.207d-10, &
9.611d-10, 9.986d-10, 1.032d-09, 1.061d-09, 1.086d-09, 1.105d-09, 1.119d-09, 1.127d-09, 1.130d-09, 1.126d-09, 1.118d-09, &
1.104d-09, 1.088d-09, 1.070d-09, 1.050d-09, 1.030d-09, 1.011d-09, 9.866d-10, 9.447d-10, 8.836d-10, 8.174d-10, 7.537d-10, &
6.946d-10, 6.396d-10, 5.874d-10, 5.376d-10, 4.913d-10, 4.467d-10, 4.052d-10, 3.661d-10, 3.299d-10, 2.962d-10, 2.649d-10, &
2.362d-10, 2.099d-10, 1.854d-10, 1.626d-10, 1.421d-10, 1.240d-10, 1.080d-10, 9.379d-11, 8.130d-11, 7.037d-11, 6.074d-11, &
5.237d-11, 4.507d-11, 3.872d-11, 3.324d-11, 2.847d-11, 2.437d-11, 2.084d-11, 1.779d-11, 1.517d-11, 1.294d-11, 1.102d-11, &
9.370d-12, 7.962d-12, 6.764d-12, 5.737d-12, 4.869d-12, 4.126d-12, 3.495d-12, 2.961d-12, 2.505d-12, 2.121d-12, 1.793d-12, &
1.516d-12, 1.280d-12, 1.082d-12, 9.128d-13, 7.698d-13, 6.491d-13, 5.468d-13, 4.600d-13, 3.868d-13, 3.252d-13, 2.734d-13, &
2.296d-13, 1.925d-13, 1.619d-13, 1.359d-13, 1.139d-13, 9.553d-14, 8.005d-14, 6.709d-14, 5.628d-14, 4.718d-14, 3.950d-14, &
3.317d-14, 2.774d-14, 2.323d-14, 1.946d-14, 1.633d-14, 1.367d-14, 1.147d-14, 9.601d-15, 8.044d-15, 6.741d-15, 5.653d-15, &
4.738d-15, 3.974d-15, 3.333d-15, 2.794d-15, 2.344d-15, 1.967d-15, 1.652d-15, 1.386d-15, 1.166d-15, 9.791d-16, 8.229d-16, &
6.913d-16, 5.810d-16, 4.888d-16, 4.112d-16, 3.457d-16, 2.911d-16, 2.451d-16, 2.064d-16, 1.738d-16, 1.465d-16, 1.235d-16, &
1.041d-16, 8.780d-17, 7.406d-17, 6.248d-17, 5.274d-17, 4.450d-17, 3.758d-17, 3.175d-17, 2.683d-17, 2.267d-17, 1.916d-17, &
1.620d-17, 1.371d-17, 1.159d-17, 9.814d-18, 8.305d-18, 7.032d-18, 5.953d-18, 5.045d-18, 4.276d-18, 3.620d-18, 3.066d-18, &
2.596d-18, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, &
0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00, 0.000d+00]
real(double_precision), dimension(nb_wavelengths) :: Qabs_si = [& !< Absorption coefficient for silicate grains from Draine]
1.164E+00, 1.176E+00, 1.190E+00, 1.204E+00, 1.220E+00, 1.238E+00, 1.259E+00, 1.272E+00, 1.286E+00, 1.304E+00, 1.320E+00, &
1.333E+00, 1.340E+00, 1.345E+00, 1.344E+00, 1.359E+00, 1.395E+00, 1.411E+00, 1.418E+00, 1.366E+00, 1.295E+00, 1.189E+00, &
1.016E+00, 8.034E-01, 7.517E-01, 6.763E-01, 5.258E-01, 4.228E-01, 3.560E-01, 3.702E-01, 3.934E-01, 4.082E-01, 3.981E-01, &
3.613E-01, 3.216E-01, 2.829E-01, 2.658E-01, 2.554E-01, 2.549E-01, 2.581E-01, 2.625E-01, 2.601E-01, 2.539E-01, 2.404E-01, &
2.235E-01, 2.044E-01, 1.869E-01, 1.701E-01, 1.561E-01, 1.438E-01, 1.328E-01, 1.241E-01, 1.158E-01, 1.089E-01, 1.025E-01, &
9.656E-02, 9.132E-02, 8.621E-02, 8.172E-02, 7.738E-02, 7.336E-02, 6.967E-02, 6.604E-02, 6.283E-02, 5.968E-02, 5.677E-02, &
5.404E-02, 5.139E-02, 4.903E-02, 4.669E-02, 4.456E-02, 4.254E-02, 4.060E-02, 3.886E-02, 3.715E-02, 3.562E-02, 3.413E-02, &
3.270E-02, 3.144E-02, 3.021E-02, 2.911E-02, 2.802E-02, 2.699E-02, 2.603E-02, 2.507E-02, 2.421E-02, 2.336E-02, 2.258E-02, &
2.185E-02, 2.115E-02, 2.052E-02, 1.989E-02, 1.931E-02, 1.875E-02, 1.821E-02, 1.772E-02, 1.723E-02, 1.678E-02, 1.634E-02, &
1.593E-02, 1.554E-02, 1.516E-02, 1.482E-02, 1.448E-02, 1.417E-02, 1.389E-02, 1.361E-02, 1.331E-02, 1.301E-02, 1.272E-02, &
1.245E-02, 1.218E-02, 1.192E-02, 1.165E-02, 1.139E-02, 1.116E-02, 1.094E-02, 1.077E-02, 1.062E-02, 1.053E-02, 1.048E-02, &
1.048E-02, 1.055E-02, 1.065E-02, 1.079E-02, 1.089E-02, 1.093E-02, 1.098E-02, 1.104E-02, 1.276E-02, 1.699E-02, 2.733E-02, &
4.423E-02, 6.587E-02, 8.756E-02, 1.095E-01, 1.309E-01, 1.370E-01, 1.283E-01, 1.160E-01, 1.024E-01, 8.765E-02, 7.454E-02, &
6.380E-02, 5.441E-02, 4.548E-02, 3.900E-02, 3.353E-02, 3.018E-02, 3.024E-02, 3.216E-02, 3.548E-02, 3.900E-02, 4.278E-02, &
4.588E-02, 4.850E-02, 4.867E-02, 4.801E-02, 4.512E-02, 4.204E-02, 3.876E-02, 3.597E-02, 3.326E-02, 3.091E-02, 2.869E-02, &
2.667E-02, 2.481E-02, 2.299E-02, 2.143E-02, 1.992E-02, 1.856E-02, 1.729E-02, 1.605E-02, 1.500E-02, 1.398E-02, 1.309E-02, &
1.225E-02, 1.146E-02, 1.072E-02, 9.995E-03, 9.332E-03, 8.696E-03, 8.091E-03, 7.545E-03, 7.010E-03, 6.536E-03, 6.080E-03, &
5.655E-03, 5.266E-03, 4.884E-03, 4.553E-03, 4.229E-03, 3.934E-03, 3.659E-03, 3.393E-03, 3.163E-03, 2.937E-03, 2.733E-03, &
2.543E-03, 2.363E-03, 2.203E-03, 2.045E-03, 1.906E-03, 1.774E-03, 1.650E-03, 1.539E-03, 1.431E-03, 1.335E-03, 1.242E-03, &
1.157E-03, 1.080E-03, 1.005E-03, 9.390E-04, 8.743E-04, 8.158E-04, 7.613E-04, 7.086E-04, 6.619E-04, 6.163E-04, 5.756E-04, &
5.371E-04, 5.005E-04, 4.677E-04, 4.357E-04, 4.074E-04, 3.802E-04, 3.545E-04, 3.313E-04, 3.085E-04, 2.887E-04, 2.694E-04, &
2.513E-04, 2.348E-04, 2.188E-04, 2.048E-04, 1.910E-04, 1.784E-04, 1.667E-04, 1.554E-04, 1.454E-04, 1.356E-04, 1.268E-04, &
1.184E-04, 1.104E-04, 1.033E-04, 9.634E-05, 9.013E-05, 8.417E-05, 7.857E-05, 7.348E-05, 6.850E-05, 6.411E-05, 5.985E-05, &
5.589E-05, 5.225E-05, 4.870E-05, 4.559E-05, 4.255E-05, 3.977E-05, 3.717E-05, 3.466E-05, 3.244E-05, 3.026E-05, 2.830E-05, &
2.644E-05, 2.467E-05, 2.308E-05, 2.153E-05, 2.014E-05, 1.881E-05, 1.757E-05, 1.643E-05, 1.532E-05, 1.434E-05, 1.326E-05, &
1.238E-05, 1.156E-05, 1.080E-05, 1.008E-05, 9.417E-06, 8.794E-06, 8.212E-06, 7.669E-06, 7.162E-06, 6.688E-06, 6.246E-06, &
5.832E-06, 5.447E-06, 5.086E-06, 4.750E-06, 4.436E-06, 4.142E-06, 3.868E-06, 3.613E-06, 3.374E-06, 3.150E-06, 2.942E-06, &
2.747E-06, 2.566E-06, 2.396E-06, 2.238E-06, 2.090E-06, 1.951E-06, 1.822E-06, 1.702E-06, 1.589E-06, 1.484E-06, 1.386E-06, &
1.294E-06, 1.209E-06, 1.129E-06, 1.054E-06, 9.843E-07, 9.192E-07, 8.584E-07, 8.016E-07, 7.486E-07, 6.991E-07, 6.528E-07, &
6.096E-07, 5.693E-07, 5.317E-07, 4.965E-07, 4.636E-07, 4.330E-07, 4.043E-07, 3.776E-07, 3.526E-07, 3.293E-07, 3.075E-07, &
2.872E-07, 2.682E-07, 2.504E-07, 2.339E-07, 2.184E-07, 2.040E-07, 1.905E-07, 1.779E-07, 1.661E-07, 1.551E-07, 1.449E-07, &
1.353E-07, 1.263E-07, 1.180E-07, 1.102E-07, 1.029E-07, 9.608E-08, 8.972E-08, 8.379E-08, 7.824E-08, 7.307E-08, 6.824E-08, &
6.372E-08, 5.951E-08, 5.557E-08, 5.189E-08, 4.846E-08, 4.526E-08, 4.226E-08, 3.947E-08, 3.686E-08, 3.442E-08, 3.214E-08, &
3.002E-08, 2.803E-08, 2.618E-08, 2.445E-08, 2.283E-08, 2.132E-08, 1.991E-08, 1.859E-08, 1.736E-08, 1.621E-08, 1.514E-08, &
1.414E-08, 1.320E-08, 1.233E-08, 1.152E-08, 1.075E-08, 1.004E-08, 9.378E-09, 8.758E-09, 8.178E-09, 7.637E-09, 7.132E-09, &
6.660E-09, 6.220E-09, 5.808E-09, 5.424E-09, 5.065E-09, 4.730E-09, 4.418E-09, 4.125E-09, 3.852E-09, 3.598E-09, 3.360E-09, &
3.137E-09, 2.930E-09, 2.736E-09, 2.555E-09, 2.386E-09, 2.228E-09, 2.081E-09, 1.943E-09, 1.815E-09, 1.695E-09, 1.583E-09, &
1.478E-09, 1.380E-09, 1.289E-09, 1.204E-09, 1.124E-09, 1.050E-09, 9.802E-10, 9.154E-10, 8.548E-10, 7.983E-10, 7.455E-10, &
6.962E-10, 6.501E-10, 6.071E-10, 5.670E-10, 5.295E-10, 4.944E-10, 4.617E-10, 4.312E-10, 4.027E-10, 3.760E-10, 3.512E-10, &
3.279E-10, 3.062E-10, 2.860E-10, 2.671E-10, 2.494E-10, 2.329E-10, 2.175E-10, 2.031E-10, 1.897E-10, 1.771E-10, 1.654E-10, &
1.545E-10, 1.443E-10, 1.347E-10, 1.258E-10, 1.175E-10, 1.097E-10, 1.025E-10, 9.568E-11, 8.935E-11, 8.344E-11, 7.792E-11, &
7.277E-11, 6.795E-11, 6.346E-11, 5.926E-11, 5.534E-11, 5.168E-11, 4.826E-11, 4.507E-11, 4.209E-11, 3.931E-11, 3.671E-11, &
3.428E-11, 3.201E-11, 2.989E-11, 2.792E-11, 2.607E-11, 2.434E-11, 2.273E-11, 2.123E-11, 1.983E-11, 1.851E-11, 1.729E-11, &
1.615E-11, 1.508E-11, 1.408E-11, 1.315E-11, 1.228E-11, 1.147E-11, 1.071E-11, 1.000E-11, 9.339E-12, 8.722E-12, 8.145E-12, &
7.606E-12, 7.103E-12, 6.633E-12, 6.194E-12, 5.785E-12, 5.402E-12, 5.045E-12, 4.711E-12, 4.399E-12, 4.108E-12, 3.837E-12, &
3.583E-12, 3.346E-12, 3.125E-12, 2.918E-12, 2.725E-12]
real(double_precision), dimension(nb_wavelengths) :: Qabs_gr = [& !< Absorption coefficient for graphite grains from Draine]
1.070E+00, 1.078E+00, 1.095E+00, 1.113E+00, 1.129E+00, 1.159E+00, 1.198E+00, 1.247E+00, 1.295E+00, 1.333E+00, 1.359E+00, &
1.373E+00, 1.362E+00, 1.344E+00, 1.328E+00, 1.312E+00, 1.297E+00, 1.288E+00, 1.282E+00, 1.270E+00, 1.261E+00, 1.257E+00, &
1.266E+00, 1.282E+00, 1.308E+00, 1.330E+00, 1.337E+00, 1.333E+00, 1.320E+00, 1.312E+00, 1.305E+00, 1.304E+00, 1.314E+00, &
1.336E+00, 1.368E+00, 1.403E+00, 1.437E+00, 1.471E+00, 1.503E+00, 1.525E+00, 1.542E+00, 1.546E+00, 1.546E+00, 1.542E+00, &
1.535E+00, 1.527E+00, 1.523E+00, 1.522E+00, 1.530E+00, 1.544E+00, 1.563E+00, 1.569E+00, 1.567E+00, 1.535E+00, 1.496E+00, &
1.448E+00, 1.404E+00, 1.361E+00, 1.324E+00, 1.287E+00, 1.250E+00, 1.210E+00, 1.169E+00, 1.123E+00, 1.075E+00, 1.025E+00, &
9.734E-01, 9.207E-01, 8.691E-01, 8.170E-01, 7.668E-01, 7.180E-01, 6.700E-01, 6.263E-01, 5.831E-01, 5.440E-01, 5.062E-01, &
4.702E-01, 4.381E-01, 4.066E-01, 3.788E-01, 3.518E-01, 3.268E-01, 3.043E-01, 2.826E-01, 2.639E-01, 2.456E-01, 2.288E-01, &
2.134E-01, 1.987E-01, 1.858E-01, 1.731E-01, 1.619E-01, 1.513E-01, 1.414E-01, 1.324E-01, 1.237E-01, 1.160E-01, 1.087E-01, &
1.018E-01, 9.555E-02, 8.939E-02, 8.399E-02, 7.874E-02, 7.383E-02, 6.940E-02, 6.510E-02, 6.127E-02, 5.750E-02, 5.406E-02, &
5.085E-02, 4.775E-02, 4.501E-02, 4.231E-02, 3.986E-02, 3.754E-02, 3.532E-02, 3.332E-02, 3.136E-02, 2.957E-02, 2.785E-02, &
2.623E-02, 2.474E-02, 2.328E-02, 2.188E-02, 2.059E-02, 1.953E-02, 1.849E-02, 1.744E-02, 1.653E-02, 1.563E-02, 1.481E-02, &
1.404E-02, 1.330E-02, 1.264E-02, 1.200E-02, 1.143E-02, 1.090E-02, 1.041E-02, 9.972E-03, 9.557E-03, 9.251E-03, 8.919E-03, &
8.557E-03, 8.301E-03, 8.080E-03, 7.897E-03, 7.728E-03, 7.595E-03, 7.498E-03, 7.421E-03, 7.400E-03, 7.394E-03, 7.424E-03, &
7.480E-03, 7.558E-03, 7.675E-03, 7.805E-03, 7.963E-03, 8.138E-03, 8.329E-03, 8.536E-03, 8.754E-03, 8.986E-03, 9.213E-03, &
9.434E-03, 9.634E-03, 9.829E-03, 9.980E-03, 1.011E-02, 1.019E-02, 1.022E-02, 1.023E-02, 1.015E-02, 1.005E-02, 9.874E-03, &
9.656E-03, 9.400E-03, 9.096E-03, 8.771E-03, 8.415E-03, 8.046E-03, 7.663E-03, 7.279E-03, 6.888E-03, 6.510E-03, 6.133E-03, &
5.766E-03, 5.417E-03, 5.069E-03, 4.755E-03, 4.444E-03, 4.153E-03, 3.880E-03, 3.612E-03, 3.376E-03, 3.144E-03, 2.933E-03, &
2.734E-03, 2.542E-03, 2.373E-03, 2.208E-03, 2.061E-03, 1.921E-03, 1.789E-03, 1.671E-03, 1.555E-03, 1.454E-03, 1.358E-03, &
1.270E-03, 1.194E-03, 1.119E-03, 1.058E-03, 9.983E-04, 9.461E-04, 8.942E-04, 8.417E-04, 7.861E-04, 7.298E-04, 6.753E-04, &
6.242E-04, 5.756E-04, 5.336E-04, 4.930E-04, 4.583E-04, 4.254E-04, 3.949E-04, 3.679E-04, 3.417E-04, 3.190E-04, 2.971E-04, &
2.768E-04, 2.583E-04, 2.404E-04, 2.249E-04, 2.096E-04, 1.956E-04, 1.827E-04, 1.702E-04, 1.593E-04, 1.485E-04, 1.389E-04, &
1.297E-04, 1.209E-04, 1.131E-04, 1.055E-04, 9.871E-05, 9.218E-05, 8.605E-05, 8.050E-05, 7.506E-05, 7.027E-05, 6.561E-05, &
6.129E-05, 5.731E-05, 5.342E-05, 5.003E-05, 4.670E-05, 4.366E-05, 4.082E-05, 3.807E-05, 3.564E-05, 3.325E-05, 3.110E-05, &
2.906E-05, 2.713E-05, 2.539E-05, 2.368E-05, 2.216E-05, 2.070E-05, 1.933E-05, 1.808E-05, 1.686E-05, 1.578E-05, 1.567E-05, &
1.465E-05, 1.369E-05, 1.279E-05, 1.195E-05, 1.117E-05, 1.043E-05, 9.750E-06, 9.111E-06, 8.514E-06, 7.955E-06, 7.434E-06, &
6.946E-06, 6.491E-06, 6.065E-06, 5.668E-06, 5.296E-06, 4.949E-06, 4.624E-06, 4.321E-06, 4.038E-06, 3.773E-06, 3.526E-06, &
3.295E-06, 3.079E-06, 2.877E-06, 2.688E-06, 2.512E-06, 2.347E-06, 2.193E-06, 2.049E-06, 1.915E-06, 1.790E-06, 1.672E-06, &
1.563E-06, 1.460E-06, 1.364E-06, 1.275E-06, 1.191E-06, 1.113E-06, 1.040E-06, 9.720E-07, 9.083E-07, 8.488E-07, 7.931E-07, &
7.411E-07, 6.925E-07, 6.471E-07, 6.047E-07, 5.650E-07, 5.280E-07, 4.934E-07, 4.610E-07, 4.308E-07, 4.026E-07, 3.762E-07, &
3.515E-07, 3.285E-07, 3.069E-07, 2.868E-07, 2.680E-07, 2.504E-07, 2.340E-07, 2.187E-07, 2.043E-07, 1.909E-07, 1.784E-07, &
1.667E-07, 1.558E-07, 1.456E-07, 1.360E-07, 1.271E-07, 1.188E-07, 1.110E-07, 1.037E-07, 9.691E-08, 9.055E-08, 8.462E-08, &
7.907E-08, 7.388E-08, 6.904E-08, 6.451E-08, 6.028E-08, 5.633E-08, 5.264E-08, 4.919E-08, 4.596E-08, 4.295E-08, 4.013E-08, &
3.750E-08, 3.504E-08, 3.274E-08, 3.060E-08, 2.859E-08, 2.672E-08, 2.497E-08, 2.333E-08, 2.180E-08, 2.037E-08, 1.903E-08, &
1.779E-08, 1.662E-08, 1.553E-08, 1.451E-08, 1.356E-08, 1.267E-08, 1.184E-08, 1.106E-08, 1.034E-08, 9.661E-09, 9.028E-09, &
8.436E-09, 7.883E-09, 7.366E-09, 6.883E-09, 6.432E-09, 6.010E-09, 5.616E-09, 5.248E-09, 4.904E-09, 4.582E-09, 4.282E-09, &
4.001E-09, 3.739E-09, 3.494E-09, 3.264E-09, 3.050E-09, 2.850E-09, 2.664E-09, 2.489E-09, 2.326E-09, 2.173E-09, 2.031E-09, &
1.898E-09, 1.773E-09, 1.657E-09, 1.548E-09, 1.447E-09, 1.352E-09, 1.263E-09, 1.180E-09, 1.103E-09, 1.031E-09, 9.632E-10, &
9.000E-10, 8.410E-10, 7.859E-10, 7.343E-10, 6.862E-10, 6.412E-10, 5.992E-10, 5.599E-10, 5.232E-10, 4.889E-10, 4.568E-10, &
4.269E-10, 3.989E-10, 3.727E-10, 3.483E-10, 3.255E-10, 3.041E-10, 2.842E-10, 2.655E-10, 2.481E-10, 2.319E-10, 2.167E-10, &
2.025E-10, 1.892E-10, 1.768E-10, 1.652E-10, 1.544E-10, 1.442E-10, 1.348E-10, 1.259E-10, 1.177E-10, 1.100E-10, 1.028E-10, &
9.602E-11, 8.973E-11, 8.384E-11, 7.835E-11, 7.321E-11, 6.841E-11, 6.392E-11, 5.973E-11, 5.582E-11, 5.216E-11, 4.874E-11, &
4.554E-11, 4.256E-11, 3.977E-11, 3.716E-11, 3.472E-11, 3.245E-11, 3.032E-11, 2.833E-11, 2.647E-11, 2.474E-11, 2.312E-11, &
2.160E-11, 2.018E-11, 1.886E-11, 1.762E-11, 1.647E-11, 1.539E-11, 1.438E-11, 1.344E-11, 1.256E-11, 1.173E-11, 1.096E-11, &
1.024E-11, 9.573E-12, 8.945E-12, 8.359E-12, 7.811E-12, 7.299E-12, 6.820E-12, 6.373E-12, 5.955E-12, 5.565E-12, 5.200E-12, &
4.859E-12, 4.540E-12, 4.243E-12, 3.964E-12, 3.705E-12]
real(double_precision), dimension(nb_wavelengths) :: Qabs
real(double_precision), dimension(nb_wavelengths) :: Iinc !< sum of the 4 composant in the incident flux, 3 parts of the spectrum, and dust
real(double_precision) :: rate_abs
private
public :: get_grain_temperature_computed !< Only get_grain_temperature_computed routine will be available outside the module.
contains
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!> @author
!> Maxime Ruaud & Christophe Cossou
!
!> @date may 2014
!
! DESCRIPTION:
!> @brief At a given time, compute the dust temperature using Uv_flux and
!! Visual_extinction.
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subroutine get_grain_temperature_computed(space, time, gas_temperature, av, grain_temperature)
implicit none
! Inputs
integer, intent(in) :: space ![in] current spatial point for 1D
real(double_precision), intent(in) :: time !<[in] current time of the simulation [s]
real(double_precision), intent(in) :: gas_temperature !<[in] gas temperature [K]
real(double_precision), intent(in) :: av !<[in] visual extinction [mag]
! Outputs
real(double_precision),dimension(:), intent(out) :: grain_temperature !<[out] Steady state dust temperature [K]
! Locals
real(double_precision) :: Tleft, Tright ! Temperature boundary
real(double_precision), parameter :: eps = 1.0D-08 ! Tolerance
real(double_precision) :: fss ! Rq: fss should be equal to zero
integer :: etat ! flag
real(double_precision) :: grain_temperature_1st ! = grain_temperature(1), it is used to just make code compatible with grain size distribution part
!----
! We use Qabs for silicates
Qabs = Qabs_si
!----
! Compute the incident radiation filed in term of specific
! intensity (erg cm-2 s-1 Angstrom-1 sr-1) after screening
! by dust
call compute_Iinc(wavelength, av, Iinc)
!----
! Compute the absorption rate by dust
call compute_abs(wavelength, Iinc, Qabs, rate_abs)
!----
! Find the steady state dust temperature using a
! dichotomy algorithm.
! Temperature boundary
Tleft = 2.73d00
Tright = 1.0d03
call dicho(Tleft, Tright, eps, grain_temperature_1st, fss, etat)
grain_temperature=grain_temperature_1st
end subroutine get_grain_temperature_computed
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!> @author
!> Maxime Ruaud
!
!> @date may 2014
!
! DESCRIPTION:
!> @brief Compute the incident radiation filed in term of specific
!! intensity (erg cm-2 s-1 Angstrom-1 sr-1) after screening
!! by dust
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subroutine compute_Iinc(x, av, Iout)
implicit none
! Inputs
real(double_precision), dimension(nb_wavelengths), intent(in) :: x !<[in] Wavelength [Angstrom]
real(double_precision), intent(in) :: av !< Visual extinction [mag]
! Outputs
real(double_precision), dimension(nb_wavelengths), intent(out) :: Iout !<[out] Incident flux after dust screening [erg cm-2 s-1 Angstrom-1 sr-1]
! Locals
integer :: i
real(double_precision) :: Iin
Iout = 0.d0
do i=1, nb_wavelengths
Iin = max(get_local_UV_flux(x(i)), get_starlight_flux(x(i)), get_CMB_flux(x(i)), incident_dust_flux(i))
Iout(i) = Iin * 10.d0**(-ext(x(i)) * av / 2.5d0)
enddo
end subroutine compute_Iinc
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!> @author
!> Maxime Ruaud
!
!> @date may 2014
!
! DESCRIPTION:
!> @brief TODO
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subroutine compute_abs(x, Iin, Q, dustabs)
implicit none
! Inputs
real(double_precision), dimension(nb_wavelengths), intent(in) :: x
real(double_precision), dimension(nb_wavelengths), intent(in) :: Iin
real(double_precision), dimension(nb_wavelengths), intent(in) :: Q
! Outputs
real(double_precision), intent(out) :: dustabs
! Locals
real(double_precision), dimension(nb_wavelengths) :: Uin
real(double_precision) :: sigmabs
real(double_precision) :: test
real(double_precision), dimension(nb_wavelengths) :: Utest
integer :: i
! --- Convert the specific intensity into specific energy density
Uin = 4.0 * pi * Iin / SPEED_OF_LIGHT
! --- Compute the heating rate by absorption of radiation
call trap_int(nb_wavelengths, x, Uin*Q, sigmabs)
dustabs = sigmabs * pi * grain_radius**2 * SPEED_OF_LIGHT
end subroutine compute_abs
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!> @author
!> Maxime Ruaud
!
!> @date 2014
!
! DESCRIPTION:
!> @brief TODO
!
!> @return TODO
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
real(double_precision) function get_ss_grain(Tss)
implicit none
! Inputs
real(double_precision), intent(in) :: Tss
! Locals
real(double_precision) :: rate_emi
real(double_precision), dimension(nb_wavelengths) :: dustem
real(double_precision) :: sigmaem
integer :: i
! --- Compute the cooling rate by infrared emission
do i = 1, nb_wavelengths
dustem(i) = get_black_body_flux(wavelength(i), Tss)
enddo
call trap_int(nb_wavelengths, wavelength, dustem*Qabs, sigmaem)
rate_emi = 4.d0 * pi**2 * grain_radius**2 * sigmaem
! --- cooling balance heating
get_ss_grain = rate_emi - rate_abs
end function get_ss_grain
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!> @author
!> Maxime Ruaud
!
!> @date may 2014
!
! DESCRIPTION:
!> @brief 1st component
!!\n Local UV background between 912 and 2460 Angstroms (From Mathis et al. 1983)
!!\n The fit parameters come from "Physics of the ISM and IGM", Draine, 2011
!!\n - x in Angstroms
!!\n - starlight(x) in erg cm-2 s-1 Angstrom-1 sr-1
!
!> @return get the local UV flux at the given wavelength
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
real(double_precision) function get_local_UV_flux(x)
implicit none
! Inputs
real(double_precision), intent(in) :: x !<[in] Wavelength (Angstrom)
if (x .GE. 1340.0 .AND. x .LT. 2460.0) then
get_local_UV_flux = 2.373D-14 * (x/1e4)**(-0.6678)
elseif (x .GE. 1100.0 .AND. x .LT. 1340.0) then
get_local_UV_flux = 6.825D-13*(x/1e4)
elseif (x .GE. 912.0 .AND. x .LT. 1100.0) then
get_local_UV_flux = 1.287D-9 * (x/1e4)**(4.4172)
else
get_local_UV_flux = 0.0d00
endif
get_local_UV_flux = get_local_UV_flux * SPEED_OF_LIGHT / (4.d0*pi) / x * UV_FLUX
end function get_local_UV_flux
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!> @author
!> Maxime Ruaud
!
!> @date may 2014
!
! DESCRIPTION:
!> @brief 2nd component
!!\n Starlight emission from near-UV, visible and near-IR (From Mathis et al. 1983)
!!\n 3 diluted Black Body (From Mathis et al. 1983)
!!\n - x in Angstroms
!!\n - starlight(x) in erg cm-2 s-1 Angstrom-1 sr-1
!
!> @return Starlight emission at a given wavelength
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
real(double_precision) function get_starlight_flux(x)
implicit none
! Inputs
real(double_precision), intent(in) :: x !<[in] Wavelength (Angstrom)
get_starlight_flux = 1.0d-14*get_black_body_flux(x, 7500.d0) &
+ 1.65d-13*get_black_body_flux(x, 4000.d0) &
+ 7.0d-13*get_black_body_flux(x, 3000.d0)
end function get_starlight_flux
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!> @author
!> Maxime Ruaud
!
!> @date may 2014
!
! DESCRIPTION:
!> @brief 3rd component
!!\n CMB component at T=2.725 K
!!\n - x in Angstroms
!!\n - starlight(x) in erg cm-2 s-1 Angstrom-1 sr-1
!
!> @return Return the Black body spectrum of the CMB at the given wavelength
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
real(double_precision) function get_CMB_flux(x)
implicit none
! Inputs
real(double_precision), intent(in) :: x !<[in] Wavelength (Angstrom)
get_CMB_flux = get_black_body_flux(x, 2.725d0)
end function get_CMB_flux
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!> @author
!> Maxime Ruaud
!
!> @date may 2014
!
! DESCRIPTION:
!> @brief Black body. x in Angstrom, T in K
!
!
!> @return get_black_body_flux in erg cm-2 s-1 Angstrom-1 sr-1
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
real(double_precision) function get_black_body_flux(x, T)
implicit none
! Inputs
real(double_precision), intent(in) :: x !<[in] Wavelength [Angstrom]
real(double_precision), intent(in) :: T !<[in] Temperature [K]
get_black_body_flux = 2.d0 * PLANCK_CONSTANT * SPEED_OF_LIGHT**2 * 1.0d32 / &
(x**5 * (exp((PLANCK_CONSTANT*SPEED_OF_LIGHT/K_B)*1.0d8 / (x*T)) - 1.d0))
end function get_black_body_flux
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!> @author
!> Maxime Ruaud
!
!> @date may 2014
!
! DESCRIPTION:
!> @brief Extinction curve fit parameter from Cardelli et al. 1989 (1989ApJ...345..245C)
!
!> @return Extinction curve as a function of the wavelength (in Angstrom)
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
real(double_precision) function ext(wl)
implicit none
! Inputs
real(double_precision), intent(in) :: wl !< Wavelength [Angstrom]
! Locals
real(double_precision) :: x
real(double_precision) :: a, b, fa, fb, y
! convert x which is in Angstrom to micrometer-1
x = 1.0e4/wl
a = 0.d0
b = 0.d0
! --- Infrared: 0.0 to 1.1 micrometer-1
if(x .lt. 1.1) then
a = 0.574 * x**1.61
b = -0.527 * x**1.61
! Optical/NIR: 1.1 to 3.3 micrometer-1
elseif(x .ge. 1.1 .and. x .le. 3.3) then
y = x - 1.82
a = 1.00 + 0.17699*y - 0.50447*y**2 - 0.02427*y**3 + 0.72085*y**4 + &
0.01979*y**5 - 0.77530*y**6 + 0.32999*y**7
b = 1.41338*y + 2.28305*y**2 + 1.07233*y**3 - 5.38434*y**4 - &
0.62251*y**5 + 5.30260*y**6 - 2.09002*y**7
! UV: 3.3 to 8.0 micrometer-1
elseif(x .gt. 3.3 .and. x .le. 8.0) then
if(x .gt. 5.9 .and. x .le. 8.0) then
fa = -0.04473*(x-5.9)**2 - 0.009779*(x-5.9)**3
fb = 0.2130*(x-5.9)**2 + 0.1207*(x-5.9)**3
elseif(x .le. 5.9) then
fa = 0.d0
fb = 0.d0
endif
a = 1.752 - 0.316*x - 0.104/((x-4.67)**2 + 0.341) + fa
b = -3.090 + 1.825*x + 1.206/((x-4.62)**2 + 0.263) + fb
! Far-UV: 8.0 to ... micrometer-1
elseif(x .ge. 8.0) then
a = -1.073 - 0.628*(x-8.0) + 0.137*(x-8.0)**2 - 0.070*(x-8.0)**3
b = 13.670 + 4.257*(x-8.0) - 0.420*(x-8.0)**2 + 0.374*(x-8.0)**3
endif
ext = a + b/3.1
end function ext
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!> @author
!> Maxime Ruaud
!
!> @date may 2014
!
! DESCRIPTION:
!> @brief TODO
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subroutine trap_int(n, x, f, res)
implicit none
! Inputs
integer, intent(in) :: n
real(double_precision), dimension(n), intent(in) :: x, f
! Outputs
real(double_precision), intent(out) :: res
! Locals
integer :: i
real(double_precision) :: h, int
res = 0.d0
int = 0.d0
do i=1, n-1
h = abs((x(i+1) - x(i))/2.0)
int = h * (f(i) + f(i+1))
res = res + int
enddo
end subroutine trap_int
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!> @author
!> Maxime Ruaud
!
!> @date may 2014
!
! DESCRIPTION:
!> @brief TODO
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subroutine dicho(xl_in, xr_in, eps_in, xtry, ftry, etat)
implicit none
! Inputs
real(double_precision), intent(in) :: xl_in, xr_in !<[in] Borne gauche et droite initiale
real(double_precision), intent(in) :: eps_in !<[in] Precision
! Outputs
real(double_precision), intent(out) :: xtry, ftry !<[out] Point milieu
integer, intent(out):: etat !<[out] Flag
! Locals
real(double_precision) :: xl, xr ! Borne gauche et droite
real(double_precision) :: fl, fr ! f(xl) et f(xr)
real(double_precision) :: dxrel ! Variation
integer :: i ! Compteur
integer, parameter :: imax = 10000
!--- Initialisation
xl = xl_in
xr = xr_in
fl = get_ss_grain(xl)
fr = get_ss_grain(xr)
!--- consistency test
if (xl >= xr) then
write(Error_unit,*) "Error: In dust_temperature:dicho"
write(Error_unit,*) "We need xl < xr but xl=", xl, " and xr=", xr
stop
endif
if (fl*fr < 0.0d00) then ! The zero is between xl and xr
etat = 0 ! No solution found yet
i = 0
do while (etat == 0)
i = i + 1
xtry = 0.5d00 * (xl + xr)
ftry = get_ss_grain(xtry)
if (fl*ftry > 0.0d00) then
xl = xtry
fl = ftry
else
xr = xtry
fr = ftry
endif
if (xtry /= 0.0d00) then
dxrel = ABS((xr-xl)/xtry)
else
dxrel = ABS(xr-xl)
endif
if (dxrel < eps_in .AND. ABS(ftry) < eps_in) then
etat = 1
else if (i > imax) then
etat = 2
endif
enddo
else
etat = 3
endif
if (etat == 3) then
write(Error_unit, *) " "
write(Error_unit, *) "-------------------------------------------------------- "
write(Error_unit, *) " Error in subroutine DICHO of dust_temperature.f90:"
write(Error_unit, *) " the sign of the function doesn't change in the interval:"
write(Error_unit, *) " x(left) :", xl, " f(left) :", fl
write(Error_unit, *) " x(right) :", xr, " f(right) :", fr
write(Error_unit, *) "-------------------------------------------------------- "
write(Error_unit, *) " "
call exit(11)
endif
end subroutine dicho
end module dust_temperature_module