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

Commit

Permalink
Fixed problem with unit conversion for the CHK_QMIN_RANGE value. Also…
Browse files Browse the repository at this point in the history
… set it so that the default rmin value is the central body radius, rather than the solar radius
  • Loading branch information
daminton committed Feb 26, 2024
1 parent 1b7f1ba commit cba1f77
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions swiftest/simulation_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def __init__(self,read_param: bool = False,
The name of the time unit. When setting one of the standard units via `TU` a name will be
automatically set for the unit, so this argument will override the automatic name.
Parameter input file equivalent is None
rmin : float, default value is the radius of the Sun in the unit system defined by the unit input arguments.
rmin : float, default value is the radius of the central body in the unit system defined by the unit input arguments.
Minimum distance of the simulation
Parameter input file equivalent are `CHK_QMIN`, `CHK_RMIN`, `CHK_QMIN_RANGE[0]`
rmax : float, default value is 10000 AU in the unit system defined by the unit input arguments.
Expand Down Expand Up @@ -776,7 +776,7 @@ def set_parameter(self,
"MU_name": None,
"DU_name": None,
"TU_name": None,
"rmin": constants.RSun / constants.AU2M,
"rmin": None,
"rmax": 10000.0,
"qmin_coord": "HELIO",
"gmtiny": 0.0,
Expand Down Expand Up @@ -2008,7 +2008,8 @@ def _update_param_units(self, MU2KG_old, DU2M_old, TU2S_old):
if CHK_QMIN_RANGE is not None:
CHK_QMIN_RANGE = CHK_QMIN_RANGE.split(" ")
for i, v in enumerate(CHK_QMIN_RANGE):
CHK_QMIN_RANGE[i] = float(CHK_QMIN_RANGE[i]) * self.param['DU2M'] / DU2M_old
if float(v) > 0.0:
CHK_QMIN_RANGE[i] = float(v) * DU2M_old / self.param['DU2M']
self.param['CHK_QMIN_RANGE'] = f"{CHK_QMIN_RANGE[0]} {CHK_QMIN_RANGE[1]}"

if TU2S_old is not None:
Expand Down Expand Up @@ -3255,5 +3256,8 @@ def set_central_body(self,

if align_to_central_body_rotation and 'rot' in cbda:
self.data = tool.rotate_to_vector(self.data,cbda.rot.isel(time=0).values[()])


if self.param['CHK_CLOSE']:
if 'CHK_RMIN' not in self.param:
self.param['CHK_RMIN'] = cbda.radius.values.item()
return

0 comments on commit cba1f77

Please sign in to comment.