Skip to content

Commit

Permalink
Corrected for differing KPP and MICM coefficient conventions.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwfncar committed Aug 18, 2023
1 parent d3fe44c commit bc3fffb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
13 changes: 9 additions & 4 deletions etc/scripts/kpp_to_micm.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,21 @@ def parse_kpp_arrhenius(kpp_str):
logging.debug(coeffs)
arr_dict = dict()
arr_dict['type'] = 'ARRHENIUS'
# note the interchange of B and C, and change of sign
# in the KPP and MICM conventions
if ('_abc(' in kpp_str):
arr_dict['A'] = coeffs[0]
arr_dict['B'] = coeffs[1]
arr_dict['C'] = coeffs[2]
arr_dict['B'] = coeffs[2]
arr_dict['C'] = - coeffs[1]
arr_dict['D'] = 300.0
elif ('_ab(' in kpp_str):
arr_dict['A'] = coeffs[0]
arr_dict['B'] = coeffs[1]
arr_dict['C'] = - coeffs[1]
arr_dict['D'] = 300.0
elif ('_ac(' in kpp_str):
arr_dict['A'] = coeffs[0]
arr_dict['C'] = coeffs[1]
arr_dict['B'] = coeffs[1]
arr_dict['D'] = 300.0
else:
logging.error('unrecognized KPP Arrhenius syntax')
logging.debug(arr_dict)
Expand Down
8 changes: 4 additions & 4 deletions etc/scripts/test_kpp_to_micm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ def test_parse_kpp_arrhenius():
arr_dict = kpp_to_micm.parse_kpp_arrhenius(
'ARR_ab(%.2e, %.2f)' % (kpp_A, kpp_B))
assert arr_dict['A'] == kpp_A
assert arr_dict['B'] == kpp_B
assert arr_dict['C'] == - kpp_B

arr_dict = kpp_to_micm.parse_kpp_arrhenius(
'ARR_ac(%.2e, %.2f)' % (kpp_A, kpp_C))
assert arr_dict['A'] == kpp_A
assert arr_dict['C'] == kpp_C
assert arr_dict['B'] == kpp_C

arr_dict = kpp_to_micm.parse_kpp_arrhenius(
'ARR_abc(%.2e, %.2f, %.2f)' % (kpp_A, kpp_B, kpp_C))
assert arr_dict['A'] == kpp_A
assert arr_dict['B'] == kpp_B
assert arr_dict['C'] == kpp_C
assert arr_dict['C'] == - kpp_B
assert arr_dict['B'] == kpp_C

0 comments on commit bc3fffb

Please sign in to comment.