Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions SS_recruit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -385,17 +385,21 @@ FUNCTION dvar_vector Equil_Spawn_Recr_Fxn(const dvar_vector& SRparm,
// SRZ_surv = mfexp((1. - pow((B_equil / SSB_virgin_use), SRparm(3))) * (srz_min - SRZ_0) + SRZ_0); // survival
// R_equil = B_equil * SRZ_surv;
dvariable SPR0 = SSB_virgin_use / Recr_virgin_use;
// warning << "SPR: " << SSBpR_current / SPR0 << " Old: " << B_equil << " " << R_equil;

// formula: pow( (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )), (1. / SRparm(3)));
// use a join fxn to keep the quantity positive
dvariable temp = (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) ));
dvariable join1 = 1. / (1. + mfexp(40. * (-temp))); // steep logistic joiner
dvariable temp1 = sqrt( square( join1 * temp)); // to make small negative values positive
B_equil = Recr_virgin_use * SPR0 * pow( temp1, (1. / SRparm(3)));
R_equil = B_equil / SSBpR_current;
// warning << " log(SPR): " << log (SPR0 / SSBpR_current) << " denom " << steepness * log (SPR0) << " base: " <<
// (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )) << " temp: " << temp << " join " << join1 << " temp1: " << temp1 << " New: " << B_equil << " " << R_equil << endl;
if (temp > 1.0e-9)
{
B_equil = Recr_virgin_use * SPR0 * pow( temp, (1. / SRparm(3)));
R_equil = B_equil / SSBpR_current;
}
else
{
B_equil = 1.0e-06;
R_equil = 1.0e-06;
}
// warning << SSBpR_current/SPR0 << " log(SPR): " << log (SPR0 / SSBpR_current) << " denom " << steepness * log (SPR0) << " base: " <<
// (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )) << " temp: " << temp << " join " << join << " temp1: " << temp1 << " New: " << B_equil << " " << R_equil << endl;
break;
}

Expand Down
Loading