Skip to content

Commit

Permalink
Fixes error pointed out by Jinliang in SOC interpolation function (#1314
Browse files Browse the repository at this point in the history
)

* Fixes error pointed out by Jinliang in interpolation function

* add note

* fix typo

---------

Co-authored-by: Ludovico Bianchi <lbianchi@lbl.gov>
  • Loading branch information
dallan-keylogic and lbianchi-lbl authored Jan 23, 2024
1 parent 690eb5e commit f07552d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,12 @@ def _interpolate_2D(
phi_bound_1: expression for the value of the quantity to be interpolated
at the 1 bound
derivative: If True estimate derivative
method: interpolation method currently only CDS is supported
Returns:
expression for phi at face
"""
# TODO add tests to ensure this function works as designed
# Also, user beware, use of CV_Bound enums is untested
icu = ic - 1
icd = ic
if ic == ifaces.first():
Expand All @@ -203,7 +204,7 @@ def _interpolate_2D(
if not derivative:
cf = faces.at(ic)
lambf = (cd - cf) / (cd - cu)
return (1 - lambf) * phi_func(icu) + lambf * phi_func(icd)
return (1 - lambf) * phi_func(icd) + lambf * phi_func(icu)
else:
# Since we are doing linear interpolation derivative is the slope
# between node centers even if they are not evenly spaced
Expand Down

0 comments on commit f07552d

Please sign in to comment.