D How to calculate a NLTE model with TMAP
D.1 Basics
First a short explanation of the directory structure:
user=${LOGNAME}
/home/<user>/adaten | is the directory for the atomic data checked by ATOMS2.
|
/home/<user>/bimod | is the directory for the executable binaries of LTE2 and PRO2. |
/home/<user>/fgrids | is the directory for the frequency grids that were produced with SETF2. |
/home/<user>/jobs | is the directory for all the .job files (ATOMS2, SETF2, LTE2, and PRO2). |
/home/<user>/models | is the directory where the calculated models from LTE2 and PRO2 are. |
For our script, we use the following definitions / shell variables:
setenv AA /home/<user>/adaten
setenv BI /home/<user>/bimod
setenv FF /home/<user>/fgrids
setenv JO /home/<user>/jobs
setenv MO /home/<user>/models
D.2 Creation of atomic data files with ATOMS2
- Change into the directory /home/<user>/jobs/atoms2 and copy the template job file to
<name>.job. It needs a file <name> with the atomic data in /home/<user>/adaten. The
name <name> can be chosen to contain all the elements used in the model (e.g. H+He)
- You need to edit both files, test_atmos_lte.job and test_atoms.job (e.g. with emacs). The
first one is for LTE2, the second one for PRO2.
- After editing, execute the job files and create output files for both jobs with
| <name>_atoms.job | > <name>_atoms.out and
|
| <name>_atoms_lte.job | > <name>_atoms_lte.out . |
- Check both output files (with emacs) for error messages.
- The jobs create ASCII files, e.g. /home/<user>/adaten/<name>.atoms2.
D.3 Creation of a frequency grid with SETF2
- edit both files <name>_lte_setf2 and <name>_setf2 in /home/<user>/jobs/setf2.
Adjust the temperature and make sure that it refers to <name>_lte.atoms2
- run both jobs and create output files with
| <name>_setf2 | > <name>_setf2.out and
|
| <name>_lte_setf2 | > <name>_lte_setf2.out . |
- it writes the files <name>_<temperature>_lte.setf2 and <name>_<temperature>.setf2
to /home/<user>/fgrids
D.4 Adaption of the Parameter files
- extract the parameters from the <name>_atoms.out file with
grep para <name>_atoms.out and from the output file <name>_setf2.out of the
frequency grid
- if you want to save the parameters you can write them in a file with
grep para <name>_atoms.out > object.out
- the parameter files for PRO2 can be found in /home/<user>/PARAMETER/pro2
- copy the existing parameter files to PARA_<name>.INC, PARA1_<name>.INC,
PARA3_<name>.INC and adjust them by using the parameters from
<name>_atoms.out
NOTICE: the values in the parameter files should never be 0!
- compile with ssh aithp3 load pro2 <name> [x64/p64] (use x64 for 64 bit machines, p64
for penryn-processor (our quad core) 64 bit machines),
the executable is copied to /home/<user>/bimod/pro2_<name>.Linux_[x64]
D.5 Calculation of a start model with LTE2
- edit <name>_lte.job with emacs. Adjust the temperature, log g, and the abundances of the
elements used (as normalized number fraction) and check if the used files have the right
name
- input files: <name>_lte.atoms2, <name>_temperature_lte.setf2
- start the job and write it into an output file with
nice +19 <name>_lte.job > <name>_lte.out
- the lte model is written to /home/<user>/model/<name>/lte. The file is called
temperature_logg_numberfraction element a_numberfraction element b,
e.g. 0100000_7.00_1.000_0.000
D.6 Calculation of a NLTE model with PRO2
- edit the <name>_nlte.job in emacs. Adjust the temperature, log g and the
abundances of the used elements and check if the used files have the right name
- input files: <name>.atoms2, <name>_temperature.setf2 and the LTE2 model as input
model
- start the job with nice +19 <name>_nlte.job > <name>_nlte.out
- the output model is written to /home/<user>/model/<name>/
D.7 Strategy to calculate a NLTE model with PRO2
Some models calculate without any problem using the LTE2 start model and an atomic data files that
contains all lines. This can be tested first. In case that this approach fails, try to follow these
steps
Table 5: | Steps to calculate a NLTE model with PRO2 |
|
|
|
|
|
|
| | line | temperature | ATOMS | FGRID | | | step | | | | | comment | |
| | |
|
| | | | transitions | correction | calculated for | | |
|
|
|
|
|
|
| 1 | no | no | LTE2 | LTE2 | very fast due to minimum NF, should work in all cases at least with a
REDUCE LOG CVEC -1
during the very first iterations | |
2 | no | yes | LTE2 | LTE2 | very fast | |
3 | no | yes | LTE2 | PRO2 | fast, using now the final frequency grid | |
4 | yes | yes | PRO2 | PRO2 | initial test with
ITMAX=0
NEWMAX=0
LP-PLOT OPTICALLY THICK/THIN,ITERATION:LAST,FILE ONLY
whether the atmosphere is optically thin at the outer boundary (at least two depth
points) and optically thick at the inner boundary (at least two depth points) - if this
is not fulfilled, recalculate the LTE2 models with slightly extended min and/or max
(be aware that the following PRO2 calculation will change the atmospheric structure
and the occupation numbers of the atomic levels and, thus, all line strengths - check
this = 1 limit in the atmosphere by default after all PRO2 jobs (together with
temperature structure and spectral energy distribution) | |
5 | yes | yes | PRO2 | PRO2 | test whether all lines can be considered in the temperature correction directly from
the outset
a) if numerical instabilities are encountered, try first
REDUCE LOG CVEC -1 or REDUCE LOG CVEC -2
b) if step a is not successful, use the STEP UP F-VALUES method, start with
unproblematic ions like H I and He II, followed by those that have low ionization
fractions, and finally those that are dominating in the line-forming region | |
6 | yes | yes | PRO2 | PRO2 | in the final model, neither a REDUCE LOG CVEC nor a UNSOELD-LUCY TEMPERATURE
CORRECTIONa is allowed | |
|
|
|
|
|
|
| |
a The UNSOELD-LUCY TEMPERATURE CORRECTION may be used in interplay with the standard PRO2 temperature correction because it yields the temperature of the inner
atmosphere quickly and thus stabilizes the numerics. In the outer atmosphere, starting from the line-forming region, the UNSOELD-LUCY TEMPERATURE CORRECTION is not
giving a reliable temperature stratification.
|
D.8 Example: A model with hydrogen and helium
T = 100000 K, log g = 7 and number fractions H = 0.9 and He = 0.1
Basic H and He model atoms are provided by TMAD ( http://astro.uni-_tuebingen.de/~TMAD).
These are combined then in ${AA}/H+He.
D.8.1 ATOMS2
- Copy the job file in /home/<user>/jobs/atoms2 to H+He.job. It needs a file H+He with
the atomic data in /home/<user>/adaten. Edit both files the test_atmos.job and the
test_atoms_lte.job (with emacs). Make sure you use the atomic data file H+He.
- After editing, execute the job file and create an output file for both jobs and check the
output files for error messages.
Table 6: | Example for the atoms2.job in the case of LTE and NLTE model atmosphere calculations |
|
|
|
| LTE model | NLTE model |
|
| #!/bin/sh | #!/bin/sh |
set +x;. ${HOME}/.jobstart | set +x;. ${HOME}/.jobstart |
# | # |
cat > options <<eos | cat > options <<eos |
AUTO ION H I 16 16 16 | AUTO ION H I 16 16 16 |
AUTO ION HE II 14 32 -14 | AUTO ION HE II 14 32 -14 |
CBB-AUTO-FILL | CBB-AUTO-FILL |
CBF-AUTO-FILL | CBF-AUTO-FILL |
CBX-AUTO-FILL | CBX-AUTO-FILL |
RBB-AUTO-FILL ( NONE) | .RBB-AUTO-FILL ( NONE) |
RBF-AUTO-FILL ( NOOP) | RBF-AUTO-FILL |
RDI-AUTO-FILL ( NONE) | RDI-AUTO-FILL ( NONE) |
END OPTIONS | END OPTIONS |
eos | eos |
# | # |
cp ${AA}/H+He PROATOM | cp ${AA}/H+He PROATOM |
expand options PROATOM > SOURCE | expand options PROATOM > SOURCE |
${BI}/atoms2${sys} | ${BI}/atoms2${sys} |
ls -l ATOMS | ls -l ATOMS |
# | # |
cp ATOMS ${AA}/H+He_lte.atoms2 | cp ATOMS ${AA}/H+He.atoms2 |
# | # |
set +x; ${HOME}/.jobend ${TMPDIR} | set +x; ${HOME}/.jobend ${TMPDIR} |
|
| |
|
D.8.2 SETF2
- Edit both files H+He_lte_setf2 and H+He_setf2 in /home/<user>/jobs/setf2. Set the
temperature on 100000K and make sure that it refers to H+He_lte.atoms2.
Table 7: | Example for a setf2.job in the case of LTE and NLTE model atmosphere
calculations |
|
|
|
| LTE model | NLTE model |
|
| #!/bin/sh | #!/bin/sh |
set +x;. ${HOME}/.jobstart | set +x;. ${HOME}/.jobstart |
# | # |
TT=0100000 | TT=0100000 |
# | # |
type='_lte' | type=' ' |
# | # |
cp ${AA}/H+He${type}.atoms2 ATOMS | cp ${AA}/H+He${type}.atoms2 ATOMS |
# | # |
${BI}/setf2${sys} << % | ${BI}/setf2${sys} << % |
$TT | $TT |
PRINT CHECK | PRINT CHECK |
1.30E+16 | 1.30E+16 |
-1 | -1 |
10 10 | 10 10 |
% | % |
# | # |
if test -s FGRID | if test -s FGRID |
then | then |
cp FGRID ${FF}/H+He_${TT}${type}.setf2 | cp FGRID ${FF}/H+He_${TT}${type}.setf2 |
else | else |
echo 'no FGRID created' | echo 'no FGRID created' |
fi | fi |
# | # |
set +x; ${HOME}/.jobend ${TMPDIR} | set +x; ${HOME}/.jobend ${TMPDIR} |
|
| |
|
- Run both jobs and create output files for them. The files H+He_100000(_lte).setf2 and are written
to /home/<user>/fgrids.
D.8.3 Parameter files
- Extract the parameters from the H+He_atoms.out file with
grep para H+He_atoms.out and from the output file H+He_setf2.out of the
frequency grid If you want to save the parameters you can write them in a file with
grep para H+He_atoms.out > object.out
- the parameter files for PRO2 can be found in /home/<user>/PARAMETER/pro2
- copy the existing
parameter files to PARA_H+He.INC, PARA1_H+He.INC, PARA3_H+He.INC and adjust
them by using the parameters from H+He_atoms.out and H+He_setf2.out.
NOTICE: the values in the parameter files should be never 0!
- compile with ssh aithp3 load pro2 H+He [x64/p64] (use x64 for
64 bit machines, p64 for penryn-processor (our quad core) 64 bit machines). The executable
/home/<user>/bimod/pro2_H+He.Linux_[x64] is created
D.8.4 LTE2
- Edit H+He_lte.job with emacs. Set T=100000K, logg=7 and H=0.9 and He=0.1. The input
files are H+He_lte.atoms2 and H+He_100000_lte.setf2.
- Start the job (an example is given below) and write its output into a file.
nice +19 H+He_lte.job
> H+He_lte.out The lte model is written to /home/<user>/model/H+He/lte. The file is
called
0100000_7.00_0.900_0.100.
#!/ bin/sh
set + x ; . ${ HOME }/. jobstart
# do not edit the beginning of this f i l e
# #######################
# # own job following ##
# #######################
#
# ------------
# common paths
# ------------
GRP =/ home/rauch/group
# ---------
# user part
# ---------
#
# directories etc .
#
code=lte2
mod = H + He
type=’_lte ’
#
jobdir= ${JO}/ l t e
f l x d i r= ${JO}/ l t e
#
# model parameters
H=0.900
HE=0.100
#
GGM =7.00
TTM =0100000
#
name = ${ TTM }_${ GGM }
fn= ${mod}
#
aa = ${ AA }/${fn}${type}. atoms2
f f= ${FF}/${fn}_${ TTM }${type}. setf2
#
if test ! -s ${ f f }
then
echo ’${ TTM } ’ > SDATEN
echo ’PRINT CHECK ’ >> SDATEN
echo ’1.30E+16’ >> SDATEN
echo ’1 ’ >> SDATEN
echo ’20 10 ’ >> SDATEN
cp ${aa} ATOMS
${BI}/ setf2$ { sys } < SDATEN 1>&1
if test -f FGRID
then
cp FGRID ${ f f }
chmod 600 ${ f f }
echo ’new frequency grid created ’
l s -l ${ f f }
else
echo ’no new frequency grid created ’
break
fi
rm *
fi
#
MO = ${ MO }/${mod}/ l t e /${name}_${ H }_${ HE }
#
if test ! -s ${ MO }
then
#
echo ’2 1 ${ H } ${ HE} ’ > normH
echo ’2 2 ${ H } ${ HE} ’ > normHE
#
HN =‘/home/rauch/bimod/normalize${ sys } < normH 2>/dev/ null 1>&1‘
HEN =‘/home/rauch/bimod/normalize${ sys } < normHE 2>/dev/ null 1>&1‘
#
cat > LDATEN << eos
T EFF ${ TTM }
LOG G ${ GGM }
DAMP =0.1
ITMAX =100
EPS=1.0E -6
TAU SCALE 86 90 -2
PRINT INTEGRATED EDDINGTON FLUX,ITERATION:LAST
PRINT TEMPERATURE CORRECTIONS,ITERATION:LAST,ALL DEPTHS
PRINT MODEL ATOMS ( OVERVIEW )
ABUNDANCE H ${ HN }
ABUNDANCE HE ${ HEN }
eos
#
cp ${aa} ATOMS
cp ${ f f } FGRID
#
${BI}/${code}${ sys } < LDATEN
#
if test -s MODELL
then
cp MODELL ${ MO }
chmod 600 ${ MO }
fi
fi
#
# do not edit the rest of this f i l e
# ####################
set + x ; ${ HOME }/. jobend ${ TMPDIR }
D.8.5 PRO2
- Edit the H+He_nlte.job in emacs. Adjust the temperature, log gand the abundances of the
used elements as before and check if the used files have the right name. The Input files are
H+He.atoms2, H+He_100000.setf2 and the model from LTE2 is the input model.
- Start the job (an example is given in table below) with
nice +19 H+He_nlte.job > H+He_nlte.out
- The output model is written to /home/<user>/model/H+He/.
#!/ bin/sh
set + x ; . ${ HOME }/. jobstart
# do not edit the beginning of this f i l e
# #######################
# # own job following ##
# #######################
#
# ------------
# common paths
# ------------
GRP =/ home/rauch/group
# ---------
# user part
# ---------
#
# directories etc .
#
code=pro2
mod = H + He
#
type=’’
#
jobdir= ${ HOME }/ jobs /pro2
f l x d i r= ${ HOME }/ jobs /pro2
#
IONFRAC = HE
#
# --- model parameters
#
fn= ${mod}
#
GGM =7.00
#
TTM =0140000
#
H=0.900
HE=0.100
#
name = ${ TTM }_${ GGM }
#
#
aa = ${ AA }/${fn}${type}. atoms2
f f= ${FF}/${fn}_${ TTM }${type}. setf2
#
if test ! -s ${ f f }
then
/home/rauch/prep_conts_man${ sys } > noCONTS_MAN << eos
5.0 2000.1 0.1
eos
echo ’${ TTM } ’ > SDATEN
echo ’PRINT CHECK ’ >> SDATEN
echo ’1.30E+16’ >> SDATEN
echo ’1 ’ >> SDATEN
echo ’4 10 ’ >> SDATEN
cp ${aa} ATOMS
${BI}/ setf2$ { sys } < SDATEN 2>/dev/ null 1>&1
if test -f FGRID
then
cp FGRID ${ f f }
chmod 600 ${ f f }
echo ’new frequency grid created ’
l s -l ${ f f }
else
echo ’no new frequency grid created ’
break
fi
rm *
fi
#
name = ${name}_${ H }_${ HE }
#
MI = ${ HOME }/models/${mod}/0100000_7 .00 _0 .900 _0 .100 _pro2
MO = ${ HOME }/models/${mod}/${name}_pro2
#
if test -s ${MI}
then
#
if test -s ${ MO }
then
MI = ${ MO }
fi
#
cat > DATEN << eos
COMMENT: test 4 TMAP
.
.CHANGE ABUNDANCE H ${ H } MASS FRACTION
.CHANGE ABUNDANCE HE ${ HE } MASS FRACTION
.
.CHANGE LOGG $GGM
.CHANGE EFFECTIVE TEMPERATURE $TT
.
LAMBDA =4
.
OCCUPATION PROBABILITY FORMALISM FOR H1
OCCUPATION PROBABILITY FORMALISM FOR HE1
OCCUPATION PROBABILITY FORMALISM FOR HE2
.
OPACITY PROJECT RBF DATA: START AT EDGE
OPACITY PROJECT RBF DATA: MISSING HYDROGENIC
.
.STEP UP F - VALUES: MODEL - START: H1 1.0E -03 1.5 1
.STEP UP F - VALUES: MODEL - START: HE1 1.0E -04 1.5 1
.STEP UP F - VALUES: MODEL - START: HE2 1.0E -03 1.5 1
.
ITMAX =20
.ERRSCH =1.0E -4
NEWMAX =2
.ERRNEW =1.E -8
.
RADIATIVE EQUILIBRIUM: DIFFERENTIAL/ INTEGRAL FORM
.INNER BOUNDARY: LAMBDA - ITERATION
.LINEARIZE HYDROSTATIC EQUATION
.
NO NEGATIVE POPULATION NUMBERS (LTE)
.
.SWITCH OFF LINES
.
DEPTH DEPENDENT LINE PROFILES, LINEARIZATION: FIRST
.
KANTOROVICH =2, SWITCH LIMITS 0-->1, 1-->2, 2-->1 : 0.1 0.01 0.5
.SOLVE STATISTICAL EQUATIONS ONLY RE - SOLVE PARTICLE CONSERVATION
.
.NO TEMPERATURE CORRECTION
.UNSOELD - LUCY TEMPERATURE CORRECTION DAMP =0.1 0.1 0.1
.UNSOELD - LUCY PARAMETERS PRINT LIMIT 0.1 TAU - WTS 0.1 1.
.
.REDUCE LOG CVEC -1
.
.PRINT OPTIONS
PRINT MODEL ATOMS ( OVERVIEW )
PRINT ABUNDANCES
PRINT MAX. REL. CORRECTIONS EVERY 1 ITERATIONS
PRINT INTEGRATED SURFACE FLUX,ITERATION:EACH
PRINT CP - TIME /ITERATION,EACH
PLOT EMERGENT FLUX,ITERATION:LAST
PRINT OUTPUT MODEL ,ITERATION:LAST,DEPTH INCREMENT:1 (STRUCTURE ONLY)
PRINT CORRECTIONS OF LAST LINEARIZATION,ITERATION:LAST,DEPTH INCREMENT:1
LP - PLOT OPTICALLY THICK /THIN,ITERATION:LAST, FILE ONLY
PLOT IONIZATION FRACTIONS ${ IONFRAC } -8.5 2.5 -10.0 0.5
.
MACHINE ‘ hostname ‘
eos
#
cp ${MI} MODIN; chmod 600 MODIN
cp ${aa} ATOMS
cp ${ f f } FGRID
/home/rauch/data/get_OP > /dev/ null
#
${BI}/${code}_${mod}${type}${ sys } < DATEN
#
if test -s MODOUT
then
echo ”new_
NLTE_ _
model _
${ MO } created ”
cp ${MI} ${MI}_ ‘ date +% y -% m -% d}_ % H :% M :%S ‘
cp MODOUT ${ MO
chmod 600 ${ MO
l s -l ${ MO
if test -s STOP
then
cp STOP ${ MO }. converged
fi
else
echo ”no _
new_
model _
${ MO } created ” > ${ MO }. f a i l e d
touch ${ MO }.failed@$HOSTNAME
echo ”no _
new_
model _
${ MO } created ”
if test -s MODTMP
then
echo ”model _
found _
from _
i t e r a t i o n _
before _
f a i l u r e ”
cp ${MI} ${MI}_ ‘ date +% y -% m -% d_ % H :% M :%S ‘
cp MODTMP ${ MO }_tmp
l s -l ${ MO }_tmp
fi
fi
#
if test -s IONPLOT
then
cp IONPLOT ${ jobdir }/${name}. ${ IONFRAC }_ion
fi
if test -s PLLP
then
cp PLLP ${ jobdir }/${name}. lp
fi
if test -s PLOTCORR
then
cp PLOTCORR ${ jobdir }/${name}. corr
fi
if test -s PRFLUX
then
cp PRFLUX ${ f l x d i r }/${name}. flux
fi
if test -s STRUCTURE
then
cp STRUCTURE ${ jobdir }/${name}.T -structure
fi
#
fi
#
# do not edit the rest of this f i l e
# ####################
set + x ; ${ HOME }/. jobend ${ TMPDIR }
D.9 Naming the TMAP models
In the framework of the Virtual Observatory, TMAP models and SEDs that are calculated from them
have to follow a general rule. The models’ names have to start with Teff (TTTTTTT) and
logg (G.GG), followed by the element abundances in mass fractions. An example is
0100000_7.00_H:__9.0000E-01_HE:_1.0000E-01 .
This is suitable for a small number of elements, where the level name stays relatively short. Thus, the
general form for a model name is then
TTTTTTT_G.GG_ABUND_<nnn> ,
where nnn is a three digit integer code. ABUND_nnn corresponds to a file with the same name (located
e.g. in the model directory). It has the form
H
9.0000E-01
<source ...>
HE
3.0000E-05
<source ...>
C
4.0000E-06
<source ...>
N
2.0000E-06
<source ...>
O
1.0000E-05
<source ...>
NE
2.0000E-03
<source ...>
SI
8.0000E-06
<source ...>
FE
1.0000E-03
<source ...>
NI
2.0000E-05
<source ...>
Please use one line per element, starting with the TMAP element code. The abundances are in mass
fraction. The entry for the source of the abundances is optional and format free. Avoid to use any
string that will be erroneously identified as an element code by a UNIX grep command!
In the TMAP jobs, the following has to be inserted to set some shell variables (${moddir} is the model
directory, ${abund_old} and ${abund_new} may be used for different abundances).
#
abund_old="ABUND_001"
abund_new="ABUND_001"
#
#
# abundances in mass fraction (see files)
#
# old abundances
oldabund=${moddir}/${abund_old}
#
Hold=`grep "H
" ${oldabund} | awk '{ print $2 }'`
HEold=`grep "HE
" ${oldabund} | awk '{ print $2 }'`
Cold=`grep "C
" ${oldabund} | awk '{ print $2 }'`
Nold=`grep "N
" ${oldabund} | awk '{ print $2 }'`
Oold=`grep "O
" ${oldabund} | awk '{ print $2 }'`
NEold=`grep "NE
" ${oldabund} | awk '{ print $2 }'`
SIold=`grep "SI
" ${oldabund} | awk '{ print $2 }'`
FEold=`grep "FE
" ${oldabund} | awk '{ print $2 }'`
NIold=`grep "NI
" ${oldabund} | awk '{ print $2 }'`
#
#
# new abundances
newabund=${moddir}/${abund_new}
#
Hnew=`grep "H
" ${newabund} | awk '{ print $2 }'`
HEnew=`grep "HE
" ${newabund} | awk '{ print $2 }'`
Cnew=`grep "C
" ${newabund} | awk '{ print $2 }'`
Nnew=`grep "N
" ${newabund} | awk '{ print $2 }'`
Onew=`grep "O
" ${newabund} | awk '{ print $2 }'`
NEnew=`grep "NE
" ${newabund} | awk '{ print $2 }'`
SInew=`grep "SI
" ${newabund} | awk '{ print $2 }'`
FEnew=`grep "FE
" ${newabund} | awk '{ print $2 }'`
NInew=`grep "NI
" ${newabund} | awk '{ print $2 }'`
#
In the input files of e.g. PRO2 respective cards have to use the XXnew variables (XX is the
element):
CHANGE
ABUNDANCE
H
${Hnew}
MASS FRACTION
CHANGE
ABUNDANCE
HE
${HEnew}
MASS FRACTION
CHANGE
ABUNDANCE
C
${Cnew}
MASS FRACTION
CHANGE
ABUNDANCE
N
${Nnew}
MASS FRACTION
CHANGE
ABUNDANCE
O
${Onew}
MASS FRACTION
CHANGE
ABUNDANCE
NE
${NEnew}
MASS FRACTION
CHANGE
ABUNDANCE
SI
${SInew}
MASS FRACTION
CHANGE
ABUNDANCE
FE
${FEnew}
MASS FRACTION
CHANGE
ABUNDANCE
NI
${NInew}
MASS FRACTION