From 084d8ab04df5670c72a7eebc28c66ca459e6a270 Mon Sep 17 00:00:00 2001 From: Kevin Cazelles Date: Tue, 11 Mar 2025 10:20:58 -0400 Subject: [PATCH 01/11] Remove MacOS .DS_Store file and .Rhistory --- .DS_Store | Bin 14340 -> 0 bytes atlantis/.DS_Store | Bin 32772 -> 0 bytes example/.DS_Store | Bin 10244 -> 0 bytes example/.Rhistory | 119 ------------------------------------- example/inputs/._.DS_Store | Bin 4096 -> 0 bytes 5 files changed, 119 deletions(-) delete mode 100755 .DS_Store delete mode 100755 atlantis/.DS_Store delete mode 100755 example/.DS_Store delete mode 100755 example/.Rhistory delete mode 100644 example/inputs/._.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100755 index 4bb8cab192b34e1bd4b5ec9cd0e0fb1cf4970728..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14340 zcmeHNdvFz389%>GAbZQ*W)q;WK**&L$Up)~NJ2t*+&mCMpga=tf*Nk_UC7GjZn%4s z(8g5M(iinr9ej>jsamzQjYjm_?wcxZkeK>Zi|FpJ)j@9p+a}zcOEK>Uy8CR)O_r2A3ne3S z%G4}M)3UB^?r{d2laXY};-wbHvAai}Bi*f*IoPGosCVMYh!r;zLcxleB(l5B zipQM6I;TG#bA@iRYzR>5(q|71Rje#23YC=&7lnpO%d4u2LRIBu!@~h}X2J5B9bNnF z-nes%oETDz1JlwbdgR=*wD*-ZN1fh2kLEe-;@y#0aAxUCx4rT6+H;T7>%>O)G0tDB zujfMFZp{7(W0$c8=CCN+&rFtJdufNpW@e-9L{q;kEt{A{Z(sN?k%SepNcJEhpqKSc zAbt3qr9G&5@S>x}7#dnpQCbu#ttuC=sVE@`Rj;f}gAIoTrAc9PD>bGWA?8NyZUQ&g zOKb8XNPDR1$q6LffqH50jO8OXIhFDxHE`LqVDNIIwXLnSy`!^B*ZW;_hiONW)_~a% zNt$k#p6!xrHAbEIwuCuAF4Y!w?Ec<3wd6!2cC?>_&05=Twyu@Z(S&2$+Z@+QT28#9 zGjg!SJecII?a9;w?{kb)d#CFplJ%nBc8iAM;$3ZKjxkTw3)J@hZtFn5mAppO2J?*t0sTI8cZ}w>#fkAAV^TifSg5MI zczu1sq`RyR78*+edPHq;>7`{C#lhtP-3_$tr&UI(mIcdIJr>w$N4ia0R;>(Ht9nzQ zZ9vXUR;~`NRdY}jXs1=7m*(Tj>RO{-)qkRXfRDX7;wHEDnenr4wLw)ocuQ?8MwQ$k zjhhUk)9r~Q%&mj8^6Ag0s;Iw;>cuZgExe!gF)QgLQjI%Aqi)3qELv8{*m8AMRkeTv zkEeogp?nagEC`p#lFkFEd{##8zM1VIS0AP=-OsaQ>@M~Qdz2k#&#+VM74{l?lf8`$ zOhpz{7ZrKmzJ>QIlZXh#QjVK*Z9Aoimdak%&phVfw>!VUN&K84%x z8GH$M;2XFT-^LH{Bm5XY#n13d{0_gzb9fQ2;VqoO-|-J6Q@KK!rOZ|qDCJ6pQmL#| z!b+oZmC`2PUKv@ycgga|UFo2wba!(HQlBN|j!B#;)VOI=W7Fo!_kuG$mo44ridnN4 zaG$DPTR)0CiPaH!dSNe+KE^);(gh~cA!^K-J1=j3Ftn3g!8|ybXX;rT^y&#NePux~ zq)#Ddk;TP@RGdnVB8x@Ep^&bSf68KMStzJykoN_IZe=kQkt(dJ2?q5{^25N1d2{9( z!EmrHz`b8*LbhQ&^~AmE-1t5Rx}Rk)u$S3i*cn3iH0Xrs_n{aoP)%5F!WL}9cI+TL zUyUy85tz0K(GL1>4TcES*AcF7!Y#NJAIB%~IeYF=8Tv|5zVRl%0g=RV2?DNsmItxKQ%2$fCmhmB=w_fy{&pzWRI<~wid z$$bCge3lo~!`YDO-SyzL4$DkYL~bKL`4;dk;9KC5wLlKdJd+mweZ&Zp-i1E+W=prX z&AW{A|KDG~PO#lkUGHaVqIT~RtQ|Pb4bF94Ho)TEaTi6tJnU`rj!X4x)&-CA&&Q~) zcif5Ez2h#rdk=|>KWi|S2eTTI@$%qtXA}P0+_rp0QK-1Qs#I{>6_r$~t}cHU+;-f= zyzF*dqxVnHn z&1*`_G(!>x5y11R%9WZi!XiW%&ns(IYsM(kkg-3n4%Zq+8iUZEpy35w&o?d}(G84c zx+#KN$X2mB*2;R=5WAioWw#50`xJYcon$Yvzp^)o08Awcpy6_4V>S%T#XKy;GSpxV z)?yttq6ItAN<<)rz1W8y9KZk$5)rr-AH&T!B1phdd<9>_?f5#rn+p9O#H08%h5RS* zTRe{!a2l`Tb-b-G1&X3fQ}UGgO1@I4)F`W!HOg9LgR)WCuC(%nhyE{t%vn0YZKwM2 z9(R`F9-G9Q@*1_K#?4Jt?lb#`q#d%c$RfjCpXlwY6lb$JyVXZDe?w?}1dF%5w zsN_ewhv}vPTrk|p;r%@O6Y<->0R->q1nfK%p@JY?PwcjtAl*hgHl2v3Ky4vG`!)Rn z*dM`1aXk*>M%uIaH0{}Z7Dw?_0q$eC3wPrleBZNs^9b?Ur|}Eg#rYM%{UlD|B?;Y8 z2&XgLKTiZ<@8>(~Naf)(uLzDi4(i^|_&dpYKj*ot_wWOY-rX&q|I?4)^Z)c63@>VY z{xAL5zxx*OEpRDYV2Yf42|xe0e)9AGm$Hfcx%(FQzqbG~8=4#HXqqGBG=0YWtX+t% zJ#=xIhw0*po`nkC#Bn^z#c@0;@Z)$@LMU~kwlIIB{E*D)iPA+s2Fem-H+Qz92( MH_hk&{{#I0-woSsRR910 diff --git a/atlantis/.DS_Store b/atlantis/.DS_Store deleted file mode 100755 index 7934a4bfc608cd72a002d744358a94f41bcc80f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32772 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

n~=r#3gZgjwX3N6s9bp5z@vf% z4{;q2Dz4+v;p_N!QF&~dDHpW!J{@=zzo0z*e+EdmCGzntKL2xyCVUe42pXUNr3=FU H&-wpfmduhl diff --git a/example/.Rhistory b/example/.Rhistory deleted file mode 100755 index 348f3f6..0000000 --- a/example/.Rhistory +++ /dev/null @@ -1,119 +0,0 @@ -rm(list = ls()) # clear memory -setwd("/Users/ful083/AtlantisRepository/AtlantisTrunk/example/") -library("devtools") -library("ReactiveAtlantis") -library("proj4") -####### Compare outputs and Biomass visualization ####### -nc.current <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder2/outputSETAS.nc' -nc.old <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETAS.nc' -grp.csv <- 'SETasGroupsDem.csv' -bgm.file <- 'VMPA_setas.bgm' -cum.depths <- c(0,20,50,100,250,700,2000) ## This should be the cummulative depth of your model -## individual file -compare(nc.current, nc.out.old = NULL, grp.csv, bgm.file, cum.depths) -## compare to previous run -compare(nc.current, nc.old, grp.csv, bgm.file, cum.depths) -####### Predation analysis from the Atlantis output ####### -biom <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETASBiomIndx.txt' -diet.file <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETASDietCheck.txt' -bio.age <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETASAgeBiomIndx.txt' ## optional file. just if you want to check the predation by age -grp.csv <- 'SETasGroupsDem.csv' -## Predation by Age -predation(biom, grp.csv, diet.file, bio.age) -## No predation by Age -predation(biom, grp.csv, diet.file, bio.age = NULL) -####### Exploring predator-prey interactions from the initial conditions ####### -prm.file <- 'VMPA_setas_biol_fishing_Trunk.prm' -nc.initial <- 'INIT_VMPA_Jan2015.nc' -grp.csv <- 'SETasGroupsDem.csv' -bgm.file <- 'VMPA_setas.bgm' -cum.depths <- c(0,20,50,100,250,700,2000) ## This should be the cummulative depth of your model -feeding.mat(prm.file, grp.file, nc.initial, bgm.file, cum.depths) -####### Atlantis food web and trophic level composition ####### -grp.csv <- 'SETasGroupsDem.csv' -prm.file <- 'VMPA_setas_biol_fishing_Trunk.prm' -diet.file <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETASDietCheck.txt' -food.web(diet.file, grp.csv) -## optional you can explore the food web by polygon -food.web(diet.file, grp.file, diet.file.bypol) -## diet.file.bypol Detailed diet check file, this can be obtained as an extra output from Atlantis "DetailedDietCheck.txt". To get this file from Atlantis turn on the option "flagdietcheck" on the Run.prm file. -####### Growth of primary producers and limiting factors ####### -nc.initial <- 'INIT_VMPA_Jan2015.nc' -nc.current <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETAS.nc' -grp.csv <- 'SETasGroupsDem.csv' -prm.file <- 'VMPA_setas_biol_fishing_Trunk.prm' -growth.pp(nc.initial, grp.csv, prm.file, nc.current) -####### Analysis of recruitment and primary production ####### -nc.initial <- 'INIT_VMPA_Jan2015.nc' -nc.current <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETAS.nc' -yoy.file <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETASYOY.txt' -grp.csv <- 'SETasGroupsDem.csv' -prm.file <- 'VMPA_setas_biol_fishing_Trunk.prm' -recruitment.cal(nc.initial, nc.current, yoy.file, grp.csv, prm.file) -####### Harvest outputs and model skill assessment ####### -catch.nc <- 'outputSETASCATCH.nc' -ext.catch <- 'external_catch_time_series.csv' -cum.depths <- c(0,20,50,100,250,700,2000) ## This should be the cummulative depth of your model -fsh.csv <- 'SETasFisheries.csv' -bgm.file <- 'VMPA_setas.bgm' -grp.csv <- 'SETasGroupsDem.csv' -catch(grp.csv, fsh.csv, catch.nc, ext.catch) -rm(list = ls()) # clear memory -setwd("/Users/ful083/AtlantisRepository/AtlantisTrunk/example/") -library("devtools") -library("ReactiveAtlantis") -library("proj4") -devtools::install_github('Atlantis-Ecosystem-Model/ReactiveAtlantis', force=TRUE, dependencies=TRUE) -devtools::install_github("Atlantis-Ecosystem-Model/shinyrAtlantis", force=TRUE, dependencies=TRUE) -rm(list = ls()) # clear memory -setwd("/Users/ful083/AtlantisRepository/AtlantisTrunk/example/") -library("devtools") -library("ReactiveAtlantis") -library("proj4") -nc.current <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder2/outputSETAS.nc' -nc.old <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETAS.nc' -grp.csv <- 'SETasGroupsDem.csv' -bgm.file <- 'VMPA_setas.bgm' -cum.depths <- c(0,20,50,100,250,700,2000) ## This should be the cummulative depth of your model -## individual file -compare(nc.current, nc.out.old = NULL, grp.csv, bgm.file, cum.depths) -## compare to previous run -compare(nc.current, nc.old, grp.csv, bgm.file, cum.depths) -biom <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETASBiomIndx.txt' -diet.file <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETASDietCheck.txt' -bio.age <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETASAgeBiomIndx.txt' ## optional file. just if you want to check the predation by age -grp.csv <- 'SETasGroupsDem.csv' -## Predation by Age -## Predation by Age -predation(biom, grp.csv, diet.file, bio.age) -## No predation by Age -predation(biom, grp.csv, diet.file, bio.age = NULL) -prm.file <- 'VMPA_setas_biol_fishing_Trunk.prm' -nc.initial <- 'INIT_VMPA_Jan2015.nc' -grp.csv <- 'SETasGroupsDem.csv' -bgm.file <- 'VMPA_setas.bgm' -cum.depths <- c(0,20,50,100,250,700,2000) ## This should be the cummulative depth of your model -feeding.mat(prm.file, grp.file, nc.initial, bgm.file, cum.depths) -feeding.mat(prm.file, grp.csv, nc.initial, bgm.file, cum.depths) -grp.csv <- 'SETasGroupsDem.csv' -prm.file <- 'VMPA_setas_biol_fishing_Trunk.prm' -diet.file <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETASDietCheck.txt' -food.web(diet.file, grp.csv) -nc.initial <- 'INIT_VMPA_Jan2015.nc' -nc.current <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETAS.nc' -grp.csv <- 'SETasGroupsDem.csv' -prm.file <- 'VMPA_setas_biol_fishing_Trunk.prm' -growth.pp(nc.initial, grp.csv, prm.file, nc.current) -nc.initial <- 'INIT_VMPA_Jan2015.nc' -nc.current <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETAS.nc' -yoy.file <- '/Users/ful083/AtlantisRepository/AtlantisTrunk/example/outputFolder/outputSETASYOY.txt' -grp.csv <- 'SETasGroupsDem.csv' -prm.file <- 'VMPA_setas_biol_fishing_Trunk.prm' -recruitment.cal(nc.initial, nc.current, yoy.file, grp.csv, prm.file) -catch.nc <- 'outputSETASCATCH.nc' -ext.catch <- 'external_catch_time_series.csv' -cum.depths <- c(0,20,50,100,250,700,2000) ## This should be the cummulative depth of your model -fsh.csv <- 'SETasFisheries.csv' -bgm.file <- 'VMPA_setas.bgm' -grp.csv <- 'SETasGroupsDem.csv' -catch(grp.csv, fsh.csv, catch.nc, ext.catch) diff --git a/example/inputs/._.DS_Store b/example/inputs/._.DS_Store deleted file mode 100644 index 338bd7ba27b62046d75470a7732f6f1b01806cb5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUpMh9H2BNBh0QSWmV*mgE From 5e171f0743e476bf458ab235ce71d25b1ff0fef9 Mon Sep 17 00:00:00 2001 From: Kevin Cazelles Date: Tue, 11 Mar 2025 10:47:23 -0400 Subject: [PATCH 02/11] Fix BiTAC_sp memory allocation --- atlantis/atmanage/atManageSetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atlantis/atmanage/atManageSetup.c b/atlantis/atmanage/atManageSetup.c index 5741bf4..2de15a7 100755 --- a/atlantis/atmanage/atManageSetup.c +++ b/atlantis/atmanage/atManageSetup.c @@ -1189,7 +1189,7 @@ void Allocate_Arrays_Pre_Load(MSEBoxModel *bm) { /* These are always allocated even if the management option is off */ bm->reg_season = (int *) i_alloc1d(bm->K_num_reg); bm->phased_out = Util_Alloc_Init_2D_Double(nfleets, bm->K_num_tot_sp, 1.0); - bm->BiTAC_sp = (double ****) alloc4d(2, bm->K_num_tot_sp, totalreg_id + 1, 6); + bm->BiTAC_sp = (double ****) alloc4d(2, totalreg_id + 1, bm->K_num_tot_sp, 6); bm->BiTACamt = Util_Alloc_Init_4D_Double(2, nfleets, bm->K_num_tot_sp, 6, 0.0); bm->TACamt = Util_Alloc_Init_3D_Double(K_num_TAC_entries, nfleets, bm->K_num_tot_sp, 0.0); bm->TripCatch = Util_Alloc_Init_2D_Double(nfleets, bm->K_num_tot_sp, 0.0); From b54ffd163e562961ce02dab52d4ab54bd6de76b4 Mon Sep 17 00:00:00 2001 From: Kevin Cazelles Date: Tue, 11 Nov 2025 13:14:30 -0500 Subject: [PATCH 03/11] remove all .DS_Store --- .gitignore | 4 ---- atlantis/atecology/.DS_Store | Bin 6148 -> 0 bytes atlantis/ateconomic/.DS_Store | Bin 6148 -> 0 bytes atlantis/atlantismain/.DS_Store | Bin 6148 -> 0 bytes atlantis/atmanage/.DS_Store | Bin 6148 -> 0 bytes .../win32_vs_dll_4.0.1-beta3.tar/.DS_Store | Bin 6148 -> 0 bytes example/inputs/.DS_Store | Bin 10244 -> 0 bytes example/outputFolderPristine/.DS_Store | Bin 6148 -> 0 bytes 8 files changed, 4 deletions(-) delete mode 100755 atlantis/atecology/.DS_Store delete mode 100755 atlantis/ateconomic/.DS_Store delete mode 100755 atlantis/atlantismain/.DS_Store delete mode 100755 atlantis/atmanage/.DS_Store delete mode 100755 atlantis/externalLibs/win32_vs_dll_4.0.1-beta3.tar/.DS_Store delete mode 100755 example/inputs/.DS_Store delete mode 100755 example/outputFolderPristine/.DS_Store diff --git a/.gitignore b/.gitignore index f91e7e5..d548d16 100644 --- a/.gitignore +++ b/.gitignore @@ -16,10 +16,6 @@ autom4te.cache/ *atlantisMerged *atlantisMerged.pc .DS_Store -atlantis/.DS_Store -.DS_Store -.DS_Store Trunk2025.xcworkspace/xcuserdata/ful083.xcuserdatad/UserInterfaceState.xcuserstate -.DS_Store Trunk2025.xcworkspace/xcuserdata/ful083.xcuserdatad/UserInterfaceState.xcuserstate .Rproj.user/ diff --git a/atlantis/atecology/.DS_Store b/atlantis/atecology/.DS_Store deleted file mode 100755 index b0fcd993d245db0f556919fd36418f4a18b549e1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKxlRKy5PgOekq}Z!N`CdIsC!Kt?kt!z$0JJIpvDtkdlIdqN^0NMnqOG;YW)lB z;&xfjPMfMO>2-)JRJi93D~$1g26OD;2nU=UbI)^TS?Jy?oYQYf4l3rXi6!28ye_G4 z81qbeOd-M=A`X4+esPE(4o39m)NF!cV66k>3r8SuhX`{4)m9V0tl~a8rJ_e%YSfwVCaj sO+@@!8BjRx`~+|!=g5v4&7NgUzrwLKlq{mxaAN!jC?U}W1HZt)JF7@Iod5s; diff --git a/atlantis/ateconomic/.DS_Store b/atlantis/ateconomic/.DS_Store deleted file mode 100755 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0S5T0$TZ7D(z3gT(OYsHq9V(}7ceE}nSP^pb68jRV}wB}F>c>sMOAH?Tz zW_JTtbMPc$XJGf6ouA#z2iYG05dFE|0;mH(1skCtB}d4d>nhk_LZRoFgAZdbi6>r| zGtpl((YKc&fC%m&giqhEJoLPIlQ4*9&E~r(6iXYMWt3X^#(hwUI~&dBaep+uqS3ih zp_l0+?;;o{!}|7#ie{rA8c%gX;Eyrn`Z9=omGsp-@?)Lr8b=jnSl?SLTHT|DJm|E0 z%Z6OE+TC_T_IjP=vRc{MKRiAgK88<`dNE`QmW-J>VV%Ay&W z0cL<1UJzKw(M`x|Xc8iUK;!;vjP+z$O;DGj#UF|e} bNjk1(ozrer;NJLEc diff --git a/atlantis/atmanage/.DS_Store b/atlantis/atmanage/.DS_Store deleted file mode 100755 index f2163775d79d83cf92ae251d19035c9c380dc648..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}&BV5S|5;5@Y0GqQ|{>di()?l#61IjYs_+ZEZ|+Zm5b*2Y$C|G0hk@Hl!JKfh>g1^x^b)(lVR6`h%F z`bj7B@QYH)Oz7U}M`0Y@U}Ul&WieO*R)7^)6a~!LX00sBhIk*W04wlo3efo=(THus znPzo#;GkLn3|5JHzC>r!D_457<$UYb1HaHd(8gD}m9Fi#ey zLlNrfxV}{BAZ*P%vI4BYR|Tl|LzLH1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0k~3UT;jw=on*|M zV;vL(2m}ZO2m}ZO2m}b+4G7?wO%q?tWbh6U2oMMmm_mT=4+=h1Hu-XbNpI`Gmlpz{ zEW~0j;Wx$sULD1kO}?C9(yNMXvgiT)s^Ethz^bEOq2?%?d^y1+t4@GbC*b!CeuM&E z?^sXq%n39x8N34o0tDtFKx6lXBu-R}+~c|NyB$N#rC8E595)oY23$emf}({yO(pze z(Ghzz>Z)$qX;D-AX|79kM`HeWw{4qK-)gMa&_@TQrLDH*s)nVfyvl~Aqsf6j!_w^0 z7CUWej@M3@o|AKUmf1jK9o3oWbEkp zu~Ten;BOD4bk@kYmu-ck(lWr!4KTL5-NS|LUTSV?O#|W zM{;``!e(aUo{6R`)3%0DLuVn7gTy8&Tor>jM4!G{xocKtQ>YPFrh%`c0bZ8^Pq%0W3O zl{!e<_PA|zrF5$Ai`!;8VL5|RSzI;aX;XFeX48xsM|7v()epJ!YrwHnZmVZFC`oBY z->ajYkCcirQ=)kE3B2*i`@ zle$HRbP;tpwTL3i`>3v2)4TyyEH5vS+vN^k`kEhbM%0wvIf`4xq+j02^WMT?Ic=>? zGhBO08Kp|eurdbjOt{2sgW_wN)**Q?%|Jz{X$rAo{N+(eHsbG$-Q)oJS&}?UPLPx2 zMe-IoO+Fx>lJn#exk9dzZ^$J1k^Dk#kUz;^KmdS)VyJ*hkf9n@Lm29z0Um^AXn_c{ z!J`m`Zs>(R7=nW^3~K zltH;i&T3czYhfL%hg#SGTVN|R!gi!-8|;K#&<-6)(jKH~KMX(|G|<5U84MPKz;rA&90x`@eb5HWKG!9hw49D<{qp? z*ShFH^0YVWa4jMU??~0@5u1C|ko#^#u!R}=+)?lRj1T)i17_JwkN0*qxg#YC9cYjO z1OfyC1OfyC1m+)s0@kHM@BiCw|NsB|4=m_0Kp;S1-VlJoNHo%d-DLyH**$Yupx`rv z4^7l=f=RCmzNiT;_pakHL$Bk#up7&=aW>UA`F0abVhN^s|1$t@MS}RB-s|Sxl?Czt I|0(|e8^23Cy8r+H diff --git a/example/outputFolderPristine/.DS_Store b/example/outputFolderPristine/.DS_Store deleted file mode 100755 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Thu, 9 Apr 2026 09:37:36 +0000 Subject: [PATCH 04/11] Fix effort displacement for forced effort fisheries with MPAs (closes #22) --- atlantis/atharvest/atHarvestIO.c | 2 +- .../atlantismain/include/atlantisboxmodel.h | 1 + atlantis/atmanage/atManage.c | 96 +++++++++++-------- atlantis/atmanage/atManageSetup.c | 26 ++--- 4 files changed, 73 insertions(+), 52 deletions(-) diff --git a/atlantis/atharvest/atHarvestIO.c b/atlantis/atharvest/atHarvestIO.c index 7338f15..596aad1 100755 --- a/atlantis/atharvest/atHarvestIO.c +++ b/atlantis/atharvest/atHarvestIO.c @@ -388,7 +388,7 @@ FILE * initDisplacedEffortFile(MSEBoxModel *bm) { int nf; /** Create filename **/ - sprintf(fname, "%sDisplaceEffort.txt", bm->startfname); + sprintf(fname, "%sDetailedEffort.txt", bm->startfname); printf("Creating %s\n", fname); /** Create file **/ diff --git a/atlantis/atlantismain/include/atlantisboxmodel.h b/atlantis/atlantismain/include/atlantisboxmodel.h index 5708947..411a90f 100755 --- a/atlantis/atlantismain/include/atlantisboxmodel.h +++ b/atlantis/atlantismain/include/atlantisboxmodel.h @@ -1027,6 +1027,7 @@ typedef enum { mEff_max_id, mEff_a_id, flagmpa_id, + flagMFCdisplace_id, mpascale_cap_id, max_mpa_sequence_id, infringe_id, diff --git a/atlantis/atmanage/atManage.c b/atlantis/atmanage/atManage.c index f353205..9718775 100755 --- a/atlantis/atmanage/atManage.c +++ b/atlantis/atmanage/atManage.c @@ -85,7 +85,7 @@ double k_proprecfish; void Manage_Calculate_Total_Effort(MSEBoxModel *bm, FILE *llogfp) { double EFF_scale1 = 0.0, EFF_scale2 = 0.0, EFF_scale3 = 0.0, EFF_scale4, FCpressure, orig_FCpressure, fish_infringe, FCdisplaced, prop_pop_fish = 0.0, localcell_vol, FC_likeREEF, FC_likeFLAT, FC_likeSOFT, FC_dempel, reef_area, flat_area, soft_area, otherFC_likeREEF, otherFC_likeFLAT, totconflict, otherFC_likeSOFT, otherFC_dempel, dempel_match, K_GearConflict, conflict_contrib, active_scale, step1_cpue, totcatch, dummy, mpa_scale, mpa_infringe, F_displaced, F_rescale; int ij, k, sp, nf, flagspeffortmodel, fishery_id, flagmanage, end_trigger_tripped, new_fish_loc = 0, nstock, flagfcmpa, - crunch_id; + crunch_id, flagMFCdisplace; //int do_debug_nf; //int do_debug; int ncells = bm->nbox; @@ -115,7 +115,7 @@ void Manage_Calculate_Total_Effort(MSEBoxModel *bm, FILE *llogfp) { /* Initialise local arrays */ if(bm->EffortModelsActive) { - for (nf = 0; nf < bm->K_num_fisheries; nf++) { + for (nf = 0; nf < bm->K_num_fisheries; nf++) { Harvest_Set_Harvest_Index(bm, nf, checkdone_id, 0); for (ij = 0; ij < ncells; ij++) { bm->CumEffort[nf][ij] += bm->Effort[ij][nf]; @@ -138,18 +138,19 @@ void Manage_Calculate_Total_Effort(MSEBoxModel *bm, FILE *llogfp) { } } - // If displaceing effort need to clean up the record keeping - if (bm->flagdisplace) { - for (nf = 0; nf < bm->K_num_fisheries; nf++) { - for (ij = 0; ij < ncells; ij++) { - if(bm->newmonth && bm->flagday) { - bm->CumDisplaceEffort[ij][nf] = 0.0; - } else { - bm->CumDisplaceEffort[ij][nf] += bm->Effort[ij][nf]; - } - } - } - } + // If displaceing effort need to clean up the record keeping + if (bm->flagdisplace) { + for (nf = 0; nf < bm->K_num_fisheries; nf++) { + for (ij = 0; ij < ncells; ij++) { + if(bm->newmonth && bm->flagday) { + bm->CumDisplaceEffort[ij][nf] = 0.0; + } + if(!bm->Effort[ij][nf] && (bm->FISHERYprms[nf][flagMFCdisplace_id])){ + bm->Effort[ij][nf] = 1.0; + } + } + } + } for (sp = 0; sp < bm->K_num_tot_sp; sp++) { if (FunctGroupArray[sp].isTAC) { @@ -236,7 +237,6 @@ void Manage_Calculate_Total_Effort(MSEBoxModel *bm, FILE *llogfp) { if (bm->dayt != bm->predayt) { for (fishery_id = 0; fishery_id < bm->K_num_fisheries; fishery_id++) { Check_For_Active_MPA(bm, fishery_id); - if (bm->flagdisplace) { for (ij = 0; ij < bm->nbox; ij++) { orig_FCpressure = 1.0; @@ -252,6 +252,10 @@ void Manage_Calculate_Total_Effort(MSEBoxModel *bm, FILE *llogfp) { bm->Effort[ij][fishery_id] *= F_rescale; /* this is so that accumulate additional fishing mortakity pressure due to displaced effort */ bm->Effort[new_fish_loc][fishery_id] += F_displaced; } + + for (ij = 0; ij < bm->nbox; ij++) { + bm->CumDisplaceEffort[ij][fishery_id] += bm->Effort[ij][fishery_id]; + } } } } @@ -362,14 +366,16 @@ void Manage_Calculate_Total_Effort(MSEBoxModel *bm, FILE *llogfp) { //fprintf(llogfp, "Time: %e %s flagspeffortmodel: %d\n", bm->dayt, FisheryArray[fishery_id].fisheryCode, flagspeffortmodel); - - /* Check if fishery activated and if no set to zero and only continue if fishery active this time step */ - if (((!flagspeffortmodel) && ((!mEff[fishery_id][bm->NextQofY]) && (!mEff[fishery_id][bm->QofY]))) || (!bm->FISHERYprms[fishery_id][fisheriesactive_id])) { - for (ij = 0; ij < bm->nbox; ij++) { - bm->Effort[ij][fishery_id] = 0; - } - continue; + + /* Check if fishery activated and if no set to zero and only continue if fishery active this time step */ + flagMFCdisplace = (int)(bm->FISHERYprms[fishery_id][flagMFCdisplace_id]); + if (((!flagspeffortmodel) && (!flagMFCdisplace) && ((!mEff[fishery_id][bm->NextQofY]) && (!mEff[fishery_id][bm->QofY]))) || (!bm->FISHERYprms[fishery_id][fisheriesactive_id])) { + for (ij = 0; ij < bm->nbox; ij++) { + bm->Effort[ij][fishery_id] = 0; + } + continue; } + /* If active determine what proportion of the entire day it is active and then compare that against dt, so can scale realised effort accordingly @@ -490,7 +496,7 @@ void Manage_Calculate_Total_Effort(MSEBoxModel *bm, FILE *llogfp) { /* Spatial management */ flagfcmpa = (int) (bm->FISHERYprms[fishery_id][flagmpa_id]); if (flagfcmpa) { - mpa_scale = bm->MPA[bm->current_box][fishery_id]; + mpa_scale = bm->MPA[ij][fishery_id]; /*jmk fix, from mpa_scale = bm->MPA[bm->current_box][fishery_id];*/ /* Allow for infringement */ if (bm->flaginfringe) { @@ -502,10 +508,10 @@ void Manage_Calculate_Total_Effort(MSEBoxModel *bm, FILE *llogfp) { mpa_scale = 1.0; } + orig_FCpressure = FCpressure; /*JMK bug patch */ FCpressure = FCpressure * mpa_scale; if (bm->flagdisplace) { - orig_FCpressure = FCpressure; Effort_Displacement(bm, fishery_id, ij, orig_FCpressure, &FCpressure, &FCdisplaced, &new_fish_loc, llogfp); if (FCpressure < 0.0) @@ -658,7 +664,14 @@ void Manage_Calculate_Total_Effort(MSEBoxModel *bm, FILE *llogfp) { } } } - + // Right before Check_CAP(bm, llogfp); + if (bm->flagdisplace) { + for (fishery_id = 0; fishery_id < bm->K_num_fisheries; fishery_id++) { + for (ij = 0; ij < bm->nbox; ij++) { + bm->CumDisplaceEffort[ij][fishery_id] += bm->Effort[ij][fishery_id]; + } + } + } /* Check fishing effort cap */ Check_CAP(bm, llogfp); @@ -1851,7 +1864,7 @@ void Effort_Displacement(MSEBoxModel *bm, int fishery_id, int ij, double orig_FC if (bm->flagdisplace) { mEff_thresh = bm->FISHERYprms[fishery_id][mEff_thresh_id]; /* Test to see if CPUE is high enough */ - if (bm->TempCPUE[ij][fishery_id] < mEff_thresh) { + if ((bm->TempCPUE[ij][fishery_id] < mEff_thresh) || (bm->MPA[ij][fishery_id] < 1.0)) { /*JMK fix */ /* Find target stock in current cell */ for (sp = 0; sp < bm->K_num_tot_sp; sp++) { if (FunctGroupArray[sp].isFished == TRUE) { @@ -1885,9 +1898,10 @@ void Effort_Displacement(MSEBoxModel *bm, int fishery_id, int ij, double orig_FC FisheryArray[fishery_id].fisheryCode, ij, fishthere); } */ - /* Check MPA status */ - MPA_check = 1.0 - bm->MPA[nb][fishery_id]; + /* Check MPA status */ + MPA_check = bm->MPA[nb][fishery_id]; /*JMK fix, was 1.0 - bm->MPA[nb][fishery_id] */ + /* Scale stock by MPA access scalar to get final potentail stock */ fishthere *= MPA_check; @@ -1907,18 +1921,20 @@ void Effort_Displacement(MSEBoxModel *bm, int fishery_id, int ij, double orig_FC */ /* If stock in an adjacent box is better than in the current box displace some effort to that location */ - if (maxfishthere > fishhere) { - /* If displacement is due to poor stocks the effort displaced matches - the relative stock sizes in the current and adjacent box */ - prop_displaced = maxfishthere / (maxfishthere + fishhere); - *FCdisplaced = *FCpressure * prop_displaced; - *FCpressure -= *FCdisplaced; - - /* If displacement is due to an MPA, the effort displaced - is the difference between the full effort for the box and - that left after MPA restrictions imposed */ - *FCdisplaced = orig_FCpressure - *FCpressure; - } + /* MPA-imposed displacement: effort must move regardless of biomass comparison JMK bug patch*/ + if (bm->MPA[ij][fishery_id] < 1.0) { + if (maxfishthere > 0) { + /* Displaced effort is the difference between original and post-MPA effort */ + *FCdisplaced = orig_FCpressure - *FCpressure; + } + /* CPUE-based displacement: only if adjacent box has better stock */ + } else if (maxfishthere > fishhere) { + prop_displaced = maxfishthere / (maxfishthere + fishhere); + *FCdisplaced = *FCpressure * prop_displaced; + *FCpressure -= *FCdisplaced; + *FCdisplaced = orig_FCpressure - *FCpressure; + } + } } diff --git a/atlantis/atmanage/atManageSetup.c b/atlantis/atmanage/atManageSetup.c index 5741bf4..e12625f 100755 --- a/atlantis/atmanage/atManageSetup.c +++ b/atlantis/atmanage/atManageSetup.c @@ -552,18 +552,22 @@ void Manage_Init(MSEBoxModel *bm, FILE *llogfp) { } for (i = 0; i < nfleets; i++) { - count_it = 0; - for (sp = 0; sp < bm->K_num_tot_sp; sp++) { - if (FunctGroupArray[sp].isFished == TRUE) { - if (bm->FISHERYtarget[i][sp]) { - count_it++; + count_it = 0; + bm->FISHERYprms[i][flagMFCdisplace_id] = 0; + for (sp = 0; sp < bm->K_num_tot_sp; sp++) { + if (FunctGroupArray[sp].isFished == TRUE) { + if (bm->FISHERYtarget[i][sp]) { + count_it++; + //fprintf(llogfp, "%s is target of %s\n", FunctGroupArray[sp].groupCode, FisheryArray[i].fisheryCode); + } + } + if((bm->SP_FISHERYprms[sp][i][flagF_id] > 0 ) && bm->flagdisplace) { + bm->FISHERYprms[i][flagMFCdisplace_id] = 1; // mFC fishery and displace effort on + } + } + bm->FISHERYprms[i][ntargets_id] = count_it; +} - //fprintf(llogfp, "%s is target of %s\n", FunctGroupArray[sp].groupCode, FisheryArray[i].fisheryCode); - } - } - } - bm->FISHERYprms[i][ntargets_id] = count_it; - } for (i = 0; i < nfleets; i++) { for (guild = 0; guild < bm->K_num_tot_sp; guild++) { From 8c443c94d67295637418e186f596639e75af9bfe Mon Sep 17 00:00:00 2001 From: Hem Nalini Morzaria-Luna Date: Thu, 23 Apr 2026 06:44:42 -0700 Subject: [PATCH 05/11] Update CHANGELOG.md Added Commit number for new release and revised missing information --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d9349b..e82e07c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,14 +6,19 @@ As changed, removed or added. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [3.6721.1] - 2026-04-21 +## [3.6722] - 2026-04-23 - Commit 4f6c3d7 + ### Added Created md file with a table listing Atlantis models in use, location, and contact person GitHub actions to build and run SETAS when a pull request is triggered Templates for bug reporting, feature requests and pull requests that standardize content for maintainers and reviewers. +Parameter min_pool_cont for the Contaminant module, which sets the threshold for minimum contaminant concentration. This addition decouples min_pool a global parameter from the contaminant submodule. Need to add min_pool_cont as a parameter if using track_contaminants +Instructions to add new features or bug fixes to the user manual. The documentation should be updated directly after the feature or bug is incorporated in a new release +Code to identify the Git release and return the release version ### Changed In atlantis/PreRules.am‎ refactors the code to detect the underlying OS and then "turn" on the appropriate flag +Readme and CHANGELOG are updated ### Removed Extra printfs in atUtils.c used for debugging From 0aed228f7078146196689b8cf303a5591a587d94 Mon Sep 17 00:00:00 2001 From: andybeet <22455149+andybeet@users.noreply.github.com> Date: Thu, 23 Apr 2026 09:50:23 -0400 Subject: [PATCH 06/11] fix(release): print GitHub release to standard --- atlantis/atlantismain/atlantismain.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/atlantis/atlantismain/atlantismain.c b/atlantis/atlantismain/atlantismain.c index 5739fea..5fed938 100644 --- a/atlantis/atlantismain/atlantismain.c +++ b/atlantis/atlantismain/atlantismain.c @@ -2543,10 +2543,7 @@ void modelshutdown(MSEBoxModel *bm) { void Util_Usage(int dummy) { - printf("\nAtlantis SVN Updated to Version %s\n", ATLANTIS_REVISION); - printf("Atlantis SVN Path %s\n", ATLANTIS_WCPATH); - printf("Atlantis SVN Last Change Date %s\n\n", ATLANTIS_WCDATE); - + printf("Git release version: %s\n", RELEASE_VERSION); printf("Util_Usage: atlantis -i input.nc dump -o output.nc -r run.prm -f force.prm -p physics.prm -b biology.prm -m migration.csv -h harvest.prm -a assess.prm -e economics.prm -s functionGroupFile.xml -q fisheries.xml [-d destinationFolder] [-t inputFolder]\n"); printf("\nDestinationFolder - An optional parameter. If provided a new folder with this name will be create and all output files generated by Atlantis will be placed in this folder.\n"); From e802447c7c700de906870f478fe3d53ee7483332 Mon Sep 17 00:00:00 2001 From: andybeet <22455149+andybeet@users.noreply.github.com> Date: Thu, 23 Apr 2026 10:57:44 -0400 Subject: [PATCH 07/11] refactor(revision): replaced old with new Variable name --- atlantis/atlantismain/atlantismain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atlantis/atlantismain/atlantismain.c b/atlantis/atlantismain/atlantismain.c index 0289794..4af2d2c 100644 --- a/atlantis/atlantismain/atlantismain.c +++ b/atlantis/atlantismain/atlantismain.c @@ -803,7 +803,7 @@ void setupMSEBoxModel(int argc, char *argv[], MSEBoxModel *bm) { /* Process arguments - where specified output filename used as basis for all output netcdf file names */ if (argc < 16){ if(argc == 2){ - quit("Atlantis version %s\n", ATLANTIS_REVISION); + quit("Atlantis version %s\n", RELEASE_VERSION); } Util_Usage(1); From 24b704fb94ce985a5b74cc779cf162084883367e Mon Sep 17 00:00:00 2001 From: andybeet <22455149+andybeet@users.noreply.github.com> Date: Thu, 23 Apr 2026 11:02:41 -0400 Subject: [PATCH 08/11] build(setas): allow code to access github release version --- .github/workflows/build_run_SETAS1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_run_SETAS1.yml b/.github/workflows/build_run_SETAS1.yml index 042a818..6dd56b9 100644 --- a/.github/workflows/build_run_SETAS1.yml +++ b/.github/workflows/build_run_SETAS1.yml @@ -45,7 +45,7 @@ jobs: TZ=America/New_York && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && apt-get update && - apt-get install -yq build-essential autoconf libnetcdf-dev libxml2-dev libproj-dev subversion valgrind dos2unix gawk nano r-base && + apt-get install -yq build-essential autoconf libnetcdf-dev libxml2-dev libproj-dev subversion valgrind dos2unix gawk nano r-base git && cd atlantis && aclocal && autoheader && autoconf && automake -a && ./configure --enable-rassesslink && make && make install && echo 'Now run the model!' && cd ../example && From 57342ade63ab48f42899df1c7a988534e79177cd Mon Sep 17 00:00:00 2001 From: Beth Fulton Date: Sat, 25 Apr 2026 22:03:36 +1000 Subject: [PATCH 09/11] Update BiTAC_sp in atManageSetup.c Fixed BiTAC_sp with Util_Alloc_Init_4D_Double instead for consistency sake --- atlantis/atmanage/atManageSetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atlantis/atmanage/atManageSetup.c b/atlantis/atmanage/atManageSetup.c index a013293..5bc8bc5 100755 --- a/atlantis/atmanage/atManageSetup.c +++ b/atlantis/atmanage/atManageSetup.c @@ -1193,7 +1193,7 @@ void Allocate_Arrays_Pre_Load(MSEBoxModel *bm) { /* These are always allocated even if the management option is off */ bm->reg_season = (int *) i_alloc1d(bm->K_num_reg); bm->phased_out = Util_Alloc_Init_2D_Double(nfleets, bm->K_num_tot_sp, 1.0); - bm->BiTAC_sp = (double ****) alloc4d(2, totalreg_id + 1, bm->K_num_tot_sp, 6); + bm->BiTAC_sp = Util_Alloc_Init_4D_Double(2, bm->K_num_tot_sp, totalreg_id + 1, 6, 0.0);; bm->BiTACamt = Util_Alloc_Init_4D_Double(2, nfleets, bm->K_num_tot_sp, 6, 0.0); bm->TACamt = Util_Alloc_Init_3D_Double(K_num_TAC_entries, nfleets, bm->K_num_tot_sp, 0.0); bm->TripCatch = Util_Alloc_Init_2D_Double(nfleets, bm->K_num_tot_sp, 0.0); From ee3401bfd24c7b287fc3f903f54d244759b7bd8d Mon Sep 17 00:00:00 2001 From: hmorzaria Date: Mon, 4 May 2026 21:41:28 +0000 Subject: [PATCH 10/11] Removed quit statement when contaminant transfer for externally reproducing species was not present --- atlantis/ConvertAtlantis/Makefile.in | 6 +- atlantis/Makefile.in | 1 + atlantis/atCLAMLink/Makefile.in | 6 +- atlantis/atSS3Link/Makefile.in | 6 +- atlantis/atassess/Makefile.in | 6 +- atlantis/atbrokerlink/Makefile.in | 6 +- atlantis/atecology/Makefile.in | 6 +- atlantis/atecology/atdemography.c | 600 +++++++++++++------------- atlantis/ateconomic/Makefile.in | 6 +- atlantis/atharvest/Makefile.in | 6 +- atlantis/atimplementation/Makefile.in | 6 +- atlantis/atlantisUtil/Makefile.in | 6 +- atlantis/atlantismain/Makefile.in | 6 +- atlantis/atlink/Makefile.in | 6 +- atlantis/atmanage/Makefile.in | 6 +- atlantis/atphysics/Makefile.in | 6 +- atlantis/config.h.in | 3 + atlantis/configure | 98 +++++ atlantis/sjwlib/Makefile.in | 6 +- 19 files changed, 477 insertions(+), 315 deletions(-) diff --git a/atlantis/ConvertAtlantis/Makefile.in b/atlantis/ConvertAtlantis/Makefile.in index 0a034e7..4ed379e 100644 --- a/atlantis/ConvertAtlantis/Makefile.in +++ b/atlantis/ConvertAtlantis/Makefile.in @@ -282,6 +282,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -367,7 +368,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" lib_LIBRARIES = libatConvertAtlantis.a libatConvertAtlantis_adir = $(includedir)/ConvertAtlantis libatConvertAtlantis_a_SOURCES = atBioltoXML.c atCreateXML.c convertXML.h atHarvesttoXML.c atManagetoXML.c atImplementationtoXML.c atAssesstoXML.c \ diff --git a/atlantis/Makefile.in b/atlantis/Makefile.in index 20dc97b..a60c6d2 100644 --- a/atlantis/Makefile.in +++ b/atlantis/Makefile.in @@ -252,6 +252,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ diff --git a/atlantis/atCLAMLink/Makefile.in b/atlantis/atCLAMLink/Makefile.in index d10be0e..be1d538 100644 --- a/atlantis/atCLAMLink/Makefile.in +++ b/atlantis/atCLAMLink/Makefile.in @@ -280,6 +280,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -365,7 +366,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" lib_LIBRARIES = libatCLAMLink.a c_sources = atCLAMManage.c atCLAMLinkIO.c atCLAMComm.c atCLAMLinkSetup.c atCLAMImplement.c h_sources = $(top_srcdir)/atCLAMLink/include/atCLAMLink.h diff --git a/atlantis/atSS3Link/Makefile.in b/atlantis/atSS3Link/Makefile.in index a585dbd..847772c 100644 --- a/atlantis/atSS3Link/Makefile.in +++ b/atlantis/atSS3Link/Makefile.in @@ -280,6 +280,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -365,7 +366,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" lib_LIBRARIES = libatSS3Link.a c_sources = atSS3Link.c atSS3LinkIO.c atSS3DataGen.c atSS3Util.c atCloseKin.c diff --git a/atlantis/atassess/Makefile.in b/atlantis/atassess/Makefile.in index 8c46093..24f907d 100644 --- a/atlantis/atassess/Makefile.in +++ b/atlantis/atassess/Makefile.in @@ -282,6 +282,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -367,7 +368,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" lib_LIBRARIES = libatassess.a libatassess_adir = $(includedir)/atassess libatassess_a_SOURCES = atclassical.c atindices.c atsample.c atsurvey.c \ diff --git a/atlantis/atbrokerlink/Makefile.in b/atlantis/atbrokerlink/Makefile.in index 4a51e9c..3d7ed34 100644 --- a/atlantis/atbrokerlink/Makefile.in +++ b/atlantis/atbrokerlink/Makefile.in @@ -276,6 +276,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -361,7 +362,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" lib_LIBRARIES = libbrokerlink.a libbrokerlink_adir = $(includedir)/atbrokerlink libbrokerlink_a_SOURCES = requests.pb-c.h requests.pb-c.c responses.pb-c.h responses.pb-c.c \ diff --git a/atlantis/atecology/Makefile.in b/atlantis/atecology/Makefile.in index 4a0b694..e742b83 100644 --- a/atlantis/atecology/Makefile.in +++ b/atlantis/atecology/Makefile.in @@ -307,6 +307,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -392,7 +393,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" lib_LIBRARIES = libatecology.a libatecology_adir = $(includedir)/atecology libatecology_a_SOURCES = atbiolUtil.c atannualbiology.c atbiolmessage.c atbiology.c atbiolsetup.c \ diff --git a/atlantis/atecology/atdemography.c b/atlantis/atecology/atdemography.c index 34f6d0f..3e7eea9 100644 --- a/atlantis/atecology/atdemography.c +++ b/atlantis/atecology/atdemography.c @@ -115,7 +115,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota //double lostden = 0; double dennow, CHLa, KWSR_sp, KWRR_sp, enviro_scalar, this_prop_ageup, plankton, vertdistrib, starting_num, new_num, amt, sp_AgeClassSize; - + //printf("Created Vertebrate Reproduction arrays\n"); if (verbose > 1) @@ -142,7 +142,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota } else { do_debug = 0; } - + /******************************************************************************* Get initial values for vertebrate vectors */ @@ -156,7 +156,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota VERTinfo[bm->which_check][cohort][DEN_id]); } } - + /******************************************************************************* Get plankton values in case have plankton based reproduction */ @@ -170,24 +170,24 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota for (species = 0; species < bm->K_num_tot_sp; species++) { if ((FunctGroupArray[species].speciesParams[flag_id] == TRUE) && ((FunctGroupArray[species].isVertebrate == TRUE) || (FunctGroupArray[species].groupAgeType == AGE_STRUCTURED))) { - + // Reinitialise for this species Util_Init_1D_Int(active_den, bm->K_num_max_cohort * bm->K_num_max_genetypes, 0); - + if ((bm->which_check == species) && (((bm->current_box == bm->checkbox) || (bm->checkbox > bm->nbox)) && (bm->dayt >= bm->checkstart))) do_debug = 1; else do_debug = 0; - + //if ((FunctGroupArray[species].numSpawns > 1) || (FunctGroupArray[species].groupType == FISH_INVERT)) // do_debug = 1; - + //if (bm->which_check == species) // do_debug = 1; //if ((species == 44) || (species == 64)) // do_debug = 1; - + /** Initialisation **/ /* Define num_cohorts = FunctGroupArray[species].numCohorts so that when use it as index to call value from vector have already corrected for the fact index starts at 0 not 1. @@ -216,7 +216,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota need_recupdate = 0; semelparous_migrants = 0; semelparous_parents = 0; - + /* If species in model and active then proceed */ if (flagSP && sp_active) { EMBRYO[species].recruiting_now = 0; @@ -224,7 +224,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota /** Spawning **/ sp_checkday = EMBRYO[species].next_spawn_any_age; - + /** //if (do_debug && (bm->which_check == species)) //if ((FunctGroupArray[species].groupType == MAMMAL) || (FunctGroupArray[species].groupType == FISH_INVERT)) @@ -233,9 +233,9 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota fprintf(llogfp, "Time: %e overall_checkday: %d, spawn_check_day: %d, ageday: %d for sp %s sp_checkday: %d\n", bm->dayt, overall_checkday, sp_checkday, EMBRYO[species].next_age_any_age, FunctGroupArray[species].groupCode, sp_checkday); } **/ - + if (overall_checkday == sp_checkday) { - + done_something = 1; /* Initalise TotSpawn for new values from current time step - needs to be reset for every box-layer as is the total spawn for that box-layer and added to EMBRYO.Larvae[] */ for (ngene = 0; ngene < sp_numGeneTypes; ngene++) { @@ -252,7 +252,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota Find_Evolution_Stats(bm, species, llogfp, 0); Find_Evolution_Shift(bm, species, llogfp); Do_Evolution(bm, species, llogfp); - + /* External to model spawning */ Ecology_Do_External_Age_Structured_Spawning(bm, species, flagmother, do_debug, &semelparous_migrants, llogfp); @@ -264,7 +264,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota /* Apply an semelparous reproductive deaths */ Apply_Semelparous_Deaths(bm, species, do_debug, semelparous_migrants, semelparous_parents, llogfp); - + /* Now spawning is started turn the switch off (so any once off events not repeated) */ EMBRYO[species].readytospawn[stock_id] = 0; } else { @@ -272,7 +272,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota EMBRYO[species].IndSpawn[cohort] = 0; } } - + /* Reset spawning readiness - can't do it at the time due to multiple layer handling */ if (overall_checkday == (sp_checkday + 1)) { done_something = 1; @@ -290,15 +290,15 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota /* Get vertical position in the water column */ vertdistrib = Get_Vertical_Recruit_Position(species, wclayer, maxdeep, totaldeep); - + /* Check for final recruit distribution */ Find_Final_Recruit_Distribution(bm, species, enviro_scalar, vertdistrib, wclayer, stock_id, do_debug, llogfp); } - + /** Do record keeping and diagostic tracking **/ if (overall_checkday == (sp_checkday + 2)) { done_something = 1; - + qid = EMBRYO[species].next_larvae; if(EMBRYO[species].SpawnRecruitOverlap && EMBRYO[species].CounterNotDone) qid++; @@ -326,11 +326,11 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota Update_Spawn_Queue(bm, species, cohort, maxstock_id, do_debug, llogfp); } } - + /******* Aging and Settlement of new young ******/ Util_Init_1D_Double(lostden_zero, bm->K_num_max_genetypes, 0.0); sp_checkday = EMBRYO[species].next_age_any_age; - + /* Find any recruits settling in this timestep */ Get_Settlers(bm, species, wclayer, stock_id, &recruits_arrive, do_debug, llogfp); @@ -339,18 +339,18 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota fprintf(llogfp, "Time: %e box%d-%d %s has sp_checkday %d vs overall_checkday %d\n", bm->dayt, bm->current_box, bm->current_layer, FunctGroupArray[species].groupCode, sp_checkday, overall_checkday); } */ - + /* Start aging */ if (overall_checkday == sp_checkday) { done_something = 1; - + Init_Aging_Arrays(bm, species, stock_id, maxstock_id, llogfp); - + /* Turn switch on to let groups age */ for (cohort = (int)floor((FunctGroupArray[species].numCohortsXnumGenes) - 1); cohort >= 0; cohort--) { shiftVERTON[species][cohort]++; } - + if (bm->flagsenesce && (sp_AgeClassSize >= 1.0)) { /* If assuming senescence - not necessary if each age phase represents < 1 year */ senesce_on = 1; @@ -358,20 +358,20 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota /* The oldest age group doesn't age up. */ senesce_on = 0; } - + /** if (do_debug && (bm->which_check == species)) { fprintf(llogfp, "Time: %e, %s senesce_on: %d\n", bm->dayt, FunctGroupArray[species].groupCode, senesce_on); } **/ - + /* Iterate of cohorts and calculate number aging up - starting with evolutionary shifts */ Do_Phenotyic_Expression(bm, species, llogfp); Do_Aging_Update_Trait(bm, species, llogfp); - + for (cohort = (int)floor((FunctGroupArray[species].numCohortsXnumGenes) - 1); cohort >= 0; cohort--) { basecohort = (int)floor (cohort / sp_numGeneTypes); - + /** if (do_debug && (bm->which_check == species)) { //if ((FunctGroupArray[species].groupType == MAMMAL) || (FunctGroupArray[species].groupType == FISH_INVERT)) { @@ -385,9 +385,9 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota /* Skip to next cohort as oldest don't age away in this option or the cohort not aging now */ continue; } - + dennow = Get_Numbers_Aging(bm, species, cohort, active_den, lostden_zero, &this_prop_ageup, do_debug, llogfp); - + /* Update numbers to age and local distribution */ Update_Aging_Numbers(bm, species, cohort, stock_id, dennow, this_prop_ageup, do_debug, llogfp); @@ -398,7 +398,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota Update_Age_Queue(bm, species, cohort, do_debug, llogfp); } - + /* Set flag to indicate need age distribution update */ need_update = 1; @@ -406,7 +406,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota age-structured information due to aging */ need_matupdate = 1; } - + /** //if (do_debug && (bm->which_check == species)) { //if ((FunctGroupArray[species].groupType == MAMMAL) || (FunctGroupArray[species].groupType == FISH_INVERT)) { @@ -422,7 +422,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota moving target - not 100% correct probably but much easier to deal with) */ if (EMBRYO[species].recruiting_now) { done_something = 1; - + /** if (do_debug && (bm->which_check == species)) { //if ((FunctGroupArray[species].groupType == MAMMAL) || (FunctGroupArray[species].groupType == FISH_INVERT)) { @@ -441,9 +441,9 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota so don't need to update age distribution */ if ((bm->current_box == bm->last_box) && (!bm->current_layer)) FunctGroupArray[species].speciesParams[firstrecday_id] = 0; - + } - + /* Update flags */ FunctGroupArray[species].speciesParams[need_update_id] = need_update; FunctGroupArray[species].speciesParams[need_recupdate_id] = need_recupdate; @@ -451,12 +451,12 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota cohort = 0; /* Update sizes of smallest age class - calculate new sn and rn */ - + if (bm->flag_modify_KWSR) { KWSR_sp = Get_Recruit_Size_Forcing(bm, species, do_debug, llogfp); KWRR_sp = KWSR_sp * FunctGroupArray[species].X_RS[cohort]; } - + FunctGroupArray[species].speciesParams[suckler_contam_today_id] = 1; // Only zeroed if recruits actively arriving if (recruits_arrive) { /* Update sizes of smallest age class - calculate new sn and rn */ @@ -467,7 +467,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota new_num += starting_num; shiftVERT[species][cohort][SN_id] = (KWSR_sp * EMBRYO[species].recruitSPden[ngene] + VERTinfo[species][cohort][SN_id] * starting_num) / (new_num + small_num); shiftVERT[species][cohort][RN_id] = (KWRR_sp * EMBRYO[species].recruitSPden[ngene] + (VERTinfo[species][cohort][RN_id] - EMBRYO[species].IndSpawn[cohort]) * starting_num) / (new_num + small_num); - + if(bm->track_contaminants && bm->flag_contamMaternalTransfer){ Apply_Settler_Contaminants(bm, species, cohort, starting_num, new_num, EMBRYO[species].next_recruit); FunctGroupArray[species].speciesParams[suckler_contam_today_id] = 0; // As getting transfer at birth so don't double up @@ -477,11 +477,11 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota if((EMBRYO[species].recruitSPden[ngene] > 0) || (lostden_zero[ngene] != 0.0)){ active_den[cohort] = 1; } - + /** //if (do_debug && (bm->which_check == species) && (EMBRYO[species].recruitSPden[ngene] > 0) ) { //fprintf(bm->logFile, "VERTinfo[species][cohort][DEN_id] = %e\n", VERTinfo[species][cohort][DEN_id]); - + if (do_debug && (EMBRYO[species].recruitSPden[ngene] > 0)) { //if (EMBRYO[species].recruitSPden[ngene] > 0) { fprintf(llogfp, "Time: %e, box%d %s ngene: %d shiftVERT-SN: %e, KWSR_sp: %e, recruitSPden: %e, VERTinfo-SN: %e, starting_num: %e, new_num: %e (VERTden: %e, lostdenzero: %e)\n", bm->dayt, bm->current_box, FunctGroupArray[species].groupCode, ngene, shiftVERT[species][cohort][SN_id], KWSR_sp, EMBRYO[species].recruitSPden[ngene], VERTinfo[species][cohort][SN_id], starting_num, new_num, VERTinfo[species][cohort][DEN_id], lostden_zero[ngene]); @@ -499,7 +499,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota for (i = 0; i < (FunctGroupArray[species].numCohortsXnumGenes); i++) { basecohort = (int)(floor (i / sp_numGeneTypes)); ngene = i - (basecohort * sp_numGeneTypes); - + if (shiftVERT[species][i][DEN_id] > 0) { fprintf(llogfp, "day: %e, %s-%d box: %d, layer %d, shiftDEN-%d %e\n", bm->dayt, FunctGroupArray[species].groupCode, i, bm->current_box, wclayer, i, shiftVERT[species][i][DEN_id]); @@ -510,14 +510,14 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota } } **/ - + /* Update local dPools */ if(done_something){ for (i = 0; i < (FunctGroupArray[species].numCohortsXnumGenes); i++) { Update_Local_dPool(bm, species, i, EMBRYO[species].IndSpawn[i], EMBRYO[species].recruitSPden, sp_numGeneTypes, localWCTracers, do_debug, llogfp); } } - + /* Update age distributions - only do at end for typical group, but do it every box for site attached */ need_update = (int) (FunctGroupArray[species].speciesParams[need_update_id]); if (bm->flagagestruct && need_update && (((bm->current_box == bm->last_box) && (!bm->current_layer)) @@ -544,7 +544,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota } } } - + return; } @@ -560,7 +560,7 @@ void Vertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int tota double Ecology_Age_Structured_Spawn(int species, double KSPA_SP, double FSP_SP, double RSprop_SP, double SN, double RN, double FSPB_SP, double X_RS, int repcost, FILE *llogfp) { double WforS, Wgt, Spwn, Wgtcheck, RepCost; double RN_buf = 0.999999999; - + if(repcost) { // NOTE: parameters are overloaded - FSP is constant for reproduction cost and KSPA is the exponent here RepCost = FSP_SP * pow(SN, KSPA_SP); @@ -586,13 +586,13 @@ double Ecology_Age_Structured_Spawn(int species, double KSPA_SP, double FSP_SP, Spwn = RN; } } - + // Sanity check if (Spwn > RN) Spwn = RN * RN_buf; //fprintf(llogfp, "%s repcost %d SN: %e RN: %e KSPA_SP %e FSP_SP: %e RSprop_SP: %e FSPB_SP: %e X_RS: %e Spwn: %e\n", FunctGroupArray[species].groupCode, repcost, SN, RN, KSPA_SP, FSP_SP, RSprop_SP, FSPB_SP, X_RS, Spwn); - + return (Spwn); } @@ -643,7 +643,7 @@ int Ecology_Sp_Active(MSEBoxModel *bm, int species, FILE *llogfp) { } } else if(FunctGroupArray[species].groupAgeType == AGE_STRUCTURED_BIOMASS) { sp_active = bm->flagday; - } + } } return sp_active; } @@ -658,7 +658,7 @@ void Ecology_Init_Spawn_Params(MSEBoxModel *bm, int species, int maxstock_id, in int basecohort; int sp_numGeneTypes = (int) (FunctGroupArray[species].numGeneTypes); int overall_checkday = (int) (floor(bm->dayt)); - + Util_Init_1D_Int(ngene_done, bm->K_num_max_genetypes, 0); Util_Init_1D_Int(not_finished, bm->K_num_max_genetypes, 0); @@ -669,13 +669,13 @@ void Ecology_Init_Spawn_Params(MSEBoxModel *bm, int species, int maxstock_id, in //if((bm->dayt >= bm->checkstart) && (bm->which_check == species)) // do_debug = 1; - + //if ((FunctGroupArray[species].numSpawns > 1) || (FunctGroupArray[species].groupType == FISH_INVERT)) // do_debug = 1; //if (bm->which_check == species) // do_debug = 1; - + //printf("Creating Init Spawn arrays\n"); /* If no embryos there can be no recruits */ @@ -685,21 +685,21 @@ void Ecology_Init_Spawn_Params(MSEBoxModel *bm, int species, int maxstock_id, in if ((bm->current_box == bm->last_box) && (!bm->current_layer)) { for(chrt = 0; chrt < FunctGroupArray[species].numCohortsXnumGenes; chrt++) { - + basecohort = (int)(floor (chrt / sp_numGeneTypes)); ngene = chrt - (basecohort * sp_numGeneTypes); - + /** if (do_debug && (species == bm->which_check)) { fprintf(llogfp, "Time: %e %s-%d has overall_checkday: %d StartDay: %d EndDay: %d next_recruit: %d Larvae: %e\n", bm->dayt, FunctGroupArray[species].groupCode, chrt, overall_checkday, EMBRYO[species].StartDay[chrt][EMBRYO[species].next_recruit], EMBRYO[species].EndDay[chrt][EMBRYO[species].next_recruit], EMBRYO[species].next_recruit, EMBRYO[species].Larvae[0][0][EMBRYO[species].next_recruit]); } **/ - + if(( overall_checkday > EMBRYO[species].StartDay[chrt][EMBRYO[species].next_recruit] ) && ( overall_checkday <= EMBRYO[species].EndDay[chrt][EMBRYO[species].next_recruit])) { if(ngene_done[ngene] < 1) { not_finished[ngene] = 0; for (i = 0; i < maxstock_id; i++) { - + /** //if (do_debug && (species == bm->which_check)) { if (species == 52) { @@ -717,7 +717,7 @@ void Ecology_Init_Spawn_Params(MSEBoxModel *bm, int species, int maxstock_id, in if (not_finished[ngene] < 1) { /* If all settlers arrived then need to reset */ EMBRYO[species].EndDay[chrt][EMBRYO[species].next_recruit] = overall_checkday; - + /** //if (do_debug && (species == bm->which_check)) { if (species == 52) { @@ -750,7 +750,7 @@ void Ecology_Init_Spawn_Params(MSEBoxModel *bm, int species, int maxstock_id, in bm->dayt, FunctGroupArray[species].groupCode, EMBRYO[species].next_larvae, EMBRYO[species].next_recruit); } **/ - + ngene_done[ngene] = 2; // Step 2 done } } @@ -768,7 +768,7 @@ void Ecology_Init_Spawn_Params(MSEBoxModel *bm, int species, int maxstock_id, in bm->tot_SSB[species] = 0.0; // Reinitialise CounterNotDone in case need to spawn mid recruitment EMBRYO[species].CounterNotDone = 1; - + //fprintf(llogfp, "Time: %e, %s has -- CounterNotDone reset to 1\n", bm->dayt, FunctGroupArray[species].groupCode); } @@ -779,7 +779,7 @@ void Ecology_Init_Spawn_Params(MSEBoxModel *bm, int species, int maxstock_id, in fprintf(llogfp, "Ending Init Spawns\n"); } */ - + return; } @@ -792,19 +792,19 @@ void Ecology_Init_Spawn_Params(MSEBoxModel *bm, int species, int maxstock_id, in */ void Update_Age_Queue(MSEBoxModel *bm, int species, int cohort, int do_debug, FILE *llogfp) { int chrt, day_to_check; - + if ((bm->current_box == bm->last_box) && (!bm->current_layer) && !cohort){ /* Shuffle Aging Queue to next entry - only do once per species and as counter counting down do it for the youngest (as last) */ EMBRYO[species].next_age++; day_to_check = MAXINT; for(chrt = 0; chrt < FunctGroupArray[species].numCohortsXnumGenes; chrt++) { - + if ((EMBRYO[species].Age_Now[chrt][EMBRYO[species].next_age] > bm->dayt) && (day_to_check > EMBRYO[species].Age_Now[chrt][EMBRYO[species].next_age])) day_to_check = EMBRYO[species].Age_Now[chrt][EMBRYO[species].next_age]; } EMBRYO[species].next_age_any_age = day_to_check; - + /** //if (bm->which_check == species) { fprintf(llogfp, "Time: %e, %s-%d has next_age_id: %d next_age date: %d\n", bm->dayt, @@ -827,21 +827,21 @@ void Update_Spawn_Queue(MSEBoxModel *bm, int species, int cohort, int maxstock_i if ((bm->current_box == bm->last_box) && (!bm->current_layer) && (cohort == (FunctGroupArray[species].numCohortsXnumGenes - 1))){ EMBRYO[species].next_spawn++; EMBRYO[species].CounterNotDone = 1; - + day_to_check = MAXINT; for(chrt = 0; chrt < FunctGroupArray[species].numCohortsXnumGenes; chrt++) { if ((EMBRYO[species].Spawn_Now[chrt][EMBRYO[species].next_spawn] > bm->dayt) && (day_to_check > EMBRYO[species].Spawn_Now[chrt][EMBRYO[species].next_spawn])) day_to_check = EMBRYO[species].Spawn_Now[chrt][EMBRYO[species].next_spawn]; } EMBRYO[species].next_spawn_any_age = day_to_check; - + /* Zero statistic storing */ for (ngene = 0; ngene < FunctGroupArray[species].numGeneTypes; ngene++){ for (i = 0; i < maxstock_id; i++) { totrecruit[species][i][ngene] = 0.0; } } - + /* if (do_debug && (bm->which_check == species)){ fprintf(llogfp, "Time: %e, %s-%d has next_spawn: %d\n", bm->dayt, FunctGroupArray[species].groupCode, cohort, EMBRYO[species].next_spawn); @@ -876,12 +876,12 @@ void Ecology_Do_External_Age_Structured_Spawning(MSEBoxModel *bm, int species, i int basecohort = 0; int flag_allow_spawn = 1; *semelparous_migrants = 0; - + if(verbose) printf("Ecology_Do_External_Age_Structured_Spawning for %s\n", FunctGroupArray[species].groupCode); - + //fprintf(llogfp, "Time: %e, %s-%d box%d-%d Spawn_Now: %d (next_spawn: %d) overall_checkday: %d recruitType: %d\n", bm->dayt, FunctGroupArray[species].groupCode, cohort, bm->current_box, bm->current_layer, EMBRYO[species].Spawn_Now[cohort][EMBRYO[species].next_spawn], EMBRYO[species].next_spawn, overall_checkday, FunctGroupArray[sp].recruitType); - + /* If spawn outside model and in first dynamic box then add in spawning due to migrants */ if ((FunctGroupArray[species].externalReproducer) && ((bm->current_box == bm->first_box) && (bm->current_layer == bm->top_layer))) { for (cohort = ((FunctGroupArray[species].numCohortsXnumGenes) - 1); cohort >= 0; cohort--) { @@ -890,7 +890,7 @@ void Ecology_Do_External_Age_Structured_Spawning(MSEBoxModel *bm, int species, i recieve_ngene = ngene; //fprintf(llogfp, "Time: %e, %s-%d Spawn_Now: %d (next_spawn: %d) overall_checkday: %d\n", bm->dayt, FunctGroupArray[species].groupCode, cohort, EMBRYO[species].Spawn_Now[cohort][EMBRYO[species].next_spawn], EMBRYO[species].next_spawn, overall_checkday); - + if(EMBRYO[species].Spawn_Now[cohort][EMBRYO[species].next_spawn] != overall_checkday) continue; // As not the cohort spawning @@ -904,7 +904,7 @@ void Ecology_Do_External_Age_Structured_Spawning(MSEBoxModel *bm, int species, i } else { allowed_to_spawn = 0; } - + //fprintf(llogfp, "Time: %e, %s-%d allowed_to_spawn A: %d\n", bm->dayt, FunctGroupArray[species].groupCode, cohort, allowed_to_spawn); if (!allowed_to_spawn) // If not big enough to spawn skip ahead @@ -920,24 +920,24 @@ void Ecology_Do_External_Age_Structured_Spawning(MSEBoxModel *bm, int species, i for (mid = MIGRATION[species].num_in_queue_done; mid < MIGRATION[species].num_in_queue; mid++) { flag_allow_spawn = MIGRATION[species].ReprodAllowed[cohort][mid]; if (flag_allow_spawn && (MIGRATION[species].DEN[cohort][mid] > bm->min_dens)) { - + /* for those species with size-based age of maturity, check the age class is big enough to spawn */ Wgt = MIGRATION[species].SN[cohort][mid] + MIGRATION[species].RN[cohort][mid]; li = Ecology_Get_Size(bm, species, Wgt, cohort); if (li < FunctGroupArray[species].speciesParams[min_li_mat_id]) { allowed_to_spawn = 0; } - + //fprintf(llogfp, "Time: %e, %s cohort %d allowed_to_spawn B: %d\n", bm->dayt, FunctGroupArray[species].groupCode, cohort, allowed_to_spawn); if (!allowed_to_spawn) // If not big enough to spawn skip ahead continue; - + step1 = Ecology_Age_Structured_Spawn(species, KSPA_sp, FSP_sp, RSprop_sp, MIGRATION[species].SN[cohort][mid], MIGRATION[species].RN[cohort][mid], FunctGroupArray[species].scaled_FSPB[cohort], FunctGroupArray[species].X_RS[cohort], bm->flag_repcostSpawn, llogfp); MigIndSpawn = FunctGroupArray[species].scaled_FSPB[cohort] * step1; - + //fprintf(llogfp, "Time: %e, %s cohort %d mid: %d MigIndSpawn: %e FSPB: %e step1: %e\n", bm->dayt, FunctGroupArray[species].groupCode, cohort, mid, MigIndSpawn, FunctGroupArray[species].scaled_FSPB[cohort], step1); - + thisSSB = (MIGRATION[species].RN[cohort][mid] + MIGRATION[species].SN[cohort][mid]) * MIGRATION[species].DEN[cohort][mid]; bm->tot_SSB[species] += FunctGroupArray[species].scaled_FSPB[cohort] * thisSSB; @@ -946,10 +946,10 @@ void Ecology_Do_External_Age_Structured_Spawning(MSEBoxModel *bm, int species, i EMBRYO[species].TotSpawn[recieve_ngene] += MigIndSpawn * MIGRATION[species].DEN[cohort][mid]; MIGRATION[species].RN[cohort][mid] -= MigIndSpawn; // Mass lost in spawning - - if(bm->track_contaminants && bm->flag_contamMaternalTransfer){ + + /* if(bm->track_contaminants && bm->flag_contamMaternalTransfer){ quit("Have not coded contaminant transfer for externally reproducing species - if you get this message contact teh developer group and ask them to sort this for you.... if it involves salmon Beth may swear, don't worry she will be fine after a bowl of ice cream\n"); - } + } */ /* If semelparous reproduction */ if (flagmother < 0) { @@ -959,7 +959,7 @@ void Ecology_Do_External_Age_Structured_Spawning(MSEBoxModel *bm, int species, i if (isnan(MIGRATION[species].RN[cohort][mid])) { quit("Time %e - during external spawning of %s cohort %d mid: %d have got NAN RN: %e SN: %e MigIndSpawn: %e scaled_FSPB: %e step1: %e DEN: %e\n", bm->dayt, FunctGroupArray[species].groupCode, cohort, mid, MIGRATION[species].RN[cohort][mid], MIGRATION[species].SN[cohort][mid], MigIndSpawn, FunctGroupArray[species].scaled_FSPB[cohort], step1, MIGRATION[species].DEN[cohort][mid]); } - + /** //if (do_debug) { if (species == 33) { @@ -1031,20 +1031,20 @@ void Ecology_Do_Internal_Age_Structured_Spawning(MSEBoxModel *bm, int species, i /* Animals in this box spawn */ step1 = Ecology_Age_Structured_Spawn(species, KSPA_sp, FSP_sp, RSprop_sp, VERTinfo[species][cohort][SN_id], VERTinfo[species][cohort][RN_id], FunctGroupArray[species].scaled_FSPB[cohort], FunctGroupArray[species].X_RS[cohort], bm->flag_repcostSpawn, llogfp); EMBRYO[species].IndSpawn[cohort] = FunctGroupArray[species].scaled_FSPB[cohort] * step1; - + thisSSB = (VERTinfo[species][cohort][RN_id] + VERTinfo[species][cohort][SN_id]) * VERTinfo[species][cohort][DEN_id]; bm->tot_SSB[species] += FunctGroupArray[species].scaled_FSPB[cohort] * thisSSB; if(bm->flag_do_evolution) { recieve_ngene = Do_Inheritance(bm, species, ngene, basecohort, cohort, llogfp); } - + if(bm->track_contaminants && bm->flag_contamMaternalTransfer){ if(EMBRYO[species].IndSpawn[cohort] > 0) { // Only transfer contaminants if actually producing any spawn Get_Parental_Contaminants(bm, species, cohort, flagmother, VERTinfo[species][cohort][DEN_id]); } } - + EMBRYO[species].TotSpawn[recieve_ngene] += EMBRYO[species].IndSpawn[cohort] * VERTinfo[species][cohort][DEN_id]; /** @@ -1056,7 +1056,7 @@ void Ecology_Do_Internal_Age_Structured_Spawning(MSEBoxModel *bm, int species, i FunctGroupArray[species].scaled_FSPB[cohort], VERTinfo[species][cohort][SN_id], VERTinfo[species][cohort][RN_id], FSP_sp, KSPA_sp, step1); } **/ - + /* If semelparous reproduction */ if (flagmother < 0) { *semelparous_parents = 1; @@ -1073,36 +1073,36 @@ void Ecology_Do_Internal_Age_Structured_Spawning(MSEBoxModel *bm, int species, i */ void Apply_Semelparous_Deaths(MSEBoxModel *bm, int species, int do_debug, int semelparous_migrants, int semelparous_parents, FILE *llogfp) { int cohort, qid; - + for (cohort = ((FunctGroupArray[species].numCohortsXnumGenes) - 1); cohort >= 0; cohort--) { - + if(FunctGroupArray[species].scaled_FSPB[cohort] > 0.0) { /* If semelparous external reproduction */ if (semelparous_migrants) { for (qid = MIGRATION[species].num_in_queue_done; qid < MIGRATION[species].num_in_queue; qid++) { fprintf(llogfp,"Time: %e %s-%d qid: %d has starting MIGRATION_den_expect: %e", bm->dayt, FunctGroupArray[species].groupCode, cohort, qid, MIGRATION[species].DEN[cohort][qid]); - + MIGRATION[species].DEN[cohort][qid] *= (1.0 - FunctGroupArray[species].scaled_FSPB[cohort]); - + fprintf(llogfp," ending: %e as scaled_FSPB: %e\n", MIGRATION[species].DEN[cohort][qid], FunctGroupArray[species].scaled_FSPB[cohort]); } } - + /* If semelparous reproduction internal to the model domain */ if (semelparous_parents) { fprintf(llogfp,"Time: %e %s-%d current_box: %d has DEN: %e and shiftDEN: %e ", bm->dayt, FunctGroupArray[species].groupCode, cohort, bm->current_box, VERTinfo[species][cohort][DEN_id], shiftVERT[species][cohort][DEN_id]); - + /* In case need to do aging correct adult abundance directly */ VERTinfo[species][cohort][DEN_id] *= (1.0 - FunctGroupArray[species].scaled_FSPB[cohort]); - + /* If not at same time aging then need to update the shift values - no need to multiply by (1.0 - FunctGroupArray[species].scaled_FSPB[cohort]) here as already applied that above */ shiftVERT[species][cohort][DEN_id] = VERTinfo[species][cohort][DEN_id]; shiftVERTON[species][cohort]++; - + fprintf(llogfp," DEN ending: %e shift ending: %e as scaled_FSPB: %e\n", VERTinfo[species][cohort][DEN_id], shiftVERT[species][cohort][DEN_id], FunctGroupArray[species].scaled_FSPB[cohort]); } @@ -1134,7 +1134,7 @@ void Ecology_Find_Embryoes(MSEBoxModel *bm, int species, int stock_id, double pl qid++; if (qid > (EMBRYO[species].num_in_larval_queue - 1)) qid = EMBRYO[species].num_in_larval_queue - 1; - + /** if (species == 33) fprintf(llogfp, "Time: %e %s has qid %d as next_larvae %d SpawnRecruitOverlap %d CounterNotDone %d and next_larve %d \n", bm->dayt, FunctGroupArray[species].groupCode, qid, EMBRYO[species].next_larvae, EMBRYO[species].SpawnRecruitOverlap, EMBRYO[species].CounterNotDone, EMBRYO[species].next_larvae); @@ -1151,10 +1151,10 @@ void Ecology_Find_Embryoes(MSEBoxModel *bm, int species, int stock_id, double pl EMBRYO[species].Larvae[stock_id][ngene][qid] = 0; } } - + /**/ - - + + for(ngene = 0; ngene < sp_numGeneTypes; ngene++){ switch (recruit_sp) { case no_recruit: @@ -1163,19 +1163,19 @@ void Ecology_Find_Embryoes(MSEBoxModel *bm, int species, int stock_id, double pl case const_recruit: /* Fixed set of constants */ if (EMBRYO[species].readytospawn[stock_id] == 1) EMBRYO[species].Larvae[stock_id][ngene][qid] = KDENR_sp / ng; - + /* if (species == 52) { fprintf(llogfp, "Time: %e box%d-%d %s larvae %e KDENR: %e ng: %e\n", bm->dayt, bm->current_box, bm->current_layer, FunctGroupArray[species].groupCode, EMBRYO[species].Larvae[stock_id][ngene][qid], KDENR_sp, ng); } */ - + break; case chl_recruit: /* Proportional to primary productivity */ EMBRYO[species].Larvae[stock_id][ngene][qid] += recSTOCK[species][stock_id] * PP_sp * bm->cell_vol * (CHLa / bm->ref_chl); - + //fprintf(llogfp, "Time: %e box%d-%d %s larvae %e P_sp: %e cell_vol: %e CHLa: %e ref_chl: %e\n", bm->dayt, bm->current_box, bm->current_layer, FunctGroupArray[species].groupCode, EMBRYO[species].Larvae[stock_id][ngene][qid], PP_sp, bm->cell_vol, CHLa, bm->ref_chl); - + break; case rand_recruit: /* Random - follows lognormal */ if (EMBRYO[species].readytospawn[stock_id] == 1) @@ -1206,7 +1206,7 @@ void Ecology_Find_Embryoes(MSEBoxModel *bm, int species, int stock_id, double pl //if (do_debug && (bm->which_check == species)) { if (species == 33) { fprintf(llogfp,"Doing %s stock %d, ngene: %d, qid: %d, TotSpawn: %e, Larvae: %e\n", - FunctGroupArray[species].groupCode, stock_id, ngene, qid, EMBRYO[species].TotSpawn[ngene], + FunctGroupArray[species].groupCode, stock_id, ngene, qid, EMBRYO[species].TotSpawn[ngene], EMBRYO[species].Larvae[stock_id][ngene][qid]); } **/ @@ -1225,7 +1225,7 @@ void Ecology_Find_Embryoes(MSEBoxModel *bm, int species, int stock_id, double pl } **/ } - + if ((FunctGroupArray[species].externalReproducer) && ((bm->current_box == bm->first_box) && (bm->current_layer == bm->top_layer))) { for (cohort = ((FunctGroupArray[species].numCohortsXnumGenes) - 1); cohort >= 0; cohort--) { for (mid = MIGRATION[species].num_in_queue_done; mid < MIGRATION[species].num_in_queue; mid++) { @@ -1233,7 +1233,7 @@ void Ecology_Find_Embryoes(MSEBoxModel *bm, int species, int stock_id, double pl EMBRYO[species].Larvae[stock_id][ngene][qid] += KDENR_sp * FunctGroupArray[species].scaled_FSPB[cohort] * MIGRATION[species].DEN[cohort][mid]; FunctGroupArray[species].speciesParams[recruit_qid_id] = qid; - + /** if (do_debug && (bm->which_check == species)) { fprintf(llogfp,"Time: %e %s ngene: %d, qid: %d, mid: %d, cohort: %d, KDENR: %e, scaledFSPB: %e, MIGRATIONden: %e, Larvae: %e\n", bm->dayt, FunctGroupArray[species].groupCode, ngene, qid, mid, cohort, KDENR_sp, FunctGroupArray[species].scaled_FSPB[cohort], MIGRATION[species].DEN[cohort][mid], EMBRYO[species].Larvae[stock_id][ngene][qid]); @@ -1248,7 +1248,7 @@ void Ecology_Find_Embryoes(MSEBoxModel *bm, int species, int stock_id, double pl case ts_recruit:/* Read in timeseries of recruitment */ if (EMBRYO[species].readytospawn[stock_id] == 1) { EMBRYO[species].Larvae[stock_id][ngene][qid] = tsEval(bm->tsRecruit, tsrecruitid, bm->t); - + /** //if (do_debug && (bm->which_check == species)) fprintf(llogfp, "Time: %e %s ngene: %d stock: %d qid: %d with Larvae: %e and time t: %e\n", bm->dayt, FunctGroupArray[species].groupCode, ngene, stock_id, qid, EMBRYO[species].Larvae[stock_id][ngene][qid], bm->t); @@ -1264,12 +1264,12 @@ void Ecology_Find_Embryoes(MSEBoxModel *bm, int species, int stock_id, double pl cohort = (FunctGroupArray[species].numGeneTypes * bcohort) + ngene; EMBRYO[species].Larvae[stock_id][ngene][qid] += VERTinfo[species][cohort][DEN_id] * FunctGroupArray[species].scaled_FSPB[cohort] * (VERTinfo[species][cohort][SN_id] + VERTinfo[species][cohort][RN_id]) * bm->X_CN * mg_2_tonne; } - + if ((FunctGroupArray[species].externalReproducer) && ((bm->current_box == bm->first_box) && (bm->current_layer == bm->top_layer))) { for (cohort = ((FunctGroupArray[species].numCohortsXnumGenes) - 1); cohort >= 0; cohort--) { for (mid = MIGRATION[species].num_in_queue_done; mid < MIGRATION[species].num_in_queue; mid++) { if(MIGRATION[species].DEN[cohort][mid] > bm->min_dens){ - + EMBRYO[species].Larvae[stock_id][ngene][qid] += MIGRATION[species].DEN[cohort][mid] * FunctGroupArray[species].scaled_FSPB[cohort] * (MIGRATION[species].SN[cohort][mid] + MIGRATION[species].RN[cohort][mid]) * bm->X_CN * mg_2_tonne; FunctGroupArray[species].speciesParams[recruit_qid_id] = qid; } @@ -1284,12 +1284,12 @@ void Ecology_Find_Embryoes(MSEBoxModel *bm, int species, int stock_id, double pl EMBRYO[species].Larvae[stock_id][ngene][qid] += FunctGroupArray[species].scaled_FSPB[cohort] * VERTinfo[species][cohort][DEN_id]; } - + if ((FunctGroupArray[species].externalReproducer) && ((bm->current_box == bm->first_box) && (bm->current_layer == bm->top_layer))) { for (cohort = ((FunctGroupArray[species].numCohortsXnumGenes) - 1); cohort >= 0; cohort--) { for (mid = MIGRATION[species].num_in_queue_done; mid < MIGRATION[species].num_in_queue; mid++) { if(MIGRATION[species].DEN[cohort][mid] > bm->min_dens){ - + EMBRYO[species].Larvae[stock_id][ngene][qid] += FunctGroupArray[species].scaled_FSPB[cohort] * MIGRATION[species].DEN[cohort][mid]; FunctGroupArray[species].speciesParams[recruit_qid_id] = qid; } @@ -1303,7 +1303,7 @@ void Ecology_Find_Embryoes(MSEBoxModel *bm, int species, int stock_id, double pl quit("No such flagrecruit defined for vertebrates (i.e. value must be between 1 ands 10 at present)\n"); break; } - + stocking_sp = (int) (FunctGroupArray[species].speciesParams[flagstocking_id]); if (stocking_sp) { /* Read in timeseries of number of recruits added due to stocking - assume all genotypes get the same number of recruits */ @@ -1321,16 +1321,16 @@ void Ecology_Find_Embryoes(MSEBoxModel *bm, int species, int stock_id, double pl EMBRYO[species].Larvae[stock_id][ngene][qid], EMBRYO[species].TotSpawn[ngene], recruit_sp); } **/ - + if(bm->track_contaminants && bm->flag_contamMaternalTransfer){ Store_Recruit_Contaminants(bm, species, stock_id, ngene, qid); } } - + if (bm->flag_do_evolution){ /* Redistribute larvae across based on evolutiomn curve if necesary */ Evolution_Curve(bm, species, stock_id, qid, do_debug, llogfp); } - + return; } @@ -1375,7 +1375,7 @@ void Get_Recruits(MSEBoxModel *bm, int species, int stock_id, double plankton, F /* if(((bm->current_box == bm->checkbox) || (bm->checkbox > bm->nbox)) && (bm->dayt >= bm->checkstart) && (bm->which_check == species)) do_debug = 1; - + if ((FunctGroupArray[species].numSpawns > 1) || (FunctGroupArray[species].groupType == FISH_INVERT)) do_debug = 1; @@ -1398,7 +1398,7 @@ void Get_Recruits(MSEBoxModel *bm, int species, int stock_id, double plankton, F case ts_recruit:/* Read in timeseries of recruitment */ case multiple_ts_recruit: /* Read in timeseries of recruitment */ temprec = EMBRYO[species].Larvae[stock_id][ngene][qid]; - + /** //if (do_debug) { //if (species == 33) { @@ -1406,7 +1406,7 @@ void Get_Recruits(MSEBoxModel *bm, int species, int stock_id, double plankton, F fprintf( llogfp, "Time: %e, box%d-%d, species %s, ngene: %d, stock: %d, qid: %d, temprec: %e, Larvae: %e\n", bm->dayt, bm->current_box, bm->current_layer, FunctGroupArray[species].groupCode, ngene, stock_id, qid, temprec, EMBRYO[species].Larvae[stock_id][ngene][qid]); } **/ - + break; case BevHolt_recruit: /* Beverton-Holt stock-recruit relationship - Atlantis basic version (mix numbers and biomass) */ temprec = (recSTOCK[species][stock_id] * BHalpha_sp * EMBRYO[species].Larvae[stock_id][ngene][qid] / (BHbeta_sp + bm->totfishpop[species] * stock_prop[species][stock_id])); @@ -1417,7 +1417,7 @@ void Get_Recruits(MSEBoxModel *bm, int species, int stock_id, double plankton, F if (species == 33) { fprintf( llogfp, "Time: %e, box%d-%d, species %s, ngene: %d, stock: %d, temprec: %e, recSTOCK: %e, BHalpha: %e, Larvae: %e, BHbeta: %e, totfish: %e, stock_prop: %e)\n", - bm->dayt, bm->current_box, bm->current_layer, FunctGroupArray[species].groupCode, + bm->dayt, bm->current_box, bm->current_layer, FunctGroupArray[species].groupCode, ngene, stock_id, temprec, recSTOCK[species][stock_id], BHalpha_sp, EMBRYO[species].Larvae[stock_id][ngene][qid], BHbeta_sp, bm->totfishpop[species], stock_prop[species][stock_id]); @@ -1457,7 +1457,7 @@ void Get_Recruits(MSEBoxModel *bm, int species, int stock_id, double plankton, F break; case Ricker_recruit: /* Ricker */ temprec = bm->totfishpop[species] * stock_prop[species][stock_id] * exp(recSTOCK[species][stock_id] * Ralpha_sp * (1.0 - bm->totfishpop[species] * stock_prop[species][stock_id] / Rbeta_sp)); - + /** if (do_debug && (bm->which_check == species)) { fprintf( llogfp, "Time: %e, box%d-%d, species %s, ngene: %d, stock: %d, temprec: %e, totfishpop: %e, stock_prop: %e, recSTOCK: %e, Ralpha: %e, Larvae: %e, Rbeta: %e\n", @@ -1466,7 +1466,7 @@ void Get_Recruits(MSEBoxModel *bm, int species, int stock_id, double plankton, F EMBRYO[species].Larvae[stock_id][ngene][qid], Rbeta_sp); } **/ - + break; case SSB_BevHolt_recruit: /* Standard Beverton-Holt stock-recruit relationship */ temprec = (recSTOCK[species][stock_id] * BHalpha_sp * bm->totfishpop[species] * stock_prop[species][stock_id] / (BHbeta_sp + bm->totfishpop[species] * stock_prop[species][stock_id])); @@ -1503,7 +1503,7 @@ void Get_Recruits(MSEBoxModel *bm, int species, int stock_id, double plankton, F bm->airtemp_index = tsEvalR(bm->thermal_index, bm->tindex_id, bm->t, bm->tindex_rewindid); bm->airT_rate_index = tsEvalR(bm->rate_index, bm->rindex_id, bm->t, bm->rindex_rewindid); current_ICE = Get_Ice_Rating(bm, species); - + this_stock = bm->tot_SSB[species] * stock_prop[species][stock_id]; prod_alpha = FunctGroupArray[species].speciesParams[prod_alpha_id]; @@ -1512,9 +1512,9 @@ void Get_Recruits(MSEBoxModel *bm, int species, int stock_id, double plankton, F temp_coefft = FunctGroupArray[species].speciesParams[temp_coefft_id]; rate_coefft = FunctGroupArray[species].speciesParams[rate_coefft_id]; wind_coefft = FunctGroupArray[species].speciesParams[wind_coefft_id]; - + recruit_var = FunctGroupArray[species].speciesParams[recruit_var_id]; - + step1 = prod_alpha - dd_beta1 * this_stock * dd_beta2 * current_ICE + temp_coefft * bm->airtemp_index + rate_coefft * bm->airT_rate_index + recruit_var * 0.5; if(bm->track_wind) { step1 += (wind_coefft * current_WIND); @@ -1532,13 +1532,13 @@ void Get_Recruits(MSEBoxModel *bm, int species, int stock_id, double plankton, F larval_scalar = Larval_Mortality(bm, species, stock_id, llogfp); temprec *= larval_scalar; } - + // Check for any stochasticity added to this recruitment if ( FunctGroupArray[species].speciesParams[flag_recruit_stochastic_id] > 0) { step1 = temprec; temprec = Util_Normx_Result(step1, norm_sigma); } - + // Store the final number of recruits EMBRYO[species].BulkRecruits[ngene] = temprec; @@ -1552,13 +1552,13 @@ void Get_Recruits(MSEBoxModel *bm, int species, int stock_id, double plankton, F EMBRYO[species].BulkRecruits[ngene], temprec, EMBRYO[species].Larvae[stock_id][ngene][qid], qid); } **/ - + if(bm->track_contaminants && bm->flag_contamMaternalTransfer){ Get_Recruit_Contaminants(bm, species, ngene, stock_id, qid); } - + } - + return; } @@ -1572,7 +1572,7 @@ double Larval_Mortality(MSEBoxModel *bm, int species, int stock_id, FILE *llogfp double dependbiom = bm->totfishpop[dependsp_id]; double depend_scalar = FunctGroupArray[species].speciesParams[intersp_depend_scale_id]; double ans = 0.0; - + if (depend_type == intersp_linear) { // Directly proportional ans = depend_scalar * dependbiom; } else if (depend_type == intersp_inverse) { // Indirectly proportional @@ -1606,7 +1606,7 @@ double Get_Enviro_Recruit_Forcing(MSEBoxModel *bm, int species, int do_debug, FI double Tscalar = 1.0; double recCcorr = 1.0; //int recruit_sp = (int) (FunctGroupArray[species].speciesParams[flagrecruit_id]); - + if(!bm->flagtempdepend_reprod) { // Have turned off temperature dependent movement if(temp_sensitive_sp && bm->newmonth) { warn("Time: %e Zeroing temperature sensitivity for reproduction of %s even though flagtempsensitive %d as flagtempdepend_move = %d\n", bm->dayt, FunctGroupArray[species].groupCode, temp_sensitive_sp, bm->flagtempdepend_move); @@ -1705,7 +1705,7 @@ double Get_Enviro_Recruit_Forcing(MSEBoxModel *bm, int species, int do_debug, FI FunctGroupArray[species].groupCode, H2Otemp, min_spawntemp_sp, max_spawntemp_sp, current_SALT, min_spawnsalt_sp, max_spawnsalt_sp); } **/ - + return enviro_scalar; } @@ -1713,15 +1713,15 @@ double Get_Recruit_Size_Forcing(MSEBoxModel *bm, int species, int do_debug, FILE int KWSRforceid = (int) (FunctGroupArray[species].speciesParams[KWSRforce_id]); double KWSR_sp = FunctGroupArray[species].speciesParams[KWSR_id]; double KWSR_force = 0.0; - + /* Forcing */ if (bm->flag_modify_KWSR && (KWSRforceid > -1)) { KWSR_force = tsEval(bm->KWSR_force, KWSRforceid, bm->t); - + if (bm->flag_modify_KWSR == scale_KWSR) KWSR_force *= KWSR_sp; } - + return KWSR_force; } @@ -1736,7 +1736,7 @@ void Recruit_Migration(MSEBoxModel *bm, int species, int wclayer, int stock_id, double KWRR_sp = FunctGroupArray[species].speciesParams[KWRR_id]; int larval_queue_extension = FunctGroupArray[species].speciesParams[larval_queue_extension_id]; //int cohort_recruit_entry = FunctGroupArray[species].speciesParams[cohort_recruit_entry_id]; - + //fprintf(bm->logFile, "Time: %e %s box%d-%d (vs first_box %d, top_layer %d) numGeneTypes: %d Recruit_Migration recruitType: %d num_in_queue: %d externalReproducer: %d\n", bm->dayt, FunctGroupArray[species].groupCode, bm->current_box, bm->current_layer, bm->first_box, bm->top_layer, sp_numGeneTypes, FunctGroupArray[species].recruitType, MIGRATION[species].num_in_queue, FunctGroupArray[species].externalReproducer); if((FunctGroupArray[species].externalReproducer && (FunctGroupArray[species].recruitType != external_spawn_local_recruit)) || (FunctGroupArray[species].recruitType == external_recruit)) { @@ -1744,9 +1744,9 @@ void Recruit_Migration(MSEBoxModel *bm, int species, int wclayer, int stock_id, for(ngene = 0; ngene < sp_numGeneTypes; ngene++){ for (mid = 0; mid < MIGRATION[species].num_in_queue; mid++) { - + fprintf(bm->logFile, "Time: %e %s RecruitQueueMatch: %d\n", bm->dayt, FunctGroupArray[species].groupCode, MIGRATION[species].RecruitQueueMatch[mid]); - + if (MIGRATION[species].RecruitQueueMatch[mid] > 0) { if (bm->flag_modify_KWSR) { KWSR_sp = Get_Recruit_Size_Forcing(bm, species, do_debug, llogfp); @@ -1757,7 +1757,7 @@ void Recruit_Migration(MSEBoxModel *bm, int species, int wclayer, int stock_id, recruit_outside = 0; thisday = EMBRYO[species].StartDay[ngene][EMBRYO[species].next_recruit]; - + /** if(do_debug) { fprintf(bm->logFile, "Time: %e %s mid: %d Return_Now = %d, Leave_Now = %d, thisday: %d\n", bm->dayt, FunctGroupArray[species].groupCode, mid, MIGRATION[species].Return_Now[mid], MIGRATION[species].Leave_Now[mid], thisday); @@ -1770,7 +1770,7 @@ void Recruit_Migration(MSEBoxModel *bm, int species, int wclayer, int stock_id, if ( thisday > MIGRATION[species].Return_Now[mid]) continue; // Skip ahead if time is alredy past the migration time /**/ - + /* Outside the model when recruitment happens */ if ((MIGRATION[species].Return_Now[mid] >= thisday) && (MIGRATION[species].Leave_Now[mid] <= thisday)) { recruit_outside = 1; @@ -1778,19 +1778,19 @@ void Recruit_Migration(MSEBoxModel *bm, int species, int wclayer, int stock_id, FunctGroupArray[species].speciesParams[direct_recruit_entry_id] = 0; direct_recruit_entry = 1; } - + /** //if(do_debug) { if ((species == 26) || (species == 35) || (species == 64)) { fprintf(bm->logFile, "Time: %e %s-%d mid: %d recruit_outside = %d, MIGRATION.recruit = %e (leave: %d return: %d start_return_chrt: %d direct_recruit_entry: %e)\n", bm->dayt, FunctGroupArray[species].groupCode, ngene, mid, recruit_outside, MIGRATION[species].recruit[ngene][mid], MIGRATION[species].Leave_Now[mid], MIGRATION[species].Return_Now[mid], MIGRATION[species].start_return_chrt[mid], FunctGroupArray[species].speciesParams[direct_recruit_entry_id]); } **/ - + if (recruit_outside && (!direct_recruit_entry)) { oldDEN = MIGRATION[species].DEN[ngene][mid]; oldSN = MIGRATION[species].SN[ngene][mid]; oldRN = MIGRATION[species].RN[ngene][mid]; - + embryo_recruits = 0.0; if(larval_queue_extension) { for (lid = 0; lid < larval_queue_extension; lid++) { @@ -1807,19 +1807,19 @@ void Recruit_Migration(MSEBoxModel *bm, int species, int wclayer, int stock_id, //orig_den = MIGRATION[species].DEN[ngene][mid]; MIGRATION[species].DEN[ngene][mid] += (MIGRATION[species].recruit[ngene][mid] + embryo_recruits); // As all in youngest cohort maps to ngene not cohort in Migration //MIGRATION[species].recruit[ngene][mid] = EMBRYO[species].BulkRecruits[ngene] * enviro_scalar; - + // Update size here too - used to reset to KMIG each year, but that is erroneous MIGRATION[species].SN[ngene][mid] = (oldSN * oldDEN + KWSR_sp * MIGRATION[species].recruit[ngene][mid]) / (MIGRATION[species].recruit[ngene][mid] + oldDEN + small_num); MIGRATION[species].RN[ngene][mid] = (oldRN * oldDEN + KWRR_sp * MIGRATION[species].recruit[ngene][mid]) / (MIGRATION[species].recruit[ngene][mid] + oldDEN + small_num); - + //fprintf(bm->logFile, "Time: %e %s-%d mid: %d now MigDEN: %e as MIGrecruit: %e MigYOY: %e embryo_recruits: %e with SN: %e and RN: %e\n", bm->dayt, FunctGroupArray[species].groupCode, ngene, mid, MIGRATION[species].DEN[ngene][mid], MIGRATION[species].recruit[ngene][mid], MIGRATION[species].MigYOY[ngene][mid], embryo_recruits, MIGRATION[species].SN[ngene][mid], MIGRATION[species].RN[ngene][mid]); if(bm->track_contaminants && bm->flag_contamMaternalTransfer){ Get_SettlerMigrant_Contaminants(bm, species, ngene, mid, oldDEN, MIGRATION[species].recruit[ngene][mid]); } - + // Reset now passed across MIGRATION[species].recruit[ngene][mid] = 0; } @@ -1829,7 +1829,7 @@ void Recruit_Migration(MSEBoxModel *bm, int species, int wclayer, int stock_id, } } } - + return; } @@ -1846,23 +1846,23 @@ void Find_Final_Recruit_Distribution(MSEBoxModel *bm, int species, double enviro double recruitment_scalar; double hab_scalar = Get_Habitat_Mediated_Recruit_Scalar(bm, species, llogfp); enviro_scalar *= hab_scalar; - + //double KWSR_sp = FunctGroupArray[species].speciesParams[KWSR_id]; //double KWRR_sp = FunctGroupArray[species].speciesParams[KWRR_id]; //double oldDEN, oldSN, oldRN; - + if(EMBRYO[species].SpawnRecruitOverlap && EMBRYO[species].CounterNotDone) qid++; /* Recruitment scaling due to external files - added for Cam for the GOC model */ recruitment_scalar = Ecology_Get_Recruitment_Scalar(bm, species); - + /** if (bm->debug == debug_external_scaling && (bm->which_check == species)) { fprintf(bm->logFile, "Time: %e, External recruitment scaling of group %s in box %d:%d. Scaling - %e. Spawning numbers before scaling = %e, after = %e\n", bm->dayt, FunctGroupArray[species].groupCode, bm->current_box, bm->current_layer, recruitment_scalar, enviro_scalar, enviro_scalar * recruitment_scalar ); } - + if (species == 0){ fprintf(llogfp, "Time: %e %s has qid %d as next_recruit %d SpawnRecruitOverlap %d CounterNotDone %d\n", bm->dayt, FunctGroupArray[species].groupCode, qid, EMBRYO[species].next_recruit, EMBRYO[species].SpawnRecruitOverlap, EMBRYO[species].CounterNotDone); } @@ -1899,7 +1899,7 @@ void Find_Final_Recruit_Distribution(MSEBoxModel *bm, int species, double enviro fprintf(llogfp,"Time: %e, %s box%d-%d ngene: %d, qid: %d, totrecruit: %e num_rec: %e (Bulkrecruits: %e, enviro_scalar: %e, vdistrib: %e, hdistrib: %e)\n", bm->dayt, FunctGroupArray[species].groupCode, bm->current_box, wclayer, ngene, qid, totrecruit[species][stock_id][ngene], EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][qid], EMBRYO[species].BulkRecruits[ngene], enviro_scalar, vertdistrib, bm->recruit_hdistrib[ngene][bm->current_box][species]); } **/ - + break; case external_recruit: if ((bm->current_box == bm->first_box) && (bm->current_layer == bm->top_layer)) { @@ -1910,8 +1910,8 @@ void Find_Final_Recruit_Distribution(MSEBoxModel *bm, int species, double enviro if (mid < 0) { // See AlignVsMigration() for how this is set recruit_outside = 0; } - - + + /** thisday = EMBRYO[species].StartDay[ngene][qid]; @@ -1920,7 +1920,7 @@ void Find_Final_Recruit_Distribution(MSEBoxModel *bm, int species, double enviro bm->dayt, FunctGroupArray[species].groupCode, ngene, mid, thisday, MIGRATION[species].Leave_Now[mid], MIGRATION[species].Return_Now[mid], recruit_outside); } **/ - + if (recruit_outside) { //oldDEN = MIGRATION[species].DEN[ngene][mid]; //oldSN = MIGRATION[species].SN[ngene][mid]; @@ -1934,7 +1934,7 @@ void Find_Final_Recruit_Distribution(MSEBoxModel *bm, int species, double enviro // Update size here too - used to reset to KMIG each year, but that is erroneous //MIGRATION[species].SN[ngene][mid] = (oldSN * oldDEN + KWSR_sp * EMBRYO[species].BulkRecruits[ngene] * enviro_scalar) / (EMBRYO[species].BulkRecruits[ngene] * enviro_scalar + oldDEN + small_num); //MIGRATION[species].RN[ngene][mid] = (oldRN * oldDEN + KWRR_sp * EMBRYO[species].BulkRecruits[ngene] * enviro_scalar) / (EMBRYO[species].BulkRecruits[ngene] * enviro_scalar + oldDEN + small_num); - + /** //if ((species == 64) || (species == 69)) { if (species == 52) { @@ -1947,7 +1947,7 @@ void Find_Final_Recruit_Distribution(MSEBoxModel *bm, int species, double enviro MIGRATION[species].recruit[ngene][mid] = 0; EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][qid] = EMBRYO[species].BulkRecruits[ngene] * enviro_scalar * vertdistrib * bm->recruit_hdistrib[ngene][bm->current_box][species]; totrecruit[species][stock_id][ngene] += EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][qid]; - + /** //if ((species == 64) || (species == 69)) { fprintf(bm->logFile, "Time: %e %s ngene: %d qid: %d box: %d-%d num_recruit: %e BulkRecruits: %e enviro_scalar: %e vertdistrib: %e hdistrib: %e\n", @@ -1984,13 +1984,13 @@ void Find_Final_Recruit_Distribution(MSEBoxModel *bm, int species, double enviro } EMBRYO[species].num_recruits_updating[bm->current_box][wclayer][ngene][qid] = EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][qid]; - - + + /* Now find the contaminant content */ if(bm->track_contaminants && bm->flag_contamMaternalTransfer){ Set_Recruit_Final_Contaminants(bm, wclayer, species, ngene, mid, qid, recruit_outside); } - + /** //if (do_debug && (bm->which_check == species)) { //if (species == 33) { @@ -2061,7 +2061,7 @@ void Sanity_Check_Recruits(MSEBoxModel *bm, int species, FILE *llogfp){ int maxstock_id = FunctGroupArray[species].numStocks; int sp_numGeneTypes = (int) (FunctGroupArray[species].numGeneTypes); int qid = EMBRYO[species].next_larvae; - + if (recruit_sp == fixed_linear_recruit) { for(ij=0; ij < bm->nbox; ij++){ if(bm->boxes[ij].type != BOUNDARY) { @@ -2072,7 +2072,7 @@ void Sanity_Check_Recruits(MSEBoxModel *bm, int species, FILE *llogfp){ } } } - + for ( i = 0; i < maxstock_id; i++) { for(ngene = 0; ngene < sp_numGeneTypes; ngene++){ KDENR_sp = KDENR[species][i]; @@ -2087,7 +2087,7 @@ void Sanity_Check_Recruits(MSEBoxModel *bm, int species, FILE *llogfp){ } } } - + return; } @@ -2107,7 +2107,7 @@ void Store_Recruitment_Diagnostics(MSEBoxModel *bm, int species, int use_aggrega int ngene = 0, i = 0, stock_id = 0, den, k, mid, thisday, recruit_outside = 0; //int stage; int fished_chrt = 0; - + Util_Init_1D_Double(yoy, bm->K_num_max_genetypes, 0.0); /* yoy = young of the year */ @@ -2117,7 +2117,7 @@ void Store_Recruitment_Diagnostics(MSEBoxModel *bm, int species, int use_aggrega KWSR_sp = Get_Recruit_Size_Forcing(bm, species, do_debug, llogfp); KWRR_sp = KWSR_sp * FunctGroupArray[species].X_RS[ngene]; } - + //yoysum += EMBRYO[species].Larvae[i][ngene][qid]; yoy[ngene] += EMBRYO[species].Larvae[i][ngene][qid]; if (use_aggregate) { @@ -2125,19 +2125,19 @@ void Store_Recruitment_Diagnostics(MSEBoxModel *bm, int species, int use_aggrega } else { tot_yoy[species][i] = (EMBRYO[species].Larvae[i][ngene][qid] * (KWRR_sp + KWSR_sp)); } - + if(FunctGroupArray[species].externalReproducer){ for (mid = MIGRATION[species].num_in_queue_done; mid < MIGRATION[species].num_in_queue; mid++) { recruit_outside = 0; - + thisday = EMBRYO[species].StartDay[ngene][EMBRYO[species].next_recruit]; //stage = FunctGroupArray[species].cohort_stage[ngene]; - + /* Outside the model when recruitment happens */ if ((MIGRATION[species].Return_Now[mid] >= thisday) && (MIGRATION[species].Leave_Now[mid] <= thisday)) { recruit_outside = 1; } - + if (recruit_outside) { tot_yoy[species][i] += MIGRATION[species].recruit[ngene][mid] * (KWRR_sp + KWSR_sp); } @@ -2223,11 +2223,11 @@ void Store_Recruitment_Diagnostics(MSEBoxModel *bm, int species, int use_aggrega bm->calcTrackedMort[species][ngene][k][ongoingF_id] = 0.0; bm->calcTrackedMort[species][ngene][k][start_id] = 0.0; - + if (!k) { FunctGroupArray[species].min_B[ngene] = MAXDOUBLE; FunctGroupArray[species].max_B[ngene] = MINDOUBLE; - + if(FunctGroupArray[species].groupAgeType == AGE_STRUCTURED) { FunctGroupArray[species].min_wgt[ngene] = MAXDOUBLE; FunctGroupArray[species].max_wgt[ngene] = MINDOUBLE; @@ -2284,7 +2284,7 @@ void Store_Recruitment_Diagnostics(MSEBoxModel *bm, int species, int use_aggrega /* Set starting cohort size for pseduo assessment */ bm->calcNstart[species][expect_id] = biomass; bm->calcNstartPerPred[species][expect_id] = biomass; - + // Mark diet updated FunctGroupArray[species].updatedDiet = 1; @@ -2308,11 +2308,11 @@ void Get_Settlers(MSEBoxModel *bm, int species, int wclayer, int stock_id, int * //int do_debug2; int sp_checkday = (int)(bm->dayt); *recruits_arrive = 0; - + if(verbose) { printf("Doing Get_Settlers for %s\n", FunctGroupArray[species].groupCode); } - + /* If recruit within the same year do so now */ for (ngene = 0; ngene < sp_numGeneTypes; ngene ++) { /** @@ -2322,10 +2322,10 @@ void Get_Settlers(MSEBoxModel *bm, int species, int wclayer, int stock_id, int * bm->dayt, FunctGroupArray[species].groupCode, ngene, EMBRYO[species].next_recruit, EMBRYO[species].StartDay[ngene][EMBRYO[species].next_recruit], EMBRYO[species].EndDay[ngene][EMBRYO[species].next_recruit], sp_checkday, EMBRYO[species].num_recruits_updating[bm->current_box][wclayer][ngene][EMBRYO[species].next_recruit]); } **/ - + if ((sp_checkday >= EMBRYO[species].StartDay[ngene][EMBRYO[species].next_recruit]) && (sp_checkday < EMBRYO[species].EndDay[ngene][EMBRYO[species].next_recruit])) { Dayj = bm->dayt - EMBRYO[species].StartDay[ngene][EMBRYO[species].next_recruit]; - + /* Flat recruitment distribution through recruitment period */ if (flagtrecruitdistrib) { recruits_coming = EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][EMBRYO[species].next_recruit] / EMBRYO[species].RecruitPeriod[EMBRYO[species].next_recruit]; @@ -2350,13 +2350,13 @@ void Get_Settlers(MSEBoxModel *bm, int species, int wclayer, int stock_id, int * } **/ } - + if (FunctGroupArray[species].recruitType == external_recruit) { /* Recruiting into te MIGRATION array */ this_ID = EMBRYO[species].migIDmatch[EMBRYO[species].next_recruit]; MIGRATION[species].recruit[ngene][this_ID] = recruits_coming; FunctGroupArray[species].speciesParams[direct_recruit_entry_id] = 1; - + /** if (species == 33) { fprintf(llogfp, "Time: %e, get settlers %s box%d wclayer: %d num_recruits: %e, period: %e, recruits_coming: %e MIGRATION.recruit[this_ID: %d]: %e\n", bm->dayt, FunctGroupArray[species].groupCode, bm->current_box, wclayer, EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][EMBRYO[species].next_recruit], EMBRYO[species].RecruitPeriod[EMBRYO[species].next_recruit], recruits_coming, EMBRYO[species].recruitSPden[ngene], this_ID, MIGRATION[species].recruit[ngene][this_ID]); @@ -2366,7 +2366,7 @@ void Get_Settlers(MSEBoxModel *bm, int species, int wclayer, int stock_id, int * } else { /* Recruiting within the model domain */ EMBRYO[species].recruitSPden[ngene] = recruits_coming; - + /** if (species == 33) { fprintf(llogfp, "Time: %e, get settlers %s box%d wclayer: %d num_recruits: %e, period: %e, recruits_coming: %e recruitSPden: %e\n", bm->dayt, FunctGroupArray[species].groupCode, bm->current_box, wclayer, EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][EMBRYO[species].next_recruit], EMBRYO[species].RecruitPeriod[EMBRYO[species].next_recruit], recruits_coming, EMBRYO[species].recruitSPden[ngene]); @@ -2379,7 +2379,7 @@ void Get_Settlers(MSEBoxModel *bm, int species, int wclayer, int stock_id, int * //EMBRYO[species].Larvae[stock_id][ngene][EMBRYO[species].next_recruit] -= recruits_coming; EMBRYO[species].num_recruits_updating[bm->current_box][wclayer][ngene][EMBRYO[species].next_recruit] -= recruits_coming; *recruits_arrive = 1; - + //fprintf(llogfp, "Time: %e, %s box%d-%d stock %d ngene %d next_reruit: %d setting remaining Larvae: %e\n", bm->dayt, FunctGroupArray[species].groupCode, bm->current_box, wclayer, stock_id, ngene, EMBRYO[species].next_recruit, EMBRYO[species].num_recruits_updating[bm->current_box][wclayer][ngene][EMBRYO[species].next_recruit]); } @@ -2390,26 +2390,26 @@ void Get_Settlers(MSEBoxModel *bm, int species, int wclayer, int stock_id, int * fprintf(llogfp, "Time: %e, %s ngene: %d, qid (next_recruit): %d StartDay: %d, EndDay: %d, sp_checkday: %d, recruitSPden: %e, remaining larvae: %e, num_recruits%d-%d: %e, temprec: %e, RecruitPeriod: %e, flagtrecruitdistrib: %d\n", bm->dayt, FunctGroupArray[species].groupCode, ngene, EMBRYO[species].next_recruit, EMBRYO[species].StartDay[ngene][EMBRYO[species].next_recruit], EMBRYO[species].EndDay[ngene][EMBRYO[species].next_recruit], sp_checkday, EMBRYO[species].recruitSPden[ngene], EMBRYO[species].num_recruits_updating[bm->current_box][wclayer][ngene][EMBRYO[species].next_recruit], bm->current_box, wclayer, EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][EMBRYO[species].next_recruit], temprec, EMBRYO[species].RecruitPeriod[EMBRYO[species].next_recruit], flagtrecruitdistrib); } **/ - + if (EMBRYO[species].num_recruits_updating[bm->current_box][wclayer][ngene][EMBRYO[species].next_recruit] < 0.0) { - + /** //if (do_debug && (bm->which_check == species)) { if ((species == 33) || (species == 32)) { fprintf(llogfp,"Time: %e %s stock: %d, ngene: %d, out of larvae in box%d-%d as larvae : %e so larvae RESET\n", bm->dayt, FunctGroupArray[species].groupCode, stock_id, ngene, bm->current_box, bm->current_layer, EMBRYO[species].num_recruits_updating[bm->current_box][wclayer][ngene][EMBRYO[species].next_recruit]); } **/ - + /** Reset EMBRYO information and finalise settling**/ EMBRYO[species].num_recruits_updating[bm->current_box][wclayer][ngene][EMBRYO[species].next_recruit] = 0.0; EMBRYO[species].EndDay[ngene][EMBRYO[species].next_recruit] = bm->dayt + 1; - + } if (FunctGroupArray[species].speciesParams[firstrecday_id]) { EMBRYO[species].recruiting_now = 1; } - + } else { FunctGroupArray[species].speciesParams[firstrecday_id] = 1; EMBRYO[species].recruitSPden[ngene] = 0.0; @@ -2421,7 +2421,7 @@ void Get_Settlers(MSEBoxModel *bm, int species, int wclayer, int stock_id, int * **/ } - + if(bm->track_contaminants && bm->flag_contamMaternalTransfer){ Get_Settler_Contaminants(bm, wclayer, species, ngene, EMBRYO[species].next_recruit, EMBRYO[species].recruitSPden[ngene]); } @@ -2443,12 +2443,12 @@ void Init_Aging_Arrays(MSEBoxModel *bm, int species, int stock_id, int maxstock_ int sp_ddepend_move = (int)(FunctGroupArray[species].speciesParams[ddepend_move_id]); int sp_AgeClassSize = FunctGroupArray[species].ageClassSize; int qid; - + /* if(verbose) printf(" Doing Init_Aging_Arrays - %s current_box %d first_box %d current_layer %d top_layer %d\n", FunctGroupArray[species].groupCode, bm->current_box, bm->first_box, bm->current_layer, bm->top_layer); */ - + /* Initialise aging arrays - once if no site attachment, per box if there is site_attachment */ if ((bm->current_box == bm->first_box) && (bm->current_layer == bm->top_layer)) { for (cohort = 0; cohort < FunctGroupArray[species].numCohortsXnumGenes; cohort++) { @@ -2457,21 +2457,21 @@ void Init_Aging_Arrays(MSEBoxModel *bm, int species, int stock_id, int maxstock_ FunctGroupArray[species].agingVERT[cohort][i][DEN_id] = 0.0; FunctGroupArray[species].agingVERT[cohort][i][SN_id] = 0.0; FunctGroupArray[species].agingVERT[cohort][i][RN_id] = 0.0; - + /* if (species == 22) { fprintf(llogfp,"Time: %e %s-%d stock %d agingVERT zeroed\n", bm->dayt, FunctGroupArray[species].groupCode, cohort, i); } */ } - + if (sp_ddepend_move != 1) { for (nc = 0; nc < sp_AgeClassSize; nc++) { bm->tempPopRatio[i][species][cohort][nc] = 0.0; } } } - + for (qid = MIGRATION[species].num_in_queue_done; qid < MIGRATION[species].num_in_queue; qid++) { MIGRATION[species].aging[cohort][qid] = 0.0; } @@ -2507,7 +2507,7 @@ double Get_Proportion_Aging(MSEBoxModel *bm, int species, int cohort, int do_deb p_ageup = 1.0 / sp_AgeSize; if (p_ageup > 1.0) p_ageup = 1.0; - + } else { /* If non-homogeneous distribution, determine proportion to age-up */ i = (int) (sp_AgeSize - 1); @@ -2523,7 +2523,7 @@ double Get_Proportion_Aging(MSEBoxModel *bm, int species, int cohort, int do_deb if (do_debug && (bm->which_check == species)) { fprintf(llogfp, "Time: %e p_ageup: %e sp: %s cohort: %d boxPopRatio: %e sp_AgeSize: %e\n", bm->dayt, p_ageup, FunctGroupArray[species].groupCode, cohort, FunctGroupArray[species].boxPopRatio[bm->current_box][bm->current_layer][cohort][i], sp_AgeSize); **/ - + if ((p_ageup < 0) || (!_finite(p_ageup)) || (p_ageup > 1)){ fprintf(llogfp, "p_ageup: %e, sp: %s, cohort: %d, i: %d is IMPOSSIBLE?! (boxPopRatio[%d][%d][%d][%d]: %e)\n", p_ageup, FunctGroupArray[species].groupCode, cohort, i, bm->current_box, bm->current_layer, cohort, i, FunctGroupArray[species].boxPopRatio[bm->current_box][bm->current_layer][cohort][i]); quit("p_ageup: %e, sp: %s, cohort: %d, i: %d is IMPOSSIBLE?! (boxPopRatio[%d][%d][%d][%d]: %e)\n", p_ageup, FunctGroupArray[species].groupCode, cohort, i, @@ -2565,7 +2565,7 @@ double Get_Numbers_Aging(MSEBoxModel *bm, int species, int cohort, int *active_d FunctGroupArray[species].groupCode, cohort, shiftVERT[species][cohort][DEN_id], num_aging, VERTinfo[species][cohort][DEN_id]); } **/ - + // Find number aging into the age-gene bin (well it will be age+1 but the +1 transition is done in Update_Aging_Numbers() to be consistent with non-evolution case dennow = 0.0; for (ng = 0; ng < FunctGroupArray[species].numGeneTypes; ng++){ @@ -2607,7 +2607,7 @@ double Get_Numbers_Aging(MSEBoxModel *bm, int species, int cohort, int *active_d shiftVERTON[species][cohort]); } **/ - + // Used to assume that as iterating down last lostden was for the youngest ageclass, // now storing it explicitly, just to be safe (and storing one value per gene type - see lostden_zero). if(lostden > 0) @@ -2678,7 +2678,7 @@ void Update_Aging_Numbers(MSEBoxModel *bm, int species, int cohort, int stock_id fprintf(llogfp, "Time: %e, box%d-%d %s-chrt_aged_into %d stock: %d, agingDEN: %e, agingSN: %e, agingRN: %e dennow: %e\n", bm->dayt, bm->current_box, bm->current_layer, FunctGroupArray[species].groupCode, nextcid, stock_id, FunctGroupArray[species].agingVERT[nextcid][stock_id][DEN_id], FunctGroupArray[species].agingVERT[nextcid][stock_id][SN_id], FunctGroupArray[species].agingVERT[nextcid][stock_id][RN_id], dennow); } **/ - + if(bm->track_contaminants){ Age_Contaminants_Store(bm, species, cohort, nextcid, dennow, this_p_ageup); } @@ -2715,11 +2715,11 @@ void Update_Migration_Array(MSEBoxModel *bm, int species, int cohort, int maxsto //double mxs = (double)(maxstock_id); //do_debug = 1; - + if ((bm->current_box != bm->first_box) || (bm->current_layer != bm->top_layer)){ return; // As only want to do this once } - + /* Have replaced previous detailed and somewhat painful handling of aging in the MIGRATION array by having single entry per migration queue rather than trying to overload per cohort */ if (spmigrate) { if (FunctGroupArray[species].isVertebrate == TRUE){ @@ -2735,17 +2735,17 @@ void Update_Migration_Array(MSEBoxModel *bm, int species, int cohort, int maxsto } else { p_ageup = shiftVERT[species][cohort][RN_id]; // p_ageup stored here for biomass pool age structured groups } - + oldden = MIGRATION[species].DEN[nextcid][qid]; oldSN = MIGRATION[species].SN[nextcid][qid]; oldRN = MIGRATION[species].RN[nextcid][qid]; - + newSN = MIGRATION[species].SN[cohort][qid]; newRN = MIGRATION[species].RN[cohort][qid]; num_aging = (p_ageup * MIGRATION[species].DEN[cohort][qid]); /* Update size - + Start with size scalar - only needed if not using external pop code to update size explicitly */ sizeScalar = 1.0; @@ -2755,47 +2755,47 @@ void Update_Migration_Array(MSEBoxModel *bm, int species, int cohort, int maxsto sizeScalar = 1.0 + (MIGRATION[species].growth[qid] / growth_period); } } - + MIGRATION[species].SN[nextcid][qid] = (oldden * oldSN + num_aging * newSN * sizeScalar) / (oldden + num_aging + small_num); MIGRATION[species].RN[nextcid][qid] = (oldden * oldRN + num_aging * newRN * sizeScalar) / (oldden + num_aging + small_num); - + if(bm->track_contaminants){ Age_MigrantContaminants_Update(bm, species, nextcid, cohort, qid, oldden, num_aging); } - + /* Update numbers */ MIGRATION[species].DEN[nextcid][qid] += num_aging; MIGRATION[species].DEN[cohort][qid] -= num_aging; - + MIGRATION[species].aging[nextcid][qid] = num_aging; - + if (MIGRATION[species].DEN[nextcid][qid] > 0) { MIGRATION[species].cohort_migrating[nextcid][qid] = 1; - } - + } + /* Not doing this as getting double migration - as enter ok, and not checked when leave this is proabably ok if (!MIGRATION[species].cohort_migrating[nextcid][qid]) { MIGRATION[species].cohort_migrating[nextcid][qid] = 1; // Update so allowed to migrate in the movement code } */ - + /** //if (do_debug) { if (species == 33) { fprintf(llogfp,"Time: %e box%d-%d %s-%d qid: %d p_ageup: %e, DEN: %e nextDEN: %e (num_in_queue: %d)\n", bm->dayt, bm->current_box, bm->current_layer, FunctGroupArray[species].groupCode, cohort, qid, p_ageup, MIGRATION[species].DEN[cohort][qid], MIGRATION[species].DEN[nextcid][qid], MIGRATION[species].num_in_queue); } **/ - + } } else { for (qid = MIGRATION[species].num_in_queue_done; qid < MIGRATION[species].num_in_queue; qid++) { - + if( (FunctGroupArray[species].speciesParams[flagkeep_plusgroup_id] > 0) && (bm->dayt < MIGRATION[species].Return_Now[qid])) { // Do nothing as want to keep a plus group that hasn't returned to the model yet } else { MIGRATION[species].DEN[cohort][qid] *= (1.0 - p_ageup); // So have aging out of system handled } - + /** if (species == 33) { fprintf(llogfp,"Time: %e box%d-%d %s-%d qid: %d p_ageup: %e, DEN: %e\n", bm->dayt, bm->current_box, bm->current_layer, FunctGroupArray[species].groupCode, cohort, qid, p_ageup, MIGRATION[species].DEN[cohort][qid]); @@ -2816,9 +2816,9 @@ void Get_Latest_Additions(MSEBoxModel *bm, int wclayer, int species, int maxstoc int i = 0, nc = 0, cohort = 0, migstock_id = 0, ngene = 0, qid = 0, mxk = 0; //int stage = 0; double sp_AgeClassSize = (double)(FunctGroupArray[species].ageClassSize); - int sp_numGeneTypes = (int) (FunctGroupArray[species].numGeneTypes); + int sp_numGeneTypes = (int) (FunctGroupArray[species].numGeneTypes); Util_Init_1D_Double(coming_SPden, bm->K_num_max_genetypes, 0.0); - + /* Get total settlers that are in the process of arriving */ for ( ngene = 0; ngene < sp_numGeneTypes; ngene++ ){ coming_SPden[ngene] = EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][EMBRYO[species].next_recruit]; @@ -2894,7 +2894,7 @@ void Get_Latest_Additions(MSEBoxModel *bm, int wclayer, int species, int maxstoc } } } - + return; } @@ -2902,7 +2902,7 @@ void Get_Latest_Additions(MSEBoxModel *bm, int wclayer, int species, int maxstoc * \brief Update the Local tracers - the cohort index used to be i in the original code when was all in one routine * */ -void Update_Local_dPool(MSEBoxModel *bm, int species, int cohort, double Spawned_Matter, double *recruitDEN, +void Update_Local_dPool(MSEBoxModel *bm, int species, int cohort, double Spawned_Matter, double *recruitDEN, int sp_numGeneTypes, double *localWCTracers, int do_debug, FILE *llogfp) { int vids = FunctGroupArray[species].structNTracers[cohort]; int vidr = FunctGroupArray[species].resNTracers[cohort]; @@ -2915,7 +2915,7 @@ void Update_Local_dPool(MSEBoxModel *bm, int species, int cohort, double Spawned /** if (do_debug && (bm->which_check == species)) { fprintf(llogfp, "Time: %e, %s-%d starting Pool: %e with SN: %e, RN: %e with shiftden: %e and Spawned_Matter: %e\n", bm->dayt, - FunctGroupArray[species].groupCode, cohort, + FunctGroupArray[species].groupCode, cohort, localWCTracers[vidd], localWCTracers[vids], localWCTracers[vidr], shiftVERT[species][cohort][DEN_id], Spawned_Matter); } **/ @@ -2954,7 +2954,7 @@ void Update_Local_dPool(MSEBoxModel *bm, int species, int cohort, double Spawned } } - + /** if ((do_debug && (shiftVERT[species][cohort][DEN_id] > 0.0)) || (!_finite(localWCTracers[vidd]))) { fprintf(llogfp, "Time: %e %s-%d newPool: %e (%e) with SN: %e RN: %e (Spawned_Matter: %e shiftDEN: %e)\n", @@ -2993,18 +2993,18 @@ void Update_Age_Distrib(MSEBoxModel *bm, int species, int stock_id, int sp_ddepe Util_Init_1D_Int(stock_done, bm->K_num_stocks_per_sp, 0); Util_Init_1D_Double(totsum, bm->K_num_stocks_per_sp, 0.0); Util_Init_1D_Double(totksum, bm->K_num_stocks_per_sp, 0.0); - + /* - + if(((bm->nbox < bm->checkbox) || (bm->current_box == bm->checkbox)) && (bm->dayt > bm->checkstart) && (bm->which_check == species)) do_debug = 1; - + if ((FunctGroupArray[species].numSpawns > 1) || (FunctGroupArray[species].groupType == FISH_INVERT)) do_debug = 1; if (bm->which_check == species) do_debug = 1; - + if((bm->which_check == species) && (bm->dayt >= bm->checkstart)) do_debug = 1; @@ -3183,7 +3183,7 @@ void Update_Age_Distrib(MSEBoxModel *bm, int species, int stock_id, int sp_ddepe bm->tempPopRatio[stock_id][species][cohort][k] /= totksum[stock_id]; } } - + /* If site attached update local age distribution */ for (k = 0; k < classize; k++) { FunctGroupArray[species].boxPopRatio[bm->current_box][bm->current_layer][cohort][k] = bm->tempPopRatio[stock_id][species][cohort][k]; @@ -3244,7 +3244,7 @@ void Update_Age_Distrib(MSEBoxModel *bm, int species, int stock_id, int sp_ddepe if(rec_related) bm->tempPopRatio[i][species][cohort][k] = recVERTpopratio[i][species][cohort][k]; totsum[i] += bm->tempPopRatio[i][species][cohort][k]; - + /** if(do_debug){ fprintf(llogfp,"Time: %e step 1 %s-%d stock %d k: %d tempPopRatio: %e (recVERTpopratio: %e) totsum %e allgone: %d\n", @@ -3274,7 +3274,7 @@ void Update_Age_Distrib(MSEBoxModel *bm, int species, int stock_id, int sp_ddepe if (bm->tempPopRatio[i][species][cohort][k] > maxvalue) maxvalue = bm->tempPopRatio[i][species][cohort][k]; - + /** if(do_debug){ fprintf(llogfp,"Time: %e step 2 %s-%d stock %d k: %d tempPopRatio: %e totsum %e\n", @@ -3304,7 +3304,7 @@ void Update_Age_Distrib(MSEBoxModel *bm, int species, int stock_id, int sp_ddepe } totksum[i] += bm->tempPopRatio[i][species][cohort][k]; - + /* if(do_debug){ fprintf(llogfp,"Time: %e step 4 %s-%d stock %d classize: %d tempPopRatio: %e totksum %e\n", @@ -3323,11 +3323,11 @@ void Update_Age_Distrib(MSEBoxModel *bm, int species, int stock_id, int sp_ddepe } if (totksum[i] != 1) { - + /* Renormalise */ for (k = 0; k < classize; k++) { bm->tempPopRatio[i][species][cohort][k] /= totksum[i]; - + /** if(do_debug){ fprintf(llogfp,"Time: %e step 5 renormalising %s-%d stock %d classize %d tempPopRatio: %e totksum %e\n", @@ -3352,7 +3352,7 @@ void Update_Age_Distrib(MSEBoxModel *bm, int species, int stock_id, int sp_ddepe for (b = 0; b < classize; b++) { FunctGroupArray[species].boxPopRatio[ij][k][cohort][b] = bm->tempPopRatio[stock_id][species][cohort][b]; - + if(!_finite(FunctGroupArray[species].boxPopRatio[ij][k][cohort][b])){ quit("boxPopRatio for %s-%d in box%d-%d sub-chort (b) %d is NAN as tempPopRatio for stock_id %d = %e MIGRATIONaging may hold more\n", FunctGroupArray[species].groupCode, cohort, ij, k, b, stock_id, bm->tempPopRatio[stock_id][species][cohort][b]); @@ -3375,7 +3375,7 @@ void Update_Age_Distrib(MSEBoxModel *bm, int species, int stock_id, int sp_ddepe } } } - + // Update migrators so nhave an appropriate proportion assigned to aging event on return if (MIGRATION[species].num_in_queue > 0) { for (cohort = 0; cohort < NumCohort; cohort++) { @@ -3390,7 +3390,7 @@ void Update_Age_Distrib(MSEBoxModel *bm, int species, int stock_id, int sp_ddepe } } } - + /* If aging alone then ended, if has to recruit also then set flag to -1 to signal already done age distribution recalculation */ @@ -3542,7 +3542,7 @@ void Determine_Stock_Prop(MSEBoxModel *bm, int species, int maxstock_id, int who stock_prop[species][stock_id] += bm->stock_struct_prop[species][n][stock_id] * scale; overall_tot += bm->stock_struct_prop[species][n][stock_id] * scale; } - + } /* Find total amount */ @@ -3633,29 +3633,29 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { //do_debug = 0; //if(species == 7) // do_debug = 1; - + if (FunctGroupArray[species].speciesParams[flag_id] == TRUE && FunctGroupArray[species].isVertebrate == TRUE) { Util_Init_1D_Double(tot_new_mat, bm->K_num_max_cohort * bm->K_num_max_genetypes, 0.0); //Util_Init_1D_Int(mig_status, bm->K_num_max_stages, 0); - + /** if((bm->dayt >= bm->checkstart) && (sp == bm->which_check)) do_debug = 1; else do_debug = 0; - + if (bm->which_check == species) do_debug = 1; - + if ((FunctGroupArray[species].numSpawns > 1) || (FunctGroupArray[species].groupType == FISH_INVERT)) do_debug = 1; - + if((bm->dayt >= bm->checkstart) && (species == bm->which_check)) do_debug = 1; if ((species == 64) || (species == 69)) do_debug = 1; - + if((bm->dayt >= bm->checkstart) && (species == bm->which_check)) do_debug = 1; **/ @@ -3671,7 +3671,7 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { if(bm->M_est_method == Z_and_F_based) { Record_End_Num(bm, species); } - + /* Initialise aging in general */ for (cohort = 0; cohort < FunctGroupArray[species].numCohortsXnumGenes; cohort++) { for (k = 0; k < maxstock; k++) { @@ -3708,11 +3708,11 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { /* Determine proportion of the population that is currently outside the model domain */ if (sp_mignum) { - + // Was for (cohort = (((FunctGroupArray[species].numCohorts - 1) * FunctGroupArray[species].numGeneTypes) - 1); cohort > -1 ; cohort--) // I think can actually be as written below but keeping it here for reference just in case - - + + for (cohort = FunctGroupArray[species].numCohortsXnumGenes - 1; cohort > -1 ; cohort--) { // Running backwards so don't need embedded stage check to see different migration status for mig_status (if run forward then get wrong answer for young_in_old_out as not done the later stages when do the younger finalmig = 0; avgsn = 0; @@ -3722,36 +3722,36 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { nextcid = cid + FunctGroupArray[species].numGeneTypes; //stage = FunctGroupArray[species].cohort_stage[cohort]; //next_stage = FunctGroupArray[species].cohort_stage[nextcid]; - + // For each migration group? num_in_MIG_total = 0.0; for (qid = MIGRATION[species].num_in_queue_done; qid < MIGRATION[species].num_in_queue; qid++) { num_in_MIG = MIGRATION[species].DEN[cohort][qid]; num_in_MIG_total += MIGRATION[species].DEN[cohort][qid]; - + // Does prop_mig[cohort] have to be handled as migration_den[cohort+1] - as put against agingDEN which already cast to [cohort+1]? I don't think so as called form main loop so aging will have happened already on previous iteration of the model // #TODO: check this assumption re cohort vs cohrot+1 MIGRATION[species].prop_mig[cohort][qid] = num_in_MIG / (totden[species][cohort] + num_in_MIG + small_num); } - + MIGRATION[species].totprop_mig[cohort] += num_in_MIG_total / (totden[species][cohort] + num_in_MIG_total + small_num); - + if (MIGRATION[species].totprop_mig[cohort] > 1.0) MIGRATION[species].totprop_mig[cohort] = 1.0; /* Allocate those who would age-up into an age class outside the model domain to the Migration array. Only do this if juveniles becoming adults and one away while the other isn't - + Do allocation of aging into Migration array only when appropriate - i.e. juveniles in model domain and adults not. If both outside model domain then code in Update_Migration_Array() will handle it. Also if juveniles are outside the domain and the adults are inside then this is dealt with in Update_Migration_Array() too - see logic discussion in Update_Migration_Array() - + By default mat_transition_thresh should be something high like 0.99 and juv_transition_thresh something lower like 0.1 or 0.5 etc, so this only comes into play when the majority of the adult popualtion is outside the model and juveniles not, but made them variables so more easily adjusted as needed - + */ if ((cohort < age_mat) && (nextcid >= age_mat)) { if ((MIGRATION[species].totprop_mig[cohort] < bm->juv_transition_thresh) && (MIGRATION[species].totprop_mig[nextcid] > bm->mat_transition_thresh)) { @@ -3762,11 +3762,11 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { fprintf(llogfp, "Time: %e, Looking at %s-%d with totprop_mig-%d (juv) %e totprop_mig-%d (mat): %e juv_transition_thresh: %e mat_transition_thresh: %e\n", bm->dayt, FunctGroupArray[species].groupCode, cohort, MIGRATION[species].totprop_mig[cohort], MIGRATION[species].totprop_mig[nextcid],bm->juv_transition_thresh, bm->mat_transition_thresh); } **/ - + // #TODO: Do we need to use MIGRATION[species].all_go[cohort][qid] here? if (FunctGroupArray[species].agingVERT[cohort][k][DEN_id] > 0) { warn("Juveniles have to suddenly flee domain as age for %s (time: %e)\n", FunctGroupArray[species].groupCode, bm->dayt); // Warngin as doesn't really make sense to have to do this - + for (k = 0; k < maxstock; k++) { oldden = MIGRATION[species].DEN[nextcid][qid]; oldSN = MIGRATION[species].SN[nextcid][qid]; @@ -3818,7 +3818,7 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { **/ } } - + /* Apply newly mature individuals accordingly */ //totsum = 0; for (cohort = 1; cohort < FunctGroupArray[species].numCohortsXnumGenes; cohort++) { @@ -3835,7 +3835,7 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { denup = (1.0 - MIGRATION[species].totprop_mig[cohort]) * FunctGroupArray[species].agingVERT[cohort][stock_id][DEN_id] * FunctGroupArray[species].AGEnewden[cohort][0][ij] * spSTOCKprop[stock_id][cohort] / AGE_stock_struct_prop[species][cohort][stock_id]; - + if (denup < 0.0) denup = 0.0; @@ -3849,7 +3849,7 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { bm->boxes[ij].tr[0][rn] = (dennow * rnnow + FunctGroupArray[species].agingVERT[cohort][stock_id][RN_id] * denup) / nextden; } bm->boxes[ij].tr[0][den] = nextden; - + if ((do_debug) || (!_finite(bm->boxes[ij].tr[0][den]))) { fprintf(llogfp, "Update1-Land Time: %e, box%d-%d %s-chrt%d, dennow: %e, snnow: %e, aging-stock%d-SN: %e, denup: %e, nextden: %e\n", bm->dayt, ij, 0, FunctGroupArray[species].groupCode, cohort, dennow, snnow, stock_id, @@ -3862,7 +3862,7 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { FunctGroupArray[species].groupCode, cohort, bm->boxes[ij].tr[0][den] / (dennow + small_num), bm->boxes[ij].tr[0][sn] / snnow, bm->boxes[ij].tr[0][rn] / rnnow); } - + if((!_finite(bm->boxes[ij].tr[0][den]))){ quit("Ecology_Update_Vert_Cohorts %s-%d has nan numbers in box %d-%d\n", FunctGroupArray[species].groupCode, cohort, ij, 0); } @@ -3879,7 +3879,7 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { bm->boxes[ij].tr[0][sn] = snnow; if (sp_AgeSize < 1 && bm->boxes[ij].tr[0][rn] < bm->min_pool * 10.0) bm->boxes[ij].tr[0][rn] = rnnow; - + /* Note that age distributions have already been updated in Vertebrate_Reproduction */ } else if (bm->boxes[ij].type != BOUNDARY) { @@ -3914,7 +3914,7 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { if (denup < 0.0) denup = 0.0; - + nextden = bm->boxes[ij].tr[k][den] + denup + small_num; dennow = bm->boxes[ij].tr[k][den]; snnow = bm->boxes[ij].tr[k][sn]; @@ -3923,7 +3923,7 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { if (nextden > 0 && MIGRATION[species].totprop_mig[cohort] < 0.99) { bm->boxes[ij].tr[k][sn] = (dennow * snnow + FunctGroupArray[species].agingVERT[cohort][stock_id][SN_id] * denup) / nextden; bm->boxes[ij].tr[k][rn] = (dennow * rnnow + FunctGroupArray[species].agingVERT[cohort][stock_id][RN_id] * denup) / nextden; - + if(bm->track_contaminants){ Age_Contaminants_Update(bm, species, cohort, denup, dennow, nextden, ij, k); } @@ -3944,7 +3944,7 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { if((!_finite(bm->boxes[ij].tr[k][den])) || (bm->boxes[ij].tr[k][den] < 0.0)){ quit("Ecology_Update_Vert_Cohorts %s-%d has nan numbers or is a negative in box %d-%d\n", FunctGroupArray[species].groupCode, cohort, ij, k); } - + /** //if ((species == 64) || (species == 69)) { //if (species == 22) { @@ -3974,7 +3974,7 @@ void Ecology_Update_Vertebrate_Cohorts(MSEBoxModel *bm, FILE *llogfp) { bm->boxes[ij].tr[k][sn] = snnow; if (sp_AgeSize < 1 && bm->boxes[ij].tr[k][rn] < bm->min_pool * 10.0) bm->boxes[ij].tr[k][rn] = rnnow; - + /* Note that age distributions have already been updated in Vertebrate_Reproduction */ } } @@ -4027,7 +4027,7 @@ void Record_End_Num(MSEBoxModel *bm, int species) { int ij, k, cohort, stock_id, den, fished_chrt; double chrt_biomass; double biomass = 0.0; - + for(cohort = FunctGroupArray[species].numGeneTypes; cohortcalcTrackedMort[species][cohort][stock_id][endNum_id] = 0.0; } - + if(FunctGroupArray[species].groupAgeType == AGE_STRUCTURED) { den = FunctGroupArray[species].NumsTracers[cohort]; for (ij = 0; ij < bm->nbox; ij++) { @@ -4045,9 +4045,9 @@ void Record_End_Num(MSEBoxModel *bm, int species) { for (k = 0; k < bm->boxes[ij].nz; k++) { if (fished_chrt == cohort ) biomass += bm->boxes[ij].tr[k][den]; - + stock_id = bm->group_stock[species][ij][k]; - + bm->calcTrackedMort[species][cohort][stock_id][endNum_id] += bm->boxes[ij].tr[k][den]; } } @@ -4057,15 +4057,15 @@ void Record_End_Num(MSEBoxModel *bm, int species) { for (ij = 0; ij < bm->nbox; ij++) { // Loop through each pelagic layer for (k = 0; k < bm->boxes[ij].nz; k++) { - + stock_id = bm->group_stock[species][ij][k]; - + chrt_biomass = bm->boxes[ij].tr[k][den] * bm->boxes[ij].dz[k] * bm->boxes[ij].area * FunctGroupArray[species].habitatCoeffs[WC]; bm->calcTrackedMort[species][cohort][stock_id][endNum_id] += chrt_biomass; } // Set relk for sediment and epibenthos by assuming its the one in deepest vertical layer stock_id = bm->group_stock[species][ij][0]; // As assuming k = 0 - + // Loop through each sediment layer for (k = 0; k < bm->boxes[ij].sm.nz; k++) { chrt_biomass = bm->boxes[ij].sm.tr[k][den] * bm->boxes[ij].sm.dz[k] * bm->boxes[ij].area * FunctGroupArray[species].habitatCoeffs[SED]; @@ -4079,7 +4079,7 @@ void Record_End_Num(MSEBoxModel *bm, int species) { } } } - + return; } @@ -4146,17 +4146,17 @@ void Reset_Mortality(MSEBoxModel *bm, int species) { bm->calcTrackedPredMort[species][cohort][k][pred][final_id] = bm->calcTrackedPredMort[species][cohort][k][pred][ongoing_id] / (bm->calcTrackedMort[species][cohort][k][start_id] + small_num); bm->calcTrackedPredMort[species][cohort][k][pred][ongoing_id] = 0.0; } - + bm->calcTrackedMort[species][cohort][k][ongoingM1_id] = 0.0; bm->calcTrackedMort[species][cohort][k][ongoingM2_id] = 0.0; bm->calcTrackedMort[species][cohort][k][ongoingF_id] = 0.0; bm->calcTrackedMort[species][cohort][k][start_id] = 0.0; - + if (!k) { FunctGroupArray[species].min_B[cohort] = MAXDOUBLE; FunctGroupArray[species].max_B[cohort] = MINDOUBLE; - + if(FunctGroupArray[species].groupAgeType == AGE_STRUCTURED) { FunctGroupArray[species].min_wgt[cohort] = MAXDOUBLE; FunctGroupArray[species].max_wgt[cohort] = MINDOUBLE; @@ -4211,7 +4211,7 @@ void Reset_Mortality(MSEBoxModel *bm, int species) { } bm->calcNstart[species][expect_id] = biomass; bm->calcNstartPerPred[species][expect_id] = biomass; - + FunctGroupArray[species].updatedDiet = 2; return; @@ -4256,10 +4256,10 @@ void Invertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int to do_debug = 1; } else do_debug = 0; - + //if(((bm->current_box == bm->checkbox) || (bm->dayt >= bm->checkstart)) && (bm->which_check == species)) // do_debug = 1; - + //if (bm->which_check == species) // do_debug = 1; @@ -4334,10 +4334,10 @@ void Invertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int to /* if (do_debug && (bm->which_check == species)) - fprintf(llogfp, "day %d, %s-%d box: %d-%d starting_biom: %e, sp_Spawn_Now = %d, sp_Age_Now: %d, spawn_day: %d, age_day: %d, overall_checkday: %d, sp_spawnday: %d, additional_day: %d, stuff_to_do: %d\n", + fprintf(llogfp, "day %d, %s-%d box: %d-%d starting_biom: %e, sp_Spawn_Now = %d, sp_Age_Now: %d, spawn_day: %d, age_day: %d, overall_checkday: %d, sp_spawnday: %d, additional_day: %d, stuff_to_do: %d\n", overall_checkday, FunctGroupArray[species].groupCode, cohort, bm->current_box, bm->current_layer, this_biom, sp_Spawn_Now, sp_Age_Now, EMBRYO[species].Spawn_Now[cohort][EMBRYO[species].next_spawn], EMBRYO[species].Age_Now[cohort][EMBRYO[species].next_age], overall_checkday, sp_spawnday, additional_day, stuff_to_do); */ - + if (!sp_Spawn_Now && !sp_Age_Now && !stuff_to_do) { /* Not spawning or aging now so don't do anything */ continue; @@ -4362,7 +4362,7 @@ void Invertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int to if (do_debug && (bm->which_check == species)) fprintf(llogfp, "%s-%d box: %d-%d, spawning_biomass = %e spawn_active: %e this_biom: %e, scaled_FSPB: %e\n", FunctGroupArray[species].groupCode, cohort, bm->current_box, bm->current_layer, spawning_biomass, spawn_active, this_biom, FunctGroupArray[species].scaled_FSPB[cohort]); */ - + /* Spawning - internal to model domain */ Ecology_Find_Invert_Spawn(bm, species, spawning_biomass, stock_id, plankton, CHLa, llogfp); @@ -4377,7 +4377,7 @@ void Invertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int to if (do_debug && (bm->which_check == species)) fprintf(llogfp, "%s-%d box: %d-%d, overall_checkday: %d, sp_spawnday: %d, additional_day: %d\n", FunctGroupArray[species].groupCode, cohort, bm->current_box, bm->current_layer, overall_checkday, sp_spawnday, additional_day); */ - + /* Reset spawning readiness - can't do it at the time due to multiple layer handling */ if (overall_checkday == (sp_spawnday + additional_day)) { EMBRYO[species].readytospawn[stock_id] = 2; // Reset so ready for next spawning event (now this one is done) @@ -4392,7 +4392,7 @@ void Invertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int to if (do_debug && (bm->which_check == species)) fprintf(llogfp, "%s-%d box: %d-%d, spawned_biomass = %e ", FunctGroupArray[species].groupCode, cohort, bm->current_box, bm->current_layer, spawned_biomass); */ - + /* Check for environmental effects */ enviro_scalar = 1.0; enviro_scalar = Get_Enviro_Recruit_Forcing(bm, species, do_debug, llogfp); @@ -4402,7 +4402,7 @@ void Invertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int to if (do_debug && (bm->which_check == species)) fprintf(llogfp, "enviro_scalar = %e ", enviro_scalar); */ - + /* Check for vertical distribution of new recruits */ if (FunctGroupArray[species].recruitType) { vertdistrib = 1.0; @@ -4423,7 +4423,7 @@ void Invertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int to if (do_debug && (bm->which_check == species)) fprintf(llogfp, "vertdistrib = %e\n", vertdistrib); */ - + Find_Final_Invert_Recruit_Distribtuion(bm, species, ngene, qid, stock_id, spawned_biomass, wclayer, llogfp); /* Update yoy sum - only if localised recruit as all other cases done in Store_Recruitment_Diagnostics() */ @@ -4477,7 +4477,7 @@ void Invertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int to if(bm->M_est_method == Z_and_F_based) { Record_End_Num(bm, species); } - + Init_Aging_Arrays(bm, species, stock_id, maxstock_id, llogfp); /* Add the cohort that is maturing (if senescent they will just age out of the system and die) */ @@ -4493,10 +4493,10 @@ void Invertebrate_Reproduction(MSEBoxModel *bm, int wclayer, int maxdeep, int to /* if (do_debug && (bm->which_check == species)) - fprintf(llogfp," %s-%d (bc %d vs nc %d) biomass_newly_mature: %e, this_biom: %e, p_ageup: %e\n", + fprintf(llogfp," %s-%d (bc %d vs nc %d) biomass_newly_mature: %e, this_biom: %e, p_ageup: %e\n", FunctGroupArray[species].groupCode, cohort, basecohort, num_cohorts, biomass_newly_mature, this_biom, p_ageup); */ - + /* Did something */ did_something = 1; } @@ -4611,7 +4611,7 @@ void Ecology_Find_Invert_Spawn(MSEBoxModel *bm, int species, double spawning_bio boxkey_id = bm->BoxKeyMap[bm->current_box][rects_key_id]; EMBRYO[species].Larvae[stock_id][ngene][qid] += Get_Imposed_MultRecruits(bm, species, do_debug, boxkey_id, llogfp); } - + if (FunctGroupArray[species].recruitType) EMBRYO[species].Larvae[stock_id][ngene][qid] = local_spawn_biomass; // Local biomass sets the number of recruits else @@ -4685,7 +4685,7 @@ double Ecology_Find_Invert_Recruits(MSEBoxModel *bm, int species, int ngene, int stock_scalar1 = recSTOCK[species][stock_id]; pop_spawning_biomass = bm->totfishpop[species] * stock_prop[species][stock_id]; } - + //if (bm->which_check == species) // do_debug = 1; @@ -4740,7 +4740,7 @@ double Ecology_Find_Invert_Recruits(MSEBoxModel *bm, int species, int ngene, int // force_recover_recruit); break; case Ricker_recruit: /* Ricker */ - case SSB_ricker: /* SSB based ricker version - for senescent and short lived species */ + case SSB_ricker: /* SSB based ricker version - for senescent and short lived species */ spawned_biomass = pop_spawning_biomass * exp(stock_scalar1 * Ralpha_sp * (1.0 - pop_spawning_biomass / Rbeta_sp)); break; case jackknife_recruit: /* Jackknife spawning function - sum up spawning stock biomass */ @@ -4766,7 +4766,7 @@ double Ecology_Find_Invert_Recruits(MSEBoxModel *bm, int species, int ngene, int step1 = spawned_biomass; spawned_biomass = Util_Normx_Result(step1, norm_sigma); } - + if (do_debug && (bm->which_check == species)) fprintf(llogfp,"%s has recruit_sp: %d, spawned_biomass %e\n", FunctGroupArray[species].groupCode, recruit_sp, spawned_biomass); @@ -4830,7 +4830,7 @@ void Ecology_Update_Invert_Cohorts(MSEBoxModel *bm, FILE *llogfp) { bm->calcTrackedMort[species][n][k][ongoingM2_id] = 0.0; bm->calcTrackedMort[species][n][k][ongoingF_id] = 0.0; bm->calcTrackedMort[species][n][k][start_id] = 0.0; - + FunctGroupArray[species].min_B[n] = MAXDOUBLE; FunctGroupArray[species].max_B[n] = MINDOUBLE; @@ -4864,7 +4864,7 @@ void Ecology_Update_Invert_Cohorts(MSEBoxModel *bm, FILE *llogfp) { } bm->calcNstart[species][expect_id] = biomass; bm->calcNstartPerPred[species][expect_id] = biomass; - + FunctGroupArray[species].updatedDiet = 1; } @@ -4876,10 +4876,10 @@ void Ecology_Update_Invert_Cohorts(MSEBoxModel *bm, FILE *llogfp) { FunctGroupArray[species].speciesParams[need_matupdate_id] = 0; } } - + } } - + return; } @@ -4907,7 +4907,7 @@ void Find_Final_Invert_Recruit_Distribtuion(MSEBoxModel *bm, int species, int ng EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][qid] = hab_scalar * spawned_biomass * bm->recruit_hdistrib[ngene][bm->current_box][species]; totrecruit[species][stock_id][ngene] += EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][qid]; - + /* if(EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][qid] > 0){ fprintf(llogfp,"Time: %e box%d-%d %s ngene: %d, qid: %d, num_rec: %e, hab_scalar: %e, spawned_biomass: %e, hdistrib: %e, totrecruit: %e\n", @@ -4919,7 +4919,7 @@ void Find_Final_Invert_Recruit_Distribtuion(MSEBoxModel *bm, int species, int ng case at_parent_location: EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][qid] = hab_scalar * spawned_biomass; totrecruit[species][stock_id][ngene] += EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][qid]; - + /* fprintf(llogfp,"Time: %e box%d-%d %s ngene: %d, qid: %d, num_rec: %e, hab_scalar: %e, spawned_biomass: %e, totrecruit: %e\n", bm->dayt, bm->current_box, wclayer, FunctGroupArray[species].groupCode, ngene, qid, EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][qid], @@ -4938,7 +4938,7 @@ void Find_Final_Invert_Recruit_Distribtuion(MSEBoxModel *bm, int species, int ng //thisday = (double)(EMBRYO[species].Spawn_Now[cohort][EMBRYO[species].next_spawn]); thisday = (double)EMBRYO[species].StartDay[cohort][EMBRYO[species].next_recruit]; //pid = FunctGroupArray[species].cohort_stage[cohort]; - + /* Recruit while outside the model */ if ((MIGRATION[species].Return_Now[mid] >= thisday) && (MIGRATION[species].Leave_Now[mid] <= thisday)) { recruit_outside = 1; @@ -4950,7 +4950,7 @@ void Find_Final_Invert_Recruit_Distribtuion(MSEBoxModel *bm, int species, int ng } else { MIGRATION[species].recruit[ngene][mid] = 0; } - + /** if ((species == 26) || (species == 35) || (species == 64)) { fprintf(llogfp,"Time: %e box%d-%d %s ngene: %d, mid: %d, MIGden: %e, MIGrecruit: %e, hab_scalar: %e, spawned_biomass: %e, totrecruit: %e\n", @@ -4987,8 +4987,8 @@ void Find_Final_Invert_Recruit_Distribtuion(MSEBoxModel *bm, int species, int ng break; } /* - fprintf(llogfp,"%s case: %d, qid: %d, spawned_biomass: %e, num_rec: %e\n", - FunctGroupArray[species].groupCode,FunctGroupArray[species].recruitType, qid, spawned_biomass, + fprintf(llogfp,"%s case: %d, qid: %d, spawned_biomass: %e, num_rec: %e\n", + FunctGroupArray[species].groupCode,FunctGroupArray[species].recruitType, qid, spawned_biomass, EMBRYO[species].num_recruits[bm->current_box][wclayer][ngene][qid]); */ } @@ -5031,7 +5031,7 @@ void Update_Invert_Aging(MSEBoxModel *bm, double *localWCTracers, int species, i /* for (i = 0; i < FunctGroupArray[species].numCohortsXnumGenes; i++) { - fprintf(llogfp, "Time: %e %s-%d box%d-%d biom_start: %e\n", + fprintf(llogfp, "Time: %e %s-%d box%d-%d biom_start: %e\n", bm->dayt, FunctGroupArray[species].groupCode, i, bm->current_box, bm->current_layer, localWCTracers[FunctGroupArray[species].totNTracers[i]]); } */ @@ -5112,12 +5112,12 @@ void Update_Invert_Aging(MSEBoxModel *bm, double *localWCTracers, int species, i } } */ - + /* Lose those aging up and any contributions to spawning */ localWCTracers[FunctGroupArray[species].totNTracers[cohort]] -= ((biomass_newly_mature + spawning_biomass_contrib) / tracer_correction); /* Gain newly aged up * Note: Originally had no terminal entry below just skipped this addition if (basecohort == num_cohorts) - * However added in terminal age class step below so can have multi-year age cohorts for biomass pools + * However added in terminal age class step below so can have multi-year age cohorts for biomass pools */ localWCTracers[FunctGroupArray[species].totNTracers[nextcid]] += (biomass_newly_mature / tracer_correction); /* Gain new recruits */ @@ -5136,7 +5136,7 @@ void Update_Invert_Aging(MSEBoxModel *bm, double *localWCTracers, int species, i bm->dayt, FunctGroupArray[species].groupCode, bm->current_box, bm->current_layer, cohort, ngene, sp_numGeneTypes, nextcid, new_settled_biomass/tracer_correction, biomass_newly_mature/tracer_correction, biomass_terminal_class/tracer_correction, spawning_biomass_contrib/tracer_correction); for (i = 0; i < FunctGroupArray[species].numCohortsXnumGenes; i++) { - fprintf(llogfp, "Time: %e %s-%d box%d-%d biom_end: %e\n", + fprintf(llogfp, "Time: %e %s-%d box%d-%d biom_end: %e\n", bm->dayt, FunctGroupArray[species].groupCode, i, bm->current_box, bm->current_layer, localWCTracers[FunctGroupArray[species].totNTracers[i]]); } } @@ -5154,7 +5154,7 @@ void Update_Invert_Cohorts(MSEBoxModel *bm, int species, int stock_id, int maxst int i = 0, k = 0, classize = 1, sp_recruitpeak = 0, cohort = 0, qid; double totksum = 0, sp_recruitRange = 0, this_totsum = 0, maxvalue = 0; double sp_AgeClassSize = (double)(FunctGroupArray[species].ageClassSize); - + if ((int) (sp_AgeClassSize) == 0) classize = 1; else @@ -5210,7 +5210,7 @@ void Update_Invert_Cohorts(MSEBoxModel *bm, int species, int stock_id, int maxst } else { bm->tempPopRatio[stock_id][species][cohort][k] /= (this_totsum + small_num); } - + if (bm->tempPopRatio[stock_id][species][cohort][k] > maxvalue) { maxvalue = bm->tempPopRatio[stock_id][species][cohort][k]; } diff --git a/atlantis/ateconomic/Makefile.in b/atlantis/ateconomic/Makefile.in index 82fe19d..e38e8b9 100644 --- a/atlantis/ateconomic/Makefile.in +++ b/atlantis/ateconomic/Makefile.in @@ -283,6 +283,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -368,7 +369,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" lib_LIBRARIES = libateconomic.a libateconomic_adir = $(includedir)/ateconomic libateconomic_a_SOURCES = ateconindicator.c ateconomic.c ateconomicsetup.c \ diff --git a/atlantis/atharvest/Makefile.in b/atlantis/atharvest/Makefile.in index 45c4562..28cb5ef 100644 --- a/atlantis/atharvest/Makefile.in +++ b/atlantis/atharvest/Makefile.in @@ -282,6 +282,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -367,7 +368,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" lib_LIBRARIES = libatharvest.a libatharvest_adir = $(includedir)/atharvest libatharvest_a_SOURCES = atHarvestAnnual.c atHarvest.c atHarvestIndex.c atHarvestIO.c atHarvestTS.c \ diff --git a/atlantis/atimplementation/Makefile.in b/atlantis/atimplementation/Makefile.in index a245cfd..dcb92eb 100644 --- a/atlantis/atimplementation/Makefile.in +++ b/atlantis/atimplementation/Makefile.in @@ -278,6 +278,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -363,7 +364,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" lib_LIBRARIES = libatimplementation.a libatimplementation_adir = $(includedir)/atimplementation c_sources = atImplementationAnnual.c atImplementationSetup.c atImplementationParamIO.c diff --git a/atlantis/atlantisUtil/Makefile.in b/atlantis/atlantisUtil/Makefile.in index 8714877..5078e14 100644 --- a/atlantis/atlantisUtil/Makefile.in +++ b/atlantis/atlantisUtil/Makefile.in @@ -281,6 +281,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -366,7 +367,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" lib_LIBRARIES = libatlantisutil.a libatlantisutil_adir = $(includedir)/atlantisUtil libatlantisutil_a_SOURCES = atUtilhelp.c atUtil.c atUtilArray.c atUtilUnix.c atUtilIO.c atUtilGroupIO.c atUtilXML.c atUtilFisheryIO.c \ diff --git a/atlantis/atlantismain/Makefile.in b/atlantis/atlantismain/Makefile.in index 63038b0..4a8ab62 100644 --- a/atlantis/atlantismain/Makefile.in +++ b/atlantis/atlantismain/Makefile.in @@ -284,6 +284,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -369,7 +370,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" atlantisMergeddir = $(includedir)/atlantismain atlantisMerged_SOURCES = atlantismain.c atlantisboxmodel.h atlantisMerged_LDADD = -latlantisutil -latassess -latphysics \ diff --git a/atlantis/atlink/Makefile.in b/atlantis/atlink/Makefile.in index 873a003..ac2b9a7 100644 --- a/atlantis/atlink/Makefile.in +++ b/atlantis/atlink/Makefile.in @@ -274,6 +274,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -359,7 +360,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" lib_LIBRARIES = libatlink.a libatlink_adir = $(includedir)/atlink libatlink_a_SOURCES = atComms.c atlinkconversion.o atlinkexport.c atlinkimport.c atComms.h atlink.h atLinkModule.h diff --git a/atlantis/atmanage/Makefile.in b/atlantis/atmanage/Makefile.in index 2cac1e6..4fb867d 100644 --- a/atlantis/atmanage/Makefile.in +++ b/atlantis/atmanage/Makefile.in @@ -280,6 +280,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -365,7 +366,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" lib_LIBRARIES = libatmanage.a libatmanage_adir = $(includedir)/atmanage libatmanage_a_SOURCES = atManageAnnual.c atManage.c \ diff --git a/atlantis/atphysics/Makefile.in b/atlantis/atphysics/Makefile.in index ddd6cad..7e87e31 100644 --- a/atlantis/atphysics/Makefile.in +++ b/atlantis/atphysics/Makefile.in @@ -301,6 +301,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -386,7 +387,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" lib_LIBRARIES = libatphysics.a libatphysics_adir = $(includedir)/atphysics libatphysics_a_SOURCES = atbioirrig.c atbioturb.c atboundary.c atdecay.c atdeposition.c \ diff --git a/atlantis/config.h.in b/atlantis/config.h.in index 411831d..d465ed9 100644 --- a/atlantis/config.h.in +++ b/atlantis/config.h.in @@ -134,6 +134,9 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Release version */ +#undef RELEASE_VERSION + /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE diff --git a/atlantis/configure b/atlantis/configure index 1b55c2a..15a1755 100755 --- a/atlantis/configure +++ b/atlantis/configure @@ -661,6 +661,7 @@ OS_LINUX_FALSE OS_LINUX_TRUE GCC_GE_730_FALSE GCC_GE_730_TRUE +RELEASE_VERSION LIBOBJS host_os host_vendor @@ -7309,6 +7310,103 @@ then : fi +#fetching release tag from git +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for release version" >&5 +printf %s "checking for release version... " >&6; } +RELEASE_VERSION=$(git describe --tags 2>/dev/null || echo "unknown") +#RELEASE_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "unknown") +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RELEASE_VERSION" >&5 +printf "%s\n" "$RELEASE_VERSION" >&6; } + +printf "%s\n" "#define RELEASE_VERSION \"$RELEASE_VERSION\"" >>confdefs.h + + + +if test "x$ac_cv_func_vprintf" = xno +then : + ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" +if test "x$ac_cv_func__doprnt" = xyes +then : + +printf "%s\n" "#define HAVE_DOPRNT 1" >>confdefs.h + +fi + +fi +ac_fn_c_check_func "$LINENO" "floor" "ac_cv_func_floor" +if test "x$ac_cv_func_floor" = xyes +then : + printf "%s\n" "#define HAVE_FLOOR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "localtime_r" "ac_cv_func_localtime_r" +if test "x$ac_cv_func_localtime_r" = xyes +then : + printf "%s\n" "#define HAVE_LOCALTIME_R 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" +if test "x$ac_cv_func_memset" = xyes +then : + printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" +if test "x$ac_cv_func_pow" = xyes +then : + printf "%s\n" "#define HAVE_POW 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "regcomp" "ac_cv_func_regcomp" +if test "x$ac_cv_func_regcomp" = xyes +then : + printf "%s\n" "#define HAVE_REGCOMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sqrt" "ac_cv_func_sqrt" +if test "x$ac_cv_func_sqrt" = xyes +then : + printf "%s\n" "#define HAVE_SQRT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp" +if test "x$ac_cv_func_strcasecmp" = xyes +then : + printf "%s\n" "#define HAVE_STRCASECMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" +if test "x$ac_cv_func_strchr" = xyes +then : + printf "%s\n" "#define HAVE_STRCHR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" +if test "x$ac_cv_func_strdup" = xyes +then : + printf "%s\n" "#define HAVE_STRDUP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" +if test "x$ac_cv_func_strerror" = xyes +then : + printf "%s\n" "#define HAVE_STRERROR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strncasecmp" "ac_cv_func_strncasecmp" +if test "x$ac_cv_func_strncasecmp" = xyes +then : + printf "%s\n" "#define HAVE_STRNCASECMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" +if test "x$ac_cv_func_strstr" = xyes +then : + printf "%s\n" "#define HAVE_STRSTR 1" >>confdefs.h + +fi + +# if test `gcc -dumpversion | gawk '{print $1>=7?"1":"0"}'` = 1; then diff --git a/atlantis/sjwlib/Makefile.in b/atlantis/sjwlib/Makefile.in index 26cd2de..53ea8eb 100644 --- a/atlantis/sjwlib/Makefile.in +++ b/atlantis/sjwlib/Makefile.in @@ -308,6 +308,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RELEASE_VERSION = @RELEASE_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -393,7 +394,10 @@ GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') #-Wconversion WARN = -Wall -Wextra -Wno-unused-parameter -Wuninitialized \ -Warray-bounds $(am__append_1) -AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) + +#fetching repo version from git +AM_CFLAGS = $(DEFINES) $(INCLUDES) $(DBG) $(OPT) $(EF) $(PG) $(WARN) \ + -DRELEASE_VERSION=\"$(RELEASE_VERSION)\" h_sources = $(top_srcdir)/sjwlib/include/datafile.h \ $(top_srcdir)/sjwlib/include/gridlib.h \ $(top_srcdir)/sjwlib/include/mapproj.h \ From ba191af4144e943ae2e4f59d9d2bcc24b393181b Mon Sep 17 00:00:00 2001 From: Hem Nalini Morzaria-Luna Date: Fri, 22 May 2026 19:38:28 -0700 Subject: [PATCH 11/11] Update CHANGELOG.md Added missing pullets and revisions from last pull request to dev --- CHANGELOG.md | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e82e07c..fd63f0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,36 +1,54 @@ # Changelog All notable changes to this repository will be documented in this file. -As changed, removed or added. +As changed, removed, or added. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [3.6722] - 2026-04-23 - Commit 4f6c3d7 +## [3.6722] - 2026-05-22 - Commit ### Added -Created md file with a table listing Atlantis models in use, location, and contact person -GitHub actions to build and run SETAS when a pull request is triggered -Templates for bug reporting, feature requests and pull requests that standardize content for maintainers and reviewers. -Parameter min_pool_cont for the Contaminant module, which sets the threshold for minimum contaminant concentration. This addition decouples min_pool a global parameter from the contaminant submodule. Need to add min_pool_cont as a parameter if using track_contaminants -Instructions to add new features or bug fixes to the user manual. The documentation should be updated directly after the feature or bug is incorporated in a new release -Code to identify the Git release and return the release version +- Created md file with a table listing Atlantis models in use, location, and contact person +- GitHub actions to build and run SETAS when a pull request is triggered +- Templates for bug reporting, feature requests and pull requests that standardize content for maintainers and reviewers. +- Parameter min_pool_cont for the Contaminant module, which sets the threshold for minimum contaminant concentration. This addition decouples min_pool a global parameter from the contaminant submodule. Need to add min_pool_cont as a parameter if using track_contaminants +- Instructions to add new features or bug fixes to the user manual. The documentation should be updated directly after the feature or bug is incorporated in a new release +- Code to identify the Git release and return the release version +- mFC fisheries produce no harvest when flagdisplace is on. The Effort array is used as a scalar multiplier for mFC catch but was initialized to 0.0 instead of 1.0. Added flagMFCdisplace_id to identify mFC fisheries and initialize their Effort to 1.0. Modified the fishery activation check to prevent mFC fisheries with displacement from being skipped. Files: atlantisboxmodel.h, atManageSetup.c, atManage.c + ### Changed -In atlantis/PreRules.am‎ refactors the code to detect the underlying OS and then "turn" on the appropriate flag -Readme and CHANGELOG are updated +- In atlantis/PreRules.am‎ refactors the code to detect the underlying OS and then "turn" on the appropriate flag +- Readme and CHANGELOG are updated +- CumDisplaceEffort accumulation was in dead code path. Accumulation was in the if(!bm->EffortModelsActive) block, but EffortModelsActive is true when any fishery has flageffortmodel > 0 (including forced effort = 11). Placed accumulation in the EffortModelsActive code path instead. +File: atManage.c +- Wrong box index for MPA scaling in readts_effort branch. MPA scale was read from bm->MPA[bm->current_box][fishery_id] instead of bm->MPA[ij][fishery_id]. current_box was always 0, so every box got box 0's MPA value. Changed to bm->MPA[ij][fishery_id]. +File: atManage.c +- orig_FCpressure set after MPA scaling instead of before. In the readts_effort branch, orig_FCpressure was assigned after FCpressure *= mpa_scale, so Effort_Displacement computed orig_FCpressure - FCpressure = 0. Set orig_FCpressure before MPA scaling. +File: atManage.c +- All displacement logic was gated by TempCPUE < mEff_thresh. For readts_effort fisheries, TempCPUE is never calculated (stays 0.0), and with mEff_thresh = 0.0 the condition 0.0 < 0.0 is false. The manual (Section 15.6.1) states displacement should occur both for low CPUE and when MPAs are imposed. Added MPA as alternative trigger: if ((TempCPUE < mEff_thresh) || (MPA[ij][fishery_id] < 1.0)). File: atManage.c (Effort_Displacement function) +- Inverted MPA check in displacement destination scoring. Adjacent boxes were scored using MPA_check = 1.0 - bm->MPA[nb][fishery_id]. For open boxes (MPA=1.0) this gives 0.0, zeroing out their biomass attractiveness. Changed to MPA_check = bm->MPA[nb][fishery_id] so open boxes retain full attractiveness. +File: atManage.c (Effort_Displacement function) +- Biomass comparison blocked MPA-imposed displacement. Displacement was conditional on maxfishthere > fishhere. Closed MPA boxes can have high target biomass, causing this condition to fail. The manual states displacement "will still occur" when MPAs are imposed. Separated MPA-imposed displacement (unconditional, find best open neighbour) from CPUE-triggered displacement (conditional on better biomass elsewhere). File: atManage.c (Effort_Displacement function) +- Renamed output file from OutDisplaceEffort.txt to OutDetailedEffort.txt (atHarvestIO.c) +- Detailed in the following Google group thread: https://groups.google.com/g/atlantis-ecosystem-model/c/gNJN6AXaM88, the way the allocation is done does not match the way BiTAC_sp is used. For instance: +AtlantisTrunk/atlantis/atmanage/atManage.c. Line 2382 in 9f99af0, bm->BiTAC_sp[bim][nreg][sp][now_id] = 0.0; shows that the second dimension is nreg, but the allocation used the number of species for the second dimension. +- SVN release number was printed in log file. This has been replaced by GitHub version release in an earlier PR. For this to work git is required as a system dependency. This will not work for the SETAS workflow. This version number also needs to be printed to standard out. This PR fixes the standard out printing ### Removed -Extra printfs in atUtils.c used for debugging -Extra printfs in atbiology.c that was creating a memory error -atbiology.c +- Extra printfs in atUtils.c used for debugging +- Extra printfs in atbiology.c that was creating a memory error +- atbiology.c //printf("printing tracer\n"); //printf("WC - %d, box: %d, layer: %d, %s - bm->atEcologyModule->localTracer[i] = %.20e, fluxFlag = %d\n",i, bm->current_box, bm->current_layer, Varname[i], localWCTracers[i], Fluxflag[i]); +- Rremove .DS_Store files and .Rhistory. .DS_Store are in the .gitignore but once they are tracked they need to be removed explicitly (https://docs.github.com/en/get-started/git-basics/ignoring-files). +- Existing quit statement in at_demography.c for when maternal transfer was on and had externally reproducing species , but the necessary code has been added and the quit statement is no longer necessary ## [3.6721] - 2026-01-12 - Commit 51f186d ### Added -Missing lines in Free_Contaminants in atContaminant.c +- Missing lines in Free_Contaminants in atContaminant.c free(bm->contaminantStructure[cIndex]->sp_avoid); free(bm->contaminantStructure[cIndex]->sp_K_avoid); free(bm->contaminantStructure[cIndex]->sp_L);