Skip to content

Commit

Permalink
Cap to a smaller maximum time step of 50 Myr.
Browse files Browse the repository at this point in the history
  • Loading branch information
lsoucasse committed Nov 18, 2024
1 parent 90a8dcd commit 7648536
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/mors/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ def SetDefaultParameters(paramsDefault):
"""Sets up the default parameters."""

# Time integration solver parameters
paramsDefault['TimeIntegrationMethod'] = 'RosenbrockFixed' # options are 'ForwardEuler', 'RungeKutta4', 'RungeKuttaFehlberg', 'Rosenbrock'
paramsDefault['TimeIntegrationMethod'] = 'RosenbrockFixed'# options are 'ForwardEuler', 'RungeKutta4', 'RungeKuttaFehlberg', 'Rosenbrock' and 'RosenbrockFixed'
paramsDefault['nStepMax'] = 10**6 # maximum number of timesteps to allow before error
paramsDefault['DeltaDesired'] = 1.0e-5 # desired Delta value to use in numerical solvers such as Runge-Kutta-Fehlberg and Rosenbrock
paramsDefault['AgeMinDefault'] = 1.0 # Myr - default age to start evolutionary tracks
paramsDefault['AgeMaxDefault'] = 5000.0 # Myr - default age to end evolutionary tracks
paramsDefault['deltaJac'] = 1.0e-5 # pertubation to use when calculating Jacobian for Rosenbrock solver
paramsDefault['CoefficientsRB'] = _CoefficientsRB() # all coefficents needed for the Rosenbrock solver
paramsDefault['dAgeMin'] = 1.0e-5 # Myr - minimum timestep to allow
paramsDefault['dAgeMax'] = 5000.0 # Myr - maximum timestep to allow
paramsDefault['dAgeMax'] = 50.0 # Myr - maximum timestep to allow

# Physical processes to include
paramsDefault['CoreEnvelopeDecoupling'] = True # should core envelope decoupling be included
Expand Down
4 changes: 3 additions & 1 deletion src/mors/rotevo.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,9 @@ def _EvolveRotationStepRBFixed(Mstar=None,Age=None,OmegaEnv=None,OmegaCore=None,
CoefficientsRB = params['CoefficientsRB']

# Get time step
dAge = min(0.1 * np.power(Age, 0.75), dAgeMax)
dAge = 0.1 * np.power(Age, 0.75)
dAge = min( dAge , dAgeMax )
dAge = min( dAge , params['dAgeMax'] )
dAgeNew = dAge

# Setup array to hold integration values
Expand Down
4 changes: 2 additions & 2 deletions tests/test_spada_RB.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
TEST_DATA = (
((0.128, 45.2, 8.5e1),(0.21264087, 1.68629162e+31, 1.74475018e+28)),
((1.113, 17.7, 3.2e3),(1.16581971, 6.81767904e+33, 7.94621466e+28)),
((0.995, 1.005, 1.0e4),(1.48938741e+00, 7.80623475e+33, 3.11812348e+28)),
((1.000, 1.00, 1.0e4),(1.52623102e+00, 8.13153012e+33, 3.23080690e+28)),
((0.995, 1.005, 1.0e4),(1.48910765e+00, 7.80659378e+33, 3.16581356e+28)),
((1.000, 1.00, 1.0e4),(1.52588718e+00, 8.13197065e+33, 3.29155751e+28)),
)

@pytest.mark.parametrize("inp,expected", TEST_DATA)
Expand Down

0 comments on commit 7648536

Please sign in to comment.