nmfs-ost / ss3-source-code

The source code for Stock Synthesis (SS3).
https://nmfs-ost.github.io/ss3-website/
Creative Commons Zero v1.0 Universal
38 stars 16 forks source link

[Bug]: timing for spawnbio calculation incorrect in seasonal model and spawning not at start of season #619

Closed Rick-Methot-NOAA closed 2 months ago

Rick-Methot-NOAA commented 2 months ago

Describe the bug

In a seasonal model with spawnmonth not set to the beginning of a season, the reported spawnbio was lower than expected. Investigation found that there was no discrepancy with spawnmonth at beginning of a season. And that the magnitude of difference was in accord with being off by exp(-z*seasdur)

The model output for spawntiming as shown in echoinput was: 2 N seasons 6 6 months/seas (fractions OK) 2 Number of subseasons (even number only; min 2) for calculation of ALK 0.5 0.5 processed season duration (frac. of year) 0.25 0.25 processed subseason duration (frac. of year) processed subseason cumulative annual time within season 0 0.25 0 0.25 SPAWN month: 5.5; seas: 1; subseas_for_ALK: 2; timing_in_season: 0.75

Note that timing is as a fraction of the season. When the value gets used in internal calculations, season duration was not being taken into account: SSB_pop_gp(y, p, GP4(g)) += fracfemale_mult * fec(g) * elem_prod(natage(t, p, g), mfexp(-Z_rate(t, p, g) * spawn_time_seas)); // accumulates SSB by area and by growthpattern

Solution will be to adjust spawn_time_seas by duration of the season.

To Reproduce

per what is shown above

Expected behavior

spawnbio calculation to decay by exp(-Z) within the season

Screenshots

No response

Which OS are you seeing the problem on?

No response

Which version of SS3 are you seeing the problem on?

This has probably been an error throughout the history of 3.30.

Additional Context

No response