Skip to content

Commit

Permalink
Merge pull request arfc#100 from yardasol/fix-j312
Browse files Browse the repository at this point in the history
Fix bugs in `process_j312.sh`
  • Loading branch information
yardasol authored Jan 28, 2022
2 parents 66bbd90 + e513d1b commit 88c5c94
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 22 deletions.
5 changes: 3 additions & 2 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ of your SaltProc simulations.

### `xsdata`
The script in this directory downloads and processes the JEFF
3.1.2 cross section library for running the integration tests
3.1.2 cross section library -- as well as spontaneous and delayed fission neutron and
decay data -- for running the integration tests
on a UNIX-like machine. Set the `DATADIR` variable inside
the script to the directory where you want to store the cross
section libraries.
Expand All @@ -18,5 +19,5 @@ which will download and process the libraries at all available temperatures.

To run the script, execute
```
source process_j312.sh
source process_j312.bash
```
67 changes: 47 additions & 20 deletions scripts/xsdata/process_j312.sh → scripts/xsdata/process_j312.bash
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
################
### DOWNLOAD ###
################
#DATADIR is the directory where the xs library is extracted to
DATADIR=$(pwd)
# DATADIR is the directory where the xs library is extracted to
# @yardasol reccomends naming the parent directory where the files
# will be extractd to as "jeff312"
DATADIR=$PWD/jeff312
LN="https://www.oecd-nea.org/dbforms/data/eva/evatapes/jeff_31/JEFF312/ACE/"
SLUG="ACEs_"
EXT="K.zip"
Expand All @@ -17,29 +19,47 @@ TEMPS=(900)

for T in ${TEMPS[@]}
do
wget -P $DATADIR $LN$SLUG$T$EXT
if [[ ! -f $DATADIR/$SLUG$T$EXT ]]
then
wget -P $DATADIR $LN$SLUG$T$EXT
fi
done

# Get thermal XS
wget -O $DATADIR/ACEs_THERMK.zip $LN$SLUG1
if [[ ! -f $DATADIR/ACEs_THERMK.zip ]]
then
wget -O $DATADIR/ACEs_THERMK.zip $LN$SLUG1
fi


# Get neutron induced and spontaneous fission yield data from JEFF 3.3
if [[ ! -f $DATADIR/sss_jeff33.nfy ]]
then
wget -O $DATADIR/sss_jeff33.nfy https://www.oecd-nea.org/dbdata/jeff/jeff33/downloads/JEFF33-nfy.asc
fi

# Get neutron induces and spontaneous fission yield data from JEFF 3.3
wget -O $DATADIR/sss_jeff33.nfy https://www.oecd-nea.org/dbdata/jeff/jeff33/downloads/JEFF33-nfy.asc
wget -O $DATADIR/sss_jeff33.sfy https://www.oecd-nea.org/dbdata/jeff/jeff33/downloads/JEFF33-sfy.asc
if [[ ! -f $DATADIR/sss_jeff33.sfy ]]
then
wget -O $DATADIR/sss_jeff33.sfy https://www.oecd-nea.org/dbdata/jeff/jeff33/downloads/JEFF33-sfy.asc
fi

# Also get decay chains
if [[ ! -f $DATADIR/sss_jeff33.dec ]]
then
wget -O $DATADIR/sss_jeff33.dec https://www.oecd-nea.org/dbdata/jeff/jeff33/downloads/JEFF33-rdd_all.asc
fi

###############
### PROCESS ###
###############
DIRFILE=$DATADIR/sss_jeff312.xsdir
echo "datapath=$DATADIR/jeff312/acedata" | cat - > $DIRFILE
echo "datapath=$DATADIR/acedata" | cat - > $DIRFILE
echo "atomic weight ratios" | cat - >> $DIRFILE
mkdir -p $DATADIR/acedata

TEMPS=(900 "THERM")
#Uncomment if you have dowloaded the entire JEFF 3.1.2 libary
#TEMPS=(500 600 800 900 1000 1200 1500 "THERM")
TEMPS+=("THERM")

# Regular expressions for changing the ZAI of
# Regular expressions for changing the ZAI of
# metastable isotopes
REGEXMETA=[A-Z][a-z]{0,1}[0-9]{1,3}M
REGEXZAI=[0-9]{1,3}[0-9]{3}\.[0-9]{2}c
Expand All @@ -53,7 +73,7 @@ do
#Create directories for each temp and extract
mkdir -p $DATADIR/$T
unzip -j $DATADIR/ACEs_$T$EXT -d $DATADIR/$T

# Change filenames to include temperature so we can put them all in the same
# directory
if [[ $T == "THERM" ]]
Expand Down Expand Up @@ -87,10 +107,10 @@ do

# Convert DOS to UNIX
awk '{sub("\r$", ""); print }' $file > temp.ACE
mv temp.ACE > $file
mv temp.ACE $file

# Get atomic weights
if [[ $T == 900 ]]
if [[ $T == ${TEMPS[0]} ]]
then
LN="$(head -n 1 $PRE.dir)"
[[ $LN =~ $REGEXZAI ]]
Expand All @@ -101,16 +121,23 @@ do
ZAI="${ZAI:0:$len-4}"
echo " $ZAI $AWT" | cat - >> $DIRFILE
fi

mv "$file" ${arr[0]}$SUF
done

mv $DATADIR/$T/*.ACE $DATADIR/acedata/.

echo "directory" | cat - >> $DIRFILE
# Add the "directory" line only once
if [[ $T == ${TEMPS[0]} ]]
then
echo "directory" | cat - >> $DIRFILE
fi

# Add dir files to global dir file
cat $DATADIR/$T/*.dir >> $DIRFILE
cat $DATADIR/$T/*.dir >> $DIRFILE

# Cleanup
rm $DATADIR/$T/*.dir
rm -r $DATADIR/$T

done

0 comments on commit 88c5c94

Please sign in to comment.