Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SimAquaLife
GR3D
Commits
df8a3fac
Commit
df8a3fac
authored
Aug 27, 2019
by
Lambert Patrick
Browse files
with male and female recruits
parent
a02df59d
Changes
2
Show whitespace changes
Inline
Side-by-side
data/input/fishTryRealBV_CC.xml
View file @
df8a3fac
...
...
@@ -302,6 +302,7 @@
<delta__t>
0.33
</delta__t>
<survOptRep>
0.0017
</survOptRep>
<lambda>
4.1E-4
</lambda>
<proportionOfFemaleAtBirth>
0.5
</proportionOfFemaleAtBirth>
<initialLength>
2.0
</initialLength>
<sigmaRecruitment>
0.2
</sigmaRecruitment>
<survivalRateAfterReproduction>
0.1
</survivalRateAfterReproduction>
...
...
src/main/java/species/ReproduceAndSurviveAfterReproductionWithDiagnose.java
View file @
df8a3fac
...
...
@@ -60,6 +60,7 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
private
double
survivalRateAfterReproduction
=
0.1
;
private
double
maxNumberOfSuperIndividualPerReproduction
=
50
.;
private
boolean
withDiagnose
=
true
;
private
double
proportionOfFemaleAtBirth
=
0.5
;
private
boolean
displayFluxesOnConsole
=
true
;
...
...
@@ -98,7 +99,8 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
for
(
RiverBasin
riverBasin
:
group
.
getEnvironment
().
getRiverBasins
()){
double
b
,
c
,
alpha
,
beta
,
amountPerSuperIndividual
,
S95
,
S50
;
double
numberOfFemaleGenitors
=
0
.;
double
numberOfFemaleSpawners
=
0
.;
double
numberOfMaleSpawners
=
0
.;
double
numberOfAutochtones
=
0
.;
double
numberOfFemaleSpawnerForFirstTime
=
0
.;
double
femaleSpawnersForFirstTimeAgesSum
=
0
.;
...
...
@@ -169,18 +171,23 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
// age of autochnonous spawnser
Map
<
Integer
,
Long
>
ageOfNativeSpawners
=
new
TreeMap
<
Integer
,
Long
>();
// compute the number of spawners and keep the origines of the spawners
// compute the number of female spawners and keep the origine of the female spawners
for
(
DiadromousFish
fish
:
fishInBasin
){
if
(
fish
.
getGender
()
==
Gender
.
FEMALE
&
fish
.
isMature
()){
if
(
fish
.
isMature
())
{
// number of spawners per gender
if
(
fish
.
getGender
()
==
Gender
.
FEMALE
)
{
//System.out.println(fish.getAge() + " -> "+ fish.getLength() + " ("+fish.getStage()+")");
if
(
fish
.
getNumberOfReproduction
()
<
1
)
{
numberOfFemaleSpawnerForFirstTime
++;
femaleSpawnersForFirstTimeAgesSum
+=
fish
.
getAge
();
}
numberOfFemaleGenitors
+=
fish
.
getAmount
()
;
// on ajoute a chaque fois le fish.getAmount (CcumSum)
numberOfFemaleSpawners
+=
fish
.
getAmount
()
;
// on ajoute a chaque fois le fish.getAmount (CcumSum)
}
else
if
(
fish
.
getGender
()
==
Gender
.
MALE
)
{
numberOfMaleSpawners
+=
fish
.
getAmount
()
;
// on ajoute a chaque fois le fish.getAmount (CcumSum)
}
// spawner per origine
String
basinName
=
fish
.
getBirthBasin
().
getName
();
...
...
@@ -199,14 +206,20 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
// increment number of reproduction (for possible iteroparty)
fish
.
incNumberOfReproduction
();
// origin of the spwaner
fluxOrigin
spawnerOrigin
;
if
(
fish
.
getBirthBasin
()
==
riverBasin
)
spawnerOrigin
=
fluxOrigin
.
AUTOCHTONOUS
;
else
spawnerOrigin
=
fluxOrigin
.
ALLOCHTONOUS
;
// survival after reproduction (semelparity or iteroparity) of SI (change the amount of the SI)
survivalAmount
=
Miscellaneous
.
binomialForSuperIndividual
(
group
.
getPilot
(),
fish
.
getAmount
(),
survivalRateAfterReproduction
);
double
biomass
=
0
.;
fluxOrigin
origin
;
if
(
fish
.
getBirthBasin
()==
riverBasin
)
origin
=
fluxOrigin
.
AUTOCHTONOUS
;
else
origin
=
fluxOrigin
.
ALLOCHTONOUS
;
survivalAmount
=
Miscellaneous
.
binomialForSuperIndividual
(
group
.
getPilot
(),
fish
.
getAmount
(),
survivalRateAfterReproduction
)
;
// update the amount of fish or kill the fish if survival amount = 0
// compute nutrient fluxes
if
(
survivalAmount
>
0
)
{
// SUperindividu est encore vivant mais il perd des effectifs
//Export for fishes survived after spawning (survivalAmount) : excretion + gametes
...
...
@@ -217,15 +230,15 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
for
(
String
nutrient:
aFluxAfterSurvival
.
keySet
())
{
//For survival fish
totalInputFluxes
.
get
(
o
rigin
).
put
(
nutrient
,
totalInputFluxes
.
get
(
o
rigin
).
get
(
nutrient
)
+
aFluxAfterSurvival
.
get
(
nutrient
)
*
survivalAmount
);
totalInputFluxes
.
get
(
spawnerO
rigin
).
put
(
nutrient
,
totalInputFluxes
.
get
(
spawnerO
rigin
).
get
(
nutrient
)
+
aFluxAfterSurvival
.
get
(
nutrient
)
*
survivalAmount
);
//For dead fish
totalInputFluxes
.
get
(
o
rigin
).
put
(
nutrient
,
totalInputFluxes
.
get
(
o
rigin
).
get
(
nutrient
)
+
aFluxForDeadFish
.
get
(
nutrient
)
*
(
fish
.
getAmount
()
-
survivalAmount
));
totalInputFluxes
.
get
(
spawnerO
rigin
).
put
(
nutrient
,
totalInputFluxes
.
get
(
spawnerO
rigin
).
get
(
nutrient
)
+
aFluxForDeadFish
.
get
(
nutrient
)
*
(
fish
.
getAmount
()
-
survivalAmount
));
}
//compute biomass for dead fish
biomass
=
group
.
getNutrientRoutine
().
getWeight
(
fish
)
*
(
fish
.
getAmount
()
-
survivalAmount
);
totalInputFluxes
.
get
(
o
rigin
).
put
(
"biomass"
,
totalInputFluxes
.
get
(
o
rigin
).
get
(
"biomass"
)
+
biomass
);
totalInputFluxes
.
get
(
spawnerO
rigin
).
put
(
"biomass"
,
totalInputFluxes
.
get
(
spawnerO
rigin
).
get
(
"biomass"
)
+
biomass
);
//update the amount of individual in the super-individual
fish
.
setAmount
(
survivalAmount
);
...
...
@@ -238,27 +251,27 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
Map
<
String
,
Double
>
aFlux
=
group
.
getNutrientRoutine
().
computeNutrientsInputForDeathAfterSpawning
(
fish
);
//
for
(
String
nutrient:
aFlux
.
keySet
())
{
totalInputFluxes
.
get
(
o
rigin
).
put
(
nutrient
,
totalInputFluxes
.
get
(
o
rigin
).
get
(
nutrient
)
+
aFlux
.
get
(
nutrient
)
*
fish
.
getAmount
());
//Fish.getAmount - survivalAmount = total fishes died.
totalInputFluxes
.
get
(
spawnerO
rigin
).
put
(
nutrient
,
totalInputFluxes
.
get
(
spawnerO
rigin
).
get
(
nutrient
)
+
aFlux
.
get
(
nutrient
)
*
fish
.
getAmount
());
//Fish.getAmount - survivalAmount = total fishes died.
}
biomass
=
group
.
getNutrientRoutine
().
getWeight
(
fish
)
*
(
fish
.
getAmount
());
totalInputFluxes
.
get
(
o
rigin
).
put
(
"biomass"
,
totalInputFluxes
.
get
(
o
rigin
).
get
(
"biomass"
)
+
biomass
);
totalInputFluxes
.
get
(
spawnerO
rigin
).
put
(
"biomass"
,
totalInputFluxes
.
get
(
spawnerO
rigin
).
get
(
"biomass"
)
+
biomass
);
}
}
}
// keep the
spawner numb
er
riverBasin
.
setLastSpawnerNumber
(
numberOfFemale
Genito
rs
);
// keep the
number of female spawn
er
riverBasin
.
setLast
Female
SpawnerNumber
(
numberOfFemale
Spawne
rs
);
// --------------------------------------------------------------------------------------------------
// Diagnose of the population dynamics in the basin
// --------------------------------------------------------------------------------------------------
if
(
withDiagnose
==
true
)
{
if
(
withDiagnose
==
true
)
{
// calculate and keep the features of the stock recruitment relationships
riverBasin
.
setMortalityCrash
(
stockRecruitmentRelationship
.
getSigmaZcrash
());
// initialise the mortality function for the autochnous spawners
// use to approximate the mortality of all the spawners to give a proxy of the Allee trap
if
(
numberOfFemale
Genito
rs
>
0
.)
{
if
(
numberOfFemale
Spawne
rs
>
0
.)
{
List
<
Trio
<
Integer
,
Long
,
Long
>>
mortalityData
=
new
ArrayList
<
Trio
<
Integer
,
Long
,
Long
>>();
// first age
// second effective of native spwaner
...
...
@@ -289,50 +302,37 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
"\tZcrash="
+
stockRecruitmentRelationship
.
getSigmaZcrash
()
+
"\tZ="
+
riverBasin
.
getNativeSpawnerMortality
());
System
.
out
.
println
(
"\tStrap="
+
stockRecruitmentRelationship
.
getStockTrap
(
riverBasin
.
getNativeSpawnerMortality
())+
"\tStotal="
+
numberOfFemale
Genito
rs
+
"\tSautochthonous="
+
"\tStotal="
+
numberOfFemale
Spawne
rs
+
"\tSautochthonous="
+
spawnerOriginsDuringReproduction
.
get
(
riverBasin
.
getName
()));
String
message
;
if
(
Double
.
isNaN
(
riverBasin
.
getNativeSpawnerMortality
()))
message
=
"noSense"
;
else
{
double
stockTrap
=
stockRecruitmentRelationship
.
getStockTrap
(
riverBasin
.
getNativeSpawnerMortality
());
if
(
riverBasin
.
getNativeSpawnerMortality
()>
stockRecruitmentRelationship
.
getSigmaZcrash
())
message
=
"overZcrash"
;
else
{
if
(
numberOfFemaleGenitors
<
stockTrap
)
message
=
"inTrapWithStrayers"
;
else
{
if
(
spawnerOriginsDuringReproduction
.
get
(
riverBasin
.
getName
())
<
stockTrap
)
message
=
"inTrapWithOnlyNatives"
;
else
message
=
"sustain"
;
}
}
}
//System.out.println("\t"+message);
// System.out.println("\t"+ riverBasin.getPopulationStatus());
}
// --------------------------------------------------------------------------------------------------
// Reproduction process (number of recruits)
// Reproduction process (compute the number of recruits)
// need to have at least one female and one male
// use the proportion of female at birth to compute the number of recruits of each gender
// --------------------------------------------------------------------------------------------------
if
(
numberOfFemale
Genitors
>
0
.)
{
if
(
numberOfFemale
Spawners
>
0
.
&&
numberOfMaleSpawners
>
0
.)
{
//BH Stock-Recruitment relationship with logistic depensation
double
meanNumberOfRecruit
=
stockRecruitmentRelationship
.
getRecruitment
(
numberOfFemale
Genito
rs
);
double
meanNumberOfRecruit
=
stockRecruitmentRelationship
.
getRecruitment
(
numberOfFemale
Spawne
rs
);
// lognormal random draw
muRecruitment
=
Math
.
log
(
meanNumberOfRecruit
)
-
(
Math
.
pow
(
sigmaRecruitment
,
2
))/
2
;
long
numberOfRecruit
=
Math
.
round
(
Math
.
exp
(
genNormal
.
nextDouble
()*
sigmaRecruitment
+
muRecruitment
));
long
numberOfFemaleRecruit
=
Math
.
round
(
numberOfRecruit
*
proportionOfFemaleAtBirth
);
long
numberOfMaleRecruit
=
numberOfRecruit
-
numberOfFemaleRecruit
;
//System.out.println(group.getPilot().getCurrentTime()+" "+Time.getSeason(group.getPilot())+" "+ riverBasin.getName()+": " + numberOfGenitors + " spwaners \tgive "+ numberOfRecruit + " recruits");
// ----------------------------------------------
// keep information when reproduction
// keep last % of autochtone
riverBasin
.
getLastPercentagesOfAutochtones
().
push
(
numberOfAutochtones
*
100
/
numberOfFemale
Genito
rs
);
riverBasin
.
getLastPercentagesOfAutochtones
().
push
(
numberOfAutochtones
*
100
/
numberOfFemale
Spawne
rs
);
// keep the number of spawners for the firt time in the basin
// keep the number of spawners for the fir
s
t time in the basin
if
(
numberOfFemaleSpawnerForFirstTime
>
0
){
riverBasin
.
getSpawnersForFirstTimeMeanAges
().
push
(
femaleSpawnersForFirstTimeAgesSum
/
numberOfFemaleSpawnerForFirstTime
);
}
else
{
...
...
@@ -345,15 +345,34 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
// Creation of new superFish
if
(
numberOfRecruit
>
0
){
// features of the super individuals
int
numberOfsuperIndividual
=
Math
.
max
(
1
,
(
int
)
Math
.
round
(
numberOfRecruit
/
amountPerSuperIndividual
));
long
effectiveAmount
=
numberOfRecruit
/
numberOfsuperIndividual
;
long
numberOfsuperIndividual
,
effectiveAmount
,
remainingFish
;
for
(
int
i
=
0
;
i
<
numberOfsuperIndividual
;
i
++){
// features of the super individuals
// for female
numberOfsuperIndividual
=
Math
.
max
(
1L
,
Math
.
round
(
numberOfFemaleRecruit
/
amountPerSuperIndividual
));
effectiveAmount
=
(
long
)
Math
.
floor
(
numberOfFemaleRecruit
/
numberOfsuperIndividual
);
for
(
long
i
=
0
;
i
<
(
numberOfsuperIndividual
-
1
);
i
++){
group
.
addAquaNism
(
new
DiadromousFish
(
group
.
getPilot
(),
riverBasin
,
initialLength
,
effectiveAmount
,
Gender
.
FEMALE
));
}
// the last Super indivial could be larger to include remainging fish
remainingFish
=
numberOfFemaleRecruit
-
numberOfsuperIndividual
*
effectiveAmount
;
group
.
addAquaNism
(
new
DiadromousFish
(
group
.
getPilot
(),
riverBasin
,
initialLength
,
effectiveAmount
+
remainingFish
,
Gender
.
FEMALE
));
// for male
numberOfsuperIndividual
=
Math
.
max
(
1L
,
Math
.
round
(
numberOfMaleRecruit
/
amountPerSuperIndividual
));
effectiveAmount
=
(
long
)
Math
.
floor
(
numberOfMaleRecruit
/
numberOfsuperIndividual
);
for
(
long
i
=
0
;
i
<
(
numberOfsuperIndividual
-
1
);
i
++){
group
.
addAquaNism
(
new
DiadromousFish
(
group
.
getPilot
(),
riverBasin
,
initialLength
,
effectiveAmount
,
Gender
.
MALE
));
}
// the last Super indivial could be larger to include remainging fish
remainingFish
=
numberOfMaleRecruit
-
numberOfsuperIndividual
*
effectiveAmount
;
group
.
addAquaNism
(
new
DiadromousFish
(
group
.
getPilot
(),
riverBasin
,
initialLength
,
effectiveAmount
+
remainingFish
,
Gender
.
FEMALE
));
// ----------------------------------------------
// keep information when reproduction with success
// stock the first year when recruitment is non nul
if
(
riverBasin
.
getYearOfFirstNonNulRep
()
==
0
){
riverBasin
.
setYearOfFirstNonNulRep
(
Time
.
getYear
(
group
.
getPilot
()));
...
...
@@ -386,6 +405,7 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
}
else
{
// stock information when no spawners reproduce
System
.
out
.
println
(
riverBasin
.
getName
()+
"\tF:"
+
numberOfFemaleSpawners
+
" M:"
+
numberOfMaleSpawners
);
riverBasin
.
setYearOfLastNulRep
(
Time
.
getYear
(
group
.
getPilot
()));
riverBasin
.
getLastRecruitmentExpectations
().
push
((
long
)
0
);
riverBasin
.
getLastRecruitments
().
push
((
long
)
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment