From f20168a1a671dafc350f302f5e56a0b2b267ded2 Mon Sep 17 00:00:00 2001 From: Rick-Methot-NOAA Date: Thu, 19 Feb 2026 11:26:34 -0800 Subject: [PATCH 1/2] redo_SRR7_fix with IF --- SS_recruit.tpl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/SS_recruit.tpl b/SS_recruit.tpl index 73f1d102..93018eef 100644 --- a/SS_recruit.tpl +++ b/SS_recruit.tpl @@ -388,14 +388,15 @@ FUNCTION dvar_vector Equil_Spawn_Recr_Fxn(const dvar_vector& SRparm, // 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 +// dvariable join1 = 1. / (1. + mfexp(1000. * (-temp))); // steep logistic joiner + dvariable temp1 = 1.0e-09; // sqrt( square( join1 * temp)); // to make small negative values positive + if (temp > 1.0e-9) + {temp1 = temp;} 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; +// 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; } From 70550fc3711f12d602aa8011b21dfe1114c98cb1 Mon Sep 17 00:00:00 2001 From: Rick-Methot-NOAA Date: Fri, 20 Feb 2026 11:07:36 -0800 Subject: [PATCH 2/2] one more try on SRR7 equil calcs --- SS_recruit.tpl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/SS_recruit.tpl b/SS_recruit.tpl index 93018eef..bc1b81f0 100644 --- a/SS_recruit.tpl +++ b/SS_recruit.tpl @@ -385,16 +385,19 @@ 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))); dvariable temp = (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )); -// dvariable join1 = 1. / (1. + mfexp(1000. * (-temp))); // steep logistic joiner - dvariable temp1 = 1.0e-09; // sqrt( square( join1 * temp)); // to make small negative values positive if (temp > 1.0e-9) - {temp1 = temp;} - B_equil = Recr_virgin_use * SPR0 * pow( temp1, (1. / SRparm(3))); - R_equil = B_equil / SSBpR_current; + { + 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;