Skip to content

Commit

Permalink
Merge pull request #3 from ukaea/dev-mijin-1.0.3.-hotfix
Browse files Browse the repository at this point in the history
Fixed divide-by-zero bug in common_models.py
  • Loading branch information
SMijin authored Jul 27, 2023
2 parents 9d92f5a + 3ac5538 commit 97dd92c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG

## v1.0.3, 2023-07-27

- Minor bug fixes and code cleanup

### Bug Fixes

- Fixed divide-by-zero issue in common_models.py

## v1.0.2, 2023-06-28

- Minor calculation tree improvements and bug fixes
Expand Down
12 changes: 6 additions & 6 deletions RMK_support/common_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2511,12 +2511,12 @@ def dvEnergyTerm(

vProfile = [1 / (v**2) for v in vGrid]

drag = vGrid**2 * dv
vSum = [
0 for i in range(len(drag))
] # vGrid**2 if exact energy source is required, 0 if exactly no particle source is required (either way the error is negligible)
vSum[:-1] = vGrid[1:] ** 2 - vGrid[:-1] ** 2
drag = drag / vSum
drag = dv * np.ones(len(vGrid))
vSum = np.zeros(
len(drag)
) # ones if exact energy source is required, 0 if exactly no particle source is required (either way the error is negligible)
vSum[:-1] = vGrid[:-1] ** 2 / (vGrid[1:] ** 2 - vGrid[:-1] ** 2)
drag = drag * vSum
normConst = sc.CustomNormConst(multConst=multConst)

newTerm = sc.GeneralMatrixTerm(
Expand Down
4 changes: 2 additions & 2 deletions examples/sk_comp_thesis_kin.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ def generatorSKThesisKin(**kwargs) -> RKWrapper:
elCondConst = 125*(1+433*sqrt2*ionZ/360)/(32*delta)

#Taken from config after initialization
qNorm = 0.30049520576485995E+8
qNorm = skNorms["heatFlux"]

normalizationConst = rk.normalization["eVTemperature"]**3.5/(lengthNorm*qNorm)
normalizationConst = tempNorm**3.5/(lengthNorm*qNorm)
kappaDeriv = sc.simpleDerivation(-elCondConst*nConstGradT*normalizationConst, [2.5,-1.0])
rk.addCustomDerivation("kappa", kappaDeriv)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="RMK_support",
version="1.0.2",
version="1.0.3",
packages=["RMK_support"],
install_requires=[
"numpy",
Expand Down

0 comments on commit 97dd92c

Please sign in to comment.