Skip to content

Commit 87091ff

Browse files
adjust plusgroup calc
1 parent 62a5aa8 commit 87091ff

1 file changed

Lines changed: 23 additions & 18 deletions

File tree

SS_biofxn.tpl

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ FUNCTION void get_growth2(const int y)
706706
(-VBK_work - (-VBK_work / Richards(gp)) * (log(exp(Richards(gp) * (real_age(g, 1, a) + 1 - t50)) + 1) - log(exp(Richards(gp) * (real_age(g, 1, a) - t50)) + 1))) * seasdur(s);
707707
}
708708
}
709-
if(a<4 && g==1) echoinput <<a<<" G2:-T50 "<<t50<<" VBK: "<<-VBK_work<<" start_size "<<Ave_Size(t, 1, g, a)<<" incre " << t2<<" result "<<Ave_Size(t + 1, 1, g, dest_a(s,a))<<endl;
709+
// if(a<4 && g==1) echoinput <<a<<" G2:-T50 "<<t50<<" VBK: "<<-VBK_work<<" start_size "<<Ave_Size(t, 1, g, a)<<" incre " << t2<<" result "<<Ave_Size(t + 1, 1, g, dest_a(s,a))<<endl;
710710
} // done ageloop
711711
break;
712712
}
@@ -767,30 +767,35 @@ FUNCTION void get_growth2(const int y)
767767
else // Linf_decay == -997 or a positive Linf_decay is used in initial year growth
768768
{
769769
if (do_once == 1 && timevary_MG_firstyr == y && g == 1)
770-
{
771-
warnstream << "plus group mean size is updated in years with time-vary growth beginning in: " << y << "; can turn this off with Linf_decay = -998";
772-
write_message (NOTE, 0);
773-
}
774-
t2 = plusgroupsize - Ave_Size(t, 1, g, nages -1);
775-
if (t2 < 0.0) // trap to prevent decrease in size-at-age
776-
{
777-
join1 = 1.0 / (1.0 + mfexp(100. * t2 ));
778-
plusgroupsize = Ave_Size(t, 1, g, nages) * join1 + plusgroupsize * (1 - join1);
779-
if (do_once == 1 && g == 1)
780-
echoinput << y << " " << a << " prevent plusgroup shrink-G2 " << t2 << " " << join1 << " " << Ave_Size(t, 1, g, nages) << " " << plusgroupsize << endl;
781-
}
770+
{
771+
warnstream << "plus group mean size is updated in years with time-vary growth beginning in: " << y << "; can turn this off with Linf_decay = -998";
772+
write_message (NOTE, 0);
773+
}
774+
t2 = plusgroupsize - Ave_Size(t, 1, g, nages -1);
775+
if (t2 < 0.0) // trap to prevent decrease in size-at-age
776+
{
777+
join1 = 1.0 / (1.0 + mfexp(100. * t2 ));
778+
plusgroupsize = Ave_Size(t, 1, g, nages) * join1 + plusgroupsize * (1 - join1);
779+
if (do_once == 1)
780+
echoinput << y << " " << a << " prevent plusgroup shrink-G2 " << t2 << " " << join1 << " " << Ave_Size(t, 1, g, nages) << " " << plusgroupsize << endl;
781+
}
782782
783783
// numbers weighted averaging uses numbers from the previous year (nseas) because numbers are not yet calculated for this year
784-
temp = ((natage(t - nseas, 1, g, nages - 1) + 0.01) * Ave_Size(t + 1, 1, g, nages) + (natage(t - nseas, 1, g, nages) + 0.01) * plusgroupsize) / (natage(t - nseas, 1, g, nages - 1) + natage(t - nseas, 1, g, nages) + 0.02);
785-
if (do_once == 1 && g == 1) // show calculation once
786-
echoinput << " Year: " << y << " " << s << " +group calc: "
787-
<< " N _entering: " << natage(t - nseas, 1, g, nages - 1) << " N_in_+group: " << natage(t - nseas, 1, g, nages) << " size in: " << Ave_Size(t + 1, 1, g, nages) << " old +size: " << plusgroupsize << " "
784+
int plustime;
785+
if (nseas == 1)
786+
{plustime = t;}
787+
else
788+
{plustime = t - nseas;} // because numbers are not yet calculated for later seasons
789+
temp = ((natage(plustime, 1, g, nages - 1) + 0.01) * Ave_Size(t + 1, 1, g, nages) + (natage(plustime, 1, g, nages) + 0.01) * plusgroupsize) / (natage(plustime, 1, g, nages - 1) + natage(plustime, 1, g, nages) + 0.02);
790+
if (do_once == 1) // show calculation once
791+
echoinput << " Year: " << y << " " << s << " +group calc: "
792+
<< " N _entering: " << natage(plustime, 1, g, nages - 1) << " N_in_+group: " << natage(plustime, 1, g, nages) << " size in: " << Ave_Size(t + 1, 1, g, nages) << " old +size: " << plusgroupsize << " "
788793
<< " new_+size " << temp << endl;
789794
Ave_Size(t + 1, 1, g, nages) = temp;
790795
}
791796
}
792797
793-
if (do_once == 1 && g==1)
798+
if (do_once == 1)
794799
echoinput << y << " " << s << " t+1: " << t+1 << " G2+ seas.sub: " << s << "." << 1 <<" g:" << g <<" size: " << Ave_Size(t, 1, g)(0, min(4, nages)) <<" size+: " << Ave_Size(t + 1, 1, g)(0, min(4, nages)) << " plusgroup: " << Ave_Size(t + 1, 1, g, nages) << " Linf: " << L_inf(gp)<< " VBK: " << VBK_by_seas << endl;
795800
} // end of season
796801

0 commit comments

Comments
 (0)