dustem_write_align.pro
3.06 KB
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
PRO dustem_write_align,file,st_align,help=help
;+
; NAME:
; dustem_write_align
; PURPOSE:
; writes the ALIGN.DAT file
; CATEGORY:
; DustEMWrap, Distributed, HighLevel, Initialization
; CALLING SEQUENCE:
; dustem_write_align,file,st_align
; INPUTS:
; file : name of the file to be written
; st_align : structure describing alignment parameters for various grains (usually !dustem.grains.align)
; OPTIONAL INPUT PARAMETERS:
; None
; OUTPUTS:
; None
; OPTIONAL OUTPUT PARAMETERS:
; None
; ACCEPTED KEY-WORDS:
; help : whrites this help
; COMMON BLOCKS:
; None
; SIDE EFFECTS:
; a File is written
; RESTRICTIONS:
; The DustEM fortran code must be installed
; The DustEMWrap idl code must be installed
; PROCEDURES AND SUBROUTINES USED
; EXAMPLES
; MODIFICATION HISTORY:
; Evolution details on the DustEMWrap gitlab.
; See http://dustemwrap.irap.omp.eu/ for FAQ and help.
;-
IF keyword_set(help) THEN BEGIN
doc_library,'dustem_write_align'
goto,the_end
ENDIF
Ncomments=13
c=strarr(Ncomments)
;NOTE: In vincent Guillet's model, the alignment parameters of all grains have to be the same.
;As a consquence, there is only one ligne in the ALIGN.DAT file.
;Here we use the first polarized grain value
;stop
ii=0
c[ii]='# DUSTEM: definition of grain alignment' & ii=ii+1
c[ii]='# for each grain TYPE make sure you have the following files' & ii=ii+1
c[ii]='# Q1_TYPE.DAT and Q2_TYPE in /oprop' & ii=ii+1
c[ii]='# Qc_TYPE.DAT for circular polarization' & ii=ii+1
c[ii]='# QH1_TYPE.DAT QH2_TYPE.DAT for an anistropic radiation field' & ii=ii+1
c[ii]='# Q1_TYPE_RRFxxx.DAT and Q2_TYPE_RRFxxx.DAT when running with RRF option' & ii=ii+1
c[ii]='#' & ii=ii+1
c[ii]='# run keywords' & ii=ii+1
c[ii]='# lin for linear, circ for circular, anis for anistropic extinction and emission, univ for universal alignment law, RRF' & ii=ii+1
c[ii]='# degree of anisotropy of the radiation : if > 0, read QH1 and QH2 files' & ii=ii+1
c[ii]='# alignmentlaw (idg, rat, par), parameters (par1 par2 par3)' & ii=ii+1
c[ii]='# for alignmentlaw = par: parameters are aalign, pstiff, fmax (see Equ. 1 In Guillet et al. 2017' & ii=ii+1
c[ii]='#'
;WHAY IS FMAX in Guillet2017 here called plev ??
openw,unit,file,/get_lun
FOR ii=0,Ncomments-1 DO printf,unit,c[ii]
printf,unit,st_align.keywords,format='(A-40)'
printf,unit,st_align.anisG0,format='(E10.2)'
format='(A-10,2X,10(E18.10,2X))'
IF !run_univ EQ 1 THEN BEGIN
ind=where(st_align.grains.aligned eq 1,count)
ii=ind[0] ;here we use alignment parameters of the first polarized grains and for them to be the same
printf,unit,st_align.grains[ii].law,st_align.grains[ii].athresh,st_align.grains[ii].pstiff,st_align.grains[ii].plev,format=format
;stop
ENDIF ELSE BEGIN
FOR i=0,n_elements(st_align.grains)-1 DO BEGIN
IF st_align.grains[i].aligned THEN BEGIN
IF st_align.grains[i].law NE '' THEN BEGIN
printf,unit,st_align.grains[i].law,st_align.grains[i].athresh,st_align.grains[i].pstiff,st_align.grains[i].plev,format=format
ENDIF
ENDIF
ENDFOR
ENDELSE
close,unit
free_lun,unit
the_end:
END