Skip to content

Commit c34c0e6

Browse files
authored
Merge pull request #14768 from cxp484/master
FDS Utilities: Fix the fds_prop to allow False
2 parents 257ffb8 + e71fe0f commit c34c0e6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Utilities/Python/scripts/cantera_yaml_2_fds.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,24 @@
55
import sys
66
import math
77

8+
# Define str2bool function
9+
def str2bool(v):
10+
if isinstance(v, bool):
11+
return v
12+
if v.lower() in ('yes', 'true', 't', 'y', '1'):
13+
return True
14+
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
15+
return False
16+
else:
17+
raise argparse.ArgumentTypeError('Boolean value expected.')
18+
819
parser = argparse.ArgumentParser()
920

1021
parser.add_argument("--background", help="Background species formula",default='noinput',required=True)
1122
parser.add_argument("--yaml_file",help="yaml file",default='noinput',required=True)
1223
parser.add_argument("--spec_file",help="Cantera to FDS species name lookup csv file (default is yaml_file.spec) with column headings FORMULA and NAME ",default='noinput')
13-
parser.add_argument("--fds_prop",help="Set to True (default) to use FDS properties when species is in spec_file. ",type=bool,default=True)
24+
parser.add_argument("--fds_prop", type=str2bool, nargs='?', const=True, default=True,
25+
help="Set to True (default) to use FDS properties when species is in spec_file.")
1426
parser.add_argument("--radcal",help="Set to True (default) to use the RADCAL ID in the spec_file. ",type=bool,default=True)
1527
parser.add_argument("--mf0_file",help="csv file containing MASS_FRACTION_0 with column headings FORMULA and MF0",default='noinput')
1628
args = parser.parse_args()

0 commit comments

Comments
 (0)