import model_Mussel_IbarraEtal2014 as mymodel

# load default parameters
days, dt, par, InitCond = mymodel.load_defaults()

 # run the model
output = mymodel.run_model(days,dt,InitCond,par)

# plot model
mymodel.plot_model(output)

"""
Explanation: Mussel Physiology Model
In this tutorial, we'll play with a mussel physiology model. You may want to think about it as placing one single mussel in a large pool with water. You can change the conditions of the pool... but the mussel is so little incomparison to the pool, that it would not feedback... that is, it has no impact on the concentration of phytoplankton, oxygen, etc.
The model is based on:
Ibarra, Fennel, Cullen (2014) Coupling 3-D Eulerian bio-physics (ROMS) with individual-based shellfish ecophysiology (SHELL-E): A hybrid model for carrying capacity and environmental impacts of bivalve aquaculture. Ecological Modelling 273 (2014) 63- 78
Lets load and run our "toy" mussel model. Make sure that have in your working directory the following file: model_Mussel_IbarraEtal2014.py
End of explanation
"""


# Re-load default parameters
days, dt, par, InitCond = mymodel.load_defaults()

# Change a few things
InitCond['Oxy'] = 25. #Oxygen ...note that the default is 30

 # run the model
output = mymodel.run_model(days,dt,InitCond,par)

# plot model
mymodel.plot_model(output)

"""
Explanation: You can see how our "mussel" grows and spawns 3 times in 3 years. First spawing occured at year = 2
Now lets see if we lower the Oxygen concentration of the pool.
End of explanation
"""


# Re-load default parameters
days, dt, par, InitCond = mymodel.load_defaults()

# Change a few things
InitCond['Phy'] = 0.5 #Phyto ...note that the default is 2

 # run the model
output = mymodel.run_model(days,dt,InitCond,par)

# plot model
mymodel.plot_model(output)

"""
Explanation: Yikes! The mussel doesn't like the lower oxygen concentration, it grows slower, and it does not gets the chance to spawn.
Lets reset to defaults, and lets see what happens if there is "low" food in our pool...
End of explanation
"""


# Re-load default parameters
days, dt, par, InitCond = mymodel.load_defaults()

# Change a few things
InitCond['Phy'] = 1.5 #Phyto ...note that the default is 2

 # run the model
output = mymodel.run_model(days,dt,InitCond,par)

# plot model
mymodel.plot_model(output)

"""
Explanation: Wow! Our mussel grew so slow that it even reach puberty
Lets run it again but with more phytoplankton
End of explanation
"""


# Re-load default parameters
days, dt, par, InitCond = mymodel.load_defaults()

# Change a few things
InitCond['Phy'] = 0. #Phyto ...note that the default is 2
InitCond['Zoo'] = 0. #Zoo
InitCond['SDet'] = 0. #SDet

 # run the model
output = mymodel.run_model(days,dt,InitCond,par)

# plot model
mymodel.plot_model(output)

"""
Explanation: Ok. It reached puberty at 1.5 years. But it still did not spawn after 3 years!
Let's do more. Lets see if we can starve the poor mussel. Let's say no food at all!
End of explanation
"""


# Re-load default parameters
days, dt, par, InitCond = mymodel.load_defaults()

# Change a few things
InitCond['Phy'] = 10. #Phyto ...note that the default is 2

 # run the model
output = mymodel.run_model(days,dt,InitCond,par)

# plot model
mymodel.plot_model(output)

"""
Explanation: Our mussel looses about 85% of its weight in 3 years. In reality, it probably would have died... but our model allows it to keep loosing weight, until each reaches biomass = zero. 
One more run... lets feed our mussel like a king!
End of explanation
"""


# Re-load default parameters
days, dt, par, InitCond = mymodel.load_defaults()

# Change a few things
InitCond['Temp'] = 1 #Temperature...note that the default is 10

 # run the model
output = mymodel.run_model(days,dt,InitCond,par)

# plot model
mymodel.plot_model(output)

"""
Explanation: Now our mussel spawns about 6 times per year.
One last run... lets keep feeding our mussel like a king, but decrease the temperaure to -3.5 degrees celcius (Brrr!)
End of explanation
"""


