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

D.3 Creation of a frequency grid with SETF2

D.4 Adaption of the Parameter files

D.5 Calculation of a start model with LTE2

D.6 Calculation of a NLTE model with PRO2

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 temperatureATOMSFGRID

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 tmin and/or tmax (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 t = 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


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

D.8.3 Parameter files

D.8.4 LTE2


#!/ 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


#!/ 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