In [1]:
%matplotlib inline

In [20]:
import boxsimu
from boxsimu import ur

In [21]:
m_water = 1e10 * ur.kg
m_0 = 1e5 * ur.kg
flow_rate = 1e8 * ur.kg / ur.day

In [22]:
# FLUIDS
freshwater = boxsimu.Fluid('freshwater', rho=1000*ur.kg/ur.meter**3)

# VARIABLES
po4 = boxsimu.Variable('po4')

# PROCESSES
# No processes in this system

# REACTIONS
# No reactions in this system

# BOXES
lake = boxsimu.Box(
    name='lake',
    description='Little Lake',
    fluid=freshwater.q(m_water),
    variables=[po4.q(m_0)],
)

# FLOWS
inflow = boxsimu.Flow(
    name='Inflow', 
    source_box=None,
    target_box=lake,
    rate=flow_rate,
    tracer_transport=True,
    concentrations={po4: 3e-1 * ur.gram / ur.kg}, 
)

outflow = boxsimu.Flow(
    name='Outflow',
    source_box=lake,
    target_box=None,
    rate=flow_rate,
    tracer_transport=True,
)

# FLUXES
# No fluxes in this system

# BOXMODELSYSTEM
system = boxsimu.BoxModelSystem(
    name='lake_system', 
    description='Simple Lake Box Model',
    boxes=[lake,], 
    flows=[inflow, outflow,],
)

In [23]:
sol = system.solve(800*ur.day, 1*ur.day)

sol.df[:10]

sol.plot_variable_mass(po4)

sol.plot_variable_concentration(po4)


Start solving the BoxModelSystem...
- total integration time: 800 day
- dt (time step): 1 day
- number of time steps: 800
10.0%
20.0%
30.0%
40.0%
50.0%
60.0%
70.0%
80.0%
90.0%
Function "solve(...)" used 5.687s
Out[23]:
(<matplotlib.figure.Figure at 0x7fa76591d2e8>,
 <matplotlib.axes._subplots.AxesSubplot at 0x7fa76591dd68>)

In [ ]: