-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert
executable file
·49 lines (42 loc) · 1.53 KB
/
convert
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
#!/bin/sh -e
MECH=$1
if [ ! -d "$MECH" ]; then
echo "Please provide mechanism name"
exit 1
fi
. ./setpaths $MECH
. ./clean $MECH
mkdir $DIR_CANTERA $DIR_PYJAC
# echo -n "Running chemkinToFoam..."
# # echo "creating temporary $CHEMKIN_THERMO.foam file with first line listing species"
# chemkinToFoam -newFormat $CHEMKIN_CHEM $CHEMKIN_THERMO $CHEMKINTOFOAM_TRANSPORT $OPENFOAM_CHEM $OPENFOAM_THERMO
# echo "Done"
if [ -f "$CANTERA_ORIG_CHEM" ]; then
echo "[$0] Found original .cti file! Skipping ck2cti run..."
cp $CANTERA_ORIG_CHEM $CANTERA_CHEM
else
echo "[$0] Running ck2cti..."
# check if file exists, because for some mechs .inp has all the data
if [ -f "$CHEMKIN_THERMO" ]; then
THERMO_OPTION=--thermo=$CHEMKIN_THERMO
fi
if [ -f "$CHEMKIN_TRANSPORT" ]; then
TRANSPORT_OPTION=--transport=$CHEMKIN_TRANSPORT
fi
python -m cantera.ck2cti --input=$CHEMKIN_CHEM $THERMO_OPTION $TRANSPORT_OPTION -d --output=$CANTERA_CHEM --permissive | tee $MECH/log.ck2cti
echo "[$0] Done"
fi
echo "[$0] Running cti2yaml..."
python -m cantera.cti2yaml $CANTERA_CHEM
echo "[$0] Done"
echo "[$0] Running ct2foam..."
ct2foam --input $CANTERA_CHEM --output $DIR_PYJAC --Tmid 1000.0 --plot | tee $MECH/log.ct2foam
echo "[$0] Done"
echo "[$0] Running pyjac2foam..."
python -m pyjac --lang c --last_species N2 --input $CANTERA_CHEM | tee $MECH/log.pyjac
pyjac2foam.sh -m $CANTERA_CHEM -i out -c | tee $MECH/log.pyjac2foam
mv foam $DIR_PYJAC/
mv lib $DIR_PYJAC/
mv out $DIR_PYJAC/
echo "[$0] Done"
echo "All done."