Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Fixed issue where units were being recomputed even if they hadn't cha…
Browse files Browse the repository at this point in the history
…nged
  • Loading branch information
daminton committed Nov 30, 2022
1 parent 9ab2105 commit c0d2524
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/swiftest/swiftest/simulation_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,10 @@ def set_unit_system(self,
if all(key in self.param for key in ["MU2KG","DU2M","TU2S"]):
self.GU = constants.GC * self.param["TU2S"] ** 2 * self.param["MU2KG"] / self.param["DU2M"] ** 3

if recompute_unit_values:
if recompute_unit_values and \
MU2KG_old != self.param['MU2KG'] or \
DU2M_old != self.param['DU2M'] or \
TU2S_old != self.param['TU2S']:
self.update_param_units(MU2KG_old, DU2M_old, TU2S_old)

unit_dict = self.get_unit_system(update_list, verbose)
Expand Down Expand Up @@ -1868,7 +1871,6 @@ def update_param_units(self, MU2KG_old, DU2M_old, TU2S_old):
if MU2KG_old is not None:
for k in mass_keys:
if k in self.param:
print(f"param['{k}']: {self.param[k]}")
self.param[k] *= MU2KG_old / self.param['MU2KG']

if DU2M_old is not None:
Expand Down

0 comments on commit c0d2524

Please sign in to comment.