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
63c5d978
Commit
63c5d978
authored
Apr 15, 2021
by
Poulet Camille
Browse files
Merge branch 'develop' of gitlab-ssh.irstea.fr:SimAquaLife/GR3D into exploration_GR3D_process
parents
86efa21a
95ee5985
Changes
8
Hide whitespace changes
Inline
Side-by-side
data/input/northeastamerica/fishRIOBasin_Sapidissima_Rjava.xml
View file @
63c5d978
...
...
@@ -320,8 +320,14 @@
<species.SurviveAfterReproduction>
<synchronisationMode>
ASYNCHRONOUS
</synchronisationMode>
<afterReproductionSeason>
SPRING
</afterReproductionSeason>
<survivalRateAfterReproduction>
0.1
</survivalRateAfterReproduction>
<afterReproductionSeason>
SUMMER
</afterReproductionSeason>
<maximalSurvivalRate>
0.1
</maximalSurvivalRate>
<!-- <temperatureEffectSurvivalAfterReproduction class="temperatureEffect.LogitEffect"> -->
<!-- <Tref>22</Tref> -->
<!-- <alpha>-.1</alpha> -->
<!-- </temperatureEffectSurvivalAfterReproduction> -->
<temperatureEffectSurvivalAfterReproduction
class=
"temperatureEffect.NoEffect"
>
</temperatureEffectSurvivalAfterReproduction>
</species.SurviveAfterReproduction>
<species.MigrateFromRiverToInshore>
...
...
src/main/java/species/SurviveAfterReproduction.java
View file @
63c5d978
...
...
@@ -18,8 +18,8 @@ import fr.cemagref.simaqualife.kernel.util.TransientParameters.InitTransientPara
import
fr.cemagref.simaqualife.pilot.Pilot
;
import
miscellaneous.BinomialForSuperIndividualGen
;
import
species.DiadromousFish.SpawnerOrigin
;
import
umontreal.iro.lecuyer.probdist.NormalDis
t
;
import
umontreal.iro.lecuyer.randvar.NormalGen
;
import
temperatureEffect.LogitEffec
t
;
import
temperatureEffect.TemperatureEffect
;
@ServiceProvider
(
service
=
AquaNismsGroupProcess
.
class
)
...
...
@@ -27,9 +27,14 @@ public class SurviveAfterReproduction extends AquaNismsGroupProcess<DiadromousFi
private
Season
afterReproductionSeason
=
Season
.
SUMMER
;
private
double
survivalRateAfterReproduction
=
0.1
;
/**
* maximum suvival od spawnser after reproduction
*
* @unit -
*/
private
double
maximalSurvivalRate
=
0.1
;
private
transient
NormalGen
genNormal
;
private
TemperatureEffect
temperatureEffectSurvivalAfterReproduction
;
/**
* the random numbers generator for binomial draws
...
...
@@ -39,7 +44,9 @@ public class SurviveAfterReproduction extends AquaNismsGroupProcess<DiadromousFi
private
transient
BinomialForSuperIndividualGen
aleaGen
;
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
((
new
XStream
(
new
DomDriver
())).
toXML
(
new
SurviveAfterReproduction
()));
SurviveAfterReproduction
surviveAfterReproduction
=
new
SurviveAfterReproduction
();
surviveAfterReproduction
.
temperatureEffectSurvivalAfterReproduction
=
new
LogitEffect
(
22
,
-
0.1
);
System
.
out
.
println
((
new
XStream
(
new
DomDriver
())).
toXML
(
surviveAfterReproduction
));
}
...
...
@@ -47,7 +54,6 @@ public class SurviveAfterReproduction extends AquaNismsGroupProcess<DiadromousFi
@InitTransientParameters
public
void
initTransientParameters
(
Pilot
pilot
)
{
super
.
initTransientParameters
(
pilot
);
genNormal
=
new
NormalGen
(
pilot
.
getRandomStream
(),
new
NormalDist
(
0
.,
1
.));
aleaGen
=
new
BinomialForSuperIndividualGen
(
pilot
.
getRandomStream
());
...
...
@@ -77,20 +83,25 @@ public class SurviveAfterReproduction extends AquaNismsGroupProcess<DiadromousFi
totalInputFluxes
.
get
(
origin
).
put
(
"biomass"
,
0
.);
}
// temperature effect in the riverBasin
double
currentTemperature
=
riverBasin
.
getCurrentTemperature
(
group
.
getPilot
());
double
tempEffect
=
temperatureEffectSurvivalAfterReproduction
.
getTemperatureEffect
(
currentTemperature
);
double
survivalProbability
=
maximalSurvivalRate
*
tempEffect
;
// iterate on the fish
ListIterator
<
DiadromousFish
>
fishIterator
=
fishInBasin
.
listIterator
();
while
(
fishIterator
.
hasNext
())
{
DiadromousFish
fish
=
fishIterator
.
next
();
// only on spawners
if
(
fish
.
isMature
())
{
// origin of the spwaner
SpawnerOrigin
spawnerOrigin
=
(
fish
.
getBirthBasin
()
==
riverBasin
?
SpawnerOrigin
.
AUTOCHTONOUS
:
SpawnerOrigin
.
ALLOCHTONOUS
);
// survival amount of fish
double
biomass
=
0
.;
survivalAmount
=
aleaGen
.
getSuccessNumber
(
fish
.
getAmount
(),
survival
RateAfterReproduction
);
survivalAmount
=
aleaGen
.
getSuccessNumber
(
fish
.
getAmount
(),
survival
Probability
);
// at least one fish in the SI survive, the other die
if
(
survivalAmount
>
0
)
{
...
...
src/main/java/temperatureEffect/LogitEffect.java
0 → 100644
View file @
63c5d978
/**
* patrick
* @author Patrick Lambert
* @copyright Copyright (c) 2020, INRAE
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
temperatureEffect
;
/**
*
*/
public
class
LogitEffect
implements
TemperatureEffect
{
/**
*
* @unit
*/
private
static
final
long
serialVersionUID
=
3756752294442116413L
;
/**
* temperature reference used to calculate the effect
*
* @unit °C
*/
private
double
Tref
=
20
.;
/**
* parameter used to calculate the effect
*
* @unit °C
*/
private
double
alpha
=
0.1
;
@Override
public
double
getTemperatureEffect
(
double
temperature
)
{
return
1
.
/
(
1
.
+
Math
.
exp
(-
alpha
*
(
temperature
-
Tref
)));
}
public
LogitEffect
(
double
Tref
,
double
alpha
)
{
super
();
this
.
Tref
=
Tref
;
this
.
alpha
=
alpha
;
}
}
src/main/java/temperatureEffect/NoEffect.java
0 → 100644
View file @
63c5d978
/**
* patrick
* @author Patrick Lambert
* @copyright Copyright (c) 2020, INRAE
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
temperatureEffect
;
/**
*
*/
public
class
NoEffect
implements
TemperatureEffect
{
/**
*
* @unit
*/
private
static
final
long
serialVersionUID
=
-
7686765011254676763L
;
@Override
public
double
getTemperatureEffect
(
double
temperature
)
{
return
1
.;
}
public
NoEffect
(
double
Tref
,
double
alpha
)
{
super
();
}
}
src/main/java/temperatureEffect/RectangularTemperatureEffect.java
0 → 100644
View file @
63c5d978
/**
* patrick
* @author Patrick Lambert
* @copyright Copyright (c) 2020, INRAE
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
temperatureEffect
;
/**
*
*/
public
class
RectangularTemperatureEffect
implements
TemperatureEffect
{
/**
*
* @unit
*/
private
static
final
long
serialVersionUID
=
-
611999636717694259L
;
/**
* minimal temperature . Below this value, the temperature effect is 0
*
* @unit °C
*/
private
double
Tmin
;
/**
* maximal temperature. Above this value, the temperature effect is 0
*
* @unit °C
*/
private
double
Tmax
;
@Override
public
double
getTemperatureEffect
(
double
temperature
)
{
if
(
temperature
<=
Tmin
||
temperature
>=
Tmax
)
{
return
0
;
}
else
{
return
1
;
}
}
public
RectangularTemperatureEffect
(
double
tmin
,
double
tmax
)
{
super
();
this
.
Tmin
=
tmin
;
this
.
Tmax
=
tmax
;
}
}
src/main/java/temperatureEffect/Rosso.java
0 → 100644
View file @
63c5d978
/**
* patrick
* @author Patrick Lambert
* @copyright Copyright (c) 2020, INRAE
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
temperatureEffect
;
/**
*
*/
public
class
Rosso
implements
TemperatureEffect
{
/**
*
* @unit
*/
private
static
final
long
serialVersionUID
=
-
2646246167644233819L
;
/**
* minimal temperature . Below this value, the temperature effect is 0
*
* @unit °C
*/
private
double
Tmin
;
/**
* optimal temperature. At this value, the temperature effect is 1
*
* @unit °C
*/
private
double
Topt
;
/**
* maximal temperature. Above this value, the temperature effect is 0
*
* @unit °C
*/
private
double
Tmax
;
@Override
public
double
getTemperatureEffect
(
double
temperature
)
{
if
(
temperature
<=
Tmin
||
temperature
>=
Tmax
)
{
return
0
;
}
else
{
return
(
temperature
-
Tmin
)
*
(
temperature
-
Tmax
)
/
((
temperature
-
Tmin
)
*
(
temperature
-
Tmax
)
-
((
temperature
-
Topt
)
*
(
temperature
-
Topt
)));
}
}
public
Rosso
(
double
tmin
,
double
topt
,
double
tmax
)
{
super
();
this
.
Tmin
=
tmin
;
this
.
Topt
=
topt
;
this
.
Tmax
=
tmax
;
}
}
src/main/java/temperatureEffect/TemperatureEffect.java
0 → 100644
View file @
63c5d978
/**
* patrick
* @author Patrick Lambert
* @copyright Copyright (c) 2020, INRAE
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
temperatureEffect
;
import
java.io.Serializable
;
/**
*
*/
public
interface
TemperatureEffect
extends
Serializable
{
public
double
getTemperatureEffect
(
double
temperature
);
}
src/main/java/temperatureEffect/package-info.java
0 → 100644
View file @
63c5d978
/**
* patrick
* @author Patrick Lambert
* @copyright Copyright (c) 2020, INRAE
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
*
*/
package
temperatureEffect
;
\ No newline at end of file
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