Commit 78836a70 authored by Lambert Patrick's avatar Lambert Patrick
Browse files

Merge branch 'Camille_Bis' into patrick

parents 618ac5a9 9bda7a7f
......@@ -235,7 +235,7 @@
<lFirstMaturityForMale>40.0</lFirstMaturityForMale>
<processes>
<processesAtBegin>
</processesAtBegin>
<processesEachStep>
......@@ -247,15 +247,15 @@
<temporisation>0</temporisation>
</species.PlopProcess>
<species.PopulateBasinNetworkSeveralTimes>
<species.PopulateBasinNetworkSeveralTimesAccordingToBasinSize>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<nbSIPerBasin>200</nbSIPerBasin>
<nbFishPerSI>2500</nbFishPerSI>
<initialLength>20.0</initialLength>
<initialLength>2.0</initialLength>
<etaPopulate>40.0</etaPopulate>
<timesOfPopulate>5</timesOfPopulate>
<populateSeason>SPRING</populateSeason>
</species.PopulateBasinNetworkSeveralTimes>
</species.PopulateBasinNetworkSeveralTimesAccordingToBasinSize>
<species.Age>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
</species.Age>
......@@ -291,11 +291,11 @@
<species.Survive>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<tempMinSurvivalSpawnerInRiv>9.0</tempMinSurvivalSpawnerInRiv>
<tempMinSurvivalSpawnerInRiv>9.4</tempMinSurvivalSpawnerInRiv>
<tempMaxSurvivalSpawnerInRiv>23.0</tempMaxSurvivalSpawnerInRiv>
<!-- <tempOptSurvivalSpawnerInRiv>20.0</tempOptSurvivalSpawnerInRiv> -->
<survivalProbOptGenInRiv>1.0</survivalProbOptGenInRiv>
<!-- <mortalityRateInRiver>0.4</mortalityRateInRiver> -->
<tempOptSurvivalSpawnerInRiv>20.0</tempOptSurvivalSpawnerInRiv>
<survivalProbOptSpawnerInRiv>1.0</survivalProbOptSpawnerInRiv>
<!--<mortalityRateInRiver>0.4</mortalityRateInRiver> -->
<mortalityRateInSea>0.4</mortalityRateInSea>
<mortalityRateInOffshore>0.4</mortalityRateInOffshore>
</species.Survive>
......
library(openxlsx)
# ============================================================
dataBruch = read.xlsx("/home/patrick/Documents/AA/CC et migrateur/thèse Poulet/BDalosesBruch.xlsx")
dataBruch = read.xlsx("BDalosesBruch.xlsx")
#dataBruch = read.xlsx("/home/patrick/Documents/AA/CC et migrateur/thèse Poulet/BDalosesBruch.xlsx")
dataBruch$`M.gonades.(g)` = as.numeric(dataBruch$`M.gonades.(g)`)
head(dataBruch)
......@@ -162,7 +163,6 @@ for (i in 1:100) {
lines(age, apply(res, 1, quantile, probs =0.5 ), lty=2, lwd = 2, col = 'red')
lines( age, rowMeans(res))
for (i in 1:100) {
lines(age, vonBertalaffyIncrement(max(age)/timestep, L0, Linf, koptFemale, timestep, sigma, withTempEffect = TRUE), col='pink')
}
......@@ -261,4 +261,157 @@ Wpost= mean(dataBruch$`M.tot.(g)`[sel])
WgonadSpent =mean(dataBruch$`M.gonades.(g)`[sel], na.rm = TRUE)
(Wloss=(Wpre - Wpost)/Wpre)
# ===================================================================
# Exploration of Stock recruitement-relationship for GR3D calibration
# =====================================================================
#Use to improve the likelihood between observations and GR3D outputs in terms of abudances and North limit colonization.
#a = fécondité de l'espèce, a = 135000
#S = quantité de géniteurs: ici on veut la quantité R0 produite par 1000 géniteurs en fonction de la T°
#Ratio = 0.2
#n= paramètre simulant l'effet Allee
#-----------On cherche a reproduire la relation SR telle que modélisée dans GR3D--------------
temperatureEffect= function(tempWater, TminRep, ToptRep, TmaxRep){
# if (tempWater<=TminRep | tempWater >= TmaxRep)
# return(0)
# else
response=(tempWater-TminRep)*(tempWater-TmaxRep)/((tempWater-TminRep)*(tempWater-TmaxRep)-(tempWater-ToptRep)^2)
response[tempWater<=TminRep | tempWater >= TmaxRep] = 0
return(response)
}
#Relation SR telle qu'elle est modélisée dans GR3D
numberOfSpawner<- seq(0:400000)
StockRecruitementRelationship <-function (temp, surfaceWatershed, S) {
lambda = 4.1E-4
deltaTrecruitement = 0.33
survOptRep = 0.0017
n= 2.4
ratioTeta = 1.9
a = 135000
#parametre c de la RS de BH intégrant un effet du BV considéré
cj = lambda/surfaceWatershed
#parametre b représentant la mortalité densité dépendante de la RS de BH intégrant un effet de la temperature
# bj = (-(1/deltaTrecruitement))*
# log(survOptRep * temperatureEffect(temp, 9.8, 20.0, 26.0))
bj = - log(survOptRep * temperatureEffect(temp, 9.8, 20.0, 26.0)) / deltaTrecruitement
#parametre a (fécondité de l'espèce) de la RS de BH intégrant un effet de la temperature
alphaj = (bj * exp(-bj * deltaTrecruitement)) / (cj * (1-exp(-bj * deltaTrecruitement)))
#Bj = paramètre de la relation SR intégrant l'effet de la température
betaj = bj/(a*cj*(1-exp(-bj*deltaTrecruitement)))
#p = proportion de géniteurs participant à la reproduction en focntion de la quantité de géniteur total
#p = 1/(1+exp(-log(19)*(S-n)/(Ratio*surfaceWatershed)))
S95 = n * surfaceWatershed
S50 = S95/ratioTeta
p= 1/(1+exp(-log(19)*(S-S50)/(S95-S50)))
#relation Stock Recrutement ie calcul le nombre de recrues en fonction du nombre de géniteurs et de la T en intégrant l'effet Allee
#R0 = aj * S * p
AlleeEffect = 1/ (1+exp(-log(19)*(S -n/ratioTeta*surfaceWatershed)/(n*surfaceWatershed -n/ratioTeta*surfaceWatershed)))
Rj = (alphaj * S * AlleeEffect)/(betaj +S * AlleeEffect)
#Rj = ((aj * S) * p)/(Bj +S * p)
StockRecruitement = as.data.frame(Rj)
return (Rj)
}
StockRecruitement<-StockRecruitementRelationship (18, 84810, numberOfSpawner)
plot(numberOfSpawner, StockRecruitement,type = 'l', xlab= "Number of spawners", ylab = "Number of recruits")
#-----------On cherche à déterminer le numbre de juvéniles générés par S = 100000 géniteurs en fonction de la T° --------------
temperature <- seq (8,30,.1)
numberOfSpawner=100000
StockRecruitementRelationship <-function (temp, surfaceWatershed, S) {
lambda = 4.1E-4
deltaTrecruitement = 0.33
survOptRep = 0.0017
n= 2.4
ratioTeta = 1.9
a = 135000
#parametre c de la RS de BH intégrant un effet du BV considéré
cj = lambda/surfaceWatershed
#parametre b représentant la mortalité densité dépendante de la RS de BH intégrant un effet de la temperature
# bj = (-(1/deltaTrecruitement))*
# log(survOptRep * temperatureEffect(temp, 9.8, 20.0, 26.0))
bj = - log(survOptRep * temperatureEffect(temp, 9.8, 20.0, 26.0)) / deltaTrecruitement
#parametre a (fécondité de l'espèce) de la RS de BH intégrant un effet de la temperature
alphaj = (bj * exp(-bj * deltaTrecruitement)) / (cj * (1-exp(-bj * deltaTrecruitement)))
#Bj = paramètre de la relation SR intégrant l'effet de la température
betaj = bj/(a*cj*(1-exp(-bj*deltaTrecruitement)))
#p = proportion de géniteurs participant à la reproduction en focntion de la quantité de géniteur total
#p = 1/(1+exp(-log(19)*(S-n)/(Ratio*surfaceWatershed)))
S95 = n * surfaceWatershed
S50 = S95/ratioTeta
p= 1/(1+exp(-log(19)*(S-S50)/(S95-S50)))
#relation Stock Recrutement ie calcul le nombre de recrues en fonction du nombre de géniteurs et de la T en intégrant l'effet Allee
#R0 = aj * S * p
AlleeEffect = 1/ (1+exp(-log(19)*(S -n/ratioTeta*surfaceWatershed)/(n*surfaceWatershed -n/ratioTeta*surfaceWatershed)))
Rj = (alphaj * S * AlleeEffect)/(betaj +S * AlleeEffect)
#Rj = ((aj * S) * p)/(Bj +S * p)
StockRecruitement = as.data.frame(Rj)
return (Rj)
}
plot(temperature, StockRecruitementRelationship (temperature, 84810, numberOfSpawner),
type="l",
xlab =" Temperature (°C)",
ylab = "Number Of Recruits")
#-----------On cherche à déterminer le numbre de géniteurs survivants en fonction de la T° --------------
#Prend en compte Zsea
plot(temperature, StockRecruitementRelationship (temperature, 84810, numberOfSpawner),
type="l",
xlab =" Temperature (°C)",
ylab = "Number Of Recruits")
......@@ -75,9 +75,10 @@ public class MigrateToSea extends AquaNismsGroupProcess<DiadromousFish, Diadromo
duo.getFirst().moveTo(group.getPilot(), duo.getSecond(), group); //on d�place les poissons dans le fichier MoveTo et on d�note la destination du poisson.
}
if (displayFluxesOnConsole)
System.out.println(group.getPilot().getCurrentTime() + "; " + Time.getYear(group.getPilot()) + ";" + Time.getSeason(group.getPilot()) + ";EXPORT;"
+ basin.getName() + "; " + totalOutputFluxes);
if (displayFluxesOnConsole) {
System.out.println(group.getPilot().getCurrentTime() + "; " + Time.getYear(group.getPilot()) + ";" + Time.getSeason(group.getPilot())
+ ";EXPORT;"
+ basin.getName() + "; " + totalOutputFluxes);}
BufferedWriter bW = group.getbWForFluxes();
if ( bW != null) {
......
package species;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import environment.Basin;
import environment.RiverBasin;
import environment.SeaBasin;
import environment.Time;
import environment.Time.Season;
import fr.cemagref.simaqualife.kernel.processes.AquaNismsGroupProcess;
import species.DiadromousFish.Gender;
import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = AquaNismsGroupProcess.class)
public class PopulateBasinNetworkSeveralTimesAccordingToBasinSize extends AquaNismsGroupProcess<DiadromousFish, DiadromousFishGroup> {
private int nbFishPerSI=2500;
private double initialLength =2.;
private double etaPopulate = 40; // parameter linking surface of a basin and S_etoile; Should be superior at eta (eta = 2.4 in ReproduceAndSurviveAfterReproduction).
private int timesOfPopulate = 5;
private Season populateSeason = Season.SPRING;
public static void main(String[] args) { System.out.println((new
XStream(new DomDriver())) .toXML(new PopulateBasinNetworkSeveralTimesAccordingToBasinSize())); }
@Override
public void doProcess(DiadromousFishGroup group) {
if (Time.getNbYearFromBegin(group.getPilot()) <= timesOfPopulate && Time.getSeason(group.getPilot()) == populateSeason){
for (RiverBasin riverBasin : group.getEnvironment().getRiverBasins()){
int numberOfFemaleToPopulate = (int) Math.round(etaPopulate* riverBasin.getAccessibleSurface()) ;
int nbFemaleSI= numberOfFemaleToPopulate/nbFishPerSI ;
int nbMaleSI = nbFemaleSI;
for (int i=0; i < nbFemaleSI; i++){
group.addAquaNism(new DiadromousFish(group.getPilot(), riverBasin, initialLength, nbFishPerSI, Gender.FEMALE));
}
for (int i=0; i < nbMaleSI; i++){
group.addAquaNism(new DiadromousFish(group.getPilot(), riverBasin, initialLength, nbFishPerSI, Gender.MALE));
}
}
}
System.out.println("fem: "+ group. getFemaleSpawnerEffective()+ " \tmal"+group.getMaleSpawnerEffective());
}
}
......@@ -176,6 +176,7 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
amountPerSuperIndividual = alpha / maxNumberOfSuperIndividualPerReproduction;
// Compute the Allee effect parameters S95 and S50
S95 = eta * riverBasin.getAccessibleSurface(); // corresponds to S* in the rougier publication
S50 = S95 / ratioS95_S50;
......@@ -210,6 +211,7 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
numberOfMaleSpawnerForFirstTime += fish.getAmount();
maleSpawnersForFirstTimeAgesSum += fish.getAge() * fish.getAmount();
maleSpawnersForFirstTimeLengthsSum += fish.getLength() * fish.getAmount();
}
}
......@@ -326,7 +328,7 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
"\tZcrash="+ stockRecruitmentRelationship.getSigmaZcrash() +
"\tZ="+ riverBasin.getNativeSpawnerMortality());
System.out.println("\tStrap="+stockRecruitmentRelationship.getStockTrap(riverBasin.getNativeSpawnerMortality())+
"\tStotal="+numberOfFemaleSpawners+"\tSautochthonous="+
"\tStotal="+numberOfFemaleSpawners+"\tStotalMale="+numberOfMaleSpawners+ "\tSautochthonous="+
spawnerOriginsDuringReproduction.get(riverBasin.getName()));
/* // display effective from each catchment
......@@ -394,7 +396,7 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
riverBasin.getSpawnersForFirstTimeMeanLengths(Gender.FEMALE).push(femaleSpawnersForFirstTimeLengthsSum / numberOfFemaleSpawnerForFirstTime);
}
else {
riverBasin.getSpawnersForFirstTimeMeanAges(Gender.FEMALE).push(0.);
riverBasin.getSpawnersForFirstTimeMeanAges(Gender.MALE).push(0.);
riverBasin.getSpawnersForFirstTimeMeanLengths(Gender.MALE).push(0.);
}
if (numberOfMaleSpawnerForFirstTime>0) {
......@@ -493,10 +495,10 @@ public class ReproduceAndSurviveAfterReproductionWithDiagnose extends AquaNismsG
// -------------------------------------------------------
// display information
// -----------------------------------------------------
if (displayFluxesOnConsole)
/* if (displayFluxesOnConsole)
System.out.println(group.getPilot().getCurrentTime() + "; " + Time.getYear(group.getPilot()) + ";" + Time.getSeason(group.getPilot()) + ";IMPORT;"
+ riverBasin.getName() + ";" + fluxBefore + ";" + riverBasin.getSpawnerNumberPerGroup(group)+ "; " + totalInputFluxes);
+ riverBasin.getName() + ";" + fluxBefore + ";" + riverBasin.getSpawnerNumberPerGroup(group)+ "; " + totalInputFluxes); */
BufferedWriter bW = group.getbWForFluxes();
if ( bW != null) {
try {
......
......@@ -22,7 +22,7 @@ public class Survive extends AquaNismsGroupProcess<DiadromousFish, DiadromousFis
public double tempMinSurvivalSpawnerInRiv = 10.;
public double tempMaxSurvivalSpawnerInRiv = 23.; // DEFINIR TROIS AUTRES POUR MORTALITE
public double tempOptSurvivalSpawnerInRiv = 20.;
public double survivalProbOptGenInRiv = 1.;
public double survivalProbOptSpawnerInRiv = 1.;
//public double mortalityRateInRiver = 0.4;
public double mortalityRateInSea = 0.4;
......@@ -49,7 +49,7 @@ public class Survive extends AquaNismsGroupProcess<DiadromousFish, DiadromousFis
survivalProbability = 0.;
//System.out.println("le poisson situ� dans le bassin " + fish.getPosition().getName() + " en " + Time.getSeason() +" a un coeff de mortalit� de " + fish.getMortalityRateInRiver() + " mais � cause de la temp�rature une prob de survie de " + survivalProbability);
}else{
survivalProbability = survivalProbOptGenInRiv * tempEffectSurv;
survivalProbability = survivalProbOptSpawnerInRiv * tempEffectSurv;
//System.out.println("le poisson situ� dans le bassin " + fish.getPosition().getName() + " en " + Time.getSeason() + " a un coeff de mortalit� de " + fish.getMortalityRateInRiver() + " et donc une prob de survie de " + survivalProbability);
}
}else if (fish.getPosition().getType() == TypeBassin.SEA){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment