Blame view

src/idl/dustem_write_align.pro 3.09 KB
52a3c8dc   Jean-Philippe Bernard   mise a jour
1
PRO dustem_write_align,file,st_align,help=help
427f1205   Jean-Michel Glorian   version 4.2 merged
2

52a3c8dc   Jean-Philippe Bernard   mise a jour
3
4
5
;+
; NAME:
;   dustem_write_align
eafc1f8f   Annie Hughes   updated help info
6
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
7
8
; PURPOSE:
;   writes the ALIGN.DAT file
eafc1f8f   Annie Hughes   updated help info
9
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
10
; CATEGORY:
eafc1f8f   Annie Hughes   updated help info
11
12
;    DustEMWrap, Distributed, LowLevel, Initialization
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
13
14
; CALLING SEQUENCE:
;   dustem_write_align,file,st_align
eafc1f8f   Annie Hughes   updated help info
15
16
;
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
17
18
19
; INPUTS:
;    file     : name of the file to be written
;    st_align : structure describing alignment parameters for various grains (usually !dustem.grains.align)
eafc1f8f   Annie Hughes   updated help info
20
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
21
22
; OPTIONAL INPUT PARAMETERS:
;    None
eafc1f8f   Annie Hughes   updated help info
23
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
24
25
; OUTPUTS:
;    None
eafc1f8f   Annie Hughes   updated help info
26
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
27
28
; OPTIONAL OUTPUT PARAMETERS:
;    None
eafc1f8f   Annie Hughes   updated help info
29
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
30
31
; ACCEPTED KEY-WORDS:
;    help     : whrites this help
eafc1f8f   Annie Hughes   updated help info
32
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
33
34
; COMMON BLOCKS:
;    None
eafc1f8f   Annie Hughes   updated help info
35
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
36
37
; SIDE EFFECTS:
;    a File is written
eafc1f8f   Annie Hughes   updated help info
38
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
39
40
41
; RESTRICTIONS:
;    The DustEM fortran code must be installed
;    The DustEMWrap idl code must be installed
eafc1f8f   Annie Hughes   updated help info
42
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
43
; PROCEDURES AND SUBROUTINES USED  
eafc1f8f   Annie Hughes   updated help info
44
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
45
; EXAMPLES
eafc1f8f   Annie Hughes   updated help info
46
;
52a3c8dc   Jean-Philippe Bernard   mise a jour
47
48
49
50
51
52
53
54
55
56
57
; 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
427f1205   Jean-Michel Glorian   version 4.2 merged
58
59
c=strarr(Ncomments)

52a3c8dc   Jean-Philippe Bernard   mise a jour
60
;NOTE: In vincent Guillet's model, the alignment parameters of all grains have to be the same.
b56f639b   Jean-Philippe Bernard   improved, somehow
61
;As a consquence, there is only one line in the ALIGN.DAT file.
52a3c8dc   Jean-Philippe Bernard   mise a jour
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
;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 ??
427f1205   Jean-Michel Glorian   version 4.2 merged
82
83

openw,unit,file,/get_lun
52a3c8dc   Jean-Philippe Bernard   mise a jour
84
FOR ii=0,Ncomments-1 DO printf,unit,c[ii]
427f1205   Jean-Michel Glorian   version 4.2 merged
85
86
87
printf,unit,st_align.keywords,format='(A-40)'
printf,unit,st_align.anisG0,format='(E10.2)'

52a3c8dc   Jean-Philippe Bernard   mise a jour
88
89
90
91
92
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
d012e324   Ilyes Choubani   FIX to the use of...
93
	;stop 
52a3c8dc   Jean-Philippe Bernard   mise a jour
94
95
96
97
98
99
100
101
102
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
427f1205   Jean-Michel Glorian   version 4.2 merged
103
104
105
106

close,unit
free_lun,unit

52a3c8dc   Jean-Philippe Bernard   mise a jour
107
108
the_end:

427f1205   Jean-Michel Glorian   version 4.2 merged
109
END